dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Stop mangling $_GET and provide WebRequest::getQueryValuesOnly()"
[lhc/web/wiklou.git]
/
includes
/
content
/
TextContent.php
diff --git
a/includes/content/TextContent.php
b/includes/content/TextContent.php
index
0198a0d
..
54a57a5
100644
(file)
--- a/
includes/content/TextContent.php
+++ b/
includes/content/TextContent.php
@@
-73,7
+73,7
@@
class TextContent extends AbstractContent {
}
public function getTextForSummary( $maxlength = 250 ) {
}
public function getTextForSummary( $maxlength = 250 ) {
- $text = $this->get
NativeData
();
+ $text = $this->get
Text
();
$truncatedtext = MediaWikiServices::getInstance()->getContentLanguage()->
truncateForDatabase( preg_replace( "/[\n\r]/", ' ', $text ), max( 0, $maxlength ) );
$truncatedtext = MediaWikiServices::getInstance()->getContentLanguage()->
truncateForDatabase( preg_replace( "/[\n\r]/", ' ', $text ), max( 0, $maxlength ) );
@@
-87,7
+87,7
@@
class TextContent extends AbstractContent {
* @return int
*/
public function getSize() {
* @return int
*/
public function getSize() {
- $text = $this->get
NativeData
();
+ $text = $this->get
Text
();
return strlen( $text );
}
return strlen( $text );
}
@@
-118,9
+118,22
@@
class TextContent extends AbstractContent {
/**
* Returns the text represented by this Content object, as a string.
*
/**
* Returns the text represented by this Content object, as a string.
*
- * @return string The raw text.
+ * @deprecated since 1.33 use getText() instead.
+ *
+ * @return string The raw text. Subclasses may guarantee a specific syntax here.
*/
public function getNativeData() {
*/
public function getNativeData() {
+ return $this->getText();
+ }
+
+ /**
+ * Returns the text represented by this Content object, as a string.
+ *
+ * @since 1.33
+ *
+ * @return string The raw text.
+ */
+ public function getText() {
return $this->mText;
}
return $this->mText;
}
@@
-130,7
+143,7
@@
class TextContent extends AbstractContent {
* @return string The raw text.
*/
public function getTextForSearchIndex() {
* @return string The raw text.
*/
public function getTextForSearchIndex() {
- return $this->get
NativeData
();
+ return $this->get
Text
();
}
/**
}
/**
@@
-142,10
+155,12
@@
class TextContent extends AbstractContent {
* @return string|bool The raw text, or false if the conversion failed.
*/
public function getWikitextForTransclusion() {
* @return string|bool The raw text, or false if the conversion failed.
*/
public function getWikitextForTransclusion() {
+ /** @var WikitextContent $wikitext */
$wikitext = $this->convert( CONTENT_MODEL_WIKITEXT, 'lossy' );
$wikitext = $this->convert( CONTENT_MODEL_WIKITEXT, 'lossy' );
+ '@phan-var WikitextContent $wikitext';
if ( $wikitext ) {
if ( $wikitext ) {
- return $wikitext->get
NativeData
();
+ return $wikitext->get
Text
();
} else {
return false;
}
} else {
return false;
}
@@
-181,7
+196,7
@@
class TextContent extends AbstractContent {
* @return Content
*/
public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) {
* @return Content
*/
public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) {
- $text = $this->get
NativeData
();
+ $text = $this->get
Text
();
$pst = self::normalizeLineEndings( $text );
return ( $text === $pst ) ? $this : new static( $pst, $this->getModel() );
$pst = self::normalizeLineEndings( $text );
return ( $text === $pst ) ? $this : new static( $pst, $this->getModel() );
@@
-201,15
+216,16
@@
class TextContent extends AbstractContent {
*/
public function diff( Content $that, Language $lang = null ) {
$this->checkModelID( $that->getModel() );
*/
public function diff( Content $that, Language $lang = null ) {
$this->checkModelID( $that->getModel() );
-
+ /** @var self $that */
+ '@phan-var self $that';
// @todo could implement this in DifferenceEngine and just delegate here?
if ( !$lang ) {
$lang = MediaWikiServices::getInstance()->getContentLanguage();
}
// @todo could implement this in DifferenceEngine and just delegate here?
if ( !$lang ) {
$lang = MediaWikiServices::getInstance()->getContentLanguage();
}
- $otext = $this->get
NativeData
();
- $ntext = $that->get
NativeData
();
+ $otext = $this->get
Text
();
+ $ntext = $that->get
Text
();
# Note: Use native PHP diff, external engines don't give us abstract output
$ota = explode( "\n", $lang->segmentForDiff( $otext ) );
# Note: Use native PHP diff, external engines don't give us abstract output
$ota = explode( "\n", $lang->segmentForDiff( $otext ) );
@@
-240,11
+256,12
@@
class TextContent extends AbstractContent {
protected function fillParserOutput( Title $title, $revId,
ParserOptions $options, $generateHtml, ParserOutput &$output
) {
protected function fillParserOutput( Title $title, $revId,
ParserOptions $options, $generateHtml, ParserOutput &$output
) {
- global $wg
Parser, $wg
TextModelsToParse;
+ global $wgTextModelsToParse;
if ( in_array( $this->getModel(), $wgTextModelsToParse ) ) {
// parse just to get links etc into the database, HTML is replaced below.
if ( in_array( $this->getModel(), $wgTextModelsToParse ) ) {
// parse just to get links etc into the database, HTML is replaced below.
- $output = $wgParser->parse( $this->getNativeData(), $title, $options, true, true, $revId );
+ $output = MediaWikiServices::getInstance()->getParser()
+ ->parse( $this->getText(), $title, $options, true, true, $revId );
}
if ( $generateHtml ) {
}
if ( $generateHtml ) {
@@
-291,7
+308,7
@@
class TextContent extends AbstractContent {
* @return string An HTML representation of the content
*/
protected function getHighlightHtml() {
* @return string An HTML representation of the content
*/
protected function getHighlightHtml() {
- return htmlspecialchars( $this->get
NativeData
() );
+ return htmlspecialchars( $this->get
Text
() );
}
/**
}
/**
@@
-318,7
+335,7
@@
class TextContent extends AbstractContent {
if ( $toHandler instanceof TextContentHandler ) {
// NOTE: ignore content serialization format - it's just text anyway.
if ( $toHandler instanceof TextContentHandler ) {
// NOTE: ignore content serialization format - it's just text anyway.
- $text = $this->get
NativeData
();
+ $text = $this->get
Text
();
$converted = $toHandler->unserializeContent( $text );
}
$converted = $toHandler->unserializeContent( $text );
}