var $mParseWarnings = array();
var $mSquidMaxage = 0;
var $mRevisionId = null;
- var $mPageIcons = array();
protected $mTitle = null;
/**
$this->addCategoryLinks( $parserOutput->getCategories() );
$this->mNewSectionLink = $parserOutput->getNewSection();
$this->mHideNewSectionLink = $parserOutput->getHideNewSection();
- $this->mPageIcons = $parserOutput->getPageIcons();
$this->mParseWarnings = $parserOutput->getWarnings();
if ( !$parserOutput->isCacheable() ) {
$tpl->set( 'pageclass', $this->getPageClasses( $this->mTitle ) );
$tpl->set( 'skinnameclass', ( 'skin-' . Sanitizer::escapeClass( $this->getSkinName() ) ) );
- $icons = '';
- foreach( $out->mPageIcons as $icon ) {
- list( $file, $alt ) = $icon;
- $fileAttr = array( 'src' => $file->createThumb( 16 ) );
- if( $alt != '' ) {
- $msg = wfMsg( $alt );
- if( !wfEmptyMsg( $alt ) ) {
- $alt = $msg;
- }
- $fileAttr['alt'] = htmlspecialchars( $alt );
- }
- $icons .= Html::element( 'img', $fileAttr ) . " ";
- }
- $tpl->set( 'pageicons', $icons );
-
$nsname = MWNamespace::exists( $this->mTitle->getNamespace() ) ?
MWNamespace::getCanonicalName( $this->mTitle->getNamespace() ) :
$this->mTitle->getNsText();
$parser->setFunctionHook( 'subjectpagenamee', array( __CLASS__, 'subjectpagenamee' ), SFH_NO_HASH );
$parser->setFunctionHook( 'tag', array( __CLASS__, 'tagObj' ), SFH_OBJECT_ARGS );
$parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) );
- $parser->setFunctionHook( 'pageicon', array( __CLASS__, 'pageicon' ) );
if ( $wgAllowDisplayTitle ) {
$parser->setFunctionHook( 'displaytitle', array( __CLASS__, 'displaytitle' ), SFH_NO_HASH );
}
}
- public static function pageicon( $parser, $name = '', $alt = '' ) {
- $file = wfFindFile( $name );
- if( $file ) {
- $parser->mOutput->addPageIcon( $file, $alt );
- }
- return '';
- }
-
/**
* Parser function to extension tag adaptor
*/
$mSections = array(), # Table of contents
$mProperties = array(), # Name/value pairs to be cached in the DB
$mTOCHTML = ''; # HTML of the TOC
- private $mIndexPolicy = '', # 'index' or 'noindex'? Any other value will result in no change.
- $mPageIcons = array(); # Array of icons to show for the page (like Protect, Featured, etc)
+ private $mIndexPolicy = ''; # 'index' or 'noindex'? Any other value will result in no change.
function ParserOutput( $text = '', $languageLinks = array(), $categoryLinks = array(),
$containsOldMagic = false, $titletext = '' )
function getWarnings() { return array_keys( $this->mWarnings ); }
function getIndexPolicy() { return $this->mIndexPolicy; }
function getTOCHTML() { return $this->mTOCHTML; }
- function getPageIcons() { return $this->mPageIcons; }
function containsOldMagic() { return $this->mContainsOldMagic; }
function setText( $text ) { return wfSetVar( $this->mText, $text ); }
}
}
- /**
- * Add page icons to the parser output.
- * @param File $file A valid file
- * @param String $alt Alt text, if any
- */
- function addPageIcon( $file, $alt = '' ) {
- $this->mPageIcons[] = array( $file, $alt );
- }
-
/**
* Override the title to be used for display
* -- this is assumed to have been validated
'url_path' => array( 0, 'PATH' ),
'url_wiki' => array( 0, 'WIKI' ),
'url_query' => array( 0, 'QUERY' ),
- 'pageicon' => array( 1, 'pageicon' ),
);
/**