@@ -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 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param string $hook_function_in Hook function to be subscribed or executed |
32 | 32 | * @param string $hook_context_in Hook context to be subscribed or executed |
33 | 33 | */ |
34 | - public function __construct($hook_function_in, $hook_context_in = 'all'){ |
|
34 | + public function __construct($hook_function_in, $hook_context_in = 'all') { |
|
35 | 35 | $this->hook_function = $hook_function_in; |
36 | 36 | $this->hook_context = $hook_context_in; |
37 | 37 | } |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @param string $hsubscriber Name of the subscriber module |
49 | 49 | */ |
50 | - public function subscribe($hsubscriber){ |
|
51 | - if(HookProvider::getInstance()->isModuleOperational()){ |
|
50 | + public function subscribe($hsubscriber) { |
|
51 | + if (HookProvider::getInstance()->isModuleOperational()) { |
|
52 | 52 | Database::prepare( |
53 | 53 | "INSERT IGNORE INTO `##maj_hooks` (majh_hook_function, majh_hook_context, majh_module_name)". |
54 | 54 | " VALUES (?, ?, ?)" |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @param string $hsubscriber Name of the subscriber module |
63 | 63 | * @param int $priority Priority of execution |
64 | 64 | */ |
65 | - public function setPriority($hsubscriber, $priority){ |
|
66 | - if(HookProvider::getInstance()->isModuleOperational()){ |
|
65 | + public function setPriority($hsubscriber, $priority) { |
|
66 | + if (HookProvider::getInstance()->isModuleOperational()) { |
|
67 | 67 | Database::prepare( |
68 | 68 | "UPDATE `##maj_hooks`". |
69 | 69 | " SET majh_module_priority=?". |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @param string $hsubscriber Name of the subscriber module |
81 | 81 | */ |
82 | - public function enable($hsubscriber){ |
|
83 | - if(HookProvider::getInstance()->isModuleOperational()){ |
|
82 | + public function enable($hsubscriber) { |
|
83 | + if (HookProvider::getInstance()->isModuleOperational()) { |
|
84 | 84 | Database::prepare( |
85 | 85 | "UPDATE `##maj_hooks`". |
86 | 86 | " SET majh_status='enabled'". |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @param string $hsubscriber Name of the subscriber module |
98 | 98 | */ |
99 | - public function disable($hsubscriber){ |
|
100 | - if(HookProvider::getInstance()->isModuleOperational()){ |
|
99 | + public function disable($hsubscriber) { |
|
100 | + if (HookProvider::getInstance()->isModuleOperational()) { |
|
101 | 101 | Database::prepare( |
102 | 102 | "UPDATE `##maj_hooks`". |
103 | 103 | " SET majh_status='disabled'". |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @param string $hsubscriber Name of the subscriber module |
115 | 115 | */ |
116 | - public function remove($hsubscriber){ |
|
117 | - if(HookProvider::getInstance()->isModuleOperational()){ |
|
116 | + public function remove($hsubscriber) { |
|
117 | + if (HookProvider::getInstance()->isModuleOperational()) { |
|
118 | 118 | Database::prepare( |
119 | 119 | "DELETE FROM `##maj_hooks`". |
120 | 120 | " WHERE majh_hook_function=?". |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function executeOnlyFor(array $module_names) { |
140 | 140 | $result = array(); |
141 | - if(HookProvider::getInstance()->isModuleOperational()){ |
|
141 | + if (HookProvider::getInstance()->isModuleOperational()) { |
|
142 | 142 | $params = func_get_args(); |
143 | 143 | array_shift($params); |
144 | 144 | foreach ($module_names as $module_name) { |
145 | - if($module = Module::getModuleByName($module_name)) { |
|
145 | + if ($module = Module::getModuleByName($module_name)) { |
|
146 | 146 | $result[] = call_user_func_array(array($module, $this->hook_function), $params); |
147 | 147 | } |
148 | 148 | } |
@@ -156,17 +156,17 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @return array Results of the hook executions |
158 | 158 | */ |
159 | - public function execute(){ |
|
159 | + public function execute() { |
|
160 | 160 | $result = array(); |
161 | - if(HookProvider::getInstance()->isModuleOperational()){ |
|
161 | + if (HookProvider::getInstance()->isModuleOperational()) { |
|
162 | 162 | $params = func_get_args(); |
163 | 163 | $sqlquery = ''; |
164 | 164 | $sqlparams = array($this->hook_function); |
165 | - if($this->hook_context != 'all') { |
|
165 | + if ($this->hook_context != 'all') { |
|
166 | 166 | $sqlparams = array($this->hook_function, $this->hook_context); |
167 | 167 | $sqlquery = " OR majh_hook_context=?"; |
168 | 168 | } |
169 | - $module_names=Database::prepare( |
|
169 | + $module_names = Database::prepare( |
|
170 | 170 | "SELECT majh_module_name AS module, majh_module_priority AS priority FROM `##maj_hooks`". |
171 | 171 | " WHERE majh_hook_function = ? AND (majh_hook_context='all'".$sqlquery.") AND majh_status='enabled'". |
172 | 172 | " ORDER BY majh_module_priority ASC, module ASC" |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @return int Number of active modules |
185 | 185 | */ |
186 | - public function getNumberActiveModules(){ |
|
187 | - if(HookProvider::getInstance()->isModuleOperational()){ |
|
186 | + public function getNumberActiveModules() { |
|
187 | + if (HookProvider::getInstance()->isModuleOperational()) { |
|
188 | 188 | $sqlquery = ''; |
189 | 189 | $sqlparams = array($this->hook_function); |
190 | - if($this->hook_context != 'all') { |
|
190 | + if ($this->hook_context != 'all') { |
|
191 | 191 | $sqlparams = array($this->hook_function, $this->hook_context); |
192 | 192 | $sqlquery = " OR majh_hook_context=?"; |
193 | 193 | } |
194 | - $module_names=Database::prepare( |
|
194 | + $module_names = Database::prepare( |
|
195 | 195 | "SELECT majh_module_name AS modules FROM `##maj_hooks`". |
196 | 196 | " WHERE majh_hook_function = ? AND (majh_hook_context='all'".$sqlquery.") AND majh_status='enabled'" |
197 | 197 | )->execute($sqlparams)->fetchOneColumn(); |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @return bool True is active modules exist, false otherwise |
207 | 207 | */ |
208 | - public function hasAnyActiveModule(){ |
|
209 | - return ($this->getNumberActiveModules()>0); |
|
208 | + public function hasAnyActiveModule() { |
|
209 | + return ($this->getNumberActiveModules() > 0); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | public function render() { |
46 | 46 | global $controller; |
47 | 47 | |
48 | - if(!$this->ctrl) throw new \Exception('Controller not initialised'); |
|
48 | + if (!$this->ctrl) throw new \Exception('Controller not initialised'); |
|
49 | 49 | |
50 | 50 | $controller = $this->ctrl; |
51 | 51 | $this->ctrl->pageHeader(); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * Manage updates sent from the AdminConfig@index form. |
32 | 32 | */ |
33 | 33 | protected function update() { |
34 | - if(Auth::isAdmin()){ |
|
34 | + if (Auth::isAdmin()) { |
|
35 | 35 | |
36 | 36 | $this->module->setSetting('MAJ_TITLE_PREFIX', Filter::post('MAJ_TITLE_PREFIX')); |
37 | 37 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function index() { |
63 | 63 | $action = Filter::post('action'); |
64 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
64 | + if ($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
65 | 65 | |
66 | 66 | Theme::theme(new AdministrationTheme)->init(Globals::getTree()); |
67 | 67 | $ctrl = new PageController(); |
@@ -34,26 +34,26 @@ discard block |
||
34 | 34 | * Manage updates sent from the AdminConfig@index form. |
35 | 35 | */ |
36 | 36 | protected function update() { |
37 | - if(Auth::isAdmin()){ |
|
37 | + if (Auth::isAdmin()) { |
|
38 | 38 | $ihooks = HookProvider::getInstance()->getInstalledHooks(); |
39 | 39 | |
40 | - $module_names= Database::prepare( |
|
40 | + $module_names = Database::prepare( |
|
41 | 41 | "SELECT module_name FROM `##module` WHERE status='disabled'" |
42 | 42 | )->fetchOneColumn(); |
43 | 43 | |
44 | - if($ihooks !== null){ |
|
44 | + if ($ihooks !== null) { |
|
45 | 45 | foreach ($ihooks as $ihook => $params) { |
46 | - if(Filter::post('hook-' . $params['id']) === 'yes') { |
|
46 | + if (Filter::post('hook-'.$params['id']) === 'yes') { |
|
47 | 47 | $array_hook = explode('#', $ihook); |
48 | 48 | //Update status |
49 | - $new_status= Filter::postBool('status-' . $params['id']); |
|
50 | - if(in_array($array_hook[0], $module_names)) $new_status = false; |
|
49 | + $new_status = Filter::postBool('status-'.$params['id']); |
|
50 | + if (in_array($array_hook[0], $module_names)) $new_status = false; |
|
51 | 51 | $previous_status = $params['status']; |
52 | 52 | if ($new_status !== null) { |
53 | - $new_status= $new_status ? 'enabled' : 'disabled'; |
|
54 | - if($new_status != $previous_status){ |
|
53 | + $new_status = $new_status ? 'enabled' : 'disabled'; |
|
54 | + if ($new_status != $previous_status) { |
|
55 | 55 | $chook = new Hook($array_hook[1], $array_hook[2]); |
56 | - switch($new_status){ |
|
56 | + switch ($new_status) { |
|
57 | 57 | case 'enabled': |
58 | 58 | $chook->enable($array_hook[0]); |
59 | 59 | break; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $new_priority = Filter::postInteger("moduleorder-{$params['id']}"); |
71 | 71 | $previous_priority = $params['priority']; |
72 | 72 | if ($new_priority !== null) { |
73 | - if($new_priority != $previous_priority){ |
|
73 | + if ($new_priority != $previous_priority) { |
|
74 | 74 | $chook = new Hook($array_hook[1], $array_hook[2]); |
75 | 75 | $chook->setPriority($array_hook[0], $new_priority); |
76 | 76 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | HookProvider::getInstance()->updateHooks(); |
93 | 93 | |
94 | 94 | $action = Filter::post('action'); |
95 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
95 | + if ($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
96 | 96 | |
97 | 97 | Theme::theme(new AdministrationTheme)->init(Globals::getTree()); |
98 | 98 | $ctrl = new PageController(); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | ->restrictAccess(Auth::isAdmin()) |
101 | 101 | ->setPageTitle($this->module->getTitle()); |
102 | 102 | |
103 | - $table_id = 'table-installedhooks-' . Uuid::uuid4(); |
|
103 | + $table_id = 'table-installedhooks-'.Uuid::uuid4(); |
|
104 | 104 | |
105 | 105 | $view_bag = new ViewBag(); |
106 | 106 | $view_bag->set('title', $ctrl->getPageTitle()); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
64 | 64 | */ |
65 | 65 | public function getConfigLink() { |
66 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
66 | + return 'module.php?mod='.$this->getName().'&mod_action=AdminConfig'; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -92,19 +92,19 @@ discard block |
||
92 | 92 | $res = ''; |
93 | 93 | $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
94 | 94 | $titles = $dindi->getTitles(); |
95 | - if(count($titles)>0){ |
|
95 | + if (count($titles) > 0) { |
|
96 | 96 | $res = ' |
97 | 97 | <dl> |
98 | 98 | <dt class="label">'.I18N::translate('Titles').'</dt>'; |
99 | - foreach($titles as $title=>$props){ |
|
99 | + foreach ($titles as $title=>$props) { |
|
100 | 100 | $res .= |
101 | - '<dd class="field">' . $title. ' ' . |
|
102 | - FunctionsPrint::getListFromArray($props) . |
|
101 | + '<dd class="field">'.$title.' '. |
|
102 | + FunctionsPrint::getListFromArray($props). |
|
103 | 103 | '</dd>'; |
104 | 104 | } |
105 | - $res .= '</dl>'; |
|
105 | + $res .= '</dl>'; |
|
106 | 106 | } |
107 | - return array( 'indi-header-titles' , $res); |
|
107 | + return array('indi-header-titles', $res); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function hPrintHeader() { |
121 | 121 | $html = ''; |
122 | - if($this->getSetting('MAJ_ADD_HTML_HEADER', 0) == 1){ |
|
123 | - if(Auth::accessLevel(Globals::getTree()) >= $this->getSetting('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE) && !Filter::getBool('noheader')){ |
|
122 | + if ($this->getSetting('MAJ_ADD_HTML_HEADER', 0) == 1) { |
|
123 | + if (Auth::accessLevel(Globals::getTree()) >= $this->getSetting('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE) && !Filter::getBool('noheader')) { |
|
124 | 124 | $html .= $this->getSetting('MAJ_HTML_HEADER', ''); |
125 | 125 | } |
126 | 126 | } |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | public function hPrintFooter() { |
135 | 135 | $wt_tree = Globals::getTree(); |
136 | 136 | $html = ''; |
137 | - if($this->getSetting('MAJ_DISPLAY_CNIL', 0) == 1){ |
|
137 | + if ($this->getSetting('MAJ_DISPLAY_CNIL', 0) == 1) { |
|
138 | 138 | $html .= '<br/>'; |
139 | 139 | $html .= '<div class="center">'; |
140 | 140 | $cnil_ref = $this->getSetting('MAJ_CNIL_REFERENCE', ''); |
141 | - if($cnil_ref != ''){ |
|
141 | + if ($cnil_ref != '') { |
|
142 | 142 | $html .= I18N::translate('This site has been notified to the French National Commission for Data protection (CNIL) and registered under number %s. ', $cnil_ref); |
143 | 143 | } |
144 | 144 | $html .= I18N::translate('In accordance with the French Data protection Act (<em>Loi Informatique et Libertés</em>) of January 6th, 1978, you have the right to access, modify, rectify and delete personal information that pertains to you. To exercice this right, please contact %s, and provide your name, address and a proof of your identity.', |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | $html .= '</div>'; |
147 | 147 | } |
148 | 148 | |
149 | - if($this->getSetting('MAJ_ADD_HTML_FOOTER', 0) == 1){ |
|
150 | - if(Auth::accessLevel($wt_tree) >= $this->getSetting('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE) && !Filter::getBool('nofooter')){ |
|
149 | + if ($this->getSetting('MAJ_ADD_HTML_FOOTER', 0) == 1) { |
|
150 | + if (Auth::accessLevel($wt_tree) >= $this->getSetting('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE) && !Filter::getBool('nofooter')) { |
|
151 | 151 | $html .= $this->getSetting('MAJ_HTML_FOOTER', ''); |
152 | 152 | } |
153 | 153 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @return string List of elements |
33 | 33 | */ |
34 | 34 | public static function getListFromArray(array $array) { |
35 | - $n=count($array); |
|
35 | + $n = count($array); |
|
36 | 36 | switch ($n) { |
37 | 37 | case 0: |
38 | 38 | return ''; |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | default: |
42 | 42 | return implode( |
43 | 43 | /* I18N: list separator */ I18N::translate(', '), |
44 | - array_slice($array, 0, $n-1) |
|
45 | - ) . |
|
46 | - /* I18N: last list separator, " and " in English, " et " in French */ I18N::translate(' and ') . |
|
47 | - $array[$n-1]; |
|
44 | + array_slice($array, 0, $n - 1) |
|
45 | + ). |
|
46 | + /* I18N: last list separator, " and " in English, " et " in French */ I18N::translate(' and '). |
|
47 | + $array[$n - 1]; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | \MyArtJaub\Webtrees\Map\MapProviderInterface $mapProvider |
61 | 61 | ) { |
62 | 62 | $place = $fact->getPlace(); |
63 | - if(!$place->isEmpty()) { |
|
64 | - $iconPlace= $mapProvider->getPlaceIcon($place); |
|
65 | - if($iconPlace && strlen($iconPlace) > 0){ |
|
66 | - return '<div class="fact_flag">'. self::htmlPlaceIcon($place, $iconPlace, 50). '</div>'; |
|
63 | + if (!$place->isEmpty()) { |
|
64 | + $iconPlace = $mapProvider->getPlaceIcon($place); |
|
65 | + if ($iconPlace && strlen($iconPlace) > 0) { |
|
66 | + return '<div class="fact_flag">'.self::htmlPlaceIcon($place, $iconPlace, 50).'</div>'; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | return ''; |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | * @param number $size |
78 | 78 | * @return string HTML code of the inserted flag |
79 | 79 | */ |
80 | - public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path , $size = 50) { |
|
81 | - return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />'; |
|
80 | + public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path, $size = 50) { |
|
81 | + return '<img class="flag_gm_h'.$size.'" src="'.$icon_path.'" title="'.$place->getGedcomName().'" alt="'.$place->getGedcomName().'" />'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $minimum = PHP_INT_MAX; |
97 | 97 | $maximum = 1; |
98 | 98 | foreach ($list as $params) { |
99 | - if(array_key_exists('count', $params)) { |
|
99 | + if (array_key_exists('count', $params)) { |
|
100 | 100 | $maximum = max($maximum, $params['count']); |
101 | 101 | $minimum = min($minimum, $params['count']); |
102 | 102 | } |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | $size = 75.0 + 125.0 * ($count - $minimum) / ($maximum - $minimum); |
115 | 115 | } |
116 | 116 | |
117 | - $html .= '<a style="font-size:' . $size . '%" href="' . $url . '">'; |
|
117 | + $html .= '<a style="font-size:'.$size.'%" href="'.$url.'">'; |
|
118 | 118 | if ($totals) { |
119 | - $html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $text . '</span>', I18N::number($count)); |
|
119 | + $html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">'.$text.'</span>', I18N::number($count)); |
|
120 | 120 | } else { |
121 | 121 | $html .= $text; |
122 | 122 | } |
123 | 123 | $html .= '</a>'; |
124 | 124 | } |
125 | - return '<div class="tag_cloud">' . $html . '</div>'; |
|
125 | + return '<div class="tag_cloud">'.$html.'</div>'; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | * @param bool $isStrong Bolden the name ? |
158 | 158 | * @return string HTML Code for individual item |
159 | 159 | */ |
160 | - public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true){ |
|
160 | + public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true) { |
|
161 | 161 | $html = ''; |
162 | 162 | $tag = 'em'; |
163 | - if($isStrong) $tag = 'strong'; |
|
164 | - if($individual && $individual->canShow()){ |
|
163 | + if ($isStrong) $tag = 'strong'; |
|
164 | + if ($individual && $individual->canShow()) { |
|
165 | 165 | $dindi = new Individual($individual); |
166 | 166 | $html = $individual->getSexImage(); |
167 | 167 | $html .= '<a class="list_item" href="'. |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $html .= '</a>'; |
177 | 177 | } |
178 | 178 | else { |
179 | - $html .= '<span class=\"list_item\"><'.$tag.'>' . I18N::translate('Private') . '</'.$tag.'></span>'; |
|
179 | + $html .= '<span class=\"list_item\"><'.$tag.'>'.I18N::translate('Private').'</'.$tag.'></span>'; |
|
180 | 180 | } |
181 | 181 | return $html; |
182 | 182 | } |
@@ -188,20 +188,20 @@ discard block |
||
188 | 188 | * @param boolean $anchor option to print a link to calendar |
189 | 189 | * @return string HTML code for short date |
190 | 190 | */ |
191 | - public static function formatFactDateShort(\Fisharebest\Webtrees\Fact $fact, $anchor=false) { |
|
192 | - $html=''; |
|
191 | + public static function formatFactDateShort(\Fisharebest\Webtrees\Fact $fact, $anchor = false) { |
|
192 | + $html = ''; |
|
193 | 193 | $date = $fact->getDate(); |
194 | - if($date->isOK()){ |
|
195 | - $html.=' '.$date->Display($anchor && !Globals::isSearchSpider(), '%Y'); |
|
194 | + if ($date->isOK()) { |
|
195 | + $html .= ' '.$date->Display($anchor && !Globals::isSearchSpider(), '%Y'); |
|
196 | 196 | } |
197 | - else{ |
|
197 | + else { |
|
198 | 198 | // 1 DEAT Y with no DATE => print YES |
199 | 199 | // 1 BIRT 2 SOUR @S1@ => print YES |
200 | 200 | // 1 DEAT N is not allowed |
201 | 201 | // It is not proper GEDCOM form to use a N(o) value with an event tag to infer that it did not happen. |
202 | 202 | $factdetail = explode(' ', trim($fact->getGedcom())); |
203 | 203 | if (isset($factdetail) && (count($factdetail) == 3 && strtoupper($factdetail[2]) == 'Y') || (count($factdetail) == 4 && $factdetail[2] == 'SOUR')) { |
204 | - $html.=I18N::translate('yes'); |
|
204 | + $html .= I18N::translate('yes'); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | return $html; |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | * @param boolean $anchor option to print a link to placelist |
216 | 216 | * @return string HTML code for short place |
217 | 217 | */ |
218 | - public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){ |
|
219 | - $html=''; |
|
218 | + public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor = false) { |
|
219 | + $html = ''; |
|
220 | 220 | |
221 | 221 | if ($fact === null) return $html; |
222 | 222 | $place = $fact->getPlace(); |
223 | - if($place){ |
|
223 | + if ($place) { |
|
224 | 224 | $dplace = new Place($place); |
225 | 225 | $html .= $dplace->htmlFormattedName($format, $anchor); |
226 | 226 | } |
@@ -238,21 +238,21 @@ discard block |
||
238 | 238 | * @param string $size CSS size for the icon. A CSS style css_$size is required |
239 | 239 | * @return string HTML code for the formatted Sosa numbers |
240 | 240 | */ |
241 | - public static function formatSosaNumbers(array $sosatab, $format = 1, $size = 'small'){ |
|
241 | + public static function formatSosaNumbers(array $sosatab, $format = 1, $size = 'small') { |
|
242 | 242 | $html = ''; |
243 | - switch($format){ |
|
243 | + switch ($format) { |
|
244 | 244 | case 1: |
245 | - if(count($sosatab)>0){ |
|
245 | + if (count($sosatab) > 0) { |
|
246 | 246 | $html = '<i class="icon-maj-sosa_'.$size.'" title="'.I18N::translate('Sosa').'"></i>'; |
247 | 247 | } |
248 | 248 | break; |
249 | 249 | case 2: |
250 | - if(count($sosatab)>0){ |
|
250 | + if (count($sosatab) > 0) { |
|
251 | 251 | ksort($sosatab); |
252 | 252 | $tmp_html = array(); |
253 | 253 | foreach ($sosatab as $sosa => $gen) { |
254 | 254 | $tmp_html[] = sprintf( |
255 | - '<i class="icon-maj-sosa_%1$s" title="'.I18N::translate('Sosa').'"></i> <strong>%2$d '.I18N::translate('(G%s)', $gen) .'</strong>', |
|
255 | + '<i class="icon-maj-sosa_%1$s" title="'.I18N::translate('Sosa').'"></i> <strong>%2$d '.I18N::translate('(G%s)', $gen).'</strong>', |
|
256 | 256 | $size, |
257 | 257 | $sosa |
258 | 258 | ); |
@@ -278,15 +278,15 @@ discard block |
||
278 | 278 | * @param string $size CSS size for the icon. A CSS style css_$size is required |
279 | 279 | * @return string HTML code for IsSourced icon |
280 | 280 | */ |
281 | - public static function formatIsSourcedIcon($sourceType, $isSourced, $tag='EVEN', $format = 1, $size='normal'){ |
|
282 | - $html=''; |
|
283 | - $image=null; |
|
284 | - $title=null; |
|
285 | - switch($format){ |
|
281 | + public static function formatIsSourcedIcon($sourceType, $isSourced, $tag = 'EVEN', $format = 1, $size = 'normal') { |
|
282 | + $html = ''; |
|
283 | + $image = null; |
|
284 | + $title = null; |
|
285 | + switch ($format) { |
|
286 | 286 | case 1: |
287 | - switch($sourceType){ |
|
287 | + switch ($sourceType) { |
|
288 | 288 | case 'E': |
289 | - switch($isSourced){ |
|
289 | + switch ($isSourced) { |
|
290 | 290 | case 0: |
291 | 291 | $image = 'event_unknown'; |
292 | 292 | $title = I18N::translate('%s not found', GedcomTag::getLabel($tag)); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | } |
317 | 317 | break; |
318 | 318 | case 'R': |
319 | - switch($isSourced){ |
|
319 | + switch ($isSourced) { |
|
320 | 320 | case -1: |
321 | 321 | $image = 'record_notsourced'; |
322 | 322 | $title = I18N::translate('%s not sourced', GedcomTag::getLabel($tag)); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | default: |
337 | 337 | break; |
338 | 338 | } |
339 | - if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
339 | + if ($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
340 | 340 | break; |
341 | 341 | default: |
342 | 342 | break; |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @see \MyArtJaub\Webtrees\Map\MapProviderInterface::getProviderPlaceId() |
26 | 26 | */ |
27 | 27 | public function getProviderPlaceId(\Fisharebest\Webtrees\Place $place) { |
28 | - if(!$place->isEmpty()) { |
|
29 | - $parent = array_reverse(explode (',', $place->getGedcomName())); |
|
28 | + if (!$place->isEmpty()) { |
|
29 | + $parent = array_reverse(explode(',', $place->getGedcomName())); |
|
30 | 30 | $place_id = 0; |
31 | 31 | $nb_levels = count($parent); |
32 | - for ($i=0; $i < $nb_levels; $i++) { |
|
32 | + for ($i = 0; $i < $nb_levels; $i++) { |
|
33 | 33 | $parent[$i] = trim($parent[$i]); |
34 | - if (empty($parent[$i])) $parent[$i]='unknown';// GoogleMap module uses "unknown" while GEDCOM uses , , |
|
35 | - $pl_id=Database::prepare('SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place') |
|
34 | + if (empty($parent[$i])) $parent[$i] = 'unknown'; // GoogleMap module uses "unknown" while GEDCOM uses , , |
|
35 | + $pl_id = Database::prepare('SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place') |
|
36 | 36 | ->execute(array($i, $place_id, $parent[$i])) |
37 | 37 | ->fetchOne(); |
38 | 38 | if (empty($pl_id)) break; |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | * @see \MyArtJaub\Webtrees\Map\MapProviderInterface::getPlaceIcon() |
49 | 49 | */ |
50 | 50 | public function getPlaceIcon(\Fisharebest\Webtrees\Place $place) { |
51 | - if(!$place->isEmpty()){ |
|
51 | + if (!$place->isEmpty()) { |
|
52 | 52 | $place_details = |
53 | 53 | Database::prepare('SELECT pl_icon FROM `##placelocation` WHERE pl_id=? ORDER BY pl_place') |
54 | 54 | ->execute(array($this->getProviderPlaceId($place))) |
55 | 55 | ->fetchOneRow(); |
56 | - if($place_details){ |
|
56 | + if ($place_details) { |
|
57 | 57 | return WT_MODULES_DIR.'googlemap/'.$place_details->pl_icon; |
58 | 58 | } |
59 | 59 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getPossibleHooks() |
72 | 72 | */ |
73 | 73 | public function getPossibleHooks() { |
74 | - static $hooks=null; |
|
74 | + static $hooks = null; |
|
75 | 75 | if ($hooks === null) { |
76 | 76 | $hooks = array(); |
77 | 77 | |
@@ -83,31 +83,31 @@ discard block |
||
83 | 83 | 'SELECT module_name FROM `##module`' |
84 | 84 | )->fetchOneColumn(); |
85 | 85 | |
86 | - foreach($module_names as $module_name) { |
|
86 | + foreach ($module_names as $module_name) { |
|
87 | 87 | $module = Module::getModuleByName($module_name); |
88 | 88 | |
89 | - if($module instanceof HookSubscriberInterface){ |
|
89 | + if ($module instanceof HookSubscriberInterface) { |
|
90 | 90 | $subscribedhooks = $module->getSubscribedHooks(); |
91 | - if(is_array($subscribedhooks)){ |
|
92 | - foreach($subscribedhooks as $key => $value){ |
|
93 | - if(is_int($key)) { |
|
91 | + if (is_array($subscribedhooks)) { |
|
92 | + foreach ($subscribedhooks as $key => $value) { |
|
93 | + if (is_int($key)) { |
|
94 | 94 | $hook_item = $value; |
95 | 95 | $priority = self::DEFAULT_PRIORITY; |
96 | 96 | } |
97 | - else{ |
|
97 | + else { |
|
98 | 98 | $hook_item = explode('#', $key, 2); |
99 | 99 | $priority = $value; |
100 | 100 | } |
101 | - if($hook_item && count($hook_item) == 2){ |
|
101 | + if ($hook_item && count($hook_item) == 2) { |
|
102 | 102 | $hook_func = $hook_item[0]; |
103 | 103 | $hook_cont = $hook_item[1]; |
104 | 104 | } |
105 | - else{ |
|
105 | + else { |
|
106 | 106 | $hook_func = $hook_item[0]; |
107 | 107 | $hook_cont = 'all'; |
108 | 108 | } |
109 | - if(method_exists($module, $hook_func)){ |
|
110 | - $hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont]=$priority; |
|
109 | + if (method_exists($module, $hook_func)) { |
|
110 | + $hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont] = $priority; |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | } |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * {@inheritDoc} |
122 | 122 | * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getRawInstalledHooks() |
123 | 123 | */ |
124 | - public function getRawInstalledHooks(){ |
|
125 | - if(self::isModuleOperational()){ |
|
124 | + public function getRawInstalledHooks() { |
|
125 | + if (self::isModuleOperational()) { |
|
126 | 126 | return Database::prepare( |
127 | 127 | "SELECT majh_id AS id, majh_module_name AS module, majh_hook_function AS hook, majh_hook_context as context, majh_module_priority AS priority, majh_status AS status". |
128 | 128 | " FROM `##maj_hooks`". |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | * {@inheritDoc} |
137 | 137 | * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getInstalledHooks() |
138 | 138 | */ |
139 | - public function getInstalledHooks(){ |
|
140 | - static $installedhooks =null; |
|
141 | - if($installedhooks===null){ |
|
142 | - $dbhooks=self::getRawInstalledHooks(); |
|
143 | - foreach($dbhooks as $dbhook){ |
|
139 | + public function getInstalledHooks() { |
|
140 | + static $installedhooks = null; |
|
141 | + if ($installedhooks === null) { |
|
142 | + $dbhooks = self::getRawInstalledHooks(); |
|
143 | + foreach ($dbhooks as $dbhook) { |
|
144 | 144 | $installedhooks[($dbhook->module).'#'.($dbhook->hook).'#'.($dbhook->context)] = array('id' => $dbhook->id, 'status' => $dbhook->status, 'priority' => $dbhook->priority); |
145 | 145 | } |
146 | 146 | } |
@@ -153,15 +153,15 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function updateHooks() { |
155 | 155 | |
156 | - if(Auth::isAdmin()){ |
|
156 | + if (Auth::isAdmin()) { |
|
157 | 157 | $ihooks = self::getInstalledHooks(); |
158 | 158 | $phooks = self::getPossibleHooks(); |
159 | 159 | |
160 | 160 | // Insert hooks not existing yet in the DB |
161 | - if($phooks !== null){ |
|
162 | - foreach($phooks as $phook => $priority){ |
|
161 | + if ($phooks !== null) { |
|
162 | + foreach ($phooks as $phook => $priority) { |
|
163 | 163 | $array_hook = explode('#', $phook); |
164 | - if($ihooks === null || !array_key_exists($phook, $ihooks)){ |
|
164 | + if ($ihooks === null || !array_key_exists($phook, $ihooks)) { |
|
165 | 165 | $chook = new Hook($array_hook[1], $array_hook[2]); |
166 | 166 | $chook->subscribe($array_hook[0]); |
167 | 167 | $chook->setPriority($array_hook[0], $priority); |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | //Remove hooks not existing any more in the file system |
173 | - if($ihooks !== null){ |
|
174 | - foreach(array_keys($ihooks) as $ihook){ |
|
173 | + if ($ihooks !== null) { |
|
174 | + foreach (array_keys($ihooks) as $ihook) { |
|
175 | 175 | $array_hook = explode('#', $ihook); |
176 | - if($phooks === null || !array_key_exists($ihook, $phooks)){ |
|
176 | + if ($phooks === null || !array_key_exists($ihook, $phooks)) { |
|
177 | 177 | $chook = new Hook($array_hook[1], $array_hook[2]); |
178 | 178 | $chook->remove($array_hook[0]); |
179 | 179 | } |