@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | protected function getCaptchaControl() |
45 | 45 | { |
46 | 46 | $control = $this->getValidationTarget(); |
47 | - if (!$control) |
|
47 | + if(!$control) |
|
48 | 48 | throw new Exception('No target control specified for TReCaptcha2Validator'); |
49 | - if (!($control instanceof TReCaptcha2)) |
|
49 | + if(!($control instanceof TReCaptcha2)) |
|
50 | 50 | throw new Exception('TReCaptcha2Validator only works with TReCaptcha2 controls'); |
51 | 51 | return $control; |
52 | 52 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | protected function evaluateIsValid() |
67 | 67 | { |
68 | 68 | // check validity only once (if trying to evaulate multiple times, all redundant checks would fail) |
69 | - if (null === $this->_isvalid) |
|
69 | + if(null === $this->_isvalid) |
|
70 | 70 | { |
71 | 71 | $control = $this->getCaptchaControl(); |
72 | 72 | $this->_isvalid = $control->validate(); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $cs->registerHiddenField($this->getClientID() . '_1', $value); |
86 | 86 | |
87 | 87 | // update validator display |
88 | - if ($control = $this->getValidationTarget()) |
|
88 | + if($control = $this->getValidationTarget()) |
|
89 | 89 | { |
90 | 90 | $fn = 'captchaUpdateValidatorStatus_' . $this->getClientID(); |
91 | 91 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | if(($randomSeed = $options['randomSeed']) > 0) |
43 | 43 | srand($randomSeed); |
44 | 44 | else |
45 | - srand((int)(microtime() * 1000000)); |
|
45 | + srand((int) (microtime() * 1000000)); |
|
46 | 46 | $token = generateToken($publicKey, $privateKey, $alphabet, $tokenLength, $caseSensitive); |
47 | 47 | } |
48 | 48 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | function generateToken($publicKey, $privateKey, $alphabet, $tokenLength, $caseSensitive) |
54 | 54 | { |
55 | 55 | $token = substr(hash2string(md5($publicKey . $privateKey), $alphabet) . hash2string(md5($privateKey . $publicKey), $alphabet), 0, $tokenLength); |
56 | - return $caseSensitive?$token:strtoupper($token); |
|
56 | + return $caseSensitive ? $token : strtoupper($token); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | function hash2string($hex, $alphabet) |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $hexLength = strlen($hex); |
64 | 64 | $base = strlen($alphabet); |
65 | 65 | $result = ''; |
66 | - for($i = 0;$i < $hexLength;$i += 6) |
|
66 | + for($i = 0; $i < $hexLength; $i += 6) |
|
67 | 67 | { |
68 | 68 | $number = hexdec(substr($hex, $i, 6)); |
69 | 69 | while($number) |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | function displayToken($token, $fontSize, $theme) |
79 | 79 | { |
80 | - if(($fontSize = (int)$fontSize) < 22) |
|
80 | + if(($fontSize = (int) $fontSize) < 22) |
|
81 | 81 | $fontSize = 22; |
82 | 82 | if($fontSize > 100) |
83 | 83 | $fontSize = 100; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR); |
105 | 105 | |
106 | 106 | $hasShadow = ($theme & THEME_SHADOWED_TEXT); |
107 | - for($i = 0;$i < $length;$i++) |
|
107 | + for($i = 0; $i < $length; $i++) |
|
108 | 108 | { |
109 | 109 | $color = imagecolorallocate($image, rand(150, 220), rand(150, 220), rand(150, 220)); |
110 | 110 | $size = rand($fontWidth - 10, $fontWidth); |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | |
152 | 152 | function addNoise($image, $width, $height) |
153 | 153 | { |
154 | - for($x = 0;$x < $width;++$x) |
|
154 | + for($x = 0; $x < $width; ++$x) |
|
155 | 155 | { |
156 | - for($y = 0;$y < $height;++$y) |
|
156 | + for($y = 0; $y < $height; ++$y) |
|
157 | 157 | { |
158 | 158 | if(rand(0, 100) < 25) |
159 | 159 | { |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | |
168 | 168 | function addGrid($image, $width, $height) |
169 | 169 | { |
170 | - for($i = 0;$i < $width;$i += rand(15, 25)) |
|
170 | + for($i = 0; $i < $width; $i += rand(15, 25)) |
|
171 | 171 | { |
172 | 172 | imagesetthickness($image, rand(2, 6)); |
173 | 173 | $color = imagecolorallocate($image, rand(100, 180), rand(100, 180), rand(100, 180)); |
174 | 174 | imageline($image, $i + rand(-10, 20), 0, $i + rand(-10, 20), $height, $color); |
175 | 175 | imagecolordeallocate($image, $color); |
176 | 176 | } |
177 | - for($i = 0;$i < $height;$i += rand(15, 25)) |
|
177 | + for($i = 0; $i < $height; $i += rand(15, 25)) |
|
178 | 178 | { |
179 | 179 | imagesetthickness($image, rand(2, 6)); |
180 | 180 | $color = imagecolorallocate($image, rand(100, 180), rand(100, 180), rand(100, 180)); |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | |
186 | 186 | function addScribble($image, $width, $height) |
187 | 187 | { |
188 | - for($i = 0;$i < 8;$i++) |
|
188 | + for($i = 0; $i < 8; $i++) |
|
189 | 189 | { |
190 | 190 | $color = imagecolorallocate($image, rand(100, 180), rand(100, 180), rand(100, 180)); |
191 | 191 | $points = []; |
192 | - for($j = 1;$j < rand(5, 10);$j++) |
|
192 | + for($j = 1; $j < rand(5, 10); $j++) |
|
193 | 193 | { |
194 | 194 | $points[] = rand(2 * (20 * ($i + 1)), 2 * (50 * ($i + 1))); |
195 | 195 | $points[] = rand(30, $height + 30); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | { |
205 | 205 | $tempImage = imagecreatetruecolor($width, $height); |
206 | 206 | $chunk = rand(1, 5); |
207 | - for($x = $y = 0;$x < $width;$x += $chunk) |
|
207 | + for($x = $y = 0; $x < $width; $x += $chunk) |
|
208 | 208 | { |
209 | 209 | $chunk = rand(1, 5); |
210 | 210 | $y += rand(-1, 1); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | if($y < 0) $y = 5; |
213 | 213 | imagecopy($tempImage, $image, $x, 0, $x, $y, $chunk, $height); |
214 | 214 | } |
215 | - for($x = $y = 0;$y < $height;$y += $chunk) |
|
215 | + for($x = $y = 0; $y < $height; $y += $chunk) |
|
216 | 216 | { |
217 | 217 | $chunk = rand(1, 5); |
218 | 218 | $x += rand(-1, 1); |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | protected function _getZappableSleepProps(&$exprops) |
67 | 67 | { |
68 | 68 | parent::_getZappableSleepProps($exprops); |
69 | - if ($this->_flags === 0) |
|
69 | + if($this->_flags === 0) |
|
70 | 70 | $exprops[] = "\0Prado\Web\UI\WebControls\TFont\0_flags"; |
71 | - if ($this->_name === '') |
|
71 | + if($this->_name === '') |
|
72 | 72 | $exprops[] = "\0Prado\Web\UI\WebControls\TFont\0_name"; |
73 | - if ($this->_size === '') |
|
73 | + if($this->_size === '') |
|
74 | 74 | $exprops[] = "\0Prado\Web\UI\WebControls\TFont\0_size"; |
75 | 75 | } |
76 | 76 | |
@@ -287,9 +287,9 @@ discard block |
||
287 | 287 | return ''; |
288 | 288 | $str = ''; |
289 | 289 | if($this->_flags & self::IS_SET_BOLD) |
290 | - $str .= 'font-weight:' . (($this->_flags & self::IS_BOLD)?'bold;':'normal;'); |
|
290 | + $str .= 'font-weight:' . (($this->_flags & self::IS_BOLD) ? 'bold;' : 'normal;'); |
|
291 | 291 | if($this->_flags & self::IS_SET_ITALIC) |
292 | - $str .= 'font-style:' . (($this->_flags & self::IS_ITALIC)?'italic;':'normal;'); |
|
292 | + $str .= 'font-style:' . (($this->_flags & self::IS_ITALIC) ? 'italic;' : 'normal;'); |
|
293 | 293 | $textDec = ''; |
294 | 294 | if($this->_flags & self::IS_UNDERLINE) |
295 | 295 | $textDec .= 'underline'; |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | if($this->_flags === 0) |
317 | 317 | return; |
318 | 318 | if($this->_flags & self::IS_SET_BOLD) |
319 | - $writer->addStyleAttribute('font-weight', (($this->_flags & self::IS_BOLD)?'bold':'normal')); |
|
319 | + $writer->addStyleAttribute('font-weight', (($this->_flags & self::IS_BOLD) ? 'bold' : 'normal')); |
|
320 | 320 | if($this->_flags & self::IS_SET_ITALIC) |
321 | - $writer->addStyleAttribute('font-style', (($this->_flags & self::IS_ITALIC)?'italic':'normal')); |
|
321 | + $writer->addStyleAttribute('font-style', (($this->_flags & self::IS_ITALIC) ? 'italic' : 'normal')); |
|
322 | 322 | $textDec = ''; |
323 | 323 | if($this->_flags & self::IS_UNDERLINE) |
324 | 324 | $textDec .= 'underline'; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | { |
146 | 146 | $writer->addAttribute('id', $this->getClientID() . '_0'); |
147 | 147 | |
148 | - $style = $this->getActive()?$this->getParent()->getActiveHeaderStyle():$this->getParent()->getHeaderStyle(); |
|
148 | + $style = $this->getActive() ? $this->getParent()->getActiveHeaderStyle() : $this->getParent()->getHeaderStyle(); |
|
149 | 149 | |
150 | 150 | $style->addAttributesToRender($writer); |
151 | 151 | |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | if(($caption = $this->getCaption()) === '') |
169 | 169 | $caption = ' '; |
170 | 170 | |
171 | - if ($url != '') |
|
171 | + if($url != '') |
|
172 | 172 | $writer->write("<a href=\"{$url}\">"); |
173 | 173 | $writer->write("{$caption}"); |
174 | - if ($url != '') |
|
174 | + if($url != '') |
|
175 | 175 | $writer->write("</a>"); |
176 | 176 | } |
177 | 177 | } |
@@ -99,7 +99,7 @@ |
||
99 | 99 | $session = $this->_page->getSession(); |
100 | 100 | $session->open(); |
101 | 101 | $data = serialize($state); |
102 | - $timestamp = (string)microtime(true); |
|
102 | + $timestamp = (string) microtime(true); |
|
103 | 103 | $key = self::STATE_SESSION_KEY . $timestamp; |
104 | 104 | $session->add($key, $data); |
105 | 105 | if(($queue = $session->itemAt(self::QUEUE_SESSION_KEY)) === null) |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $this->delete($id); |
153 | 153 | else |
154 | 154 | { |
155 | - $data = [$value,$dependency]; |
|
155 | + $data = [$value, $dependency]; |
|
156 | 156 | return $this->setValue($this->generateUniqueKey($id), $data, $expire); |
157 | 157 | } |
158 | 158 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | { |
171 | 171 | if(empty($value) && $expire === 0) |
172 | 172 | return false; |
173 | - $data = [$value,$dependency]; |
|
173 | + $data = [$value, $dependency]; |
|
174 | 174 | return $this->addValue($this->generateUniqueKey($id), $data, $expire); |
175 | 175 | } |
176 | 176 |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function init($config) |
81 | 81 | { |
82 | - if (!function_exists('curl_version')) throw new TConfigurationException('curl_extension_required'); |
|
82 | + if(!function_exists('curl_version')) throw new TConfigurationException('curl_extension_required'); |
|
83 | 83 | parent::init($config); |
84 | 84 | } |
85 | 85 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | protected function setValue($key, $value, $expire) |
156 | 156 | { |
157 | 157 | $value = ['value' => serialize($value)]; |
158 | - if ($expire > 0) $value['ttl'] = $expire; |
|
158 | + if($expire > 0) $value['ttl'] = $expire; |
|
159 | 159 | $result = $this->request('PUT', $this->_dir . '/' . $key, $value); |
160 | 160 | return !property_exists($result, 'errorCode'); |
161 | 161 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | protected function addValue($key, $value, $expire) |
173 | 173 | { |
174 | 174 | $value = ['value' => serialize($value), 'prevExist' => 'false']; |
175 | - if ($expire > 0) $value['ttl'] = $expire; |
|
175 | + if($expire > 0) $value['ttl'] = $expire; |
|
176 | 176 | $result = $this->request('PUT', $this->_dir . '/' . $key, $value); |
177 | 177 | return !property_exists($result, 'errorCode'); |
178 | 178 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function __construct($source) |
60 | 60 | { |
61 | - $this->source = (string)$source; |
|
61 | + $this->source = (string) $source; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | |
80 | 80 | foreach($translationUnit as $unit) |
81 | 81 | { |
82 | - $source = (string)$unit->source; |
|
83 | - $translations[$source][] = (string)$unit->target; |
|
84 | - $translations[$source][] = (string)$unit['id']; |
|
85 | - $translations[$source][] = (string)$unit->note; |
|
82 | + $source = (string) $unit->source; |
|
83 | + $translations[$source][] = (string) $unit->target; |
|
84 | + $translations[$source][] = (string) $unit['id']; |
|
85 | + $translations[$source][] = (string) $unit->note; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | return $translations; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | { |
137 | 137 | if(isset($variants[$i]{0})) |
138 | 138 | { |
139 | - $variant .= ($variant)?'_' . $variants[$i]:$variants[$i]; |
|
139 | + $variant .= ($variant) ? '_' . $variants[$i] : $variants[$i]; |
|
140 | 140 | $catalogues[] = $catalogue . $this->dataSeparator . $variant . $this->dataExt; |
141 | 141 | } |
142 | 142 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | { |
172 | 172 | if(isset($variants[$i]{0})) |
173 | 173 | { |
174 | - $variant .= ($variant)?'_' . $variants[$i]:$variants[$i]; |
|
174 | + $variant .= ($variant) ? '_' . $variants[$i] : $variants[$i]; |
|
175 | 175 | $catalogues[] = $variant . '/' . $catalogue . $this->dataExt; |
176 | 176 | } |
177 | 177 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | protected function getCatalogues($dir = null, $variant = null) |
200 | 200 | { |
201 | - $dir = $dir?$dir:$this->source; |
|
201 | + $dir = $dir ? $dir : $this->source; |
|
202 | 202 | $files = scandir($dir); |
203 | 203 | $catalogue = []; |
204 | 204 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | $lastNodes = $xpath->query('//trans-unit[last()]'); |
296 | 296 | if(($last = $lastNodes->item(0)) !== null) { |
297 | - $count = (int)$last->getAttribute('id'); |
|
297 | + $count = (int) $last->getAttribute('id'); |
|
298 | 298 | } else { |
299 | 299 | $count = 0; |
300 | 300 | } |
@@ -523,7 +523,7 @@ |
||
523 | 523 | </body> |
524 | 524 | </file> |
525 | 525 | </xliff> |
526 | -EOD; |
|
526 | +eod; |
|
527 | 527 | return $xml; |
528 | 528 | } |
529 | 529 | } |
@@ -125,19 +125,19 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public static function poFile2moFile($pofile, $mofile) |
127 | 127 | { |
128 | - if (!is_file($pofile)) { |
|
128 | + if(!is_file($pofile)) { |
|
129 | 129 | throw new Exception("File $pofile doesn't exist."); |
130 | 130 | } |
131 | 131 | |
132 | 132 | include_once dirname(__FILE__) . '/PO.php'; |
133 | 133 | |
134 | 134 | $PO = new TGettext_PO($pofile); |
135 | - if (true !== ($e = $PO->load())) { |
|
135 | + if(true !== ($e = $PO->load())) { |
|
136 | 136 | return $e; |
137 | 137 | } |
138 | 138 | |
139 | 139 | $MO = $PO->toMO(); |
140 | - if (true !== ($e = $MO->save($mofile))) { |
|
140 | + if(true !== ($e = $MO->save($mofile))) { |
|
141 | 141 | return $e; |
142 | 142 | } |
143 | 143 | unset($PO, $MO); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public static function prepare($string, $reverse = false) |
158 | 158 | { |
159 | - if ($reverse) { |
|
159 | + if($reverse) { |
|
160 | 160 | $smap = ['"', "\n", "\t", "\r"]; |
161 | 161 | $rmap = ['\"', '\\n"' . "\n" . '"', '\\t', '\\r']; |
162 | 162 | return (string) str_replace($smap, $rmap, $string); |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | public static function meta2array($meta) |
180 | 180 | { |
181 | 181 | $array = []; |
182 | - foreach (explode("\n", $meta) as $info) { |
|
183 | - if ($info = trim($info)) { |
|
182 | + foreach(explode("\n", $meta) as $info) { |
|
183 | + if($info = trim($info)) { |
|
184 | 184 | list($key, $value) = explode(':', $info, 2); |
185 | 185 | $array[trim($key)] = trim($value); |
186 | 186 | } |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function fromArray($array) |
246 | 246 | { |
247 | - if (!array_key_exists('strings', $array)) { |
|
248 | - if (count($array) != 2) { |
|
247 | + if(!array_key_exists('strings', $array)) { |
|
248 | + if(count($array) != 2) { |
|
249 | 249 | return false; |
250 | 250 | } else { |
251 | 251 | list($this->meta, $this->strings) = $array; |
@@ -126,7 +126,7 @@ |
||
126 | 126 | public static function poFile2moFile($pofile, $mofile) |
127 | 127 | { |
128 | 128 | if (!is_file($pofile)) { |
129 | - throw new Exception("File $pofile doesn't exist."); |
|
129 | + throw new Exception("file $pofile doesn't exist."); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | include_once dirname(__FILE__) . '/PO.php'; |