@@ -114,7 +114,7 @@ |
||
114 | 114 | * |
115 | 115 | * @param string $value Value name |
116 | 116 | * @param AbstractModule $mod Calling module |
117 | - * @return bool True is cached |
|
117 | + * @return boolean|null True is cached |
|
118 | 118 | */ |
119 | 119 | public static function isCached($value, AbstractModule $mod = null) { |
120 | 120 | self::getInstance()->isCachedI($value, $mod); |
@@ -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 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | /** |
53 | 53 | * Find the spouse of a person, using the Xref comparison. |
54 | 54 | * |
55 | - * @param Individual $person |
|
55 | + * @param fw\Individual $person |
|
56 | 56 | * |
57 | 57 | * @return Individual|null |
58 | 58 | */ |
@@ -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 | } |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @param integer $num Numerator |
53 | 53 | * @param integer $denom Denominator |
54 | - * @param float $default Default value if denominator null or 0 |
|
55 | - * @return float Result of the safe division |
|
54 | + * @param integer $default Default value if denominator null or 0 |
|
55 | + * @return integer Result of the safe division |
|
56 | 56 | */ |
57 | 57 | public static function safeDivision($num, $denom, $default = 0) { |
58 | 58 | if($denom && $denom!=0){ |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @param int $num Numerator |
68 | 68 | * @param int $denom Denominator |
69 | - * @param float $default Default value if denominator null or 0 |
|
70 | - * @return float Percentage |
|
69 | + * @param integer $default Default value if denominator null or 0 |
|
70 | + * @return integer Percentage |
|
71 | 71 | */ |
72 | 72 | public static function getPercentage($num, $denom, $default = 0){ |
73 | 73 | return 100 * self::safeDivision($num, $denom, $default); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @param string $file The image to resize |
80 | 80 | * @param int $target The final max width/height |
81 | - * @return array array of ($width, $height). One of them must be $target |
|
81 | + * @return integer[] array of ($width, $height). One of them must be $target |
|
82 | 82 | */ |
83 | 83 | static public function getResizedImageSize($file, $target=25){ |
84 | 84 | list($width, $height, $type, $attr) = getimagesize($file); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * Returns the generation associated with a Sosa number |
234 | 234 | * |
235 | 235 | * @param int $sosa Sosa number |
236 | - * @return number |
|
236 | + * @return integer |
|
237 | 237 | */ |
238 | 238 | public static function getGeneration($sosa){ |
239 | 239 | return(int)log($sosa, 2)+1; |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * Returns whether the image type is supported by the system, and if so, return the standardised type |
247 | 247 | * |
248 | 248 | * @param string $reqtype Extension to test |
249 | - * @return boolean|string Is supported? |
|
249 | + * @return false|string Is supported? |
|
250 | 250 | */ |
251 | 251 | public static function isImageTypeSupported($reqtype) { |
252 | 252 | $supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png'); |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @param string $text Text to display |
42 | 42 | */ |
43 | - static public function promptAlert($text){ |
|
43 | + static public function promptAlert($text) { |
|
44 | 44 | echo '<script>'; |
45 | - echo 'alert("',fw\Filter::escapeHtml($text),'")'; |
|
45 | + echo 'alert("', fw\Filter::escapeHtml($text), '")'; |
|
46 | 46 | echo '</script>'; |
47 | 47 | } |
48 | 48 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @return float Result of the safe division |
56 | 56 | */ |
57 | 57 | public static function safeDivision($num, $denom, $default = 0) { |
58 | - if($denom && $denom!=0){ |
|
58 | + if ($denom && $denom != 0) { |
|
59 | 59 | return $num / $denom; |
60 | 60 | } |
61 | 61 | return $default; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param float $default Default value if denominator null or 0 |
70 | 70 | * @return float Percentage |
71 | 71 | */ |
72 | - public static function getPercentage($num, $denom, $default = 0){ |
|
72 | + public static function getPercentage($num, $denom, $default = 0) { |
|
73 | 73 | return 100 * self::safeDivision($num, $denom, $default); |
74 | 74 | } |
75 | 75 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @param int $target The final max width/height |
81 | 81 | * @return array array of ($width, $height). One of them must be $target |
82 | 82 | */ |
83 | - static public function getResizedImageSize($file, $target=25){ |
|
83 | + static public function getResizedImageSize($file, $target = 25) { |
|
84 | 84 | list($width, $height, $type, $attr) = getimagesize($file); |
85 | 85 | $max = max($width, $height); |
86 | 86 | $rapp = $target / $max; |
@@ -111,21 +111,21 @@ discard block |
||
111 | 111 | * @param int $length Length of the token, default to 32 |
112 | 112 | * @return string Random token |
113 | 113 | */ |
114 | - public static function generateRandomToken($length=32) { |
|
114 | + public static function generateRandomToken($length = 32) { |
|
115 | 115 | $chars = str_split('abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'); |
116 | 116 | $len_chars = count($chars); |
117 | 117 | $token = ''; |
118 | 118 | |
119 | 119 | for ($i = 0; $i < $length; $i++) |
120 | - $token .= $chars[ mt_rand(0, $len_chars - 1) ]; |
|
120 | + $token .= $chars[mt_rand(0, $len_chars - 1)]; |
|
121 | 121 | |
122 | 122 | # Number of 32 char chunks |
123 | - $chunks = ceil( strlen($token) / 32 ); |
|
123 | + $chunks = ceil(strlen($token) / 32); |
|
124 | 124 | $md5token = ''; |
125 | 125 | |
126 | 126 | # Run each chunk through md5 |
127 | - for ( $i=1; $i<=$chunks; $i++ ) |
|
128 | - $md5token .= md5( substr($token, $i * 32 - 32, 32) ); |
|
127 | + for ($i = 1; $i <= $chunks; $i++) |
|
128 | + $md5token .= md5(substr($token, $i * 32 - 32, 32)); |
|
129 | 129 | |
130 | 130 | # Trim the token |
131 | 131 | return substr($md5token, 0, $length); |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | * @param string $data Text to encrypt |
139 | 139 | * @return string Encrypted and encoded text |
140 | 140 | */ |
141 | - public static function encryptToSafeBase64($data){ |
|
141 | + public static function encryptToSafeBase64($data) { |
|
142 | 142 | $key = 'STANDARDKEYIFNOSERVER'; |
143 | - if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE']) |
|
143 | + if ($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE']) |
|
144 | 144 | $key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']); |
145 | 145 | $iv = mcrypt_create_iv(self::ENCRYPTION_IV_SIZE, MCRYPT_RAND); |
146 | - $id = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC,$iv); |
|
146 | + $id = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC, $iv); |
|
147 | 147 | $encrypted = base64_encode($iv.$id); |
148 | 148 | // +, / and = are not URL-compatible |
149 | 149 | $encrypted = str_replace('+', '-', $encrypted); |
@@ -158,22 +158,22 @@ discard block |
||
158 | 158 | * @param string $encrypted Text to decrypt |
159 | 159 | * @return string Decrypted text |
160 | 160 | */ |
161 | - public static function decryptFromSafeBase64($encrypted){ |
|
161 | + public static function decryptFromSafeBase64($encrypted) { |
|
162 | 162 | $key = 'STANDARDKEYIFNOSERVER'; |
163 | - if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE']) |
|
163 | + if ($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE']) |
|
164 | 164 | $key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']); |
165 | 165 | $encrypted = str_replace('-', '+', $encrypted); |
166 | 166 | $encrypted = str_replace('_', '/', $encrypted); |
167 | 167 | $encrypted = str_replace('*', '=', $encrypted); |
168 | 168 | $encrypted = base64_decode($encrypted); |
169 | - if(!$encrypted) |
|
169 | + if (!$encrypted) |
|
170 | 170 | throw new InvalidArgumentException('The encrypted value is not in correct base64 format.'); |
171 | - if(strlen($encrypted) < self::ENCRYPTION_IV_SIZE) |
|
171 | + if (strlen($encrypted) < self::ENCRYPTION_IV_SIZE) |
|
172 | 172 | throw new InvalidArgumentException('The encrypted value does not contain enough characters for the key.'); |
173 | 173 | $iv_dec = substr($encrypted, 0, self::ENCRYPTION_IV_SIZE); |
174 | 174 | $encrypted = substr($encrypted, self::ENCRYPTION_IV_SIZE); |
175 | 175 | $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $encrypted, MCRYPT_MODE_CBC, $iv_dec); |
176 | - return preg_replace('~(?:\\000+)$~','',$decrypted); |
|
176 | + return preg_replace('~(?:\\000+)$~', '', $decrypted); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -182,9 +182,9 @@ discard block |
||
182 | 182 | * @param string $string Filesystem encoded string to encode |
183 | 183 | * @return string UTF-8 encoded string |
184 | 184 | */ |
185 | - public static function encodeFileSystemToUtf8($string){ |
|
185 | + public static function encodeFileSystemToUtf8($string) { |
|
186 | 186 | if (strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') { |
187 | - return iconv('cp1252', 'utf-8//IGNORE',$string); |
|
187 | + return iconv('cp1252', 'utf-8//IGNORE', $string); |
|
188 | 188 | } |
189 | 189 | return $string; |
190 | 190 | } |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | * @param string $string UTF-8 encoded string to encode |
196 | 196 | * @return string Filesystem encoded string |
197 | 197 | */ |
198 | - public static function encodeUtf8ToFileSystem($string){ |
|
198 | + public static function encodeUtf8ToFileSystem($string) { |
|
199 | 199 | if (preg_match('//u', $string) && strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') { |
200 | - return iconv('utf-8', 'cp1252//IGNORE' , $string); |
|
200 | + return iconv('utf-8', 'cp1252//IGNORE', $string); |
|
201 | 201 | } |
202 | 202 | return $string; |
203 | 203 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @return boolean True if path valid |
211 | 211 | */ |
212 | 212 | public static function isValidPath($filename, $acceptfolder = FALSE) { |
213 | - if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true; |
|
213 | + if (strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true; |
|
214 | 214 | return false; |
215 | 215 | } |
216 | 216 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @return array Array of month short names |
223 | 223 | */ |
224 | 224 | public static function getCalendarShortMonths($calendarId = 0) { |
225 | - if(!isset(self::$calendarShortMonths[$calendarId])) { |
|
225 | + if (!isset(self::$calendarShortMonths[$calendarId])) { |
|
226 | 226 | $calendar_info = cal_info($calendarId); |
227 | 227 | self::$calendarShortMonths[$calendarId] = $calendar_info['abbrevmonths']; |
228 | 228 | } |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | * @param int $sosa Sosa number |
236 | 236 | * @return number |
237 | 237 | */ |
238 | - public static function getGeneration($sosa){ |
|
239 | - return(int)log($sosa, 2)+1; |
|
238 | + public static function getGeneration($sosa) { |
|
239 | + return(int)log($sosa, 2) + 1; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @param \Fisharebest\Webtrees\Place $place |
76 | 76 | * @param string $icon_path |
77 | - * @param number $size |
|
77 | + * @param integer $size |
|
78 | 78 | * @return string HTML code of the inserted flag |
79 | 79 | */ |
80 | 80 | public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path , $size = 50) { |
@@ -184,7 +184,6 @@ discard block |
||
184 | 184 | /** |
185 | 185 | * Format date to display short (just years) |
186 | 186 | * |
187 | - * @param \Fisharebest\Webtrees\Fact $eventObj Fact to display date |
|
188 | 187 | * @param boolean $anchor option to print a link to calendar |
189 | 188 | * @return string HTML code for short date |
190 | 189 | */ |
@@ -212,7 +211,6 @@ discard block |
||
212 | 211 | /** |
213 | 212 | * Format fact place to display short |
214 | 213 | * |
215 | - * @param \Fisharebest\Webtrees\Fact $eventObj Fact to display date |
|
216 | 214 | * @param string $format Format of the place |
217 | 215 | * @param boolean $anchor option to print a link to placelist |
218 | 216 | * @return string HTML code for short place |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @return string List of elements |
33 | 33 | */ |
34 | 34 | static public 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 | |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | \Fisharebest\Webtrees\Fact $fact, |
60 | 60 | \MyArtJaub\Webtrees\Map\MapProviderInterface $mapProvider |
61 | 61 | ) { |
62 | - $html=''; |
|
63 | - if($place = $fact->getPlace()) { |
|
64 | - $iconPlace= $mapProvider->getPlaceIcon($place); |
|
65 | - if($iconPlace && strlen($iconPlace) > 0){ |
|
66 | - $html.= '<div class="fact_flag">'. self::htmlPlaceIcon($place, $iconPlace, 50). '</div>'; |
|
62 | + $html = ''; |
|
63 | + if ($place = $fact->getPlace()) { |
|
64 | + $iconPlace = $mapProvider->getPlaceIcon($place); |
|
65 | + if ($iconPlace && strlen($iconPlace) > 0) { |
|
66 | + $html .= '<div class="fact_flag">'.self::htmlPlaceIcon($place, $iconPlace, 50).'</div>'; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | return $html; |
@@ -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 $item => $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,22 +188,22 @@ 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) { |
|
191 | + public static function formatFactDateShort(\Fisharebest\Webtrees\Fact $fact, $anchor = false) { |
|
192 | 192 | global $SEARCH_SPIDER; |
193 | 193 | |
194 | - $html=''; |
|
194 | + $html = ''; |
|
195 | 195 | $date = $fact->getDate(); |
196 | - if($date->isOK()){ |
|
197 | - $html.=' '.$date->Display($anchor && !$SEARCH_SPIDER, '%Y'); |
|
196 | + if ($date->isOK()) { |
|
197 | + $html .= ' '.$date->Display($anchor && !$SEARCH_SPIDER, '%Y'); |
|
198 | 198 | } |
199 | - else{ |
|
199 | + else { |
|
200 | 200 | // 1 DEAT Y with no DATE => print YES |
201 | 201 | // 1 BIRT 2 SOUR @S1@ => print YES |
202 | 202 | // 1 DEAT N is not allowed |
203 | 203 | // It is not proper GEDCOM form to use a N(o) value with an event tag to infer that it did not happen. |
204 | 204 | $factdetail = explode(' ', trim($fact->getGedcom())); |
205 | 205 | if (isset($factdetail) && (count($factdetail) == 3 && strtoupper($factdetail[2]) == 'Y') || (count($factdetail) == 4 && $factdetail[2] == 'SOUR')) { |
206 | - $html.=I18N::translate('yes'); |
|
206 | + $html .= I18N::translate('yes'); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | return $html; |
@@ -217,12 +217,12 @@ discard block |
||
217 | 217 | * @param boolean $anchor option to print a link to placelist |
218 | 218 | * @return string HTML code for short place |
219 | 219 | */ |
220 | - public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){ |
|
221 | - $html=''; |
|
220 | + public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor = false) { |
|
221 | + $html = ''; |
|
222 | 222 | |
223 | 223 | if ($fact === null) return $html; |
224 | 224 | $place = $fact->getPlace(); |
225 | - if($place){ |
|
225 | + if ($place) { |
|
226 | 226 | $dplace = new Place($place); |
227 | 227 | $html .= $dplace->htmlFormattedName($format, $anchor); |
228 | 228 | } |
@@ -240,21 +240,21 @@ discard block |
||
240 | 240 | * @param string $size CSS size for the icon. A CSS style css_$size is required |
241 | 241 | * @return string HTML code for the formatted Sosa numbers |
242 | 242 | */ |
243 | - public static function formatSosaNumbers(array $sosatab, $format = 1, $size = 'small'){ |
|
243 | + public static function formatSosaNumbers(array $sosatab, $format = 1, $size = 'small') { |
|
244 | 244 | $html = ''; |
245 | - switch($format){ |
|
245 | + switch ($format) { |
|
246 | 246 | case 1: |
247 | - if(count($sosatab)>0){ |
|
247 | + if (count($sosatab) > 0) { |
|
248 | 248 | $html = '<i class="icon-maj-sosa_'.$size.'" title="'.I18N::translate('Sosa').'"></i>'; |
249 | 249 | } |
250 | 250 | break; |
251 | 251 | case 2: |
252 | - if(count($sosatab)>0){ |
|
252 | + if (count($sosatab) > 0) { |
|
253 | 253 | ksort($sosatab); |
254 | 254 | $tmp_html = array(); |
255 | 255 | foreach ($sosatab as $sosa => $gen) { |
256 | 256 | $tmp_html[] = sprintf( |
257 | - '<i class="icon-maj-sosa_%1$s" title="'.I18N::translate('Sosa').'"></i> <strong>%2$d '.I18N::translate('(G%s)', $gen) .'</strong>', |
|
257 | + '<i class="icon-maj-sosa_%1$s" title="'.I18N::translate('Sosa').'"></i> <strong>%2$d '.I18N::translate('(G%s)', $gen).'</strong>', |
|
258 | 258 | $size, |
259 | 259 | $sosa |
260 | 260 | ); |
@@ -280,15 +280,15 @@ discard block |
||
280 | 280 | * @param string $size CSS size for the icon. A CSS style css_$size is required |
281 | 281 | * @return string HTML code for IsSourced icon |
282 | 282 | */ |
283 | - public static function formatIsSourcedIcon($sourceType, $isSourced, $tag='EVEN', $format = 1, $size='normal'){ |
|
284 | - $html=''; |
|
285 | - $image=null; |
|
286 | - $title=null; |
|
287 | - switch($format){ |
|
283 | + public static function formatIsSourcedIcon($sourceType, $isSourced, $tag = 'EVEN', $format = 1, $size = 'normal') { |
|
284 | + $html = ''; |
|
285 | + $image = null; |
|
286 | + $title = null; |
|
287 | + switch ($format) { |
|
288 | 288 | case 1: |
289 | - switch($sourceType){ |
|
289 | + switch ($sourceType) { |
|
290 | 290 | case 'E': |
291 | - switch($isSourced){ |
|
291 | + switch ($isSourced) { |
|
292 | 292 | case 0: |
293 | 293 | $image = 'event_unknown'; |
294 | 294 | $title = I18N::translate('%s not found', GedcomTag::getLabel($tag)); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | } |
319 | 319 | break; |
320 | 320 | case 'R': |
321 | - switch($isSourced){ |
|
321 | + switch ($isSourced) { |
|
322 | 322 | case -1: |
323 | 323 | $image = 'record_notsourced'; |
324 | 324 | $title = I18N::translate('%s not sourced', GedcomTag::getLabel($tag)); |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | default: |
340 | 340 | break; |
341 | 341 | } |
342 | - if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
342 | + if ($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
343 | 343 | break; |
344 | 344 | default: |
345 | 345 | break; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * Returns an estimated birth place based on statistics on the base |
94 | 94 | * |
95 | 95 | * @param boolean $perc Should the coefficient of reliability be returned |
96 | - * @return string|array Estimated birth place if found, null otherwise |
|
96 | + * @return string Estimated birth place if found, null otherwise |
|
97 | 97 | */ |
98 | 98 | public function getEstimatedBirthPlace($perc=false){ |
99 | 99 | if($bplace = $this->gedcomrecord->getBirthPlace()){ |
@@ -110,7 +110,6 @@ discard block |
||
110 | 110 | /** |
111 | 111 | * Returns a significant place for the individual |
112 | 112 | * |
113 | - * @param boolean $perc Should the coefficient of reliability be returned |
|
114 | 113 | * @return string|array Estimated birth place if found, null otherwise |
115 | 114 | */ |
116 | 115 | public function getSignificantPlace(){ |
@@ -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 | } |
@@ -110,7 +110,7 @@ |
||
110 | 110 | * Set parameters of the Task |
111 | 111 | * |
112 | 112 | * @param bool $is_enabled Status of the task |
113 | - * @param \DateTime $lastupdated Time of the last task run |
|
113 | + * @param \DateTime $last_updated Time of the last task run |
|
114 | 114 | * @param bool $last_result Result of the last run, true for success, false for failure |
115 | 115 | * @param int $frequency Frequency of execution in minutes |
116 | 116 | * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @param string $file Filename containing the task object |
82 | 82 | * @param TaskProviderInterface $provider Provider for tasks |
83 | 83 | */ |
84 | - public function __construct($file, TaskProviderInterface $provider = null){ |
|
84 | + public function __construct($file, TaskProviderInterface $provider = null) { |
|
85 | 85 | $this->name = trim(basename($file, '.php')); |
86 | 86 | $this->provider = $provider; |
87 | 87 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return TaskProviderInterface |
93 | 93 | */ |
94 | - public function getProvider(){ |
|
94 | + public function getProvider() { |
|
95 | 95 | return $this->provider; |
96 | 96 | } |
97 | 97 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @param TaskProviderInterface $provider |
102 | 102 | * @return self Enable method-chaining |
103 | 103 | */ |
104 | - public function setProvider(TaskProviderInterface $provider){ |
|
104 | + public function setProvider(TaskProviderInterface $provider) { |
|
105 | 105 | $this->provider = $provider; |
106 | 106 | return $this; |
107 | 107 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited |
117 | 117 | * @param bool $is_running Indicates if the task is currently running |
118 | 118 | */ |
119 | - public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){ |
|
119 | + public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running) { |
|
120 | 120 | $this->is_enabled = $is_enabled; |
121 | 121 | $this->last_updated = $last_updated; |
122 | 122 | $this->last_result = $last_result; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * |
131 | 131 | * @return string |
132 | 132 | */ |
133 | - public function getName(){ |
|
133 | + public function getName() { |
|
134 | 134 | return $this->name; |
135 | 135 | } |
136 | 136 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return boolean True if enabled |
142 | 142 | */ |
143 | - public function isEnabled(){ |
|
143 | + public function isEnabled() { |
|
144 | 144 | return $this->is_enabled; |
145 | 145 | } |
146 | 146 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * |
150 | 150 | * @return \DateTime |
151 | 151 | */ |
152 | - public function getLastUpdated(){ |
|
152 | + public function getLastUpdated() { |
|
153 | 153 | return $this->last_updated; |
154 | 154 | } |
155 | 155 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @return bool |
160 | 160 | */ |
161 | - public function isLastRunSuccess(){ |
|
161 | + public function isLastRunSuccess() { |
|
162 | 162 | return $this->last_result; |
163 | 163 | } |
164 | 164 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @return int |
169 | 169 | */ |
170 | - public function getFrequency(){ |
|
170 | + public function getFrequency() { |
|
171 | 171 | return $this->frequency; |
172 | 172 | } |
173 | 173 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * @param int $frequency |
178 | 178 | * @return self Enable method-chaining |
179 | 179 | */ |
180 | - public function setFrequency($frequency){ |
|
180 | + public function setFrequency($frequency) { |
|
181 | 181 | $this->frequency = $frequency; |
182 | 182 | return $this; |
183 | 183 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @return int |
189 | 189 | */ |
190 | - public function getRemainingOccurrences(){ |
|
190 | + public function getRemainingOccurrences() { |
|
191 | 191 | return $this->nb_occurrences; |
192 | 192 | } |
193 | 193 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @param int $nb_occur |
198 | 198 | * @return self Enable method-chaining |
199 | 199 | */ |
200 | - public function setRemainingOccurrences($nb_occur){ |
|
200 | + public function setRemainingOccurrences($nb_occur) { |
|
201 | 201 | $this->nb_occurrences = $nb_occur; |
202 | 202 | return $this; |
203 | 203 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return bool |
209 | 209 | */ |
210 | - public function isRunning(){ |
|
210 | + public function isRunning() { |
|
211 | 211 | return $this->is_running; |
212 | 212 | } |
213 | 213 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * @return bool |
237 | 237 | */ |
238 | 238 | public function save() { |
239 | - if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.'); |
|
239 | + if (!$this->provider) throw new \Exception('The task has not been initialised with a provider.'); |
|
240 | 240 | return $this->provider->updateTask($this); |
241 | 241 | } |
242 | 242 | |
@@ -244,12 +244,12 @@ discard block |
||
244 | 244 | * Execute the task, default skeleton |
245 | 245 | * |
246 | 246 | */ |
247 | - public function execute(){ |
|
247 | + public function execute() { |
|
248 | 248 | |
249 | - if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) |
|
249 | + if ($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) |
|
250 | 250 | $this->is_running = false; |
251 | 251 | |
252 | - if(!$this->is_running){ //TODO put in place a time_out for running... |
|
252 | + if (!$this->is_running) { //TODO put in place a time_out for running... |
|
253 | 253 | //TODO Log the executions in the logs |
254 | 254 | $this->last_result = false; |
255 | 255 | $this->is_running = true; |
@@ -257,11 +257,11 @@ discard block |
||
257 | 257 | |
258 | 258 | Log::addDebugLog('Start execution of Admin task: '.$this->getTitle()); |
259 | 259 | $this->last_result = $this->executeSteps(); |
260 | - if($this->last_result){ |
|
260 | + if ($this->last_result) { |
|
261 | 261 | $this->last_updated = new \DateTime(); |
262 | - if($this->nb_occurrences > 0){ |
|
262 | + if ($this->nb_occurrences > 0) { |
|
263 | 263 | $this->nb_occurrences--; |
264 | - if($this->nb_occurrences == 0) $this->is_enabled = false; |
|
264 | + if ($this->nb_occurrences == 0) $this->is_enabled = false; |
|
265 | 265 | } |
266 | 266 | } |
267 | 267 | $this->is_running = false; |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | * Set the status of a specific admin task. |
33 | 33 | * The status can be enabled (true), or disabled (false). |
34 | 34 | * |
35 | - * @param AbstractTask $ga |
|
36 | 35 | * @param bool $status |
36 | + * @return void |
|
37 | 37 | */ |
38 | 38 | public function setTaskStatus(AbstractTask $task, $status); |
39 | 39 | |
@@ -49,6 +49,7 @@ discard block |
||
49 | 49 | * Delete the task from the database, in a transactional manner. |
50 | 50 | * |
51 | 51 | * @param string $task_name Task to delete |
52 | + * @return boolean |
|
52 | 53 | */ |
53 | 54 | public function deleteTask($task_name); |
54 | 55 | |
@@ -75,7 +76,7 @@ discard block |
||
75 | 76 | * Returns the list of tasks that are currently meant to run. |
76 | 77 | * Tasks to run can be forced, or can be limited to only one. |
77 | 78 | * |
78 | - * @param string|null $force Force the enabled tasks to run. |
|
79 | + * @param boolean $force Force the enabled tasks to run. |
|
79 | 80 | * @param string|null $task_name Name of the specific task to run |
80 | 81 | */ |
81 | 82 | function getTasksToRun($force = false, $task_name = null); |
@@ -109,6 +109,7 @@ discard block |
||
109 | 109 | /** |
110 | 110 | * {@inhericDoc} |
111 | 111 | * @see \Fisharebest\Webtrees\GedcomRecord::getInstance() |
112 | + * @param string $xref |
|
112 | 113 | */ |
113 | 114 | static public function getInstance($xref, Tree $tree, $gedcom = null, CertificateProviderInterface $provider = null) { |
114 | 115 | try{ |
@@ -150,7 +151,7 @@ discard block |
||
150 | 151 | /** |
151 | 152 | * Define a source associated with the certificate |
152 | 153 | * |
153 | - * @param string|Source $xref |
|
154 | + * @param string|null $xref |
|
154 | 155 | */ |
155 | 156 | public function setSource($xref){ |
156 | 157 | if($xref instanceof Source){ |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | class Certificate extends Media { |
37 | 37 | |
38 | - const URL_PREFIX = 'module.php?mod=myartjaub_certificates&mod_action=Certificate&cid='; |
|
38 | + const URL_PREFIX = 'module.php?mod=myartjaub_certificates&mod_action=Certificate&cid='; |
|
39 | 39 | |
40 | 40 | /** @var string The "TITL" value from the GEDCOM |
41 | 41 | * This is a tweak to overcome the private level from the parent object... |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | $this->title = basename($this->getFilename(), '.'.$this->extension()); |
95 | 95 | |
96 | 96 | $ct = preg_match("/(?<year>\d{1,4})(\.(?<month>\d{1,2}))?(\.(?<day>\d{1,2}))?( (?<type>[A-Z]{1,2}) )?(?<details>.*)/", $this->title, $match); |
97 | - if($ct > 0){ |
|
98 | - $monthId = (int) $match['month']; |
|
97 | + if ($ct > 0) { |
|
98 | + $monthId = (int)$match['month']; |
|
99 | 99 | $calendarShortMonths = Functions::getCalendarShortMonths(); |
100 | 100 | $monthShortName = array_key_exists($monthId, $calendarShortMonths) ? $calendarShortMonths[$monthId] : $monthId; |
101 | 101 | $this->certDate = new Date($match['day'].' '.strtoupper($monthShortName).' '.$match['year']); |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | * @see \Fisharebest\Webtrees\GedcomRecord::getInstance() |
112 | 112 | */ |
113 | 113 | static public function getInstance($xref, Tree $tree, $gedcom = null, CertificateProviderInterface $provider = null) { |
114 | - try{ |
|
114 | + try { |
|
115 | 115 | $certfile = Functions::decryptFromSafeBase64($xref); |
116 | 116 | |
117 | 117 | //NEED TO CHECK THAT !!! |
118 | - if(Functions::isValidPath($certfile, true)) { |
|
118 | + if (Functions::isValidPath($certfile, true)) { |
|
119 | 119 | return new Certificate($certfile, $tree, $provider); |
120 | 120 | } |
121 | 121 | } |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @param string|Source $xref |
154 | 154 | */ |
155 | - public function setSource($xref){ |
|
156 | - if($xref instanceof Source){ |
|
155 | + public function setSource($xref) { |
|
156 | + if ($xref instanceof Source) { |
|
157 | 157 | $this->source = $data; |
158 | 158 | } else { |
159 | 159 | $this->source = Source::getInstance($xref, $this->tree); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @return Date Certificate date |
175 | 175 | */ |
176 | - public function getCertificateDate(){ |
|
176 | + public function getCertificateDate() { |
|
177 | 177 | return $this->certDate; |
178 | 178 | } |
179 | 179 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @return string Certificate date |
184 | 184 | */ |
185 | - public function getCertificateType(){ |
|
185 | + public function getCertificateType() { |
|
186 | 186 | return $this->certType; |
187 | 187 | } |
188 | 188 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * |
192 | 192 | * @return string Certificate details |
193 | 193 | */ |
194 | - public function getCertificateDetails(){ |
|
194 | + public function getCertificateDetails() { |
|
195 | 195 | return $this->certDetails; |
196 | 196 | } |
197 | 197 | |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return string|NULL Certificate city |
202 | 202 | */ |
203 | - public function getCity(){ |
|
203 | + public function getCity() { |
|
204 | 204 | $chunks = explode('/', $this->getFilename(), 2); |
205 | - if(count($chunks) > 1) return $chunks[0]; |
|
205 | + if (count($chunks) > 1) return $chunks[0]; |
|
206 | 206 | return null; |
207 | 207 | } |
208 | 208 | |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | * {@inhericDoc} |
211 | 211 | * @see \Fisharebest\Webtrees\Media::getServerFilename() |
212 | 212 | */ |
213 | - public function getServerFilename($which='main') { |
|
214 | - $filename = $this->provider->getRealCertificatesDirectory() . $this->getFilename(); |
|
213 | + public function getServerFilename($which = 'main') { |
|
214 | + $filename = $this->provider->getRealCertificatesDirectory().$this->getFilename(); |
|
215 | 215 | return Functions::encodeUtf8ToFileSystem($filename); |
216 | 216 | } |
217 | 217 | |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | public function getHtmlUrlDirect($which = 'main', $download = false) { |
223 | 223 | $sidstr = ($this->source) ? '&sid='.$this->source->getXref() : ''; |
224 | 224 | return |
225 | - 'module.php?mod='. \MyArtJaub\Webtrees\Constants::MODULE_MAJ_CERTIF_NAME . |
|
226 | - '&mod_action=Certificate@image' . |
|
227 | - '&ged='. $this->tree->getNameUrl() . |
|
228 | - '&cid=' . $this->getXref() . $sidstr . |
|
229 | - '&cb=' . $this->getEtag($which); |
|
225 | + 'module.php?mod='.\MyArtJaub\Webtrees\Constants::MODULE_MAJ_CERTIF_NAME. |
|
226 | + '&mod_action=Certificate@image'. |
|
227 | + '&ged='.$this->tree->getNameUrl(). |
|
228 | + '&cid='.$this->getXref().$sidstr. |
|
229 | + '&cb='.$this->getEtag($which); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -237,26 +237,26 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return string Watermark text |
239 | 239 | */ |
240 | - public function getWatermarkText(){ |
|
240 | + public function getWatermarkText() { |
|
241 | 241 | $module = Module::getModuleByName(Constants::MODULE_MAJ_CERTIF_NAME); |
242 | 242 | |
243 | - if($module) { |
|
243 | + if ($module) { |
|
244 | 244 | $wmtext = $module->getSetting('MAJ_WM_DEFAULT', I18N::translate('This image is protected under copyright law.')); |
245 | - $sid= Filter::get('sid', WT_REGEX_XREF); |
|
245 | + $sid = Filter::get('sid', WT_REGEX_XREF); |
|
246 | 246 | |
247 | - if($sid){ |
|
247 | + if ($sid) { |
|
248 | 248 | $this->source = Source::getInstance($sid, $this->tree); |
249 | 249 | } |
250 | - else{ |
|
251 | - $this->fetchALinkedSource(); // the method already attach the source to the Certificate object; |
|
250 | + else { |
|
251 | + $this->fetchALinkedSource(); // the method already attach the source to the Certificate object; |
|
252 | 252 | } |
253 | 253 | |
254 | - if($this->source) { |
|
254 | + if ($this->source) { |
|
255 | 255 | $wmtext = '©'; |
256 | 256 | $repofact = $this->source->getFirstFact('REPO'); |
257 | - if($repofact) { |
|
257 | + if ($repofact) { |
|
258 | 258 | $repo = $repofact->getTarget(); |
259 | - if($repo && $repo instanceof Repository) $wmtext .= ' '.$repo->getFullName().' - '; |
|
259 | + if ($repo && $repo instanceof Repository) $wmtext .= ' '.$repo->getFullName().' - '; |
|
260 | 260 | } |
261 | 261 | $wmtext .= $this->source->getFullName(); |
262 | 262 | } |
@@ -279,45 +279,45 @@ discard block |
||
279 | 279 | '; |
280 | 280 | |
281 | 281 | $script = ''; |
282 | - if($controller && !($controller instanceof IndividualController)){ |
|
282 | + if ($controller && !($controller instanceof IndividualController)) { |
|
283 | 283 | $controller->addInlineJavascript('$(document).ready(function() { '.$js.' });'); |
284 | 284 | } else { |
285 | - $script = '<script>' . $js . '</script>'; |
|
285 | + $script = '<script>'.$js.'</script>'; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | if ($which == 'icon' || !file_exists($this->getServerFilename())) { |
289 | 289 | // Use an icon |
290 | 290 | $image = |
291 | - '<i dir="auto" class="icon-maj-certificate margin-h-2"' . |
|
292 | - ' title="' . strip_tags($this->getFullName()) . '"' . |
|
291 | + '<i dir="auto" class="icon-maj-certificate margin-h-2"'. |
|
292 | + ' title="'.strip_tags($this->getFullName()).'"'. |
|
293 | 293 | '></i>'; |
294 | 294 | } else { |
295 | 295 | $imgsize = getimagesize($this->getServerFilename()); |
296 | 296 | $image = |
297 | - '<img' . |
|
298 | - ' class ="'. 'certif_image' . '"' . |
|
299 | - ' dir="' . 'auto' . '"' . // For the tool-tip |
|
300 | - ' src="' . $this->getHtmlUrlDirect() . '"' . |
|
301 | - ' alt="' . strip_tags($this->getFullName()) . '"' . |
|
302 | - ' title="' . strip_tags($this->getFullName()) . '"' . |
|
303 | - $imgsize[3] . // height="yyy" width="xxx" |
|
297 | + '<img'. |
|
298 | + ' class ="'.'certif_image'.'"'. |
|
299 | + ' dir="'.'auto'.'"'.// For the tool-tip |
|
300 | + ' src="'.$this->getHtmlUrlDirect().'"'. |
|
301 | + ' alt="'.strip_tags($this->getFullName()).'"'. |
|
302 | + ' title="'.strip_tags($this->getFullName()).'"'. |
|
303 | + $imgsize[3].// height="yyy" width="xxx" |
|
304 | 304 | '>'; |
305 | 305 | } |
306 | 306 | return |
307 | - '<a' . |
|
308 | - ' class="' . 'certgallery' . '"' . |
|
309 | - ' href="' . $this->getHtmlUrlDirect() . '"' . |
|
310 | - ' type="' . $this->mimeType() . '"' . |
|
311 | - ' data-obje-url="' . $this->getHtmlUrl() . '"' . |
|
312 | - ' data-title="' . strip_tags($this->getFullName()) . '"' . |
|
313 | - '>' . $image . '</a>'.$script; |
|
307 | + '<a'. |
|
308 | + ' class="'.'certgallery'.'"'. |
|
309 | + ' href="'.$this->getHtmlUrlDirect().'"'. |
|
310 | + ' type="'.$this->mimeType().'"'. |
|
311 | + ' data-obje-url="'.$this->getHtmlUrl().'"'. |
|
312 | + ' data-title="'.strip_tags($this->getFullName()).'"'. |
|
313 | + '>'.$image.'</a>'.$script; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
317 | 317 | * {@inhericDoc} |
318 | 318 | * @see \Fisharebest\Webtrees\GedcomRecord::linkedIndividuals() |
319 | 319 | */ |
320 | - public function linkedIndividuals($link = '_ACT'){ |
|
320 | + public function linkedIndividuals($link = '_ACT') { |
|
321 | 321 | $rows = Database::prepare( |
322 | 322 | 'SELECT i_id AS xref, i_gedcom AS gedcom'. |
323 | 323 | ' FROM `##individuals`'. |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * {@inhericDoc} |
342 | 342 | * @see \Fisharebest\Webtrees\GedcomRecord::linkedFamilies() |
343 | 343 | */ |
344 | - public function linkedFamilies($link = '_ACT'){ |
|
344 | + public function linkedFamilies($link = '_ACT') { |
|
345 | 345 | $rows = Database::prepare( |
346 | 346 | 'SELECT f_id AS xref, f_gedcom AS gedcom'. |
347 | 347 | ' FROM `##families`'. |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | * |
367 | 367 | * @return Source|NULL Linked source |
368 | 368 | */ |
369 | - public function fetchALinkedSource(){ |
|
369 | + public function fetchALinkedSource() { |
|
370 | 370 | $sid = null; |
371 | 371 | |
372 | 372 | // Try to find in individual, then families, then other types of records. We are interested in the first available value. |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | 'gedcom_id' => $this->tree->getTreeId(), |
379 | 379 | 'gedcom' => '%_ACT '.$this->getFilename().'%' |
380 | 380 | ))->fetchOne(); |
381 | - if(!$ged){ |
|
381 | + if (!$ged) { |
|
382 | 382 | $ged = Database::prepare( |
383 | 383 | 'SELECT f_gedcom AS gedrec FROM `##families`'. |
384 | 384 | ' WHERE f_file=:gedcom_id AND f_gedcom LIKE :gedcom') |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | 'gedcom_id' => $this->tree->getTreeId(), |
387 | 387 | 'gedcom' => '%_ACT '.$this->getFilename().'%' |
388 | 388 | ))->fetchOne(); |
389 | - if(!$ged){ |
|
389 | + if (!$ged) { |
|
390 | 390 | $ged = Database::prepare( |
391 | 391 | 'SELECT o_gedcom AS gedrec FROM `##other`'. |
392 | 392 | ' WHERE o_file=:gedcom_id AND o_gedcom LIKE :gedcom') |
@@ -397,28 +397,28 @@ discard block |
||
397 | 397 | } |
398 | 398 | } |
399 | 399 | //If a record has been found, parse it to find the source reference. |
400 | - if($ged){ |
|
400 | + if ($ged) { |
|
401 | 401 | $gedlines = explode("\n", $ged); |
402 | 402 | $level = 0; |
403 | 403 | $levelsource = -1; |
404 | - $sid_tmp=null; |
|
404 | + $sid_tmp = null; |
|
405 | 405 | $sourcefound = false; |
406 | - foreach($gedlines as $gedline){ |
|
406 | + foreach ($gedlines as $gedline) { |
|
407 | 407 | // Get the level |
408 | 408 | if (!$sourcefound && preg_match('~^('.WT_REGEX_INTEGER.') ~', $gedline, $match)) { |
409 | 409 | $level = $match[1]; |
410 | 410 | //If we are not any more within the context of a source, reset |
411 | - if($level <= $levelsource){ |
|
411 | + if ($level <= $levelsource) { |
|
412 | 412 | $levelsource = -1; |
413 | 413 | $sid_tmp = null; |
414 | 414 | } |
415 | 415 | // If a source, get the level and the reference |
416 | 416 | if (preg_match('~^'.$level.' SOUR @('.WT_REGEX_XREF.')@$~', $gedline, $match2)) { |
417 | 417 | $levelsource = $level; |
418 | - $sid_tmp=$match2[1]; |
|
418 | + $sid_tmp = $match2[1]; |
|
419 | 419 | } |
420 | 420 | // If the image has be found, get the source reference and exit. |
421 | - if($levelsource>=0 && $sid_tmp && preg_match('~^'.$level.' _ACT '.preg_quote($this->getFilename()).'~', $gedline, $match3)){ |
|
421 | + if ($levelsource >= 0 && $sid_tmp && preg_match('~^'.$level.' _ACT '.preg_quote($this->getFilename()).'~', $gedline, $match3)) { |
|
422 | 422 | $sid = $sid_tmp; |
423 | 423 | $sourcefound = true; |
424 | 424 | } |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | } |
427 | 427 | } |
428 | 428 | |
429 | - if($sid) $this->source = Source::getInstance($sid, $this->tree); |
|
429 | + if ($sid) $this->source = Source::getInstance($sid, $this->tree); |
|
430 | 430 | |
431 | 431 | return $this->source; |
432 | 432 | } |
@@ -252,7 +252,7 @@ |
||
252 | 252 | /** |
253 | 253 | * Return the HTML code for custom simple tag _ACT |
254 | 254 | * |
255 | - * @param Certificate $certificatePath Certificate (as per the GEDCOM) |
|
255 | + * @param Certificate $certificate Certificate (as per the GEDCOM) |
|
256 | 256 | * @param string|null $sid Linked Source ID, if it exists |
257 | 257 | */ |
258 | 258 | protected function getDisplay_ACT(Certificate $certificate, $sid = null){ |
@@ -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 | } |