[MediaWiki-commits] [Gerrit] mediawiki...SemanticGenealogy[master]: Patch for the previous commit in review

2017-08-08 Thread Wilkins (Code Review)
Wilkins has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/370632 )

Change subject: Patch for the previous commit in review
..

Patch for the previous commit in review

Handling Kghbln comments
- https urls
- removing shim
- compatibiliy with MediaWiki 1.23+
- some cleanup
- merging INSTALL into README

Change-Id: I12e27d9f1ce001934382cae0c34659d32ec1
---
D INSTALL
M README.md
D SemanticGenealogy.i18n.php
M SemanticGenealogy.php
4 files changed, 108 insertions(+), 93 deletions(-)


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

diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index 459c84a..000
--- a/INSTALL
+++ /dev/null
@@ -1,20 +0,0 @@
-
-== Requirements ==
-
-Semantic Genealogy requires:
-* MediaWiki 1.19 or above
-* Semantic MediaWiki 1.17 or above
-* PHP 5.3 or above
-
-
-== Installation ==
-
-Installation instructions are available online in a more convenient form for
-reading at https://www.mediawiki.org/wiki/Extension:SemanticGenalogy
-
-Copy all files into MediaWiki's extensions folder, either by using Git or by
-extracting an installation package. You need to enter one line to your local
-settings (somewhere after the inclusion of Semantic MediaWiki):
-
-// Semantic Genealogy
-require_once( "$IP/extensions/SemanticGenealogy/SemanticGenealogy.php" );
diff --git a/README.md b/README.md
index 619f185..8c61cb1 100644
--- a/README.md
+++ b/README.md
@@ -1,20 +1,95 @@
 Semantic Genealogy
 ==
-THIS EXTENSION IS CURRENTLY IN DEVELOPMENT AND IS NOT DONE TO BE USED IN A 
PRODUCTION ENVIRONMENT. BREAKING CHANGES CAN BE INTRODUCED !
 
+Features
+
 
-### Features
-* Special page to generate a FamilyTree
+* Special page to generate a FamilyTree : `Special:FamilyTree`
 * Include FamilyTree inside pages with a wiki code
 * Several Trees: Ancestors Tree, Descendants Tree, Relation Link Tree, 
Descendants list
 * Several Styles: Simple, Boxes
 * GEDCOM file format export
 
 
-### Authors
-* Thomas Pellissier Tanon  (Maintainer)
+Requirements
+
+
+Semantic Genealogy requires:
+* MediaWiki 1.23 or above
+* Semantic MediaWiki 1.7 or above
+* PHP 5.4 or above
 
 
-### Links
+Installation
+
+
+ Installation from source
+
+Installation instructions are available online in a more convenient form for
+reading at https://www.mediawiki.org/wiki/Extension:Semantic_Genealogy
+
+Copy all files into MediaWiki's extensions folder, either by using Git or by
+extracting an installation package. You need to enter one line to your local
+settings (somewhere after the inclusion of Semantic MediaWiki):
+
+
+ Installation from composer
+
+Not yet.
+
+
+Configuration
+-
+
+```php
+// Semantic Genealogy
+require_once "$IP/extensions/SemanticGenealogy/SemanticGenealogy.php";
+
+// Insert the $wgGenealogicalProperties array to specify which Semantic 
properties match which concept.
+// The properties can differ if you used personnal nouns that fit your 
language.
+
+// Here is an example of a french configuration
+$wgGenealogicalProperties = array(
+'givenname' => 'Prenom',
+'surname' => 'Nom',
+'nickname' => 'Surnom',
+'sex' => 'Sexe',
+'birthdate' => 'Datenaissance',
+'birthplace' => 'Lieunaissance',
+'deathdate' => 'Datedeces',
+'deathplace' => 'Lieudeces',
+'father' => 'Pere',
+'mother' => 'Mere',
+'partner' => 'Conjoint'
+);
+
+// Here is an example of an english configuration
+$wgGenealogicalProperties = array(
+'givenname' => 'Firstname',
+'surname' => 'Lastname',
+'nickname' => 'Nickname',
+'sex' => 'Sex',
+'birthdate' => 'date of birth',
+'birthplace' => 'place of birth',
+'deathdate' => 'date of death',
+'deathplace' => 'place of death',
+'father' => 'Father',
+'mother' => 'Mother',
+'partner' => 'Conjoint'
+);
+
+```
+
+
+Authors
+---
+
+* Thomas Pellissier Tanon  (Author, Maintainer)
+* Thibault Taillandier  (Developer)
+
+
+Links
+-
+
 * Official extension page : 
https://www.mediawiki.org/wiki/Extension:Semantic_Genealogy
 
