Completed
Push — prado-3.3 ( f4da81...5dd4b5 )
by Fabio
09:03
created
framework/I18N/core/IMessageSource.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 	 * @param string a catalogue to load
48 48
 	 * @return boolean true if loaded, false otherwise.
49 49
 	 */
50
-	function load($catalogue = 'messages');	
50
+	function load($catalogue='messages');	
51 51
 	
52 52
 	/**
53 53
 	 * Get the translation table. This includes all the loaded sections.
Please login to merge, or discard this patch.
framework/I18N/core/NumberFormat.php 1 patch
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	function __construct($formatInfo=null)
92 92
 	{
93
-		if($formatInfo === null)
94
-			$this->formatInfo = NumberFormatInfo::getInvariantInfo();
93
+		if($formatInfo===null)
94
+			$this->formatInfo=NumberFormatInfo::getInvariantInfo();
95 95
 		else if($formatInfo instanceof CultureInfo)
96
-			$this->formatInfo = $formatInfo->NumberFormat;
96
+			$this->formatInfo=$formatInfo->NumberFormat;
97 97
 		else if($formatInfo instanceof NumberFormatInfo)
98
-			$this->formatInfo = $formatInfo;
98
+			$this->formatInfo=$formatInfo;
99 99
 		else
100
-			$this->formatInfo =
100
+			$this->formatInfo=
101 101
 				NumberFormatInfo::getInstance($formatInfo);
102 102
 	}
103 103
 
@@ -120,37 +120,37 @@  discard block
 block discarded – undo
120 120
 
121 121
 		$this->setPattern($pattern);
122 122
 
123
-		if(strtolower($pattern) == 'p')
124
-			$number = $number * 100;
123
+		if(strtolower($pattern)=='p')
124
+			$number=$number * 100;
125 125
 
126
-		$string = (string)$number;
126
+		$string=(string) $number;
127 127
 
128
-		$decimal = $this->formatDecimal($string);
129
-		$integer = $this->formatInteger(abs($number));
128
+		$decimal=$this->formatDecimal($string);
129
+		$integer=$this->formatInteger(abs($number));
130 130
 
131
-		if(strlen($decimal)>0)
132
-			$result = $integer.$decimal;
131
+		if(strlen($decimal) > 0)
132
+			$result=$integer.$decimal;
133 133
 		else
134
-			$result = $integer;
134
+			$result=$integer;
135 135
 
136 136
 		//get the suffix
137 137
 		if($number >= 0)
138
-			$suffix = $this->formatInfo->PositivePattern;
138
+			$suffix=$this->formatInfo->PositivePattern;
139 139
 		else if($number < 0)
140
-			$suffix = $this->formatInfo->NegativePattern;
140
+			$suffix=$this->formatInfo->NegativePattern;
141 141
 		else
142
-			$suffix = array("","");
142
+			$suffix=array("", "");
143 143
 
144 144
 		//append and prepend suffix
145
-		$result = $suffix[0].$result.$suffix[1];
145
+		$result=$suffix[0].$result.$suffix[1];
146 146
 
147 147
 		//replace currency sign
148
-		$symbol = @$this->formatInfo->getCurrencySymbol($currency);
149
-		if($symbol === null) {
150
-			$symbol = $currency;
148
+		$symbol=@$this->formatInfo->getCurrencySymbol($currency);
149
+		if($symbol===null) {
150
+			$symbol=$currency;
151 151
 		}
152 152
 
153
-		$result = str_replace('¤',$symbol, $result);
153
+		$result=str_replace('¤', $symbol, $result);
154 154
 
155 155
 		setlocale(LC_NUMERIC, $oldLocale);
156 156
 
@@ -164,68 +164,68 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	protected function formatInteger($string)
166 166
 	{
167
-		$string = (string)$string;
167
+		$string=(string) $string;
168 168
 
169
-		$decimalDigits = $this->formatInfo->DecimalDigits;
169
+		$decimalDigits=$this->formatInfo->DecimalDigits;
170 170
 		//if not decimal digits, assume 0 decimal points.
171 171
 		if(is_int($decimalDigits) && $decimalDigits > 0)
172
-			$string = (string)round(floatval($string),$decimalDigits);
173
-		$dp = strpos($string, '.');
172
+			$string=(string) round(floatval($string), $decimalDigits);
173
+		$dp=strpos($string, '.');
174 174
 		if(is_int($dp))
175
-			$string = substr($string, 0, $dp);
176
-		$integer = '';
175
+			$string=substr($string, 0, $dp);
176
+		$integer='';
177 177
 
178
-		$digitSize = $this->formatInfo->getDigitSize();
178
+		$digitSize=$this->formatInfo->getDigitSize();
179 179
 
180
-		$string = str_pad($string, $digitSize, '0',STR_PAD_LEFT);
180
+		$string=str_pad($string, $digitSize, '0', STR_PAD_LEFT);
181 181
 
182
-		$len = strlen($string);
182
+		$len=strlen($string);
183 183
 
184
-		$groupSeparator = $this->formatInfo->GroupSeparator;
185
-		$groupSize = $this->formatInfo->GroupSizes;
184
+		$groupSeparator=$this->formatInfo->GroupSeparator;
185
+		$groupSize=$this->formatInfo->GroupSizes;
186 186
 
187 187
 
188
-		$firstGroup = true;
189
-		$multiGroup = is_int($groupSize[1]);
190
-		$count = 0;
188
+		$firstGroup=true;
189
+		$multiGroup=is_int($groupSize[1]);
190
+		$count=0;
191 191
 
192 192
 		if(is_int($groupSize[0]))
193 193
 		{
194 194
 			//now for the integer groupings
195
-			for($i=0; $i<$len; $i++)
195
+			for($i=0; $i < $len; $i++)
196 196
 			{
197
-				$char = $string{$len-$i-1};
197
+				$char=$string{$len - $i - 1};
198 198
 
199
-				if($multiGroup && $count == 0)
199
+				if($multiGroup && $count==0)
200 200
 				{
201
-					if($i != 0 && $i%$groupSize[0] == 0)
201
+					if($i!=0 && $i % $groupSize[0]==0)
202 202
 					{
203
-						$integer = $groupSeparator . $integer;
203
+						$integer=$groupSeparator.$integer;
204 204
 						$count++;
205 205
 					}
206 206
 				}
207 207
 				else if($multiGroup && $count >= 1)
208 208
 				{
209
-					if($i != 0 && ($i-$groupSize[0])%$groupSize[1] == 0)
209
+					if($i!=0 && ($i - $groupSize[0]) % $groupSize[1]==0)
210 210
 					{
211
-						$integer = $groupSeparator . $integer;
211
+						$integer=$groupSeparator.$integer;
212 212
 						$count++;
213 213
 					}
214 214
 				}
215 215
 				else
216 216
 				{
217
-					if($i != 0 && $i%$groupSize[0] == 0)
217
+					if($i!=0 && $i % $groupSize[0]==0)
218 218
 					{
219
-						$integer = $groupSeparator . $integer;
219
+						$integer=$groupSeparator.$integer;
220 220
 						$count++;
221 221
 					}
222 222
 				}
223 223
 
224
-				$integer = $char . $integer;
224
+				$integer=$char.$integer;
225 225
 			}
226 226
 		}
227 227
 		else
228
-			$integer = $string;
228
+			$integer=$string;
229 229
 
230 230
 		return $integer;
231 231
 	}
@@ -237,32 +237,32 @@  discard block
 block discarded – undo
237 237
 	 */
238 238
 	protected function formatDecimal($string)
239 239
 	{
240
-		$dp = strpos($string, '.');
241
-		$decimal = '';
240
+		$dp=strpos($string, '.');
241
+		$decimal='';
242 242
 
243
-		$decimalDigits = $this->formatInfo->DecimalDigits;
244
-		$decimalSeparator = $this->formatInfo->DecimalSeparator;
243
+		$decimalDigits=$this->formatInfo->DecimalDigits;
244
+		$decimalSeparator=$this->formatInfo->DecimalSeparator;
245 245
 
246 246
 		//do the correct rounding here
247 247
 		//$string = round(floatval($string), $decimalDigits);
248 248
 		if(is_int($dp))
249 249
 		{
250
-			if($decimalDigits == -1)
250
+			if($decimalDigits==-1)
251 251
 			{
252
-				$decimal = substr($string, $dp+1);
252
+				$decimal=substr($string, $dp + 1);
253 253
 			}
254 254
 			else if(is_int($decimalDigits))
255 255
 			{
256
-				$float = round((float)$string, $decimalDigits);
257
-				if(strpos((string)$float, '.') === false)
256
+				$float=round((float) $string, $decimalDigits);
257
+				if(strpos((string) $float, '.')===false)
258 258
 				{
259
-					$decimal = str_pad($decimal,$decimalDigits,'0');
259
+					$decimal=str_pad($decimal, $decimalDigits, '0');
260 260
 				}
261 261
 				else
262 262
 				{
263
-					$decimal = substr($float, strpos($float,'.')+1);
264
-					if(strlen($decimal)<$decimalDigits)
265
-						$decimal = str_pad($decimal,$decimalDigits,'0');
263
+					$decimal=substr($float, strpos($float, '.') + 1);
264
+					if(strlen($decimal) < $decimalDigits)
265
+						$decimal=str_pad($decimal, $decimalDigits, '0');
266 266
 				}
267 267
 			}
268 268
 			else
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 
271 271
 			return $decimalSeparator.$decimal;
272 272
 		}
273
-		else if ($decimalDigits > 0)
274
-			return $decimalSeparator.str_pad($decimal,$decimalDigits,'0');
273
+		else if($decimalDigits > 0)
274
+			return $decimalSeparator.str_pad($decimal, $decimalDigits, '0');
275 275
 
276 276
 		return $decimal;
277 277
 	}
Please login to merge, or discard this patch.
framework/I18N/core/MessageSource_SQLite.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	function __construct($source)
56 56
 	{
57
-		$dsn = parseDSN((string)$source);
58
-		$this->source = $dsn['database'];
57
+		$dsn=parseDSN((string) $source);
58
+		$this->source=$dsn['database'];
59 59
 	}
60 60
 	
