Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php |
— | — | @@ -21,14 +21,20 @@ |
22 | 22 | |
23 | 23 | protected $m_categoryprefix; // cache label of category namespace . ':' |
24 | 24 | protected $m_conceptprefix; // cache label of concept namespace . ':' |
| 25 | + protected $m_categoryPrefixCannonical; // cache canonnical label of category namespace . ':' |
| 26 | + protected $m_conceptPrefixCannonical; // cache canonnical label of concept namespace . ':' |
25 | 27 | protected $m_queryfeatures; // query features to be supported, format similar to $smwgQFeatures |
26 | 28 | |
27 | 29 | public function __construct( $queryfeatures = false ) { |
28 | 30 | global $wgContLang, $smwgQFeatures; |
| 31 | + |
29 | 32 | $this->m_categoryprefix = $wgContLang->getNsText( NS_CATEGORY ) . ':'; |
30 | 33 | $this->m_conceptprefix = $wgContLang->getNsText( SMW_NS_CONCEPT ) . ':'; |
| 34 | + $this->m_categoryPrefixCannonical = 'Category:'; |
| 35 | + $this->m_conceptPrefixCannonical = 'Concept:'; |
| 36 | + |
31 | 37 | $this->m_defaultns = null; |
32 | | - $this->m_queryfeatures = $queryfeatures === false ? $smwgQFeatures:$queryfeatures; |
| 38 | + $this->m_queryfeatures = $queryfeatures === false ? $smwgQFeatures : $queryfeatures; |
33 | 39 | } |
34 | 40 | |
35 | 41 | /** |
— | — | @@ -228,9 +234,11 @@ |
229 | 235 | // block could be a Category-statement, fixed object, or property statement. |
230 | 236 | $chunk = $this->readChunk( '', true, false ); // NOTE: untrimmed, initial " " escapes prop. chains |
231 | 237 | |
232 | | - if ( ( smwfNormalTitleText( $chunk ) == $this->m_categoryprefix ) || // category statement or |
233 | | - ( smwfNormalTitleText( $chunk ) == $this->m_conceptprefix ) ) { // concept statement |
234 | | - return $this->getClassDescription( $setNS, ( smwfNormalTitleText( $chunk ) == $this->m_categoryprefix ) ); |
| 238 | + if ( in_array( smwfNormalTitleText( $chunk ), |
| 239 | + array( $this->m_categoryprefix, $this->m_conceptprefix, $this->m_categoryPrefixCannonical, $this->m_conceptPrefixCannonical ) ) ) { |
| 240 | + return $this->getClassDescription( $setNS, ( |
| 241 | + smwfNormalTitleText( $chunk ) == $this->m_categoryprefix || smwfNormalTitleText( $chunk ) == $this->m_categoryPrefixCannonical |
| 242 | + ) ); |
235 | 243 | } else { // fixed subject, namespace restriction, property query, or subquery |
236 | 244 | $sep = $this->readChunk( '', false ); // do not consume hit, "look ahead" |
237 | 245 | |
— | — | @@ -513,8 +521,10 @@ |
514 | 522 | */ |
515 | 523 | protected function readChunk( $stoppattern = '', $consume = true, $trim = true ) { |
516 | 524 | if ( $stoppattern == '' ) { |
517 | | - $stoppattern = '\[\[|\]\]|::|:=|<q>|<\/q>|^' . $this->m_categoryprefix . |
518 | | - '|^' . $this->m_conceptprefix . '|\|\||\|'; |
| 525 | + $stoppattern = '\[\[|\]\]|::|:=|<q>|<\/q>' . |
| 526 | + '|^' . $this->m_categoryprefix . '|^' . $this->m_categoryPrefixCannonical . |
| 527 | + '|^' . $this->m_conceptprefix . '|^' . $this->m_conceptPrefixCannonical . |
| 528 | + '|\|\||\|'; |
519 | 529 | } |
520 | 530 | $chunks = preg_split( '/[\s]*(' . $stoppattern . ')/u', $this->m_curstring, 2, PREG_SPLIT_DELIM_CAPTURE ); |
521 | 531 | if ( count( $chunks ) == 1 ) { // no matches anymore, strip spaces and finish |