Page MenuHomePhabricator

Intersection-DynamicPageList.diff

Authored By
bzimport
Nov 21 2014, 10:03 PM
Size
2 KB
Referenced Files
None
Subscribers
None

Intersection-DynamicPageList.diff

Index: intersection/DynamicPageList.php
===================================================================
--- intersection/DynamicPageList.php (revisjon 33116)
+++ intersection/DynamicPageList.php (arbeidskopi)
@@ -62,6 +62,8 @@
// The callback function for converting the input text to HTML output
function DynamicPageList( $input ) {
+ global $wgParser;
+ global $wgMessageCache;
global $wgUser;
global $wgLang;
global $wgContLang;
@@ -70,6 +72,7 @@
$aParams = array();
$bCountSet = false;
+ $bLinkObject = true;
$sStartList = '<ul>';
$sEndList = '</ul>';
@@ -160,12 +163,28 @@
$sEndItem = '</li>';
break;
case 'unordered':
- default:
$sStartList = '<ul>';
$sEndList = '</ul>';
$sStartItem = '<li>';
$sEndItem = '</li>';
break;
+ default:
+ if ($sArg) {
+ $tpl = $wgMessageCache->getMsgFromNamespace('Intersection-' . $sArg);
+ if (!$tpl) $tpl = '&lt;' . $sArg . '&gt;';
+ $sStartList = '';
+ $sEndList = '';
+ $sStartItem = '{{' . $tpl . '|';
+ $sEndItem = '}}';
+ $bLinkObject = false;
+ }
+ else {
+ $sStartList = '<ul>';
+ $sEndList = '</ul>';
+ $sStartItem = '<li>';
+ $sEndItem = '</li>';
+ }
+ break;
}
}
else if ('order' == $sType)
@@ -367,18 +386,28 @@
while ($row = $dbr->fetchObject( $res ) ) {
$title = Title::makeTitle( $row->page_namespace, $row->page_title);
$output .= $sStartItem;
- if (true == $bAddFirstCategoryDate)
- $output .= $wgLang->date($row->cl_timestamp) . ': ';
- if (true == $bShowNamespace)
- $output .= $sk->makeKnownLinkObj($title);
- else
- $output .= $sk->makeKnownLinkObj($title, htmlspecialchars($title->getText()));
+ if (true == $bLinkObject) {
+ if (true == $bAddFirstCategoryDate)
+ $output .= $wgLang->date($row->cl_timestamp) . ': ';
+ if (true == $bShowNamespace)
+ $output .= $sk->makeKnownLinkObj($title);
+ else
+ $output .= $sk->makeKnownLinkObj($title, htmlspecialchars($title->getText()));
+ }
+ else {
+ if (true == $bShowNamespace)
+ $output .= $title;
+ else
+ $output .= $title->getText();
+ if (true == $bAddFirstCategoryDate)
+ $output .= '|' . $wgLang->date($row->cl_timestamp);
+ }
$output .= $sEndItem . "\n";
}
//end unordered list
$output .= $sEndList . "\n";
- return $output;
+ return (true == $bLinkObject ? $output : $wgParser->recursiveTagParse($output));
}

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4213
Default Alt Text
Intersection-DynamicPageList.diff (2 KB)

Event Timeline