Wilkins has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/245906

Change subject: PSR2 Syntax and one class per file
......................................................................

PSR2 Syntax and one class per file

Change-Id: I9aa98b6d408866cf9c440fe1e0dfc95624d5af11
---
M AncestorsFamilyTree.php
M DescendantFamilyTree.php
M FamilyTree.php
M FamilyTreeFactory.php
M FamilyTreeTag.php
A Gedcom5FilePrinter.php
M Gedcom5ResultPrinter.php
M GenealogicalFilePrinter.php
M PersonPageValues.php
M RelationFamilyTree.php
M SemanticGenealogy.alias.php
M SemanticGenealogy.body.php
M SemanticGenealogy.i18n.php
M SemanticGenealogy.php
M SpecialFamilyTree.php
15 files changed, 691 insertions(+), 644 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticGenealogy 
refs/changes/06/245906/1

diff --git a/AncestorsFamilyTree.php b/AncestorsFamilyTree.php
index a527e20..25ff254 100644
--- a/AncestorsFamilyTree.php
+++ b/AncestorsFamilyTree.php
@@ -4,7 +4,7 @@
  * AncestorsFamilyTree object
  *
  * Handle a FamilyTree to display the ancestors of the person
- * 
+ *
  * @file AncestorsFamilyTree.php
  * @ingroup SemanticGenealogy
  *
