PageHistory Class Reference

This class handles printing the history page for an article. More...

List of all members.

Public Member Functions

 __construct ($article)
 Construct a new PageHistory.
 getArticle ()
 getTitle ()
 preCacheMessages ()
 As we use the same small set of messages in various methods and that they are called often, we call them once and save them in $this->message.
 history ()
 Print the history page for an article.
 beginHistoryList ()
 Creates begin of history list with a submit button.
 endHistoryList ()
 Creates end of history list with a submit button.
 submitButton ($message, $attributes=array())
 Creates a submit button.
 historyLine ($row, $next, $counter= '', $notificationtimestamp=false, $latest=false, $firstInList=false)
 Returns a row from the history printout.
 revLink ($rev)
 Create a link to view this revision of the page.
 curLink ($rev, $latest)
 Create a diff-to-current link for this revision for this page.
 lastLink ($prevRev, $next, $counter)
 Create a diff-to-previous link for this revision for this page.
 diffButtons ($rev, $firstInList, $counter)
 Create radio buttons for page history.
 fetchRevisions ($limit, $offset, $direction)
 Fetch an array of revisions, specified by a given limit, offset and direction.
 feed ($type)
 Output a subscription feed listing recent edits to this page.
 feedEmpty ()
 feedItem ($row)
 Generate a FeedItem object from a given revision table row Borrows Recent Changes' feed generation functions for formatting; includes a diff to the previous revision (if any).

Public Attributes

const DIR_PREV = 0
const DIR_NEXT = 1
 $mArticle
 $mTitle
 $mSkin
 $lastdate
 $linesonpage
 $mLatestId = null

Private Attributes

 $mOldIdChecked = 0


Detailed Description

This class handles printing the history page for an article.

In order to be efficient, it uses timestamps rather than offsets for paging, to avoid costly LIMIT,offset queries.

Construct it by passing in an Article, and call $h->history() to print the history.

Definition at line 18 of file PageHistory.php.


Constructor & Destructor Documentation

PageHistory::__construct ( article  ) 

Construct a new PageHistory.

Parameters:
Article $article
Returns:
nothing

Definition at line 35 of file PageHistory.php.

References $wgUser, and preCacheMessages().


Member Function Documentation

PageHistory::beginHistoryList (  ) 

Creates begin of history list with a submit button.

Returns:
string HTML output

Definition at line 155 of file PageHistory.php.

References $s, $wgEnableHtmlDiff, $wgScript, $wgTitle, Xml::hidden(), Xml::openElement(), submitButton(), wfMsg(), and wfMsgExt().

Referenced by history().

PageHistory::curLink ( rev,
latest 
)

Create a diff-to-current link for this revision for this page.

Parameters:
Revision $rev
Bool $latest, this is the latest revision of the page?
Returns:
string

Definition at line 367 of file PageHistory.php.

References Revision::DELETED_TEXT.

Referenced by historyLine().

PageHistory::diffButtons ( rev,
firstInList,
counter 
)

Create radio buttons for page history.

Parameters:
object $rev Revision
bool $firstInList Is this version the first one?
int $counter A counter of what row number we're at, counted from the top row = 1.
Returns:
string HTML output for the radio buttons

Definition at line 411 of file PageHistory.php.

References $counter, Revision::DELETED_TEXT, and Xml::element().

Referenced by historyLine().

PageHistory::endHistoryList (  ) 

Creates end of history list with a submit button.

Returns:
string HTML output

Definition at line 195 of file PageHistory.php.

References $s, $wgEnableHtmlDiff, submitButton(), and wfMsg().

Referenced by history().

PageHistory::feed ( type  ) 

Output a subscription feed listing recent edits to this page.

Parameters:
string $type

Definition at line 474 of file PageHistory.php.

References $row, $type, $wgFeedClasses, $wgFeedLimit, $wgRequest, FeedUtils::checkFeedOutput(), DIR_NEXT, feedEmpty(), feedItem(), fetchRevisions(), and wfMsgForContent().

Referenced by history().

PageHistory::feedEmpty (  ) 

Definition at line 505 of file PageHistory.php.

References $wgOut, wfMsgForContent(), and wfTimestamp().

