r89437 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89436‎ | r89437 | r89438 >
Date:20:11, 3 June 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
several fixes, mainly to Special:BrowseByProperty
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Property.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DataValue.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php
@@ -77,7 +77,7 @@
7878 $this->propertystring = '';
7979 } else {
8080 $this->propertystring = $this->property->getWikiValue();
81 - $this->value = SMWDataValueFactory::newPropertyObjectValue( $this->property, $this->valuestring );
 81+ $this->value = SMWDataValueFactory::newPropertyObjectValue( $this->property->getDataItem(), $this->valuestring );
8282
8383 if ( $this->value->isValid() ) {
8484 $this->valuestring = $this->value->getWikiValue();
@@ -201,11 +201,10 @@
202202
203203 while ( $results && $number != 0 ) {
204204 $result = array_shift( $results );
205 - $thing = $result[0]->getLongHTMLText( smwfGetLinker() );
206205
207 - $html .= '<li>' . $thing;
 206+ $html .= '<li>' . $result[0]->getLongHTMLText( smwfGetLinker() );
208207
209 - if ( $result[0]->getTypeId() == '_wpg' ) {
 208+ if ( $result[0]->getTypeID() == '_wpg' ) {
210209 $html .= '&#160;&#160;' . SMWInfolink::newBrowsingLink( '+', $result[0]->getShortHTMLText() )->getHTML( smwfGetLinker() );
211210 }
212211
@@ -294,11 +293,14 @@
295294 $options->offset = $this->offset;
296295 $options->sort = true;
297296
298 - $res = smwfGetStore()->getPropertySubjects( $this->property, $this->value, $options );
 297+ $res = smwfGetStore()->getPropertySubjects( $this->property->getDataItem(), $this->value->getDataItem(), $options );
299298 $results = array();
300299
301300 foreach ( $res as $result ) {
302 - array_push( $results, array( $result, $this->value ) );
 301+ array_push( $results, array(
 302+ SMWDataValueFactory::newDataItemValue( $result ),
 303+ $this->value
 304+ ) );
303305 }
304306
305307 return $results;
@@ -327,10 +329,10 @@
328330 $params['sort'] = $this->propertystring;
329331 $params['order'] = 'DESC';
330332 if ( $greater ) $params['order'] = 'ASC';
331 - $cmp = "<";
332 - if ( $greater ) $cmp = ">";
 333+ $cmp = '<';
 334+ if ( $greater ) $cmp = '>';
333335
334 - $querystring = "[[" . $this->propertystring . "::" . $cmp . $this->valuestring . "]]";
 336+ $querystring = '[[' . $this->propertystring . '::' . $cmp . $this->valuestring . ']]';
335337 $queryobj = SMWQueryProcessor::createQuery( $querystring, $params, SMWQueryProcessor::SPECIAL_PAGE, 'ul', array( $printrequest ) );
336338 $queryobj->querymode = SMWQuery::MODE_INSTANCES;
337339 $queryobj->setLimit( $this->limit );
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DataValue.php
@@ -60,7 +60,6 @@
6161 */
6262 protected $m_dataitem;
6363
64 -
6564 /**
6665 * The text label of the respective property or false if none given.
6766 * @var SMWDIProperty
@@ -642,7 +641,7 @@
643642 */
644643 public function isValid() {
645644 $this->unstub();
646 - return ( ( !$this->mHasErrors ) && isset( $this->m_dataitem ) );
 645+ return !$this->mHasErrors && isset( $this->m_dataitem );
647646 }
648647
649648 /**
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Property.php
@@ -89,7 +89,7 @@
9090 * original object's content.
9191 */
9292 public function __clone() {
93 - if ( $this->m_wikipage !== null ) $this->m_wikipage = clone $this->m_wikipage;
 93+ if ( !is_null( $this->m_wikipage ) ) $this->m_wikipage = clone $this->m_wikipage;
9494 }
9595
9696 /**

Status & tagging log