[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/diff/ -> DifferenceEngine.php (summary)

User interface for the difference engine. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 1372 lines (41 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

DifferenceEngine:: (37 methods):
  __construct()
  setReducedLineNumbers()
  getDiffLang()
  wasCacheHit()
  getOldid()
  getNewid()
  deletedLink()
  deletedIdMarker()
  showMissingRevision()
  showDiffPage()
  markPatrolledLink()
  revisionDeleteLink()
  renderNewRevision()
  getParserOutput()
  showDiff()
  showDiffStyle()
  getDiff()
  getDiffBody()
  getDiffBodyCacheKey()
  generateContentDiffBody()
  generateDiffBody()
  generateTextDiffBody()
  debug()
  localiseLineNumbers()
  localiseLineNumbersCb()
  getMultiNotice()
  intermediateEditsMsg()
  getRevisionHeader()
  addHeader()
  setText()
  setContent()
  setTextLanguage()
  mapDiffPrevNext()
  loadRevisionIds()
  loadRevisionData()
  loadText()
  loadNewText()


Class: DifferenceEngine  - X-Ref


__construct( $context = null, $old = 0, $new = 0, $rcid = 0,$refreshCache = false, $unhide = false)   X-Ref
Constructor

param: IContextSource $context Context to use, anything else will be ignored
param: int $old Old ID we want to show and diff with.
param: string|int $new Either revision ID or 'prev' or 'next'. Default: 0.
param: int $rcid Deprecated, no longer used!
param: bool $refreshCache If set, refreshes the diff cache
param: bool $unhide If set, allow viewing deleted revs

setReducedLineNumbers( $value = true )   X-Ref

param: bool $value

getDiffLang()   X-Ref

return: Language

wasCacheHit()   X-Ref

return: bool

getOldid()   X-Ref

return: int

getNewid()   X-Ref

return: bool|int

deletedLink( $id )   X-Ref
Look up a special:Undelete link to the given deleted revision id,
as a workaround for being unable to load deleted diffs in currently.

param: int $id Revision ID
return: mixed URL or false

deletedIdMarker( $id )   X-Ref
Build a wikitext link toward a deleted revision, if viewable.

param: int $id Revision ID
return: string Wikitext fragment

showMissingRevision()   X-Ref
No description

showDiffPage( $diffOnly = false )   X-Ref
No description

markPatrolledLink()   X-Ref
Get a link to mark the change as patrolled, or '' if there's either no
revision to patrol or the user is not allowed to to it.
Side effect: When the patrol link is build, this method will call
OutputPage::preventClickjacking() and load mediawiki.page.patrol.ajax.

return: string

revisionDeleteLink( $rev )   X-Ref

param: Revision $rev
return: string

renderNewRevision()   X-Ref
Show the new revision of the page.


getParserOutput( WikiPage $page, Revision $rev )   X-Ref
No description

showDiff( $otitle, $ntitle, $notice = '' )   X-Ref
Get the diff text, send it to the OutputPage object
Returns false if the diff could not be generated, otherwise returns true

param: string|bool $otitle Header for old text or false
param: string|bool $ntitle Header for new text or false
param: string $notice HTML between diff header and body
return: bool

showDiffStyle()   X-Ref
Add style sheets and supporting JS for diff display.


getDiff( $otitle, $ntitle, $notice = '' )   X-Ref
Get complete diff table, including header

param: string|bool $otitle Header for old text or false
param: string|bool $ntitle Header for new text or false
param: string $notice HTML between diff header and body
return: mixed

getDiffBody()   X-Ref
Get the diff table body, without header

return: mixed (string/false)

getDiffBodyCacheKey()   X-Ref
Returns the cache key for diff body text or content.

return: string

generateContentDiffBody( Content $old, Content $new )   X-Ref
Generate a diff, no caching.

This implementation uses generateTextDiffBody() to generate a diff based on the default
serialization of the given Content objects. This will fail if $old or $new are not
instances of TextContent.

Subclasses may override this to provide a different rendering for the diff,
perhaps taking advantage of the content's native form. This is required for all content
models that are not text based.

param: Content $old Old content
param: Content $new New content
return: bool|string

generateDiffBody( $otext, $ntext )   X-Ref
Generate a diff, no caching

param: string $otext Old text, must be already segmented
param: string $ntext New text, must be already segmented
return: bool|string

generateTextDiffBody( $otext, $ntext )   X-Ref
Generate a diff, no caching

param: string $otext Old text, must be already segmented
param: string $ntext New text, must be already segmented
return: bool|string

debug( $generator = "internal" )   X-Ref
Generate a debug comment indicating diff generating time,
server node, and generator backend.

param: string $generator : What diff engine was used
return: string

localiseLineNumbers( $text )   X-Ref
Replace line numbers with the text in the user's language

param: string $text
return: mixed

localiseLineNumbersCb( $matches )   X-Ref
No description

getMultiNotice()   X-Ref
If there are revisions between the ones being compared, return a note saying so.

return: string

intermediateEditsMsg( $numEdits, $numUsers, $limit )   X-Ref
Get a notice about how many intermediate edits and users there are

param: int $numEdits
param: int $numUsers
param: int $limit
return: string

getRevisionHeader( Revision $rev, $complete = '' )   X-Ref
Get a header for a specified revision.

param: Revision $rev
param: string $complete 'complete' to get the header wrapped depending
return: string HTML fragment

addHeader( $diff, $otitle, $ntitle, $multi = '', $notice = '' )   X-Ref
Add the header to a diff body

param: string $diff Diff body
param: string $otitle Old revision header
param: string $ntitle New revision header
param: string $multi Notice telling user that there are intermediate
param: string $notice Other notices, e.g. that user is viewing deleted content
return: string

setText( $oldText, $newText )   X-Ref
Use specified text instead of loading from the database


setContent( Content $oldContent, Content $newContent )   X-Ref
Use specified text instead of loading from the database

param: Content $oldContent
param: Content $newContent

setTextLanguage( $lang )   X-Ref
Set the language in which the diff text is written
(Defaults to page content language).

param: Language|string $lang

mapDiffPrevNext( $old, $new )   X-Ref
Maps a revision pair definition as accepted by DifferenceEngine constructor
to a pair of actual integers representing revision ids.

param: int $old Revision id, e.g. from URL parameter 'oldid'
param: int|string $new Revision id or strings 'next' or 'prev', e.g. from URL parameter 'diff'
return: int[] List of two revision ids, older first, later second.

loadRevisionIds()   X-Ref
Load revision IDs


loadRevisionData()   X-Ref
Load revision metadata for the specified articles. If newid is 0, then compare
the old article in oldid to the current article; if oldid is 0, then
compare the current article to the immediately previous one (ignoring the
value of newid).

If oldid is false, leave the corresponding revision object set
to false. This is impossible via ordinary user input, and is provided for
API convenience.

return: bool

loadText()   X-Ref
Load the text of the revisions, as well as revision data.

return: bool

loadNewText()   X-Ref
Load the text of the new revision, not the old one

return: bool



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1