Manual:WikiPage.php
MediaWiki ファイル: WikiPage.php | |
---|---|
場所: | includes/page/ |
ソース コード: | master • 1.40.0 • 1.39.4 • 1.35.11 |
クラス: | WikiPage • Page |
WikiPage
クラスは、MediaWiki のページとその履歴を表現します。
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 Article class handles the business and presentation functions.
If you have an Article object, you can get a WikiPage object using Article::getPage()
.
WikiPageオブジェクトの作成
To instantiate WikiPage
, call one of the static factory methods:
WikiPage::factory( $title )
-$title
は Title のインスタンスWikiPage::newFromId( $id )
-$id
はページ IDWikiPage::newFromRow( $row )
- where$row
is a row fetched from the database containing all the fields listed inWikiPage::selectFields()
.
メソッド
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 );
メソッドの完全な一覧については https://doc.wikimedia.org/mediawiki-core/master/php/classWikiPage.html を参照してください。
Accessors
getTitle()
- Get the title object of the article.