@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | class Individual extends GedcomRecord { |
| 23 | 23 | |
| 24 | 24 | /** @var array|null List of titles the individal holds */ |
| 25 | - protected $_titles=null; |
|
| 25 | + protected $_titles = null; |
|
| 26 | 26 | |
| 27 | 27 | /** @var string|null Individual's primary surname, without any privacy applied to it */ |
| 28 | 28 | protected $_unprotectedPrimarySurname = null; |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | * @param null|string $gedcom |
| 45 | 45 | * @return null|Individual |
| 46 | 46 | */ |
| 47 | - public static function getIntance($xref, Tree $tree, $gedcom = null){ |
|
| 47 | + public static function getIntance($xref, Tree $tree, $gedcom = null) { |
|
| 48 | 48 | $indi = \Fisharebest\Webtrees\Individual::getInstance($xref, $tree, $gedcom); |
| 49 | - if($indi){ |
|
| 49 | + if ($indi) { |
|
| 50 | 50 | return new Individual($indi); |
| 51 | 51 | } |
| 52 | 52 | return null; |
@@ -57,18 +57,18 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return array Array of titles |
| 59 | 59 | */ |
| 60 | - public function getTitles(){ |
|
| 61 | - if(is_null($this->_titles) && $module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME)){ |
|
| 60 | + public function getTitles() { |
|
| 61 | + if (is_null($this->_titles) && $module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME)) { |
|
| 62 | 62 | $pattern = '/(.*) (('.$module->getSetting('MAJ_TITLE_PREFIX', '').')(.*))/'; |
| 63 | - $this->_titles=array(); |
|
| 63 | + $this->_titles = array(); |
|
| 64 | 64 | $titlefacts = $this->gedcomrecord->getFacts('TITL'); |
| 65 | - foreach($titlefacts as $titlefact){ |
|
| 65 | + foreach ($titlefacts as $titlefact) { |
|
| 66 | 66 | $ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2); |
| 67 | - if($ct2>0){ |
|
| 68 | - $this->_titles[$match2[1][0]][]= trim($match2[2][0]); |
|
| 67 | + if ($ct2 > 0) { |
|
| 68 | + $this->_titles[$match2[1][0]][] = trim($match2[2][0]); |
|
| 69 | 69 | } |
| 70 | - else{ |
|
| 71 | - $this->_titles[$titlefact->getValue()][]=''; |
|
| 70 | + else { |
|
| 71 | + $this->_titles[$titlefact->getValue()][] = ''; |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | * @return string Primary surname |
| 83 | 83 | */ |
| 84 | 84 | public function getUnprotectedPrimarySurname() { |
| 85 | - if(!$this->_unprotectedPrimarySurname){ |
|
| 86 | - $tmp=$this->gedcomrecord->getAllNames(); |
|
| 85 | + if (!$this->_unprotectedPrimarySurname) { |
|
| 86 | + $tmp = $this->gedcomrecord->getAllNames(); |
|
| 87 | 87 | $this->_unprotectedPrimarySurname = $tmp[$this->gedcomrecord->getPrimaryName()]['surname']; |
| 88 | 88 | } |
| 89 | 89 | return $this->_unprotectedPrimarySurname; |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | * @param boolean $perc Should the coefficient of reliability be returned |
| 96 | 96 | * @return string|array Estimated birth place if found, null otherwise |
| 97 | 97 | */ |
| 98 | - public function getEstimatedBirthPlace($perc=false){ |
|
| 99 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
| 100 | - if($perc){ |
|
| 101 | - return array ($bplace, 1); |
|
| 98 | + public function getEstimatedBirthPlace($perc = false) { |
|
| 99 | + if ($bplace = $this->gedcomrecord->getBirthPlace()) { |
|
| 100 | + if ($perc) { |
|
| 101 | + return array($bplace, 1); |
|
| 102 | 102 | } |
| 103 | - else{ |
|
| 103 | + else { |
|
| 104 | 104 | return $bplace; |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | * @param boolean $perc Should the coefficient of reliability be returned |
| 114 | 114 | * @return string|array Estimated birth place if found, null otherwise |
| 115 | 115 | */ |
| 116 | - public function getSignificantPlace(){ |
|
| 117 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
| 116 | + public function getSignificantPlace() { |
|
| 117 | + if ($bplace = $this->gedcomrecord->getBirthPlace()) { |
|
| 118 | 118 | return $bplace; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
| 127 | + if ($dplace = $this->gedcomrecord->getDeathPlace()) { |
|
| 128 | 128 | return $dplace; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
| 131 | + foreach ($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
| 132 | 132 | foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
| 133 | 133 | if ($rplace) { |
| 134 | 134 | return $rplace; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * |
| 145 | 145 | * @return boolean Is the individual a Sosa ancestor |
| 146 | 146 | */ |
| 147 | - public function isSosa(){ |
|
| 147 | + public function isSosa() { |
|
| 148 | 148 | return count($this->getSosaNumbers()) > 0; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | * @uses \MyArtJaub\Webtrees\Functions\ModuleManager |
| 156 | 156 | * @return array List of Sosa numbers |
| 157 | 157 | */ |
| 158 | - public function getSosaNumbers(){ |
|
| 159 | - if($this->_sosa === null) { |
|
| 158 | + public function getSosaNumbers() { |
|
| 159 | + if ($this->_sosa === null) { |
|
| 160 | 160 | $provider = new SosaProvider($this->gedcomrecord->getTree()); |
| 161 | 161 | $this->_sosa = $provider->getSosaNumbers($this->gedcomrecord); |
| 162 | 162 | } |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | * |
| 169 | 169 | * @return int Level of sources |
| 170 | 170 | * */ |
| 171 | - public function isBirthSourced(){ |
|
| 172 | - if($this->_isbirthsourced !== null) return $this->_isbirthsourced; |
|
| 171 | + public function isBirthSourced() { |
|
| 172 | + if ($this->_isbirthsourced !== null) return $this->_isbirthsourced; |
|
| 173 | 173 | $this->_isbirthsourced = $this->isFactSourced(WT_EVENTS_BIRT); |
| 174 | 174 | return $this->_isbirthsourced; |
| 175 | 175 | } |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | * |
| 180 | 180 | * @return int Level of sources |
| 181 | 181 | * */ |
| 182 | - public function isDeathSourced(){ |
|
| 183 | - if($this->_isdeathsourced !== null) return $this->_isdeathsourced; |
|
| 182 | + public function isDeathSourced() { |
|
| 183 | + if ($this->_isdeathsourced !== null) return $this->_isdeathsourced; |
|
| 184 | 184 | $this->_isdeathsourced = $this->isFactSourced(WT_EVENTS_DEAT); |
| 185 | 185 | return $this->_isdeathsourced; |
| 186 | 186 | } |
@@ -14,13 +14,13 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * Cache component to speed up some potential data retrievals |
| 16 | 16 | */ |
| 17 | -class Cache{ |
|
| 17 | +class Cache { |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * Underlying Zend Cache object |
| 21 | 21 | * @var \Zend_Cache_Core|\Zend_Cache_FrontEnd $cache |
| 22 | 22 | */ |
| 23 | - protected $cache=null; |
|
| 23 | + protected $cache = null; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Defines whether the cache has been initialised |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | protected function init() { |
| 56 | 56 | // The translation libraries only work with a cache. |
| 57 | - $cache_options=array('automatic_serialization'=>true); |
|
| 57 | + $cache_options = array('automatic_serialization'=>true); |
|
| 58 | 58 | |
| 59 | 59 | if (ini_get('apc.enabled')) { |
| 60 | 60 | $this->cache = \Zend_Cache::factory('Core', 'Apc', $cache_options, array()); |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | * Initiliase the Cache if not done. |
| 80 | 80 | * |
| 81 | 81 | */ |
| 82 | - protected function checkInit(){ |
|
| 83 | - if(!$this->is_init) $this->init(); |
|
| 82 | + protected function checkInit() { |
|
| 83 | + if (!$this->is_init) $this->init(); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | * @param AbstractModule $mod Calling module |
| 91 | 91 | * @return string Cached key name |
| 92 | 92 | */ |
| 93 | - protected function getKeyName($value, AbstractModule $mod = null){ |
|
| 93 | + protected function getKeyName($value, AbstractModule $mod = null) { |
|
| 94 | 94 | $this->checkInit(); |
| 95 | 95 | $mod_name = 'myartjaub'; |
| 96 | - if($mod !== null) $mod_name = $mod->getName(); |
|
| 96 | + if ($mod !== null) $mod_name = $mod->getName(); |
|
| 97 | 97 | return $mod_name.'_'.$value; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @param AbstractModule $mod Calling module |
| 128 | 128 | * @return unknown_type Cached value |
| 129 | 129 | */ |
| 130 | - public function getI($value, AbstractModule $mod = null){ |
|
| 130 | + public function getI($value, AbstractModule $mod = null) { |
|
| 131 | 131 | $this->checkInit(); |
| 132 | 132 | return $this->cache->load($this->getKeyName($value, $mod)); |
| 133 | 133 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @param AbstractModule $mod Calling module |
| 140 | 140 | * @return unknown_type Cached value |
| 141 | 141 | */ |
| 142 | - public static function get($value, AbstractModule $mod = null){ |
|
| 142 | + public static function get($value, AbstractModule $mod = null) { |
|
| 143 | 143 | self::getInstance()->getI($value, $mod); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * @param AbstractModule $mod Calling module |
| 152 | 152 | * @return unknown_type Cached value |
| 153 | 153 | */ |
| 154 | - public function saveI($value, $data, AbstractModule $mod = null){ |
|
| 154 | + public function saveI($value, $data, AbstractModule $mod = null) { |
|
| 155 | 155 | $this->checkInit(); |
| 156 | 156 | $this->cache->save($data, $this->getKeyName($value, $mod)); |
| 157 | 157 | return $this->get($value, $mod); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @param AbstractModule $mod Calling module |
| 166 | 166 | * @return unknown_type Cached value |
| 167 | 167 | */ |
| 168 | - public static function save($value, $data, AbstractModule $mod = null){ |
|
| 168 | + public static function save($value, $data, AbstractModule $mod = null) { |
|
| 169 | 169 | self::getInstance()->saveI($value, $data, $mod); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * Clean the cache |
| 174 | 174 | * |
| 175 | 175 | */ |
| 176 | - public function cleanI(){ |
|
| 176 | + public function cleanI() { |
|
| 177 | 177 | $this->checkInit(); |
| 178 | 178 | $this->cache->clean(); |
| 179 | 179 | } |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | * @param unknown_type $data Data to identify the individual |
| 30 | 30 | * @return \MyArtJaub\Webtrees\Family|null \MyArtJaub\Webtrees\Family instance |
| 31 | 31 | */ |
| 32 | - public static function getIntance($data){ |
|
| 32 | + public static function getIntance($data) { |
|
| 33 | 33 | $dfam = null; |
| 34 | 34 | $fam = fw\Family::getInstance($data); |
| 35 | - if($fam){ |
|
| 35 | + if ($fam) { |
|
| 36 | 36 | $dfam = new Family($fam); |
| 37 | 37 | } |
| 38 | 38 | return $dfam; |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return int Level of sources |
| 45 | 45 | * */ |
| 46 | - function isMarriageSourced(){ |
|
| 47 | - if($this->_ismarriagesourced !== null) return $this->_ismarriagesourced; |
|
| 46 | + function isMarriageSourced() { |
|
| 47 | + if ($this->_ismarriagesourced !== null) return $this->_ismarriagesourced; |
|
| 48 | 48 | $this->_ismarriagesourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC'); |
| 49 | 49 | return $this->_ismarriagesourced; |
| 50 | 50 | } |
@@ -23,14 +23,14 @@ discard block |
||
| 23 | 23 | protected $gedcomrecord; |
| 24 | 24 | |
| 25 | 25 | /** @var bool Is the GedcomRecord sourced (cache) */ |
| 26 | - protected $_issourced=null; |
|
| 26 | + protected $_issourced = null; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Contructor for the decorator |
| 30 | 30 | * |
| 31 | 31 | * @param \Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in The GedcomRecord to extend |
| 32 | 32 | */ |
| 33 | - public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in){ |
|
| 33 | + public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in) { |
|
| 34 | 34 | $this->gedcomrecord = $gedcomrecord_in; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @return \Fisharebest\Webtrees\GedcomRecord Embedded gedcom record |
| 41 | 41 | */ |
| 42 | - public function getDerivedRecord(){ |
|
| 42 | + public function getDerivedRecord() { |
|
| 43 | 43 | return $this->gedcomrecord; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | if (($fact->getDate() || $fact->getPlace()) && $fact->canShow()) { |
| 86 | 86 | switch ($style) { |
| 87 | 87 | case 10: |
| 88 | - return '<i>'.$fact->getLabel().' '. mw\Functions\FunctionsPrint::formatFactDateShort($fact) .' '. mw\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') .'</i>'; |
|
| 88 | + return '<i>'.$fact->getLabel().' '.mw\Functions\FunctionsPrint::formatFactDateShort($fact).' '.mw\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1').'</i>'; |
|
| 89 | 89 | break; |
| 90 | 90 | default: |
| 91 | 91 | return $this->gedcomrecord->formatFirstMajorFact($facts, $style); |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | * @param int $access_level |
| 102 | 102 | * @return boolean |
| 103 | 103 | */ |
| 104 | - public function canDisplayIsSourced($access_level = null){ |
|
| 104 | + public function canDisplayIsSourced($access_level = null) { |
|
| 105 | 105 | global $global_facts; |
| 106 | 106 | |
| 107 | - if(!$this->gedcomrecord->canShow($access_level)) return false; |
|
| 108 | - if($access_level === null ) |
|
| 107 | + if (!$this->gedcomrecord->canShow($access_level)) return false; |
|
| 108 | + if ($access_level === null) |
|
| 109 | 109 | $access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree()); |
| 110 | 110 | |
| 111 | 111 | if (isset($global_facts['SOUR'])) { |
@@ -124,14 +124,14 @@ discard block |
||
| 124 | 124 | * |
| 125 | 125 | * @return int Level of sources |
| 126 | 126 | */ |
| 127 | - public function isSourced(){ |
|
| 128 | - if($this->_issourced !== null) return $this->_issourced; |
|
| 129 | - $this->_issourced=-1; |
|
| 127 | + public function isSourced() { |
|
| 128 | + if ($this->_issourced !== null) return $this->_issourced; |
|
| 129 | + $this->_issourced = -1; |
|
| 130 | 130 | $sourcesfacts = $this->gedcomrecord->getFacts('SOUR'); |
| 131 | - foreach($sourcesfacts as $sourcefact){ |
|
| 132 | - $this->_issourced=max($this->_issourced, 1); |
|
| 133 | - if($sourcefact->getAttribute('_ACT')){ |
|
| 134 | - $this->_issourced=max($this->_issourced, 2); |
|
| 131 | + foreach ($sourcesfacts as $sourcefact) { |
|
| 132 | + $this->_issourced = max($this->_issourced, 1); |
|
| 133 | + if ($sourcefact->getAttribute('_ACT')) { |
|
| 134 | + $this->_issourced = max($this->_issourced, 2); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | return $this->_issourced; |
@@ -143,19 +143,19 @@ discard block |
||
| 143 | 143 | * @param string $eventslist |
| 144 | 144 | * @return int Level of sources |
| 145 | 145 | */ |
| 146 | - public function isFactSourced($eventslist){ |
|
| 147 | - if(empty($eventslist)) return 0; |
|
| 148 | - $isSourced=0; |
|
| 146 | + public function isFactSourced($eventslist) { |
|
| 147 | + if (empty($eventslist)) return 0; |
|
| 148 | + $isSourced = 0; |
|
| 149 | 149 | $facts = $this->gedcomrecord->getFacts($eventslist); |
| 150 | - foreach($facts as $fact){ |
|
| 151 | - if($isSourced < Fact::MAX_IS_SOURCED_LEVEL){ |
|
| 150 | + foreach ($facts as $fact) { |
|
| 151 | + if ($isSourced < Fact::MAX_IS_SOURCED_LEVEL) { |
|
| 152 | 152 | $dfact = new Fact($fact); |
| 153 | 153 | $tmpIsSourced = $dfact->isSourced(); |
| 154 | - if($tmpIsSourced != 0) { |
|
| 155 | - if($isSourced==0) { |
|
| 156 | - $isSourced = $tmpIsSourced; |
|
| 154 | + if ($tmpIsSourced != 0) { |
|
| 155 | + if ($isSourced == 0) { |
|
| 156 | + $isSourced = $tmpIsSourced; |
|
| 157 | 157 | } |
| 158 | - else{ |
|
| 158 | + else { |
|
| 159 | 159 | $isSourced = max($isSourced, $tmpIsSourced); |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -54,30 +54,30 @@ discard block |
||
| 54 | 54 | public function buildLineages() { |
| 55 | 55 | $indis = \Fisharebest\Webtrees\Query\QueryName::individuals($this->tree, $this->surname, null, null, false, false); |
| 56 | 56 | |
| 57 | - if(count($indis) == 0) return null; |
|
| 57 | + if (count($indis) == 0) return null; |
|
| 58 | 58 | |
| 59 | 59 | $root_lineages = array(); |
| 60 | 60 | |
| 61 | - foreach($indis as $indi) { |
|
| 61 | + foreach ($indis as $indi) { |
|
| 62 | 62 | $pid = $indi->getXref(); |
| 63 | - if(!isset($this->used_indis[$pid])){ |
|
| 63 | + if (!isset($this->used_indis[$pid])) { |
|
| 64 | 64 | //Find the root of the lineage |
| 65 | 65 | /** @var Fisharebest\Webtrees\Individual $indiFirst */ |
| 66 | - $indiFirst= $this->getLineageRootIndividual($indi); |
|
| 67 | - if($indiFirst){ |
|
| 66 | + $indiFirst = $this->getLineageRootIndividual($indi); |
|
| 67 | + if ($indiFirst) { |
|
| 68 | 68 | $this->used_indis[$indiFirst->getXref()] = true; |
| 69 | - if($indiFirst->canShow()){ |
|
| 69 | + if ($indiFirst->canShow()) { |
|
| 70 | 70 | //Check if the root individual has brothers and sisters, without parents |
| 71 | 71 | $indiChildFamily = $indiFirst->getPrimaryChildFamily(); |
| 72 | - if($indiChildFamily !== null){ |
|
| 72 | + if ($indiChildFamily !== null) { |
|
| 73 | 73 | $root_node = new LineageRootNode(null); |
| 74 | 74 | $root_node->addFamily($indiChildFamily); |
| 75 | 75 | } |
| 76 | - else{ |
|
| 76 | + else { |
|
| 77 | 77 | $root_node = new LineageRootNode($indiFirst); |
| 78 | 78 | } |
| 79 | 79 | $root_node = $this->buildLineage($root_node); |
| 80 | - if($root_node) $root_lineages[] = $root_node; |
|
| 80 | + if ($root_node) $root_lineages[] = $root_node; |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -94,45 +94,45 @@ discard block |
||
| 94 | 94 | * @return (Individual|null) Root individual |
| 95 | 95 | */ |
| 96 | 96 | protected function getLineageRootIndividual(Individual $indi) { |
| 97 | - $is_first=false; |
|
| 97 | + $is_first = false; |
|
| 98 | 98 | $dindi = new \MyArtJaub\Webtrees\Individual($indi); |
| 99 | - $indi_surname=$dindi->getUnprotectedPrimarySurname(); |
|
| 99 | + $indi_surname = $dindi->getUnprotectedPrimarySurname(); |
|
| 100 | 100 | $resIndi = $indi; |
| 101 | - while(!$is_first){ |
|
| 101 | + while (!$is_first) { |
|
| 102 | 102 | //Get the individual parents family |
| 103 | - $fam=$resIndi->getPrimaryChildFamily(); |
|
| 104 | - if($fam){ |
|
| 105 | - $husb=$fam->getHusband(); |
|
| 106 | - $wife=$fam->getWife(); |
|
| 103 | + $fam = $resIndi->getPrimaryChildFamily(); |
|
| 104 | + if ($fam) { |
|
| 105 | + $husb = $fam->getHusband(); |
|
| 106 | + $wife = $fam->getWife(); |
|
| 107 | 107 | //If the father exists, take him |
| 108 | - if($husb){ |
|
| 108 | + if ($husb) { |
|
| 109 | 109 | $dhusb = new \MyArtJaub\Webtrees\Individual($husb); |
| 110 | - $dhusb->isNewAddition() ? $is_first = true : $resIndi=$husb; |
|
| 110 | + $dhusb->isNewAddition() ? $is_first = true : $resIndi = $husb; |
|
| 111 | 111 | } |
| 112 | 112 | //If only a mother exists |
| 113 | - else if($wife){ |
|
| 113 | + else if ($wife) { |
|
| 114 | 114 | $dwife = new \MyArtJaub\Webtrees\Individual($wife); |
| 115 | - $wife_surname=$dwife->getUnprotectedPrimarySurname(); |
|
| 115 | + $wife_surname = $dwife->getUnprotectedPrimarySurname(); |
|
| 116 | 116 | //Check if the child is a natural child of the mother (based on the surname - Warning : surname must be identical) |
| 117 | - if(!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0){ |
|
| 118 | - $resIndi=$wife; |
|
| 117 | + if (!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0) { |
|
| 118 | + $resIndi = $wife; |
|
| 119 | 119 | } |
| 120 | - else{ |
|
| 121 | - $is_first=true; |
|
| 120 | + else { |
|
| 121 | + $is_first = true; |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | - else{ |
|
| 125 | - $is_first=true; |
|
| 124 | + else { |
|
| 125 | + $is_first = true; |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | - else{ |
|
| 129 | - $is_first=true; |
|
| 128 | + else { |
|
| 129 | + $is_first = true; |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | - if(isset($this->used_indis[$resIndi->getXref()])){ |
|
| 132 | + if (isset($this->used_indis[$resIndi->getXref()])) { |
|
| 133 | 133 | return null; |
| 134 | 134 | } |
| 135 | - else{ |
|
| 135 | + else { |
|
| 136 | 136 | return $resIndi; |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -145,15 +145,15 @@ discard block |
||
| 145 | 145 | * @return LineageNode Computed lineage |
| 146 | 146 | */ |
| 147 | 147 | protected function buildLineage(LineageNode $node) { |
| 148 | - if($node === null) return; |
|
| 148 | + if ($node === null) return; |
|
| 149 | 149 | |
| 150 | 150 | $indi_surname = null; |
| 151 | 151 | |
| 152 | 152 | $indi_node = $node->getIndividual(); |
| 153 | - if($indi_node) { |
|
| 154 | - if(count($node->getFamiliesNodes()) == 0) { |
|
| 153 | + if ($indi_node) { |
|
| 154 | + if (count($node->getFamiliesNodes()) == 0) { |
|
| 155 | 155 | $indiSpouseFamilies = $indi_node->getSpouseFamilies(); |
| 156 | - foreach($indiSpouseFamilies as $indiSpouseFamily) { |
|
| 156 | + foreach ($indiSpouseFamilies as $indiSpouseFamily) { |
|
| 157 | 157 | $node->addFamily($indiSpouseFamily); |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -162,62 +162,62 @@ discard block |
||
| 162 | 162 | $indi_surname = $dindi_node->getUnprotectedPrimarySurname(); |
| 163 | 163 | |
| 164 | 164 | //Get the estimated birth place and put it in the place table |
| 165 | - $place=$dindi_node->getEstimatedBirthPlace(false); |
|
| 166 | - if($place && strlen($place) > 0){ |
|
| 167 | - $place=trim($place); |
|
| 165 | + $place = $dindi_node->getEstimatedBirthPlace(false); |
|
| 166 | + if ($place && strlen($place) > 0) { |
|
| 167 | + $place = trim($place); |
|
| 168 | 168 | $node->getRootNode()->addPlace(new Place($place, $this->tree)); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | //Tag the individual as used |
| 172 | - $this->used_indis[$indi_node->getXref()]=true; |
|
| 172 | + $this->used_indis[$indi_node->getXref()] = true; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - foreach($node->getFamiliesNodes() as $family) { |
|
| 175 | + foreach ($node->getFamiliesNodes() as $family) { |
|
| 176 | 176 | $spouse_surname = null; |
| 177 | - if($indi_node && $spouse = $family->getSpouse($indi_node)) { |
|
| 177 | + if ($indi_node && $spouse = $family->getSpouse($indi_node)) { |
|
| 178 | 178 | $dspouse = new \MyArtJaub\Webtrees\Individual($spouse); |
| 179 | - $spouse_surname=$dspouse->getUnprotectedPrimarySurname(); |
|
| 179 | + $spouse_surname = $dspouse->getUnprotectedPrimarySurname(); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | $children = $family->getChildren(); |
| 183 | 183 | |
| 184 | - $nbChildren=0; |
|
| 185 | - $nbNatural=0; |
|
| 184 | + $nbChildren = 0; |
|
| 185 | + $nbNatural = 0; |
|
| 186 | 186 | |
| 187 | - foreach($children as $child){ |
|
| 187 | + foreach ($children as $child) { |
|
| 188 | 188 | $dchild = new \MyArtJaub\Webtrees\Individual($child); |
| 189 | - $child_surname=$dchild->getUnprotectedPrimarySurname(); |
|
| 189 | + $child_surname = $dchild->getUnprotectedPrimarySurname(); |
|
| 190 | 190 | |
| 191 | - if(!$dchild->isNewAddition()) { |
|
| 191 | + if (!$dchild->isNewAddition()) { |
|
| 192 | 192 | $nbChildren++; |
| 193 | 193 | //If the root individual is the mother |
| 194 | - if($indi_node && I18N::strcasecmp($indi_node->getSex(), 'F') == 0) { |
|
| 194 | + if ($indi_node && I18N::strcasecmp($indi_node->getSex(), 'F') == 0) { |
|
| 195 | 195 | //Print only lineages of children with the same surname as their mother (supposing they are natural children) |
| 196 | - if(!$spouse || ($spouse_surname && I18N::strcasecmp($child_surname, $spouse_surname) != 0)){ |
|
| 197 | - if(I18N::strcasecmp($child_surname, $indi_surname) == 0){ |
|
| 196 | + if (!$spouse || ($spouse_surname && I18N::strcasecmp($child_surname, $spouse_surname) != 0)) { |
|
| 197 | + if (I18N::strcasecmp($child_surname, $indi_surname) == 0) { |
|
| 198 | 198 | $nbNatural++; |
| 199 | 199 | $node_child = new LineageNode($child, $node->getRootNode()); |
| 200 | 200 | $node_child = $this->buildLineage($node_child); |
| 201 | - if($node_child) $node->addChild($family, $node_child); |
|
| 201 | + if ($node_child) $node->addChild($family, $node_child); |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | //If the root individual is the father |
| 206 | 206 | else { |
| 207 | 207 | //Print if the children does not bear the same name as his mother (and different from his father) |
| 208 | - if( strlen($child_surname) == 0 || strlen($indi_surname) == 0 || strlen($spouse_surname) == 0 || |
|
| 208 | + if (strlen($child_surname) == 0 || strlen($indi_surname) == 0 || strlen($spouse_surname) == 0 || |
|
| 209 | 209 | I18N::strcasecmp($child_surname, $indi_surname) == 0 || |
| 210 | - I18N::strcasecmp($child_surname, $spouse_surname) != 0 ) |
|
| 210 | + I18N::strcasecmp($child_surname, $spouse_surname) != 0) |
|
| 211 | 211 | { |
| 212 | 212 | $nbNatural++; |
| 213 | 213 | $node_child = new LineageNode($child, $node->getRootNode()); |
| 214 | 214 | $node_child = $this->buildLineage($node_child); |
| 215 | - if($node_child) $node->addChild($family, $node_child); |
|
| 215 | + if ($node_child) $node->addChild($family, $node_child); |
|
| 216 | 216 | } |
| 217 | 217 | else { |
| 218 | 218 | $nbNatural++; |
| 219 | 219 | $node_child = new LineageNode($child, $node->getRootNode(), $child_surname); |
| 220 | - if($node_child) $node->addChild($family, $node_child); |
|
| 220 | + if ($node_child) $node->addChild($family, $node_child); |
|
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | |
| 227 | 227 | //Do not print other children |
| 228 | - if(($nbChildren-$nbNatural)>0){ |
|
| 228 | + if (($nbChildren - $nbNatural) > 0) { |
|
| 229 | 229 | $node->addChild($family, null); |
| 230 | 230 | } |
| 231 | 231 | } |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | /** @var \Fisharebest\Webtrees\Tree $tree */ |
| 37 | 37 | $tree = $this->data->get('tree'); |
| 38 | 38 | |
| 39 | - echo '<h2 class="center">', $this->data->get('title') , '</h2>'; |
|
| 39 | + echo '<h2 class="center">', $this->data->get('title'), '</h2>'; |
|
| 40 | 40 | echo '<p class="center alpha_index">', implode(' | ', $this->getInitialLettersList()), '</p>'; |
| 41 | 41 | |
| 42 | - if($this->data->get('issurnames', false)) { |
|
| 42 | + if ($this->data->get('issurnames', false)) { |
|
| 43 | 43 | $surns = $this->data->get('surnameslist', array()); |
| 44 | - $extra_params = array ('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage'); |
|
| 44 | + $extra_params = array('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage'); |
|
| 45 | 45 | // Show the surname list |
| 46 | 46 | switch ($tree->getPreference('SURNAME_LIST_STYLE')) { |
| 47 | 47 | case 'style1': |
@@ -59,16 +59,16 @@ discard block |
||
| 59 | 59 | else if ($this->data->get('islineages', false)) { |
| 60 | 60 | //Link to indilist |
| 61 | 61 | echo '<p class="center"><strong>'. |
| 62 | - '<a href="indilist.php?ged=' . $tree->getNameUrl() . '&surname=' . rawurlencode($this->data->get('surname')) .'">'. |
|
| 62 | + '<a href="indilist.php?ged='.$tree->getNameUrl().'&surname='.rawurlencode($this->data->get('surname')).'">'. |
|
| 63 | 63 | I18N::translate('Go to the list of individuals with surname %s', $this->data->get('legend')). |
| 64 | 64 | '</a></strong></p>'; |
| 65 | 65 | |
| 66 | 66 | $lineages = $this->data->get('lineages', null); |
| 67 | 67 | $nb_lineages = count($lineages); |
| 68 | - if(is_null($lineages) || $nb_lineages == 0) { |
|
| 68 | + if (is_null($lineages) || $nb_lineages == 0) { |
|
| 69 | 69 | echo '<p class="center"><span class="warning">', |
| 70 | 70 | I18N::translate('No individuals with surname %s has been found. Please try another name.', |
| 71 | - '<span dir="auto">' . $this->data->get('legend') . '</span>'), |
|
| 71 | + '<span dir="auto">'.$this->data->get('legend').'</span>'), |
|
| 72 | 72 | '</span></p>'; |
| 73 | 73 | } else { |
| 74 | 74 | |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | echo '<div class="list_value_wrap">'; |
| 81 | 81 | |
| 82 | - foreach($lineages as $i => $lineage) { |
|
| 82 | + foreach ($lineages as $i => $lineage) { |
|
| 83 | 83 | $this->printRootLineage($lineage); |
| 84 | - if($i < $nb_lineages - 1) echo '<hr />'; |
|
| 84 | + if ($i < $nb_lineages - 1) echo '<hr />'; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | echo '</div>'; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $list = array(); |
| 105 | 105 | /** @var \Fisharebest\Webtrees\Tree $tree */ |
| 106 | 106 | $tree = $this->data->get('tree'); |
| 107 | - $script_base_url = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
|
| 107 | + $script_base_url = WT_SCRIPT_NAME.'?mod='.\MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME.'&mod_action=Lineage'; |
|
| 108 | 108 | |
| 109 | 109 | foreach (QueryName::surnameAlpha($tree, false, false) as $letter => $count) { |
| 110 | 110 | switch ($letter) { |
@@ -120,9 +120,9 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | if ($count) { |
| 122 | 122 | if ($letter == $this->data->get('alpha')) { |
| 123 | - $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" class="warning" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
| 123 | + $list[] = '<a href="'.$script_base_url.'&alpha='.rawurlencode($letter).'&ged='.$tree->getNameUrl().'" class="warning" title="'.I18N::number($count).'">'.$html.'</a>'; |
|
| 124 | 124 | } else { |
| 125 | - $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
| 125 | + $list[] = '<a href="'.$script_base_url.'&alpha='.rawurlencode($letter).'&ged='.$tree->getNameUrl().'" title="'.I18N::number($count).'">'.$html.'</a>'; |
|
| 126 | 126 | } |
| 127 | 127 | } else { |
| 128 | 128 | $list[] = $html; |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | // Search spiders don't get the "show all" option as the other links give them everything. |
| 133 | 133 | if (!Auth::isSearchEngine()) { |
| 134 | 134 | if ($this->data->get('show_all') === 'yes') { |
| 135 | - $list[] = '<span class="warning">' . I18N::translate('All') . '</span>'; |
|
| 135 | + $list[] = '<span class="warning">'.I18N::translate('All').'</span>'; |
|
| 136 | 136 | } else { |
| 137 | - $list[] = '<a href="' . $script_base_url . '&show_all=yes' . '&ged=' . $tree->getNameUrl() . '">' . I18N::translate('All') . '</a>'; |
|
| 137 | + $list[] = '<a href="'.$script_base_url.'&show_all=yes'.'&ged='.$tree->getNameUrl().'">'.I18N::translate('All').'</a>'; |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
@@ -147,11 +147,11 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | private function printRootLineage(LineageRootNode $node) { |
| 149 | 149 | print '<div class="patrolin_tree">'; |
| 150 | - if($node->getIndividual() === null) { |
|
| 150 | + if ($node->getIndividual() === null) { |
|
| 151 | 151 | $fam_nodes = $node->getFamiliesNodes(); |
| 152 | - foreach($fam_nodes as $fam){ |
|
| 153 | - foreach($fam_nodes[$fam] as $child_node) { |
|
| 154 | - if($child_node) { |
|
| 152 | + foreach ($fam_nodes as $fam) { |
|
| 153 | + foreach ($fam_nodes[$fam] as $child_node) { |
|
| 154 | + if ($child_node) { |
|
| 155 | 155 | $this->printLineage($child_node); |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | echo '</div>'; |
| 164 | 164 | |
| 165 | 165 | $places = $node->getPlaces(); |
| 166 | - if($places && count($places)>0){ |
|
| 166 | + if ($places && count($places) > 0) { |
|
| 167 | 167 | echo '<div class="patrolin_places">'; |
| 168 | 168 | echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlPlacesCloud($places, false, $this->data->get('tree')); |
| 169 | 169 | echo '</div>'; |
@@ -178,34 +178,34 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | echo '<ul>'; |
| 180 | 180 | $fam_nodes = $node->getFamiliesNodes(); |
| 181 | - if(count($fam_nodes) > 0) { |
|
| 181 | + if (count($fam_nodes) > 0) { |
|
| 182 | 182 | $is_first_family = true; |
| 183 | - foreach($fam_nodes as $fam) { |
|
| 183 | + foreach ($fam_nodes as $fam) { |
|
| 184 | 184 | $node_indi = $node->getIndividual(); |
| 185 | 185 | echo '<li>'; |
| 186 | - if($is_first_family){ |
|
| 186 | + if ($is_first_family) { |
|
| 187 | 187 | echo FunctionsPrint::htmlIndividualForList($node_indi); |
| 188 | 188 | } |
| 189 | - else{ |
|
| 189 | + else { |
|
| 190 | 190 | echo FunctionsPrint::htmlIndividualForList($node_indi, false); |
| 191 | 191 | } |
| 192 | 192 | //Get individual's spouse |
| 193 | 193 | $dfam = new Family($fam); |
| 194 | - $spouse=$dfam->getSpouseById($node_indi); |
|
| 194 | + $spouse = $dfam->getSpouseById($node_indi); |
|
| 195 | 195 | //Print the spouse if relevant |
| 196 | - if($spouse){ |
|
| 196 | + if ($spouse) { |
|
| 197 | 197 | $marrdate = I18N::translate('yes'); |
| 198 | 198 | $marryear = ''; |
| 199 | 199 | echo ' <a href="'.$fam->getHtmlUrl().'">'; |
| 200 | - if ($fam->getMarriageYear()){ |
|
| 200 | + if ($fam->getMarriageYear()) { |
|
| 201 | 201 | $marrdate = strip_tags($fam->getMarriageDate()->Display()); |
| 202 | 202 | $marryear = $fam->getMarriageYear(); |
| 203 | 203 | } |
| 204 | 204 | echo '<span class="details1" title="'.$marrdate.'"><i class="icon-rings"></i>'.$marryear.'</span></a> '; |
| 205 | 205 | echo FunctionsPrint::htmlIndividualForList($spouse); |
| 206 | 206 | } |
| 207 | - foreach($fam_nodes[$fam] as $child_node) { |
|
| 208 | - if($child_node) { |
|
| 207 | + foreach ($fam_nodes[$fam] as $child_node) { |
|
| 208 | + if ($child_node) { |
|
| 209 | 209 | $this->printLineage($child_node); |
| 210 | 210 | } |
| 211 | 211 | else { |
@@ -218,10 +218,10 @@ discard block |
||
| 218 | 218 | else { |
| 219 | 219 | echo '<li>'; |
| 220 | 220 | echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlIndividualForList($node->getIndividual()); |
| 221 | - if($node->hasFollowUpSurname()) { |
|
| 222 | - $url_base = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
|
| 221 | + if ($node->hasFollowUpSurname()) { |
|
| 222 | + $url_base = WT_SCRIPT_NAME.'?mod='.\MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME.'&mod_action=Lineage'; |
|
| 223 | 223 | echo ' '. |
| 224 | - '<a href="' . $url_base . '&surname=' . rawurlencode($node->getFollowUpSurname()) . '&ged=' . $this->data->get('tree')->getNameUrl() . '">'. |
|
| 224 | + '<a href="'.$url_base.'&surname='.rawurlencode($node->getFollowUpSurname()).'&ged='.$this->data->get('tree')->getNameUrl().'">'. |
|
| 225 | 225 | '('.I18N::translate('Go to %s lineages', $node->getFollowUpSurname()).')'. |
| 226 | 226 | '</a>'; |
| 227 | 227 | } |
@@ -52,24 +52,24 @@ discard block |
||
| 52 | 52 | * {@inhericDoc} |
| 53 | 53 | * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory() |
| 54 | 54 | */ |
| 55 | - public function getRealCertificatesDirectory(){ |
|
| 56 | - return WT_DATA_DIR . $this->root_path; |
|
| 55 | + public function getRealCertificatesDirectory() { |
|
| 56 | + return WT_DATA_DIR.$this->root_path; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * {@inhericDoc} |
| 61 | 61 | * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList() |
| 62 | 62 | */ |
| 63 | - public function getCitiesList(){ |
|
| 64 | - if(!isset($this->cities_list) || is_null($this->cities_list)){ |
|
| 63 | + public function getCitiesList() { |
|
| 64 | + if (!isset($this->cities_list) || is_null($this->cities_list)) { |
|
| 65 | 65 | $certdir = $this->getRealCertificatesDirectory(); |
| 66 | 66 | $this->cities_list = array(); |
| 67 | 67 | |
| 68 | 68 | $dir = opendir($certdir); |
| 69 | 69 | |
| 70 | - while($entry = readdir($dir)){ |
|
| 71 | - if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){ |
|
| 72 | - $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry); |
|
| 70 | + while ($entry = readdir($dir)) { |
|
| 71 | + if ($entry != '.' && $entry != '..' && is_dir($certdir.$entry)) { |
|
| 72 | + $this->cities_list[] = Functions::encodeFileSystemToUtf8($entry); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | sort($this->cities_list); |
@@ -81,21 +81,21 @@ discard block |
||
| 81 | 81 | * {@inhericDoc} |
| 82 | 82 | * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList() |
| 83 | 83 | */ |
| 84 | - public function getCertificatesList($selCity){ |
|
| 84 | + public function getCertificatesList($selCity) { |
|
| 85 | 85 | |
| 86 | 86 | $selCity = Functions::encodeUtf8ToFileSystem($selCity); |
| 87 | 87 | |
| 88 | 88 | $certdir = $this->getRealCertificatesDirectory(); |
| 89 | - $tabCertif= array(); |
|
| 89 | + $tabCertif = array(); |
|
| 90 | 90 | |
| 91 | - if(is_dir($certdir.$selCity)){ |
|
| 92 | - $dir=opendir($certdir.$selCity); |
|
| 93 | - while($entry = readdir($dir)){ |
|
| 94 | - if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){ |
|
| 91 | + if (is_dir($certdir.$selCity)) { |
|
| 92 | + $dir = opendir($certdir.$selCity); |
|
| 93 | + while ($entry = readdir($dir)) { |
|
| 94 | + if ($entry != '.' && $entry != '..' && !is_dir($certdir.$entry.'/')) { |
|
| 95 | 95 | $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry); |
| 96 | 96 | $certificate = new Certificate($path, $this->tree, $this); |
| 97 | - if(Functions::isImageTypeSupported($certificate->extension())){ |
|
| 98 | - $tabCertif[] = $certificate; |
|
| 97 | + if (Functions::isImageTypeSupported($certificate->extension())) { |
|
| 98 | + $tabCertif[] = $certificate; |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -107,17 +107,17 @@ discard block |
||
| 107 | 107 | * {@inhericDoc} |
| 108 | 108 | * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith() |
| 109 | 109 | */ |
| 110 | - public function getCertificatesListBeginWith($city, $contains, $limit= 9999){ |
|
| 111 | - $tabFiles= array(); |
|
| 112 | - $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/'; |
|
| 110 | + public function getCertificatesListBeginWith($city, $contains, $limit = 9999) { |
|
| 111 | + $tabFiles = array(); |
|
| 112 | + $dirPath = $this->getRealCertificatesDirectory().Functions::encodeUtf8ToFileSystem($city).'/'; |
|
| 113 | 113 | $contains = utf8_decode($contains); |
| 114 | 114 | $nbCert = 0; |
| 115 | 115 | |
| 116 | - if(is_dir($dirPath)){ |
|
| 117 | - $dir=opendir($dirPath); |
|
| 118 | - while(($entry = readdir($dir)) && $nbCert < $limit){ |
|
| 119 | - if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){ |
|
| 120 | - $tabFiles[]= Functions::encodeFileSystemToUtf8($entry); |
|
| 116 | + if (is_dir($dirPath)) { |
|
| 117 | + $dir = opendir($dirPath); |
|
| 118 | + while (($entry = readdir($dir)) && $nbCert < $limit) { |
|
| 119 | + if ($entry != '.' && $entry != '..' && $entry != 'Thumbs.db' && !is_dir($dirPath.$entry.'/') && stripos($entry, $contains) !== false) { |
|
| 120 | + $tabFiles[] = Functions::encodeFileSystemToUtf8($entry); |
|
| 121 | 121 | $nbCert++; |
| 122 | 122 | } |
| 123 | 123 | } |
@@ -33,26 +33,26 @@ discard block |
||
| 33 | 33 | * Manage updates sent from the AdminConfig@index form. |
| 34 | 34 | */ |
| 35 | 35 | protected function update() { |
| 36 | - if(Auth::isAdmin()){ |
|
| 36 | + if (Auth::isAdmin()) { |
|
| 37 | 37 | $ihooks = HookProvider::getInstalledHooks(); |
| 38 | 38 | |
| 39 | - $module_names= Database::prepare( |
|
| 39 | + $module_names = Database::prepare( |
|
| 40 | 40 | "SELECT module_name FROM `##module` WHERE status='disabled'" |
| 41 | 41 | )->fetchOneColumn(); |
| 42 | 42 | |
| 43 | - if($ihooks !== null){ |
|
| 43 | + if ($ihooks !== null) { |
|
| 44 | 44 | foreach ($ihooks as $ihook => $params) { |
| 45 | - if(Filter::post('hook-' . $params['id']) === 'yes') { |
|
| 45 | + if (Filter::post('hook-'.$params['id']) === 'yes') { |
|
| 46 | 46 | $array_hook = explode('#', $ihook); |
| 47 | 47 | //Update status |
| 48 | - $new_status= Filter::postBool('status-' . $params['id']); |
|
| 49 | - if(in_array($array_hook[0], $module_names)) $new_status = false; |
|
| 48 | + $new_status = Filter::postBool('status-'.$params['id']); |
|
| 49 | + if (in_array($array_hook[0], $module_names)) $new_status = false; |
|
| 50 | 50 | $previous_status = $params['status']; |
| 51 | 51 | if ($new_status !== null) { |
| 52 | - $new_status= $new_status ? 'enabled' : 'disabled'; |
|
| 53 | - if($new_status != $previous_status){ |
|
| 52 | + $new_status = $new_status ? 'enabled' : 'disabled'; |
|
| 53 | + if ($new_status != $previous_status) { |
|
| 54 | 54 | $chook = new Hook($array_hook[1], $array_hook[2]); |
| 55 | - switch($new_status){ |
|
| 55 | + switch ($new_status) { |
|
| 56 | 56 | case 'enabled': |
| 57 | 57 | $chook->enable($array_hook[0]); |
| 58 | 58 | break; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $new_priority = Filter::postInteger("moduleorder-{$params['id']}"); |
| 70 | 70 | $previous_priority = $params['priority']; |
| 71 | 71 | if ($new_priority !== null) { |
| 72 | - if($new_priority != $previous_priority){ |
|
| 72 | + if ($new_priority != $previous_priority) { |
|
| 73 | 73 | $chook = new Hook($array_hook[1], $array_hook[2]); |
| 74 | 74 | $chook->setPriority($array_hook[0], $new_priority); |
| 75 | 75 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | HookProvider::updateHooks(); |
| 94 | 94 | |
| 95 | 95 | $action = Filter::post('action'); |
| 96 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
| 96 | + if ($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
| 97 | 97 | |
| 98 | 98 | Theme::theme(new AdministrationTheme)->init($WT_TREE); |
| 99 | 99 | $ctrl = new PageController(); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | ->restrictAccess(Auth::isAdmin()) |
| 102 | 102 | ->setPageTitle($this->module->getTitle()); |
| 103 | 103 | |
| 104 | - $table_id = 'table-installedhooks-' . Uuid::uuid4(); |
|
| 104 | + $table_id = 'table-installedhooks-'.Uuid::uuid4(); |
|
| 105 | 105 | |
| 106 | 106 | $view_bag = new ViewBag(); |
| 107 | 107 | $view_bag->set('title', $ctrl->getPageTitle()); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
| 68 | 68 | */ |
| 69 | 69 | public function getConfigLink() { |
| 70 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
| 70 | + return 'module.php?mod='.$this->getName().'&mod_action=AdminConfig'; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function getMenu(Tree $tree, $reference = null) { |
| 94 | 94 | $tree_url = $tree ? $tree->getNameUrl() : ''; |
| 95 | - return new Menu($this->getTitle(), 'module.php?mod=' . $this->getName() . '&mod_action=Certificate@listAll&ged=' . $tree_url, 'menu-maj-list-certificate', array('rel' => 'nofollow')); |
|
| 95 | + return new Menu($this->getTitle(), 'module.php?mod='.$this->getName().'&mod_action=Certificate@listAll&ged='.$tree_url, 'menu-maj-list-certificate', array('rel' => 'nofollow')); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -102,27 +102,27 @@ discard block |
||
| 102 | 102 | public function hFactSourcePrepend($srec) { |
| 103 | 103 | global $WT_TREE; |
| 104 | 104 | |
| 105 | - $html=''; |
|
| 106 | - $sid=null; |
|
| 105 | + $html = ''; |
|
| 106 | + $sid = null; |
|
| 107 | 107 | |
| 108 | - if($this->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE)){ |
|
| 108 | + if ($this->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE)) { |
|
| 109 | 109 | if (!$srec || strlen($srec) == 0) return $html; |
| 110 | 110 | |
| 111 | 111 | $certificate = null; |
| 112 | 112 | $subrecords = explode("\n", $srec); |
| 113 | 113 | $levelSOUR = substr($subrecords[0], 0, 1); |
| 114 | 114 | if (preg_match('~^'.$levelSOUR.' SOUR @('.WT_REGEX_XREF.')@$~', $subrecords[0], $match)) { |
| 115 | - $sid=$match[1]; |
|
| 115 | + $sid = $match[1]; |
|
| 116 | 116 | }; |
| 117 | 117 | $nb_subrecords = count($subrecords); |
| 118 | - for ($i=0; $i < $nb_subrecords; $i++) { |
|
| 118 | + for ($i = 0; $i < $nb_subrecords; $i++) { |
|
| 119 | 119 | $subrecords[$i] = trim($subrecords[$i]); |
| 120 | 120 | $tag = substr($subrecords[$i], 2, 4); |
| 121 | 121 | $text = substr($subrecords[$i], 7); |
| 122 | - if($tag == '_ACT') $certificate= new Certificate($text, $WT_TREE, $this->getProvider()); |
|
| 122 | + if ($tag == '_ACT') $certificate = new Certificate($text, $WT_TREE, $this->getProvider()); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if($certificate && $certificate->canShow()) |
|
| 125 | + if ($certificate && $certificate->canShow()) |
|
| 126 | 126 | $html = $this->getDisplay_ACT($certificate, $sid); |
| 127 | 127 | |
| 128 | 128 | } |
@@ -149,9 +149,9 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function hHtmlSimpleTagDisplay($tag, $value, $context = null, $contextid = null) { |
| 151 | 151 | $html = ''; |
| 152 | - switch($tag){ |
|
| 152 | + switch ($tag) { |
|
| 153 | 153 | case '_ACT': |
| 154 | - if($context == 'SOUR') $html = $this->getDisplay_ACT($value, $contextid); |
|
| 154 | + if ($context == 'SOUR') $html = $this->getDisplay_ACT($value, $contextid); |
|
| 155 | 155 | break; |
| 156 | 156 | } |
| 157 | 157 | return $html; |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | $html = ''; |
| 168 | 168 | |
| 169 | - switch($tag){ |
|
| 169 | + switch ($tag) { |
|
| 170 | 170 | case '_ACT': |
| 171 | 171 | $element_id = Uuid::uuid4(); |
| 172 | 172 | $controller |
@@ -174,14 +174,14 @@ discard block |
||
| 174 | 174 | ->addExternalJavascript(WT_STATIC_URL.WT_MODULES_DIR.$this->getName().'/js/autocomplete.js') |
| 175 | 175 | ->addExternalJavascript(WT_STATIC_URL.WT_MODULES_DIR.$this->getName().'/js/updatecertificatevalues.js'); |
| 176 | 176 | $certificate = null; |
| 177 | - if($value){ |
|
| 177 | + if ($value) { |
|
| 178 | 178 | $certificate = new Certificate($value, $WT_TREE, $this->getProvider()); |
| 179 | 179 | } |
| 180 | 180 | $tabCities = $this->getProvider()->getCitiesList(); |
| 181 | 181 | $html .= '<select id="certifCity'.$element_id.'" class="_CITY">'; |
| 182 | - foreach ($tabCities as $cities){ |
|
| 183 | - $selectedCity=''; |
|
| 184 | - if($certificate && $cities== $certificate->getCity()) $selectedCity='selected="true"'; |
|
| 182 | + foreach ($tabCities as $cities) { |
|
| 183 | + $selectedCity = ''; |
|
| 184 | + if ($certificate && $cities == $certificate->getCity()) $selectedCity = 'selected="true"'; |
|
| 185 | 185 | $html .= '<option value="'.$cities.'" '.$selectedCity.' />'.$cities.'</option>'; |
| 186 | 186 | } |
| 187 | 187 | $html .= '</select>'; |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hAddSimpleTag() |
| 200 | 200 | */ |
| 201 | 201 | public function hAddSimpleTag($context, $level) { |
| 202 | - switch($context){ |
|
| 202 | + switch ($context) { |
|
| 203 | 203 | case 'SOUR': |
| 204 | 204 | FunctionsEdit::addSimpleTag($level.' _ACT'); |
| 205 | 205 | break; |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHasHelpTextTag() |
| 212 | 212 | */ |
| 213 | 213 | public function hHasHelpTextTag($tag) { |
| 214 | - switch($tag){ |
|
| 214 | + switch ($tag) { |
|
| 215 | 215 | case '_ACT': |
| 216 | 216 | return true; |
| 217 | 217 | break; |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hGetHelpTextTag() |
| 225 | 225 | */ |
| 226 | 226 | public function hGetHelpTextTag($tag) { |
| 227 | - switch($tag){ |
|
| 227 | + switch ($tag) { |
|
| 228 | 228 | case '_ACT': |
| 229 | 229 | return array( |
| 230 | 230 | I18N::translate('Certificate'), |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | public function getProvider() { |
| 243 | 243 | global $WT_TREE; |
| 244 | 244 | |
| 245 | - if(!$this->provider) { |
|
| 245 | + if (!$this->provider) { |
|
| 246 | 246 | $root_path = $this->getSetting('MAJ_CERT_ROOTDIR', 'certificates/'); |
| 247 | 247 | $this->provider = new CertificateFileProvider($root_path, $WT_TREE); |
| 248 | 248 | } |
@@ -256,9 +256,9 @@ discard block |
||
| 256 | 256 | * @param Certificate $certificatePath Certificate (as per the GEDCOM) |
| 257 | 257 | * @param string|null $sid Linked Source ID, if it exists |
| 258 | 258 | */ |
| 259 | - protected function getDisplay_ACT(Certificate $certificate, $sid = null){ |
|
| 259 | + protected function getDisplay_ACT(Certificate $certificate, $sid = null) { |
|
| 260 | 260 | $html = ''; |
| 261 | - if($certificate){ |
|
| 261 | + if ($certificate) { |
|
| 262 | 262 | $certificate->setSource($sid); |
| 263 | 263 | $html = $certificate->displayImage('icon'); |
| 264 | 264 | } |