MediaWiki file: | WikiPage.php|
---|---|
Location: | includes/page/ |
Source code: | master • 1.40.0 • 1.39.4 • 1.35.11 |
Classes: | WikiPage • Page |
The WikiPage
class represents a MediaWiki page and its history.
It encapsulates access to page information stored in the database, and allows access to properties such as page text (in Wikitext format), flags, etc.
In theory, WikiPage is supposed to be the model object for pages, while the ArticleArticle::getPage()
.
Creating a new WikiPage object
To instantiate WikiPage
, call one of the static factory methods:
WikiPage::factory( $title )
- where$title
is a Title instance.WikiPage::newFromId( $id )
- where$id
is a page id.WikiPage::newFromRow( $row )
- where$row
is a row fetched from the database containing all the fields listed inWikiPage::selectFields()
.
Methods
getContent( $audience )
: Get the content of the latest revision, where $audience is one of:RevisionRecord::FOR_PUBLIC
- to be displayed to all usersRevisionRecord::FOR_THIS_USER
- to be displayed to$wgUser
RevisionRecord::RAW
- get the text regardless of permissions
- To get the text of the latest revision, use:
$content = $wikiPage->getContent( RevisionRecord::RAW ); $text = ContentHandler::getContentText( $content );
See https://doc.wikimedia.org/mediawiki-core/master/php/classWikiPage.html for a complete lists of methods.
Accessors
getTitle()
- Get the title object of the article.
See also
- Manual:Code
- Manual:Coding conventions
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.