@@ -47,13 +47,13 @@ |
||
47 | 47 | <div class="value"> |
48 | 48 | <?php |
49 | 49 | $users = $this->data->get('users_settings'); |
50 | - if(count($users) == 1) { |
|
51 | - $root_indi = $users[0]['rootid']; ?> |
|
50 | + if (count($users) == 1) { |
|
51 | + $root_indi = $users[0]['rootid']; ?> |
|
52 | 52 | <label> |
53 | 53 | <input id="maj_sosa_input_userid" type="hidden" name="userid" value="<?php echo $users[0]['user']->getUserId(); ?>" /> |
54 | 54 | <?php echo $users[0]['user']->getRealNameHtml() ?> |
55 | 55 | </label> |
56 | - <?php } else if(count($users) > 1) { ?> |
|
56 | + <?php } else if (count($users) > 1) { ?> |
|
57 | 57 | <select id='maj-sosa-config-select' name="userid"> |
58 | 58 | <?php |
59 | 59 | $root_indi = $users[0]['rootid']; |
@@ -20,13 +20,13 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * Cache component to speed up some potential data retrievals |
22 | 22 | */ |
23 | -class Cache{ |
|
23 | +class Cache { |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Underlying Cache object |
27 | 27 | * @var CacheItemPoolInterface $cache |
28 | 28 | */ |
29 | - protected $cache=null; |
|
29 | + protected $cache = null; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Defines whether the cache has been initialised |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * |
60 | 60 | */ |
61 | 61 | protected function init() { |
62 | - if(Apc::isAvailable()) { |
|
62 | + if (Apc::isAvailable()) { |
|
63 | 63 | $driver = new Apc(); |
64 | 64 | } else { |
65 | 65 | if (!is_dir(WT_DATA_DIR.DIRECTORY_SEPARATOR.'cache')) { |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | * Initiliase the Cache if not done. |
84 | 84 | * |
85 | 85 | */ |
86 | - protected function checkInit(){ |
|
87 | - if(!$this->is_init) $this->init(); |
|
86 | + protected function checkInit() { |
|
87 | + if (!$this->is_init) $this->init(); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | * @param AbstractModule $mod Calling module |
95 | 95 | * @return string Cached key name |
96 | 96 | */ |
97 | - protected function getKeyName($value, AbstractModule $mod = null){ |
|
97 | + protected function getKeyName($value, AbstractModule $mod = null) { |
|
98 | 98 | $this->checkInit(); |
99 | 99 | $mod_name = 'myartjaub'; |
100 | - if($mod !== null) $mod_name = $mod->getName(); |
|
100 | + if ($mod !== null) $mod_name = $mod->getName(); |
|
101 | 101 | return $mod_name.'_'.$value; |
102 | 102 | } |
103 | 103 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param AbstractModule $mod Calling module |
109 | 109 | * @return \Psr\Cache\CacheItemInterface |
110 | 110 | */ |
111 | - public function getI($value, AbstractModule $mod = null){ |
|
111 | + public function getI($value, AbstractModule $mod = null) { |
|
112 | 112 | $this->checkInit(); |
113 | 113 | return $this->cache->getItem($this->getKeyName($value, $mod)); |
114 | 114 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @param AbstractModule $mod Calling module |
121 | 121 | * @return \Psr\Cache\CacheItemInterface |
122 | 122 | */ |
123 | - public static function get($value, AbstractModule $mod = null){ |
|
123 | + public static function get($value, AbstractModule $mod = null) { |
|
124 | 124 | return self::getInstance()->getI($value, $mod); |
125 | 125 | } |
126 | 126 | |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | * @param mixed $data Value |
132 | 132 | * @param AbstractModule $mod Calling module |
133 | 133 | */ |
134 | - public function saveI($value, $data, AbstractModule $mod = null){ |
|
134 | + public function saveI($value, $data, AbstractModule $mod = null) { |
|
135 | 135 | $this->checkInit(); |
136 | 136 | |
137 | 137 | $item = $value; |
138 | - if(!($value instanceof CacheItemInterface)) { |
|
138 | + if (!($value instanceof CacheItemInterface)) { |
|
139 | 139 | $item = new \Stash\Item(); |
140 | 140 | $item->setKey($this->getKeyName($value, $mod)); |
141 | 141 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @param mixed $data Value |
151 | 151 | * @param AbstractModule $mod Calling module |
152 | 152 | */ |
153 | - public static function save($value, $data, AbstractModule $mod = null){ |
|
153 | + public static function save($value, $data, AbstractModule $mod = null) { |
|
154 | 154 | self::getInstance()->saveI($value, $data, $mod); |
155 | 155 | } |
156 | 156 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @param AbstractModule $mod Calling module |
162 | 162 | * @return bool Deletion successful? |
163 | 163 | */ |
164 | - public function deleteI($value, AbstractModule $mod = null){ |
|
164 | + public function deleteI($value, AbstractModule $mod = null) { |
|
165 | 165 | $this->checkInit(); |
166 | 166 | return $this->cache->deleteItem($this->getKeyName($value, $mod)); |
167 | 167 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @param AbstractModule $mod Calling module |
174 | 174 | * @return bool Deletion successful? |
175 | 175 | */ |
176 | - public static function delete($value, AbstractModule $mod = null){ |
|
176 | + public static function delete($value, AbstractModule $mod = null) { |
|
177 | 177 | return self::getInstance()->deleteI($value, $mod); |
178 | 178 | } |
179 | 179 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * Clean the cache |
182 | 182 | * |
183 | 183 | */ |
184 | - public function cleanI(){ |
|
184 | + public function cleanI() { |
|
185 | 185 | $this->checkInit(); |
186 | 186 | $this->cache->clear(); |
187 | 187 | } |
@@ -35,8 +35,8 @@ |
||
35 | 35 | $surn = str_replace('@N.N.', 'AAAA', $surn); |
36 | 36 | |
37 | 37 | return array( |
38 | - $surn . 'AAAA' . $givn, |
|
39 | - $givn . 'AAAA' . $surn, |
|
38 | + $surn.'AAAA'.$givn, |
|
39 | + $givn.'AAAA'.$surn, |
|
40 | 40 | ); |
41 | 41 | } |
42 | 42 |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | <input type="hidden" name="ged" value="<?= $this->data->get('url_ged') ?>"> |
40 | 40 | <select name="city"> |
41 | 41 | <?php foreach ($cities as $city) { ?> |
42 | - <option value="<?= Functions::encryptToSafeBase64($city) ?>" <?php if(trim($city) == trim($selected_city)) echo 'selected="selected"'?> ><?= $city ?></option> |
|
42 | + <option value="<?= Functions::encryptToSafeBase64($city) ?>" <?php if (trim($city) == trim($selected_city)) echo 'selected="selected"'?> ><?= $city ?></option> |
|
43 | 43 | <?php } ?> |
44 | 44 | </select> |
45 | 45 | <input type="submit" value="<?= I18N::translate('Show') ?>" /> |
46 | 46 | </form> |
47 | 47 | |
48 | - <?php if($this->data->get('has_list', false)) { ?> |
|
48 | + <?php if ($this->data->get('has_list', false)) { ?> |
|
49 | 49 | <div class="loading-image"> </div> |
50 | 50 | <div class="certificate-list"> |
51 | 51 | <table id="<?= $this->data->get('table_id') ?>"> |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | ?> |
63 | 63 | <tr> |
64 | 64 | <!-- Certificate date --> |
65 | - <?php if($date = $certificate->getCertificateDate()) { ?> |
|
65 | + <?php if ($date = $certificate->getCertificateDate()) { ?> |
|
66 | 66 | <td data-sort="<?= $date->julianDay() ?>"><?= $date->display() ?></td> |
67 | 67 | <?php } else { ?> |
68 | 68 | <td data-sort="0"> </td> |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | <?php |
74 | 74 | $name = $certificate->getCertificateDetails() ?: ''; |
75 | 75 | $sortname = ""; |
76 | - $ct_names=preg_match("/([A-Z]{2,})/", $name, $match); |
|
77 | - if($ct_names > 0) $sortname = $match[1].'_'; |
|
76 | + $ct_names = preg_match("/([A-Z]{2,})/", $name, $match); |
|
77 | + if ($ct_names > 0) $sortname = $match[1].'_'; |
|
78 | 78 | $sortname .= $name; |
79 | 79 | ?> |
80 | 80 | <td data-sort="<?= Filter::escapeHtml($sortname) ?>"> |
@@ -91,7 +91,7 @@ |
||
91 | 91 | return $wb_controller->config($block_id); |
92 | 92 | } |
93 | 93 | catch (MvcException $ex) { |
94 | - if($ex->getHttpCode() != 200) throw $ex; |
|
94 | + if ($ex->getHttpCode() != 200) throw $ex; |
|
95 | 95 | return; |
96 | 96 | } |
97 | 97 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $this->tree = $tree; |
59 | 59 | $this->user = $user; |
60 | 60 | |
61 | - $this->sosa_provider = new SosaProvider($this->tree, $this->user);; |
|
61 | + $this->sosa_provider = new SosaProvider($this->tree, $this->user); ; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function computeAll() { |
69 | 69 | $root_id = $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID'); |
70 | 70 | $indi = Individual::getInstance($root_id, $this->tree); |
71 | - if($indi){ |
|
71 | + if ($indi) { |
|
72 | 72 | $this->sosa_provider->deleteAll(); |
73 | 73 | $this->addNode($indi, 1); |
74 | 74 | $this->flushTmpSosaTable(true); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | public function computeFromIndividual(Individual $indi) { |
86 | 86 | $dindi = new \MyArtJaub\Webtrees\Individual($indi); |
87 | 87 | $current_sosas = $dindi->getSosaNumbers(); |
88 | - foreach($current_sosas as $current_sosa => $gen) { |
|
88 | + foreach ($current_sosas as $current_sosa => $gen) { |
|
89 | 89 | $this->sosa_provider->deleteAncestors($current_sosa); |
90 | 90 | $this->addNode($indi, $current_sosa); |
91 | 91 | } |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | |
112 | 112 | $this->flushTmpSosaTable(); |
113 | 113 | |
114 | - if($fam = $indi->getPrimaryChildFamily()) { |
|
115 | - if($husb = $fam->getHusband()) $this->addNode($husb, 2 * $sosa); |
|
116 | - if($wife = $fam->getWife()) $this->addNode($wife, 2 * $sosa + 1); |
|
114 | + if ($fam = $indi->getPrimaryChildFamily()) { |
|
115 | + if ($husb = $fam->getHusband()) $this->addNode($husb, 2 * $sosa); |
|
116 | + if ($wife = $fam->getWife()) $this->addNode($wife, 2 * $sosa + 1); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | * @param bool $force Should the flush be forced |
124 | 124 | */ |
125 | 125 | protected function flushTmpSosaTable($force = false) { |
126 | - if( count($this->tmp_sosa_table)> 0 && |
|
127 | - ($force || count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT)){ |
|
126 | + if (count($this->tmp_sosa_table) > 0 && |
|
127 | + ($force || count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT)) { |
|
128 | 128 | $this->sosa_provider->insertOrUpdate($this->tmp_sosa_table); |
129 | 129 | $this->tmp_sosa_table = array(); |
130 | 130 | } |
@@ -57,7 +57,7 @@ |
||
57 | 57 | public function getConfigLink() { |
58 | 58 | Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
59 | 59 | |
60 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
60 | + return 'module.php?mod='.$this->getName().'&mod_action=AdminConfig'; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @param \Fisharebest\Webtrees\Fact $fact_in The Fact to extend |
40 | 40 | */ |
41 | - public function __construct(\Fisharebest\Webtrees\Fact $fact_in){ |
|
41 | + public function __construct(\Fisharebest\Webtrees\Fact $fact_in) { |
|
42 | 42 | $this->fact = $fact_in; |
43 | 43 | } |
44 | 44 | |
@@ -54,22 +54,22 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return int Level of sources |
56 | 56 | */ |
57 | - public function isSourced(){ |
|
58 | - $isSourced=0; |
|
57 | + public function isSourced() { |
|
58 | + $isSourced = 0; |
|
59 | 59 | $date = $this->fact->getDate(); |
60 | - if($date->isOK()) { |
|
61 | - $isSourced=-1; |
|
62 | - if($date->qual1=='' && $date->minimumJulianDay() == $date->maximumJulianDay()){ |
|
63 | - $isSourced=-2; |
|
60 | + if ($date->isOK()) { |
|
61 | + $isSourced = -1; |
|
62 | + if ($date->qual1 == '' && $date->minimumJulianDay() == $date->maximumJulianDay()) { |
|
63 | + $isSourced = -2; |
|
64 | 64 | $citations = $this->fact->getCitations(); |
65 | - foreach($citations as $citation){ |
|
66 | - $isSourced=max($isSourced, 1); |
|
67 | - if(preg_match('/3 _ACT (.*)/', $citation) ){ |
|
68 | - $isSourced=max($isSourced, 2); |
|
65 | + foreach ($citations as $citation) { |
|
66 | + $isSourced = max($isSourced, 1); |
|
67 | + if (preg_match('/3 _ACT (.*)/', $citation)) { |
|
68 | + $isSourced = max($isSourced, 2); |
|
69 | 69 | preg_match_all("/4 DATE (.*)/", $citation, $datessource, PREG_SET_ORDER); |
70 | - foreach($datessource as $daterec){ |
|
70 | + foreach ($datessource as $daterec) { |
|
71 | 71 | $datesource = new Date($daterec[1]); |
72 | - if(abs($datesource->julianDay() - $date->julianDay()) < self::DATE_PRECISION_MARGIN){ |
|
72 | + if (abs($datesource->julianDay() - $date->julianDay()) < self::DATE_PRECISION_MARGIN) { |
|
73 | 73 | $isSourced = max($isSourced, 3); //If this level increases, do not forget to change the constant MAX_IS_SOURCED_LEVEL |
74 | 74 | } |
75 | 75 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function index(PageController $parent_controller, Tree $tree, $block_id, $template) { |
46 | 46 | $view_bag = new ViewBag(); |
47 | 47 | |
48 | - if($parent_controller && $tree) { |
|
48 | + if ($parent_controller && $tree) { |
|
49 | 49 | |
50 | 50 | $view_bag->set('tree', $tree); |
51 | 51 | $view_bag->set('indi', $parent_controller->getSignificantIndividual()); |
@@ -64,22 +64,22 @@ discard block |
||
64 | 64 | '); |
65 | 65 | |
66 | 66 | if (Auth::isAdmin()) { |
67 | - $title='<a class="icon-admin" title="'.I18N::translate('Preferences').'" href="block_edit.php?block_id='.$block_id.'&ged=' . $tree->getNameHtml() . '&ctype=gedcom"></a>'; |
|
67 | + $title = '<a class="icon-admin" title="'.I18N::translate('Preferences').'" href="block_edit.php?block_id='.$block_id.'&ged='.$tree->getNameHtml().'&ctype=gedcom"></a>'; |
|
68 | 68 | } else { |
69 | - $title=''; |
|
69 | + $title = ''; |
|
70 | 70 | } |
71 | - $title .='<span dir="auto">'.$tree->getTitleHtml().'</span>'; |
|
71 | + $title .= '<span dir="auto">'.$tree->getTitleHtml().'</span>'; |
|
72 | 72 | |
73 | 73 | $piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false); |
74 | 74 | $view_bag->set('piwik_enabled', $piwik_enabled); |
75 | - if($piwik_enabled) { |
|
75 | + if ($piwik_enabled) { |
|
76 | 76 | $parent_controller->addInlineJavascript( |
77 | 77 | '$("#piwik_stats") |
78 | 78 | .load("module.php?mod='.$this->module->getName().'&mod_action=Piwik&block_id='.$block_id.'");' |
79 | 79 | ); |
80 | 80 | } |
81 | 81 | |
82 | - $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial(); |
|
82 | + $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial(); |
|
83 | 83 | |
84 | 84 | if ($template) { |
85 | 85 | return Theme::theme()->formatBlock($id, $title, $class, $content); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function config($block_id = null) { |
100 | 100 | |
101 | - if(empty($block_id)) throw new MvcException(404); |
|
101 | + if (empty($block_id)) throw new MvcException(404); |
|
102 | 102 | |
103 | 103 | if (Filter::postBool('save') && Filter::checkCsrf()) { |
104 | 104 | $this->module->setBlockSetting($block_id, 'piwik_enabled', Filter::postBool('piwik_enabled')); |