本文整理汇总了PHP中SMWOutputs::requireFromParserOutput方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWOutputs::requireFromParserOutput方法的具体用法?PHP SMWOutputs::requireFromParserOutput怎么用?PHP SMWOutputs::requireFromParserOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMWOutputs
的用法示例。
在下文中一共展示了SMWOutputs::requireFromParserOutput方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: embedWiki
public static function embedWiki($input, $argv)
{
// if(!ETParserFunctions::$inlineParser) {
// global $wgParserConf;
// ETParserFunctions::$inlineParser = wfCreateObject( $wgParserConf['class'], array( $wgParserConf ) );
// }
global $wgParser;
if ($wgParser->getTitle() instanceof Title && $wgParser->getOptions() instanceof ParserOptions) {
$result = $wgParser->recursiveTagParse($input);
} else {
global $wgTitle;
$popt = new ParserOptions();
$popt->setEditSection(false);
$pout = $wgParser->parse($input . '__NOTOC__', $wgTitle, $popt);
// / NOTE: as of MW 1.14SVN, there is apparently no better way to hide the TOC
SMWOutputs::requireFromParserOutput($pout);
$result = $pout->getText();
}
return $result;
}
示例2: handleNonFileResult
/**
* Continuation of getResult that only gets executed for non file outputs.
*
* @since 1.6
*
* @param string $result
* @param SMWQueryResult $results
* @param integer $outputmode
*
* @return string
*/
protected function handleNonFileResult($result, SMWQueryResult $results, $outputmode)
{
/**
* @var \Parser $wgParser
*/
global $wgParser, $smwgEnabledResultFormatsWithRecursiveAnnotationSupport;
$result .= $this->getErrorString($results);
// append errors
// Apply intro parameter
if ($this->mIntro && $results->getCount() > 0) {
if ($outputmode == SMW_OUTPUT_HTML && $wgParser->getTitle() instanceof Title) {
global $wgParser;
$result = $wgParser->recursiveTagParse($this->mIntro) . $result;
} else {
$result = $this->mIntro . $result;
}
}
// Apply outro parameter
if ($this->mOutro && $results->getCount() > 0) {
if ($outputmode == SMW_OUTPUT_HTML && $wgParser->getTitle() instanceof Title) {
$result = $result . $wgParser->recursiveTagParse($this->mOutro);
} else {
$result = $result . $this->mOutro;
}
}
// Preprocess embedded templates if needed
if (!$this->isHTML && $this->hasTemplates) {
if ($wgParser->getTitle() instanceof Title && $wgParser->getOptions() instanceof ParserOptions) {
self::$mRecursionDepth++;
if (self::$mRecursionDepth <= self::$maxRecursionDepth) {
// restrict recursion
$result = in_array($this->params['format'], $smwgEnabledResultFormatsWithRecursiveAnnotationSupport) ? $wgParser->recursivePreprocess($result) : '[[SMW::off]]' . $wgParser->replaceVariables($result) . '[[SMW::on]]';
} else {
$result = '';
/// TODO: explain problem (too much recursive parses)
}
self::$mRecursionDepth--;
} else {
// not during parsing, no preprocessing needed, still protect the result
$result = in_array($this->params['format'], $smwgEnabledResultFormatsWithRecursiveAnnotationSupport) ? $result : '[[SMW::off]]' . $result . '[[SMW::on]]';
}
}
if ($this->isHTML && $outputmode == SMW_OUTPUT_WIKI) {
$result = array($result, 'isHTML' => true);
} elseif (!$this->isHTML && $outputmode == SMW_OUTPUT_HTML) {
self::$mRecursionDepth++;
// check whether we are in an existing parse, or if we should start a new parse for $wgTitle
if (self::$mRecursionDepth <= self::$maxRecursionDepth) {
// retrict recursion
if ($wgParser->getTitle() instanceof Title && $wgParser->getOptions() instanceof ParserOptions) {
$result = $wgParser->recursiveTagParse($result);
} else {
global $wgTitle;
$popt = new ParserOptions();
$popt->setEditSection(false);
$pout = $wgParser->parse($result . '__NOTOC__', $wgTitle, $popt);
/// NOTE: as of MW 1.14SVN, there is apparently no better way to hide the TOC
\SMWOutputs::requireFromParserOutput($pout);
$result = $pout->getText();
}
} else {
$result = '';
/// TODO: explain problem (too much recursive parses)
}
self::$mRecursionDepth--;
}
return $result;
}
示例3: onOutputPageParserOutput
/**
* This hook copies SMW's custom data from the given ParserOutput object to
* the given OutputPage object, since otherwise it is not possible to access
* it later on to build a Factbox.
*
* @param OutputPage $outputpage
* @param ParserOutput $parseroutput
*
* @return true
*/
public static function onOutputPageParserOutput(OutputPage $outputpage, ParserOutput $parseroutput)
{
global $wgParser;
$factbox = SMWFactbox::getFactboxTextFromOutput($parseroutput, $outputpage->getTitle());
if ($factbox !== '') {
$popts = new ParserOptions();
$po = $wgParser->parse($factbox, $outputpage->getTitle(), $popts);
$outputpage->mSMWFactboxText = $po->getText();
// do not forget to grab the outputs header items
SMWOutputs::requireFromParserOutput($po);
SMWOutputs::commitToOutputPage($outputpage);
}
// else: nothing shown, don't even set any text
return true;
}
示例4: smwf_nm_NotifyAccess
function smwf_nm_NotifyAccess( $method, $params ) {
$p_array = explode( ",", $params );
global $smwgQEnabled;
$result = "Query disabled.";
if ( $method == "updateMail" ) {
global $wgUser;
$wgUser->setOption( 'enotifyme', $params );
$wgUser->saveSettings();
return wfMsg( 'smw_nm_ajax_mailupdate' );
}
elseif ( $method == "addNotify" ) {
if ( $smwgQEnabled ) {
$result = SMWNotifyProcessor::addNotify( str_replace( '&', '&', str_replace( ',', ',', $p_array[0] ) ),
str_replace( '&', '&', str_replace( ',', ',', $p_array[3] ) ),
$p_array[1], $p_array[2], implode( ",", array_slice( $p_array, 4 ) ) );
}
return $result;
}
elseif ( $method == "getQueryResult" ) {
if ( $smwgQEnabled ) {
$params .= '
| format=table
| link=all';
// parse params and answer query
SMWQueryProcessor::processFunctionParams( SMWNotifyProcessor::getQueryRawParams( $params ), $querystring, $params, $printouts );
$result = SMWQueryProcessor::getResultFromQueryString( $querystring, $params, $printouts, SMW_OUTPUT_WIKI );
switch ( $params->format ) {
case 'timeline':
return $result;
break;
case 'eventline':
return $result;
break;
case 'googlepie':
return $result[0];
break;
case 'googlebar':
return $result[0];
break;
case 'exhibit':
return $result;
break;
default:
}
global $wgParser;
if ( ( $wgParser->getTitle() instanceof Title ) && ( $wgParser->getOptions() instanceof ParserOptions ) ) {
$result = $wgParser->recursiveTagParse( $result );
} else {
global $wgTitle;
$popt = new ParserOptions();
$popt->setEditSection( false );
$pout = $wgParser->parse( $result . '__NOTOC__', $wgTitle, $popt );
// / NOTE: as of MW 1.14SVN, there is apparently no better way to hide the TOC
SMWOutputs::requireFromParserOutput( $pout );
$result = $pout->getText();
}
// add target="_new" for all links
$pattern = "|<a|i";
$result = preg_replace( $pattern, '<a target="_new"', $result );
}
return $result;
}
elseif ( $method == "updateStates" ) {
if ( $smwgQEnabled ) {
$result = SMWNotifyProcessor::updateStates( $p_array );
}
return $result;
}
elseif ( $method == "updateReportAll" ) {
if ( $smwgQEnabled ) {
$result = SMWNotifyProcessor::updateReportAll( $p_array );
}
return $result;
}
elseif ( $method == "updateShowAll" ) {
if ( $smwgQEnabled ) {
$result = SMWNotifyProcessor::updateShowAll( $p_array );
}
return $result;
}
elseif ( $method == "updateDelegates" ) {
if ( $smwgQEnabled ) {
$result = SMWNotifyProcessor::updateDelegates( explode( "|", $params ) );
}
return $result;
}
elseif ( $method == "delNotify" ) {
if ( $smwgQEnabled ) {
$result = SMWNotifyProcessor::delNotify( $p_array );
}
return $result;
}
else {
return wfMsg( 'smw_nm_ajax_fail' );
}
//.........这里部分代码省略.........
示例5: handleNonFileResult
/**
* Continuation of getResult that only gets executed for non file outputs.
*
* @since 1.6
*
* @param string $result
* @param SMWQueryResult $results
* @param integer $outputmode
*
* @return string
*/
protected function handleNonFileResult($result, SMWQueryResult $results, $outputmode)
{
/**
* @var \Parser $wgParser
*/
global $wgParser;
$result .= $this->getErrorString($results);
// append errors
// MW 1.21+
// Block recursive import of annotations unless otherwise specified for
// a specific use case
if (method_exists($wgParser->getOutput(), 'setExtensionData')) {
$wgParser->getOutput()->setExtensionData('smw-blockannotation', $this->params['format'] === 'embedded');
}
// Apply intro parameter
if ($this->mIntro && $results->getCount() > 0) {
if ($outputmode == SMW_OUTPUT_HTML) {
$result = Message::get(array('smw-parse', $this->mIntro), Message::PARSE) . $result;
} else {
$result = $this->mIntro . $result;
}
}
// Apply outro parameter
if ($this->mOutro && $results->getCount() > 0) {
if ($outputmode == SMW_OUTPUT_HTML) {
$result = $result . Message::get(array('smw-parse', $this->mOutro), Message::PARSE);
} else {
$result = $result . $this->mOutro;
}
}
// Preprocess embedded templates if needed
if (!$this->isHTML && $this->hasTemplates) {
if ($wgParser->getTitle() instanceof Title && $wgParser->getOptions() instanceof ParserOptions) {
self::$mRecursionDepth++;
if (self::$mRecursionDepth <= self::$maxRecursionDepth) {
// restrict recursion
$result = isset($this->params['import-annotation']) && $this->params['import-annotation'] ? $wgParser->recursivePreprocess($result) : '[[SMW::off]]' . $wgParser->replaceVariables($result) . '[[SMW::on]]';
} else {
$result = '';
/// TODO: explain problem (too much recursive parses)
}
self::$mRecursionDepth--;
} else {
// not during parsing, no preprocessing needed, still protect the result
$result = isset($this->params['import-annotation']) && $this->params['import-annotation'] ? $result : '[[SMW::off]]' . $result . '[[SMW::on]]';
}
}
if ($this->isHTML && $outputmode == SMW_OUTPUT_WIKI) {
$result = array($result, 'isHTML' => true);
} elseif (!$this->isHTML && $outputmode == SMW_OUTPUT_HTML) {
self::$mRecursionDepth++;
// check whether we are in an existing parse, or if we should start a new parse for $wgTitle
if (self::$mRecursionDepth <= self::$maxRecursionDepth) {
// retrict recursion
if ($wgParser->getTitle() instanceof Title && $wgParser->getOptions() instanceof ParserOptions) {
$result = $wgParser->recursiveTagParse($result);
} else {
global $wgTitle;
$popt = new ParserOptions();
$popt->setEditSection(false);
$pout = $wgParser->parse($result . '__NOTOC__', $wgTitle, $popt);
/// NOTE: as of MW 1.14SVN, there is apparently no better way to hide the TOC
\SMWOutputs::requireFromParserOutput($pout);
$result = $pout->getText();
}
} else {
$result = '';
/// TODO: explain problem (too much recursive parses)
}
self::$mRecursionDepth--;
}
if (method_exists($wgParser->getOutput(), 'setExtensionData')) {
$wgParser->getOutput()->setExtensionData('smw-blockannotation', false);
}
return $result;
}
示例6: parseWikiText
/**
* function content copied from SMWResultPrinter::getResult(). Using the constant
* SMW_OUTPUT_HTML doesn't always work. Details see bug #10494
*
* @param string wikitext
* @return string html
*/
function parseWikiText($text)
{
global $wgParser;
if ($wgParser->getTitle() instanceof Title && $wgParser->getOptions() instanceof ParserOptions) {
$result = $wgParser->recursiveTagParse($text);
} else {
global $wgTitle;
$popt = new ParserOptions();
$popt->setEditSection(false);
$pout = $wgParser->parse($text . '__NOTOC__', $wgTitle, $popt);
/// NOTE: as of MW 1.14SVN, there is apparently no better way to hide the TOC
SMWOutputs::requireFromParserOutput($pout);
$result = $pout->getText();
}
return $result;
}