@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function setText($value) |
96 | 96 | { |
97 | - if(parent::getText() === $value) |
|
97 | + if(parent::getText()===$value) |
|
98 | 98 | return; |
99 | 99 | |
100 | 100 | parent::setText($value); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | protected function addAttributesToRender($writer) |
118 | 118 | { |
119 | 119 | parent::addAttributesToRender($writer); |
120 | - $writer->addAttribute('id',$this->getClientID()); |
|
120 | + $writer->addAttribute('id', $this->getClientID()); |
|
121 | 121 | $this->getActiveControl()->registerCallbackClientScript( |
122 | 122 | $this->getClientClassName(), $this->getPostBackOptions()); |
123 | 123 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | class TReCaptcha2Validator extends TBaseValidator |
31 | 31 | { |
32 | - protected $_isvalid = null; |
|
32 | + protected $_isvalid=null; |
|
33 | 33 | |
34 | 34 | protected function getClientClassName() |
35 | 35 | { |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | } |
42 | 42 | protected function getCaptchaControl() |
43 | 43 | { |
44 | - $control = $this->getValidationTarget(); |
|
45 | - if (!$control) |
|
44 | + $control=$this->getValidationTarget(); |
|
45 | + if(!$control) |
|
46 | 46 | throw new Exception('No target control specified for TReCaptcha2Validator'); |
47 | - if (!($control instanceof TReCaptcha2)) |
|
47 | + if(!($control instanceof TReCaptcha2)) |
|
48 | 48 | throw new Exception('TReCaptcha2Validator only works with TReCaptcha2 controls'); |
49 | 49 | return $control; |
50 | 50 | } |
51 | 51 | public function getClientScriptOptions() |
52 | 52 | { |
53 | - $options = parent::getClientScriptOptions(); |
|
54 | - $options['ResponseFieldName'] = $this->getCaptchaControl()->getResponseFieldName(); |
|
53 | + $options=parent::getClientScriptOptions(); |
|
54 | + $options['ResponseFieldName']=$this->getCaptchaControl()->getResponseFieldName(); |
|
55 | 55 | return $options; |
56 | 56 | } |
57 | 57 | /** |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | protected function evaluateIsValid() |
65 | 65 | { |
66 | 66 | // check validity only once (if trying to evaulate multiple times, all redundant checks would fail) |
67 | - if (is_null($this->_isvalid)) |
|
67 | + if(is_null($this->_isvalid)) |
|
68 | 68 | { |
69 | - $control = $this->getCaptchaControl(); |
|
70 | - $this->_isvalid = $control->validate(); |
|
69 | + $control=$this->getCaptchaControl(); |
|
70 | + $this->_isvalid=$control->validate(); |
|
71 | 71 | } |
72 | 72 | return ($this->_isvalid==true); |
73 | 73 | } |
@@ -75,19 +75,19 @@ discard block |
||
75 | 75 | { |
76 | 76 | parent::onPreRender($param); |
77 | 77 | |
78 | - $cs = $this->Page->getClientScript(); |
|
78 | + $cs=$this->Page->getClientScript(); |
|
79 | 79 | $cs->registerPradoScript('validator'); |
80 | 80 | |
81 | 81 | // communicate validation status to the client side |
82 | - $value = $this->_isvalid===false ? '0' : '1'; |
|
83 | - $cs->registerHiddenField($this->getClientID().'_1',$value); |
|
82 | + $value=$this->_isvalid===false ? '0' : '1'; |
|
83 | + $cs->registerHiddenField($this->getClientID().'_1', $value); |
|
84 | 84 | |
85 | 85 | // update validator display |
86 | - if ($control = $this->getValidationTarget()) |
|
86 | + if($control=$this->getValidationTarget()) |
|
87 | 87 | { |
88 | - $fn = 'captchaUpdateValidatorStatus_'.$this->getClientID(); |
|
88 | + $fn='captchaUpdateValidatorStatus_'.$this->getClientID(); |
|
89 | 89 | |
90 | - $cs->registerEndScript($this->getClientID().'::validate', implode(' ',array( |
|
90 | + $cs->registerEndScript($this->getClientID().'::validate', implode(' ', array( |
|
91 | 91 | // this function will be used to update the validator |
92 | 92 | 'function '.$fn.'(valid)', |
93 | 93 | '{', |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param TDbConnection the database connection |
46 | 46 | * @param string the SQL statement to be executed |
47 | 47 | */ |
48 | - public function __construct(TDbConnection $connection,$text) |
|
48 | + public function __construct(TDbConnection $connection, $text) |
|
49 | 49 | { |
50 | 50 | $this->_connection=$connection; |
51 | 51 | $this->setText($text); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function __sleep() |
58 | 58 | { |
59 | - return array_diff(parent::__sleep(),array("\0TDbCommand\0_statement")); |
|
59 | + return array_diff(parent::__sleep(), array("\0TDbCommand\0_statement")); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | catch(Exception $e) |
114 | 114 | { |
115 | - throw new TDbException('dbcommand_prepare_failed',$e->getMessage(),$this->getText()); |
|
115 | + throw new TDbException('dbcommand_prepare_failed', $e->getMessage(), $this->getText()); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | } |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | { |
143 | 143 | $this->prepare(); |
144 | 144 | if($dataType===null) |
145 | - $this->_statement->bindParam($name,$value); |
|
145 | + $this->_statement->bindParam($name, $value); |
|
146 | 146 | else if($length===null) |
147 | - $this->_statement->bindParam($name,$value,$dataType); |
|
147 | + $this->_statement->bindParam($name, $value, $dataType); |
|
148 | 148 | else |
149 | - $this->_statement->bindParam($name,$value,$dataType,$length); |
|
149 | + $this->_statement->bindParam($name, $value, $dataType, $length); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | { |
164 | 164 | $this->prepare(); |
165 | 165 | if($dataType===null) |
166 | - $this->_statement->bindValue($name,$value); |
|
166 | + $this->_statement->bindValue($name, $value); |
|
167 | 167 | else |
168 | - $this->_statement->bindValue($name,$value,$dataType); |
|
168 | + $this->_statement->bindValue($name, $value, $dataType); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | catch(Exception $e) |
194 | 194 | { |
195 | - throw new TDbException('dbcommand_execute_failed',$e->getMessage(),$this->getDebugStatementText()); |
|
195 | + throw new TDbException('dbcommand_execute_failed', $e->getMessage(), $this->getDebugStatementText()); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | } |
227 | 227 | catch(Exception $e) |
228 | 228 | { |
229 | - throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText()); |
|
229 | + throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText()); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | } |
254 | 254 | catch(Exception $e) |
255 | 255 | { |
256 | - throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText()); |
|
256 | + throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText()); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | } |
283 | 283 | catch(Exception $e) |
284 | 284 | { |
285 | - throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText()); |
|
285 | + throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText()); |
|
286 | 286 | } |
287 | 287 | } |
288 | 288 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | class TReCaptcha2 extends TActivePanel implements ICallbackEventHandler, IValidatable |
57 | 57 | { |
58 | - const ChallengeFieldName = 'g-recaptcha-response'; |
|
58 | + const ChallengeFieldName='g-recaptcha-response'; |
|
59 | 59 | private $_widgetId=0; |
60 | 60 | private $_isValid=true; |
61 | 61 | |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | } |
103 | 103 | public function getResponseFieldName() |
104 | 104 | { |
105 | - $captchas = $this->Page->findControlsByType('TReCaptcha2'); |
|
106 | - $cont = 0; |
|
107 | - $responseFieldName = self::ChallengeFieldName; |
|
108 | - foreach ($captchas as $captcha) |
|
105 | + $captchas=$this->Page->findControlsByType('TReCaptcha2'); |
|
106 | + $cont=0; |
|
107 | + $responseFieldName=self::ChallengeFieldName; |
|
108 | + foreach($captchas as $captcha) |
|
109 | 109 | { |
110 | - if ($this->getClientID() == $captcha->ClientID) |
|
110 | + if($this->getClientID()==$captcha->ClientID) |
|
111 | 111 | { |
112 | - $responseFieldName .= ($cont > 0) ? '-'.$cont : ''; |
|
112 | + $responseFieldName.=($cont > 0) ? '-'.$cont : ''; |
|
113 | 113 | } |
114 | 114 | $cont++; |
115 | 115 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function reset() |
238 | 238 | { |
239 | - $this->Page->CallbackClient->callClientFunction('grecaptcha.reset',array(array($this->WidgetId))); |
|
239 | + $this->Page->CallbackClient->callClientFunction('grecaptcha.reset', array(array($this->WidgetId))); |
|
240 | 240 | } |
241 | 241 | /** |
242 | 242 | * Gets the response for the reCAPTCHA widget. |
@@ -259,34 +259,34 @@ discard block |
||
259 | 259 | } |
260 | 260 | protected function getClientOptions() |
261 | 261 | { |
262 | - $options['ID'] = $this->getClientID(); |
|
263 | - $options['EventTarget'] = $this->getUniqueID(); |
|
264 | - $options['FormID'] = $this->Page->getForm()->getClientID(); |
|
265 | - $options['onCallback'] = $this->hasEventHandler('OnCallback'); |
|
266 | - $options['onCallbackExpired'] = $this->hasEventHandler('OnCallbackExpired'); |
|
267 | - $options['options']['sitekey'] = $this->getSiteKey(); |
|
268 | - if ($theme = $this->getTheme()) $options['options']['theme'] = $theme; |
|
269 | - if ($type = $this->getType()) $options['options']['type'] = $type; |
|
270 | - if ($size = $this->getSize()) $options['options']['size'] = $size; |
|
271 | - if ($tabIndex = $this->getTabIndex()) $options['options']['tabindex'] = $tabIndex; |
|
262 | + $options['ID']=$this->getClientID(); |
|
263 | + $options['EventTarget']=$this->getUniqueID(); |
|
264 | + $options['FormID']=$this->Page->getForm()->getClientID(); |
|
265 | + $options['onCallback']=$this->hasEventHandler('OnCallback'); |
|
266 | + $options['onCallbackExpired']=$this->hasEventHandler('OnCallbackExpired'); |
|
267 | + $options['options']['sitekey']=$this->getSiteKey(); |
|
268 | + if($theme=$this->getTheme()) $options['options']['theme']=$theme; |
|
269 | + if($type=$this->getType()) $options['options']['type']=$type; |
|
270 | + if($size=$this->getSize()) $options['options']['size']=$size; |
|
271 | + if($tabIndex=$this->getTabIndex()) $options['options']['tabindex']=$tabIndex; |
|
272 | 272 | |
273 | 273 | return $options; |
274 | 274 | } |
275 | 275 | protected function registerClientScript() |
276 | 276 | { |
277 | - $id = $this->getClientID(); |
|
278 | - $options = TJavaScript::encode($this->getClientOptions()); |
|
279 | - $className = $this->getClientClassName(); |
|
280 | - $cs = $this->Page->ClientScript; |
|
281 | - $code = "new $className($options);"; |
|
277 | + $id=$this->getClientID(); |
|
278 | + $options=TJavaScript::encode($this->getClientOptions()); |
|
279 | + $className=$this->getClientClassName(); |
|
280 | + $cs=$this->Page->ClientScript; |
|
281 | + $code="new $className($options);"; |
|
282 | 282 | |
283 | 283 | $cs->registerPradoScript('ajax'); |
284 | 284 | $cs->registerEndScript("grecaptcha:$id", $code); |
285 | 285 | } |
286 | 286 | public function validate() |
287 | 287 | { |
288 | - $value = $this->getValidationPropertyValue(); |
|
289 | - if($value === null || empty($value)) |
|
288 | + $value=$this->getValidationPropertyValue(); |
|
289 | + if($value===null || empty($value)) |
|
290 | 290 | return false; |
291 | 291 | |
292 | 292 | return true; |
@@ -299,46 +299,46 @@ discard block |
||
299 | 299 | { |
300 | 300 | parent::onPreRender($param); |
301 | 301 | |
302 | - if("" == $this->getSiteKey()) |
|
302 | + if(""==$this->getSiteKey()) |
|
303 | 303 | throw new TConfigurationException('recaptcha_publickey_unknown'); |
304 | - if("" == $this->getSecretKey()) |
|
304 | + if(""==$this->getSecretKey()) |
|
305 | 305 | throw new TConfigurationException('recaptcha_privatekey_unknown'); |
306 | 306 | |
307 | 307 | // need to register captcha fields so they will be sent postback |
308 | 308 | $this->Page->registerRequiresPostData($this->getResponseFieldName()); |
309 | - $this->Page->ClientScript->registerHeadScriptFile('grecaptcha2', 'https://www.google.com/recaptcha/api.js?onload=TReCaptcha2_onloadCallback&render=explicit&hl=' . $this->getLanguage()); |
|
309 | + $this->Page->ClientScript->registerHeadScriptFile('grecaptcha2', 'https://www.google.com/recaptcha/api.js?onload=TReCaptcha2_onloadCallback&render=explicit&hl='.$this->getLanguage()); |
|
310 | 310 | } |
311 | 311 | protected function addAttributesToRender($writer) |
312 | 312 | { |
313 | - $writer->addAttribute('id',$this->getClientID()); |
|
313 | + $writer->addAttribute('id', $this->getClientID()); |
|
314 | 314 | parent::addAttributesToRender($writer); |
315 | 315 | } |
316 | 316 | public function raiseCallbackEvent($param) |
317 | 317 | { |
318 | - $params = $param->getCallbackParameter(); |
|
319 | - if ($params instanceof stdClass) |
|
318 | + $params=$param->getCallbackParameter(); |
|
319 | + if($params instanceof stdClass) |
|
320 | 320 | { |
321 | - $callback = property_exists($params, 'onCallback'); |
|
322 | - $callbackExpired = property_exists($params, 'onCallbackExpired'); |
|
321 | + $callback=property_exists($params, 'onCallback'); |
|
322 | + $callbackExpired=property_exists($params, 'onCallbackExpired'); |
|
323 | 323 | |
324 | - if ($callback) |
|
324 | + if($callback) |
|
325 | 325 | { |
326 | - $this->WidgetId = $params->widgetId; |
|
327 | - $this->Response = $params->response; |
|
328 | - $this->Page->CallbackClient->jQuery($params->responseField, 'text',array($params->response)); |
|
326 | + $this->WidgetId=$params->widgetId; |
|
327 | + $this->Response=$params->response; |
|
328 | + $this->Page->CallbackClient->jQuery($params->responseField, 'text', array($params->response)); |
|
329 | 329 | |
330 | - if ($params->onCallback) |
|
330 | + if($params->onCallback) |
|
331 | 331 | { |
332 | 332 | $this->onCallback($param); |
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
336 | - if ($callbackExpired) |
|
336 | + if($callbackExpired) |
|
337 | 337 | { |
338 | - $this->Response = ''; |
|
338 | + $this->Response=''; |
|
339 | 339 | $this->reset(); |
340 | 340 | |
341 | - if ($params->onCallbackExpired) |
|
341 | + if($params->onCallbackExpired) |
|
342 | 342 | { |
343 | 343 | $this->onCallbackExpired($param); |
344 | 344 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @var string $_cacheDir |
56 | 56 | */ |
57 | - protected $_cacheDir = '/tmp/'; |
|
57 | + protected $_cacheDir='/tmp/'; |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Enable / disable caching |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @var boolean $_caching |
65 | 65 | */ |
66 | - protected $_caching = true; |
|
66 | + protected $_caching=true; |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Cache lifetime (in seconds) |
70 | 70 | * |
71 | 71 | * @var int $_lifeTime |
72 | 72 | */ |
73 | - protected $_lifeTime = 3600; |
|
73 | + protected $_lifeTime=3600; |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Enable / disable fileLocking |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @var boolean $_fileLocking |
81 | 81 | */ |
82 | - protected $_fileLocking = true; |
|
82 | + protected $_fileLocking=true; |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Timestamp of the last valid cache |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @var boolean $_writeControl |
107 | 107 | */ |
108 | - protected $_writeControl = true; |
|
108 | + protected $_writeControl=true; |
|
109 | 109 | |
110 | 110 | /** |
111 | 111 | * Enable / disable read control |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @var boolean $_writeControl |
117 | 117 | */ |
118 | - protected $_readControl = true; |
|
118 | + protected $_readControl=true; |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Type of read control (only if read control is enabled) |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @var boolean $_readControlType |
130 | 130 | */ |
131 | - protected $_readControlType = 'crc32'; |
|
131 | + protected $_readControlType='crc32'; |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Current cache id |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @var boolean $_memoryCaching |
153 | 153 | */ |
154 | - protected $_memoryCaching = false; |
|
154 | + protected $_memoryCaching=false; |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Enable / Disable "Only Memory Caching" |
@@ -159,28 +159,28 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @var boolean $_onlyMemoryCaching |
161 | 161 | */ |
162 | - protected $_onlyMemoryCaching = false; |
|
162 | + protected $_onlyMemoryCaching=false; |
|
163 | 163 | |
164 | 164 | /** |
165 | 165 | * Memory caching array |
166 | 166 | * |
167 | 167 | * @var array $_memoryCachingArray |
168 | 168 | */ |
169 | - protected $_memoryCachingArray = array(); |
|
169 | + protected $_memoryCachingArray=array(); |
|
170 | 170 | |
171 | 171 | /** |
172 | 172 | * Memory caching counter |
173 | 173 | * |
174 | 174 | * @var int $memoryCachingCounter |
175 | 175 | */ |
176 | - protected $_memoryCachingCounter = 0; |
|
176 | + protected $_memoryCachingCounter=0; |
|
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Memory caching limit |
180 | 180 | * |
181 | 181 | * @var int $memoryCachingLimit |
182 | 182 | */ |
183 | - protected $_memoryCachingLimit = 1000; |
|
183 | + protected $_memoryCachingLimit=1000; |
|
184 | 184 | |
185 | 185 | /** |
186 | 186 | * File Name protection |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @var boolean $fileNameProtection |
194 | 194 | */ |
195 | - protected $_fileNameProtection = true; |
|
195 | + protected $_fileNameProtection=true; |
|
196 | 196 | |
197 | 197 | /** |
198 | 198 | * Enable / disable automatic serialization |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @var boolean $_serialize |
204 | 204 | */ |
205 | - protected $_automaticSerialization = false; |
|
205 | + protected $_automaticSerialization=false; |
|
206 | 206 | |
207 | 207 | // --- Public methods --- |
208 | 208 | |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | * @param array $options options |
229 | 229 | * @access public |
230 | 230 | */ |
231 | - function __construct($options = array(null)) |
|
231 | + function __construct($options=array(null)) |
|
232 | 232 | { |
233 | - $availableOptions = array( 'automaticSerialization', |
|
233 | + $availableOptions=array('automaticSerialization', |
|
234 | 234 | 'fileNameProtection', |
235 | 235 | 'memoryCaching', |
236 | 236 | 'onlyMemoryCaching', |
@@ -244,11 +244,11 @@ discard block |
||
244 | 244 | 'readControlType'); |
245 | 245 | foreach($options as $key => $value) { |
246 | 246 | if(in_array($key, $availableOptions)) { |
247 | - $property = '_'.$key; |
|
248 | - $this->$property = $value; |
|
247 | + $property='_'.$key; |
|
248 | + $this->$property=$value; |
|
249 | 249 | } |
250 | 250 | } |
251 | - $this->_refreshTime = time() - $this->_lifeTime; |
|
251 | + $this->_refreshTime=time() - $this->_lifeTime; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -261,41 +261,41 @@ discard block |
||
261 | 261 | * @return string data of the cache (or false if no cache available) |
262 | 262 | * @access public |
263 | 263 | */ |
264 | - function get($id, $group = 'default', $doNotTestCacheValidity = false) |
|
264 | + function get($id, $group='default', $doNotTestCacheValidity=false) |
|
265 | 265 | { |
266 | - $this->_id = $id; |
|
267 | - $this->_group = $group; |
|
268 | - $data = false; |
|
269 | - if ($this->_caching) { |
|
266 | + $this->_id=$id; |
|
267 | + $this->_group=$group; |
|
268 | + $data=false; |
|
269 | + if($this->_caching) { |
|
270 | 270 | $this->_setFileName($id, $group); |
271 | - if ($this->_memoryCaching) { |
|
272 | - if (isset($this->_memoryCachingArray[$this->_file])) { |
|
273 | - if ($this->_automaticSerialization) { |
|
271 | + if($this->_memoryCaching) { |
|
272 | + if(isset($this->_memoryCachingArray[$this->_file])) { |
|
273 | + if($this->_automaticSerialization) { |
|
274 | 274 | return unserialize( |
275 | 275 | $this->_memoryCachingArray[$this->_file]); |
276 | 276 | } else { |
277 | 277 | return $this->_memoryCachingArray[$this->_file]; |
278 | 278 | } |
279 | 279 | } else { |
280 | - if ($this->_onlyMemoryCaching) { |
|
280 | + if($this->_onlyMemoryCaching) { |
|
281 | 281 | return false; |
282 | 282 | } |
283 | 283 | } |
284 | 284 | } |
285 | - if ($doNotTestCacheValidity) { |
|
286 | - if (file_exists($this->_file)) { |
|
287 | - $data = $this->_read(); |
|
285 | + if($doNotTestCacheValidity) { |
|
286 | + if(file_exists($this->_file)) { |
|
287 | + $data=$this->_read(); |
|
288 | 288 | } |
289 | 289 | } else { |
290 | - if (@filemtime($this->_file) > $this->_refreshTime) { |
|
291 | - $data = $this->_read(); |
|
290 | + if(@filemtime($this->_file) > $this->_refreshTime) { |
|
291 | + $data=$this->_read(); |
|
292 | 292 | } |
293 | 293 | } |
294 | - if (($data) and ($this->_memoryCaching)) { |
|
294 | + if(($data) and ($this->_memoryCaching)) { |
|
295 | 295 | $this->_memoryCacheAdd($this->_file, $data); |
296 | 296 | } |
297 | - if ($this->_automaticSerialization && is_string($data)) { |
|
298 | - $data = unserialize($data); |
|
297 | + if($this->_automaticSerialization && is_string($data)) { |
|
298 | + $data=unserialize($data); |
|
299 | 299 | } |
300 | 300 | return $data; |
301 | 301 | } |
@@ -312,24 +312,24 @@ discard block |
||
312 | 312 | * @return boolean true if no problem |
313 | 313 | * @access public |
314 | 314 | */ |
315 | - function save($data, $id = null, $group = 'default') |
|
315 | + function save($data, $id=null, $group='default') |
|
316 | 316 | { |
317 | - if ($this->_caching) { |
|
318 | - if ($this->_automaticSerialization) { |
|
319 | - $data = serialize($data); |
|
317 | + if($this->_caching) { |
|
318 | + if($this->_automaticSerialization) { |
|
319 | + $data=serialize($data); |
|
320 | 320 | } |
321 | - if (isset($id)) { |
|
321 | + if(isset($id)) { |
|
322 | 322 | $this->_setFileName($id, $group); |
323 | 323 | } |
324 | - if ($this->_memoryCaching) { |
|
324 | + if($this->_memoryCaching) { |
|
325 | 325 | $this->_memoryCacheAdd($this->_file, $data); |
326 | - if ($this->_onlyMemoryCaching) { |
|
326 | + if($this->_onlyMemoryCaching) { |
|
327 | 327 | return true; |
328 | 328 | } |
329 | 329 | } |
330 | - if ($this->_writeControl) { |
|
331 | - if (!$this->_writeAndControl($data)) { |
|
332 | - @touch($this->_file, time() - 2*abs($this->_lifeTime)); |
|
330 | + if($this->_writeControl) { |
|
331 | + if(!$this->_writeAndControl($data)) { |
|
332 | + @touch($this->_file, time() - 2 * abs($this->_lifeTime)); |
|
333 | 333 | return false; |
334 | 334 | } else { |
335 | 335 | return true; |
@@ -349,10 +349,10 @@ discard block |
||
349 | 349 | * @return boolean true if no problem |
350 | 350 | * @access public |
351 | 351 | */ |
352 | - function remove($id, $group = 'default') |
|
352 | + function remove($id, $group='default') |
|
353 | 353 | { |
354 | 354 | $this->_setFileName($id, $group); |
355 | - if (!@unlink($this->_file)) { |
|
355 | + if(!@unlink($this->_file)) { |
|
356 | 356 | $this->raiseError('TCache_Lite : Unable to remove cache !', -3); |
357 | 357 | return false; |
358 | 358 | } |
@@ -369,35 +369,35 @@ discard block |
||
369 | 369 | * @return boolean true if no problem |
370 | 370 | * @access public |
371 | 371 | */ |
372 | - function clean($group = false) |
|
372 | + function clean($group=false) |
|
373 | 373 | { |
374 | - if ($this->_fileNameProtection) { |
|
375 | - $motif = ($group) ? 'cache_'.md5($group).'_' : 'cache_'; |
|
374 | + if($this->_fileNameProtection) { |
|
375 | + $motif=($group) ? 'cache_'.md5($group).'_' : 'cache_'; |
|
376 | 376 | } else { |
377 | - $motif = ($group) ? 'cache_'.$group.'_' : 'cache_'; |
|
377 | + $motif=($group) ? 'cache_'.$group.'_' : 'cache_'; |
|
378 | 378 | } |
379 | - if ($this->_memoryCaching) { |
|
380 | - while (list($key, $value) = each($this->_memoryCaching)) { |
|
381 | - if (strpos($key, $motif, 0)) { |
|
379 | + if($this->_memoryCaching) { |
|
380 | + while(list($key, $value)=each($this->_memoryCaching)) { |
|
381 | + if(strpos($key, $motif, 0)) { |
|
382 | 382 | unset($this->_memoryCaching[$key]); |
383 | - $this->_memoryCachingCounter = |
|
383 | + $this->_memoryCachingCounter= |
|
384 | 384 | $this->_memoryCachingCounter - 1; |
385 | 385 | } |
386 | 386 | } |
387 | - if ($this->_onlyMemoryCaching) { |
|
387 | + if($this->_onlyMemoryCaching) { |
|
388 | 388 | return true; |
389 | 389 | } |
390 | 390 | } |
391 | - if (!($dh = opendir($this->_cacheDir))) { |
|
391 | + if(!($dh=opendir($this->_cacheDir))) { |
|
392 | 392 | $this->raiseError('TCache_Lite : Unable to open cache directory !'); |
393 | 393 | return false; |
394 | 394 | } |
395 | - while ($file = readdir($dh)) { |
|
396 | - if (($file != '.') && ($file != '..')) { |
|
397 | - $file = $this->_cacheDir . $file; |
|
398 | - if (is_file($file)) { |
|
399 | - if (strpos($file, $motif, 0)) { |
|
400 | - if (!@unlink($file)) { |
|
395 | + while($file=readdir($dh)) { |
|
396 | + if(($file!='.') && ($file!='..')) { |
|
397 | + $file=$this->_cacheDir.$file; |
|
398 | + if(is_file($file)) { |
|
399 | + if(strpos($file, $motif, 0)) { |
|
400 | + if(!@unlink($file)) { |
|
401 | 401 | $this->raiseError('Cache_Lite : Unable to remove cache !', -3); |
402 | 402 | return false; |
403 | 403 | } |
@@ -416,22 +416,22 @@ discard block |
||
416 | 416 | */ |
417 | 417 | function setLifeTime($newLifeTime) |
418 | 418 | { |
419 | - $this->_lifeTime = $newLifeTime; |
|
420 | - $this->_refreshTime = time() - $newLifeTime; |
|
419 | + $this->_lifeTime=$newLifeTime; |
|
420 | + $this->_refreshTime=time() - $newLifeTime; |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
424 | 424 | * |
425 | 425 | * @access public |
426 | 426 | */ |
427 | - function saveMemoryCachingState($id, $group = 'default') |
|
427 | + function saveMemoryCachingState($id, $group='default') |
|
428 | 428 | { |
429 | - if ($this->_caching) { |
|
430 | - $array = array( |
|
429 | + if($this->_caching) { |
|
430 | + $array=array( |
|
431 | 431 | 'counter' => $this->_memoryCachingCounter, |
432 | 432 | 'array' => $this->_memoryCachingState |
433 | 433 | ); |
434 | - $data = serialize($array); |
|
434 | + $data=serialize($array); |
|
435 | 435 | $this->save($data, $id, $group); |
436 | 436 | } |
437 | 437 | } |
@@ -440,15 +440,15 @@ discard block |
||
440 | 440 | * |
441 | 441 | * @access public |
442 | 442 | */ |
443 | - function getMemoryCachingState($id, $group = 'default', |
|
444 | - $doNotTestCacheValidity = false) |
|
443 | + function getMemoryCachingState($id, $group='default', |
|
444 | + $doNotTestCacheValidity=false) |
|
445 | 445 | { |
446 | - if ($this->_caching) { |
|
447 | - if ($data = $this->get($id, $group, $doNotTestCacheValidity)) |
|
446 | + if($this->_caching) { |
|
447 | + if($data=$this->get($id, $group, $doNotTestCacheValidity)) |
|
448 | 448 | { |
449 | - $array = unserialize($data); |
|
450 | - $this->_memoryCachingCounter = $array['counter']; |
|
451 | - $this->_memoryCachingArray = $array['array']; |
|
449 | + $array=unserialize($data); |
|
450 | + $this->_memoryCachingCounter=$array['counter']; |
|
451 | + $this->_memoryCachingArray=$array['array']; |
|
452 | 452 | } |
453 | 453 | } |
454 | 454 | } |
@@ -488,12 +488,12 @@ discard block |
||
488 | 488 | */ |
489 | 489 | function _memoryCacheAdd($id, $data) |
490 | 490 | { |
491 | - $this->_memoryCachingArray[$this->_file] = $data; |
|
492 | - if ($this->_memoryCachingCounter >= $this->_memoryCachingLimit) { |
|
493 | - list($key, $value) = each($this->_memoryCachingArray); |
|
491 | + $this->_memoryCachingArray[$this->_file]=$data; |
|
492 | + if($this->_memoryCachingCounter >= $this->_memoryCachingLimit) { |
|
493 | + list($key, $value)=each($this->_memoryCachingArray); |
|
494 | 494 | unset($this->_memoryCachingArray[$key]); |
495 | 495 | } else { |
496 | - $this->_memoryCachingCounter = $this->_memoryCachingCounter + 1; |
|
496 | + $this->_memoryCachingCounter=$this->_memoryCachingCounter + 1; |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | |
@@ -506,11 +506,11 @@ discard block |
||
506 | 506 | */ |
507 | 507 | function _setFileName($id, $group) |
508 | 508 | { |
509 | - if ($this->_fileNameProtection) { |
|
510 | - $this->_file = ($this->_cacheDir.'cache_'.md5($group).'_' |
|
509 | + if($this->_fileNameProtection) { |
|
510 | + $this->_file=($this->_cacheDir.'cache_'.md5($group).'_' |
|
511 | 511 | .md5($id)); |
512 | 512 | } else { |
513 | - $this->_file = $this->_cacheDir.'cache_'.$group.'_'.$id; |
|
513 | + $this->_file=$this->_cacheDir.'cache_'.$group.'_'.$id; |
|
514 | 514 | } |
515 | 515 | } |
516 | 516 | |
@@ -527,23 +527,23 @@ discard block |
||
527 | 527 | */ |
528 | 528 | function _read() |
529 | 529 | { |
530 | - $fp = @fopen($this->_file, "rb"); |
|
531 | - if ($this->_fileLocking) @flock($fp, LOCK_SH); |
|
532 | - if ($fp) { |
|
530 | + $fp=@fopen($this->_file, "rb"); |
|
531 | + if($this->_fileLocking) @flock($fp, LOCK_SH); |
|
532 | + if($fp) { |
|
533 | 533 | // because the filesize can be cached by PHP itself... |
534 | 534 | clearstatcache(); |
535 | - $length = @filesize($this->_file); |
|
536 | - if ($this->_readControl) { |
|
537 | - $hashControl = @fread($fp, 32); |
|
538 | - $length = $length - 32; |
|
535 | + $length=@filesize($this->_file); |
|
536 | + if($this->_readControl) { |
|
537 | + $hashControl=@fread($fp, 32); |
|
538 | + $length=$length - 32; |
|
539 | 539 | } |
540 | - $data = @fread($fp, $length); |
|
541 | - if ($this->_fileLocking) @flock($fp, LOCK_UN); |
|
540 | + $data=@fread($fp, $length); |
|
541 | + if($this->_fileLocking) @flock($fp, LOCK_UN); |
|
542 | 542 | @fclose($fp); |
543 | - if ($this->_readControl) { |
|
544 | - $hashData = $this->_hash($data, $this->_readControlType); |
|
545 | - if ($hashData != $hashControl) { |
|
546 | - @touch($this->_file, time() - 2*abs($this->_lifeTime)); |
|
543 | + if($this->_readControl) { |
|
544 | + $hashData=$this->_hash($data, $this->_readControlType); |
|
545 | + if($hashData!=$hashControl) { |
|
546 | + @touch($this->_file, time() - 2 * abs($this->_lifeTime)); |
|
547 | 547 | return false; |
548 | 548 | } |
549 | 549 | } |
@@ -562,15 +562,15 @@ discard block |
||
562 | 562 | */ |
563 | 563 | function _write($data) |
564 | 564 | { |
565 | - $fp = @fopen($this->_file, "wb"); |
|
566 | - if ($fp) { |
|
567 | - if ($this->_fileLocking) @flock($fp, LOCK_EX); |
|
568 | - if ($this->_readControl) { |
|
565 | + $fp=@fopen($this->_file, "wb"); |
|
566 | + if($fp) { |
|
567 | + if($this->_fileLocking) @flock($fp, LOCK_EX); |
|
568 | + if($this->_readControl) { |
|
569 | 569 | @fwrite($fp, $this->_hash($data, $this->_readControlType), 32); |
570 | 570 | } |
571 | - $len = strlen($data); |
|
571 | + $len=strlen($data); |
|
572 | 572 | @fwrite($fp, $data, $len); |
573 | - if ($this->_fileLocking) @flock($fp, LOCK_UN); |
|
573 | + if($this->_fileLocking) @flock($fp, LOCK_UN); |
|
574 | 574 | @fclose($fp); |
575 | 575 | return true; |
576 | 576 | } |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | function _writeAndControl($data) |
590 | 590 | { |
591 | 591 | $this->_write($data); |
592 | - $dataRead = $this->_read($data); |
|
592 | + $dataRead=$this->_read($data); |
|
593 | 593 | return ($dataRead==$data); |
594 | 594 | } |
595 | 595 | |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | */ |
604 | 604 | function _hash($data, $controlType) |
605 | 605 | { |
606 | - switch ($controlType) { |
|
606 | + switch($controlType) { |
|
607 | 607 | case 'md5': |
608 | 608 | return md5($data); |
609 | 609 | case 'crc32': |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function getMediaType() |
84 | 84 | { |
85 | - return $this->getViewState('MediaType',''); |
|
85 | + return $this->getViewState('MediaType', ''); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function setMediaType($value) |
92 | 92 | { |
93 | - $this->setViewState('MediaType',$value,''); |
|
93 | + $this->setViewState('MediaType', $value, ''); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -100,17 +100,17 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function onPreRender($param) |
102 | 102 | { |
103 | - $cs = $this->getPage()->getClientScript(); |
|
103 | + $cs=$this->getPage()->getClientScript(); |
|
104 | 104 | |
105 | - $styles = preg_split('/,|\s+/', $this->getPradoStyles()); |
|
105 | + $styles=preg_split('/,|\s+/', $this->getPradoStyles()); |
|
106 | 106 | foreach($styles as $style) |
107 | 107 | { |
108 | - if(($style = trim($style))!=='') |
|
108 | + if(($style=trim($style))!=='') |
|
109 | 109 | $cs->registerPradoStyle($style); |
110 | 110 | } |
111 | 111 | |
112 | 112 | if(($url=$this->getStyleSheetUrl())!=='') |
113 | - $cs->registerStyleSheetFile($url,$url,$this->getMediaType()); |
|
113 | + $cs->registerStyleSheetFile($url, $url, $this->getMediaType()); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * Array of translation messages. |
82 | 82 | * @var array |
83 | 83 | */ |
84 | - protected $messages = array(); |
|
84 | + protected $messages=array(); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * The source of message translations. |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | protected $cache; |
97 | 97 | |
98 | - protected $untranslated = array(); |
|
98 | + protected $untranslated=array(); |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Private constructor. MessageSource must be initialized using |
@@ -127,23 +127,23 @@ discard block |
||
127 | 127 | */ |
128 | 128 | static function &factory($type, $source='.', $filename='') |
129 | 129 | { |
130 | - $types = array('XLIFF','gettext','Database','SQLite'); |
|
130 | + $types=array('XLIFF', 'gettext', 'Database', 'SQLite'); |
|
131 | 131 | |
132 | 132 | if(empty($filename) && !in_array($type, $types)) |
133 | 133 | throw new Exception('Invalid type "'.$type.'", valid types are '. |
134 | 134 | implode(', ', $types)); |
135 | 135 | |
136 | - $class = 'MessageSource_'.$type; |
|
136 | + $class='MessageSource_'.$type; |
|
137 | 137 | |
138 | 138 | if(empty($filename)) |
139 | - $filename = dirname(__FILE__).'/'.$class.'.php'; |
|
139 | + $filename=dirname(__FILE__).'/'.$class.'.php'; |
|
140 | 140 | |
141 | - if(is_file($filename) == false) |
|
141 | + if(is_file($filename)==false) |
|
142 | 142 | throw new Exception("File $filename not found"); |
143 | 143 | |
144 | 144 | include_once $filename; |
145 | 145 | |
146 | - $obj = new $class($source); |
|
146 | + $obj=new $class($source); |
|
147 | 147 | |
148 | 148 | return $obj; |
149 | 149 | } |
@@ -169,36 +169,36 @@ discard block |
||
169 | 169 | */ |
170 | 170 | function load($catalogue='messages') |
171 | 171 | { |
172 | - $variants = $this->getCatalogueList($catalogue); |
|
172 | + $variants=$this->getCatalogueList($catalogue); |
|
173 | 173 | |
174 | - $this->messages = array(); |
|
174 | + $this->messages=array(); |
|
175 | 175 | |
176 | 176 | foreach($variants as $variant) |
177 | 177 | { |
178 | - $source = $this->getSource($variant); |
|
178 | + $source=$this->getSource($variant); |
|
179 | 179 | |
180 | - if($this->isValidSource($source) == false) continue; |
|
180 | + if($this->isValidSource($source)==false) continue; |
|
181 | 181 | |
182 | - $loadData = true; |
|
182 | + $loadData=true; |
|
183 | 183 | |
184 | 184 | if($this->cache) |
185 | 185 | { |
186 | - $data = $this->cache->get($variant, |
|
186 | + $data=$this->cache->get($variant, |
|
187 | 187 | $this->culture, $this->getLastModified($source)); |
188 | 188 | |
189 | 189 | if(is_array($data)) |
190 | 190 | { |
191 | - $this->messages[$variant] = $data; |
|
192 | - $loadData = false; |
|
191 | + $this->messages[$variant]=$data; |
|
192 | + $loadData=false; |
|
193 | 193 | } |
194 | 194 | unset($data); |
195 | 195 | } |
196 | 196 | if($loadData) |
197 | 197 | { |
198 | - $data = &$this->loadData($source); |
|
198 | + $data=&$this->loadData($source); |
|
199 | 199 | if(is_array($data)) |
200 | 200 | { |
201 | - $this->messages[$variant] = $data; |
|
201 | + $this->messages[$variant]=$data; |
|
202 | 202 | if($this->cache) |
203 | 203 | $this->cache->save($data, $variant, $this->culture); |
204 | 204 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public function setCache(MessageCache $cache) |
236 | 236 | { |
237 | - $this->cache = $cache; |
|
237 | + $this->cache=$cache; |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | public function append($message) |
246 | 246 | { |
247 | 247 | if(!in_array($message, $this->untranslated)) |
248 | - $this->untranslated[] = $message; |
|
248 | + $this->untranslated[]=$message; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function setCulture($culture) |
256 | 256 | { |
257 | - $this->culture = $culture; |
|
257 | + $this->culture=$culture; |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function __construct($component) |
48 | 48 | { |
49 | - if(is_string($component) && class_exists($component,false)) |
|
49 | + if(is_string($component) && class_exists($component, false)) |
|
50 | 50 | $this->_className=$component; |
51 | 51 | else if(is_object($component)) |
52 | 52 | $this->_className=get_class($component); |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | { |
60 | 60 | $methodName=$method->getName(); |
61 | 61 | return $method->getNumberOfRequiredParameters()===0 |
62 | - && strncasecmp($methodName,'get',3)===0 |
|
62 | + && strncasecmp($methodName, 'get', 3)===0 |
|
63 | 63 | && isset($methodName[3]); |
64 | 64 | } |
65 | 65 | |
66 | 66 | private function isEventMethod($method) |
67 | 67 | { |
68 | 68 | $methodName=$method->getName(); |
69 | - return strncasecmp($methodName,'on',2)===0 |
|
69 | + return strncasecmp($methodName, 'on', 2)===0 |
|
70 | 70 | && isset($methodName[2]); |
71 | 71 | } |
72 | 72 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $properties=array(); |
77 | 77 | $events=array(); |
78 | 78 | $methods=array(); |
79 | - $isComponent=is_subclass_of($this->_className,'TComponent') || strcasecmp($this->_className,'TComponent')===0; |
|
79 | + $isComponent=is_subclass_of($this->_className, 'TComponent') || strcasecmp($this->_className, 'TComponent')===0; |
|
80 | 80 | foreach($class->getMethods() as $method) |
81 | 81 | { |
82 | 82 | if($method->isPublic() || $method->isProtected()) |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | if(!$method->isStatic() && $isComponent) |
86 | 86 | { |
87 | 87 | if($this->isPropertyMethod($method)) |
88 | - $properties[substr($methodName,3)]=$method; |
|
88 | + $properties[substr($methodName, 3)]=$method; |
|
89 | 89 | else if($this->isEventMethod($method)) |
90 | 90 | { |
91 | 91 | $methodName[0]='O'; |
92 | 92 | $events[$methodName]=$method; |
93 | 93 | } |
94 | 94 | } |
95 | - if(strncmp($methodName,'__',2)!==0) |
|
95 | + if(strncmp($methodName, '__', 2)!==0) |
|
96 | 96 | $methods[$methodName]=$method; |
97 | 97 | } |
98 | 98 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | protected function determinePropertyType($method) |
143 | 143 | { |
144 | 144 | $comment=$method->getDocComment(); |
145 | - if(preg_match('/@return\\s+(.*?)\\s+/',$comment,$matches)) |
|
145 | + if(preg_match('/@return\\s+(.*?)\\s+/', $comment, $matches)) |
|
146 | 146 | return $matches[1]; |
147 | 147 | else |
148 | 148 | return '{unknown}'; |
@@ -63,7 +63,7 @@ |
||
63 | 63 | * @param string password |
64 | 64 | * @return boolean whether the validation succeeds |
65 | 65 | */ |
66 | - abstract public function validateUser($username,$password); |
|
66 | + abstract public function validateUser($username, $password); |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Creates a new user instance given the username. |