@@ -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); |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class Cache{ |
18 | 18 | |
19 | - /** |
|
20 | - * Underlying Zend Cache object |
|
21 | - * @var \Zend_Cache_Core|\Zend_Cache_FrontEnd $cache |
|
22 | - */ |
|
19 | + /** |
|
20 | + * Underlying Zend Cache object |
|
21 | + * @var \Zend_Cache_Core|\Zend_Cache_FrontEnd $cache |
|
22 | + */ |
|
23 | 23 | protected $cache=null; |
24 | 24 | |
25 | 25 | /** |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | */ |
42 | 42 | protected static function getInstance() |
43 | 43 | { |
44 | - if (null === static::$instance) { |
|
45 | - static::$instance = new static(); |
|
46 | - } |
|
44 | + if (null === static::$instance) { |
|
45 | + static::$instance = new static(); |
|
46 | + } |
|
47 | 47 | |
48 | - return static::$instance; |
|
48 | + return static::$instance; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return string Cached key name |
92 | 92 | */ |
93 | 93 | protected function getKeyName($value, AbstractModule $mod = null){ |
94 | - $this->checkInit(); |
|
94 | + $this->checkInit(); |
|
95 | 95 | $mod_name = 'myartjaub'; |
96 | 96 | if($mod != null) $mod_name = $mod->getName(); |
97 | 97 | return $mod_name.'_'.$value; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @return bool True is cached |
118 | 118 | */ |
119 | 119 | public static function isCached($value, AbstractModule $mod = null) { |
120 | - self::getInstance()->isCachedI($value, $mod); |
|
120 | + self::getInstance()->isCachedI($value, $mod); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return unknown_type Cached value |
141 | 141 | */ |
142 | 142 | public static function get($value, AbstractModule $mod = null){ |
143 | - self::getInstance()->getI($value, $mod); |
|
143 | + self::getInstance()->getI($value, $mod); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @return unknown_type Cached value |
167 | 167 | */ |
168 | 168 | public static function save($value, $data, AbstractModule $mod = null){ |
169 | - self::getInstance()->saveI($value, $data, $mod); |
|
169 | + self::getInstance()->saveI($value, $data, $mod); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * |
175 | 175 | */ |
176 | 176 | public function cleanI(){ |
177 | - $this->checkInit(); |
|
177 | + $this->checkInit(); |
|
178 | 178 | $this->cache->clean(); |
179 | 179 | } |
180 | 180 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * Static invocation of the *clean* method. |
183 | 183 | */ |
184 | 184 | public static function clean() { |
185 | - self::getInstance()->cleanI(); |
|
185 | + self::getInstance()->cleanI(); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | } |
189 | 189 | \ No newline at end of file |
@@ -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 | } |
@@ -80,7 +80,9 @@ discard block |
||
80 | 80 | * |
81 | 81 | */ |
82 | 82 | protected function checkInit(){ |
83 | - if(!$this->is_init) $this->init(); |
|
83 | + if(!$this->is_init) { |
|
84 | + $this->init(); |
|
85 | + } |
|
84 | 86 | } |
85 | 87 | |
86 | 88 | /** |
@@ -93,7 +95,9 @@ discard block |
||
93 | 95 | protected function getKeyName($value, AbstractModule $mod = null){ |
94 | 96 | $this->checkInit(); |
95 | 97 | $mod_name = 'myartjaub'; |
96 | - if($mod != null) $mod_name = $mod->getName(); |
|
98 | + if($mod != null) { |
|
99 | + $mod_name = $mod->getName(); |
|
100 | + } |
|
97 | 101 | return $mod_name.'_'.$value; |
98 | 102 | } |
99 | 103 |
@@ -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 | */ |
@@ -39,10 +39,10 @@ |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | - * Check if this family's marriages are sourced |
|
43 | - * |
|
44 | - * @return int Level of sources |
|
45 | - * */ |
|
42 | + * Check if this family's marriages are sourced |
|
43 | + * |
|
44 | + * @return int Level of sources |
|
45 | + * */ |
|
46 | 46 | function isMarriageSourced(){ |
47 | 47 | if($this->_ismarriagesourced != null) return $this->_ismarriagesourced; |
48 | 48 | $this->_ismarriagesourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC'); |
@@ -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 | } |
@@ -44,7 +44,9 @@ |
||
44 | 44 | * @return int Level of sources |
45 | 45 | * */ |
46 | 46 | function isMarriageSourced(){ |
47 | - if($this->_ismarriagesourced != null) return $this->_ismarriagesourced; |
|
47 | + if($this->_ismarriagesourced != null) { |
|
48 | + return $this->_ismarriagesourced; |
|
49 | + } |
|
48 | 50 | $this->_ismarriagesourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC'); |
49 | 51 | return $this->_ismarriagesourced; |
50 | 52 | } |
@@ -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'); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 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 | } |
@@ -249,20 +249,20 @@ discard block |
||
249 | 249 | * @return boolean|string Is supported? |
250 | 250 | */ |
251 | 251 | public static function isImageTypeSupported($reqtype) { |
252 | - $supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png'); |
|
253 | - $reqtype = strtolower($reqtype); |
|
252 | + $supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png'); |
|
253 | + $reqtype = strtolower($reqtype); |
|
254 | 254 | |
255 | - if (empty($supportByGD[$reqtype])) { |
|
256 | - return false; |
|
257 | - } |
|
255 | + if (empty($supportByGD[$reqtype])) { |
|
256 | + return false; |
|
257 | + } |
|
258 | 258 | |
259 | - $type = $supportByGD[$reqtype]; |
|
259 | + $type = $supportByGD[$reqtype]; |
|
260 | 260 | |
261 | - if (function_exists('imagecreatefrom'.$type) && function_exists('image'.$type)) { |
|
262 | - return $type; |
|
263 | - } |
|
261 | + if (function_exists('imagecreatefrom'.$type) && function_exists('image'.$type)) { |
|
262 | + return $type; |
|
263 | + } |
|
264 | 264 | |
265 | - return false; |
|
265 | + return false; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | } |
@@ -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 |
@@ -116,16 +116,18 @@ discard block |
||
116 | 116 | $len_chars = count($chars); |
117 | 117 | $token = ''; |
118 | 118 | |
119 | - for ($i = 0; $i < $length; $i++) |
|
120 | - $token .= $chars[ mt_rand(0, $len_chars - 1) ]; |
|
119 | + for ($i = 0; $i < $length; $i++) { |
|
120 | + $token .= $chars[ mt_rand(0, $len_chars - 1) ]; |
|
121 | + } |
|
121 | 122 | |
122 | 123 | # Number of 32 char chunks |
123 | 124 | $chunks = ceil( strlen($token) / 32 ); |
124 | 125 | $md5token = ''; |
125 | 126 | |
126 | 127 | # Run each chunk through md5 |
127 | - for ( $i=1; $i<=$chunks; $i++ ) |
|
128 | - $md5token .= md5( substr($token, $i * 32 - 32, 32) ); |
|
128 | + for ( $i=1; $i<=$chunks; $i++ ) { |
|
129 | + $md5token .= md5( substr($token, $i * 32 - 32, 32) ); |
|
130 | + } |
|
129 | 131 | |
130 | 132 | # Trim the token |
131 | 133 | return substr($md5token, 0, $length); |
@@ -140,8 +142,9 @@ discard block |
||
140 | 142 | */ |
141 | 143 | public static function encryptToSafeBase64($data){ |
142 | 144 | $key = 'STANDARDKEYIFNOSERVER'; |
143 | - if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE']) |
|
144 | - $key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']); |
|
145 | + if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE']) { |
|
146 | + $key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']); |
|
147 | + } |
|
145 | 148 | $iv = mcrypt_create_iv(self::ENCRYPTION_IV_SIZE, MCRYPT_RAND); |
146 | 149 | $id = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC,$iv); |
147 | 150 | $encrypted = base64_encode($iv.$id); |
@@ -160,16 +163,19 @@ discard block |
||
160 | 163 | */ |
161 | 164 | public static function decryptFromSafeBase64($encrypted){ |
162 | 165 | $key = 'STANDARDKEYIFNOSERVER'; |
163 | - if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE']) |
|
164 | - $key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']); |
|
166 | + if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE']) { |
|
167 | + $key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']); |
|
168 | + } |
|
165 | 169 | $encrypted = str_replace('-', '+', $encrypted); |
166 | 170 | $encrypted = str_replace('_', '/', $encrypted); |
167 | 171 | $encrypted = str_replace('*', '=', $encrypted); |
168 | 172 | $encrypted = base64_decode($encrypted); |
169 | - if(!$encrypted) |
|
170 | - throw new InvalidArgumentException('The encrypted value is not in correct base64 format.'); |
|
171 | - if(strlen($encrypted) < self::ENCRYPTION_IV_SIZE) |
|
172 | - throw new InvalidArgumentException('The encrypted value does not contain enough characters for the key.'); |
|
173 | + if(!$encrypted) { |
|
174 | + throw new InvalidArgumentException('The encrypted value is not in correct base64 format.'); |
|
175 | + } |
|
176 | + if(strlen($encrypted) < self::ENCRYPTION_IV_SIZE) { |
|
177 | + throw new InvalidArgumentException('The encrypted value does not contain enough characters for the key.'); |
|
178 | + } |
|
173 | 179 | $iv_dec = substr($encrypted, 0, self::ENCRYPTION_IV_SIZE); |
174 | 180 | $encrypted = substr($encrypted, self::ENCRYPTION_IV_SIZE); |
175 | 181 | $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $encrypted, MCRYPT_MODE_CBC, $iv_dec); |
@@ -210,7 +216,9 @@ discard block |
||
210 | 216 | * @return boolean True if path valid |
211 | 217 | */ |
212 | 218 | public static function isValidPath($filename, $acceptfolder = FALSE) { |
213 | - if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true; |
|
219 | + if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) { |
|
220 | + return true; |
|
221 | + } |
|
214 | 222 | return false; |
215 | 223 | } |
216 | 224 |
@@ -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 |
@@ -78,7 +78,7 @@ |
||
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) { |
81 | - return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />'; |
|
81 | + return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -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 | - if ($fact==null) return $html; |
|
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; |
@@ -160,7 +160,9 @@ discard block |
||
160 | 160 | public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true){ |
161 | 161 | $html = ''; |
162 | 162 | $tag = 'em'; |
163 | - if($isStrong) $tag = 'strong'; |
|
163 | + if($isStrong) { |
|
164 | + $tag = 'strong'; |
|
165 | + } |
|
164 | 166 | if($individual && $individual->canShow()){ |
165 | 167 | $dindi = new Individual($individual); |
166 | 168 | $html = $individual->getSexImage(); |
@@ -174,8 +176,7 @@ discard block |
||
174 | 176 | $html .= ' <span><small><em>'.$dindi->format_first_major_fact(WT_EVENTS_BIRT, 10).'</em></small></span>'; |
175 | 177 | $html .= ' <span><small><em>'.$dindi->format_first_major_fact(WT_EVENTS_DEAT, 10).'</em></small></span>'; |
176 | 178 | $html .= '</a>'; |
177 | - } |
|
178 | - else { |
|
179 | + } else { |
|
179 | 180 | $html .= '<span class=\"list_item\"><'.$tag.'>' . I18N::translate('Private') . '</'.$tag.'></span>'; |
180 | 181 | } |
181 | 182 | return $html; |
@@ -195,8 +196,7 @@ discard block |
||
195 | 196 | $date = $fact->getDate(); |
196 | 197 | if($date->isOK()){ |
197 | 198 | $html.=' '.$date->Display($anchor && !$SEARCH_SPIDER, '%Y'); |
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 |
@@ -220,7 +220,9 @@ discard block |
||
220 | 220 | public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){ |
221 | 221 | $html=''; |
222 | 222 | |
223 | - if ($fact==null) return $html; |
|
223 | + if ($fact==null) { |
|
224 | + return $html; |
|
225 | + } |
|
224 | 226 | $place = $fact->getPlace(); |
225 | 227 | if($place){ |
226 | 228 | $dplace = new Place($place); |
@@ -339,7 +341,9 @@ discard block |
||
339 | 341 | default: |
340 | 342 | break; |
341 | 343 | } |
342 | - if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
344 | + if($image && $title) { |
|
345 | + $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
346 | + } |
|
343 | 347 | break; |
344 | 348 | default: |
345 | 349 | break; |
@@ -45,6 +45,7 @@ discard block |
||
45 | 45 | * @param string $element_name Element name from the edit interface, used to POST values for update |
46 | 46 | * @param string $context Tag context |
47 | 47 | * @param string $contextid Id of tag context |
48 | + * @return string |
|
48 | 49 | */ |
49 | 50 | public function hHtmlSimpleTagEditor($tag, $value = null, $element_id = '', $element_name = '', $context = null, $contextid = null); |
50 | 51 | |
@@ -53,6 +54,7 @@ discard block |
||
53 | 54 | * |
54 | 55 | * @param string $context Context of the edition |
55 | 56 | * @param int $level Level to which add the tags |
57 | + * @return void |
|
56 | 58 | */ |
57 | 59 | public function hAddSimpleTag($context, $level); |
58 | 60 |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
4 | - * |
|
5 | - * @package MyArtJaub\Webtrees |
|
6 | - * @subpackage Hook |
|
7 | - * @author Jonathan Jaubart <[email protected]> |
|
8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
10 | - */ |
|
3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
4 | + * |
|
5 | + * @package MyArtJaub\Webtrees |
|
6 | + * @subpackage Hook |
|
7 | + * @author Jonathan Jaubart <[email protected]> |
|
8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
10 | + */ |
|
11 | 11 | namespace MyArtJaub\Webtrees\Hook\HookInterfaces; |
12 | 12 | |
13 | 13 | /** |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | interface CustomSimpleTagManager { |
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * Returns the list of expected tags, classified by type of records. |
|
23 | - * |
|
24 | - * @return array List of expected tags |
|
25 | - */ |
|
26 | - public function hGetExpectedTags(); |
|
21 | + /** |
|
22 | + * Returns the list of expected tags, classified by type of records. |
|
23 | + * |
|
24 | + * @return array List of expected tags |
|
25 | + */ |
|
26 | + public function hGetExpectedTags(); |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Return the HTML code to be display for this tag. |
@@ -19,6 +19,7 @@ discard block |
||
19 | 19 | * Insert some content before the fact source text. |
20 | 20 | * |
21 | 21 | * @param string $srec Source fact record |
22 | + * @return string |
|
22 | 23 | */ |
23 | 24 | public function hFactSourcePrepend($srec); |
24 | 25 | |
@@ -26,6 +27,7 @@ discard block |
||
26 | 27 | * Insert some content after the fact source text. |
27 | 28 | * |
28 | 29 | * @param string $srec Source fact record |
30 | + * @return void |
|
29 | 31 | */ |
30 | 32 | public function hFactSourceAppend($srec); |
31 | 33 |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
4 | - * |
|
5 | - * @package MyArtJaub\Webtrees |
|
6 | - * @subpackage Hook |
|
7 | - * @author Jonathan Jaubart <[email protected]> |
|
8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
10 | - */ |
|
3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
4 | + * |
|
5 | + * @package MyArtJaub\Webtrees |
|
6 | + * @subpackage Hook |
|
7 | + * @author Jonathan Jaubart <[email protected]> |
|
8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
10 | + */ |
|
11 | 11 | namespace MyArtJaub\Webtrees\Hook\HookInterfaces; |
12 | 12 | |
13 | 13 | /** |
@@ -21,6 +21,7 @@ discard block |
||
21 | 21 | * Insert some content before the record name text. |
22 | 22 | * |
23 | 23 | * @param GedcomRecord $grec Gedcom record |
24 | + * @return void |
|
24 | 25 | */ |
25 | 26 | public function hRecordNamePrepend(GedcomRecord $grec); |
26 | 27 | |
@@ -28,6 +29,7 @@ discard block |
||
28 | 29 | * Insert some content after the record name text. |
29 | 30 | * |
30 | 31 | * @param GedcomRecord $grec Gedcom record |
32 | + * @return string |
|
31 | 33 | */ |
32 | 34 | public function hRecordNameAppend(GedcomRecord $grec); |
33 | 35 |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
4 | - * |
|
5 | - * @package MyArtJaub\Webtrees |
|
6 | - * @subpackage Hook |
|
7 | - * @author Jonathan Jaubart <[email protected]> |
|
8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
10 | - */ |
|
3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
4 | + * |
|
5 | + * @package MyArtJaub\Webtrees |
|
6 | + * @subpackage Hook |
|
7 | + * @author Jonathan Jaubart <[email protected]> |
|
8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
10 | + */ |
|
11 | 11 | namespace MyArtJaub\Webtrees\Hook\HookInterfaces; |
12 | 12 | |
13 | 13 | use Fisharebest\Webtrees\GedcomRecord; |
@@ -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(){ |
@@ -114,29 +114,29 @@ discard block |
||
114 | 114 | * @return string|array Estimated birth place if found, null otherwise |
115 | 115 | */ |
116 | 116 | public function getSignificantPlace(){ |
117 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
118 | - return $bplace; |
|
119 | - } |
|
117 | + if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
118 | + return $bplace; |
|
119 | + } |
|
120 | 120 | |
121 | - foreach ($this->gedcomrecord->getAllEventPlaces('RESI') as $rplace) { |
|
122 | - if ($rplace) { |
|
123 | - return $rplace; |
|
124 | - } |
|
125 | - } |
|
121 | + foreach ($this->gedcomrecord->getAllEventPlaces('RESI') as $rplace) { |
|
122 | + if ($rplace) { |
|
123 | + return $rplace; |
|
124 | + } |
|
125 | + } |
|
126 | 126 | |
127 | - if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
128 | - return $dplace; |
|
129 | - } |
|
127 | + if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
128 | + return $dplace; |
|
129 | + } |
|
130 | 130 | |
131 | - foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
132 | - foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
|
133 | - if ($rplace) { |
|
134 | - return $rplace; |
|
135 | - } |
|
136 | - } |
|
137 | - } |
|
131 | + foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
132 | + foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
|
133 | + if ($rplace) { |
|
134 | + return $rplace; |
|
135 | + } |
|
136 | + } |
|
137 | + } |
|
138 | 138 | |
139 | - return null; |
|
139 | + return null; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * @return boolean Is the individual a Sosa ancestor |
146 | 146 | */ |
147 | 147 | public function isSosa(){ |
148 | - return count($this->getSosaNumbers()) > 0; |
|
148 | + return count($this->getSosaNumbers()) > 0; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | * @return array List of Sosa numbers |
157 | 157 | */ |
158 | 158 | public function getSosaNumbers(){ |
159 | - if($this->_sosa === null) { |
|
160 | - $provider = new SosaProvider($this->gedcomrecord->getTree()); |
|
161 | - $this->_sosa = $provider->getSosaNumbers($this->gedcomrecord); |
|
162 | - } |
|
163 | - return $this->_sosa; |
|
159 | + if($this->_sosa === null) { |
|
160 | + $provider = new SosaProvider($this->gedcomrecord->getTree()); |
|
161 | + $this->_sosa = $provider->getSosaNumbers($this->gedcomrecord); |
|
162 | + } |
|
163 | + return $this->_sosa; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
178 | - * Check if this individual's death is sourced |
|
179 | - * |
|
180 | - * @return int Level of sources |
|
181 | - * */ |
|
178 | + * Check if this individual's death is sourced |
|
179 | + * |
|
180 | + * @return int Level of sources |
|
181 | + * */ |
|
182 | 182 | public function isDeathSourced(){ |
183 | 183 | if($this->_isdeathsourced != null) return $this->_isdeathsourced; |
184 | 184 | $this->_isdeathsourced = $this->isFactSourced(WT_EVENTS_DEAT); |
@@ -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 | } |
@@ -66,8 +66,7 @@ discard block |
||
66 | 66 | $ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2); |
67 | 67 | if($ct2>0){ |
68 | 68 | $this->_titles[$match2[1][0]][]= trim($match2[2][0]); |
69 | - } |
|
70 | - else{ |
|
69 | + } else{ |
|
71 | 70 | $this->_titles[$titlefact->getValue()][]=''; |
72 | 71 | } |
73 | 72 | } |
@@ -99,8 +98,7 @@ discard block |
||
99 | 98 | if($bplace = $this->gedcomrecord->getBirthPlace()){ |
100 | 99 | if($perc){ |
101 | 100 | return array ($bplace, 1); |
102 | - } |
|
103 | - else{ |
|
101 | + } else{ |
|
104 | 102 | return $bplace; |
105 | 103 | } |
106 | 104 | } |
@@ -169,7 +167,9 @@ discard block |
||
169 | 167 | * @return int Level of sources |
170 | 168 | * */ |
171 | 169 | public function isBirthSourced(){ |
172 | - if($this->_isbirthsourced != null) return $this->_isbirthsourced; |
|
170 | + if($this->_isbirthsourced != null) { |
|
171 | + return $this->_isbirthsourced; |
|
172 | + } |
|
173 | 173 | $this->_isbirthsourced = $this->isFactSourced(WT_EVENTS_BIRT); |
174 | 174 | return $this->_isbirthsourced; |
175 | 175 | } |
@@ -180,7 +180,9 @@ discard block |
||
180 | 180 | * @return int Level of sources |
181 | 181 | * */ |
182 | 182 | public function isDeathSourced(){ |
183 | - if($this->_isdeathsourced != null) return $this->_isdeathsourced; |
|
183 | + if($this->_isdeathsourced != null) { |
|
184 | + return $this->_isdeathsourced; |
|
185 | + } |
|
184 | 186 | $this->_isdeathsourced = $this->isFactSourced(WT_EVENTS_DEAT); |
185 | 187 | return $this->_isdeathsourced; |
186 | 188 | } |
@@ -14,7 +14,6 @@ |
||
14 | 14 | use Fisharebest\Webtrees\Controller\AjaxController; |
15 | 15 | use Fisharebest\Webtrees\Controller\PageController; |
16 | 16 | use Fisharebest\Webtrees\Filter; |
17 | -use Fisharebest\Webtrees\Html; |
|
18 | 17 | use Fisharebest\Webtrees\I18N; |
19 | 18 | use Fisharebest\Webtrees\Log; |
20 | 19 | use Fisharebest\Webtrees\Module; |
@@ -35,37 +35,37 @@ discard block |
||
35 | 35 | */ |
36 | 36 | class AdminConfigController extends MvcController |
37 | 37 | { |
38 | - /** |
|
39 | - * Tasks Provider |
|
40 | - * @var TaskProviderInterface $provider |
|
41 | - */ |
|
42 | - protected $provider; |
|
38 | + /** |
|
39 | + * Tasks Provider |
|
40 | + * @var TaskProviderInterface $provider |
|
41 | + */ |
|
42 | + protected $provider; |
|
43 | 43 | |
44 | - /** |
|
45 | - * Constructor for Admin Config controller |
|
46 | - * @param AbstractModule $module |
|
47 | - */ |
|
48 | - public function __construct(AbstractModule $module) { |
|
49 | - parent::__construct($module); |
|
44 | + /** |
|
45 | + * Constructor for Admin Config controller |
|
46 | + * @param AbstractModule $module |
|
47 | + */ |
|
48 | + public function __construct(AbstractModule $module) { |
|
49 | + parent::__construct($module); |
|
50 | 50 | |
51 | - $this->provider = $this->module->getProvider(); |
|
52 | - } |
|
51 | + $this->provider = $this->module->getProvider(); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Pages |
|
56 | - */ |
|
54 | + /** |
|
55 | + * Pages |
|
56 | + */ |
|
57 | 57 | |
58 | - /** |
|
59 | - * AdminConfig@index |
|
60 | - */ |
|
61 | - public function index() { |
|
62 | - global $WT_TREE; |
|
58 | + /** |
|
59 | + * AdminConfig@index |
|
60 | + */ |
|
61 | + public function index() { |
|
62 | + global $WT_TREE; |
|
63 | 63 | |
64 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
65 | - $controller = new PageController(); |
|
66 | - $controller |
|
67 | - ->restrictAccess(Auth::isAdmin()) |
|
68 | - ->setPageTitle($this->module->getTitle()); |
|
64 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
65 | + $controller = new PageController(); |
|
66 | + $controller |
|
67 | + ->restrictAccess(Auth::isAdmin()) |
|
68 | + ->setPageTitle($this->module->getTitle()); |
|
69 | 69 | |
70 | 70 | $token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN'); |
71 | 71 | if(is_null($token)) { |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | $this->module->setSetting('PAT_FORCE_EXEC_TOKEN', $token); |
74 | 74 | } |
75 | 75 | |
76 | - $data = new ViewBag(); |
|
77 | - $data->set('title', $controller->getPageTitle()); |
|
76 | + $data = new ViewBag(); |
|
77 | + $data->set('title', $controller->getPageTitle()); |
|
78 | 78 | |
79 | - $table_id = 'table-admintasks-' . Uuid::uuid4(); |
|
80 | - $data->set('table_id', $table_id); |
|
79 | + $table_id = 'table-admintasks-' . Uuid::uuid4(); |
|
80 | + $data->set('table_id', $table_id); |
|
81 | 81 | |
82 | 82 | $data->set('trigger_url_root', WT_BASE_URL.'module.php?mod='.$this->module->getName().'&mod_action=Task@trigger'); |
83 | 83 | $token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN'); |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | $this->provider->getInstalledTasks(); |
91 | 91 | |
92 | 92 | $controller |
93 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
94 | - ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
95 | - ->addInlineJavascript(' |
|
93 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
94 | + ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
95 | + ->addInlineJavascript(' |
|
96 | 96 | //Datatable initialisation |
97 | 97 | jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; |
98 | 98 | jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | }); |
125 | 125 | |
126 | 126 | ') |
127 | - ->addInlineJavascript(' |
|
127 | + ->addInlineJavascript(' |
|
128 | 128 | function generate_force_token() { |
129 | 129 | jQuery("#bt_genforcetoken").attr("disabled", "disabled"); |
130 | 130 | jQuery("#bt_tokentext").empty().html("<i class=\"fa fa-spinner fa-pulse fa-fw\"></i>"); |
@@ -172,56 +172,56 @@ discard block |
||
172 | 172 | } |
173 | 173 | '); |
174 | 174 | |
175 | - ViewFactory::make('AdminConfig', $this, $controller, $data)->render(); |
|
176 | - } |
|
175 | + ViewFactory::make('AdminConfig', $this, $controller, $data)->render(); |
|
176 | + } |
|
177 | 177 | |
178 | - /** |
|
179 | - * AdminConfig@jsonTasksList |
|
180 | - */ |
|
181 | - public function jsonTasksList() { |
|
182 | - global $WT_TREE; |
|
178 | + /** |
|
179 | + * AdminConfig@jsonTasksList |
|
180 | + */ |
|
181 | + public function jsonTasksList() { |
|
182 | + global $WT_TREE; |
|
183 | 183 | |
184 | - $controller = new JsonController(); |
|
185 | - $controller |
|
186 | - ->restrictAccess(Auth::isAdmin()); |
|
184 | + $controller = new JsonController(); |
|
185 | + $controller |
|
186 | + ->restrictAccess(Auth::isAdmin()); |
|
187 | 187 | |
188 | - // Generate an AJAX/JSON response for datatables to load a block of rows |
|
189 | - $search = Filter::postArray('search'); |
|
190 | - if($search) $search = $search['value']; |
|
191 | - $start = Filter::postInteger('start'); |
|
192 | - $length = Filter::postInteger('length'); |
|
193 | - $order = Filter::postArray('order'); |
|
188 | + // Generate an AJAX/JSON response for datatables to load a block of rows |
|
189 | + $search = Filter::postArray('search'); |
|
190 | + if($search) $search = $search['value']; |
|
191 | + $start = Filter::postInteger('start'); |
|
192 | + $length = Filter::postInteger('length'); |
|
193 | + $order = Filter::postArray('order'); |
|
194 | 194 | |
195 | 195 | $order_by_name = false; |
196 | - foreach($order as $key => &$value) { |
|
197 | - switch($value['column']) { |
|
198 | - case 3: |
|
196 | + foreach($order as $key => &$value) { |
|
197 | + switch($value['column']) { |
|
198 | + case 3: |
|
199 | 199 | $order_by_name = true; |
200 | - unset($order[$key]); |
|
201 | - break; |
|
202 | - case 4; |
|
200 | + unset($order[$key]); |
|
201 | + break; |
|
202 | + case 4; |
|
203 | 203 | $value['column'] = 'majat_last_run'; |
204 | 204 | break; |
205 | 205 | case 4; |
206 | 206 | $value['column'] = 'majat_last_result'; |
207 | 207 | break; |
208 | - default: |
|
209 | - unset($order[$key]); |
|
210 | - } |
|
211 | - } |
|
208 | + default: |
|
209 | + unset($order[$key]); |
|
210 | + } |
|
211 | + } |
|
212 | 212 | |
213 | - $list = $this->provider->getFilteredTasksList($search, $order, $start, $length); |
|
213 | + $list = $this->provider->getFilteredTasksList($search, $order, $start, $length); |
|
214 | 214 | if($order_by_name) { |
215 | 215 | usort($list, function(AbstractTask $a, AbstractTask $b) { return I18N::strcasecmp($a->getTitle(), $b->getTitle()); }); |
216 | 216 | } |
217 | - $recordsFiltered = count($list); |
|
218 | - $recordsTotal = $this->provider->getTasksCount(); |
|
217 | + $recordsFiltered = count($list); |
|
218 | + $recordsTotal = $this->provider->getTasksCount(); |
|
219 | 219 | |
220 | - $data = array(); |
|
221 | - foreach($list as $task) { |
|
222 | - $datum = array(); |
|
220 | + $data = array(); |
|
221 | + foreach($list as $task) { |
|
222 | + $datum = array(); |
|
223 | 223 | |
224 | - $datum[0] = ' |
|
224 | + $datum[0] = ' |
|
225 | 225 | <div class="btn-group"> |
226 | 226 | <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
227 | 227 | <i class="fa fa-pencil"></i><span class="caret"></span> |
@@ -239,50 +239,50 @@ discard block |
||
239 | 239 | </li> |
240 | 240 | </ul> |
241 | 241 | </div>'; |
242 | - $datum[1] = $task->getName(); |
|
243 | - $datum[2] = $task->isEnabled() ? |
|
242 | + $datum[1] = $task->getName(); |
|
243 | + $datum[2] = $task->isEnabled() ? |
|
244 | 244 | '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : |
245 | 245 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>'; |
246 | - $datum[3] = $task->getTitle(); |
|
247 | - $date_format = str_replace('%', '', I18N::dateFormat()) . ' H:i:s'; |
|
246 | + $datum[3] = $task->getTitle(); |
|
247 | + $date_format = str_replace('%', '', I18N::dateFormat()) . ' H:i:s'; |
|
248 | 248 | $datum[4] = $task->getLastUpdated()->format($date_format); |
249 | - $datum[5] = $task->isLastRunSuccess() ? |
|
249 | + $datum[5] = $task->isLastRunSuccess() ? |
|
250 | 250 | '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : |
251 | 251 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>'; |
252 | - $dtF = new \DateTime('@0'); |
|
253 | - $dtT = new \DateTime('@' . ($task->getFrequency() * 60)); |
|
254 | - $datum[6] = $dtF->diff($dtT)->format(I18N::translate('%a d %h h %i m')); |
|
252 | + $dtF = new \DateTime('@0'); |
|
253 | + $dtT = new \DateTime('@' . ($task->getFrequency() * 60)); |
|
254 | + $datum[6] = $dtF->diff($dtT)->format(I18N::translate('%a d %h h %i m')); |
|
255 | 255 | $datum[7] = $task->getRemainingOccurrences() > 0 ? I18N::number($task->getRemainingOccurrences()) : I18N::translate('Unlimited'); |
256 | 256 | $datum[8] = $task->isRunning() ? |
257 | 257 | '<i class="fa fa-cog fa-spin fa-fw"></i><span class="sr-only">'.I18N::translate('Running').'</span>' : |
258 | 258 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Not running').'</span>'; |
259 | 259 | if($task->isEnabled() && !$task->isRunning()) { |
260 | - $datum[9] = ' |
|
260 | + $datum[9] = ' |
|
261 | 261 | <button id="bt_runtask_'. $task->getName() .'" class="btn btn-primary" href="#" onclick="return run_admintask(\''. $task->getName() .'\')"> |
262 | 262 | <div id="bt_runtasktext_'. $task->getName() .'"><i class="fa fa-cog fa-fw" ></i>' . I18N::translate('Run') . '</div> |
263 | 263 | </button>'; |
264 | 264 | } |
265 | 265 | else { |
266 | - $datum[9] = ''; |
|
266 | + $datum[9] = ''; |
|
267 | 267 | } |
268 | 268 | |
269 | - $data[] = $datum; |
|
270 | - } |
|
269 | + $data[] = $datum; |
|
270 | + } |
|
271 | 271 | |
272 | - $controller->pageHeader(); |
|
272 | + $controller->pageHeader(); |
|
273 | 273 | |
274 | - echo \Zend_Json::encode(array( |
|
275 | - 'draw' => Filter::getInteger('draw'), |
|
276 | - 'recordsTotal' => $recordsTotal, |
|
277 | - 'recordsFiltered' => $recordsFiltered, |
|
278 | - 'data' => $data |
|
279 | - )); |
|
274 | + echo \Zend_Json::encode(array( |
|
275 | + 'draw' => Filter::getInteger('draw'), |
|
276 | + 'recordsTotal' => $recordsTotal, |
|
277 | + 'recordsFiltered' => $recordsFiltered, |
|
278 | + 'data' => $data |
|
279 | + )); |
|
280 | 280 | |
281 | - } |
|
281 | + } |
|
282 | 282 | |
283 | 283 | /** |
284 | 284 | * AdminConfig@generateToken |
285 | - * |
|
285 | + * |
|
286 | 286 | * Ajax call to generate a new token. Display the token, if generated. |
287 | 287 | * Tokens call only be generated by a site administrator. |
288 | 288 | * |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | ->setPageTitle($this->module->getTitle()); |
69 | 69 | |
70 | 70 | $token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN'); |
71 | - if(is_null($token)) { |
|
71 | + if (is_null($token)) { |
|
72 | 72 | $token = Functions::generateRandomToken(); |
73 | 73 | $this->module->setSetting('PAT_FORCE_EXEC_TOKEN', $token); |
74 | 74 | } |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | $data = new ViewBag(); |
77 | 77 | $data->set('title', $controller->getPageTitle()); |
78 | 78 | |
79 | - $table_id = 'table-admintasks-' . Uuid::uuid4(); |
|
79 | + $table_id = 'table-admintasks-'.Uuid::uuid4(); |
|
80 | 80 | $data->set('table_id', $table_id); |
81 | 81 | |
82 | 82 | $data->set('trigger_url_root', WT_BASE_URL.'module.php?mod='.$this->module->getName().'&mod_action=Task@trigger'); |
83 | 83 | $token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN'); |
84 | - if(is_null($token)) { |
|
84 | + if (is_null($token)) { |
|
85 | 85 | $token = Functions::generateRandomToken(); |
86 | 86 | $this->module->setSetting('MAJ_AT_FORCE_EXEC_TOKEN', $token); |
87 | 87 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | processing: true, |
107 | 107 | serverSide : true, |
108 | 108 | ajax : { |
109 | - url : "module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@jsonTasksList&ged='. $WT_TREE->getNameUrl().'", |
|
109 | + url : "module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@jsonTasksList&ged='.$WT_TREE->getNameUrl().'", |
|
110 | 110 | type : "POST" |
111 | 111 | }, |
112 | 112 | columns: [ |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | url: "module.php", |
144 | 144 | type: "GET", |
145 | 145 | data: { |
146 | - mod: "' . $this->module->getName() .'", |
|
146 | + mod: "' . $this->module->getName().'", |
|
147 | 147 | mod_action: "Task@setStatus", |
148 | 148 | task: task, |
149 | 149 | status: status |
150 | 150 | }, |
151 | 151 | error: function(result, stat, error) { |
152 | 152 | var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error; |
153 | - alert("' . I18N::translate('An error occured while editing this task:') . '" + err); |
|
153 | + alert("' . I18N::translate('An error occured while editing this task:').'" + err); |
|
154 | 154 | }, |
155 | 155 | complete: function(result, stat) { |
156 | 156 | adminTasksTable.ajax.reload(null, false); |
@@ -187,14 +187,14 @@ discard block |
||
187 | 187 | |
188 | 188 | // Generate an AJAX/JSON response for datatables to load a block of rows |
189 | 189 | $search = Filter::postArray('search'); |
190 | - if($search) $search = $search['value']; |
|
190 | + if ($search) $search = $search['value']; |
|
191 | 191 | $start = Filter::postInteger('start'); |
192 | 192 | $length = Filter::postInteger('length'); |
193 | 193 | $order = Filter::postArray('order'); |
194 | 194 | |
195 | 195 | $order_by_name = false; |
196 | - foreach($order as $key => &$value) { |
|
197 | - switch($value['column']) { |
|
196 | + foreach ($order as $key => &$value) { |
|
197 | + switch ($value['column']) { |
|
198 | 198 | case 3: |
199 | 199 | $order_by_name = true; |
200 | 200 | unset($order[$key]); |
@@ -211,14 +211,14 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | $list = $this->provider->getFilteredTasksList($search, $order, $start, $length); |
214 | - if($order_by_name) { |
|
214 | + if ($order_by_name) { |
|
215 | 215 | usort($list, function(AbstractTask $a, AbstractTask $b) { return I18N::strcasecmp($a->getTitle(), $b->getTitle()); }); |
216 | 216 | } |
217 | 217 | $recordsFiltered = count($list); |
218 | 218 | $recordsTotal = $this->provider->getTasksCount(); |
219 | 219 | |
220 | 220 | $data = array(); |
221 | - foreach($list as $task) { |
|
221 | + foreach ($list as $task) { |
|
222 | 222 | $datum = array(); |
223 | 223 | |
224 | 224 | $datum[0] = ' |
@@ -229,37 +229,34 @@ discard block |
||
229 | 229 | <ul class="dropdown-menu" role="menu"> |
230 | 230 | <li> |
231 | 231 | <a href="#" onclick="return set_admintask_status(\''. $task->getName().'\', '.($task->isEnabled() ? 'false' : 'true').');"> |
232 | - <i class="fa fa-fw '.($task->isEnabled() ? 'fa-times' : 'fa-check').'"></i> ' . ($task->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')) . ' |
|
232 | + <i class="fa fa-fw '.($task->isEnabled() ? 'fa-times' : 'fa-check').'"></i> '.($task->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')).' |
|
233 | 233 | </a> |
234 | 234 | </li> |
235 | 235 | <li> |
236 | - <a href="module.php?mod='.$this->module->getName().'&mod_action=Task@edit&task='. $task->getName().'"> |
|
237 | - <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit') . ' |
|
236 | + <a href="module.php?mod='.$this->module->getName().'&mod_action=Task@edit&task='.$task->getName().'"> |
|
237 | + <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit').' |
|
238 | 238 | </a> |
239 | 239 | </li> |
240 | 240 | </ul> |
241 | 241 | </div>'; |
242 | 242 | $datum[1] = $task->getName(); |
243 | 243 | $datum[2] = $task->isEnabled() ? |
244 | - '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : |
|
245 | - '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>'; |
|
244 | + '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>'; |
|
246 | 245 | $datum[3] = $task->getTitle(); |
247 | - $date_format = str_replace('%', '', I18N::dateFormat()) . ' H:i:s'; |
|
246 | + $date_format = str_replace('%', '', I18N::dateFormat()).' H:i:s'; |
|
248 | 247 | $datum[4] = $task->getLastUpdated()->format($date_format); |
249 | 248 | $datum[5] = $task->isLastRunSuccess() ? |
250 | - '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : |
|
251 | - '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>'; |
|
249 | + '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>'; |
|
252 | 250 | $dtF = new \DateTime('@0'); |
253 | - $dtT = new \DateTime('@' . ($task->getFrequency() * 60)); |
|
251 | + $dtT = new \DateTime('@'.($task->getFrequency() * 60)); |
|
254 | 252 | $datum[6] = $dtF->diff($dtT)->format(I18N::translate('%a d %h h %i m')); |
255 | 253 | $datum[7] = $task->getRemainingOccurrences() > 0 ? I18N::number($task->getRemainingOccurrences()) : I18N::translate('Unlimited'); |
256 | 254 | $datum[8] = $task->isRunning() ? |
257 | - '<i class="fa fa-cog fa-spin fa-fw"></i><span class="sr-only">'.I18N::translate('Running').'</span>' : |
|
258 | - '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Not running').'</span>'; |
|
259 | - if($task->isEnabled() && !$task->isRunning()) { |
|
255 | + '<i class="fa fa-cog fa-spin fa-fw"></i><span class="sr-only">'.I18N::translate('Running').'</span>' : '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Not running').'</span>'; |
|
256 | + if ($task->isEnabled() && !$task->isRunning()) { |
|
260 | 257 | $datum[9] = ' |
261 | - <button id="bt_runtask_'. $task->getName() .'" class="btn btn-primary" href="#" onclick="return run_admintask(\''. $task->getName() .'\')"> |
|
262 | - <div id="bt_runtasktext_'. $task->getName() .'"><i class="fa fa-cog fa-fw" ></i>' . I18N::translate('Run') . '</div> |
|
258 | + <button id="bt_runtask_'. $task->getName().'" class="btn btn-primary" href="#" onclick="return run_admintask(\''.$task->getName().'\')"> |
|
259 | + <div id="bt_runtasktext_'. $task->getName().'"><i class="fa fa-cog fa-fw" ></i>'.I18N::translate('Run').'</div> |
|
263 | 260 | </button>'; |
264 | 261 | } |
265 | 262 | else { |
@@ -187,7 +187,9 @@ discard block |
||
187 | 187 | |
188 | 188 | // Generate an AJAX/JSON response for datatables to load a block of rows |
189 | 189 | $search = Filter::postArray('search'); |
190 | - if($search) $search = $search['value']; |
|
190 | + if($search) { |
|
191 | + $search = $search['value']; |
|
192 | + } |
|
191 | 193 | $start = Filter::postInteger('start'); |
192 | 194 | $length = Filter::postInteger('length'); |
193 | 195 | $order = Filter::postArray('order'); |
@@ -261,8 +263,7 @@ discard block |
||
261 | 263 | <button id="bt_runtask_'. $task->getName() .'" class="btn btn-primary" href="#" onclick="return run_admintask(\''. $task->getName() .'\')"> |
262 | 264 | <div id="bt_runtasktext_'. $task->getName() .'"><i class="fa fa-cog fa-fw" ></i>' . I18N::translate('Run') . '</div> |
263 | 265 | </button>'; |
264 | - } |
|
265 | - else { |
|
266 | + } else { |
|
266 | 267 | $datum[9] = ''; |
267 | 268 | } |
268 | 269 |