61 61
 	/**
@@ -66,26 +66,26 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	protected function &loadData($variant)
68 68
 	{
69
-		$variant = sqlite_escape_string($variant);
69
+		$variant=sqlite_escape_string($variant);
70 70
 		
71
-		$statement = 
71
+		$statement= 
72 72
 			"SELECT t.id, t.source, t.target, t.comments
73 73
 				FROM trans_unit t, catalogue c
74 74
  				WHERE c.cat_id =  t.cat_id
75 75
 					AND c.name = '{$variant}' 
76 76
 				ORDER BY id ASC";
77 77
 	
78
-		$db = sqlite_open($this->source);
79
-		$rs = sqlite_query($statement, $db);
78
+		$db=sqlite_open($this->source);
79
+		$rs=sqlite_query($statement, $db);
80 80
 			
81
-		$result = array();
81
+		$result=array();
82 82
 		
83
-		while($row = sqlite_fetch_array($rs,SQLITE_NUM))
83
+		while($row=sqlite_fetch_array($rs, SQLITE_NUM))
84 84
 		{
85
-			$source = $row[1];
86
-			$result[$source][] = $row[2]; //target
87
-			$result[$source][] = $row[0]; //id
88
-			$result[$source][] = $row[3]; //comments
85
+			$source=$row[1];
86
+			$result[$source][]=$row[2]; //target
87
+			$result[$source][]=$row[0]; //id
88
+			$result[$source][]=$row[3]; //comments
89 89
 		}
90 90
 
91 91
 		sqlite_close($db);
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 	 */	
102 102
 	protected function getLastModified($source)
