Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Embedded.php |
— | — | @@ -37,20 +37,13 @@ |
38 | 38 | } |
39 | 39 | |
40 | 40 | protected function getResultText($res,$outputmode) { |
41 | | - global $smwgEmbeddingList, $wgParser; |
42 | | - if (!is_array($smwgEmbeddingList)) { // catch recursions (sometimes more restrictive than needed, but normal usage is not affected) |
43 | | - $firstrun = true; |
44 | | - $smwgEmbeddingList = array(); |
45 | | - // No page should embed itself: |
46 | | - if ($wgParser->getTitle() instanceof Title) { |
47 | | - $smwgEmbeddingList[] = $wgParser->getTitle()->getPrefixedText(); |
48 | | - } else { |
49 | | - global $wgTitle; |
50 | | - $smwgEmbeddingList[] = $wgTitle->getPrefixedText(); |
51 | | - } |
52 | | - $oldEmbeddingList = false; |
53 | | - } else { |
54 | | - $oldEmbeddingList = array_values($smwgEmbeddingList); |
| 41 | + global $wgParser; |
| 42 | + // No page should embed itself, find out who we are: |
| 43 | + if ($wgParser->getTitle() instanceof Title) { |
| 44 | + $title = $wgParser->getTitle()->getPrefixedText(); |
| 45 | + } else { // this is likely to be in vain -- this case is typical if we run on special pages |
| 46 | + global $wgTitle; |
| 47 | + $title = $wgTitle->getPrefixedText(); |
55 | 48 | } |
56 | 49 | |
57 | 50 | // print header |
— | — | @@ -86,8 +79,7 @@ |
87 | 80 | if ($this->m_showhead) { |
88 | 81 | $result .= $headstart . $text . $headend; |
89 | 82 | } |
90 | | - if (!in_array($object->getLongWikiText(), $smwgEmbeddingList)) { // prevent recursion! |
91 | | - $smwgEmbeddingList[] = $object->getLongWikiText(); |
| 83 | + if ($object->getLongWikiText() != $title) { |
92 | 84 | if ($object->getNamespace() == NS_MAIN) { |
93 | 85 | $articlename = ':' . $object->getDBkey(); |
94 | 86 | } else { |
— | — | @@ -121,11 +113,6 @@ |
122 | 114 | } |
123 | 115 | $result .= $footer; |
124 | 116 | |
125 | | - if (is_array($oldEmbeddingList)) { |
126 | | - $smwgEmbeddingList = array_values($oldEmbeddingList); |
127 | | - } else { |
128 | | - $smwgEmbeddingList = false; |
129 | | - } |
130 | 117 | return $result; |
131 | 118 | } |
132 | 119 | } |