Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_URI.php |
— | — | @@ -141,7 +141,7 @@ |
142 | 142 | |
143 | 143 | // Now create the URI data item: |
144 | 144 | try { |
145 | | - $this->m_dataitem = new SMWDIUri( $scheme, $hierpart, $query, $fragment, $this->m_typeid); |
| 145 | + $this->m_dataitem = new SMWDIUri( $scheme, $hierpart, $query, $fragment, $this->m_typeid ); |
146 | 146 | } catch ( SMWDataItemException $e ) { |
147 | 147 | $this->addError( wfMsgForContent( 'smw_baduri', $this->m_wikitext ) ); |
148 | 148 | $this->m_dataitem = new SMWDIUri( 'http', '//example.com', '', '', $this->m_typeid ); // define data item to have some value |
— | — | @@ -244,11 +244,13 @@ |
245 | 245 | */ |
246 | 246 | public function getURL() { |
247 | 247 | global $wgUrlProtocols; |
| 248 | + |
248 | 249 | foreach ( $wgUrlProtocols as $prot ) { |
249 | 250 | if ( ( $prot == $this->m_dataitem->getScheme() . ':' ) || ( $prot == $this->m_dataitem->getScheme() . '://' ) ) { |
250 | 251 | return $this->m_dataitem->getURI(); |
251 | 252 | } |
252 | 253 | } |
| 254 | + |
253 | 255 | return ''; |
254 | 256 | } |
255 | 257 | |
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Types.php |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | } |
36 | 36 | |
37 | 37 | public static function getTypeUriFromTypeId( $typeId ) { |
38 | | - return new SMWDIUri( 'http', '//semantic-mediawiki.org/swivt/1.0', '', $typeId ); |
| 38 | + return new SMWDIUri( 'http', 'semantic-mediawiki.org/swivt/1.0', '', $typeId ); |
39 | 39 | } |
40 | 40 | |
41 | 41 | protected function parseUserValue( $value ) { |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | */ |
84 | 84 | protected function loadDataItem( SMWDataItem $dataItem ) { |
85 | 85 | if ( ( $dataItem instanceof SMWDIUri ) && ( $dataItem->getScheme() == 'http' ) && |
86 | | - ( $dataItem->getHierpart() == '//semantic-mediawiki.org/swivt/1.0' ) && |
| 86 | + ( $dataItem->getHierpart() == 'semantic-mediawiki.org/swivt/1.0' ) && |
87 | 87 | ( $dataItem->getQuery() == '' ) ) { |
88 | 88 | $this->m_isAlias = false; |
89 | 89 | $this->m_typeId = $dataItem->getFragment(); |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_CompatibilityHelpers.php |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | if ( $typeid == '__typ' && $dbkeys[0]{0} == '_' ) { // b/c: old data stored as type ids |
50 | 50 | return SMWTypesValue::getTypeUriFromTypeId( $dbkeys[0] ); |
51 | 51 | } else { |
52 | | - return SMWDIUri::doUnserialize( $dbkeys[0]); |
| 52 | + return SMWDIUri::doUnserialize( $dbkeys[0] ); |
53 | 53 | } |
54 | 54 | case SMWDataItem::TYPE_TIME: |
55 | 55 | $timedate = explode( 'T', $dbkeys[0], 2 ); |
Index: trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_URI.php |
— | — | @@ -71,11 +71,13 @@ |
72 | 72 | 'http', 'https', 'ftp' |
73 | 73 | ); |
74 | 74 | |
75 | | - return $this->m_scheme . ':' |
| 75 | + $uri = $this->m_scheme . ':' |
76 | 76 | . ( in_array( $this->m_scheme, $schemesWithDoubleslesh ) ? '//' : '' ) |
77 | 77 | . $this->m_hierpart |
78 | 78 | . ( $this->m_query ? '?' . $this->m_query : '' ) |
79 | 79 | . ( $this->m_fragment ? '#' . $this->m_fragment : '' ); |
| 80 | + |
| 81 | + return $uri; |
80 | 82 | } |
81 | 83 | |
82 | 84 | public function getScheme() { |
— | — | @@ -125,6 +127,9 @@ |
126 | 128 | $hierpart = $parts[0]; |
127 | 129 | $fragment = ( count( $parts ) == 2 ) ? $parts[1] : ''; |
128 | 130 | } |
| 131 | + |
| 132 | + $hierpart = ltrim( $hierpart, '/' ); |
| 133 | + |
129 | 134 | return new SMWDIUri( $scheme, $hierpart, $query, $fragment ); |
130 | 135 | } |
131 | 136 | |