本文整理汇总了PHP中SMWOutputs::commitToOutputPage方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWOutputs::commitToOutputPage方法的具体用法?PHP SMWOutputs::commitToOutputPage怎么用?PHP SMWOutputs::commitToOutputPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMWOutputs
的用法示例。
在下文中一共展示了SMWOutputs::commitToOutputPage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Main entry point for Special Pages
*
* @param[in] $query string Given by MediaWiki
*/
public function execute($query)
{
global $wgRequest, $wgOut, $smwgBrowseShowAll;
$this->setHeaders();
// get the GET parameters
$this->articletext = $wgRequest->getVal('article');
// no GET parameters? Then try the URL
if (is_null($this->articletext)) {
$params = SMWInfolink::decodeParameters($query, false);
reset($params);
$this->articletext = current($params);
}
$this->subject = SMWDataValueFactory::newTypeIDValue('_wpg', $this->articletext);
$offsettext = $wgRequest->getVal('offset');
$this->offset = is_null($offsettext) ? 0 : intval($offsettext);
$dir = $wgRequest->getVal('dir');
if ($smwgBrowseShowAll) {
$this->showoutgoing = true;
$this->showincoming = true;
}
if ($dir === 'both' || $dir === 'in') {
$this->showincoming = true;
}
if ($dir === 'in') {
$this->showoutgoing = false;
}
if ($dir === 'out') {
$this->showincoming = false;
}
$wgOut->addHTML($this->displayBrowse());
SMWOutputs::commitToOutputPage($wgOut);
// make sure locally collected output data is pushed to the output!
}
示例2: execute
/**
* Main entrypoint for the special page.
*
* @param string $p
*/
public function execute($p)
{
global $wgOut, $wgRequest, $smwgQEnabled;
$wgOut->addModules('ext.smw.style');
$wgOut->addModules('ext.smw.ask');
$wgOut->addModules('ext.smw.property');
$this->setHeaders();
if (!$smwgQEnabled) {
$wgOut->addHTML('<br />' . wfMessage('smw_iq_disabled')->escaped());
} else {
if ($wgRequest->getCheck('showformatoptions')) {
// handle Ajax action
$format = $wgRequest->getVal('showformatoptions');
$params = $wgRequest->getArray('params');
$wgOut->disable();
echo $this->showFormatOptions($format, $params);
} else {
$this->extractQueryParameters($p);
$this->makeHTMLResult();
}
}
$this->addExternalHelpLinkFor('smw_ask_doculink');
SMWOutputs::commitToOutputPage($wgOut);
// make sure locally collected output data is pushed to the output!
}
示例3: render
/**
* Method for handling the set_recurring_event parser function.
*
* @since 1.5.3
*
* @param Parser $parser
*/
public static function render( Parser &$parser ) {
$params = func_get_args();
array_shift( $params ); // We already know the $parser ...
// Almost all of the work gets done by
// getDatesForRecurringEvent().
$results = self::getDatesForRecurringEvent( $params );
if ( $results == null ) {
return null;
}
list( $property_name, $all_date_strings, $unused_params ) = $results;
// Do the actual saving of the data.
foreach ( $all_date_strings as $date_str ) {
SMWParseData::addProperty( $property_name, $date_str, false, $parser, true );
}
global $wgTitle;
if ( !is_null( $wgTitle ) && $wgTitle->isSpecialPage() ) {
global $wgOut;
SMWOutputs::commitToOutputPage( $wgOut );
}
else {
SMWOutputs::commitToParser( $parser );
}
}
示例4: showList
/**
* Main method for adding all additional HTML to the output stream.
*/
protected function showList()
{
global $wgOut, $wgRequest;
$this->from = $wgRequest->getVal('from', '');
$this->until = $wgRequest->getVal('until', '');
if ($this->initParameters()) {
$wgOut->addHTML($this->getHtml());
SMWOutputs::commitToOutputPage($wgOut);
}
}
示例5: execute
/**
* Main entry point for the special page.
*
* @param string $query Given by MediaWiki
*/
public function execute($query)
{
global $wgOut;
$this->setHeaders();
$this->processParameters($query);
$wgOut->addHTML($this->displaySearchByProperty());
$wgOut->addHTML($this->queryForm());
// push locally collected output data to the output
SMWOutputs::commitToOutputPage($wgOut);
}
示例6: execute
public function execute($param)
{
wfProfileIn('smwfDoSpecialUnusedProperties (SMW)');
global $wgOut;
$wgOut->setPageTitle(wfMsg('unusedproperties'));
$rep = new SMWUnusedPropertiesPage();
list($limit, $offset) = wfCheckLimits();
$rep->doQuery($offset, $limit);
// Ensure locally collected output data is pushed to the output!
SMWOutputs::commitToOutputPage($wgOut);
wfProfileOut('smwfDoSpecialUnusedProperties (SMW)');
}
示例7: showList
/**
* Main method for adding all additional HTML to the output stream.
*/
protected function showList()
{
global $wgOut, $wgRequest;
wfProfileIn(__METHOD__ . ' (SMW)');
$this->from = $wgRequest->getVal('from', '');
$this->until = $wgRequest->getVal('until', '');
if ($this->initParameters()) {
$wgOut->addHTML("<br id=\"smwfootbr\"/>\n" . $this->getHtml());
SMWOutputs::commitToOutputPage($wgOut);
}
wfProfileOut(__METHOD__ . ' (SMW)');
}
示例8: render
/**
* Method for handling the declare parser function.
*
* @since 1.5.3
*
* @param Parser $parser
* @param PPFrame $frame
* @param array $args
*/
public static function render(Parser &$parser, PPFrame $frame, array $args)
{
if ($frame->isTemplate()) {
foreach ($args as $arg) {
if (trim($arg) !== '') {
$expanded = trim($frame->expand($arg));
$parts = explode('=', $expanded, 2);
if (count($parts) == 1) {
$propertystring = $expanded;
$argumentname = $expanded;
} else {
$propertystring = $parts[0];
$argumentname = $parts[1];
}
$property = SMWPropertyValue::makeUserProperty($propertystring);
$argument = $frame->getArgument($argumentname);
$valuestring = $frame->expand($argument);
if ($property->isValid()) {
$type = $property->getPropertyTypeID();
if ($type == '_wpg') {
$matches = array();
preg_match_all('/\\[\\[([^\\[\\]]*)\\]\\]/u', $valuestring, $matches);
$objects = $matches[1];
if (count($objects) == 0) {
if (trim($valuestring) !== '') {
SMWParseData::addProperty($propertystring, $valuestring, false, $parser, true);
}
} else {
foreach ($objects as $object) {
SMWParseData::addProperty($propertystring, $object, false, $parser, true);
}
}
} elseif (trim($valuestring) !== '') {
SMWParseData::addProperty($propertystring, $valuestring, false, $parser, true);
}
// $value = SMWDataValueFactory::newPropertyObjectValue( $property->getDataItem(), $valuestring );
// if (!$value->isValid()) continue;
}
}
}
} else {
// @todo Save as metadata
}
global $wgTitle;
if (!is_null($wgTitle) && $wgTitle->isSpecialPage()) {
global $wgOut;
SMWOutputs::commitToOutputPage($wgOut);
} else {
SMWOutputs::commitToParser($parser);
}
return '';
}
示例9: render
/**
* Renders and returns the output.
* @see ParserHook::render
*
* @since 1.7
*
* @param array $parameters
*
* @return string
*/
public function render(array $parameters)
{
/**
* Non-escaping is safe bacause a user's message is passed through parser, which will
* handle unsafe HTM elements.
*/
$result = smwfEncodeMessages(array($parameters['message']), $parameters['icon'], ' <!--br-->', false);
if (!is_null($this->parser->getTitle()) && $this->parser->getTitle()->isSpecialPage()) {
global $wgOut;
SMWOutputs::commitToOutputPage($wgOut);
} else {
SMWOutputs::commitToParser($this->parser);
}
return $result;
}
示例10: execute
public function execute($param)
{
global $wgOut;
$params = SMWInfolink::decodeParameters($param, false);
$typeLabel = reset($params);
if ($typeLabel == false) {
$wgOut->setPageTitle(wfMessage('types')->text());
$html = $this->getTypesList();
} else {
$typeName = str_replace('_', ' ', $typeLabel);
$wgOut->setPageTitle($typeName);
// Maybe add a better message for this
$html = $this->getTypeProperties($typeLabel);
}
$wgOut->addHTML($html);
SMWOutputs::commitToOutputPage($wgOut);
}
示例11: render
/**
* Method for handling the ask concept function.
*
* @todo The possible use of this in an HTML or Specal page context needs to be revisited. The code mentions it, but can this actually happen?
* @todo The escaping of symbols in concept queries needs to be revisited.
*
* @since 1.5.3
*
* @param Parser $parser
*/
public static function render(Parser &$parser)
{
global $wgContLang, $wgTitle;
$title = $parser->getTitle();
$pconc = new SMWDIProperty('_CONC');
if ($title->getNamespace() != SMW_NS_CONCEPT) {
$result = smwfEncodeMessages(array(wfMsgForContent('smw_no_concept_namespace')));
SMWOutputs::commitToParser($parser);
return $result;
} elseif (count(SMWParseData::getSMWdata($parser)->getPropertyValues($pconc)) > 0) {
$result = smwfEncodeMessages(array(wfMsgForContent('smw_multiple_concepts')));
SMWOutputs::commitToParser($parser);
return $result;
}
// process input:
$params = func_get_args();
array_shift($params);
// We already know the $parser ...
// Use first parameter as concept (query) string.
$concept_input = str_replace(array('>', '<'), array('>', '<'), array_shift($params));
// second parameter, if any, might be a description
$concept_docu = array_shift($params);
// NOTE: the str_replace above is required in MediaWiki 1.11, but not in MediaWiki 1.14
$query = SMWQueryProcessor::createQuery($concept_input, SMWQueryProcessor::getProcessedParams(array('limit' => 20, 'format' => 'list')), SMWQueryProcessor::CONCEPT_DESC);
$concept_text = $query->getDescription()->getQueryString();
if (!is_null(SMWParseData::getSMWData($parser))) {
$diConcept = new SMWDIConcept($concept_text, $concept_docu, $query->getDescription()->getQueryFeatures(), $query->getDescription()->getSize(), $query->getDescription()->getDepth());
SMWParseData::getSMWData($parser)->addPropertyObjectValue($pconc, $diConcept);
}
// display concept box:
$rdflink = SMWInfolink::newInternalLink(wfMsgForContent('smw_viewasrdf'), $wgContLang->getNsText(NS_SPECIAL) . ':ExportRDF/' . $title->getPrefixedText(), 'rdflink');
SMWOutputs::requireResource('ext.smw.style');
// TODO: escape output, preferably via Html or Xml class.
$result = '<div class="smwfact"><span class="smwfactboxhead">' . wfMsgForContent('smw_concept_description', $title->getText()) . (count($query->getErrors()) > 0 ? ' ' . smwfEncodeMessages($query->getErrors()) : '') . '</span>' . '<span class="smwrdflink">' . $rdflink->getWikiText() . '</span>' . '<br />' . ($concept_docu ? "<p>{$concept_docu}</p>" : '') . '<pre>' . str_replace('[', '[', $concept_text) . "</pre>\n</div>";
if (!is_null($wgTitle) && $wgTitle->isSpecialPage()) {
global $wgOut;
SMWOutputs::commitToOutputPage($wgOut);
} else {
SMWOutputs::commitToParser($parser);
}
return $result;
}
示例12: render
/**
* Method for handling the ask parser function.
*
* @since 1.5.3
*
* @param Parser $parser
*/
public static function render(Parser &$parser)
{
global $smwgQEnabled, $smwgIQRunningNumber, $wgTitle;
if ($smwgQEnabled) {
$smwgIQRunningNumber++;
$params = func_get_args();
array_shift($params);
// We already know the $parser ...
$result = SMWQueryProcessor::getResultFromFunctionParams($params, SMW_OUTPUT_WIKI);
} else {
$result = smwfEncodeMessages(array(wfMessage('smw_iq_disabled')->inContentLanguage()->text()));
}
if (!is_null($wgTitle) && $wgTitle->isSpecialPage()) {
global $wgOut;
SMWOutputs::commitToOutputPage($wgOut);
} else {
SMWOutputs::commitToParser($parser);
}
return $result;
}
示例13: render
/**
* Method for handling the show parser function.
*
* @since 1.5.3
*
* @param Parser $parser
*/
public static function render(Parser &$parser)
{
global $smwgQEnabled, $smwgIQRunningNumber, $wgTitle;
if ($smwgQEnabled) {
$smwgIQRunningNumber++;
$rawParams = func_get_args();
array_shift($rawParams);
// We already know the $parser ...
list($query, $params) = SMWQueryProcessor::getQueryAndParamsFromFunctionParams($rawParams, SMW_OUTPUT_WIKI, SMWQueryProcessor::INLINE_QUERY, true);
$result = SMWQueryProcessor::getResultFromQuery($query, $params, SMW_OUTPUT_WIKI, SMWQueryProcessor::INLINE_QUERY);
$queryKey = hash('md4', implode('|', $rawParams), false);
SMWAsk::addQueryData($queryKey, $query, $params, $parser);
} else {
$result = smwfEncodeMessages(array(wfMessage('smw_iq_disabled')->inContentLanguage()->text()));
}
if (!is_null($wgTitle) && $wgTitle->isSpecialPage()) {
global $wgOut;
SMWOutputs::commitToOutputPage($wgOut);
} else {
SMWOutputs::commitToParser($parser);
}
return $result;
}
示例14: execute
/**
* Main entrypoint for the special page.
*
* @param string $p
*/
public function execute($p)
{
global $wgOut, $wgRequest, $smwgQEnabled;
$this->setHeaders();
wfProfileIn('doSpecialAsk (SMW)');
if (!$smwgQEnabled) {
$wgOut->addHTML('<br />' . wfMessage('smw_iq_disabled')->text());
} else {
if ($wgRequest->getCheck('showformatoptions')) {
// handle Ajax action
$format = $wgRequest->getVal('showformatoptions');
$params = $wgRequest->getArray('params');
$wgOut->disable();
echo $this->showFormatOptions($format, $params);
} else {
$this->extractQueryParameters($p);
$this->makeHTMLResult();
}
}
SMWOutputs::commitToOutputPage($wgOut);
// make sure locally collected output data is pushed to the output!
wfProfileOut('doSpecialAsk (SMW)');
}
示例15: execute
/**
* Initialises the page. Sets the property $uiCore to the appropriate
* helper object.
*
* To create a custom UI, adding changes to makePage() is usually
* enough, but one might want to overload this method to get better
* handling of form parameters.
*
* @global OutputPage $wgOut
* @global WebRequest $wgRequest
* @global boolean $smwgQEnabled
* @param string $p the sub-page string
*/
public function execute($p)
{
global $wgOut, $wgRequest, $smwgQEnabled, $wgFeedClasses;
$this->setHeaders();
if (!$smwgQEnabled) {
$wgOut->addHTML('<br />' . wfMessage('smw_iq_disabled')->escaped());
return;
}
// Check if this request is actually an AJAX request, and handle it accodingly:
$ajaxMode = $this->processFormatOptions($wgRequest);
// If not replying to AJAX, build the UI HTML as usual:
if (!$ajaxMode) {
// Checking if a query string has been sent by using the form:
if ($this->processQueryFormBox($wgRequest) !== false) {
$params = $this->processParams();
$this->uiCore = SMWQueryUIHelper::makeForUI($this->processQueryFormBox($wgRequest), $params, array(), false);
if ($this->uiCore->getQueryString() !== '') {
$this->uiCore->execute();
}
} else {
// Query not sent via form (though maybe from "further results" link:
$this->uiCore = SMWQueryUIHelper::makeForInfoLink($p);
}
// Add RSS feed of results to the page head:
if ($this->isSyndicated() && $this->uiCore->getQueryString() !== '' && method_exists($wgOut, 'addFeedlink') && array_key_exists('rss', $wgFeedClasses)) {
$res = $this->uiCore->getResultObject();
$link = $res->getQueryLink();
$link->setParameter('rss', 'format');
$link->setParameter($this->uiCore->getLimit(), 'limit');
$wgOut->addFeedLink('rss', $link->getURl());
}
$wgOut->addHTML($this->makePage($p));
}
// Make sure locally collected output data is pushed to the output:
SMWOutputs::commitToOutputPage($wgOut);
}