Referenced by feed().

PageHistory::feedItem ( row  ) 

Generate a FeedItem object from a given revision table row Borrows Recent Changes' feed generation functions for formatting; includes a diff to the previous revision (if any).

Parameters:
$row 
Returns:
FeedItem

Definition at line 524 of file PageHistory.php.

References $row, $text, $title, $wgContLang, FeedUtils::formatDiffRow(), FeedItem::stripComment(), and wfMsgForContent().

Referenced by feed().

PageHistory::fetchRevisions ( limit,
offset,
direction 
)

Fetch an array of revisions, specified by a given limit, offset and direction.

This is now only used by the feeds. It was previously used by the main UI but that's now handled by the pager.

Definition at line 446 of file PageHistory.php.

References $dbr, $offset, DIR_PREV, Revision::selectFields(), and wfGetDB().

Referenced by feed().

PageHistory::getArticle (  ) 

Definition at line 43 of file PageHistory.php.

PageHistory::getTitle (  ) 

Definition at line 47 of file PageHistory.php.

PageHistory::history (  ) 

PageHistory::historyLine ( row,
next,
counter = '',
notificationtimestamp = false,
latest = false,
firstInList = false 
)

Returns a row from the history printout.

Todo:
document some more, and maybe clean up the code (some params redundant?)
Parameters:
Row $row The database row corresponding to the previous line.
mixed $next The database row corresponding to the next line.
int $counter Apparently a counter of what row number we're at, counted from the top row = 1.
$notificationtimestamp 
bool $latest Whether this row corresponds to the page's latest revision.
bool $firstInList Whether this row corresponds to the first displayed on this history page.
Returns:
string HTML output for the row

Definition at line 255 of file PageHistory.php.

References $classes, $counter, $del, $row, $s, $size, $wgLang, $wgUser, curLink(), Revision::DELETED_RESTRICTED, Revision::DELETED_TEXT, diffButtons(), Xml::element(), ChangeTags::formatSummaryRow(), lastLink(), revLink(), Xml::tags(), wfMsg(), wfMsgHtml(), and wfRunHooks().

PageHistory::lastLink ( prevRev,
next,
counter 
)

Create a diff-to-previous link for this revision for this page.

Parameters:
Revision $prevRev, the previous revision
mixed $next, the newer revision
int $counter, what row on the history list this is
Returns:
string

Definition at line 384 of file PageHistory.php.

References Revision::DELETED_TEXT.

Referenced by historyLine().

PageHistory::preCacheMessages (  ) 

As we use the same small set of messages in various methods and that they are called often, we call them once and save them in $this->message.

Definition at line 55 of file PageHistory.php.

References $msg, and wfMsgExt().

Referenced by __construct().

PageHistory::revLink ( rev  ) 

Create a link to view this revision of the page.

Parameters:
Revision $rev
Returns:
string

Definition at line 350 of file PageHistory.php.

References $wgLang, Revision::DELETED_TEXT, and wfTimestamp().

Referenced by historyLine().

PageHistory::submitButton ( message,
attributes = array() 
)

Creates a submit button.

Parameters:
array $attributes attributes
Returns:
string HTML output for the submit button

Definition at line 233 of file PageHistory.php.

Referenced by beginHistoryList(), endHistoryList(), and history().


Member Data Documentation

PageHistory::$lastdate

Definition at line 23 of file PageHistory.php.

PageHistory::$linesonpage

Definition at line 24 of file PageHistory.php.

PageHistory::$mArticle

Definition at line 22 of file PageHistory.php.

PageHistory::$mLatestId = null

Definition at line 25 of file PageHistory.php.

PageHistory::$mOldIdChecked = 0 [private]

Definition at line 27 of file PageHistory.php.

PageHistory::$mSkin

Definition at line 22 of file PageHistory.php.

PageHistory::$mTitle

Definition at line 22 of file PageHistory.php.

Definition at line 20 of file PageHistory.php.

Referenced by feed().

Definition at line 19 of file PageHistory.php.

Referenced by fetchRevisions().


The documentation for this class was generated from the following file:

Generated on Sat Sep 5 02:08:43 2009 for MediaWiki by  doxygen 1.5.9