Index: trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php |
— | — | @@ -149,8 +149,7 @@ |
150 | 150 | * @todo FIXME: Some job generations here might create too many jobs at once on a large wiki. Use incremental jobs instead. |
151 | 151 | */ |
152 | 152 | static public function storeData( $parseroutput, Title $title, $makejobs = true ) { |
153 | | - global $smwgEnableUpdateJobs, $smwgDeclarationProperties, |
154 | | - $smwgContLang, $smwgPageSpecialProperties; |
| 153 | + global $smwgEnableUpdateJobs, $smwgDeclarationProperties, $smwgContLang, $smwgPageSpecialProperties; |
155 | 154 | |
156 | 155 | $semdata = $parseroutput->mSMWData; |
157 | 156 | $namespace = $title->getNamespace(); |
— | — | @@ -166,35 +165,42 @@ |
167 | 166 | // Property name in `$smwgPageSpecialProperties' may be localized. |
168 | 167 | // Get property id to work with. |
169 | 168 | $propId = $smwgContLang->getPropertyId( $propName ); |
| 169 | + |
170 | 170 | if ( is_null( $propId ) ) { |
171 | | - continue; // Issue error? |
| 171 | + continue; |
172 | 172 | } |
173 | | - if ( isset( $props[$propId] ) ) { // Do not calculate the same property again. |
174 | | - continue; // Issue warning? |
| 173 | + |
| 174 | + // Do not calculate the same property again. |
| 175 | + if ( array_key_exists( $propId, $props ) ) { |
| 176 | + continue; |
175 | 177 | } |
176 | | - $props[ $propId ] = true; // Remember the property is processed. |
| 178 | + |
| 179 | + // Remember the property is processed. |
| 180 | + $props[ $propId ] = true; |
177 | 181 | $prop = new SMWDIProperty( $propId ); |
| 182 | + |
178 | 183 | if ( count( $semdata->getPropertyValues( $prop ) ) > 0 ) { |
179 | 184 | continue; |
180 | 185 | } |
| 186 | + |
181 | 187 | // Calculate property value. |
182 | 188 | $datum = null; |
| 189 | + |
183 | 190 | switch ( $propId ) { |
184 | | - case '_MDAT' : { |
| 191 | + case '_MDAT' : |
185 | 192 | $timestamp = Revision::getTimeStampFromID( $title, $title->getLatestRevID() ); |
186 | 193 | $datum = self::getDataItemFromMWTimestamp( $timestamp ); |
187 | | - } break; |
188 | | - case '_CDAT' : { |
| 194 | + break; |
| 195 | + case '_CDAT' : |
189 | 196 | $timestamp = $title->getFirstRevision()->getTimestamp(); |
190 | 197 | $datum = self::getDataItemFromMWTimestamp( $timestamp ); |
191 | | - } break; |
| 198 | + break; |
192 | 199 | } |
193 | 200 | |
194 | | - if ( is_null( $datum ) ) { |
195 | | - continue; // Issue error or warning? |
196 | | - } |
| 201 | + if ( !is_null( $datum ) ) { |
| 202 | + $semdata->addPropertyObjectValue( $prop, $datum ); |
| 203 | + } // Issue error or warning? |
197 | 204 | |
198 | | - $semdata->addPropertyObjectValue( $prop, $datum ); |
199 | 205 | } // foreach |
200 | 206 | } else { // data found, but do all operations as if it was empty |
201 | 207 | $semdata = new SMWSemanticData( $semdata->getSubject() ); |
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_URI.php |
— | — | @@ -190,7 +190,7 @@ |
191 | 191 | |
192 | 192 | public function getShortHTMLText( $linker = null ) { |
193 | 193 | $url = $this->getURL(); |
194 | | - if ( is_null( $linked ) || ( !$this->isValid() ) || ( $this->m_outformat == '-' ) || ( $url === '' ) || ( $this->m_caption === '' ) ) { |
| 194 | + if ( is_null( $linker ) || ( !$this->isValid() ) || ( $this->m_outformat == '-' ) || ( $url === '' ) || ( $this->m_caption === '' ) ) { |
195 | 195 | return $this->m_caption; |
196 | 196 | } else { |
197 | 197 | return $linker->makeExternalLink( $url, $this->m_caption ); |
— | — | @@ -202,6 +202,7 @@ |
203 | 203 | return $this->getErrorText(); |
204 | 204 | } |
205 | 205 | $url = $this->getURL(); |
| 206 | + |
206 | 207 | if ( is_null( $linked ) || ( $linked === false ) || ( $this->m_outformat == '-' ) || ( $url === '' ) ) { |
207 | 208 | return $this->m_wikitext; |
208 | 209 | } else { |
— | — | @@ -213,8 +214,10 @@ |
214 | 215 | if ( !$this->isValid() ) { |
215 | 216 | return $this->getErrorText(); |
216 | 217 | } |
| 218 | + |
217 | 219 | $url = $this->getURL(); |
218 | | - if ( is_null( $linked ) || ( $this->m_outformat == '-' ) || ( $url === '' ) ) { |
| 220 | + |
| 221 | + if ( is_null( $linker ) || ( $this->m_outformat == '-' ) || ( $url === '' ) ) { |
219 | 222 | return htmlspecialchars( $this->m_wikitext ); |
220 | 223 | } else { |
221 | 224 | return $linker->makeExternalLink( $url, $this->m_wikitext ); |
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Types.php |
— | — | @@ -124,7 +124,7 @@ |
125 | 125 | } |
126 | 126 | |
127 | 127 | public function getLongHTMLText( $linker = null ) { |
128 | | - if ( is_null( $linked ) || ( $linker === false ) ) { |
| 128 | + if ( is_null( $linker ) || ( $linker === false ) ) { |
129 | 129 | return htmlspecialchars( $this->m_realLabel ); |
130 | 130 | } else { |
131 | 131 | $title = Title::makeTitle( NS_SPECIAL, $this->getSpecialPageTitleText() ); |