diff --git a/SemanticGenealogy.i18n.php b/SemanticGenealogy.i18n.php
deleted file mode 100644
index d127f33..000
--- a/SemanticGenealogy.i18n.php
+++ /dev/null
@@ -1,44 +0,0 @@
-https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
- *
- * Beginning with MediaWiki 1.23, translation strings are stored in json files,
- * and the EXTENSION.i18n.php file only exists to provide compatibility with
- * older releases of MediaWiki. For more information about this migration, see:
- * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
- *
- * This shim maintains compatibility back to MediaWiki 1.17.
- */
-$messages = [];
-if ( !function_exists( 'wfJsonI18nShimc57238e8287ad032' ) ) {
-   /**
-* I have no idea what t

[MediaWiki-commits] [Gerrit] mediawiki...SemanticGenealogy[master]: Patch for the previous commit in review - fixing syntax base...

2017-08-07 Thread Wilkins (Code Review)
Wilkins has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/370594 )

Change subject: Patch for the previous commit in review - fixing syntax based 
on codesniffer v0.10 - deleting composer.lock
..

Patch for the previous commit in review
- fixing syntax based on codesniffer v0.10
- deleting composer.lock

Change-Id: I726a246e89c8b5b381f7ff1233ca59019ae86d57
---
M Gedcom5FilePrinter.php
M Gedcom5ResultPrinter.php
M GenealogicalFilePrinter.php
M PersonPageValues.php
M SemanticGenealogy.alias.php
M SemanticGenealogy.body.php
M SemanticGenealogy.i18n.php
M SemanticGenealogy.php
M SemanticGenealogyException.php
M SpecialFamilyTree.php
M Tools.php
M composer.json
D composer.lock
M src/Decorator/BoxDecorator.php
M src/Decorator/SimpleDecorator.php
M src/Decorator/TreeDecorator.php
M src/Decorator/TreeDecoratorFactory.php
M src/Tree/AncestorsFamilyTree.php
M src/Tree/DescendantFamilyTree.php
M src/Tree/DescendantListFamilyTree.php
M src/Tree/FamilyTree.php
M src/Tree/FamilyTreeFactory.php
M src/Tree/LinkFamilyTree.php
23 files changed, 319 insertions(+), 352 deletions(-)


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

diff --git a/Gedcom5FilePrinter.php b/Gedcom5FilePrinter.php
index e13811e..47b3787 100644
--- a/Gedcom5FilePrinter.php
+++ b/Gedcom5FilePrinter.php
@@ -11,11 +11,10 @@
  * @licence GNU GPL v2+
  * @author  Thomas Pellissier Tanon 
  */
-class Gedcom5FilePrinter extends GenealogicalFilePrinter
-{
+class Gedcom5FilePrinter extends GenealogicalFilePrinter {
 
-   protected $families = array();
-   protected $familiesByPerson = array();
+   protected $families = [];
+   protected $familiesByPerson = [];
 
/**
 * Set file in $this->file property
@@ -23,7 +22,6 @@
 * @return void
 */
protected function setFile() {
-
$this->setFamiliesList();
 
$this->addHead();
@@ -42,20 +40,25 @@
 * @return void
 */
protected function setFamiliesList() {
-
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 );
+   $familyId = $this->getFamilyIdForChild( $child );
+   if ( $familyId != '0S0' ) {
+   $this->addChildToFamily( $familyId, $child );
+   list( $fatherId, $motherId ) = explode( 'S', 
$familyId );
+   $this->addFamilyToPerson( $familyId, $fatherId 
);
+   $this->addFamilyToPerson( $familyId, $motherId 
);
}
}
}
 
+   /**
+* Get the family Id if the given child
+*
+* @param object $child the PersonPageValues object of the child
+*
+* @return string the key
+*/
protected function getFamilyIdForChild( PersonPageValues $child ) {
-
$key = '';
if ( $child->father instanceof SMWDIWikiPage
&& isset( 
$this->people[$child->father->getTitle()->getArticleID()] ) ) {
@@ -78,36 +81,51 @@
return $key;
}
 
+   /**
+* Adds a child to a family
+*
+* @param string $familyKey the family key
+* @param object $child the PersonPageValues object of the child to add
+*
+* @return void
+*/
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 );
+   $this->families[$familyKey] = [ $childId ];
}
}
 
+   /**
+* Adds a family to a person
+*
+* @param integer $familyId the id of the family
+* @param integer $personId the id of the person
+*
+* @return void
+*/
protected function addFamilyToPerson( $familyId, $personId ) {
-
if ( $personId != 0 ) {
if ( isset( $this->familiesByPerson[$personId] ) ) {
if ( !in_array( $familyId, 
$this->familiesByPerson[$personId] ) ) {