}
if( is_null( $this->mTitle ) ) {
+ wfProfileOut( $fname );
+ wfProfileOut( $fname.'-setup' );
throw new MWException( __METHOD__.": \$this->mTitle is null\n" );
}
$nottalk = !$this->mTitle->isTalkPage();
# should be external links.
if (preg_match('/^\b(?:' . wfUrlProtocols() . ')/', $m[1])) {
$s .= $prefix . '[[' . $line ;
+ wfProfileOut( "$fname-misc" );
continue;
}
# Special and Media are pseudo-namespaces; no pages actually exist in them
if( $ns == NS_MEDIA ) {
- $link = $sk->makeMediaLinkObj( $nt, $text );
+ # Give extensions a chance to select the file revision for us
+ $skip = $time = false;
+ wfRunHooks( 'BeforeParserMakeImageLinkObj', array( &$this, &$nt, &$skip, &$time ) );
+ if ( $skip ) {
+ $link = $sk->makeLinkObj( $nt );
+ } else {
+ $link = $sk->makeMediaLinkObj( $nt, $text, $time );
+ }
# Cloak with NOPARSE to avoid replacement in replaceExternalLinks
$s .= $prefix . $this->armorLinks( $link ) . $trail;
$this->mOutput->addImage( $nt->getDBkey() );
}
}
+ /**
+ * Increment the expensive function count
+ *
+ * @return boolean False if the limit has been exceeded
+ */
+ function incrementExpensiveFunctionCount() {
+ global $wgExpensiveParserFunctionLimit;
+ $this->mExpensiveFunctionCount++;
+ if($this->mExpensiveFunctionCount <= $wgExpensiveParserFunctionLimit) {
+ return true;
+ }
+ return false;
+ }
+
/**
* Strip double-underscore items like __NOGALLERY__ and __NOTOC__
* Fills $this->mDoubleUnderscores, returns the modified text