* @ingroup Parser
*/
class CoreLinkFunctions {
+ /**
+ * @static
+ * @param $parser Parser_LinkHooks
+ * @return bool
+ */
static function register( $parser ) {
$parser->setLinkHook( NS_CATEGORY, array( __CLASS__, 'categoryLinkHook' ) );
return true;
}
+ /**
+ * @static
+ * @param $parser Parser
+ * @param $holders LinkHolderArray
+ * @param $markers LinkMarkerReplacer
+ * @param Title $title
+ * @param $titleText
+ * @param null $displayText
+ * @param bool $leadingColon
+ * @return bool
+ */
static function defaultLinkHook( $parser, $holders, $markers,
Title $title, $titleText, &$displayText = null, &$leadingColon = false ) {
if( isset($displayText) && $markers->findMarker( $displayText ) ) {
return $holders->makeHolder( $title, isset($displayText) ? $displayText : $titleText, '', '', '' );
}
+ /**
+ * @static
+ * @param $parser Parser
+ * @param $holders LinkHolderArray
+ * @param $markers LinkMarkerReplacer
+ * @param Title $title
+ * @param $titleText
+ * @param null $sortText
+ * @param bool $leadingColon
+ * @return bool|string
+ */
static function categoryLinkHook( $parser, $holders, $markers,
Title $title, $titleText, &$sortText = null, &$leadingColon = false ) {
global $wgContLang;
}
}
+ /**
+ * @static
+ * @param $parser Parser
+ * @param string $part1
+ * @return array
+ */
static function intFunction( $parser, $part1 = '' /*, ... */ ) {
if ( strval( $part1 ) !== '' ) {
$args = array_slice( func_get_args(), 2 );
}
}
+ /**
+ * @static
+ * @param $parser Parser
+ * @param $date
+ * @param null $defaultPref
+ * @return mixed|string
+ */
static function formatDate( $parser, $date, $defaultPref = null ) {
$df = DateFormatter::getInstance();
return $wgContLang->ucfirst( $s );
}
+ /**
+ * @static
+ * @param $parser Parser
+ * @param string $s
+ * @return
+ */
static function lc( $parser, $s = '' ) {
global $wgContLang;
if ( is_callable( array( $parser, 'markerSkipCallback' ) ) ) {
}
}
+ /**
+ * @static
+ * @param $parser Parser
+ * @param string $s
+ * @return
+ */
static function uc( $parser, $s = '' ) {
global $wgContLang;
if ( is_callable( array( $parser, 'markerSkipCallback' ) ) ) {
}
}
+ /**
+ * @static
+ * @param $parser Parser
+ * @param string $num
+ * @param null $raw
+ * @return
+ */
static function formatNum( $parser, $num = '', $raw = null) {
if ( self::israw( $raw ) ) {
return $parser->getFunctionLang()->parseFormattedNumber( $num );
}
}
+ /**
+ * @static
+ * @param $parser Parser
+ * @param string $case
+ * @param string $word
+ * @return
+ */
static function grammar( $parser, $case = '', $word = '' ) {
return $parser->getFunctionLang()->convertGrammar( $word, $case );
}
+ /**
+ * @static
+ * @param $parser Parser
+ * @param $user User
+ * @return
+ */
static function gender( $parser, $user ) {
wfProfileIn( __METHOD__ );
$forms = array_slice( func_get_args(), 2);
wfProfileOut( __METHOD__ );
return $ret;
}
+
+ /**
+ * @static
+ * @param $parser Parser
+ * @param string $text
+ * @return
+ */
static function plural( $parser, $text = '' ) {
$forms = array_slice( func_get_args(), 2 );
$text = $parser->getFunctionLang()->parseFormattedNumber( $text );
return array( Xml::escapeTagsOnly( $content ), 'markerType' => 'nowiki' );
}
+ /**
+ * @static
+ * @param $content
+ * @param $attributes
+ * @param $parser Parser
+ * @return
+ */
static function math( $content, $attributes, $parser ) {
global $wgContLang;
return $wgContLang->armourMath( MathRenderer::renderMath( $content, $attributes, $parser->getOptions() ) );
* parsing of interwiki links, and secondly to allow all existence checks and
* article length checks (for stub links) to be bundled into a single query.
*
+ * @param $nt Title
*/
function makeHolder( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
wfProfileIn( __METHOD__ );
# Temporary
# These are variables reset at least once per parse regardless of $clearState
- var $mOptions; # ParserOptions object
+
+ /**
+ * @var ParserOptions
+ */
+ var $mOptions;
var $mTitle; # Title context, used for self-link rendering and similar things
var $mOutputType; # Output type, one of the OT_xxx constants
var $ot; # Shortcut alias, see setOutputType()
return $this->mLinkID++;
}
+ /**
+ * @return Language
+ */
function getFunctionLang() {
global $wgLang, $wgContLang;
$this->mMemc = $memCached;
}
+ /**
+ * @param $article Article
+ * @param $hash
+ * @return mixed|string
+ */
protected function getParserOutputKey( $article, $hash ) {
global $wgRequest;
return $key;
}
+ /**
+ * @param $article Article
+ * @return mixed|string
+ */
protected function getOptionsKey( $article ) {
$pageid = $article->getID();
return wfMemcKey( 'pcache', 'idoptions', "{$pageid}" );
* $article. For example give a Chinese interface to a user with
* English preferences. That's why we take into account *all* user
* options. (r70809 CR)
+ *
+ * @param $article Article
+ * @param $popts ParserOptions
*/
function getETag( $article, $popts ) {
return 'W/"' . $this->getParserOutputKey( $article,
* Used to provide a unique id for the PoolCounter.
* It would be preferable to have this code in get()
* instead of having Article looking in our internals.
+ *
+ * @param $article Article
+ * @param $popts ParserOptions
*/
public function getKey( $article, $popts, $useOutdated = true ) {
global $wgCacheEpoch;
return $value;
}
-
+ /**
+ * @param $parserOutput ParserOutput
+ * @param $article Article
+ * @param $popts ParserOptions
+ * @return void
+ */
public function save( $parserOutput, $article, $popts ) {
$expire = $parserOutput->getCacheExpiry();
var $mThumbSize; # Thumb size preferred by the user.
var $mUserLang; # Language code of the User language.
+ /**
+ * @var User
+ */
var $mUser; # Stored user object
var $mIsPreview = false; # Parsing the page for a "preview" operation
var $mIsSectionPreview = false; # Parsing the page for a "preview" operation on a single section
$this->mImages[$name] = 1;
}
+ /**
+ * @param $title Title
+ * @param $page_id
+ * @param $rev_id
+ * @return void
+ */
function addTemplate( $title, $page_id, $rev_id ) {
$ns = $title->getNamespace();
$dbk = $title->getDBkey();
* @ingroup Parser
*/
class Preprocessor_Hash implements Preprocessor {
+ /**
+ * @var Parser
+ */
var $parser;
const CACHE_VERSION = 1;
function preprocessToObj( $text, $flags = 0 ) {
wfProfileIn( __METHOD__ );
-
// Check cache.
global $wgMemc, $wgPreprocessorCacheThreshold;
var $namespaces = array( NS_MAIN );
var $showRedirects = false;
+ /**
+ * @var DatabaseBase
+ */
+ protected $db;
+
function __construct($db = null) {
if ( $db ) {
$this->db = $db;