Index: trunk/extensions/SemanticMediaWiki/includes/SMW_PageSchemas.php |
— | — | @@ -150,16 +150,24 @@ |
151 | 151 | $template_all = $psSchemaObj->getTemplates(); |
152 | 152 | foreach ( $template_all as $template ) { |
153 | 153 | $field_all = $template->getFields(); |
154 | | - foreach( $field_all as $field ) { |
| 154 | + foreach ( $field_all as $field ) { |
155 | 155 | $smw_array = $field->getObject('semanticmediawiki_Property'); |
156 | | - if ( array_key_exists( 'smw', $smw_array ) ) { |
157 | | - $prop_array = $smw_array['smw']; |
158 | | - $title = Title::makeTitleSafe( SMW_NS_PROPERTY, $prop_array['name'] ); |
159 | | - $key_title = PageSchemas::titleString( $title ); |
160 | | - if(in_array( $key_title, $toGenPageList )){ |
161 | | - self::createProperty( $prop_array['name'], $prop_array['Type'], $prop_array['allowed_values'] ) ; |
162 | | - } |
| 156 | + if ( !array_key_exists( 'smw', $smw_array ) ) { |
| 157 | + continue; |
163 | 158 | } |
| 159 | + $prop_array = $smw_array['smw']; |
| 160 | + if ( !array_key_exists( 'name', $prop_array ) ) { |
| 161 | + continue; |
| 162 | + } |
| 163 | + if ( empty( $prop_array['name'] ) ) { |
| 164 | + continue; |
| 165 | + } |
| 166 | + $title = Title::makeTitleSafe( SMW_NS_PROPERTY, $prop_array['name'] ); |
| 167 | + $key_title = PageSchemas::titleString( $title ); |
| 168 | + if ( !in_array( $key_title, $toGenPageList ) ) { |
| 169 | + continue; |
| 170 | + } |
| 171 | + self::createProperty( $prop_array['name'], $prop_array['Type'], $prop_array['allowed_values'] ) ; |
164 | 172 | } |
165 | 173 | } |
166 | 174 | return true; |
— | — | @@ -171,11 +179,12 @@ |
172 | 180 | $type_tag = "[[{$prop_labels['_TYPE']}::$property_type]]"; |
173 | 181 | $text = wfMsgForContent( 'ps-property-isproperty', $type_tag ); |
174 | 182 | if ( $allowed_values != null) { |
175 | | - // replace the comma substitution character that has no chance of |
176 | | - // being included in the values list - namely, the ASCII beep |
| 183 | + // Replace the comma with a substitution character |
| 184 | + // that has no chance of being included in the values |
| 185 | + // list - namely, the ASCII beep. |
177 | 186 | $text .= "\n\n" . wfMsgExt( 'ps-property-allowedvals', array( 'parsemag', 'content' ), count( $allowed_values ) ); |
178 | 187 | foreach ( $allowed_values as $i => $value ) { |
179 | | - // replace beep back with comma, trim |
| 188 | + // Replace beep back with comma, trim. |
180 | 189 | $value = str_replace( "\a",',' , trim( $value ) ); |
181 | 190 | if ( method_exists( $smwgContLang, 'getPropertyLabels' ) ) { |
182 | 191 | $prop_labels = $smwgContLang->getPropertyLabels(); |