http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97790
Revision: 97790
Author: yaron
Date: 2011-09-22 04:17:45 +0000 (Thu, 22 Sep 2011)
Log Message:
-----------
PHP improvements
Modified Paths:
--------------
trunk/extensions/SemanticForms/includes/SF_PageSchemas.php
Modified: trunk/extensions/SemanticForms/includes/SF_PageSchemas.php
===================================================================
--- trunk/extensions/SemanticForms/includes/SF_PageSchemas.php 2011-09-22
03:59:13 UTC (rev 97789)
+++ trunk/extensions/SemanticForms/includes/SF_PageSchemas.php 2011-09-22
04:17:45 UTC (rev 97790)
@@ -17,13 +17,12 @@
*/
public static function createPageSchemasObject( $objectName,
$xmlForField, &$object ) {
$sfarray = array();
- $formName = "";
if ( $objectName == "semanticforms_Form" ) {
foreach ( $xmlForField->children() as $tag => $child ) {
if ( $tag == $objectName ) {
$formName = (string)
$child->attributes()->name;
$sfarray['name'] = $formName;
- foreach ($child->children() as $tag =>
$formelem) {
+ foreach ( $child->children() as $tag =>
$formelem ) {
$sfarray[(string)$tag] =
(string)$formelem;
}
$object['sf'] = $sfarray;
@@ -53,6 +52,7 @@
* Creates Page Schemas XML for form-wide information.
*/
public static function getSchemaXML( $request, &$xmlArray ) {
+ $xml = '';
foreach ( $request->getValues() as $var => $val ) {
if ( $var == 'sf_form_name' ) {
$xml = '<semanticforms_Form name="' . $val . '"
>';
@@ -210,12 +210,18 @@
}
public static function getFormName( $psSchemaObj ) {
- $formData = $psSchemaObj->getObject( 'semanticforms_Form' );
- return $formData['sf']['name'];
+ $mainFormInfo = self::getMainFormInfo( $psSchemaObj );
+ if ( is_null( $mainFormInfo ) || !array_key_exists( 'name',
$mainFormInfo ) ) {
+ return null;
+ }
+ return $mainFormInfo['name']
}
public static function getMainFormInfo( $psSchemaObj ) {
$formData = $psSchemaObj->getObject( 'semanticforms_Form' );
+ if ( !array_key_exists( 'sf', $formData ) ) {
+ return null;
+ }
return $formData['sf'];
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs