65 $sect =
$wgParser->getSection( $text, $sectionId,
false );
67 if ( $sect ===
false ) {
70 return new static(
$sect );
86 $sectionModelId = $with->getModel();
88 if ( $sectionModelId != $myModelId ) {
89 throw new MWException(
"Incompatible content model for section: " .
90 "document uses $myModelId but " .
91 "section uses $sectionModelId." );
95 $text = $with->getText();
97 if (
strval( $sectionId ) ===
'' ) {
101 if ( $sectionId ===
'new' ) {
102 # Inserting a new section
103 $subject = $sectionTitle ?
wfMessage(
'newsectionheaderdefaultlevel' )
104 ->plaintextParams( $sectionTitle )->inContentLanguage()->text() .
"\n\n" :
'';
105 if ( Hooks::run(
'PlaceNewSection', [ $this, $oldtext, $subject, &$text ] ) ) {
107 ?
"{$oldtext}\n\n{$subject}{$text}"
108 :
"{$subject}{$text}";
111 # Replacing an existing section; roll out the big guns
114 $text =
$wgParser->replaceSection( $oldtext, $sectionId, $text );
117 $newContent =
new static( $text );
131 $text =
wfMessage(
'newsectionheaderdefaultlevel' )
132 ->rawParams(
$header )->inContentLanguage()->text();
136 return new static( $text );
153 $pst =
$wgParser->preSaveTransform( $text, $title, $user, $popts );
155 if ( $text === $pst ) {
161 if (
$wgParser->getOutput()->getFlag(
'user-signature' ) ) {
162 $ret->hadSignature =
true;
184 return new static(
$plt );
199 if ( $this->redirectTargetAndText !==
null ) {
200 return $this->redirectTargetAndText;
205 $this->redirectTargetAndText = [
null, $this->
getText() ];
206 return $this->redirectTargetAndText;
209 $redir = MediaWikiServices::getInstance()->getMagicWordFactory()->get(
'redirect' );
211 if ( $redir->matchStartAndRemove( $text ) ) {
216 if (
preg_match(
'!^\s*:?\s*\[{2}(.*?)(?:\|.*?)?\]{2}\s*!', $text, $m ) ) {
219 if (
strpos( $m[1],
'%' ) !==
false ) {
223 $title = Title::newFromText( $m[1] );
226 $this->redirectTargetAndText = [
null, $this->
getText() ];
227 return $this->redirectTargetAndText;
231 return $this->redirectTargetAndText;
235 $this->redirectTargetAndText = [
null, $this->
getText() ];
236 return $this->redirectTargetAndText;
270 # Remember that redirect pages can have categories, templates, etc.,
271 # so the regex has to be fairly general
274 $this->getText(), 1 );
298 if ( $hasLinks ===
null ) { # not known, find out
300 $context = RequestContext::getMain();
305 $links = $po->getLinks();
306 $hasLinks = !empty( $links );
320 $truncatedtext = parent::getTextForSummary( $maxlength );
322 # clean up unfinished links
323 # XXX: make this optional? wasn't there in autosummary, but required for
325 $truncatedtext =
preg_replace(
'/\[\[([^\]]*)\]?$/',
'$1', $truncatedtext );
347 if ( $this->previousParseStackTrace ) {
351 $logger = LoggerFactory::getInstance(
'DuplicateParse' );
353 __METHOD__ .
': Possibly redundant parse!',
355 'title' => $title->getPrefixedDBkey(),
357 'options-hash' =>
$options->optionsHash(
358 ParserOptions::allCacheVaryingOptions(),
361 'trace' => $stackTrace,
362 'previous-trace' => $this->previousParseStackTrace,
375 if ( $generateHtml ) {
381 $output->addModuleStyles(
'mediawiki.action.view.redirectPage' );
386 if ( $this->hadSignature ) {
387 $output->setFlag(
'user-signature' );
396 "getHtml() not implemented for wikitext. "
397 .
"Use getParserOutput()->getText()."
411 return $word->match( $this->
getText() );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
and give any other recipients of the Program a copy of this License along with the Program You may charge a fee for the physical act of transferring a copy
$wgMaxRedirects
Max number of redirects to follow when resolving redirects.
$wgArticleCountMethod
Method used to determine if a page in a content namespace should be counted as a valid article.
getParserOutput(Title $title, $revId=null, ParserOptions $options=null, $generateHtml=true)
Returns a ParserOutput object containing information derived from this content.
static getRedirectHeaderHtml(Language $lang, $target, $forceKnown=false)
Return the HTML for the top of a redirect page.
This class encapsulates "magic words" such as "#redirect", NOTOC, etc.
Set options of the Parser.
Content object implementation for representing flat text.
getText()
Returns the text represented by this Content object, as a string.
Represents a title within MediaWiki.
getFullText()
Get the prefixed title with spaces, plus any fragment (part beginning with '#')
isValidRedirectTarget()
Check if this Title is a valid redirect target.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Content object for wiki text pages.
updateRedirect(Title $target)
This implementation replaces the first link on the page with the given new target if this Content obj...
getRedirectTarget()
Implement redirect extraction for wikitext.
array null $previousParseStackTrace
Stack trace of the previous parse.
getTextForSummary( $maxlength=250)
preloadTransform(Title $title, ParserOptions $popts, $params=[])
Returns a Content object with preload transformations applied (or this object if no transformations a...
fillParserOutput(Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
Returns a ParserOutput object resulting from parsing the content's text using $wgParser.
getRedirectTargetAndText()
Extract the redirect target and the remaining text on the page.
addSectionHeader( $header)
Returns a new WikitextContent object with the given section heading prepended.
isCountable( $hasLinks=null, Title $title=null)
Returns true if this content is not a redirect, and this content's text is countable according to the...
matchMagicWord(MagicWord $word)
This implementation calls $word->match() on the this TextContent object's text.
bool $hadSignature
Tracks if the parser set the user-signature flag when creating this content, which would make it expi...
preSaveTransform(Title $title, User $user, ParserOptions $popts)
Returns a Content object with pre-save transformations applied using Parser::preSaveTransform().
replaceSection( $sectionId, Content $with, $sectionTitle='')
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
namespace and then decline to actually register it file or subcat img or subcat $title
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place $output
const CONTENT_MODEL_WIKITEXT
Base interface for content objects.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))