103 103
 	{
104
-		$source = sqlite_escape_string($source);
104
+		$source=sqlite_escape_string($source);
105 105
 
106
-		$db = sqlite_open($this->source);
106
+		$db=sqlite_open($this->source);
107 107
 		
108
-		$rs = sqlite_query(
108
+		$rs=sqlite_query(
109 109
 			"SELECT date_modified FROM catalogue WHERE name = '{$source}'",
110 110
 			$db);
111 111
 			
112
-		$result = $rs ? (int)sqlite_fetch_single($rs) : 0;
112
+		$result=$rs ? (int) sqlite_fetch_single($rs) : 0;
113 113
 		
114 114
 		sqlite_close($db);		
115 115
 	
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	protected function isValidSource($variant)
126 126
 	{
127
-		$variant = sqlite_escape_string($variant);
128
-		$db = sqlite_open($this->source);
129
-		$rs = sqlite_query(
127
+		$variant=sqlite_escape_string($variant);
128
+		$db=sqlite_open($this->source);
129
+		$rs=sqlite_query(
130 130
 			"SELECT COUNT(*) FROM catalogue WHERE name = '{$variant}'",
131 131
 			$db);
132
-		$result = $rs && (int)sqlite_fetch_single($rs);	
132
+		$result=$rs && (int) sqlite_fetch_single($rs);	
133 133
 		sqlite_close($db);
134 134
 
135 135
 		return $result;
@@ -142,18 +142,18 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	protected function getCatalogueList($catalogue)
144 144
 	{
145
-		$variants = explode('_',$this->culture);
145
+		$variants=explode('_', $this->culture);
146 146
 		
147
-		$catalogues = array($catalogue);
147
+		$catalogues=array($catalogue);
148 148
 
149
-		$variant = null;
149
+		$variant=null;
150 150
 				
151
-		for($i = 0, $k = count($variants); $i < $k; ++$i)
151
+		for($i=0, $k=count($variants); $i < $k; ++$i)
152 152
 		{						
153 153
 			if(isset($variants[$i]{0}))
154 154
 			{
155
-				$variant .= ($variant)?'_'.$variants[$i]:$variants[$i];
156
-				$catalogues[] = $catalogue.'.'.$variant;
155
+				$variant.=($variant) ? '_'.$variants[$i] : $variants[$i];
156
+				$catalogues[]=$catalogue.'.'.$variant;
157 157
 			}
158 158
 		}
159 159
 		return array_reverse($catalogues);	
@@ -167,29 +167,29 @@  discard block
 block discarded – undo
167 167
 	private function getCatalogueDetails($catalogue='messages')
168 168
 	{
169 169
 		if(empty($catalogue))
170
-			$catalogue = 'messages';
170
+			$catalogue='messages';
171 171
 
172
-		$variant = $catalogue.'.'.$this->culture;
172
+		$variant=$catalogue.'.'.$this->culture;
173 173
 		
174
-		$name = sqlite_escape_string($this->getSource($variant));	
174
+		$name=sqlite_escape_string($this->getSource($variant));	
175 175
 			
176
-		$db = sqlite_open($this->source);
176
+		$db=sqlite_open($this->source);
177 177
 		
178
-		$rs = sqlite_query("SELECT cat_id
178
+		$rs=sqlite_query("SELECT cat_id
179 179
 					FROM catalogue WHERE name = '{$name}'", $db);
180 180
 		
181
-		if(sqlite_num_rows($rs) != 1)
181
+		if(sqlite_num_rows($rs)!=1)
182 182
 			return false;
183 183
 		
184
-		$cat_id = (int)sqlite_fetch_single($rs);
184
+		$cat_id=(int) sqlite_fetch_single($rs);
185 185
 		
186 186
 		//first get the catalogue ID
187
-		$rs = sqlite_query(
187
+		$rs=sqlite_query(
188 188
 			"SELECT count(msg_id)
189 189
 				FROM trans_unit
190 190
 				WHERE cat_id = {$cat_id}", $db);
191 191
 
192
-		$count = (int)sqlite_fetch_single($rs);
192
+		$count=(int) sqlite_fetch_single($rs);
193 193
 
194 194
 		sqlite_close($db);	
195 195
 		
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	private function updateCatalogueTime($cat_id, $variant, $db)
204 204
 	{
205
-		$time = time();
205
+		$time=time();
206 206
 		
207
-		$result = sqlite_query("UPDATE catalogue 
207
+		$result=sqlite_query("UPDATE catalogue 
208 208
 							SET date_modified = {$time}
209 209
 							WHERE cat_id = {$cat_id}", $db);
210 210
 
@@ -223,27 +223,27 @@  discard block
 block discarded – undo
223 223
 	 */
224 224
 	function save($catalogue='messages')
225 225
 	{
226
-		$messages = $this->untranslated;
226
+		$messages=$this->untranslated;
227 227
 		
228 228
 		if(count($messages) <= 0) return false;				
229 229
 		
230
-		$details = $this->getCatalogueDetails($catalogue);	
230
+		$details=$this->getCatalogueDetails($catalogue);	
231 231
 		
232 232
 		if($details)
233
-			list($cat_id, $variant, $count) = $details;
233
+			list($cat_id, $variant, $count)=$details;
234 234
 		else
235 235
 			return false;
236 236
 		
237 237
 		if($cat_id <= 0) return false;
238
-		$inserted = 0;
238
+		$inserted=0;
239 239
 		
240
-		$db = sqlite_open($this->source);
241
-		$time = time();
240
+		$db=sqlite_open($this->source);
241
+		$time=time();
242 242
 
243 243
 		foreach($messages as $message)
244 244
 		{
245
-			$message = sqlite_escape_string($message);
246
-			$statement = "INSERT INTO trans_unit
245
+			$message=sqlite_escape_string($message);
246
+			$statement="INSERT INTO trans_unit
247 247
 				(cat_id,id,source,date_added) VALUES
248 248
 				({$cat_id}, {$count},'{$message}',$time)";
249 249
 			if(sqlite_query($statement, $db))
@@ -269,31 +269,31 @@  discard block
 block discarded – undo
269 269
 	 */	
270 270
 	function update($text, $target, $comments, $catalogue='messages')
271 271
 	{
272
-		$details = $this->getCatalogueDetails($catalogue);
272
+		$details=$this->getCatalogueDetails($catalogue);
273 273
 		if($details)
274
-			list($cat_id, $variant, $count) = $details;
274
+			list($cat_id, $variant, $count)=$details;
275 275
 		else
276 276
 			return false;
277 277
 		
278
-		$comments = sqlite_escape_string($comments);
279
-		$target = sqlite_escape_string($target);
280
-		$text = sqlite_escape_string($text);
278
+		$comments=sqlite_escape_string($comments);
279
+		$target=sqlite_escape_string($target);
280
+		$text=sqlite_escape_string($text);
281 281
 		
282
-		$time = time();
282
+		$time=time();
283 283
 		
284
-		$db = sqlite_open($this->source);
284
+		$db=sqlite_open($this->source);
285 285
 		
286
-		$statement = "UPDATE trans_unit SET
286
+		$statement="UPDATE trans_unit SET
287 287
 						target = '{$target}',
288 288
 						comments = '{$comments}',
289 289
 						date_modified = '{$time}'
290 290
 					WHERE cat_id = {$cat_id} 
291 291
 						AND source = '{$text}'";
292 292
 		
293
-		$updated = false;
293
+		$updated=false;
294 294
 		
295 295
 		if(sqlite_query($statement, $db))
296
-			$updated = $this->updateCatalogueTime($cat_id, $variant, $db);
296
+			$updated=$this->updateCatalogueTime($cat_id, $variant, $db);
297 297
 		
298 298
 		sqlite_close($db);			
299 299
 				
@@ -308,21 +308,21 @@  discard block
 block discarded – undo
308 308
 	 */
309 309
 	function delete($message, $catalogue='messages')
310 310
 	{
311
-		$details = $this->getCatalogueDetails($catalogue);
311
+		$details=$this->getCatalogueDetails($catalogue);
312 312
 		if($details)
313
-			list($cat_id, $variant, $count) = $details;
313
+			list($cat_id, $variant, $count)=$details;
314 314
 		else
315 315
 			return false;
316 316
 			
317
-		$db = sqlite_open($this->source);
318
-		$text = sqlite_escape_string($message);
317
+		$db=sqlite_open($this->source);
318
+		$text=sqlite_escape_string($message);
319 319
 		
320
-		$statement = "DELETE FROM trans_unit WHERE
320
+		$statement="DELETE FROM trans_unit WHERE
321 321
 						cat_id = {$cat_id} AND source = '{$message}'";
322
-		$deleted = false;
322
+		$deleted=false;
323 323
 				
324 324
 		if(sqlite_query($statement, $db))
325
-			$deleted = $this->updateCatalogueTime($cat_id, $variant, $db);		
325
+			$deleted=$this->updateCatalogueTime($cat_id, $variant, $db);		
326 326
 			
327 327
 		sqlite_close($db);	
328 328
 				
@@ -335,16 +335,16 @@  discard block
 block discarded – undo
335 335
 	 */
336 336
 	function catalogues()
337 337
 	{
338
-		$db = sqlite_open($this->source);
339
-		$statement = 'SELECT name FROM catalogue ORDER BY name';
340
-		$rs = sqlite_query($statement, $db);
341
-		$result = array();
342
-		while($row = sqlite_fetch_array($rs,SQLITE_NUM))
338
+		$db=sqlite_open($this->source);
339
+		$statement='SELECT name FROM catalogue ORDER BY name';
340
+		$rs=sqlite_query($statement, $db);
341
+		$result=array();
342
+		while($row=sqlite_fetch_array($rs, SQLITE_NUM))
343 343
 		{
344
-			$details = explode('.',$row[0]);
345
-			if(!isset($details[1])) $details[1] = null;
344
+			$details=explode('.', $row[0]);
345
+			if(!isset($details[1])) $details[1]=null;
346 346
 			
347
-			$result[] = $details;
347
+			$result[]=$details;
348 348
 		}
349 349
 		sqlite_close($db);
350 350
 		return $result;
Please login to merge, or discard this patch.
framework/I18N/core/ChoiceFormat.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 	 * The pattern to validate a set notation
83 83
 	 * @var string
84 84
 	 */
85
-	protected $validate = '/[\(\[\{]|[-Inf\d:\s]+|,|[\+Inf\d\s:\?\-=!><%\|&\(\)]+|[\)\]\}]/ms';
85
+	protected $validate='/[\(\[\{]|[-Inf\d:\s]+|,|[\+Inf\d\s:\?\-=!><%\|&\(\)]+|[\)\]\}]/ms';
86 86
 
87 87
 	/**
88 88
 	 * The pattern to parse the formatting string.
89 89
 	 * @var string
90 90
 	 */
91
-	protected $parse = '/\s*\|?([\(\[\{]([-Inf\d:\s]+,?[\+Inf\d\s:\?\-=!><%\|&\(\)]*)+[\)\]\}])\s*/';
91
+	protected $parse='/\s*\|?([\(\[\{]([-Inf\d:\s]+,?[\+Inf\d\s:\?\-=!><%\|&\(\)]*)+[\)\]\}])\s*/';
92 92
 
93 93
 	/**
94 94
 	 * The value for positive infinity.
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	function __construct()
104 104
 	{
105
-		$this->inf = -log(0);
105
+		$this->inf=-log(0);
106 106
 	}
107 107
 
108 108
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	function isValid($number, $set)
116 116
 	{
117
-		$n = preg_match_all($this->validate,$set,$matches,PREG_SET_ORDER);
117
+		$n=preg_match_all($this->validate, $set, $matches, PREG_SET_ORDER);
118 118
 
119 119
 		if($n < 3) throw new Exception("Invalid set \"{$set}\"");
120 120
 
@@ -123,42 +123,42 @@  discard block
 block discarded – undo
123 123
 			return $this->isValidSetNotation($number, $def[1]);
124 124
 		}
125 125
 
126
-		$leftBracket = $matches[0][0];
127
-		$rightBracket = $matches[$n-1][0];
126
+		$leftBracket=$matches[0][0];
127
+		$rightBracket=$matches[$n - 1][0];
128 128
 
129
-		$i = 0;
130
-		$elements = array();
129
+		$i=0;
130
+		$elements=array();
131 131
 		foreach($matches as $match)
132 132
 		{
133
-			$string = $match[0];
134
-			if($i != 0 && $i != $n-1 && $string !== ',')
133
+			$string=$match[0];
134
+			if($i!=0 && $i!=$n - 1 && $string!==',')
135 135
 			{
136
-				if($string == '-Inf')
137
-					$elements[] = -1*$this->inf;
138
-				else if ($string == '+Inf' || $string == 'Inf')
139
-					$elements[] = $this->inf;
136
+				if($string=='-Inf')
137
+					$elements[]=-1 * $this->inf;
138
+				else if($string=='+Inf' || $string=='Inf')
139
+					$elements[]=$this->inf;
140 140
 				else
141
-					$elements[] = floatval($string);
141
+					$elements[]=floatval($string);
142 142
 			}
143 143
 			$i++;
144 144
 		}
145
-		$total = count($elements);
146
-		$number = floatval($number);
145
+		$total=count($elements);
146
+		$number=floatval($number);
147 147
 
148
-		if($leftBracket == '{' && $rightBracket == '}')
148
+		if($leftBracket=='{' && $rightBracket=='}')
149 149
 			return in_array($number, $elements);
150 150
 
151
-		$left = false;
152
-		if($leftBracket == '[')
153
-			$left = $number >= $elements[0];
154
-		else if ($leftBracket == '(')
155
-			$left = $number > $elements[0];
151
+		$left=false;
152
+		if($leftBracket=='[')
153
+			$left=$number >= $elements[0];
154
+		else if($leftBracket=='(')
155
+			$left=$number > $elements[0];
156 156
 
157
-		$right = false;
157
+		$right=false;
158 158
 		if($rightBracket==']')
159
-			$right = $number <= $elements[$total-1];
160
-		else if($rightBracket == ')')
161
-			$right = $number < $elements[$total-1];
159
+			$right=$number <= $elements[$total - 1];
160
+		else if($rightBracket==')')
161
+			$right=$number < $elements[$total - 1];
162 162
 
163 163
 		if($left && $right) return true;
164 164
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
 	protected function isValidSetNotation($number, $set)
169 169
 	{
170
-		$str = '$result = '.str_replace('n', '$number', $set).';';
170
+		$str='$result = '.str_replace('n', '$number', $set).';';
171 171
 		try
172 172
 		{
173 173
 			eval($str);
@@ -187,18 +187,18 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	function parse($string)
189 189
 	{
190
-		$n = preg_match_all($this->parse,$string,$matches, PREG_OFFSET_CAPTURE);
191
-		$sets = array();
190
+		$n=preg_match_all($this->parse, $string, $matches, PREG_OFFSET_CAPTURE);
191
+		$sets=array();
192 192
 		foreach($matches[1] as $match)
193
-			$sets[] = $match[0];
194
-		$offset = $matches[0];
195
-		$strings = array();
196
-		for($i = 0; $i < $n; $i++)
193
+			$sets[]=$match[0];
194
+		$offset=$matches[0];
195
+		$strings=array();
196
+		for($i=0; $i < $n; $i++)
197 197
 		{
198
-			$len = strlen($offset[$i][0]);
199
-			$begin = $i == 0? $len : $offset[$i][1] + $len;
200
-			$end = $i == $n-1 ? strlen($string) : $offset[$i+1][1];
201
-			$strings[] = substr($string, $begin, $end - $begin);
198
+			$len=strlen($offset[$i][0]);
199
+			$begin=$i==0 ? $len : $offset[$i][1] + $len;
200
+			$end=$i==$n - 1 ? strlen($string) : $offset[$i + 1][1];
201
+			$strings[]=substr($string, $begin, $end - $begin);
202 202
 		}
203 203
 		return array($sets, $strings);
204 204
 	}
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
 	 */
213 213
 	public function format($string, $number)
214 214
 	{
215
-		list($sets, $strings) = $this->parse($string);
216
-		$total = count($sets);
217
-		for($i = 0; $i < $total; $i++)
215
+		list($sets, $strings)=$this->parse($string);
216
+		$total=count($sets);
217
+		for($i=0; $i < $total; $i++)
218 218
 		{
219 219
 			if($this->isValid($number, $sets[$i]))
220 220
 				return $strings[$i];
Please login to merge, or discard this patch.
framework/I18N/core/HTTPNegotiator.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -51,44 +51,44 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	function getLanguages()
53 53
 	{
54
-		if($this->languages !== null) {
54
+		if($this->languages!==null) {
55 55
 			return $this->languages;
56 56
 		}
57 57
 
58
-		$this->languages = array();
58
+		$this->languages=array();
59 59
 
60
-		if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
60
+		if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
61 61
             return $this->languages;
62 62
 
63 63
 		//$basedir = CultureInfo::dataDir();
64 64
 		//$ext = CultureInfo::fileExt();
65
-		$info = new CultureInfo();
65
+		$info=new CultureInfo();
66 66
 
67 67
 		foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang)
68 68
 		{
69 69
             // Cut off any q-value that might come after a semi-colon
70
-            if ($pos = strpos($lang, ';'))
71
-                $lang = trim(substr($lang, 0, $pos));
70
+            if($pos=strpos($lang, ';'))
71
+                $lang=trim(substr($lang, 0, $pos));
72 72
 
73
-			if (strstr($lang, '-'))
73
+			if(strstr($lang, '-'))
74 74
 			{
75
-				$codes = explode('-',$lang);
76
-				if($codes[0] == 'i')
75
+				$codes=explode('-', $lang);
76
+				if($codes[0]=='i')
77 77
 				{
78 78
                     // Language not listed in ISO 639 that are not variants
79 79
                     // of any listed language, which can be registerd with the
80 80
                     // i-prefix, such as i-cherokee
81
-					if(count($codes)>1)
82
-						$lang = $codes[1];
81
+					if(count($codes) > 1)
82
+						$lang=$codes[1];
83 83
 				}
84 84
 				else
85 85
 				{
86
-					for($i = 0, $k = count($codes); $i<$k; ++$i)
86
+					for($i=0, $k=count($codes); $i < $k; ++$i)
87 87
 					{
88
-						if($i == 0)
89
-							$lang = strtolower($codes[0]);
88
+						if($i==0)
89
+							$lang=strtolower($codes[0]);
90 90
 						else
91
-							$lang .= '_'.strtoupper($codes[$i]);
91
+							$lang.='_'.strtoupper($codes[$i]);
92 92
 					}
93 93
 				}
94 94
             }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
 
98 98
 			if($info->validCulture($lang))
99
-				$this->languages[] = $lang;
99
+				$this->languages[]=$lang;
100 100
         }
101 101
 
102 102
 		return $this->languages;
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	function getCharsets()
110 110
 	{
111
-        if($this->charsets !== null) {
111
+        if($this->charsets!==null) {
112 112
 			return $this->charsets;
113 113
 		}
114 114
 
115
-		$this->charsets = array();
115
+		$this->charsets=array();
116 116
 
117
-		if (!isset($_SERVER['HTTP_ACCEPT_CHARSET']))
117
+		if(!isset($_SERVER['HTTP_ACCEPT_CHARSET']))
118 118
             return $this->charsets;
119 119
 
120
-		foreach (explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset)
120
+		foreach(explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset)
121 121
 		{
122
-            if (!empty($charset))
123
-                $this->charsets[] = preg_replace('/;.*/', '', $charset);
122
+            if(!empty($charset))
123
+                $this->charsets[]=preg_replace('/;.*/', '', $charset);
124 124
         }
125 125
 
126 126
 		return $this->charsets;
Please login to merge, or discard this patch.
framework/I18N/core/MessageSource_gettext.php 1 patch
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -45,23 +45,23 @@  discard block
 block discarded – undo
45 45
 	 * Message data filename extension.
46 46
 	 * @var string
47 47
 	 */
48
-	protected $dataExt = '.mo';
48
+	protected $dataExt='.mo';
49 49
 
50 50
 	/**
51 51
 	 * PO data filename extension
52 52
 	 * @var string
53 53
 	 */
54
-	protected $poExt = '.po';
54
+	protected $poExt='.po';
55 55
 
56 56
 	/**
57 57
 	 * Separator between culture name and source.
58 58
 	 * @var string
59 59
 	 */
60
-	protected $dataSeparator = '.';
60
+	protected $dataSeparator='.';
61 61
 
62 62
 	function __construct($source)
63 63
 	{
64
-		$this->source = (string)$source;
64
+		$this->source=(string) $source;
65 65
 	}
66 66
 
67 67
 
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	protected function &loadData($filename)
74 74
 	{
75
-		$mo = TGettext::factory('MO',$filename);
75
+		$mo=TGettext::factory('MO', $filename);
76 76
 		$mo->load();
77
-		$result = $mo->toArray();
77
+		$result=$mo->toArray();
78 78
 
79
-		$results = array();
79
+		$results=array();
80 80
 		$count=0;
81 81
 		foreach($result['strings'] as $source => $target)
82 82
 		{
83
-			$results[$source][] = $target; //target
84
-			$results[$source][] = $count++; //id
85
-			$results[$source][] = ''; //comments
83
+			$results[$source][]=$target; //target
84
+			$results[$source][]=$count++; //id
85
+			$results[$source][]=''; //comments
86 86
 		}
87 87
 		return $results;
88 88
 	}
@@ -129,24 +129,24 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	protected function getCatalogueList($catalogue)
131 131
 	{
132
-		$variants = explode('_',$this->culture);
133
-		$source = $catalogue.$this->dataExt;
132
+		$variants=explode('_', $this->culture);
133
+		$source=$catalogue.$this->dataExt;
134 134
 
135
-		$catalogues = array($source);
135
+		$catalogues=array($source);
136 136
 
137
-		$variant = null;
137
+		$variant=null;
138 138
 
139
-		for($i = 0, $k = count($variants); $i < $k; ++$i)
139
+		for($i=0, $k=count($variants); $i < $k; ++$i)
140 140
 		{
141 141
 			if(isset($variants[$i]{0}))
142 142
 			{
143
-				$variant .= ($variant)?'_'.$variants[$i]:$variants[$i];
144
-				$catalogues[] = $catalogue.$this->dataSeparator.
143
+				$variant.=($variant) ? '_'.$variants[$i] : $variants[$i];
144
+				$catalogues[]=$catalogue.$this->dataSeparator.
145 145
 								$variant.$this->dataExt;
146 146
 			}
147 147
 		}
148
-		$byDir = $this->getCatalogueByDir($catalogue);
149
-		$catalogues = array_merge($byDir,array_reverse($catalogues));
148
+		$byDir=$this->getCatalogueByDir($catalogue);
149
+		$catalogues=array_merge($byDir, array_reverse($catalogues));
150 150
 		return $catalogues;
151 151
 	}
152 152
 
@@ -160,17 +160,17 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	private function getCatalogueByDir($catalogue)
162 162
 	{
163
-		$variants = explode('_',$this->culture);
164
-		$catalogues = array();
163
+		$variants=explode('_', $this->culture);
164
+		$catalogues=array();
165 165
 
166
-		$variant = null;
166
+		$variant=null;
167 167
 
168
-		for($i = 0, $k = count($variants); $i < $k; ++$i)
168
+		for($i=0, $k=count($variants); $i < $k; ++$i)
169 169
 		{
170 170
 			if(isset($variants[$i]{0}))
171 171
 			{
172
-				$variant .= ($variant)?'_'.$variants[$i]:$variants[$i];
173
-				$catalogues[] = $variant.'/'.$catalogue.$this->dataExt;
172
+				$variant.=($variant) ? '_'.$variants[$i] : $variants[$i];
173
+				$catalogues[]=$variant.'/'.$catalogue.$this->dataExt;
174 174
 			}
175 175
 		}
176 176
 		return array_reverse($catalogues);
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	private function getVariants($catalogue='messages')
188 188
 	{
189
-		if($catalogue === null) {
190
-			$catalogue = 'messages';
189
+		if($catalogue===null) {
190
+			$catalogue='messages';
191 191
 		}
192 192
 
193 193
 		foreach($this->getCatalogueList($catalogue) as $variant)
194 194
 		{
195
-			$file = $this->getSource($variant);
196
-			$po = $this->getPOFile($file);
195
+			$file=$this->getSource($variant);
196
+			$po=$this->getPOFile($file);
197 197
 			if(is_file($file) || is_file($po))
198 198
 				return array($variant, $file, $po);
199 199
 		}
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
 	private function getPOFile($MOFile)
204 204
 	{
205
-		$filebase = substr($MOFile, 0, strlen($MOFile)-strlen($this->dataExt));
205
+		$filebase=substr($MOFile, 0, strlen($MOFile) - strlen($this->dataExt));
206 206
 		return $filebase.$this->poExt;
207 207
 	}
208 208
 
@@ -215,46 +215,46 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	function save($catalogue='messages')
217 217
 	{
218
-		$messages = $this->untranslated;
218
+		$messages=$this->untranslated;
219 219
 
220 220
 		if(count($messages) <= 0) return false;
221 221
 
222
-		$variants = $this->getVariants($catalogue);
222
+		$variants=$this->getVariants($catalogue);
223 223
 
224 224
 		if($variants)
225
-			list($variant, $MOFile, $POFile) = $variants;
225
+			list($variant, $MOFile, $POFile)=$variants;
226 226
 		else
227
-			list($variant, $MOFile, $POFile) = $this->createMessageTemplate($catalogue);
227
+			list($variant, $MOFile, $POFile)=$this->createMessageTemplate($catalogue);
228 228
 
229
-		if(is_writable($MOFile) == false)
229
+		if(is_writable($MOFile)==false)
230 230
 			throw new TIOException("Unable to save to file {$MOFile}, file must be writable.");
231
-		if(is_writable($POFile) == false)
231
+		if(is_writable($POFile)==false)
232 232
 			throw new TIOException("Unable to save to file {$POFile}, file must be writable.");
233 233
 
234 234
 		//set the strings as untranslated.
235
-		$strings = array();
235
+		$strings=array();
236 236
 		foreach($messages as $message)
237
-			$strings[$message] = '';
237
+			$strings[$message]='';
238 238
 
239 239
 		//load the PO
240
-		$po = TGettext::factory('PO',$POFile);
240
+		$po=TGettext::factory('PO', $POFile);
241 241
 		$po->load();
242
-		$result = $po->toArray();
242
+		$result=$po->toArray();
243 243
 
244
-		$existing = count($result['strings']);
244
+		$existing=count($result['strings']);
245 245
 
246 246
 		//add to strings to the existing message list
247
-		$result['strings'] = array_merge($result['strings'],$strings);
247
+		$result['strings']=array_merge($result['strings'], $strings);
248 248
 
249
-		$new = count($result['strings']);
249
+		$new=count($result['strings']);
250 250
 
251 251
 		if($new > $existing)
252 252
 		{
253 253
 			//change the date 2004-12-25 12:26
254
-			$result['meta']['PO-Revision-Date'] = @date('Y-m-d H:i:s');
254
+			$result['meta']['PO-Revision-Date']=@date('Y-m-d H:i:s');
255 255
 
256 256
 			$po->fromArray($result);
257
-			$mo = $po->toMO();
257
+			$mo=$po->toMO();
258 258
 			if($po->save() && $mo->save($MOFile))
259 259
 			{
260 260
 				if(!empty($this->cache))
@@ -275,30 +275,30 @@  discard block
 block discarded – undo
275 275
 	 */
276 276
 	function delete($message, $catalogue='messages')
277 277
 	{
278
-		$variants = $this->getVariants($catalogue);
278
+		$variants=$this->getVariants($catalogue);
279 279
 		if($variants)
280
-			list($variant, $MOFile, $POFile) = $variants;
280
+			list($variant, $MOFile, $POFile)=$variants;
281 281
 		else
282 282
 			return false;
283 283
 
284
-		if(is_writable($MOFile) == false)
284
+		if(is_writable($MOFile)==false)
285 285
 			throw new TIOException("Unable to modify file {$MOFile}, file must be writable.");
286
-		if(is_writable($POFile) == false)
286
+		if(is_writable($POFile)==false)
287 287
 			throw new TIOException("Unable to modify file {$POFile}, file must be writable.");
288 288
 
289
-		$po = TGettext::factory('PO',$POFile);
289
+		$po=TGettext::factory('PO', $POFile);
290 290
 		$po->load();
291
-		$result = $po->toArray();
291
+		$result=$po->toArray();
292 292
 
293 293
 		foreach($result['strings'] as $string => $value)
294 294
 		{
295
-			if($string == $message)
295
+			if($string==$message)
296 296
 			{
297
-				$result['meta']['PO-Revision-Date'] = @date('Y-m-d H:i:s');
297
+				$result['meta']['PO-Revision-Date']=@date('Y-m-d H:i:s');
298 298
 				unset($result['strings'][$string]);
299 299
 
300 300
 				$po->fromArray($result);
301
-				$mo = $po->toMO();
301
+				$mo=$po->toMO();
302 302
 				if($po->save() && $mo->save($MOFile))
303 303
 				{
304 304
 					if(!empty($this->cache))
@@ -323,31 +323,31 @@  discard block
 block discarded – undo
323 323
 	 */
324 324
 	function update($text, $target, $comments, $catalogue='messages')
325 325
 	{
326
-		$variants = $this->getVariants($catalogue);
326
+		$variants=$this->getVariants($catalogue);
327 327
 		if($variants)
328
-			list($variant, $MOFile, $POFile) = $variants;
328
+			list($variant, $MOFile, $POFile)=$variants;
329 329
 		else
330 330
 			return false;
331 331
 
332
-		if(is_writable($MOFile) == false)
332
+		if(is_writable($MOFile)==false)
333 333
 			throw new TIOException("Unable to update file {$MOFile}, file must be writable.");
334
-		if(is_writable($POFile) == false)
334
+		if(is_writable($POFile)==false)
335 335
 			throw new TIOException("Unable to update file {$POFile}, file must be writable.");
336 336
 
337 337
 
338
-		$po = TGettext::factory('PO',$POFile);
338
+		$po=TGettext::factory('PO', $POFile);
339 339
 		$po->load();
340
-		$result = $po->toArray();
340
+		$result=$po->toArray();
341 341
 
342 342
 		foreach($result['strings'] as $string => $value)
343 343
 		{
344
-			if($string == $text)
344
+			if($string==$text)
345 345
 			{
346
-				$result['strings'][$string] = $target;
347
-				$result['meta']['PO-Revision-Date'] = @date('Y-m-d H:i:s');
346
+				$result['strings'][$string]=$target;
347
+				$result['meta']['PO-Revision-Date']=@date('Y-m-d H:i:s');
348 348
 
349 349
 				$po->fromArray($result);
350
-				$mo = $po->toMO();
350
+				$mo=$po->toMO();
351 351
 
352 352
 				if($po->save() && $mo->save($MOFile))
353 353
 				{
@@ -379,42 +379,42 @@  discard block
 block discarded – undo
379 379
 	 * E.g. array('messages','en_AU')
380 380
 	 * @return array list of catalogues
381 381
 	 */
382
-	protected function getCatalogues($dir=null,$variant=null)
382
+	protected function getCatalogues($dir=null, $variant=null)
383 383
 	{
384
-		$dir = $dir?$dir:$this->source;
385
-		$files = scandir($dir);
384
+		$dir=$dir ? $dir : $this->source;
385
+		$files=scandir($dir);
386 386
 
387
-		$catalogue = array();
387
+		$catalogue=array();
388 388
 
389 389
 		foreach($files as $file)
390 390
 		{
391 391
 			if(is_dir($dir.'/'.$file)
392
-				&& preg_match('/^[a-z]{2}(_[A-Z]{2,3})?$/',$file))
392
+				&& preg_match('/^[a-z]{2}(_[A-Z]{2,3})?$/', $file))
393 393
 			{
394 394
 
395
-				$catalogue = array_merge($catalogue,
395
+				$catalogue=array_merge($catalogue,
396 396
 								$this->getCatalogues($dir.'/'.$file, $file));
397 397
 			}
398 398
 
399
-			$pos = strpos($file,$this->dataExt);
399
+			$pos=strpos($file, $this->dataExt);
400 400
 
401
-			if($pos >0
402
-				&& substr($file,-1*strlen($this->dataExt)) == $this->dataExt)
401
+			if($pos > 0
402
+				&& substr($file, -1 * strlen($this->dataExt))==$this->dataExt)
403 403
 			{
404
-				$name = substr($file,0,$pos);
405
-				$dot = strrpos($name,$this->dataSeparator);
406
-				$culture = $variant;
407
-				$cat = $name;
404
+				$name=substr($file, 0, $pos);
405
+				$dot=strrpos($name, $this->dataSeparator);
406
+				$culture=$variant;
407
+				$cat=$name;
408 408
 				if(is_int($dot))
409 409
 				{
410
-					$culture = substr($name, $dot+1,strlen($name));
411
-					$cat = substr($name,0,$dot);
410
+					$culture=substr($name, $dot + 1, strlen($name));
411
+					$cat=substr($name, 0, $dot);
412 412
 				}
413
-				$details[0] = $cat;
414
-				$details[1] = $culture;
413
+				$details[0]=$cat;
414
+				$details[1]=$culture;
415 415
 
416 416
 
417
-				$catalogue[] = $details;
417
+				$catalogue[]=$details;
418 418
 			}
419 419
 		}
420 420
 		sort($catalogue);
@@ -424,29 +424,29 @@  discard block
 block discarded – undo
424 424
 
425 425
 	protected function createMessageTemplate($catalogue)
426 426
 	{
427
-		if($catalogue === null) {
428
-			$catalogue = 'messages';
427
+		if($catalogue===null) {
428
+			$catalogue='messages';
429 429
 		}
430
-		$variants = $this->getCatalogueList($catalogue);
431
-		$variant = array_shift($variants);
432
-		$mo_file = $this->getSource($variant);
433
-		$po_file = $this->getPOFile($mo_file);
430
+		$variants=$this->getCatalogueList($catalogue);
431
+		$variant=array_shift($variants);
432
+		$mo_file=$this->getSource($variant);
433
+		$po_file=$this->getPOFile($mo_file);
434 434
 
435
-		$dir = dirname($mo_file);
435
+		$dir=dirname($mo_file);
436 436
 		if(!is_dir($dir))
437 437
 		{
438 438
 			@mkdir($dir);
439
-			@chmod($dir,PRADO_CHMOD);
439
+			@chmod($dir, PRADO_CHMOD);
440 440
 		}
441 441
 		if(!is_dir($dir))
442 442
 			throw new TException("Unable to create directory $dir");
443 443
 
444
-		$po = TGettext::factory('PO',$po_file);
445
-		$result['meta']['PO-Revision-Date'] = @date('Y-m-d H:i:s');
446
-		$result['strings'] = array();
444
+		$po=TGettext::factory('PO', $po_file);
445
+		$result['meta']['PO-Revision-Date']=@date('Y-m-d H:i:s');
446
+		$result['strings']=array();
447 447
 
448 448
 		$po->fromArray($result);
449
-		$mo = $po->toMO();
449
+		$mo=$po->toMO();
450 450
 		if($po->save() && $mo->save($mo_file))
451 451
 			return array($variant, $mo_file, $po_file);
452 452
 		else
Please login to merge, or discard this patch.
framework/I18N/core/NumberFormatInfo.php 1 patch
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
 	 * ICU number formatting data.
53 53
 	 * @var array
54 54
 	 */
55
-	private $data = array();
55
+	private $data=array();
56 56
 
57 57
 	/**
58 58
 	 * A list of properties that are accessable/writable.
59 59
 	 * @var array
60 60
 	 */
61
-	protected $properties = array();
61
+	protected $properties=array();
62 62
 
63 63
 	/**
64 64
 	 * The number pattern.
65 65
 	 * @var array
66 66
 	 */
67
-	protected $pattern = array();
67
+	protected $pattern=array();
68 68
 
69
-	const DECIMAL = 0;
70
-	const CURRENCY = 1;
71
-	const PERCENTAGE = 2;
72
-	const SCIENTIFIC = 3;
69
+	const DECIMAL=0;
70
+	const CURRENCY=1;
71
+	const PERCENTAGE=2;
72
+	const SCIENTIFIC=3;
73 73
 
74 74
 	/**
75 75
 	 * Allow functions that begins with 'set' to be called directly
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function __get($name)
80 80
 	{
81
-		$getProperty = 'get'.$name;
81
+		$getProperty='get'.$name;
82 82
 		if(in_array($getProperty, $this->properties))
83 83
 			return $this->$getProperty();
84 84
 		else
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function __set($name, $value)
93 93
 	{
94
-		$setProperty = 'set'.$name;
94
+		$setProperty='set'.$name;
95 95
 		if(in_array($setProperty, $this->properties))
96 96
 			$this->$setProperty($value);
97 97
 		else
@@ -109,12 +109,12 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function __construct($data=array(), $type=NumberFormatInfo::DECIMAL)
111 111
 	{
112
-		$this->properties = get_class_methods($this);
112
+		$this->properties=get_class_methods($this);
113 113
 
114 114
 		if(empty($data))
115 115
 			throw new Exception('Please provide the ICU data to initialize.');
116 116
 
117
-		$this->data = $data;
117
+		$this->data=$data;
118 118
 
119 119
 		$this->setPattern($type);
120 120
 	}
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
 	public function setPattern($type=NumberFormatInfo::DECIMAL)
129 129
 	{
130 130
 		if(is_int($type))
131
-			$this->pattern =
131
+			$this->pattern=
132 132
 				$this->parsePattern($this->data['NumberPatterns'][$type]);
133 133
 		else
134
-			$this->pattern = $this->parsePattern($type);
134
+			$this->pattern=$this->parsePattern($type);
135 135
 
136
-		$this->pattern['negInfty'] =
136
+		$this->pattern['negInfty']=
137 137
 			$this->data['NumberElements'][6].
138 138
 			$this->data['NumberElements'][9];
139 139
 
140
-		$this->pattern['posInfty'] =
140
+		$this->pattern['posInfty']=
141 141
 			$this->data['NumberElements'][11].
142 142
 			$this->data['NumberElements'][9];
143 143
 	}
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
     public static function getInvariantInfo($type=NumberFormatInfo::DECIMAL)
156 156
     {
157 157
         static $invariant;
158
-		if($invariant === null)
158
+		if($invariant===null)
159 159
         {
160
-            $culture = CultureInfo::getInvariantCulture();
161
-            $invariant = $culture->NumberFormat;
160
+            $culture=CultureInfo::getInvariantCulture();
161
+            $invariant=$culture->NumberFormat;
162 162
             $invariant->setPattern($type);
163 163
         }
164 164
 		return $invariant;
@@ -179,23 +179,23 @@  discard block
 block discarded – undo
179 179
     public static function getInstance($culture=null,
180 180
     								   $type=NumberFormatInfo::DECIMAL)
181 181
     {
182
-   		if ($culture instanceof CultureInfo)
182
+   		if($culture instanceof CultureInfo)
183 183
    		{
184
-            $formatInfo = $culture->NumberFormat;
184
+            $formatInfo=$culture->NumberFormat;
185 185
             $formatInfo->setPattern($type);
186 186
             return $formatInfo;
187 187
    		}
188 188
        	else if(is_string($culture))
189 189
        	{
190
-       		$cultureInfo = new CultureInfo($culture);
191
-       		$formatInfo = $cultureInfo->NumberFormat;
190
+       		$cultureInfo=new CultureInfo($culture);
191
+       		$formatInfo=$cultureInfo->NumberFormat;
192 192
        		$formatInfo->setPattern($type);
193 193
        		return $formatInfo;
194 194
        	}
195 195
        	else
196 196
        	{
197
-            $cultureInfo = new CultureInfo();
198
-       		$formatInfo = $cultureInfo->NumberFormat;
197
+            $cultureInfo=new CultureInfo();
198
+       		$formatInfo=$cultureInfo->NumberFormat;
199 199
        		$formatInfo->setPattern($type);
200 200
        		return $formatInfo;
201 201
        	}
@@ -241,67 +241,67 @@  discard block
 block discarded – undo
241 241
      */
242 242
     protected function parsePattern($pattern)
243 243
 	{
244
-		$pattern = explode(';',$pattern);
244
+		$pattern=explode(';', $pattern);
245 245
 
246
-		$negative = null;
246
+		$negative=null;
247 247
 		if(count($pattern) > 1)
248
-			$negative = $pattern[1];
249
-		$pattern = $pattern[0];
248
+			$negative=$pattern[1];
249
+		$pattern=$pattern[0];
250 250
 
251
-		$comma = ',';
252
-		$dot = '.';
253
-		$digit = '0';
254
-		$hash = '#';
251
+		$comma=',';
252
+		$dot='.';
253
+		$digit='0';
254
+		$hash='#';
255 255
 
256 256
 		//find the first group point, and decimal point
257
-		$groupPos1 = strrpos($pattern,$comma);
258
-		$decimalPos = strrpos($pattern,$dot);
257
+		$groupPos1=strrpos($pattern, $comma);
258
+		$decimalPos=strrpos($pattern, $dot);
259 259
 
260
-		$groupPos2 = false;
261
-		$groupSize1 = false;
262
-		$groupSize2 = false;
263
-		$decimalPoints = is_int($decimalPos)?-1:false;
260
+		$groupPos2=false;
261
+		$groupSize1=false;
262
+		$groupSize2=false;
263
+		$decimalPoints=is_int($decimalPos) ?-1 : false;
264 264
 
265
-		$info['negPref'] = $this->data['NumberElements'][6];
266
-		$info['negPost'] = '';
265
+		$info['negPref']=$this->data['NumberElements'][6];
266
+		$info['negPost']='';
267 267
 
268
-		$info['negative'] = $negative;
269
-		$info['positive'] = $pattern;
268
+		$info['negative']=$negative;
269
+		$info['positive']=$pattern;
270 270
 
271 271
 		//find the negative prefix and postfix
272 272
 		if($negative)
273 273
 		{
274
-			$prefixPostfix = $this->getPrePostfix($negative);
275
-			$info['negPref'] = $prefixPostfix[0];
276
-			$info['negPost'] = $prefixPostfix[1];
274
+			$prefixPostfix=$this->getPrePostfix($negative);
275
+			$info['negPref']=$prefixPostfix[0];
276
+			$info['negPost']=$prefixPostfix[1];
277 277
 		}
278 278
 
279
-		$posfix = $this->getPrePostfix($pattern);
280
-		$info['posPref'] = $posfix[0];
281
-		$info['posPost'] = $posfix[1];
279
+		$posfix=$this->getPrePostfix($pattern);
280
+		$info['posPref']=$posfix[0];
281
+		$info['posPost']=$posfix[1];
282 282
 
283 283
 		//var_dump($pattern);
284 284
 		//var_dump($decimalPos);
285 285
 		if(is_int($groupPos1))
286 286
 		{
287 287
 			//get the second group
288
-			$groupPos2 = strrpos(substr($pattern,0,$groupPos1),$comma);
288
+			$groupPos2=strrpos(substr($pattern, 0, $groupPos1), $comma);
289 289
 
290 290
 			//get the number of decimal digits
291 291
 			if(is_int($decimalPos))
292 292
 			{
293
-				$groupSize1 = $decimalPos - $groupPos1-1;
293
+				$groupSize1=$decimalPos - $groupPos1 - 1;
294 294
 
295 295
 			}
296 296
 			else
297 297
 			{
298 298
 				//no decimal point, so traverse from the back
299 299
 				//to find the groupsize 1.
300
-				for($i=strlen($pattern)-1; $i>=0; $i--)
300
+				for($i=strlen($pattern) - 1; $i >= 0; $i--)
301 301
 				{
302
-					if($pattern{$i} == $digit || $pattern{$i}==$hash)
302
+					if($pattern{$i}==$digit || $pattern{$i}==$hash)
303 303
 					{
304
-						$groupSize1 = $i - $groupPos1;
304
+						$groupSize1=$i - $groupPos1;
305 305
 						break;
306 306
 					}
307 307
 				}
@@ -309,36 +309,36 @@  discard block
 block discarded – undo
309 309
 
310 310
 			//get the second group size
311 311
 			if(is_int($groupPos2))
312
-				$groupSize2 = $groupPos1 - $groupPos2-1;
312
+				$groupSize2=$groupPos1 - $groupPos2 - 1;
313 313
 		}
314 314
 
315 315
 		if(is_int($decimalPos))
316 316
 		{
317
-			for($i=strlen($pattern)-1; $i>=0; $i--)
317
+			for($i=strlen($pattern) - 1; $i >= 0; $i--)
318 318
 			{
319
-				if($pattern{$i} == $dot) break;
320
-				if($pattern{$i} == $digit)
319
+				if($pattern{$i}==$dot) break;
320
+				if($pattern{$i}==$digit)
321 321
 				{
322
-					$decimalPoints = $i - $decimalPos;
322
+					$decimalPoints=$i - $decimalPos;
323 323
 					break;
324 324
 				}
325 325
 			}
326 326
 		}
327 327
 
328 328
 		if(is_int($decimalPos))
329
-			$digitPattern = substr($pattern,0,$decimalPos);
329
+			$digitPattern=substr($pattern, 0, $decimalPos);
330 330
 		else
331
-			$digitPattern  = $pattern;
331
+			$digitPattern=$pattern;
332 332
 
333
-		$digitPattern  = preg_replace('/[^0]/','',$digitPattern);
333
+		$digitPattern=preg_replace('/[^0]/', '', $digitPattern);
334 334
 
335
-		$info['groupPos1'] = $groupPos1;
336
-		$info['groupSize1'] = $groupSize1;
337
-		$info['groupPos2'] = $groupPos2;
338
-		$info['groupSize2'] = $groupSize2;
339
-		$info['decimalPos'] = $decimalPos;
340
-		$info['decimalPoints'] = $decimalPoints;
341
-		$info['digitSize'] = strlen($digitPattern);
335
+		$info['groupPos1']=$groupPos1;
336
+		$info['groupSize1']=$groupSize1;
337
+		$info['groupPos2']=$groupPos2;
338
+		$info['groupSize2']=$groupSize2;
339
+		$info['decimalPos']=$decimalPos;
340
+		$info['decimalPoints']=$decimalPoints;
341
+		$info['digitSize']=strlen($digitPattern);
342 342
 		return $info;
343 343
 	}
344 344
 
@@ -349,9 +349,9 @@  discard block
 block discarded – undo
349 349
 	 */
350 350
 	protected function getPrePostfix($pattern)
351 351
 	{
352
-		$regexp = '/[#,\.0]+/';
353
-		$result = preg_split($regexp, $pattern);
354
-		return array($result[0],$result[1]);
352
+		$regexp='/[#,\.0]+/';
353
+		$result=preg_split($regexp, $pattern);
354
+		return array($result[0], $result[1]);
355 355
 	}
356 356
 
357 357
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
      */
371 371
     function setDecimalDigits($value)
372 372
     {
373
-    	return $this->pattern['decimalPoints'] = $value;
373
+    	return $this->pattern['decimalPoints']=$value;
374 374
     }
375 375
 
376 376
     function getDigitSize()
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 
381 381
     function setDigitSize($value)
382 382
     {
383
-    	$this->pattern['digitSize'] = $value;
383
+    	$this->pattern['digitSize']=$value;
384 384
     }
385 385
 
386 386
     /**
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
      */
399 399
     function setDecimalSeparator($value)
400 400
     {
401
-    	return $this->data['NumberElements'][0] = $value;
401
+    	return $this->data['NumberElements'][0]=$value;
402 402
     }
403 403
 
404 404
     /**
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
      */
419 419
     function setGroupSeparator($value)
420 420
     {
421
-    	return $this->data['NumberElements'][1] = $value;
421
+    	return $this->data['NumberElements'][1]=$value;
422 422
     }
423 423
 
424 424
     /**
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
      */
431 431
     function getGroupSizes()
432 432
     {
433
-    	$group1 = $this->pattern['groupSize1'];
434
-    	$group2 = $this->pattern['groupSize2'];
433
+    	$group1=$this->pattern['groupSize1'];
434
+    	$group2=$this->pattern['groupSize2'];
435 435
 
436 436
     	return array($group1, $group2);
437 437
     }
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
      */
446 446
     function setGroupSizes($groupSize)
447 447
     {
448
-   		$this->pattern['groupSize1'] = $groupSize[0];
449
-   		$this->pattern['groupSize2'] = $groupSize[1];
448
+   		$this->pattern['groupSize1']=$groupSize[0];
449
+   		$this->pattern['groupSize2']=$groupSize[1];
450 450
     }
451 451
 
452 452
     /**
@@ -457,8 +457,8 @@  discard block
 block discarded – undo
457 457
      */
458 458
     function getNegativePattern()
459 459
     {
460
-    	$prefix = $this->pattern['negPref'];
461
-    	$postfix = $this->pattern['negPost'];
460
+    	$prefix=$this->pattern['negPref'];
461
+    	$postfix=$this->pattern['negPost'];
462 462
     	return array($prefix, $postfix);
463 463
     }
464 464
 
@@ -470,8 +470,8 @@  discard block
 block discarded – undo
470 470
      */
471 471
     function setNegativePattern($pattern)
472 472
     {
473
-    	$this->pattern['negPref'] = $pattern[0];
474
-    	$this->pattern['negPost'] = $pattern[1];
473
+    	$this->pattern['negPref']=$pattern[0];
474
+    	$this->pattern['negPost']=$pattern[1];
475 475
     }
476 476
 
477 477
     /**
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
      */
483 483
     function getPositivePattern()
484 484
     {
485
-    	$prefix = $this->pattern['posPref'];
486
-    	$postfix = $this->pattern['posPost'];
485
+    	$prefix=$this->pattern['posPref'];
486
+    	$postfix=$this->pattern['posPost'];
487 487
     	return array($prefix, $postfix);
488 488
     }
489 489
 
@@ -495,8 +495,8 @@  discard block
 block discarded – undo
495 495
      */
496 496
     function setPositivePattern($pattern)
497 497
     {
498
-    	$this->pattern['posPref'] = $pattern[0];
499
-    	$this->pattern['posPost'] = $pattern[1];
498
+    	$this->pattern['posPref']=$pattern[0];
499
+    	$this->pattern['posPost']=$pattern[1];
500 500
     }
501 501
 
502 502
     /**
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
      */
519 519
     function setCurrencySymbol($symbol)
520 520
     {
521
-    	$this->pattern['symbol'] = $symbol;
521
+    	$this->pattern['symbol']=$symbol;
522 522
     }
523 523
 
524 524
     /**
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
      */
537 537
     function setNegativeInfinitySymbol($value)
538 538
     {
539
-		$this->pattern['negInfty'] = $value;
539
+		$this->pattern['negInfty']=$value;
540 540
     }
541 541
 
542 542
     /**
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
      */
555 555
     function setPositiveInfinitySymbol($value)
556 556
     {
557
-		$this->pattern['posInfty'] = $value;
557
+		$this->pattern['posInfty']=$value;
558 558
     }
559 559
 
560 560
     /**
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
      */
573 573
     function setNegativeSign($value)
574 574
     {
575
-    	$this->data['NumberElements'][6] = $value;
575
+    	$this->data['NumberElements'][6]=$value;
576 576
     }
577 577
 
578 578
     /**
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
      */
591 591
     function setPositiveSign($value)
592 592
     {
593
-    	$this->data['NumberElements'][11] = $value;
593
+    	$this->data['NumberElements'][11]=$value;
594 594
     }
595 595
 
596 596
     /**
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
      */
609 609
     function setNaNSymbol($value)
610 610
     {
611
-    	$this->data['NumberElements'][10] = $value;
611
+    	$this->data['NumberElements'][10]=$value;
612 612
     }
613 613
 
614 614
     /**
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
      */
627 627
     function setPercentSymbol($value)
628 628
     {
629
-    	$this->data['NumberElements'][3] = $value;
629
+    	$this->data['NumberElements'][3]=$value;
630 630
     }
631 631
 
632 632
     /**
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
      */
645 645
     function setPerMilleSymbol($value)
646 646
     {
647
-    	$this->data['NumberElements'][8] = $value;
647
+    	$this->data['NumberElements'][8]=$value;
648 648
     }
649 649
 }
650 650
 
Please login to merge, or discard this patch.
framework/I18N/core/CultureInfo.php 1 patch
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	 * ICU data filename extension.
52 52
 	 * @var string
53 53
 	 */
54
-	private $dataFileExt = '.dat';
54
+	private $dataFileExt='.dat';
55 55
 
56 56
 	/**
57 57
 	 * The ICU data array.
58 58
 	 * @var array
59 59
 	 */
60
-	private $data = array();
60
+	private $data=array();
61 61
 
62 62
 	/**
63 63
 	 * The current culture.
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * A list of ICU date files loaded.
76 76
 	 * @var array
77 77
 	 */
78
-	private $dataFiles = array();
78
+	private $dataFiles=array();
79 79
 
80 80
 	/**
81 81
 	 * The current date time format info.
@@ -93,28 +93,28 @@  discard block
 block discarded – undo
93 93
 	 * A list of properties that are accessable/writable.
94 94
 	 * @var array
95 95
 	 */
96
-	protected $properties = array();
96
+	protected $properties=array();
97 97
 
98 98
 	/**
99 99
 	 * Culture type, all.
100 100
 	 * @see getCultures()
101 101
 	 * @var int
102 102
 	 */
103
-	const ALL = 0;
103
+	const ALL=0;
104 104
 
105 105
 	/**
106 106
 	 * Culture type, neutral.
107 107
 	 * @see getCultures()
108 108
 	 * @var int
109 109
 	 */
110
-	const NEUTRAL = 1;
110
+	const NEUTRAL=1;
111 111
 
112 112
 	/**
113 113
 	 * Culture type, specific.
114 114
 	 * @see getCultures()
115 115
 	 * @var int
116 116
 	 */
117
-	const SPECIFIC = 2;
117
+	const SPECIFIC=2;
118 118
 
119 119
 	/**
120 120
 	 * Display the culture name.
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	function __get($name)
136 136
 	{
137
-		$getProperty = 'get'.$name;
137
+		$getProperty='get'.$name;
138 138
 		if(in_array($getProperty, $this->properties))
139 139
 			return $this->$getProperty();
140 140
 		else
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	function __set($name, $value)
149 149
 	{
150
-		$setProperty = 'set'.$name;
150
+		$setProperty='set'.$name;
151 151
 		if(in_array($setProperty, $this->properties))
152 152
 			$this->$setProperty($value);
153 153
 		else
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	function __construct($culture='en')
167 167
 	{
168
-		$this->properties = get_class_methods($this);
168
+		$this->properties=get_class_methods($this);
169 169
 
170 170
 		if(empty($culture))
171
-			$culture = 'en';
171
+			$culture='en';
172 172
 
173
-		$this->dataDir = $this->dataDir();
174
-		$this->dataFileExt = $this->fileExt();
173
+		$this->dataDir=$this->dataDir();
174
+		$this->dataFileExt=$this->fileExt();
175 175
 
176 176
 		$this->setCulture($culture);
177 177
 
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 	*/
205 205
 	public static function getInstance($culture)
206 206
 	{
207
-		static $instances = array();
207
+		static $instances=array();
208 208
 		if(!isset($instances[$culture]))
209
-			$instances[$culture] = new CultureInfo($culture);
209
+			$instances[$culture]=new CultureInfo($culture);
210 210
 		return $instances[$culture];
211 211
 	}
212 212
 
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
233 233
 	{
234 234
 		if(!empty($culture))
235 235
 		{
236
-			if (!preg_match('/^[_\\w]+$/', $culture))
237
-				throw new Exception('Invalid culture supplied: ' . $culture);
236
+			if(!preg_match('/^[_\\w]+$/', $culture))
237
+				throw new Exception('Invalid culture supplied: '.$culture);
238 238
 		}
239 239
 
240
-		$this->culture = $culture;
240
+		$this->culture=$culture;
241 241
 	}
242 242
 
243 243
 	/**
@@ -246,30 +246,30 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	protected function loadCultureData($culture)
248 248
 	{
249
-		$file_parts = explode('_',$culture);
250
-		$current_part = $file_parts[0];
249
+		$file_parts=explode('_', $culture);
250
+		$current_part=$file_parts[0];
251 251
 
252
-		$files = array($current_part);
252
+		$files=array($current_part);
253 253
 
254
-		for($i = 1, $k = count($file_parts); $i < $k; ++$i)
254
+		for($i=1, $k=count($file_parts); $i < $k; ++$i)
255 255
 		{
256
-			$current_part .= '_'.$file_parts[$i];
257
-			$files[] = $current_part;
256
+			$current_part.='_'.$file_parts[$i];
257
+			$files[]=$current_part;
258 258
 		}
259 259
 
260 260
 		foreach($files as $file)
261 261
 		{
262
-			$filename = $this->dataDir.$file.$this->dataFileExt;
262
+			$filename=$this->dataDir.$file.$this->dataFileExt;
263 263
 
264
-			if(is_file($filename) == false)
264
+			if(is_file($filename)==false)
265 265
 				throw new Exception('Data file for "'.$file.'" was not found.');
266 266
 
267
-			if(in_array($filename, $this->dataFiles) === false)
267
+			if(in_array($filename, $this->dataFiles)===false)
268 268
 			{
269 269
 				array_unshift($this->dataFiles, $file);
270 270
 
271
-				$data = &$this->getData($filename);
272
-				$this->data[$file] = &$data;
271
+				$data=&$this->getData($filename);
272
+				$this->data[$file]=&$data;
273 273
 
274 274
 				if(isset($data['__ALIAS']))
275 275
 					$this->loadCultureData($data['__ALIAS'][0]);
@@ -287,13 +287,13 @@  discard block
 block discarded – undo
287 287
 	 */
288 288
 	protected function &getData($filename)
289 289
 	{
290
-		static $data = array();
291
-		static $files = array();
290
+		static $data=array();
291
+		static $files=array();
292 292
 
293 293
 		if(!in_array($filename, $files))
294 294
 		{
295
-			$data[$filename] = unserialize(file_get_contents($filename));
296
-			$files[] = $filename;
295
+			$data[$filename]=unserialize(file_get_contents($filename));
296
+			$files[]=$filename;
297 297
 		}
298 298
 
299 299
 		return $data[$filename];
@@ -315,15 +315,15 @@  discard block
 block discarded – undo
315 315
 	 */
316 316
 	protected function findInfo($path='/', $merge=false)
317 317
 	{
318
-		$result = array();
318
+		$result=array();
319 319
 		foreach($this->dataFiles as $section)
320 320
 		{
321
-			$info = $this->searchArray($this->data[$section], $path);
321
+			$info=$this->searchArray($this->data[$section], $path);
322 322
 
323 323
 			if($info)
324 324
 			{
325 325
 				if($merge)
326
-					$result = array_merge($info,$result);
326
+					$result=array_merge($info, $result);
327 327
 				else
328 328
 					return $info;
329 329
 			}
@@ -342,16 +342,16 @@  discard block
 block discarded – undo
342 342
 	 */
343 343
 	private function searchArray($info, $path='/')
344 344
 	{
345
-		$index = explode('/',$path);
345
+		$index=explode('/', $path);
346 346
 
347
-		$array = $info;
347
+		$array=$info;
348 348
 
349
-		for($i = 0, $k = count($index); $i < $k; ++$i)
349
+		for($i=0, $k=count($index); $i < $k; ++$i)
350 350
 		{
351
-			$value = $index[$i];
352
-			if($i < $k-1 && isset($array[$value]))
353
-				$array = $array[$value];
354
-			else if ($i == $k-1 && isset($array[$value]))
351
+			$value=$index[$i];
352
+			if($i < $k - 1 && isset($array[$value]))
353
+				$array=$array[$value];
354
+			else if($i==$k - 1 && isset($array[$value]))
355 355
 				return $array[$value];
356 356
 		}
357 357
 	}
@@ -373,10 +373,10 @@  discard block
 block discarded – undo
373 373
 	 */
374 374
 	function getDateTimeFormat()
375 375
 	{
376
-		if($this->dateTimeFormat === null)
376
+		if($this->dateTimeFormat===null)
377 377
 		{
378
-			$calendar = $this->getCalendar();
379
-			$info = $this->findInfo("calendar/{$calendar}", true);
378
+			$calendar=$this->getCalendar();
379
+			$info=$this->findInfo("calendar/{$calendar}", true);
380 380
 			$this->setDateTimeFormat(new DateTimeFormatInfo($info));
381 381
 		}
382 382
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	 */
390 390
 	function setDateTimeFormat($dateTimeFormat)
391 391
 	{
392
-		$this->dateTimeFormat = $dateTimeFormat;
392
+		$this->dateTimeFormat=$dateTimeFormat;
393 393
 	}
394 394
 
395 395
 	/**
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	 */
399 399
 	function getCalendar()
400 400
 	{
401
-		$info = $this->findInfo('calendar/default');
401
+		$info=$this->findInfo('calendar/default');
402 402
 		return $info[0];
403 403
 	}
404 404
 
@@ -410,10 +410,10 @@  discard block
 block discarded – undo
410 410
 	 */
411 411
 	function getNativeName()
412 412
 	{
413
-		$lang = substr($this->culture,0,2);
414
-		$reg = substr($this->culture,3,2);
415
-		$language = $this->findInfo("Languages/{$lang}");
416
-		$region = $this->findInfo("Countries/{$reg}");
413
+		$lang=substr($this->culture, 0, 2);
414
+		$reg=substr($this->culture, 3, 2);
415
+		$language=$this->findInfo("Languages/{$lang}");
416
+		$region=$this->findInfo("Countries/{$reg}");
417 417
 		if($region)
418 418
 			return $language[0].' ('.$region[0].')';
419 419
 		else
@@ -428,15 +428,15 @@  discard block
 block discarded – undo
428 428
 	 */
429 429
 	function getEnglishName()
430 430
 	{
431
-		$lang = substr($this->culture,0,2);
432
-		$reg = substr($this->culture,3,2);
433
-		$culture = $this->getInvariantCulture();
431
+		$lang=substr($this->culture, 0, 2);
432
+		$reg=substr($this->culture, 3, 2);
433
+		$culture=$this->getInvariantCulture();
434 434
 
435
-		$language = $culture->findInfo("Languages/{$lang}");
436
-		if(count($language) == 0)
435
+		$language=$culture->findInfo("Languages/{$lang}");
436
+		if(count($language)==0)
437 437
 			return $this->culture;
438 438
 
439
-		$region = $culture->findInfo("Countries/{$reg}");
439
+		$region=$culture->findInfo("Countries/{$reg}");
440 440
 		if($region)
441 441
 			return $language[0].' ('.$region[0].')';
442 442
 		else
@@ -453,8 +453,8 @@  discard block
 block discarded – undo
453 453
 	static function getInvariantCulture()
454 454
 	{
455 455
 		static $invariant;
456
-		if($invariant === null)
457
-			$invariant = new CultureInfo();
456
+		if($invariant===null)
457
+			$invariant=new CultureInfo();
458 458
 		return $invariant;
459 459
 	}
460 460
 
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	 */
467 467
 	function getIsNeutralCulture()
468 468
 	{
469
-		return strlen($this->culture) == 2;
469
+		return strlen($this->culture)==2;
470 470
 	}
471 471
 
472 472
 	/**
@@ -476,12 +476,12 @@  discard block
 block discarded – undo
476 476
 	 */
477 477
 	function getNumberFormat()
478 478
 	{
479
-		if($this->numberFormat === null)
479
+		if($this->numberFormat===null)
480 480
 		{
481
-			$elements = $this->findInfo('NumberElements');
482
-			$patterns = $this->findInfo('NumberPatterns');
483
-			$currencies = $this->getCurrencies();
484
-			$data = array(	'NumberElements'=>$elements,
481
+			$elements=$this->findInfo('NumberElements');
482
+			$patterns=$this->findInfo('NumberPatterns');
483
+			$currencies=$this->getCurrencies();
484
+			$data=array('NumberElements'=>$elements,
485 485
 							'NumberPatterns'=>$patterns,
486 486
 							'Currencies' => $currencies);
487 487
 
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	 */
497 497
 	function setNumberFormat($numberFormat)
498 498
 	{
499
-		$this->numberFormat = $numberFormat;
499
+		$this->numberFormat=$numberFormat;
500 500
 	}
501 501
 
502 502
 	/**
@@ -506,10 +506,10 @@  discard block
 block discarded – undo
506 506
 	 */
507 507
 	function getParent()
508 508
 	{
509
-		if(strlen($this->culture) == 2)
509
+		if(strlen($this->culture)==2)
510 510
 			return $this->getInvariantCulture();
511 511
 
512
-		$lang = substr($this->culture,0,2);
512
+		$lang=substr($this->culture, 0, 2);
513 513
 			return new CultureInfo($lang);
514 514
 	}
515 515
 
@@ -524,24 +524,24 @@  discard block
 block discarded – undo
524 524
 	 */
525 525
 	static function getCultures($type=CultureInfo::ALL)
526 526
 	{
527
-		$dataDir = CultureInfo::dataDir();
528
-		$dataExt = CultureInfo::fileExt();
529
-		$dir = dir($dataDir);
527
+		$dataDir=CultureInfo::dataDir();
528
+		$dataExt=CultureInfo::fileExt();
529
+		$dir=dir($dataDir);
530 530
 
531
-		$neutral = array();
532
-		$specific = array();
531
+		$neutral=array();
532
+		$specific=array();
533 533
 
534
-		while (false !== ($entry = $dir->read()))
534
+		while(false!==($entry=$dir->read()))
535 535
 		{
536 536
 			if(is_file($dataDir.$entry)
537
-				&& substr($entry,-4) == $dataExt
538
-				&& $entry != 'root'.$dataExt)
537
+				&& substr($entry, -4)==$dataExt
538
+				&& $entry!='root'.$dataExt)
539 539
 			{
540
-				$culture = substr($entry,0,-4);
541
-				if(strlen($culture) == 2)
542
-					$neutral[] = $culture;
540
+				$culture=substr($entry, 0, -4);
541
+				if(strlen($culture)==2)
542
+					$neutral[]=$culture;
543 543
 				else
544
-					$specific[] = $culture;
544
+					$specific[]=$culture;
545 545
 			}
546 546
 		}
547 547
 		$dir->close();
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 		switch($type)
550 550
 		{
551 551
 			case CultureInfo::ALL :
552
-				$all = 	array_merge($neutral, $specific);
552
+				$all=array_merge($neutral, $specific);
553 553
 				sort($all);
554 554
 				return $all;
555 555
 				break;
@@ -571,12 +571,12 @@  discard block
 block discarded – undo
571 571
 	 */
572 572
 	private function simplify($array)
573 573
 	{
574
-		for($i = 0, $k = count($array); $i<$k; ++$i)
574
+		for($i=0, $k=count($array); $i < $k; ++$i)
575 575
 		{
576
-			$key = key($array);
576
+			$key=key($array);
577 577
 			if(is_array($array[$key])
578
-				&& count($array[$key]) == 1)
579
-				$array[$key] = $array[$key][0];
578
+				&& count($array[$key])==1)
579
+				$array[$key]=$array[$key][0];
580 580
 			next($array);
581 581
 		}
582 582
 		return $array;
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 	 */
589 589
 	function getCountries()
590 590
 	{
591
-		return $this->simplify($this->findInfo('Countries',true));
591
+		return $this->simplify($this->findInfo('Countries', true));
592 592
 	}
593 593
 
594 594
 	/**
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 	 */
598 598
 	function getCurrencies()
599 599
 	{
600
-		return $this->findInfo('Currencies',true);
600
+		return $this->findInfo('Currencies', true);
601 601
 	}
602 602
 
603 603
 	/**
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 	 */
607 607
 	function getLanguages()
608 608
 	{
609
-		return $this->simplify($this->findInfo('Languages',true));
609
+		return $this->simplify($this->findInfo('Languages', true));
610 610
 	}
611 611
 
612 612
 	/**
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	 */
616 616
 	function getScripts()
617 617
 	{
618
-		return $this->simplify($this->findInfo('Scripts',true));
618
+		return $this->simplify($this->findInfo('Scripts', true));
619 619
 	}
620 620
 
621 621
 	/**
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 	 */
625 625
 	function getTimeZones()
626 626
 	{
627
-		return $this->simplify($this->findInfo('zoneStrings',true));
627
+		return $this->simplify($this->findInfo('zoneStrings', true));
628 628
 	}
629 629
 }
630 630
 
Please login to merge, or discard this patch.
framework/I18N/Translation.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 		//initialized the default class wide formatter
44 44
 		if(!isset(self::$formatters[$catalogue]))
45 45
 		{
46
-			$app = Prado::getApplication()->getGlobalization();
47
-			$config = $app->getTranslationConfiguration();
48
-			$source = MessageSource::factory($config['type'],
46
+			$app=Prado::getApplication()->getGlobalization();
47
+			$config=$app->getTranslationConfiguration();
48
+			$source=MessageSource::factory($config['type'],
49 49
 											$config['source'],
50 50
 											$config['filename']);
51 51
 
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 			if(TPropertyValue::ensureBoolean($config['cache']))
55 55
 				$source->setCache(new MessageCache($config['cache']));
56 56
 
57
-			self::$formatters[$catalogue] = new MessageFormat($source, $app->getCharset());
57
+			self::$formatters[$catalogue]=new MessageFormat($source, $app->getCharset());
58 58
 
59 59
 			//mark untranslated text
60 60
 			if($ps=$config['marker'])
61
-				self::$formatters[$catalogue]->setUntranslatedPS(array($ps,$ps));
61
+				self::$formatters[$catalogue]->setUntranslatedPS(array($ps, $ps));
62 62
 
63 63
 			//save the message on end request
64 64
 			// Do it only once !
@@ -86,21 +86,21 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public static function saveMessages()
88 88
 	{
89
-		static $onceonly = true;
89
+		static $onceonly=true;
90 90
 
91 91
 		if($onceonly)
92 92
 		{
93
-			foreach (self::$formatters as $catalogue=>$formatter)
93
+			foreach(self::$formatters as $catalogue=>$formatter)
94 94
 			{
95
-				$app = Prado::getApplication()->getGlobalization();
96
-				$config = $app->getTranslationConfiguration();
95
+				$app=Prado::getApplication()->getGlobalization();
96
+				$config=$app->getTranslationConfiguration();
97 97
 				if(isset($config['autosave']))
98 98
 				{
99 99
 					$formatter->getSource()->setCulture($app->getCulture());
100 100
 					$formatter->getSource()->save($catalogue);
101 101
 				}
102 102
 			}
103
-			$onceonly = false;
103
+			$onceonly=false;
104 104
 		}
105 105
 	}
106 106
 }
Please login to merge, or discard this patch.