@@ -23,10 +23,10 @@
     public function getAncestors()
     {
         $tree = array();
-        $tree[0][1] = new PersonPageValues( $this->person );
+        $tree[0][1] = new PersonPageValues($this->person);
 
-        for($i = 0; $i < $this->numOfGenerations && $tree[$i] !== null; $i++ ) 
{
-            $tree = $this->addGenInTree( $i + 1, $tree );
+        for ($i = 0; $i < $this->numOfGenerations && $tree[$i] !== null; $i++) 
{
+            $tree = $this->addGenInTree($i + 1, $tree);
         }
         return $tree;
     }
@@ -43,19 +43,20 @@
         $output = $this->getOutput();
         $output->addHTML('<table style="text-align:center;">');
         $col = 1;
-        for( $i = $this->numOfGenerations - 1; $i >= 0; $i-- ) {
-            if( isset( $tree[$i] ) ) {
+        for ($i = $this->numOfGenerations - 1; $i >= 0; $i--) {
+            if (isset( $tree[$i] )) {
                 $output->addHTML('<tr>');
                 foreach ($tree[$i] as $sosa => $person) {
                     $output->addHTML('<td colspan="' . $col . '">');
-                    if($person !== null) {
-                        $output->addHTML($sosa . '<br/>' );
-                         $output->addWikiText( 
$person->getDescriptionWikiText( true ) );
-                        if($sosa != 1) {
-                            if($sosa % 2 == 0)
-                                $output->addHTML( '<br/>\\' );
-                            else
-                                $output->addHTML( '<br/>/' );
+                    if ($person !== null) {
+                        $output->addHTML($sosa . '<br/>');
+                         
$output->addWikiText($person->getDescriptionWikiText(true));
+                        if ($sosa != 1) {
+                            if ($sosa % 2 == 0) {
+                                $output->addHTML('<br/>\\');
+                            } else {
+                                $output->addHTML('<br/>/');
+                            }
                         }
                     }
                     $output->addHTML('</td>');
diff --git a/DescendantFamilyTree.php b/DescendantFamilyTree.php
index ab60323..36c21e4 100644
--- a/DescendantFamilyTree.php
+++ b/DescendantFamilyTree.php
@@ -4,7 +4,7 @@
  * DescandantFamilyTree object
  *
  * Handle a FamilyTree to display the descendants of a person
- * 
+ *
  * @file DescendantFamilyTree.php
  * @ingroup SemanticGenealogy
  *
@@ -20,15 +20,17 @@
      *
      * @return void
      */
-    public function outputDescendantLine( $person, $pellissier, $end ) {
+    public function outputDescendantLine($person, $pellissier, $end)
+    {
         $output = $this->getOutput();
         $children = $person->getChildren();
         $i = 1;
-        foreach($children as $child) {
+        foreach ($children as $child) {
             $pel = $pellissier . $i . '.';
-            $output->addWikiText( $pel . ' ' . $child->getDescriptionWikiText( 
false ) );
-            if( $end > 0 )
-                $this->outputDescendantLine( $child, $pel, $end - 1);
+            $output->addWikiText($pel . ' ' . 
$child->getDescriptionWikiText(false));
+            if ($end > 0) {
+                $this->outputDescendantLine($child, $pel, $end - 1);
+            }
             $i++;
         }
     }
@@ -41,8 +43,8 @@
     public function render()
     {
         $output = $this->getOutput();
-        $main = new PersonPageValues( $this->person );
-        $output->addWikiText( $main->getDescriptionWikiText( false ) );
-        $this->outputDescendantLine( $main, '', $this->numOfGenerations );
+        $main = new PersonPageValues($this->person);
+        $output->addWikiText($main->getDescriptionWikiText(false));
+        $this->outputDescendantLine($main, '', $this->numOfGenerations);
     }
 }
diff --git a/FamilyTree.php b/FamilyTree.php
index ed4d10a..c1c0f3f 100644
--- a/FamilyTree.php
+++ b/FamilyTree.php
@@ -4,7 +4,7 @@
  * FamilyTree object
  *
  * This class is abstract and cannot be instanciated. Please use the 
FamilyTreeFactory to create a specific type of FamilyTree (ancestors, 
descendant or relation)
- * 
+ *
  * @file    FamilyTree.php
  * @ingroup SemanticGenealogy
  *
@@ -22,7 +22,7 @@
 
     /**
      * Setter for the person
-     * 
+     *
      * @param string $personName the name of the page of the person
      *
      * @return void
@@ -35,7 +35,7 @@
 
     /**
      * Setter for the number of generations
-     * 
+     *
      * @param integer $numOfGenerations the number of generations
      *
      * @return void
@@ -47,7 +47,7 @@
 
     /**
      * Setter for the ouput object
-     * 
+     *
      * @param OutputPage $output the output object
      *
      * @return void
@@ -59,7 +59,7 @@
 
     /**
      * Getter for the ouput object
-     * 
+     *
      * @return OutputPage the output object
      */
     public function getOutput()
@@ -73,10 +73,10 @@
      * @param  int $gen The number of the generation (beginning at 0)
      * @return int
      */
-    public static function getNumOfPeopleInGen( $gen )
+    public static function getNumOfPeopleInGen($gen)
     {
         $result = 1;
-        for($i = 0; $i < $gen; $i++ ) {
+        for ($i = 0; $i < $gen; $i++) {
             $result *= 2;
         }
         return $result;
@@ -91,16 +91,16 @@
      *
      * @return array the resulting tree
      */
-    public function addGenInTree( $gen, array $tree )
+    public function addGenInTree($gen, array $tree)
     {
         $empty = true;
-        $son = self::getNumOfPeopleInGen( $gen - 1 );
+        $son = self::getNumOfPeopleInGen($gen - 1);
         $end = $son * 4;
-        for( $parent = $son * 2; $parent < $end; true ) {
-            if( isset( $tree[$gen - 1][$son] ) ) {
+        for ($parent = $son * 2; $parent < $end; true) {
+            if (isset( $tree[$gen - 1][$son] )) {
                 $father = $tree[$gen - 1][$son]->father;
-                if( $father instanceof SMWDIWikiPage ) {
-                    $tree[$gen][$parent] = new PersonPageValues( $father );
+                if ($father instanceof SMWDIWikiPage) {
+                    $tree[$gen][$parent] = new PersonPageValues($father);
                     $empty = false;
                 } else {
                     $tree[$gen][$parent] = null;
@@ -108,8 +108,8 @@
                 $parent++;
 
                 $mother = $tree[$gen - 1][$son]->mother;
-                if( $mother instanceof SMWDIWikiPage ) {
-                    $tree[$gen][$parent] = new PersonPageValues( $mother );
+                if ($mother instanceof SMWDIWikiPage) {
+                    $tree[$gen][$parent] = new PersonPageValues($mother);
                     $empty = false;
                 } else {
                     $tree[$gen][$parent] = null;
@@ -121,7 +121,7 @@
             $son++;
         }
         //Verif s'il n'y a personne dans la génération
-        if($empty) {
+        if ($empty) {
             $tree[$gen] = null;
         }
         return $tree;
@@ -132,7 +132,7 @@
      * Render the tree
      *
      * This should not be used, because you should not use a abstract 
FamilyTree
-     * 
+     *
      * @return void
      */
     public function render()
diff --git a/FamilyTreeFactory.php b/FamilyTreeFactory.php
index 0fcdbf1..563c485 100644
--- a/FamilyTreeFactory.php
+++ b/FamilyTreeFactory.php
@@ -4,21 +4,21 @@
 class FamilyTreeFactory
 {
 
-       public static function create($type)
-       {
-               switch($type) {
-                       case 'ancestors':
-                               return new AncestorsFamilyTree();
-                               break;
-                       case 'descendant':
-                               return new DescendantFamilyTree();
-                               break;
-                       case 'link':
-                               return new RelationFamilyTree();
-                               break;
-                       default:
-                               $output->addWikiText( '<span class="error">' . 
wfMsg( 'semanticgenealogy-specialfamilytree-error-unknowntype', $type ) . 
'</span>' );
-               }
+    public static function create($type)
+    {
+        switch($type) {
+            case 'ancestors':
+                return new AncestorsFamilyTree();
+                break;
+            case 'descendant':
+                return new DescendantFamilyTree();
+                break;
+            case 'link':
+                return new RelationFamilyTree();
+                break;
+            default:
+                $output->addWikiText('<span class="error">' . 
wfMsg('semanticgenealogy-specialfamilytree-error-unknowntype', $type) . 
'</span>');
+        }
 
-       }
+    }
 }
diff --git a/FamilyTreeTag.php b/FamilyTreeTag.php
index 2b4b66b..f89ae18 100644
--- a/FamilyTreeTag.php
+++ b/FamilyTreeTag.php
@@ -4,7 +4,7 @@
  * FamilyTreeTag objecta
  *
  * Handle the <familytree> tag using a FamilyTree object
- * 
+ *
  * @file FamilyTreeTag.php
  * @ingroup SemanticGenealogy
  *
@@ -21,17 +21,17 @@
     const ATTR_TYPE = "type";
 
     // Hook our callback function into the parser
-    public static function wfFamilytreeParserInit (Parser $parser)
+    public static function wfFamilytreeParserInit(Parser $parser)
     {
-        // When the parser sees the <familytree> tag, it executes 
+        // When the parser sees the <familytree> tag, it executes
         // the wfFamilytreeRender function (see below)
-        $parser->setHook( 'familytree', array('FamilyTreeTag', 
'wfFamilytreeRender') );
+        $parser->setHook('familytree', array('FamilyTreeTag', 
'wfFamilytreeRender'));
         return true;
     }
 
     /**
      * Render the family tree
-     * 
+     *
      * @param string  $input  the content of the <familytree /> tag (should be 
empty)
      * @param array   $args   the arguments
      * @param Parser  $parser None
@@ -39,7 +39,7 @@
      *
      * @return the HTML output of the tree
      */
-    public static function wfFamilytreeRender ($input, array $args, Parser 
$parser, PPFrame $frame)
+    public static function wfFamilytreeRender($input, array $args, Parser 
$parser, PPFrame $frame)
     {
         // A new OutputPage writer
         $output = new OutputPage;
diff --git a/Gedcom5FilePrinter.php b/Gedcom5FilePrinter.php
new file mode 100644
index 0000000..1e8aa4d
--- /dev/null
+++ b/Gedcom5FilePrinter.php
@@ -0,0 +1,215 @@
+<?php
+
+class Gedcom5FilePrinter extends GenealogicalFilePrinter
+{
+
+    protected $families = array();
+    protected $familiesByPerson = array();
+
+    /**
+     * set file in $this->file property
+     */
+    protected function setFile()
+    {
+        $this->setFamiliesList();
+
+        $this->addHead();
+        foreach ($this->people as $key => $person) {
+            $this->addPerson($key, $person);
+        }
+        foreach ($this->families as $key => $children) {
+            $this->addFamily($key, $children);
+        }
+        $this->addRow(0, 'TRLR');
+    }
+
+    protected function setFamiliesList()
+    {
+        $i = 1;
+        foreach ($this->people as $child) {
+            $id = $this->getFamilyIdForChild($child);
+            if ($id != '0S0') {
+                $this->addChildToFamily($id, $child);
+                list( $fatherId, $motherId ) = explode('S', $id);
+                $this->addFamilyToPerson($id, $fatherId);
+                $this->addFamilyToPerson($id, $motherId);
+            }
+        }
+    }
+
+    protected function getFamilyIdForChild(PersonPageValues $child)
+    {
+        $key = '';
+        if ($child->father instanceof SMWDIWikiPage && isset( 
$this->people[$child->father->getTitle()->getArticleID()] )) {
+            $key .= $child->father->getTitle()->getArticleID() . 'S';
+            if ($child->mother instanceof SMWDIWikiPage && isset( 
$this->people[$child->mother->getTitle()->getArticleID()] )) {
+                $key .= $child->mother->getTitle()->getArticleID();
+            } else {
+                $key .= '0';
+            }
+        } else {
+            $key .= '0S';
+            if ($child->mother instanceof SMWDIWikiPage && isset( 
$this->people[$child->mother->getTitle()->getArticleID()] )) {
+                $key .= $child->mother->getTitle()->getArticleID();
+            } else {
+                $key .= '0';
+            }
+        }
+        return $key;
+    }
+
+    protected function addChildToFamily($familyKey, PersonPageValues $child)
+    {
+        $childId = $child->title->getArticleID();
+        if (isset( $this->families[$familyKey] )) {
+            if (!in_array($childId, $this->families[$familyKey])) {
+                $this->families[$familyKey][] = $childId;
+            }
+        } else {
+            $this->families[$familyKey] = array( $childId );
+        }
+    }
+
+    protected function addFamilyToPerson($familyId, $personId)
+    {
+        if ($personId != 0) {
+            if (isset( $this->familiesByPerson[$personId] )) {
+                if (!in_array($familyId, $this->familiesByPerson[$personId])) {
+                    $this->familiesByPerson[$personId][] = $familyId;
+                }
+            } else {
+                $this->familiesByPerson[$personId] = array( $familyId );
+            }
+        }
+    }
+
+    /**
+     * add GEDCOM header
+     */
+    protected function addHead()
+    {
+        global $wgSitename, $wgRightsText;
+
+        $this->addRow(0, 'HEAD');
+        $this->addRow(1, 'SOUR', 'unregistered');
+        $this->addRow(2, 'NAME', 'Semantic Genealogy');
+        $this->addRow(2, 'VERS', SG_VERSION);
+        $this->addRow(2, 'DATA', $wgSitename);
+        if (isset( $wgRightsText ) && $wgRightsText) {
+            $this->addRow(3, 'COPR', $wgRightsText);
+        }
+        //$this->addRow( 1, 'FILE',  ); //TODO name of the file
+        $this->addRow(1, 'DATE', strtoupper(date('d M Y')));
+        $this->addRow(2, 'TIME', date('H:i:s')); //TODO hh:mm:ss.fs
+        $this->addRow(1, 'GEDC');
+        $this->addRow(2, 'VERS', 5.5);
+        $this->addRow(2, 'FORM', 'LINEAGE-LINKED');
+        $this->addRow(1, 'CHAR', 'UTF8');
+        //$this->addRow( 1, 'LANG',  ); //TODO ?
+    }
+
+    /**
+     * add the GEDCOM for a person
+     * @param $person PersonPageValues
+     */
+    protected function addPerson($id, PersonPageValues $person)
+    {
+        $this->addRow(0, '@I'. $id . '@', 'INDI');
+        $this->addRow(1, 'NAME', $this->getGedcomName($person));
+        $this->addStringValueAsRow(2, 'GIVN', $person->givenname);
+        $this->addStringValueAsRow(2, 'SURN', $person->surname);
+        $this->addStringValueAsRow(2, 'NICK', $person->nickname);
+        $this->addStringValueAsRow(2, 'NPFX', $person->prefix);
+        $this->addStringValueAsRow(2, 'NSFX', $person->suffix);
+        $this->addStringValueAsRow(1, 'SEX', $person->sex);
+        $familyId = $this->getFamilyIdForChild($person);
+        if ($familyId != '0S0') {
+            $this->addRow(1, 'FAMC', '@F'. $familyId . '@');
+        }
+        if (isset( $this->familiesByPerson[$id] )) {
+            foreach ($this->familiesByPerson[$id] as $familyId) {
+                $this->addRow(1, 'FAMS', '@F'. $familyId . '@');
+            }
+        }
+        $this->addEvent('BIRT', $person->birthdate, $person->birthplace);
+        $this->addEvent('DEAT', $person->deathdate, $person->deathplace);
+    }
+
+    protected function addFamily($id, $children)
+    {
+        list( $fatherId, $motherId ) = explode('S', $id);
+        $this->addRow(0, '@F'. $id . '@', 'FAM');
+        if ($fatherId != 0) {
+            $this->addRow(1, 'HUSB', '@I' . $fatherId . '@');
+        }
+        if ($motherId != 0) {
+            $this->addRow(1, 'WIFE', '@I' . $motherId . '@');
+        }
+        foreach ($children as $childId) {
+            $this->addRow(1, 'CHIL', '@I' . $childId . '@');
+        }
+    }
+
+    protected function getGedcomName(PersonPageValues $person)
+    {
+        $name = '';
+        if ($person->givenname instanceof SMWDIBlob && 
$person->givenname->getString() != '') {
+            $name .= $person->givenname->getString();
+        }
+        if ($person->surname instanceof SMWDIBlob && 
$person->surname->getString() != '') {
+            $name .= '/' . $person->surname->getString() . '/';
+        }
+        if ($person->suffix instanceof SMWDIBlob && 
$person->suffix->getString() != '') {
+            $name .= $person->suffixname->getString();
+        }
+        return $name;
+    }
+
+    protected function addRow($level, $key, $value = null)
+    {
+        $this->file .= $level . ' ' . $key;
+        if ($value !== null) {
+            $this->file .= ' ' . str_replace('\n', ' ', $value);
+        }
+        $this->file .= "\n";
+    }
+
+    /**
+    * TODO add places metadata support.
+    */
+    protected function addEvent($type, $date, $place)
+    {
+        if ($date === null && $place === null) {
+            return;
+        }
+        $this->addRow(1, $type);
+        $this->addTimeValueAsRow(2, 'DATE', $date);
+        if ($place instanceof SMWDIWikiPage) {
+            $this->addWikiPageValueAsRow(2, 'PLAC', $place);
+        } else {
+            $this->addStringValueAsRow(2, 'PLAC', $place);
+        }
+    }
+
+    protected function addStringValueAsRow($level, $key, $value)
+    {
+        if ($value instanceof SMWDIBlob) {
+            $this->addRow($level, $key, $value->getString());
+        }
+    }
+
+    protected function addTimeValueAsRow($level, $key, $value)
+    {
+        if ($value instanceof SMWDITime) {
+            $lang = new Language();
+            $this->addRow($level, $key, strtoupper($lang->sprintfDate('d M Y', 
$value->getMwTimestamp(TS_MW))));
+        }
+    }
+
+    protected function addWikiPageValueAsRow($level, $key, $value)
+    {
+        if ($value instanceof SMWDIWikiPage) {
+            $this->addRow($level, $key, $value->getTitle()->getText());
+        }
+    }
+}
diff --git a/Gedcom5ResultPrinter.php b/Gedcom5ResultPrinter.php
index e8445c9..5e3cceb 100644
--- a/Gedcom5ResultPrinter.php
+++ b/Gedcom5ResultPrinter.php
@@ -9,65 +9,72 @@
  * @licence GNU GPL v2+
  * @author Thomas Pellissier Tanon < thoma...@hotmail.fr >
  */
-class Gedcom5ResultPrinter extends SMWResultPrinter {
-       public $ids = array();
+class Gedcom5ResultPrinter extends SMWResultPrinter
+{
+    public $ids = array();
 
-       public function getMimeType( $res ) {
-               return 'application/x-gedcom';
-       }
+    public function getMimeType($res)
+    {
+        return 'application/x-gedcom';
+    }
 
-       public function getFileName( $res ) {
-               if( $this->getSearchLabel( SMW_OUTPUT_WIKI ) != '' ) {
-                       return str_replace( ' ', '_', $this->getSearchLabel( 
SMW_OUTPUT_WIKI ) ) . '.ged';
-               } else {
-                       return 'GEDCOM.ged';
-               }
-       }
+    public function getFileName($res)
+    {
+        if ($this->getSearchLabel(SMW_OUTPUT_WIKI) != '') {
+            return str_replace(' ', '_', 
$this->getSearchLabel(SMW_OUTPUT_WIKI)) . '.ged';
+        } else {
+            return 'GEDCOM.ged';
+        }
+    }
 
-       public function getQueryMode( $context ) {
-               return ( $context == SMWQueryProcessor::SPECIAL_PAGE ) ? 
SMWQuery::MODE_INSTANCES : SMWQuery::MODE_NONE;
-       }
+    public function getQueryMode($context)
+    {
+        return ( $context == SMWQueryProcessor::SPECIAL_PAGE ) ? 
SMWQuery::MODE_INSTANCES : SMWQuery::MODE_NONE;
+    }
 
-       public function getName() {
-               return wfMsg( 'semanticgenealogy-gedcomexport-desc' );
-       }
+    public function getName()
+    {
+        return wfMsg('semanticgenealogy-gedcomexport-desc');
+    }
 
-       protected function getResultText( SMWQueryResult $res, $outputmode ) {
-               $result = '';
+    protected function getResultText(SMWQueryResult $res, $outputmode)
+    {
+        $result = '';
 
-               if( $outputmode == SMW_OUTPUT_FILE ) {
-                       $people = array();
-                       $row = $res->getNext();
-                       while( $row !== false ) {
-                               $people[] = new PersonPageValues( 
$row[0]->getResultSubject() );
-                               $row = $res->getNext();
-                       }
-                       $printer = new Gedcom5FilePrinter();
-                       $printer->addPeople( $people );
-                       $result = $printer->getFile();
-               } else { // just make link
-                       if( $this->getSearchLabel( $outputmode ) ) {
-                               $label = $this->getSearchLabel( $outputmode );
-                       } else {
-                               $label = wfMsgForContent( 
'semanticgenealogy-gedcomexport-link' );
-                       }
-                       $link = $res->getQueryLink( $label );
-                       $link->setParameter( 'gedcom5', 'format' );
-                       if( $this->getSearchLabel( SMW_OUTPUT_WIKI ) != '' ) {
-                               $link->setParameter( $this->getSearchLabel( 
SMW_OUTPUT_WIKI ), 'searchlabel' );
-                       }
-                       if( array_key_exists( 'limit', $this->m_params ) ) {
-                               $link->setParameter( $this->m_params['limit'], 
'limit' );
-                       } else { // use a reasonable default limit
-                               $link->setParameter( 20, 'limit' );
-                       }
-                       $result .= $link->getText( $outputmode, $this->mLinker 
);
-                       $this->isHTML = ( $outputmode == SMW_OUTPUT_HTML ); // 
yes, our code can be viewed as HTML if requested, no more parsing needed
-               }
-               return $result;
-       }
+        if ($outputmode == SMW_OUTPUT_FILE) {
+            $people = array();
+            $row = $res->getNext();
+            while ($row !== false) {
+                $people[] = new PersonPageValues($row[0]->getResultSubject());
+                $row = $res->getNext();
+            }
+            $printer = new Gedcom5FilePrinter();
+            $printer->addPeople($people);
+            $result = $printer->getFile();
+        } else { // just make link
+            if ($this->getSearchLabel($outputmode)) {
+                $label = $this->getSearchLabel($outputmode);
+            } else {
+                $label = 
wfMsgForContent('semanticgenealogy-gedcomexport-link');
+            }
+            $link = $res->getQueryLink($label);
+            $link->setParameter('gedcom5', 'format');
+            if ($this->getSearchLabel(SMW_OUTPUT_WIKI) != '') {
+                $link->setParameter($this->getSearchLabel(SMW_OUTPUT_WIKI), 
'searchlabel');
+            }
+            if (array_key_exists('limit', $this->m_params)) {
+                $link->setParameter($this->m_params['limit'], 'limit');
+            } else { // use a reasonable default limit
+                $link->setParameter(20, 'limit');
+            }
+            $result .= $link->getText($outputmode, $this->mLinker);
+            $this->isHTML = ( $outputmode == SMW_OUTPUT_HTML ); // yes, our 
code can be viewed as HTML if requested, no more parsing needed
+        }
+        return $result;
+    }
 
-       public function getParameters() {
-               return array_merge( parent::getParameters(), 
$this->exportFormatParameters() );
-       }
+    public function getParameters()
+    {
+        return array_merge(parent::getParameters(), 
$this->exportFormatParameters());
+    }
 }
diff --git a/GenealogicalFilePrinter.php b/GenealogicalFilePrinter.php
index bcbe810..ab4569b 100644
--- a/GenealogicalFilePrinter.php
+++ b/GenealogicalFilePrinter.php
@@ -9,236 +9,39 @@
  * @licence GNU GPL v2+
  * @author Thomas Pellissier Tanon < thoma...@hotmail.fr >
  */
-abstract class GenealogicalFilePrinter {
-       protected $file = '';
-       protected $people = array();
+abstract class GenealogicalFilePrinter
+{
+    protected $file = '';
+    protected $people = array();
 
-       /**
-        * Add people to the GEDCOM file
-        * @param $people array|PersonPageValues
-        */
-       public function addPeople( $people ) {
-               foreach( $people as $person ) {
-                       $this->people[$person->title->getArticleID()] = $person;
-               }
-               if( !empty( $people ) && $this->file !== '' ) {
-                       $this->file  = '';
-               }
-       }
+    /**
+     * Add people to the GEDCOM file
+     * @param $people array|PersonPageValues
+     */
+    public function addPeople($people)
+    {
+        foreach ($people as $person) {
+            $this->people[$person->title->getArticleID()] = $person;
+        }
+        if (!empty( $people ) && $this->file !== '') {
+            $this->file  = '';
+        }
+    }
 
-       /**
-        * Return the file
-        * @return string
-        */
-       public function getFile() {
-               if( $this->file === '' ) {
-                       $this->setFile();
-               }
-               return $this->file;
-       }
+    /**
+     * Return the file
+     * @return string
+     */
+    public function getFile()
+    {
+        if ($this->file === '') {
+            $this->setFile();
+        }
+        return $this->file;
+    }
 
-       /**
-        * set file in $this->file property
-        */
-       protected abstract function setFile();
-}
-
-
-class Gedcom5FilePrinter extends GenealogicalFilePrinter {
-
-       protected $families = array();
-       protected $familiesByPerson = array();
-
-       /**
-        * set file in $this->file property
-        */
-       protected function setFile() {
-               $this->setFamiliesList();
-
-               $this->addHead();
-               foreach( $this->people as $key => $person ) {
-                       $this->addPerson( $key, $person );
-               }
-               foreach( $this->families as $key => $children ) {
-                       $this->addFamily( $key, $children );
-               }
-               $this->addRow( 0, 'TRLR' );
-       }
-
-       protected function setFamiliesList() {
-               $i = 1;
-               foreach( $this->people as $child ) {
-                       $id = $this->getFamilyIdForChild( $child );
-                       if( $id != '0S0' ) {
-                               $this->addChildToFamily( $id, $child );
-                               list( $fatherId, $motherId ) = explode('S', $id 
);
-                               $this->addFamilyToPerson( $id, $fatherId );
-                               $this->addFamilyToPerson( $id, $motherId );
-                       }
-               }
-       }
-
-       protected function getFamilyIdForChild( PersonPageValues $child ) {
-               $key = '';
-               if( $child->father instanceof SMWDIWikiPage && isset( 
$this->people[$child->father->getTitle()->getArticleID()] ) ) {
-                       $key .= $child->father->getTitle()->getArticleID() . 
'S';
-                       if( $child->mother instanceof SMWDIWikiPage && isset( 
$this->people[$child->mother->getTitle()->getArticleID()] ) ) {
-                               $key .= 
$child->mother->getTitle()->getArticleID();
-                       } else {
-                               $key .= '0';
-                       }
-               } else {
-                       $key .= '0S';
-                       if( $child->mother instanceof SMWDIWikiPage && isset( 
$this->people[$child->mother->getTitle()->getArticleID()] ) ) {
-                               $key .= 
$child->mother->getTitle()->getArticleID();
-                       } else {
-                               $key .= '0';
-                       }
-               }
-               return $key;
-       }
-
-       protected function addChildToFamily( $familyKey, PersonPageValues 
$child ) {
-               $childId = $child->title->getArticleID();
-               if( isset( $this->families[$familyKey] ) ) {
-                       if( !in_array( $childId, $this->families[$familyKey] ) 
) {
-                               $this->families[$familyKey][] = $childId;
-                       }
-               } else {
-                       $this->families[$familyKey] = array( $childId );
-               }
-       }
-
-       protected function addFamilyToPerson( $familyId, $personId ) {
-               if( $personId != 0 ) {
-                       if( isset( $this->familiesByPerson[$personId] ) ) {
-                               if( !in_array( $familyId, 
$this->familiesByPerson[$personId] ) ) {
-                                       $this->familiesByPerson[$personId][] = 
$familyId;
-                               }
-                       } else {
-                               $this->familiesByPerson[$personId] = array( 
$familyId );
-                       }
-               }
-       }
-
-       /**
-        * add GEDCOM header
-        */
-       protected function addHead() {
-               global $wgSitename, $wgRightsText;
-
-               $this->addRow( 0, 'HEAD' );
-               $this->addRow( 1, 'SOUR', 'unregistered' );
-               $this->addRow( 2, 'NAME', 'Semantic Genealogy' );
-               $this->addRow( 2, 'VERS', SG_VERSION  );
-               $this->addRow( 2, 'DATA', $wgSitename );
-               if( isset( $wgRightsText ) && $wgRightsText ) {
-                       $this->addRow( 3, 'COPR', $wgRightsText );
-               }
-               //$this->addRow( 1, 'FILE',  ); //TODO name of the file
-               $this->addRow( 1, 'DATE', strtoupper( date( 'd M Y' ) ) );
-               $this->addRow( 2, 'TIME', date( 'H:i:s' ) ); //TODO hh:mm:ss.fs
-               $this->addRow( 1, 'GEDC' );
-               $this->addRow( 2, 'VERS', 5.5 );
-               $this->addRow( 2, 'FORM', 'LINEAGE-LINKED' );
-               $this->addRow( 1, 'CHAR', 'UTF8' );
-               //$this->addRow( 1, 'LANG',  ); //TODO ?
-       }
-
-       /**
-        * add the GEDCOM for a person
-        * @param $person PersonPageValues
-        */
-       protected function addPerson( $id, PersonPageValues $person ) {
-               $this->addRow( 0, '@I'. $id . '@', 'INDI' );
-               $this->addRow( 1, 'NAME', $this->getGedcomName( $person ) );
-               $this->addStringValueAsRow( 2, 'GIVN', $person->givenname );
-               $this->addStringValueAsRow( 2, 'SURN', $person->surname );
-               $this->addStringValueAsRow( 2, 'NICK', $person->nickname );
-               $this->addStringValueAsRow( 2, 'NPFX', $person->prefix );
-               $this->addStringValueAsRow( 2, 'NSFX', $person->suffix );
-               $this->addStringValueAsRow( 1, 'SEX', $person->sex );
-               $familyId = $this->getFamilyIdForChild( $person );
-               if( $familyId != '0S0' ) {
-                       $this->addRow( 1, 'FAMC', '@F'. $familyId . '@' );
-               }
-               if( isset( $this->familiesByPerson[$id] ) ) {
-                       foreach( $this->familiesByPerson[$id] as $familyId ) {
-                               $this->addRow( 1, 'FAMS', '@F'. $familyId . '@' 
);
-                       }
-               }
-               $this->addEvent( 'BIRT', $person->birthdate, 
$person->birthplace );
-               $this->addEvent( 'DEAT', $person->deathdate, 
$person->deathplace );
-       }
-
-       protected function addFamily( $id, $children ) {
-               list( $fatherId, $motherId ) = explode('S', $id );
-               $this->addRow( 0, '@F'. $id . '@', 'FAM' );
-               if( $fatherId != 0 ) {
-                       $this->addRow( 1, 'HUSB', '@I' . $fatherId . '@' );
-               }
-               if( $motherId != 0 ) {
-                       $this->addRow( 1, 'WIFE', '@I' . $motherId . '@' );
-               }
-               foreach( $children as $childId ) {
-                       $this->addRow( 1, 'CHIL', '@I' . $childId . '@' );
-               }
-       }
-
-       protected function getGedcomName( PersonPageValues $person ) {
-               $name = '';
-               if( $person->givenname instanceof SMWDIBlob && 
$person->givenname->getString() != '' ) {
-                       $name .= $person->givenname->getString();
-               }
-               if( $person->surname instanceof SMWDIBlob && 
$person->surname->getString() != '' ) {
-                       $name .= '/' . $person->surname->getString() . '/';
-               }
-               if( $person->suffix instanceof SMWDIBlob && 
$person->suffix->getString() != '' ) {
-                       $name .= $person->suffixname->getString();
-               }
-               return $name;
-       }
-
-       protected function addRow( $level, $key, $value = null ) {
-               $this->file .= $level . ' ' . $key;
-               if( $value !== null ) {
-                       $this->file .= ' ' . str_replace( '\n', ' ', $value );
-               }
-               $this->file .= "\n";
-       }
-
-       /**
-       * TODO add places metadata support.
-       */
-       protected function addEvent( $type, $date, $place ) {
-               if( $date === null && $place === null ) {
-                       return;
-               }
-               $this->addRow( 1, $type );
-               $this->addTimeValueAsRow( 2, 'DATE', $date );
-               if( $place instanceof SMWDIWikiPage ) {
-                       $this->addWikiPageValueAsRow( 2, 'PLAC', $place );
-               } else {
-                       $this->addStringValueAsRow( 2, 'PLAC', $place );
-               }
-       }
-
-       protected function addStringValueAsRow( $level, $key, $value ) {
-               if( $value instanceof SMWDIBlob ) {
-                       $this->addRow( $level, $key, $value->getString() );
-               }
-       }
-
-       protected function addTimeValueAsRow( $level, $key, $value ) {
-               if( $value instanceof SMWDITime ) {
-                       $lang = new Language();
-                       $this->addRow( $level, $key, strtoupper( 
$lang->sprintfDate( 'd M Y', $value->getMwTimestamp( TS_MW ) ) ) );
-               }
-       }
-
-       protected function addWikiPageValueAsRow( $level, $key, $value ) {
-               if( $value instanceof SMWDIWikiPage ) {
-                       $this->addRow( $level, $key, 
$value->getTitle()->getText() );
-               }
-       }
+    /**
+     * set file in $this->file property
+     */
+    abstract protected function setFile();
 }
diff --git a/PersonPageValues.php b/PersonPageValues.php
index b37ad6b..d0a8e08 100644
--- a/PersonPageValues.php
+++ b/PersonPageValues.php
@@ -9,132 +9,139 @@
  * @licence GNU GPL v2+
  * @author Thomas Pellissier Tanon < thoma...@hotmail.fr >
  */
-class PersonPageValues {
-       protected $page;
-       public $title;
-       public $fullname;
-       public $surname;
-       public $givenname;
-       public $nickname;
-       public $prefix;
-       public $suffix;
-       public $sex;
-       public $birthdate;
-       public $birthplace;
-       public $deathdate;
-       public $deathplace;
-       public $father;
-       public $mother;
-       protected $children;
+class PersonPageValues
+{
+    protected $page;
+    public $title;
+    public $fullname;
+    public $surname;
+    public $givenname;
+    public $nickname;
+    public $prefix;
+    public $suffix;
+    public $sex;
+    public $birthdate;
+    public $birthplace;
+    public $deathdate;
+    public $deathplace;
+    public $father;
+    public $mother;
+    protected $children;
 
-       /**
-        * Constructor for a single indi in the file.
-        */
-       public function __construct( SMWDIWikiPage $page ) {
-               $values = array();
-               $storage = smwfGetStore();
-               $this->page = $page;
-               $this->title = $page->getTitle();
-               $properties = SemanticGenealogy::getProperties();
-               foreach( $properties as $key => $prop ) {
-                       $values = $storage->getPropertyValues( $page, $prop );
-                       if ( count( $values ) != 0 && 
property_exists('PersonPageValues', $key) ) {
-                               $this->$key = $values[0];
-                       }
-               }
+    /**
+     * Constructor for a single indi in the file.
+     */
+    public function __construct(SMWDIWikiPage $page)
+    {
+        $values = array();
+        $storage = smwfGetStore();
+        $this->page = $page;
+        $this->title = $page->getTitle();
+        $properties = SemanticGenealogy::getProperties();
+        foreach ($properties as $key => $prop) {
+            $values = $storage->getPropertyValues($page, $prop);
+            if (count($values) != 0 && property_exists('PersonPageValues', 
$key)) {
+                $this->$key = $values[0];
+            }
+        }
 
-               if( !( $this->fullname instanceof SMWDIBlob ) ) {
-                       if( $this->surname instanceof SMWDIBlob && 
$this->surname->getString() != '' ) {
-                               $fullname = '';
-                               if( $this->givenname instanceof SMWDIBlob ) {
-                                       $fullname .= 
$this->givenname->getString() . ' ';
-                               }
-                               $this->fullname = new SMWDIBlob( $fullname . 
$this->surname->getString() );
-                       } else {
-                               $this->fullname = new SMWDIBlob( 
$this->title->getText() );
-                       }
-               }
-       }
+        if (!( $this->fullname instanceof SMWDIBlob )) {
+            if ($this->surname instanceof SMWDIBlob && 
$this->surname->getString() != '') {
+                $fullname = '';
+                if ($this->givenname instanceof SMWDIBlob) {
+                    $fullname .= $this->givenname->getString() . ' ';
+                }
+                $this->fullname = new SMWDIBlob($fullname . 
$this->surname->getString());
+            } else {
+                $this->fullname = new SMWDIBlob($this->title->getText());
+            }
+        }
+    }
 
-       /**
-        * Return all the children as PersonPageValues
-        *
-        * @return array
-        */
-       public function getChildren() {
-               if( $this->children !== null )
-                       return $this->children;
+    /**
+     * Return all the children as PersonPageValues
+     *
+     * @return array
+     */
+    public function getChildren()
+    {
+        if ($this->children !== null) {
+            return $this->children;
+        }
 
-               $this->children = array();
-               $storage = smwfGetStore();
-               $properties = SemanticGenealogy::getProperties();
-               if( $properties['father'] instanceof SMWDIProperty ) {
-                       $childrenPage = $storage->getPropertySubjects( 
$properties['father'], $this->page );
-                       foreach($childrenPage as $page) {
-                               $this->children[] = new PersonPageValues( $page 
);
-                       }
-               }
-               if( $properties['mother'] instanceof SMWDIProperty ) {
-                       $childrenPage = $storage->getPropertySubjects( 
$properties['mother'], $this->page );
-                       foreach($childrenPage as $page) {
-                               $this->children[] = new PersonPageValues( $page 
);
-                       }
-               }
+        $this->children = array();
+        $storage = smwfGetStore();
+        $properties = SemanticGenealogy::getProperties();
+        if ($properties['father'] instanceof SMWDIProperty) {
+            $childrenPage = 
$storage->getPropertySubjects($properties['father'], $this->page);
+            foreach ($childrenPage as $page) {
+                $this->children[] = new PersonPageValues($page);
+            }
+        }
+        if ($properties['mother'] instanceof SMWDIProperty) {
+            $childrenPage = 
$storage->getPropertySubjects($properties['mother'], $this->page);
+            foreach ($childrenPage as $page) {
+                $this->children[] = new PersonPageValues($page);
+            }
+        }
 
-               usort( $this->children, array( "PersonPageValues", 
"comparePeopleByBirthDate" ) );
-               return $this->children;
-       }
+        usort($this->children, array( "PersonPageValues", 
"comparePeopleByBirthDate" ));
+        return $this->children;
+    }
 
-       public static function comparePeopleByBirthDate(PersonPageValues $a, 
PersonPageValues $b) {
-               if( $a->birthdate instanceof SMWDITime ) {
-                       $aKey = $a->birthdate->getSortKey();
-               } else {
-                       $aKey = 3000;
-               }
+    public static function comparePeopleByBirthDate(PersonPageValues $a, 
PersonPageValues $b)
+    {
+        if ($a->birthdate instanceof SMWDITime) {
+            $aKey = $a->birthdate->getSortKey();
+        } else {
+            $aKey = 3000;
+        }
 
-               if( $b->birthdate instanceof SMWDITime ) {
-                       $bKey = $b->birthdate->getSortKey();
-               } else {
-                       $bKey = 3000;
-               }
+        if ($b->birthdate instanceof SMWDITime) {
+            $bKey = $b->birthdate->getSortKey();
+        } else {
+            $bKey = 3000;
+        }
 
-               if( $bKey < $aKey ) {
-                       return 1;
-               } elseif( $bKey == $aKey ) {
-                       return 0;
-               } else {
-                       return -1;
-               }
-       }
+        if ($bKey < $aKey) {
+            return 1;
+        } elseif ($bKey == $aKey) {
+            return 0;
+        } else {
+            return -1;
+        }
+    }
 
-       public function getDescriptionWikiText( $withBr = false ) {
-               $text = '[[' . $this->title->getFullText() . '|' . 
$this->fullname->getString() . ']]';
-               if( $this->birthdate || $this->deathdate ) {
-                       if( $withBr ) {
-                               $text .= '<br />';
-                       }
-                       $text .= ' (';
-                       if( $this->birthdate instanceof SMWDITime ) {
-                               $text .= self::getWikiTextDateFromSMWDITime( 
$this->birthdate ) . ' ';
-                       }
-                       $text .= '-';
-                       if( $this->deathdate instanceof SMWDITime ) {
-                               $text .= ' ' . 
self::getWikiTextDateFromSMWDITime( $this->deathdate );
-                       }
-                       $text .= ')';
-               }
-               return $text;
-       }
+    public function getDescriptionWikiText($withBr = false)
+    {
+        $text = '[[' . $this->title->getFullText() . '|' . 
$this->fullname->getString() . ']]';
+        if ($this->birthdate || $this->deathdate) {
+            if ($withBr) {
+                $text .= '<br />';
+            }
+            $text .= ' (';
+            if ($this->birthdate instanceof SMWDITime) {
+                $text .= self::getWikiTextDateFromSMWDITime($this->birthdate) 
. ' ';
+            }
+            $text .= '-';
+            if ($this->deathdate instanceof SMWDITime) {
+                $text .= ' ' . 
self::getWikiTextDateFromSMWDITime($this->deathdate);
+            }
+            $text .= ')';
+        }
+        return $text;
+    }
 
-       protected static function getWikiTextDateFromSMWDITime( SMWDITime $di ) 
{
-               $val = new SMWTimeValue( SMWDataItem::TYPE_TIME );
-               $val->setDataItem( $di );
-               return $val->getShortWikiText();
+    protected static function getWikiTextDateFromSMWDITime(SMWDITime $di)
+    {
+        $val = new SMWTimeValue(SMWDataItem::TYPE_TIME);
+        $val->setDataItem($di);
+        return $val->getShortWikiText();
     }
 
     public static function getPageFromName($pageName)
     {
-               $pageTitle = Title::newFromText($pageName);
+        $pageTitle = Title::newFromText($pageName);
         return SMWDIWikiPage::newFromTitle($pageTitle);
     }
 }
diff --git a/RelationFamilyTree.php b/RelationFamilyTree.php
index 1bc9490..8df14ac 100644
--- a/RelationFamilyTree.php
+++ b/RelationFamilyTree.php
@@ -5,7 +5,7 @@
  *
  * Handle a FamilyTree to display the relationship between 2 persons.
  * Find the closest common ancestor
- * 
+ *
  * @file RelationFamilyTree.php
  * @ingroup SemanticGenealogy
  *
@@ -25,7 +25,7 @@
      * @param string $personName2 the page name of the person
      *
      * @see PersonPageValues::getPageFromName
-     * 
+     *
      * @return void
      */
     public function setPerson2($personName2)
@@ -37,57 +37,59 @@
 
     /**
      * Get the relation between the 2 persons (this->person and $this->person2)
-     * 
+     *
      * @return array an array of 2 trees
      */
     public function getRelation()
     {
         $tree1 = array();
         $tree2 = array();
-        $tree1[0][1] = new PersonPageValues( $this->person );
-        $tree2[0][1] = new PersonPageValues( $this->person2 );
+        $tree1[0][1] = new PersonPageValues($this->person);
+        $tree2[0][1] = new PersonPageValues($this->person2);
 
-        for($i = 0; $tree1[$i] !== null && $tree2[$i] !== null; $i++ ) {
-            $tree1 = $this->addGenInTree( $i + 1, $tree1 );
-            if($tree1[$i + 1] !== null) {
-                $result = $this->compareGenWith($tree1[$i + 1], $tree2, $i );
-                if($result !== null) {
+        for ($i = 0; $tree1[$i] !== null && $tree2[$i] !== null; $i++) {
+            $tree1 = $this->addGenInTree($i + 1, $tree1);
+            if ($tree1[$i + 1] !== null) {
+                $result = $this->compareGenWith($tree1[$i + 1], $tree2, $i);
+                if ($result !== null) {
                     list($sosa1, $sosa2) = $result;
                     break;
                 }
             }
 
-            $tree2 = $this->addGenInTree( $i + 1, $tree2 );
-            if($tree2[$i + 1] !== null) {
-                $result = $this->compareGenWith($tree2[$i + 1], $tree1, $i + 1 
);
-                if($result !== null) {
+            $tree2 = $this->addGenInTree($i + 1, $tree2);
+            if ($tree2[$i + 1] !== null) {
+                $result = $this->compareGenWith($tree2[$i + 1], $tree1, $i + 
1);
+                if ($result !== null) {
                     list($sosa2, $sosa1) = $result;
                     break;
                 }
             }
         }
 
-        if($result !== null)
-            return array( $this->getListOfAncestors( $sosa1, $tree1 ), 
$this->getListOfAncestors( $sosa2, $tree2 ) );
+        if ($result !== null) {
+            return array( $this->getListOfAncestors($sosa1, $tree1), 
$this->getListOfAncestors($sosa2, $tree2) );
+        }
     }
 
     /**
      * Compare a generation with a tree
-     * 
+     *
      * @param array $gen
      * @param array $tree the tree
      * @param integer $max the max depth
      *
      * @return array an array of 2 SOSA
      */
-    public function compareGenWith( array $gen, array $tree, $max ) {
-        for( $i = $max; $i >= 0; $i-- ) {
-            if( isset( $tree[$i] ) ) {
-                foreach( $tree[$i] as $sosa2 => $person2 ) {
-                    if($person2 !== null) {
-                        foreach( $gen as $sosa1 => $person1 ) {
-                            if($person1 !== null) {
-                                if( $person1->title->equals( $person2->title ) 
) {
+    public function compareGenWith(array $gen, array $tree, $max)
+    {
+        for ($i = $max; $i >= 0; $i--) {
+            if (isset( $tree[$i] )) {
+                foreach ($tree[$i] as $sosa2 => $person2) {
+                    if ($person2 !== null) {
+                        foreach ($gen as $sosa1 => $person1) {
+                            if ($person1 !== null) {
+                                if ($person1->title->equals($person2->title)) {
                                     return array( $sosa1, $sosa2 );
                                 }
                             }
@@ -101,22 +103,23 @@
 
     /**
      * Get the list of ancestors for a sosa number
-     * 
+     *
      * @param integer $sosa the SOSA number
      * @param array   $tree
      *
      * @return array the list of ancestors
      */
-    public function getListOfAncestors( $sosa, array $tree ) {
+    public function getListOfAncestors($sosa, array $tree)
+    {
         $num = 1;
         $temp = 1;
-        for($i = 0; $num < $sosa; $i++) {
+        for ($i = 0; $num < $sosa; $i++) {
             $temp *= 2;
             $num += $temp;
         }
 
         $list = array();
-        for( $j = $i; $j >= 0; $j-- ) {
+        for ($j = $i; $j >= 0; $j--) {
             $list[] = $tree[$j][$sosa];
             $sosa /= 2;
         }
@@ -132,33 +135,35 @@
     {
         $output = $this->getOutput();
         $tree = $this->getRelation();
-        if (!$tree)
-        {
-            $output->addWikiText( '<span class="error">' . wfMsg( 
'semanticgenealogy-specialfamilytree-error-nolinkfound', $this->personName, 
$this->personName2 ) . '</span>' );
+        if (!$tree) {
+            $output->addWikiText('<span class="error">' . 
wfMsg('semanticgenealogy-specialfamilytree-error-nolinkfound', 
$this->personName, $this->personName2) . '</span>');
             return;
         }
         list($tree1, $tree2) = $tree;
 
-        $output->addHTML( '<table style="text-align:center;">' );
-        $output->addHTML( '<tr><td colspan="2">' );
+        $output->addHTML('<table style="text-align:center;">');
+        $output->addHTML('<tr><td colspan="2">');
         $person = $tree1[0];
-        if( $person->fullname instanceof SMWDIBlob )
-            $output->addWikiText( $person->getDescriptionWikiText( false ) );
-        $output->addHTML( '</td></tr>' );
+        if ($person->fullname instanceof SMWDIBlob) {
+            $output->addWikiText($person->getDescriptionWikiText(false));
+        }
+        $output->addHTML('</td></tr>');
 
-        $length = max( count( $tree1 ), count( $tree2 ) );
-        for($i = 1; $i < $length; $i++ ) {
+        $length = max(count($tree1), count($tree2));
+        for ($i = 1; $i < $length; $i++) {
             $output->addHTML('<tr><td>');
-            if( isset( $tree1[$i] ) ) {
+            if (isset( $tree1[$i] )) {
                 $person = $tree1[$i];
-                if( $person->fullname instanceof SMWDIBlob )
-                    $output->addWikiText( '|<br/>' . 
$person->getDescriptionWikiText( false ) );
+                if ($person->fullname instanceof SMWDIBlob) {
+                    $output->addWikiText('|<br/>' . 
$person->getDescriptionWikiText(false));
+                }
             }
             $output->addHTML('</td><td>');
-            if( isset( $tree2[$i] ) ) {
+            if (isset( $tree2[$i] )) {
                 $person = $tree2[$i];
-                if( $person->fullname instanceof SMWDIBlob )
-                    $output->addWikiText( '|<br/>' . 
$person->getDescriptionWikiText( false ) );
+                if ($person->fullname instanceof SMWDIBlob) {
+                    $output->addWikiText('|<br/>' . 
$person->getDescriptionWikiText(false));
+                }
             }
             $output->addHTML('</td></tr>');
         }
diff --git a/SemanticGenealogy.alias.php b/SemanticGenealogy.alias.php
index 183653a..6d1632a 100644
--- a/SemanticGenealogy.alias.php
+++ b/SemanticGenealogy.alias.php
@@ -13,10 +13,10 @@
 
 /** English (English) */
 $specialPageAliases['en'] = array(
-       'FamilyTree' => array( 'FamilyTree' ),
+    'FamilyTree' => array( 'FamilyTree' ),
 );
 
 /** French (Français) */
 $specialPageAliases['fr'] = array(
-       'FamilyTree' => array( 'ArbreGénéalogique'),
+    'FamilyTree' => array( 'ArbreGénéalogique'),
 );
diff --git a/SemanticGenealogy.body.php b/SemanticGenealogy.body.php
index 3546cb5..5d23d3e 100644
--- a/SemanticGenealogy.body.php
+++ b/SemanticGenealogy.body.php
@@ -9,30 +9,33 @@
  * @licence GNU GPL v2+
  * @author Thomas Pellissier Tanon < thoma...@hotmail.fr >
  */
-class SemanticGenealogy {
+class SemanticGenealogy
+{
 
-       /**
-        * Get an array key => value of genealogical properties as SMWDIProperty
-        * @throws MWException
-        */
-       public static function getProperties() {
-               static $properties;
+    /**
+     * Get an array key => value of genealogical properties as SMWDIProperty
+     * @throws MWException
+     */
+    public static function getProperties()
+    {
+        static $properties;
 
-               if( $properties !== null )
-                       return $properties;
+        if ($properties !== null) {
+            return $properties;
+        }
 
-               global $wgGenealogicalProperties, $wgOut;
-               $properties = array();
+        global $wgGenealogicalProperties, $wgOut;
+        $properties = array();
 
-               if( !is_array( $wgGenealogicalProperties ) ) {
-                       throw new MWException( 'Configuration variable 
$wgGenealogicalProperties must be an array !' );
-               }
+        if (!is_array($wgGenealogicalProperties)) {
+            throw new MWException('Configuration variable 
$wgGenealogicalProperties must be an array !');
+        }
 
-               foreach( $wgGenealogicalProperties as $key => $value ) {
-                       if( $value ) {
-                               $properties[$key] = 
SMWDIProperty::newFromUserLabel( $value );
-                       }
-               }
-               return $properties;
-       }
+        foreach ($wgGenealogicalProperties as $key => $value) {
+            if ($value) {
+                $properties[$key] = SMWDIProperty::newFromUserLabel($value);
+            }
+        }
+        return $properties;
+    }
 }
diff --git a/SemanticGenealogy.i18n.php b/SemanticGenealogy.i18n.php
index fc01394..16d23b4 100644
--- a/SemanticGenealogy.i18n.php
+++ b/SemanticGenealogy.i18n.php
@@ -11,25 +11,26 @@
  * This shim maintains compatibility back to MediaWiki 1.17.
  */
 $messages = array();
-if ( !function_exists( 'wfJsonI18nShimc57238e8287ad032' ) ) {
-       function wfJsonI18nShimc57238e8287ad032( $cache, $code, &$cachedData ) {
-               $codeSequence = array_merge( array( $code ), 
$cachedData['fallbackSequence'] );
-               foreach ( $codeSequence as $csCode ) {
-                       $fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
-                       if ( is_readable( $fileName ) ) {
-                               $data = FormatJson::decode( file_get_contents( 
$fileName ), true );
-                               foreach ( array_keys( $data ) as $key ) {
-                                       if ( $key === '' || $key[0] === '@' ) {
-                                               unset( $data[$key] );
-                                       }
-                               }
-                               $cachedData['messages'] = array_merge( $data, 
$cachedData['messages'] );
-                       }
+if (!function_exists('wfJsonI18nShimc57238e8287ad032')) {
+    function wfJsonI18nShimc57238e8287ad032($cache, $code, &$cachedData)
+    {
+        $codeSequence = array_merge(array( $code ), 
$cachedData['fallbackSequence']);
+        foreach ($codeSequence as $csCode) {
+            $fileName = dirname(__FILE__) . "/i18n/$csCode.json";
+            if (is_readable($fileName)) {
+                $data = FormatJson::decode(file_get_contents($fileName), true);
+                foreach (array_keys($data) as $key) {
+                    if ($key === '' || $key[0] === '@') {
+                        unset( $data[$key] );
+                    }
+                }
+                $cachedData['messages'] = array_merge($data, 
$cachedData['messages']);
+            }
 
-                       $cachedData['deps'][] = new FileDependency( $fileName );
-               }
-               return true;
-       }
+            $cachedData['deps'][] = new FileDependency($fileName);
+        }
+        return true;
+    }
 
-       $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 
'wfJsonI18nShimc57238e8287ad032';
+    $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 
'wfJsonI18nShimc57238e8287ad032';
 }
diff --git a/SemanticGenealogy.php b/SemanticGenealogy.php
index 9ce5a0d..3789f1b 100644
--- a/SemanticGenealogy.php
+++ b/SemanticGenealogy.php
@@ -19,50 +19,50 @@
  * @defgroup SemanticGenealogy Semantic Genealogy
  */
 
-if ( !defined( 'MEDIAWIKI' ) ) {
-       die( 'Not an entry point.' );
+if (!defined('MEDIAWIKI')) {
+    die( 'Not an entry point.' );
 }
 
-if ( version_compare( $wgVersion, '1.19', '<' ) ) {
-       die( '<b>Error:</b> This version of Semantic Genealogy requires 
MediaWiki 1.19 or above.' );
+if (version_compare($wgVersion, '1.19', '<')) {
+    die( '<b>Error:</b> This version of Semantic Genealogy requires MediaWiki 
1.19 or above.' );
 }
 
 // Show a warning if Semantic MediaWiki is not loaded.
-if ( ! defined( 'SMW_VERSION' ) ) {
-       die( '<b>Error:</b> You need to have <a 
href="http://semantic-mediawiki.org/wiki/Semantic_MediaWiki";>Semantic 
MediaWiki</a> installed in order to use <a 
href="http://www.mediawiki.org/wiki/Extension:Semantic Maps">Semantic 
Maps</a>.<br />' );
+if (! defined('SMW_VERSION')) {
+    die( '<b>Error:</b> You need to have <a 
href="http://semantic-mediawiki.org/wiki/Semantic_MediaWiki";>Semantic 
MediaWiki</a> installed in order to use <a 
href="http://www.mediawiki.org/wiki/Extension:Semantic Maps">Semantic 
Maps</a>.<br />' );
 }
 
-if ( version_compare( SMW_VERSION, '1.7.0 alpha', '<' ) ) {
-       die( '<b>Error:</b> This version of Semantic Genealogy requires 
Semantic MediaWiki 1.7 or above.' );
+if (version_compare(SMW_VERSION, '1.7.0 alpha', '<')) {
+    die( '<b>Error:</b> This version of Semantic Genealogy requires Semantic 
MediaWiki 1.7 or above.' );
 }
 
-define( 'SG_VERSION', '0.2.0 alpha' );
+define('SG_VERSION', '0.2.0 alpha');
 
 $wgExtensionCredits['semantic'][] = array(
-       'path' => __FILE__,
-       'name' => 'Semantic Genealogy',
-       'version' => SG_VERSION,
-       'author' => array(
-               '[http://www.mediawiki.org/wiki/User:Tpt Tpt]'
-       ),
-       'url' => 'https://www.mediawiki.org/wiki/Extension:Semantic_Genealogy',
-       'descriptionmsg' => 'semanticgenealogy-desc'
+    'path' => __FILE__,
+    'name' => 'Semantic Genealogy',
+    'version' => SG_VERSION,
+    'author' => array(
+        '[http://www.mediawiki.org/wiki/User:Tpt Tpt]'
+    ),
+    'url' => 'https://www.mediawiki.org/wiki/Extension:Semantic_Genealogy',
+    'descriptionmsg' => 'semanticgenealogy-desc'
 );
 
 $wgGenealogicalProperties = array(
-       'givenname' => 'Prénom',
-       'surname' => 'Nom',
-       'nickname' => '',
-       'sex' => 'Sexe',
-       'birthdate' => 'Date de naissance',
-       'birthplace' => 'Lieu de naissance',
-       'deathdate' => 'Date de décès',
-       'deathplace' => 'Lieu de décès',
-       'father' => 'Père',
-       'mother' => 'Mère'
+    'givenname' => 'Prénom',
+    'surname' => 'Nom',
+    'nickname' => '',
+    'sex' => 'Sexe',
+    'birthdate' => 'Date de naissance',
+    'birthplace' => 'Lieu de naissance',
+    'deathdate' => 'Date de décès',
+    'deathplace' => 'Lieu de décès',
+    'father' => 'Père',
+    'mother' => 'Mère'
 );
 
-$dir = dirname( __FILE__ ) . '/';
+$dir = dirname(__FILE__) . '/';
 
 $wgMessagesDirs['SemanticGenealogy'] = __DIR__ . '/i18n';
 $wgExtensionMessagesFiles['SemanticGenealogy'] =  $dir . 
'SemanticGenealogy.i18n.php';
@@ -78,7 +78,7 @@
 $wgAutoloadClasses['FamilyTreeFactory'] = $dir . 'FamilyTreeFactory.php';
 
 $wgAutoloadClasses['GenealogicalFilePrinter'] = $dir . 
'GenealogicalFilePrinter.php';
-$wgAutoloadClasses['Gedcom5FilePrinter'] = $dir . 
'GenealogicalFilePrinter.php';
+$wgAutoloadClasses['Gedcom5FilePrinter'] = $dir . 'Gedcom5FilePrinter.php';
 $wgAutoloadClasses['Gedcom5ResultPrinter'] = $dir . 'Gedcom5ResultPrinter.php';
 $smwgResultFormats['gedcom'] = 'Gedcom5ResultPrinter';
 $smwgResultFormats['gedcom5'] = 'Gedcom5ResultPrinter';
@@ -87,16 +87,16 @@
 $wgSpecialPages['FamilyTree'] = 'SpecialFamilyTree';
 
 $moduleTemplate = array(
-       'localBasePath' => $dir,
-       'remoteBasePath' => ( $wgExtensionAssetsPath === false ? $wgScriptPath 
. '/extensions' : $wgExtensionAssetsPath ) . '/SemanticGenealogy',
-       'group' => 'ext.smg'
+    'localBasePath' => $dir,
+    'remoteBasePath' => ( $wgExtensionAssetsPath === false ? $wgScriptPath . 
'/extensions' : $wgExtensionAssetsPath ) . '/SemanticGenealogy',
+    'group' => 'ext.smg'
 );
 
 $wgResourceModules['ext.smg.specialfamilytree'] = $moduleTemplate + array(
-       'scripts' => 'specialFamilyTree.js',
-       'dependencies' => array( 'jquery.ui.autocomplete' ),
-       'messages' => array(
-       )
+    'scripts' => 'specialFamilyTree.js',
+    'dependencies' => array( 'jquery.ui.autocomplete' ),
+    'messages' => array(
+    )
 );
 
 
diff --git a/SpecialFamilyTree.php b/SpecialFamilyTree.php
index 90b19b4..852f414 100644
--- a/SpecialFamilyTree.php
+++ b/SpecialFamilyTree.php
@@ -2,7 +2,7 @@
 
 /**
  * Special page that show a family tree
- * 
+ *
  * @file SpecialFamilyTree.php
  * @ingroup SemanticGenealogy
  *
@@ -19,9 +19,9 @@
      *
      * @return void
      */
-    public function __construct( $name = 'FamilyTree' )
+    public function __construct($name = 'FamilyTree')
     {
-        parent::__construct( $name, 'other' );
+        parent::__construct($name, 'other');
         $this->mIncludable = true;
     }
 
@@ -32,88 +32,88 @@
      *
      * @return boolean the status of the rendered page
      */
-    public function execute( $par )
+    public function execute($par)
     {
         global $wgRequest, $wgScript;
 
         $this->setHeaders();
         $output = $this->getOutput();
 
-        if( $par != '') {
-            $parts = explode('/', urldecode( $par ));
+        if ($par != '') {
+            $parts = explode('/', urldecode($par));
         } else {
             $parts = array();
         }
 
-        $type = isset( $parts[0] ) ? $parts[0] : $wgRequest->getText( 'type' );
-        if($type == '') {
+        $type = isset( $parts[0] ) ? $parts[0] : $wgRequest->getText('type');
+        if ($type == '') {
             $type = 'ancestors';
         }
 
-        $pageName = isset( $parts[1] ) ? $parts[1] : $wgRequest->getText( 
'page' );
+        $pageName = isset( $parts[1] ) ? $parts[1] : 
$wgRequest->getText('page');
 
-        if( $type == 'link' ) {
-            $pageName2 = isset( $parts[2] ) ? $parts[2] : $wgRequest->getText( 
'page2' );
+        if ($type == 'link') {
+            $pageName2 = isset( $parts[2] ) ? $parts[2] : 
$wgRequest->getText('page2');
             $numOfGenerations = 0;
         } else {
-            $numOfGenerations = isset( $parts[2] ) ? intval( $parts[2] ) : 
$wgRequest->getInt( 'gen' );
-            if($numOfGenerations <= 0) {
+            $numOfGenerations = isset( $parts[2] ) ? intval($parts[2]) : 
$wgRequest->getInt('gen');
+            if ($numOfGenerations <= 0) {
                 $numOfGenerations = 5;
             }
             $pageName2 = '';
         }
 
-        if( !$this->mIncluding ) {
-            $output->addModules( 'ext.smg.specialfamilytree' );
-            $typeSelect = new XmlSelect( 'type', 'type', $type );
-            $typeSelect->addOption( wfMsg( 
'semanticgenealogy-specialfamilytree-type-ancestors' ), 'ancestors' );
-            $typeSelect->addOption( wfMsg( 
'semanticgenealogy-specialfamilytree-type-descendant' ), 'descendant' );
-            $typeSelect->addOption( wfMsg( 
'semanticgenealogy-specialfamilytree-type-link' ), 'link' );
+        if (!$this->mIncluding) {
+            $output->addModules('ext.smg.specialfamilytree');
+            $typeSelect = new XmlSelect('type', 'type', $type);
+            
$typeSelect->addOption(wfMsg('semanticgenealogy-specialfamilytree-type-ancestors'),
 'ancestors');
+            
$typeSelect->addOption(wfMsg('semanticgenealogy-specialfamilytree-type-descendant'),
 'descendant');
+            
$typeSelect->addOption(wfMsg('semanticgenealogy-specialfamilytree-type-link'), 
'link');
             $output->addHTML(
-                Xml::openElement( 'form', array( 'action' => $wgScript ) ) .
-                    Html::hidden( 'title', 
$this->getPageTitle()->getPrefixedText() ) .
-                    Xml::openElement( 'fieldset' ) .
-                        Xml::openElement( 'table', array( 'id' => 
'smg-familyTree-form' ) ) .
-                            Xml::openElement( 'tr', array('id' => 
'smg-form-entry-page' ) ) .
-                                Xml::openElement( 'th', array('class' => 
'mw-label') ) .
-                                    Xml::label( wfMsg( 
'semanticgenealogy-specialfamilytree-label-page' ), 'page' ) .
-                                Xml::closeElement( 'th' ) .
-                                Xml::openElement( 'td', array('class' => 
'mw-input') ) .
-                                    Xml::input( 'page', 30, $pageName, array( 
'class' => 'smg-input-page' ) ) .
-                                Xml::closeElement( 'td' ) .
-                            Xml::closeElement( 'tr' ) .
-                            Xml::openElement( 'tr', array('id' => 
'smg-form-entry-type' ) ) .
-                                Xml::openElement( 'th', array('class' => 
'mw-label') ) .
-                                    Xml::label( wfMsg( 
'semanticgenealogy-specialfamilytree-label-type' ), 'type' ) .
-                                Xml::closeElement( 'th' ) .
-                                Xml::openElement( 'td', array('class' => 
'mw-input') ) .
-                                    $typeSelect->getHtml() .
-                                Xml::closeElement( 'td' ) .
-                            Xml::closeElement( 'tr' ) .
-                            Xml::openElement( 'tr', array('id' => 
'smg-form-entry-gen' ) ) .
-                                Xml::openElement( 'th', array('class' => 
'mw-label') ) .
-                                    Xml::label( wfMsg( 
'semanticgenealogy-specialfamilytree-label-gen' ), 'gen' ) .
-                                Xml::closeElement( 'th' ) .
-                                Xml::openElement( 'td', array('class' => 
'mw-input') ) .
-                                    Xml::input( 'gen', 2, $numOfGenerations ) .
-                                Xml::closeElement( 'td' ) .
-                            Xml::closeElement( 'tr' ) .
-                            Xml::openElement( 'tr', array('id' => 
'smg-form-entry-page2' ) ) .
-                                Xml::openElement( 'th', array('class' => 
'mw-label') ) .
-                                    Xml::label( wfMsg( 
'semanticgenealogy-specialfamilytree-label-page2' ), 'page2' ) .
-                                Xml::closeElement( 'th' ) .
-                                Xml::openElement( 'td', array('class' => 
'mw-input') ) .
-                                    Xml::input( 'page2', 30, $pageName2, 
array( 'class' => 'smg-input-page' ) ) .
-                                Xml::closeElement( 'td' ) .
-                            Xml::closeElement( 'tr' ) .
-                        Xml::closeElement( 'table' ) .
-                        Xml::submitButton( wfMsg( 
'semanticgenealogy-specialfamilytree-button-submit' ) ) .
-                    Xml::closeElement( 'fieldset' ) .
-                Xml::closeElement( 'form' )
+                Xml::openElement('form', array( 'action' => $wgScript )) .
+                Html::hidden('title', 
$this->getPageTitle()->getPrefixedText()) .
+                Xml::openElement('fieldset') .
+                Xml::openElement('table', array( 'id' => 'smg-familyTree-form' 
)) .
+                Xml::openElement('tr', array('id' => 'smg-form-entry-page' )) .
+                Xml::openElement('th', array('class' => 'mw-label')) .
+                
Xml::label(wfMsg('semanticgenealogy-specialfamilytree-label-page'), 'page') .
+                Xml::closeElement('th') .
+                Xml::openElement('td', array('class' => 'mw-input')) .
+                Xml::input('page', 30, $pageName, array( 'class' => 
'smg-input-page' )) .
+                Xml::closeElement('td') .
+                Xml::closeElement('tr') .
+                Xml::openElement('tr', array('id' => 'smg-form-entry-type' )) .
+                Xml::openElement('th', array('class' => 'mw-label')) .
+                
Xml::label(wfMsg('semanticgenealogy-specialfamilytree-label-type'), 'type') .
+                Xml::closeElement('th') .
+                Xml::openElement('td', array('class' => 'mw-input')) .
+                $typeSelect->getHtml() .
+                Xml::closeElement('td') .
+                Xml::closeElement('tr') .
+                Xml::openElement('tr', array('id' => 'smg-form-entry-gen' )) .
+                Xml::openElement('th', array('class' => 'mw-label')) .
+                
Xml::label(wfMsg('semanticgenealogy-specialfamilytree-label-gen'), 'gen') .
+                Xml::closeElement('th') .
+                Xml::openElement('td', array('class' => 'mw-input')) .
+                Xml::input('gen', 2, $numOfGenerations) .
+                Xml::closeElement('td') .
+                Xml::closeElement('tr') .
+                Xml::openElement('tr', array('id' => 'smg-form-entry-page2' )) 
.
+                Xml::openElement('th', array('class' => 'mw-label')) .
+                
Xml::label(wfMsg('semanticgenealogy-specialfamilytree-label-page2'), 'page2') .
+                Xml::closeElement('th') .
+                Xml::openElement('td', array('class' => 'mw-input')) .
+                Xml::input('page2', 30, $pageName2, array( 'class' => 
'smg-input-page' )) .
+                Xml::closeElement('td') .
+                Xml::closeElement('tr') .
+                Xml::closeElement('table') .
+                
Xml::submitButton(wfMsg('semanticgenealogy-specialfamilytree-button-submit')) .
+                Xml::closeElement('fieldset') .
+                Xml::closeElement('form')
             );
         }
 
-        if( $pageName == '') {
+        if ($pageName == '') {
             return;
         }
 
@@ -137,7 +137,8 @@
      *
      * @return boolean
      */
-    public function isCacheable() {
+    public function isCacheable()
+    {
         return false;
     }
 
@@ -146,8 +147,9 @@
      *
      * @return string
      */
-    public function getDescription( ) {
-        return wfMsg( 'semanticgenealogy-specialfamilytree-title' );
+    public function getDescription()
+    {
+        return wfMsg('semanticgenealogy-specialfamilytree-title');
     }
 
 
@@ -156,7 +158,8 @@
      *
      * @return string
      */
-    protected function getGroupName() {
+    protected function getGroupName()
+    {
         return 'other';
     }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/245906
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9aa98b6d408866cf9c440fe1e0dfc95624d5af11
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticGenealogy
Gerrit-Branch: master
Gerrit-Owner: Wilkins <thiba...@taillandier.name>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to