Completed
Push — prado-3.3 ( f4da81...5dd4b5 )
by Fabio
09:03
created
framework/Security/TUserManager.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		{
112 112
 			if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
113 113
 			{
114
-				$userFile = include $this->_userFile;
114
+				$userFile=include $this->_userFile;
115 115
 				$this->loadUserDataFromPhp($userFile);
116 116
 			}
117 117
 			else
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
 		{
147 147
 			foreach($config['users'] as $user)
148 148
 			{
149
-				$name = trim(strtolower(isset($user['name'])?$user['name']:''));
150
-				$password = isset($user['password'])?$user['password']:'';
151
-				$this->_users[$name] = $password;
152
-				$roles = isset($user['roles'])?$user['roles']:'';
149
+				$name=trim(strtolower(isset($user['name']) ? $user['name'] : ''));
150
+				$password=isset($user['password']) ? $user['password'] : '';
151
+				$this->_users[$name]=$password;
152
+				$roles=isset($user['roles']) ? $user['roles'] : '';
153 153
 				if($roles!=='')
154 154
 				{
155
-					foreach(explode(',',$roles) as $role)
155
+					foreach(explode(',', $roles) as $role)
156 156
 					{
157 157
 						if(($role=trim($role))!=='')
158 158
 							$this->_roles[$name][]=$role;
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 		{
165 165
 			foreach($config['roles'] as $role)
166 166
 			{
167
-				$name = isset($role['name'])?$role['name']:'';
168
-				$users = isset($role['users'])?$role['users']:'';
169
-				foreach(explode(',',$users) as $user)
167
+				$name=isset($role['name']) ? $role['name'] : '';
168
+				$users=isset($role['users']) ? $role['users'] : '';
169
+				foreach(explode(',', $users) as $user)
170 170
 				{
171 171
 					if(($user=trim($user))!=='')
172 172
 						$this->_roles[strtolower($user)][]=$name;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 			$this->_users[$name]=$node->getAttribute('password');
188 188
 			if(($roles=trim($node->getAttribute('roles')))!=='')
189 189
 			{
190
-				foreach(explode(',',$roles) as $role)
190
+				foreach(explode(',', $roles) as $role)
191 191
 				{
192 192
 					if(($role=trim($role))!=='')
193 193
 						$this->_roles[$name][]=$role;
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 		}
197 197
 		foreach($xmlNode->getElementsByTagName('role') as $node)
198 198
 		{
199
-			foreach(explode(',',$node->getAttribute('users')) as $user)
199
+			foreach(explode(',', $node->getAttribute('users')) as $user)
200 200
 			{
201 201
 				if(($user=trim($user))!=='')
202 202
 					$this->_roles[strtolower($user)][]=$node->getAttribute('name');
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
 	{
247 247
 		if($this->_initialized)
248 248
 			throw new TInvalidOperationException('usermanager_userfile_unchangeable');
249
-		else if(($this->_userFile=Prado::getPathOfNamespace($value,self::USER_FILE_EXT))===null || !is_file($this->_userFile))
250
-			throw new TConfigurationException('usermanager_userfile_invalid',$value);
249
+		else if(($this->_userFile=Prado::getPathOfNamespace($value, self::USER_FILE_EXT))===null || !is_file($this->_userFile))
250
+			throw new TConfigurationException('usermanager_userfile_invalid', $value);
251 251
 	}
252 252
 
253 253
 	/**
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	public function setPasswordMode($value)
281 281
 	{
282
-		$this->_passwordMode=TPropertyValue::ensureEnum($value,'TUserManagerPasswordMode');
282
+		$this->_passwordMode=TPropertyValue::ensureEnum($value, 'TUserManagerPasswordMode');
283 283
 	}
284 284
 
285 285
 	/**
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	 * @param string password
289 289
 	 * @return boolean true if validation is successful, false otherwise.
290 290
 	 */
291
-	public function validateUser($username,$password)
291
+	public function validateUser($username, $password)
292 292
 	{
293 293
 		if($this->_passwordMode===TUserManagerPasswordMode::MD5)
294 294
 			$password=md5($password);
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 			$data=unserialize($data);
342 342
 			if(is_array($data) && count($data)===2)
343 343
 			{
344
-				list($username,$token)=$data;
344
+				list($username, $token)=$data;
345 345
 				if(isset($this->_users[$username]) && $token===md5($username.$this->_users[$username]))
346 346
 					return $this->getUser($username);
347 347
 			}
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 		$username=strtolower($user->getName());
361 361
 		if(isset($this->_users[$username]))
362 362
 		{
363
-			$data=array($username,md5($username.$this->_users[$username]));
363
+			$data=array($username, md5($username.$this->_users[$username]));
364 364
 			$cookie->setValue(serialize($data));
365 365
 		}
366 366
 	}
Please login to merge, or discard this patch.
framework/I18N/TTranslateParameter.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * To trim or not to trim the contents.
51 51
 	 * @var boolean
52 52
 	 */
53
-	protected $trim = true;
53
+	protected $trim=true;
54 54
 
55 55
 
56 56
 	/**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public function setKey($value)
72 72
 	{
73
-		$this->key = $value;
73
+		$this->key=$value;
74 74
 	}
75 75
 
76 76
 	/**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function setTrim($value)
81 81
 	{
82
-		$this->trim = TPropertyValue::ensureBoolean($value);
82
+		$this->trim=TPropertyValue::ensureBoolean($value);
83 83
 	}
84 84
 
85 85
 	/**
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function getParameter()
108 108
 	{
109
-		$value = $this->getValue();
109
+		$value=$this->getValue();
110 110
 		if(strlen($value) > 0)
111 111
 			return $value;
112
-		$htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
112
+		$htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
113 113
 		$this->renderControl($htmlWriter);
114 114
 		return $this->getTrim() ?
115 115
 			trim($htmlWriter->flush()) : $htmlWriter->flush();
Please login to merge, or discard this patch.
framework/I18N/core/MessageFormat.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -63,25 +63,25 @@  discard block
 block discarded – undo
63 63
 	 * A list of loaded message catalogues.
64 64
 	 * @var array 
65 65
 	 */
66
-	protected $catagloues = array();
66
+	protected $catagloues=array();
67 67
 	
68 68
 	/**
69 69
 	 * The translation messages.
70 70
 	 * @var array 
71 71
 	 */
72
-	protected $messages = array();
72
+	protected $messages=array();
73 73
 	
74 74
 	/**
75 75
 	 * A list of untranslated messages.
76 76
 	 * @var array 
77 77
 	 */
78
-	protected $untranslated = array();
78
+	protected $untranslated=array();
79 79
 	
80 80
 	/**
81 81
 	 * The prefix and suffix to append to untranslated messages.
82 82
 	 * @var array 
83 83
 	 */
84
-	protected $postscript = array('','');
84
+	protected $postscript=array('', '');
85 85
 	
86 86
 	/**
87 87
 	 * Set the default catalogue.
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * Output encoding charset
94 94
 	 * @var string
95 95
 	 */
96
-	protected $charset = 'UTF-8'; 
96
+	protected $charset='UTF-8'; 
97 97
 
98 98
 	/**
99 99
 	 * Constructor.
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	function __construct(IMessageSource $source, $charset='UTF-8')
106 106
 	{
107
-		$this->source = $source;	
107
+		$this->source=$source;	
108 108
 		$this->setCharset($charset);
109 109
 	}
110 110
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public function setCharset($charset)
116 116
 	{
117
-		$this->charset = $charset;
117
+		$this->charset=$charset;
118 118
 	}
119 119
 
120 120
 	/**
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	protected function loadCatalogue($catalogue)
137 137
 	{
138
-		if(in_array($catalogue,$this->catagloues))
138
+		if(in_array($catalogue, $this->catagloues))
139 139
 			return;
140 140
 			
141 141
 		if($this->source->load($catalogue))
142 142
 		{
143
-			$this->messages[$catalogue] = $this->source->read();
144
-			$this->catagloues[] = $catalogue;						
143
+			$this->messages[$catalogue]=$this->source->read();
144
+			$this->catagloues[]=$catalogue;						
145 145
 		}
146 146
 	}
147 147
 
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
 	 * catalogue.
159 159
 	 * @return string translated string.
160 160
 	 */
161
-	public function format($string,$args=array(), $catalogue=null, $charset=null) 
161
+	public function format($string, $args=array(), $catalogue=null, $charset=null) 
162 162
 	{
163
-		if(empty($charset)) $charset = $this->getCharset();
163
+		if(empty($charset)) $charset=$this->getCharset();
164 164
 		
165 165
 		//force args as UTF-8
166 166
 		foreach($args as $k => $v)
167
-			$args[$k] = I18N_toUTF8($v, $charset);
168
-		$s = $this->formatString(I18N_toUTF8($string, $charset),$args,$catalogue);
167
+			$args[$k]=I18N_toUTF8($v, $charset);
168
+		$s=$this->formatString(I18N_toUTF8($string, $charset), $args, $catalogue);
169 169
 		return I18N_toEncoding($s, $charset);
170 170
 	}
171 171
 
@@ -182,15 +182,15 @@  discard block
 block discarded – undo
182 182
 		if(empty($catalogue))
183 183
 		{
184 184
 			if(empty($this->Catalogue))
185
-				$catalogue = 'messages';
185
+				$catalogue='messages';
186 186
 			else 
187
-				$catalogue = $this->Catalogue;
187
+				$catalogue=$this->Catalogue;
188 188
 		}
189 189
 				
190 190
 		$this->loadCatalogue($catalogue);
191 191
 		
192 192
 		if(empty($args))
193
-			$args = array();		
193
+			$args=array();		
194 194
 		
195 195
 		foreach($this->messages[$catalogue] as $variant)
196 196
 		{
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
 			foreach($variant as $source => $result)
199 199
 			{ 
200 200
 				// we found it, so return the target translation
201
-				if($source == $string)
201
+				if($source==$string)
202 202
 				{
203 203
 					//check if it contains only strings.
204 204
 					if(is_string($result))
205
-						$target = $result;
205
+						$target=$result;
206 206
 					else
207 207
 					{
208
-						$target = $result[0];
208
+						$target=$result[0];
209 209
 					}
210 210
 					//found, but untranslated
211 211
 					if(empty($target))
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 	 */
246 246
 	function setUntranslatedPS($postscript)
247 247
 	{
248
-		if(is_array($postscript) && count($postscript)>=2)
248
+		if(is_array($postscript) && count($postscript) >= 2)
249 249
 		{
250
-			$this->postscript[0] = $postscript[0];
251
-			$this->postscript[1] = $postscript[1];
250
+			$this->postscript[0]=$postscript[0];
251
+			$this->postscript[1]=$postscript[1];
252 252
 		}
253 253
 	}
254 254
 }
Please login to merge, or discard this patch.
framework/I18N/core/DateFormat.php 1 patch
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * A list of tokens and their function call.
52 52
 	 * @var array
53 53
 	 */
54
-	protected $tokens = array(
54
+	protected $tokens=array(
55 55
 			'G'=>'Era',
56 56
 			'y'=>'Year',
57 57
 			'M'=>'Month',
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * A list of methods, to be used by the token function calls.
76 76
 	 * @var array
77 77
 	 */
78
-	protected $methods = array();
78
+	protected $methods=array();
79 79
 
80 80
 	/**
81 81
 	 * The DateTimeFormatInfo, containing culture specific patterns and names.
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	function __construct($formatInfo=null)
93 93
 	{
94
-		if($formatInfo === null)
95
-			$this->formatInfo = DateTimeFormatInfo::getInvariantInfo();
94
+		if($formatInfo===null)
95
+			$this->formatInfo=DateTimeFormatInfo::getInvariantInfo();
96 96
 		else if($formatInfo instanceof CultureInfo)
97
-			$this->formatInfo = $formatInfo->DateTimeFormat;
97
+			$this->formatInfo=$formatInfo->DateTimeFormat;
98 98
 		else if($formatInfo instanceof DateTimeFormatInfo)
99
-			$this->formatInfo = $formatInfo;
99
+			$this->formatInfo=$formatInfo;
100 100
 		else
101
-			$this->formatInfo = DateTimeFormatInfo::getInstance($formatInfo);
101
+			$this->formatInfo=DateTimeFormatInfo::getInstance($formatInfo);
102 102
 
103
-		$this->methods = get_class_methods($this);
103
+		$this->methods=get_class_methods($this);
104 104
 	}
105 105
 
106 106
 	/**
@@ -110,45 +110,45 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function format($time, $pattern='F', $charset='UTF-8')
112 112
 	{
113
-		if (is_numeric($time)) //assumes unix epoch
114
-			$time = floatval($time);
113
+		if(is_numeric($time)) //assumes unix epoch
114
+			$time=floatval($time);
115 115
 		else if(is_string($time))
116
-			$time = @strtotime($time);
116
+			$time=@strtotime($time);
117 117
 
118
-		if($pattern === null)
119
-			$pattern = 'F';
118
+		if($pattern===null)
119
+			$pattern='F';
120 120
 
121
-		$s = Prado::createComponent('System.Util.TDateTimeStamp');
121
+		$s=Prado::createComponent('System.Util.TDateTimeStamp');
122 122
 
123
-		$date = $s->getDate($time);
123
+		$date=$s->getDate($time);
124 124
 
125
-		$pattern = $this->getPattern($pattern);
125
+		$pattern=$this->getPattern($pattern);
126 126
 
127
-		$tokens = $this->getTokens($pattern);
127
+		$tokens=$this->getTokens($pattern);
128 128
 
129
-		for($i = 0, $k = count($tokens); $i<$k; ++$i)
129
+		for($i=0, $k=count($tokens); $i < $k; ++$i)
130 130
 		{
131
-			$pattern = $tokens[$i];
132
-			if($pattern{0} == "'"
133
-				&& $pattern{strlen($pattern)-1} == "'")
131
+			$pattern=$tokens[$i];
132
+			if($pattern{0}=="'"
133
+				&& $pattern{strlen($pattern) - 1}=="'")
134 134
 			{
135
-				$sub = preg_replace('/(^\')|(\'$)/','',$pattern);
136
-				$tokens[$i] =  str_replace('``````','\'',$sub);
135
+				$sub=preg_replace('/(^\')|(\'$)/', '', $pattern);
136
+				$tokens[$i]=str_replace('``````', '\'', $sub);
137 137
 			}
138
-			else if($pattern == '``````')
138
+			else if($pattern=='``````')
139 139
 			{
140
-				$tokens[$i] = '\'';
140
+				$tokens[$i]='\'';
141 141
 			}
142 142
 			else
143 143
 			{
144
-				$function = $this->getFunctionName($pattern);
145
-				if($function != null)
144
+				$function=$this->getFunctionName($pattern);
145
+				if($function!=null)
146 146
 				{
147
-					$fName = 'get'.$function;
147
+					$fName='get'.$function;
148 148
 					if(in_array($fName, $this->methods))
149 149
 					{
150
-						$rs = $this->$fName($date, $pattern);
151
-						$tokens[$i] = $rs;
150
+						$rs=$this->$fName($date, $pattern);
151
+						$tokens[$i]=$rs;
152 152
 					}
153 153
 					else
154 154
 						throw new
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			}			
158 158
 		}
159 159
 
160
-		return I18N_toEncoding(implode('',$tokens), $charset);
160
+		return I18N_toEncoding(implode('', $tokens), $charset);
161 161
 	}
162 162
 
163 163
 	/**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	protected function getPattern($pattern)
186 186
 	{
187
-		if(is_array($pattern) && count($pattern) == 2)
187
+		if(is_array($pattern) && count($pattern)==2)
188 188
 		{
189 189
 			return $this->formatInfo->formatDateTime(
190 190
 							$this->getPattern($pattern[0]),
@@ -273,36 +273,36 @@  discard block
 block discarded – undo
273 273
 	 */
274 274
 	protected function getTokens($pattern)
275 275
 	{
276
-		$char = null;
277
-		$tokens = array();
278
-		$token = null;
276
+		$char=null;
277
+		$tokens=array();
278
+		$token=null;
279 279
 
280
-		$text = false;
281
-		$pattern = preg_replace("/''/", '``````', $pattern);
280
+		$text=false;
281
+		$pattern=preg_replace("/''/", '``````', $pattern);
282 282
 
283
-		for($i = 0; $i < strlen($pattern); $i++)
283
+		for($i=0; $i < strlen($pattern); $i++)
284 284
 		{
285
-			if($char==null || $pattern{$i} == $char || $text)
285
+			if($char==null || $pattern{$i}==$char || $text)
286 286
 			{
287
-				$token .= $pattern{$i};
287
+				$token.=$pattern{$i};
288 288
 			}
289 289
 			else
290 290
 			{
291
-				$tokens[] = str_replace("","'",$token);
292
-				$token = $pattern{$i};
291
+				$tokens[]=str_replace("", "'", $token);
292
+				$token=$pattern{$i};
293 293
 			}
294 294
 
295
-			if($pattern{$i} == "'" && $text == false)
296
-				$text = true;
297
-			else if($text && $pattern{$i} == "'" && $char == "'")
298
-				$text = true;
299
-			else if($text && $char != "'" && $pattern{$i} == "'")
300
-				$text = false;
295
+			if($pattern{$i}=="'" && $text==false)
296
+				$text=true;
297
+			else if($text && $pattern{$i}=="'" && $char=="'")
298
+				$text=true;
299
+			else if($text && $char!="'" && $pattern{$i}=="'")
300
+				$text=false;
301 301
 
302
-			$char = $pattern{$i};
302
+			$char=$pattern{$i};
303 303
 
304 304
 		}
305
-		$tokens[] = $token;
305
+		$tokens[]=$token;
306 306
 		return $tokens;
307 307
 	}
308 308
 
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 	 */
317 317
 	protected function getYear($date, $pattern='yyyy')
318 318
 	{
319
-		$year = $date['year'];
319
+		$year=$date['year'];
320 320
 		switch($pattern)
321 321
 		{
322 322
 			case 'yy':
323
-				return substr($year,2);
323
+				return substr($year, 2);
324 324
 			case 'yyyy':
325 325
 				return $year;
326 326
 			default:
@@ -340,19 +340,19 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	protected function getMonth($date, $pattern='M')
342 342
 	{
343
-		$month = $date['mon'];
343
+		$month=$date['mon'];
344 344
 
345 345
 		switch($pattern)
346 346
 		{
347 347
 			case 'M':
348 348
 				return $month;
349 349
 			case 'MM':
350
-				return str_pad($month, 2,'0',STR_PAD_LEFT);
350
+				return str_pad($month, 2, '0', STR_PAD_LEFT);
351 351
 			case 'MMM':
352
-				return $this->formatInfo->AbbreviatedMonthNames[$month-1];
352
+				return $this->formatInfo->AbbreviatedMonthNames[$month - 1];
353 353
 				break;
354 354
 			case 'MMMM':
355
-				return $this->formatInfo->MonthNames[$month-1];
355
+				return $this->formatInfo->MonthNames[$month - 1];
356 356
 			default:
357 357
 				throw new Exception('The pattern for month '.
358 358
 						'is "M", "MM", "MMM", or "MMMM".');
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	 */
372 372
 	protected function getDayInWeek($date, $pattern='EEEE')
373 373
 	{
374
-		$day = $date['wday'];
374
+		$day=$date['wday'];
375 375
 
376 376
 		switch($pattern)
377 377
 		{
@@ -401,14 +401,14 @@  discard block
 block discarded – undo
401 401
 	 */
402 402
 	protected function getDay($date, $pattern='d')
403 403
 	{
404
-		$day = $date['mday'];
404
+		$day=$date['mday'];
405 405
 
406 406
 		switch($pattern)
407 407
 		{
408 408
 			case 'd':
409 409
 				return $day;
410 410
 			case 'dd':
411
-				return str_pad($day, 2,'0',STR_PAD_LEFT);
411
+				return str_pad($day, 2, '0', STR_PAD_LEFT);
412 412
 			default:
413 413
 				throw new Exception('The pattern for day of '.
414 414
 						'the month is "d" or "dd".');
@@ -426,10 +426,10 @@  discard block
 block discarded – undo
426 426
 	protected function getEra($date, $pattern='G')
427 427
 	{
428 428
 
429
-		if($pattern != 'G')
429
+		if($pattern!='G')
430 430
 			throw new Exception('The pattern for era is "G".');
431 431
 
432
-		$year = $date['year'];
432
+		$year=$date['year'];
433 433
 		if($year > 0)
434 434
 			return $this->formatInfo->getEra(1);
435 435
 		else
@@ -445,14 +445,14 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	protected function getHour24($date, $pattern='H')
447 447
 	{
448
-		$hour = $date['hours'];
448
+		$hour=$date['hours'];
449 449
 
450 450
 		switch($pattern)
451 451
 		{
452 452
 			case 'H':
453 453
 				return $hour;
454 454
 			case 'HH':
455
-				return str_pad($hour, 2,'0',STR_PAD_LEFT);
455
+				return str_pad($hour, 2, '0', STR_PAD_LEFT);
456 456
 			default:
457 457
 				throw new Exception('The pattern for 24 hour '.
458 458
 						'format is "H" or "HH".');
@@ -467,11 +467,11 @@  discard block
 block discarded – undo
467 467
 	 */
468 468
 	protected function getAMPM($date, $pattern='a')
469 469
 	{
470
-		if($pattern != 'a')
470
+		if($pattern!='a')
471 471
 			throw new Exception('The pattern for AM/PM marker is "a".');
472 472
 
473
-		$hour = $date['hours'];
474
-		$ampm = (int)($hour/12);
473
+		$hour=$date['hours'];
474
+		$ampm=(int) ($hour / 12);
475 475
 		return $this->formatInfo->AMPMMarkers[$ampm];
476 476
 	}
477 477
 
@@ -484,15 +484,15 @@  discard block
 block discarded – undo
484 484
 	 */
485 485
 	protected function getHour12($date, $pattern='h')
486 486
 	{
487
-		$hour = $date['hours'];
488
-		$hour = ($hour==12|$hour==0)?12:($hour)%12;
487
+		$hour=$date['hours'];
488
+		$hour=($hour==12 | $hour==0) ? 12 : ($hour) % 12;
489 489
 
490 490
 		switch($pattern)
491 491
 		{
492 492
 			case 'h':
493 493
 				return $hour;
494 494
 			case 'hh':
495
-				return str_pad($hour, 2,'0',STR_PAD_LEFT);
495
+				return str_pad($hour, 2, '0', STR_PAD_LEFT);
496 496
 			default:
497 497
 				throw new Exception('The pattern for 24 hour '.
498 498
 						'format is "H" or "HH".');
@@ -508,14 +508,14 @@  discard block
 block discarded – undo
508 508
 	 */
509 509
 	protected function getMinutes($date, $pattern='m')
510 510
 	{
511
-		$minutes = $date['minutes'];
511
+		$minutes=$date['minutes'];
512 512
 
513 513
 		switch($pattern)
514 514
 		{
515 515
 			case 'm':
516 516
 				return $minutes;
517 517
 			case 'mm':
518
-				return str_pad($minutes, 2,'0',STR_PAD_LEFT);
518
+				return str_pad($minutes, 2, '0', STR_PAD_LEFT);
519 519
 			default:
520 520
 			throw new Exception('The pattern for minutes is "m" or "mm".');
521 521
 		}
@@ -530,14 +530,14 @@  discard block
 block discarded – undo
530 530
 	 */
531 531
 	protected function getSeconds($date, $pattern='s')
532 532
 	{
533
-		$seconds = $date['seconds'];
533
+		$seconds=$date['seconds'];
534 534
 
535 535
 		switch($pattern)
536 536
 		{
537 537
 			case 's':
538 538
 				return $seconds;
539 539
 			case 'ss':
540
-				return str_pad($seconds, 2,'0',STR_PAD_LEFT);
540
+				return str_pad($seconds, 2, '0', STR_PAD_LEFT);
541 541
 			default:
542 542
 			throw new Exception('The pattern for seconds is "s" or "ss".');
543 543
 		}
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 	 */
553 553
 	protected function getTimeZone($date, $pattern='z')
554 554
 	{
555
-		if($pattern != 'z')
555
+		if($pattern!='z')
556 556
 			throw new Exception('The pattern for time zone is "z".');
557 557
 
558 558
 		return @date('T', @mktime($date['hours'], $date['minutes'], $date['seconds'], $date['mon'], $date['mday'], $date['year']));
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 	 */
567 567
 	protected function getDayInYear($date, $pattern='D')
568 568
 	{
569
-		if($pattern != 'D')
569
+		if($pattern!='D')
570 570
 			throw new Exception('The pattern for day in year is "D".');
571 571
 
572 572
 		return $date['yday'];
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 	 */
581 581
 	protected function getDayInMonth($date, $pattern='FF')
582 582
 	{
583
-		switch ($pattern) {
583
+		switch($pattern) {
584 584
 		    case 'F':
585 585
 		      return @date('j', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']));
586 586
 		      break;
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 	 */
601 601
 	protected function getWeekInYear($date, $pattern='w')
602 602
 	{
603
-		if($pattern != 'w')
603
+		if($pattern!='w')
604 604
 			throw new Exception('The pattern for week in year is "w".');
605 605
 
606 606
 		return @date('W', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']));
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 	 */
614 614
 	protected function getWeekInMonth($date, $pattern='W')
615 615
 	{
616
-		if($pattern != 'W')
616
+		if($pattern!='W')
617 617
 			throw new Exception('The pattern for week in month is "W".');
618 618
 
619 619
 		return @date('W', @mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year'])) - date('W', mktime(0, 0, 0, $date['mon'], 1, $date['year']));
@@ -627,10 +627,10 @@  discard block
 block discarded – undo
627 627
 	 */
628 628
 	protected function getHourInDay($date, $pattern='k')
629 629
 	{
630
-		if($pattern != 'k')
630
+		if($pattern!='k')
631 631
 			throw new Exception('The pattern for hour in day is "k".');
632 632
 
633
-		return $date['hours']+1;
633
+		return $date['hours'] + 1;
634 634
 	}
635 635
 
636 636
 	/**
@@ -641,10 +641,10 @@  discard block
 block discarded – undo
641 641
 	 */
642 642
 	protected function getHourInAMPM($date, $pattern='K')
643 643
 	{
644
-		if($pattern != 'K')
644
+		if($pattern!='K')
645 645
 			throw new Exception('The pattern for hour in AM/PM is "K".');
646 646
 
647
-		return ($date['hours']+1)%12;
647
+		return ($date['hours'] + 1) % 12;
648 648
 	}
649 649
 
650 650
 }
Please login to merge, or discard this patch.
framework/I18N/core/MessageSource_Database.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	function __construct($source)
43 43
 	{
44
-		$this->_connID= (string)$source;
44
+		$this->_connID=(string) $source;
45 45
 	}
46 46
 
47 47
 	/**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			if($conn instanceof TDataSourceConfig)
72 72
 				return $conn->getDbConnection();
73 73
 			else
74
-				throw new TConfigurationException('messagesource_connectionid_invalid',$connectionID);
74
+				throw new TConfigurationException('messagesource_connectionid_invalid', $connectionID);
75 75
 		}
76 76
 		else
77 77
 			throw new TConfigurationException('messagesource_connectionid_required');
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 				WHERE c.cat_id =  t.cat_id
92 92
 					AND c.name = :variant
93 93
 				ORDER BY id ASC');
94
-		$command->bindParameter(':variant',$variant,PDO::PARAM_STR);
94
+		$command->bindParameter(':variant', $variant, PDO::PARAM_STR);
95 95
 		$dataReader=$command->query();
96 96
 
97
-		$result = array();
97
+		$result=array();
98 98
 
99
-		foreach ($dataReader as $row)
100
-			$result[$row['source']] = array($row['target'],$row['id'],$row['comments']);
99
+		foreach($dataReader as $row)
100
+			$result[$row['source']]=array($row['target'], $row['id'], $row['comments']);
101 101
 
102 102
 		return $result;
103 103
 	}
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	{
113 113
 		$command=$this->getDBConnection()->createCommand(
114 114
 			'SELECT date_modified FROM catalogue WHERE name = :source');
115
-		$command->bindParameter(':source',$source,PDO::PARAM_STR);
115
+		$command->bindParameter(':source', $source, PDO::PARAM_STR);
116 116
 		$result=$command->queryScalar();
117 117
 		return $result ? $result : 0;
118 118
 	}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	{
129 129
 		$command=$this->getDBConnection()->createCommand(
130 130
 			'SELECT COUNT(*) FROM catalogue WHERE name = :variant');
131
-		$command->bindParameter(':variant',$variant,PDO::PARAM_STR);
131
+		$command->bindParameter(':variant', $variant, PDO::PARAM_STR);
132 132
 		return $command->queryScalar()==1;
133 133
 	}
134 134
 
@@ -139,18 +139,18 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	protected function getCatalogueList($catalogue)
141 141
 	{
142
-		$variants = explode('_',$this->culture);
142
+		$variants=explode('_', $this->culture);
143 143
 
144
-		$catalogues = array($catalogue);
144
+		$catalogues=array($catalogue);
145 145
 
146
-		$variant = null;
146
+		$variant=null;
147 147
 
148
-		for($i = 0, $k = count($variants); $i < $k; ++$i)
148
+		for($i=0, $k=count($variants); $i < $k; ++$i)
149 149
 		{
150 150
 			if(isset($variants[$i]{0}))
151 151
 			{
152
-				$variant .= ($variant)?'_'.$variants[$i]:$variants[$i];
153
-				$catalogues[] = $catalogue.'.'.$variant;
152
+				$variant.=($variant) ? '_'.$variants[$i] : $variants[$i];
153
+				$catalogues[]=$catalogue.'.'.$variant;
154 154
 			}
155 155
 		}
156 156
 		return array_reverse($catalogues);
@@ -164,20 +164,20 @@  discard block
 block discarded – undo
164 164
 	private function getCatalogueDetails($catalogue='messages')
165 165
 	{
166 166
 		if(empty($catalogue))
167
-			$catalogue = 'messages';
167
+			$catalogue='messages';
168 168
 
169
-		$variant = $catalogue.'.'.$this->culture;
169
+		$variant=$catalogue.'.'.$this->culture;
170 170
 
171 171
 		$command=$this->getDBConnection()->createCommand(
172 172
 			'SELECT cat_id FROM catalogue WHERE name = :variant');
173
-		$command->bindParameter(':variant',$variant,PDO::PARAM_STR);
173
+		$command->bindParameter(':variant', $variant, PDO::PARAM_STR);
174 174
 		$cat_id=$command->queryScalar();
175 175
 
176
-		if ($cat_id===null) return false;
176
+		if($cat_id===null) return false;
177 177
 
178 178
 		$command=$this->getDBConnection()->createCommand(
179 179
 			'SELECT COUNT(msg_id) FROM trans_unit WHERE cat_id = :catid ');
180
-		$command->bindParameter(':catid',$cat_id,PDO::PARAM_INT);
180
+		$command->bindParameter(':catid', $cat_id, PDO::PARAM_INT);
181 181
 		$count=$command->queryScalar();
182 182
 
183 183
 		return array($cat_id, $variant, $count);
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	private function updateCatalogueTime($cat_id, $variant)
191 191
 	{
192
-		$time = time();
192
+		$time=time();
193 193
 		$command=$this->getDBConnection()->createCommand(
194 194
 			'UPDATE catalogue SET date_modified = :moddate WHERE cat_id = :catid');
195
-		$command->bindParameter(':moddate',$time,PDO::PARAM_INT);
196
-		$command->bindParameter(':catid',$cat_id,PDO::PARAM_INT);
195
+		$command->bindParameter(':moddate', $time, PDO::PARAM_INT);
196
+		$command->bindParameter(':catid', $cat_id, PDO::PARAM_INT);
197 197
 		$result=$command->execute();
198 198
 
199 199
 		if(!empty($this->cache))
@@ -211,31 +211,31 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	function save($catalogue='messages')
213 213
 	{
214
-		$messages = $this->untranslated;
214
+		$messages=$this->untranslated;
215 215
 
216 216
 		if(count($messages) <= 0) return false;
217 217
 
218
-		$details = $this->getCatalogueDetails($catalogue);
218
+		$details=$this->getCatalogueDetails($catalogue);
219 219
 
220 220
 		if($details)
221
-			list($cat_id, $variant, $count) = $details;
221
+			list($cat_id, $variant, $count)=$details;
222 222
 		else
223 223
 			return false;
224 224
 
225 225
 		if($cat_id <= 0) return false;
226
-		$inserted = 0;
226
+		$inserted=0;
227 227
 
228
-		$time = time();
228
+		$time=time();
229 229
 
230 230
 		$command=$this->getDBConnection()->createCommand(
231 231
 			'INSERT INTO trans_unit (cat_id,id,source,date_added) VALUES (:catid,:id,:source,:dateadded)');
232
-		$command->bindParameter(':catid',$cat_id,PDO::PARAM_INT);
233
-		$command->bindParameter(':id',$count,PDO::PARAM_INT);
234
-		$command->bindParameter(':source',$message,PDO::PARAM_STR);
235
-		$command->bindParameter(':dateadded',$time,PDO::PARAM_INT);
232
+		$command->bindParameter(':catid', $cat_id, PDO::PARAM_INT);
233
+		$command->bindParameter(':id', $count, PDO::PARAM_INT);
234
+		$command->bindParameter(':source', $message, PDO::PARAM_STR);
235
+		$command->bindParameter(':dateadded', $time, PDO::PARAM_INT);
236 236
 		foreach($messages as $message)
237 237
 		{
238
-			if (empty($message)) continue;
238
+			if(empty($message)) continue;
239 239
 			$count++; $inserted++;
240 240
 			$command->execute();
241 241
 		}
@@ -253,16 +253,16 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	function delete($message, $catalogue='messages')
255 255
 	{
256
-		$details = $this->getCatalogueDetails($catalogue);
256
+		$details=$this->getCatalogueDetails($catalogue);
257 257
 		if($details)
258
-			list($cat_id, $variant, $count) = $details;
258
+			list($cat_id, $variant, $count)=$details;
259 259
 		else
260 260
 			return false;
261 261
 
262 262
 		$command=$this->getDBConnection()->createCommand(
263 263
 			'DELETE FROM trans_unit WHERE cat_id = :catid AND source = :message');
264
-		$command->bindParameter(':catid',$cat_id,PDO::PARAM_INT);
265
-		$command->bindParameter(':message',$message,PDO::PARAM_STR);
264
+		$command->bindParameter(':catid', $cat_id, PDO::PARAM_INT);
265
+		$command->bindParameter(':message', $message, PDO::PARAM_STR);
266 266
 
267 267
 		return ($command->execute()==1) ? $this->updateCatalogueTime($cat_id, $variant) : false;
268 268
 
@@ -278,21 +278,21 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	function update($text, $target, $comments, $catalogue='messages')
280 280
 	{
281
-		$details = $this->getCatalogueDetails($catalogue);
281
+		$details=$this->getCatalogueDetails($catalogue);
282 282
 		if($details)
283
-			list($cat_id, $variant, $count) = $details;
283
+			list($cat_id, $variant, $count)=$details;
284 284
 		else
285 285
 			return false;
286 286
 
287
-		$time = time();
287
+		$time=time();
288 288
 		$command=$this->getDBConnection()->createCommand(
289 289
 			'UPDATE trans_unit SET target = :target, comments = :comments, date_modified = :datemod
290 290
 					WHERE cat_id = :catid AND source = :source');
291
-		$command->bindParameter(':target',$target,PDO::PARAM_STR);
292
-		$command->bindParameter(':comments',$comments,PDO::PARAM_STR);
293
-		$command->bindParameter(':datemod',$time,PDO::PARAM_INT);
294
-		$command->bindParameter(':catid',$cat_id,PDO::PARAM_INT);
295
-		$command->bindParameter(':source',$text,PDO::PARAM_STR);
291
+		$command->bindParameter(':target', $target, PDO::PARAM_STR);
292
+		$command->bindParameter(':comments', $comments, PDO::PARAM_STR);
293
+		$command->bindParameter(':datemod', $time, PDO::PARAM_INT);
294
+		$command->bindParameter(':catid', $cat_id, PDO::PARAM_INT);
295
+		$command->bindParameter(':source', $text, PDO::PARAM_STR);
296 296
 
297 297
 		return ($command->execute()==1) ? $this->updateCatalogueTime($cat_id, $variant) : false;
298 298
 	}
@@ -303,17 +303,17 @@  discard block
 block discarded – undo
303 303
 	 */
304 304
 	function catalogues()
305 305
 	{
306
-		$command=$this->getDBConnection()->createCommand( 'SELECT name FROM catalogue ORDER BY name');
306
+		$command=$this->getDBConnection()->createCommand('SELECT name FROM catalogue ORDER BY name');
307 307
 		$dataReader=$command->query();
308 308
 
309
-		$result = array();
309
+		$result=array();
310 310
 
311
-		foreach ($dataReader as $row)
311
+		foreach($dataReader as $row)
312 312
 		{
313
-			$details = explode('.',$row[0]);
314
-			if(!isset($details[1])) $details[1] = null;
313
+			$details=explode('.', $row[0]);
314
+			if(!isset($details[1])) $details[1]=null;
315 315
 
316
-			$result[] = $details;
316
+			$result[]=$details;
317 317
 		}
318 318
 
319 319
 		return $result;
Please login to merge, or discard this patch.
framework/I18N/core/Gettext/TGettext.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      * @access  protected
67 67
      * @var     array
68 68
     */
69
-    protected $strings = array();
69
+    protected $strings=array();
70 70
 
71 71
     /**
72 72
      * meta
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * @access  protected
78 78
      * @var     array
79 79
      */
80
-    protected $meta = array();
80
+    protected $meta=array();
81 81
 
82 82
     /**
83 83
      * file path
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      * @access  protected
86 86
      * @var     string
87 87
      */
88
-    protected $file = '';
88
+    protected $file='';
89 89
 
90 90
     /**
91 91
      * Factory
@@ -97,15 +97,15 @@  discard block
 block discarded – undo
97 97
      * @param   string  $format MO or PO
98 98
      * @param   string  $file   path to GNU gettext file
99 99
      */
100
-    static function factory($format, $file = '')
100
+    static function factory($format, $file='')
101 101
     {
102
-        $format = strToUpper($format);
103
-        $filename = dirname(__FILE__).'/'.$format.'.php';
104
-        if(is_file($filename) == false)
105
-        	throw new Exception ("Class file $file not found");
102
+        $format=strToUpper($format);
103
+        $filename=dirname(__FILE__).'/'.$format.'.php';
104
+        if(is_file($filename)==false)
105
+        	throw new Exception("Class file $file not found");
106 106
 
107 107
         include_once $filename;
108
-        $class = 'TGettext_' . $format;
108
+        $class='TGettext_'.$format;
109 109
 
110 110
         return new $class($file);
111 111
     }
@@ -124,19 +124,19 @@  discard block
 block discarded – undo
124 124
      */
125 125
     static function poFile2moFile($pofile, $mofile)
126 126
     {
127
-        if (!is_file($pofile)) {
127
+        if(!is_file($pofile)) {
128 128
             throw new Exception("File $pofile doesn't exist.");
129 129
         }
130 130
 
131 131
         include_once dirname(__FILE__).'/PO.php';
132 132
 
133
-        $PO = new TGettext_PO($pofile);
134
-        if (true !== ($e = $PO->load())) {
133
+        $PO=new TGettext_PO($pofile);
134
+        if(true!==($e=$PO->load())) {
135 135
             return $e;
136 136
         }
137 137
 
138
-        $MO = $PO->toMO();
139
-        if (true !== ($e = $MO->save($mofile))) {
138
+        $MO=$PO->toMO();
139
+        if(true!==($e=$MO->save($mofile))) {
140 140
             return $e;
141 141
         }
142 142
         unset($PO, $MO);
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
      * @param   string  $string
154 154
      * @param   bool    $reverse
155 155
      */
156
-    static function prepare($string, $reverse = false)
156
+    static function prepare($string, $reverse=false)
157 157
     {
158
-        if ($reverse) {
159
-            $smap = array('"', "\n", "\t", "\r");
160
-            $rmap = array('\"', '\\n"' . "\n" . '"', '\\t', '\\r');
158
+        if($reverse) {
159
+            $smap=array('"', "\n", "\t", "\r");
160
+            $rmap=array('\"', '\\n"'."\n".'"', '\\t', '\\r');
161 161
             return (string) str_replace($smap, $rmap, $string);
162 162
         } else {
163
-        	$string = preg_replace('/"\s+"/', '', $string);
164
-            $smap = array('\\n', '\\r', '\\t', '\"');
165
-            $rmap = array("\n", "\r", "\t", '"');
163
+        	$string=preg_replace('/"\s+"/', '', $string);
164
+            $smap=array('\\n', '\\r', '\\t', '\"');
165
+            $rmap=array("\n", "\r", "\t", '"');
166 166
             return (string) str_replace($smap, $rmap, $string);
167 167
         }
168 168
     }
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
      */
178 178
     static function meta2array($meta)
179 179
     {
180
-        $array = array();
181
-        foreach (explode("\n", $meta) as $info) {
182
-            if ($info = trim($info)) {
183
-                list($key, $value) = explode(':', $info, 2);
184
-                $array[trim($key)] = trim($value);
180
+        $array=array();
181
+        foreach(explode("\n", $meta) as $info) {
182
+            if($info=trim($info)) {
183
+                list($key, $value)=explode(':', $info, 2);
184
+                $array[trim($key)]=trim($value);
185 185
             }
186 186
         }
187 187
         return $array;
@@ -243,15 +243,15 @@  discard block
 block discarded – undo
243 243
      */
244 244
     function fromArray($array)
245 245
     {
246
-    	if (!array_key_exists('strings', $array)) {
247
-    	    if (count($array) != 2) {
246
+    	if(!array_key_exists('strings', $array)) {
247
+    	    if(count($array)!=2) {
248 248
                 return false;
249 249
     	    } else {
250
-    	        list($this->meta, $this->strings) = $array;
250
+    	        list($this->meta, $this->strings)=$array;
251 251
             }
252 252
     	} else {
253
-            $this->meta = @$array['meta'];
254
-            $this->strings = @$array['strings'];
253
+            $this->meta=@$array['meta'];
254
+            $this->strings=@$array['strings'];
255 255
         }
256 256
         return true;
257 257
     }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     function toMO()
266 266
     {
267 267
         include_once dirname(__FILE__).'/MO.php';
268
-        $MO = new TGettext_MO;
268
+        $MO=new TGettext_MO;
269 269
         $MO->fromArray($this->toArray());
270 270
         return $MO;
271 271
     }
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
     function toPO()
280 280
     {
281 281
         include_once dirname(__FILE__).'/PO.php';
282
-        $PO = new TGettext_PO;
282
+        $PO=new TGettext_PO;
283 283
         $PO->fromArray($this->toArray());
284 284
         return $PO;
285 285
     }
Please login to merge, or discard this patch.
framework/I18N/core/DateTimeFormatInfo.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 	 * ICU date time formatting data.
82 82
 	 * @var array
83 83
 	 */
84
-	private $data = array();
84
+	private $data=array();
85 85
 
86 86
 	/**
87 87
 	 * A list of properties that are accessable/writable.
88 88
 	 * @var array
89 89
 	 */
90
-	protected $properties = array();
90
+	protected $properties=array();
91 91
 
92 92
 	/**
93 93
 	 * Allow functions that begins with 'set' to be called directly
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	function __get($name)
98 98
 	{
99
-		$getProperty = 'get'.$name;
99
+		$getProperty='get'.$name;
100 100
 		if(in_array($getProperty, $this->properties))
101 101
 			return $this->$getProperty();
102 102
 		else
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	function __set($name, $value)
111 111
 	{
112
-		$setProperty = 'set'.$name;
112
+		$setProperty='set'.$name;
113 113
 		if(in_array($setProperty, $this->properties))
114 114
 			$this->$setProperty($value);
115 115
 		else
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	function __construct($data=array())
129 129
 	{
130
-		$this->properties = get_class_methods($this);
130
+		$this->properties=get_class_methods($this);
131 131
 
132 132
 		if(empty($data))
133 133
 			throw new Exception('Please provide the ICU data to initialize.');
134 134
 
135
-		$this->data = $data;
135
+		$this->data=$data;
136 136
 	}
137 137
 
138 138
 	/**
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
     static function getInvariantInfo()
153 153
     {
154 154
         static $invariant;
155
-		if($invariant === null)
155
+		if($invariant===null)
156 156
         {
157
-            $culture = CultureInfo::getInvariantCulture();
158
-            $invariant = $culture->getDateTimeFormat();
157
+            $culture=CultureInfo::getInvariantCulture();
158
+            $invariant=$culture->getDateTimeFormat();
159 159
         }
160 160
 		return $invariant;
161 161
     }
@@ -169,16 +169,16 @@  discard block
 block discarded – undo
169 169
     static function getInstance($culture=null)
170 170
     {
171 171
 
172
-        if ($culture instanceof CultureInfo)
172
+        if($culture instanceof CultureInfo)
173 173
             return $culture->getDateTimeFormat();
174 174
        	else if(is_string($culture))
175 175
        	{
176
-       		$cultureInfo = CultureInfo::getInstance($culture);
176
+       		$cultureInfo=CultureInfo::getInstance($culture);
177 177
        		return $cultureInfo->getDateTimeFormat();
178 178
        	}
179 179
        	else
180 180
        	{
181
-			$cultureInfo = CultureInfo::getInvariantCulture();
181
+			$cultureInfo=CultureInfo::getInvariantCulture();
182 182
             return $cultureInfo->getDateTimeFormat();
183 183
        	}
184 184
     }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      */
206 206
     function setAbbreviatedDayNames($value)
207 207
     {
208
-    	$this->data['dayNames']['format']['abbreviated'] = $value;
208
+    	$this->data['dayNames']['format']['abbreviated']=$value;
209 209
     }
210 210
 
211 211
 	/**
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      */
230 230
 	function setNarrowDayNames($value)
231 231
 	{
232
-		$this->data['dayNames']['format']['narrow'] = $value;
232
+		$this->data['dayNames']['format']['narrow']=$value;
233 233
 	}
234 234
 
235 235
 	/**
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
      */
256 256
 	function setDayNames($value)
257 257
 	{
258
-		$this->data['dayNames']['format']['wide'] = $value;
258
+		$this->data['dayNames']['format']['wide']=$value;
259 259
 	}
260 260
 
261 261
 	/**
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
      */
280 280
     function setNarrowMonthNames($value)
281 281
     {
282
-        $this->data['monthNames']['format']['narrow'] = $value;
282
+        $this->data['monthNames']['format']['narrow']=$value;
283 283
     }
284 284
 
285 285
 	/**
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 */
293 293
 	function getAbbreviatedMonthNames()
294 294
 	{
295
-		if (isset($this->data['monthNames']['format']['abbreviated']))
295
+		if(isset($this->data['monthNames']['format']['abbreviated']))
296 296
 			return $this->data['monthNames']['format']['abbreviated'];
297 297
 		else
298 298
 			return $this->data['monthNames']['format']['wide'];
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      */
309 309
     function setAbbreviatedMonthNames($value)
310 310
     {
311
-        $this->data['monthNames']['format']['abbreviated'] = $value;
311
+        $this->data['monthNames']['format']['abbreviated']=$value;
312 312
     }
313 313
 
314 314
 	/**
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
      */
335 335
     function setMonthNames($value)
336 336
     {
337
-    	$this->data['monthNames']['format']['wide'] = $value;
337
+    	$this->data['monthNames']['format']['wide']=$value;
338 338
     }
339 339
 
340 340
 	/**
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	 */
345 345
 	function getEra($era)
346 346
 	{
347
-		$eraName = $this->data['eras']['abbreviated'];
347
+		$eraName=$this->data['eras']['abbreviated'];
348 348
 		return $eraName[$era];
349 349
 	}
350 350
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 */
356 356
 	function getAMDesignator()
357 357
 	{
358
-		$result = $this->getAMPMMarkers();
358
+		$result=$this->getAMPMMarkers();
359 359
 		return $result[0];
360 360
 	}
361 361
 
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
      */
366 366
     function setAMDesignator($value)
367 367
     {
368
-        $markers = $this->getAMPMMarkers();
369
-        $markers[0] = $value;
368
+        $markers=$this->getAMPMMarkers();
369
+        $markers[0]=$value;
370 370
         $this->setAMPMMarkers($markers);
371 371
     }
372 372
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 	 */
378 378
 	function getPMDesignator()
379 379
 	{
380
-		$result = $this->getAMPMMarkers();
380
+		$result=$this->getAMPMMarkers();
381 381
 		return $result[1];
382 382
 	}
383 383
 
@@ -387,8 +387,8 @@  discard block
 block discarded – undo
387 387
      */
388 388
     function setPMDesignator($value)
389 389
     {
390
-        $markers = $this->getAMPMMarkers();
391
-        $markers[1] = $value;
390
+        $markers=$this->getAMPMMarkers();
391
+        $markers[1]=$value;
392 392
         $this->setAMPMMarkers($markers);
393 393
     }
394 394
 
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
      */
410 410
     function setAMPMMarkers($value)
411 411
     {
412
-        $this->data['AmPmMarkers'] = $value;
412
+        $this->data['AmPmMarkers']=$value;
413 413
     }
414 414
 
415 415
 	/**
@@ -509,8 +509,8 @@  discard block
 block discarded – undo
509 509
 	 */
510 510
 	function formatDateTime($date, $time)
511 511
 	{
512
-		$pattern = $this->getDateTimeOrderPattern();
513
-		return str_replace(array('{0}','{1}'), array($time, $date), $pattern);
512
+		$pattern=$this->getDateTimeOrderPattern();
513
+		return str_replace(array('{0}', '{1}'), array($time, $date), $pattern);
514 514
 	}
515 515
 
516 516
 }
Please login to merge, or discard this patch.
framework/I18N/core/MessageSource_XLIFF.php 1 patch
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
 	 * Message data filename extension.
44 44
 	 * @var string
45 45
 	 */
46
-	protected $dataExt = '.xml';
46
+	protected $dataExt='.xml';
47 47
 
48 48
 	/**
49 49
 	 * Separator between culture name and source.
50 50
 	 * @var string
51 51
 	 */
52
-	protected $dataSeparator = '.';
52
+	protected $dataSeparator='.';
53 53
 
54 54
 	/**
55 55
 	 * Constructor.
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	function __construct($source)
60 60
 	{
61
-		$this->source = (string)$source;
61
+		$this->source=(string) $source;
62 62
 	}
63 63
 
64 64
 	/**
@@ -69,20 +69,20 @@  discard block
 block discarded – undo
69 69
 	protected function &loadData($filename)
70 70
 	{
71 71
 		//load it.
72
-		if(false === ($XML = simplexml_load_file($filename))) {
72
+		if(false===($XML=simplexml_load_file($filename))) {
73 73
 			return false;
74 74
 		}
75 75
 
76
-		$translationUnit = $XML->xpath('//trans-unit');
76
+		$translationUnit=$XML->xpath('//trans-unit');
77 77
 
78
-		$translations = array();
78
+		$translations=array();
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;
@@ -127,28 +127,28 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	protected function getCatalogueList($catalogue)
129 129
 	{
130
-		$variants = explode('_',$this->culture);
131
-		$source = $catalogue.$this->dataExt;
132
-		$catalogues = array($source);
133
-		$variant = null;
130
+		$variants=explode('_', $this->culture);
131
+		$source=$catalogue.$this->dataExt;
132
+		$catalogues=array($source);
133
+		$variant=null;
134 134
 
135
-		for($i = 0, $k = count($variants); $i < $k; ++$i)
135
+		for($i=0, $k=count($variants); $i < $k; ++$i)
136 136
 		{
137 137
 			if(isset($variants[$i]{0}))
138 138
 			{
139
-				$variant .= ($variant)?'_'.$variants[$i]:$variants[$i];
140
-				$catalogues[] = $catalogue.$this->dataSeparator.$variant.$this->dataExt;
139
+				$variant.=($variant) ? '_'.$variants[$i] : $variants[$i];
140
+				$catalogues[]=$catalogue.$this->dataSeparator.$variant.$this->dataExt;
141 141
 			}
142 142
 		}
143 143
 
144
-		$byDir = $this->getCatalogueByDir($catalogue);
145
-		$catalogues = array_merge($byDir,array_reverse($catalogues));
146
-		$files = array();
144
+		$byDir=$this->getCatalogueByDir($catalogue);
145
+		$catalogues=array_merge($byDir, array_reverse($catalogues));
146
+		$files=array();
147 147
 
148 148
 		foreach($catalogues as $file)
149 149
 		{
150
-			$files[] = $file;
151
-			$files[] = preg_replace('/\.xml$/', '.xlf', $file);
150
+			$files[]=$file;
151
+			$files[]=preg_replace('/\.xml$/', '.xlf', $file);
152 152
 		}
153 153
 
154 154
 		return $files;
@@ -163,16 +163,16 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	private function getCatalogueByDir($catalogue)
165 165
 	{
166
-		$variants = explode('_',$this->culture);
167
-		$catalogues = array();
168
-		$variant = null;
166
+		$variants=explode('_', $this->culture);
167
+		$catalogues=array();
168
+		$variant=null;
169 169
 
170
-		for($i = 0, $k = count($variants); $i < $k; ++$i)
170
+		for($i=0, $k=count($variants); $i < $k; ++$i)
171 171
 		{
172 172
 			if(isset($variants[$i]{0}))
173 173
 			{
174
-				$variant .= ($variant)?'_'.$variants[$i]:$variants[$i];
175
-				$catalogues[] = $variant.'/'.$catalogue.$this->dataExt;
174
+				$variant.=($variant) ? '_'.$variants[$i] : $variants[$i];
175
+				$catalogues[]=$variant.'/'.$catalogue.$this->dataExt;
176 176
 			}
177 177
 		}
178 178
 
@@ -196,38 +196,38 @@  discard block
 block discarded – undo
196 196
 	 * E.g. array('messages','en_AU')
197 197
 	 * @return array list of catalogues
198 198
 	 */
199
-	protected function getCatalogues($dir=null,$variant=null)
199
+	protected function getCatalogues($dir=null, $variant=null)
200 200
 	{
201
-		$dir = $dir?$dir:$this->source;
202
-		$files = scandir($dir);
203
-		$catalogue = array();
201
+		$dir=$dir ? $dir : $this->source;
202
+		$files=scandir($dir);
203
+		$catalogue=array();
204 204
 
205 205
 		foreach($files as $file)
206 206
 		{
207
-			if(is_dir($dir.'/'.$file) && preg_match('/^[a-z]{2}(_[A-Z]{2,3})?$/',$file)) {
208
-				$catalogue = array_merge(
207
+			if(is_dir($dir.'/'.$file) && preg_match('/^[a-z]{2}(_[A-Z]{2,3})?$/', $file)) {
208
+				$catalogue=array_merge(
209 209
 					$catalogue,
210 210
 					$this->getCatalogues($dir.'/'.$file, $file)
211 211
 				);
212 212
 			}
213 213
 
214
-			$pos = strpos($file,$this->dataExt);
215
-			if($pos >0 && substr($file, -1*strlen($this->dataExt)) == $this->dataExt)
214
+			$pos=strpos($file, $this->dataExt);
215
+			if($pos > 0 && substr($file, -1 * strlen($this->dataExt))==$this->dataExt)
216 216
 			{
217
-				$name = substr($file,0,$pos);
218
-				$dot = strrpos($name,$this->dataSeparator);
219
-				$culture = $variant;
220
-				$cat = $name;
217
+				$name=substr($file, 0, $pos);
218
+				$dot=strrpos($name, $this->dataSeparator);
219
+				$culture=$variant;
220
+				$cat=$name;
221 221
 
222 222
 				if(is_int($dot))
223 223
 				{
224
-					$culture = substr($name, $dot+1, strlen($name));
225
-					$cat = substr($name, 0, $dot);
224
+					$culture=substr($name, $dot + 1, strlen($name));
225
+					$cat=substr($name, 0, $dot);
226 226
 				}
227 227
 
228
-				$details[0] = $cat;
229
-				$details[1] = $culture;
230
-				$catalogue[] = $details;
228
+				$details[0]=$cat;
229
+				$details[1]=$culture;
230
+				$catalogue[]=$details;
231 231
 			}
232 232
 		}
233 233
 		sort($catalogue);
@@ -244,13 +244,13 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	private function getVariants($catalogue='messages')
246 246
 	{
247
-		if($catalogue === null) {
248
-			$catalogue = 'messages';
247
+		if($catalogue===null) {
248
+			$catalogue='messages';
249 249
 		}
250 250
 
251 251
 		foreach($this->getCatalogueList($catalogue) as $variant)
252 252
 		{
253
-			$file = $this->getSource($variant);
253
+			$file=$this->getSource($variant);
254 254
 			if(is_file($file)) {
255 255
 				return array($variant, $file);
256 256
 			}
@@ -267,48 +267,48 @@  discard block
 block discarded – undo
267 267
 	 */
268 268
 	public function save($catalogue='messages')
269 269
 	{
270
-		$messages = $this->untranslated;
270
+		$messages=$this->untranslated;
271 271
 		if(count($messages) <= 0) {
272 272
 			return false;
273 273
 		}
274 274
 
275
-		$variants = $this->getVariants($catalogue);
275
+		$variants=$this->getVariants($catalogue);
276 276
 
277 277
 		if($variants) {
278
-			list($variant, $filename) = $variants;
278
+			list($variant, $filename)=$variants;
279 279
 		} else {
280
-			list($variant, $filename) = $this->createMessageTemplate($catalogue);
280
+			list($variant, $filename)=$this->createMessageTemplate($catalogue);
281 281
 		}
282 282
 
283
-		if(is_writable($filename) == false) {
283
+		if(is_writable($filename)==false) {
284 284
 			throw new TIOException("Unable to save to file {$filename}, file must be writable.");
285 285
 		}
286 286
 
287 287
 		//create a new dom, import the existing xml
288
-		$dom = new DOMDocument();
288
+		$dom=new DOMDocument();
289 289
 		$dom->load($filename);
290 290
 
291 291
 		//find the body element
292
-		$xpath = new DomXPath($dom);
293
-    	$body = $xpath->query('//body')->item(0);
292
+		$xpath=new DomXPath($dom);
293
+    	$body=$xpath->query('//body')->item(0);
294 294
 
295
-		$lastNodes = $xpath->query('//trans-unit[last()]');
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
-			$count = 0;
299
+			$count=0;
300 300
 		}
301 301
 
302 302
 		//for each message add it to the XML file using DOM
303 303
 		foreach($messages as $message)
304 304
 		{
305
-			$unit = $dom->createElement('trans-unit');
306
-			$unit->setAttribute('id',++$count);
305
+			$unit=$dom->createElement('trans-unit');
306
+			$unit->setAttribute('id', ++$count);
307 307
 
308
-			$source = $dom->createElement('source');
308
+			$source=$dom->createElement('source');
309 309
 			$source->appendChild($dom->createCDATASection($message));
310 310
 
311
-			$target = $dom->createElement('target');
311
+			$target=$dom->createElement('target');
312 312
 			$target->appendChild($dom->createCDATASection(''));
313 313
 
314 314
 			$unit->appendChild($dom->createTextNode("\n"));
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		}
324 324
 
325 325
 
326
-		$fileNode = $xpath->query('//file')->item(0);
326
+		$fileNode=$xpath->query('//file')->item(0);
327 327
 		$fileNode->setAttribute('date', @date('Y-m-d\TH:i:s\Z'));
328 328
 
329 329
 		//save it and clear the cache for this variant
@@ -345,68 +345,68 @@  discard block
 block discarded – undo
345 345
 	 */
346 346
 	public function update($text, $target, $comments, $catalogue='messages')
347 347
 	{
348
-		$variants = $this->getVariants($catalogue);
348
+		$variants=$this->getVariants($catalogue);
349 349
 
350 350
 		if($variants) {
351
-			list($variant, $filename) = $variants;
351
+			list($variant, $filename)=$variants;
352 352
 		} else {
353 353
 			return false;
354 354
 		}
355 355
 
356
-		if(is_writable($filename) == false) {
356
+		if(is_writable($filename)==false) {
357 357
 			throw new TIOException("Unable to update file {$filename}, file must be writable.");
358 358
 		}
359 359
 
360 360
 		//create a new dom, import the existing xml
361
-		$dom = DOMDocument::load($filename);
361
+		$dom=DOMDocument::load($filename);
362 362
 
363 363
 		//find the body element
364
-		$xpath = new DomXPath($dom);
365
-		$units = $xpath->query('//trans-unit');
364
+		$xpath=new DomXPath($dom);
365
+		$units=$xpath->query('//trans-unit');
366 366
 
367 367
 		//for each of the existin units
368 368
 		foreach($units as $unit)
369 369
 		{
370
-			$found = false;
371
-			$targetted = false;
372
-			$commented = false;
370
+			$found=false;
371
+			$targetted=false;
372
+			$commented=false;
373 373
 
374 374
 			//in each unit, need to find the source, target and comment nodes
375 375
 			//it will assume that the source is before the target.
376 376
 			foreach($unit->childNodes as $node)
377 377
 			{
378 378
 				//source node
379
-				if($node->nodeName == 'source' && $node->firstChild->wholeText == $text) {
380
-					$found = true;
379
+				if($node->nodeName=='source' && $node->firstChild->wholeText==$text) {
380
+					$found=true;
381 381
 				}
382 382
 
383 383
 				//found source, get the target and notes
384 384
 				if($found)
385 385
 				{
386 386
 					//set the new translated string
387
-					if($node->nodeName == 'target')
387
+					if($node->nodeName=='target')
388 388
 					{
389
-						$node->nodeValue = $target;
390
-						$targetted = true;
389
+						$node->nodeValue=$target;
390
+						$targetted=true;
391 391
 					}
392 392
 
393 393
 					//set the notes
394
-					if(!empty($comments) && $node->nodeName == 'note')
394
+					if(!empty($comments) && $node->nodeName=='note')
395 395
 					{
396
-						$node->nodeValue = $comments;
397
-						$commented = true;
396
+						$node->nodeValue=$comments;
397
+						$commented=true;
398 398
 					}
399 399
 				}
400 400
 			}
401 401
 
402 402
 			//append a target
403 403
 			if($found && !$targetted) {
404
-				$unit->appendChild($dom->createElement('target',$target));
404
+				$unit->appendChild($dom->createElement('target', $target));
405 405
 			}
406 406
 
407 407
 			//append a note
408 408
 			if($found && !$commented && !empty($comments)) {
409
-				$unit->appendChild($dom->createElement('note',$comments));
409
+				$unit->appendChild($dom->createElement('note', $comments));
410 410
 			}
411 411
 
412 412
 			//finished searching
@@ -415,10 +415,10 @@  discard block
 block discarded – undo
415 415
 			}
416 416
 		}
417 417
 
418
-		$fileNode = $xpath->query('//file')->item(0);
418
+		$fileNode=$xpath->query('//file')->item(0);
419 419
 		$fileNode->setAttribute('date', @date('Y-m-d\TH:i:s\Z'));
420 420
 
421
-		if($dom->save($filename) >0)
421
+		if($dom->save($filename) > 0)
422 422
 		{
423 423
 			if(!empty($this->cache)) {
424 424
 				$this->cache->clean($variant, $this->culture);
@@ -438,23 +438,23 @@  discard block
 block discarded – undo
438 438
 	 */
439 439
 	public function delete($message, $catalogue='messages')
440 440
 	{
441
-		$variants = $this->getVariants($catalogue);
441
+		$variants=$this->getVariants($catalogue);
442 442
 		if($variants) {
443
-			list($variant, $filename) = $variants;
443
+			list($variant, $filename)=$variants;
444 444
 		} else {
445 445
 			return false;
446 446
 		}
447 447
 
448
-		if(is_writable($filename) == false) {
448
+		if(is_writable($filename)==false) {
449 449
 			throw new TIOException("Unable to modify file {$filename}, file must be writable.");
450 450
 		}
451 451
 
452 452
 		//create a new dom, import the existing xml
453
-		$dom = DOMDocument::load($filename);
453
+		$dom=DOMDocument::load($filename);
454 454
 
455 455
 		//find the body element
456
-		$xpath = new DomXPath($dom);
457
-		$units = $xpath->query('//trans-unit');
456
+		$xpath=new DomXPath($dom);
457
+		$units=$xpath->query('//trans-unit');
458 458
 
459 459
 		//for each of the existin units
460 460
 		foreach($units as $unit)
@@ -464,14 +464,14 @@  discard block
 block discarded – undo
464 464
 			foreach($unit->childNodes as $node)
465 465
 			{
466 466
 				//source node
467
-				if($node->nodeName == 'source' && $node->firstChild->wholeText == $message)
467
+				if($node->nodeName=='source' && $node->firstChild->wholeText==$message)
468 468
 				{
469 469
 					//we found it, remove and save the xml file.
470 470
 					$unit->parentNode->removeChild($unit);
471
-					$fileNode = $xpath->query('//file')->item(0);
471
+					$fileNode=$xpath->query('//file')->item(0);
472 472
 					$fileNode->setAttribute('date', @date('Y-m-d\TH:i:s\Z'));
473 473
 
474
-					if(false !== $dom->save($filename)) {
474
+					if(false!==$dom->save($filename)) {
475 475
 						if(!empty($this->cache)) {
476 476
 							$this->cache->clean($variant, $this->culture);
477 477
 						}
@@ -488,18 +488,18 @@  discard block
 block discarded – undo
488 488
 
489 489
 	protected function createMessageTemplate($catalogue)
490 490
 	{
491
-		if($catalogue === null) {
492
-			$catalogue = 'messages';
491
+		if($catalogue===null) {
492
+			$catalogue='messages';
493 493
 		}
494 494
 		
495
-		$variants = $this->getCatalogueList($catalogue);
496
-		$variant = array_shift($variants);
497
-		$file = $this->getSource($variant);
498
-		$dir = dirname($file);
495
+		$variants=$this->getCatalogueList($catalogue);
496
+		$variant=array_shift($variants);
497
+		$file=$this->getSource($variant);
498
+		$dir=dirname($file);
499 499
 
500 500
 		if(!is_dir($dir)) {
501 501
 			@mkdir($dir);
502
-			@chmod($dir,PRADO_CHMOD);
502
+			@chmod($dir, PRADO_CHMOD);
503 503
 		}
504 504
 
505 505
 		if(!is_dir($dir)) {
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
 
515 515
 	protected function getTemplate($catalogue)
516 516
 	{
517
-		$date = @date('c');
518
-		$xml = <<<EOD
517
+		$date=@date('c');
518
+		$xml=<<<EOD
519 519
 <?xml version="1.0" encoding="UTF-8"?>
520 520
 <xliff version="1.0">
521 521
  <file source-language="EN" target-language="{$this->culture}" datatype="plaintext" original="$catalogue" date="$date" product-name="$catalogue">
Please login to merge, or discard this patch.
framework/I18N/core/MessageCache.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * Caceh life time, default is 1 year.
30 30
 	 */
31
-	protected $lifetime = 3153600;
31
+	protected $lifetime=3153600;
32 32
 
33 33
 
34 34
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function __construct($cacheDir)
39 39
 	{
40
-		$cacheDir = $cacheDir.'/';
40
+		$cacheDir=$cacheDir.'/';
41 41
 
42 42
 		if(!is_dir($cacheDir))
43 43
 			throw new Exception(
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 				'The cache directory '.$cacheDir.' must be writable '.
49 49
 				'by the server.');
50 50
 
51
-		$options = array(
51
+		$options=array(
52 52
 			'cacheDir' => $cacheDir,
53 53
 			'lifeTime' => $this->getLifeTime(),
54 54
 			'automaticSerialization' => true
55 55
 		);
56 56
 
57
-		$this->cache = new TCache_Lite($options);
57
+		$this->cache=new TCache_Lite($options);
58 58
 	}
59 59
 
60 60
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function setLifeTime($time)
74 74
 	{
75
-		$this->lifetime = (int)$time;
75
+		$this->lifetime=(int) $time;
76 76
 	}
77 77
 
78 78
 	/**
@@ -106,18 +106,18 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function get($catalogue, $culture, $lastmodified=0)
108 108
 	{
109
-		$ID = $this->getID($catalogue, $culture);
110
-		$group = $this->getGroup($catalogue, $culture);
109
+		$ID=$this->getID($catalogue, $culture);
110
+		$group=$this->getGroup($catalogue, $culture);
111 111
 
112 112
 		$this->cache->_setFileName($ID, $group);
113 113
 
114
-		$cache = $this->cache->getCacheFile();
114
+		$cache=$this->cache->getCacheFile();
115 115
 
116
-		if(is_file($cache) == false)
116
+		if(is_file($cache)==false)
117 117
 			return false;
118 118
 
119 119
 
120
-		$lastmodified = (int)$lastmodified;
120
+		$lastmodified=(int) $lastmodified;
121 121
 
122 122
 		if($lastmodified <= 0 || $lastmodified > filemtime($cache))
123 123
 			return false;
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 	 */
137 137
 	public function save($data, $catalogue, $culture)
138 138
 	{
139
-		$ID = $this->getID($catalogue, $culture);
140
-		$group = $this->getGroup($catalogue, $culture);
139
+		$ID=$this->getID($catalogue, $culture);
140
+		$group=$this->getGroup($catalogue, $culture);
141 141
 
142 142
 		//echo '## Cache save: "'.$ID.'" : "'.$group.'"';
143 143
 		//echo "<br>\n";
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	public function clean($catalogue, $culture)
154 154
 	{
155
-		$group = $this->getGroup($catalogue, $culture);
155
+		$group=$this->getGroup($catalogue, $culture);
156 156
 		$this->cache->clean($group);
157 157
 	}
158 158
 
Please login to merge, or discard this patch.