@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function parseDSN($dsn) |
41 | 41 | { |
42 | - if (is_array($dsn)) { |
|
42 | + if(is_array($dsn)) { |
|
43 | 43 | return $dsn; |
44 | 44 | } |
45 | 45 | |
46 | - $parsed = array( |
|
46 | + $parsed=array( |
|
47 | 47 | 'phptype' => false, |
48 | 48 | 'dbsyntax' => false, |
49 | 49 | 'username' => false, |
@@ -56,94 +56,94 @@ discard block |
||
56 | 56 | ); |
57 | 57 | |
58 | 58 | // Find phptype and dbsyntax |
59 | - if (($pos = strpos($dsn, '://')) !== false) { |
|
60 | - $str = substr($dsn, 0, $pos); |
|
61 | - $dsn = substr($dsn, $pos + 3); |
|
59 | + if(($pos=strpos($dsn, '://'))!==false) { |
|
60 | + $str=substr($dsn, 0, $pos); |
|
61 | + $dsn=substr($dsn, $pos + 3); |
|
62 | 62 | } else { |
63 | - $str = $dsn; |
|
64 | - $dsn = null; |
|
63 | + $str=$dsn; |
|
64 | + $dsn=null; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | // Get phptype and dbsyntax |
68 | 68 | // $str => phptype(dbsyntax) |
69 | - if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) { |
|
70 | - $parsed['phptype'] = $arr[1]; |
|
71 | - $parsed['dbsyntax'] = (empty($arr[2])) ? $arr[1] : $arr[2]; |
|
69 | + if(preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) { |
|
70 | + $parsed['phptype']=$arr[1]; |
|
71 | + $parsed['dbsyntax']=(empty($arr[2])) ? $arr[1] : $arr[2]; |
|
72 | 72 | } else { |
73 | - $parsed['phptype'] = $str; |
|
74 | - $parsed['dbsyntax'] = $str; |
|
73 | + $parsed['phptype']=$str; |
|
74 | + $parsed['dbsyntax']=$str; |
|
75 | 75 | } |
76 | 76 | |
77 | - if (empty($dsn)) { |
|
77 | + if(empty($dsn)) { |
|
78 | 78 | return $parsed; |
79 | 79 | } |
80 | 80 | |
81 | 81 | // Get (if found): username and password |
82 | 82 | // $dsn => username:password@protocol+hostspec/database |
83 | - if (($at = strrpos($dsn,'@')) !== false) { |
|
84 | - $str = substr($dsn, 0, $at); |
|
85 | - $dsn = substr($dsn, $at + 1); |
|
86 | - if (($pos = strpos($str, ':')) !== false) { |
|
87 | - $parsed['username'] = rawurldecode(substr($str, 0, $pos)); |
|
88 | - $parsed['password'] = rawurldecode(substr($str, $pos + 1)); |
|
83 | + if(($at=strrpos($dsn, '@'))!==false) { |
|
84 | + $str=substr($dsn, 0, $at); |
|
85 | + $dsn=substr($dsn, $at + 1); |
|
86 | + if(($pos=strpos($str, ':'))!==false) { |
|
87 | + $parsed['username']=rawurldecode(substr($str, 0, $pos)); |
|
88 | + $parsed['password']=rawurldecode(substr($str, $pos + 1)); |
|
89 | 89 | } else { |
90 | - $parsed['username'] = rawurldecode($str); |
|
90 | + $parsed['username']=rawurldecode($str); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | 94 | // Find protocol and hostspec |
95 | 95 | |
96 | 96 | // $dsn => proto(proto_opts)/database |
97 | - if (preg_match('|^([^(]+)\((.*?)\)/?(.*?)$|', $dsn, $match)) { |
|
98 | - $proto = $match[1]; |
|
99 | - $proto_opts = (!empty($match[2])) ? $match[2] : false; |
|
100 | - $dsn = $match[3]; |
|
97 | + if(preg_match('|^([^(]+)\((.*?)\)/?(.*?)$|', $dsn, $match)) { |
|
98 | + $proto=$match[1]; |
|
99 | + $proto_opts=(!empty($match[2])) ? $match[2] : false; |
|
100 | + $dsn=$match[3]; |
|
101 | 101 | |
102 | 102 | // $dsn => protocol+hostspec/database (old format) |
103 | 103 | } else { |
104 | - if (strpos($dsn, '+') !== false) { |
|
105 | - list($proto, $dsn) = explode('+', $dsn, 2); |
|
104 | + if(strpos($dsn, '+')!==false) { |
|
105 | + list($proto, $dsn)=explode('+', $dsn, 2); |
|
106 | 106 | } |
107 | - if (strpos($dsn, '/') !== false) { |
|
108 | - list($proto_opts, $dsn) = explode('/', $dsn, 2); |
|
107 | + if(strpos($dsn, '/')!==false) { |
|
108 | + list($proto_opts, $dsn)=explode('/', $dsn, 2); |
|
109 | 109 | } else { |
110 | - $proto_opts = $dsn; |
|
111 | - $dsn = null; |
|
110 | + $proto_opts=$dsn; |
|
111 | + $dsn=null; |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | 115 | // process the different protocol options |
116 | - $parsed['protocol'] = (!empty($proto)) ? $proto : 'tcp'; |
|
117 | - $proto_opts = rawurldecode($proto_opts); |
|
118 | - if ($parsed['protocol'] == 'tcp') { |
|
119 | - if (strpos($proto_opts, ':') !== false) { |
|
120 | - list($parsed['hostspec'], $parsed['port']) = explode(':', $proto_opts); |
|
116 | + $parsed['protocol']=(!empty($proto)) ? $proto : 'tcp'; |
|
117 | + $proto_opts=rawurldecode($proto_opts); |
|
118 | + if($parsed['protocol']=='tcp') { |
|
119 | + if(strpos($proto_opts, ':')!==false) { |
|
120 | + list($parsed['hostspec'], $parsed['port'])=explode(':', $proto_opts); |
|
121 | 121 | } else { |
122 | - $parsed['hostspec'] = $proto_opts; |
|
122 | + $parsed['hostspec']=$proto_opts; |
|
123 | 123 | } |
124 | - } elseif ($parsed['protocol'] == 'unix') { |
|
125 | - $parsed['socket'] = $proto_opts; |
|
124 | + } elseif($parsed['protocol']=='unix') { |
|
125 | + $parsed['socket']=$proto_opts; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | // Get dabase if any |
129 | 129 | // $dsn => database |
130 | - if (!empty($dsn)) { |
|
130 | + if(!empty($dsn)) { |
|
131 | 131 | // /database |
132 | - if (($pos = strpos($dsn, '?')) === false) { |
|
133 | - $parsed['database'] = $dsn; |
|
132 | + if(($pos=strpos($dsn, '?'))===false) { |
|
133 | + $parsed['database']=$dsn; |
|
134 | 134 | // /database?param1=value1¶m2=value2 |
135 | 135 | } else { |
136 | - $parsed['database'] = substr($dsn, 0, $pos); |
|
137 | - $dsn = substr($dsn, $pos + 1); |
|
138 | - if (strpos($dsn, '&') !== false) { |
|
139 | - $opts = explode('&', $dsn); |
|
136 | + $parsed['database']=substr($dsn, 0, $pos); |
|
137 | + $dsn=substr($dsn, $pos + 1); |
|
138 | + if(strpos($dsn, '&')!==false) { |
|
139 | + $opts=explode('&', $dsn); |
|
140 | 140 | } else { // database?param1=value1 |
141 | - $opts = array($dsn); |
|
141 | + $opts=array($dsn); |
|
142 | 142 | } |
143 | - foreach ($opts as $opt) { |
|
144 | - list($key, $value) = explode('=', $opt); |
|
145 | - if (!isset($parsed[$key])) { // don't allow params overwrite |
|
146 | - $parsed[$key] = rawurldecode($value); |
|
143 | + foreach($opts as $opt) { |
|
144 | + list($key, $value)=explode('=', $opt); |
|
145 | + if(!isset($parsed[$key])) { // don't allow params overwrite |
|
146 | + $parsed[$key]=rawurldecode($value); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | } |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | */ |
162 | 162 | function I18N_toUTF8($string, $from) |
163 | 163 | { |
164 | - if($from != 'UTF-8') |
|
164 | + if($from!='UTF-8') |
|
165 | 165 | { |
166 | - $s = iconv($from,'UTF-8',$string); //to UTF-8 |
|
167 | - return $s !== false ? $s : $string; //it could return false |
|
166 | + $s=iconv($from, 'UTF-8', $string); //to UTF-8 |
|
167 | + return $s!==false ? $s : $string; //it could return false |
|
168 | 168 | } |
169 | 169 | return $string; |
170 | 170 | } |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | */ |
178 | 178 | function I18N_toEncoding($string, $to) |
179 | 179 | { |
180 | - if($to != 'UTF-8') |
|
180 | + if($to!='UTF-8') |
|
181 | 181 | { |
182 | - $s = iconv('UTF-8', $to, $string); |
|
183 | - return $s !== false ? $s : $string; |
|
182 | + $s=iconv('UTF-8', $to, $string); |
|
183 | + return $s!==false ? $s : $string; |
|
184 | 184 | } |
185 | 185 | return $string; |
186 | 186 | } |
@@ -47,7 +47,7 @@ |
||
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. |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | */ |
66 | 66 | function __construct($source) |
67 | 67 | { |
68 | - $this->source = (string)$source; |
|
69 | - $this->dns = parseDSN($this->source); |
|
70 | - $this->db = $this->connect(); |
|
68 | + $this->source=(string) $source; |
|
69 | + $this->dns=parseDSN($this->source); |
|
70 | + $this->db=$this->connect(); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -90,38 +90,38 @@ discard block |
||
90 | 90 | if($conn!==null) |
91 | 91 | return $conn; |
92 | 92 | */ |
93 | - $dsninfo = $this->dns; |
|
93 | + $dsninfo=$this->dns; |
|
94 | 94 | |
95 | - if (isset($dsninfo['protocol']) && $dsninfo['protocol'] == 'unix') |
|
96 | - $dbhost = ':' . $dsninfo['socket']; |
|
95 | + if(isset($dsninfo['protocol']) && $dsninfo['protocol']=='unix') |
|
96 | + $dbhost=':'.$dsninfo['socket']; |
|
97 | 97 | else |
98 | 98 | { |
99 | - $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; |
|
100 | - if (!empty($dsninfo['port'])) |
|
101 | - $dbhost .= ':' . $dsninfo['port']; |
|
99 | + $dbhost=$dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; |
|
100 | + if(!empty($dsninfo['port'])) |
|
101 | + $dbhost.=':'.$dsninfo['port']; |
|
102 | 102 | } |
103 | - $user = $dsninfo['username']; |
|
104 | - $pw = $dsninfo['password']; |
|
103 | + $user=$dsninfo['username']; |
|
104 | + $pw=$dsninfo['password']; |
|
105 | 105 | |
106 | - $connect_function = 'mysql_connect'; |
|
106 | + $connect_function='mysql_connect'; |
|
107 | 107 | |
108 | - if ($dbhost && $user && $pw) |
|
109 | - $conn = @$connect_function($dbhost, $user, $pw); |
|
110 | - elseif ($dbhost && $user) |
|
111 | - $conn = @$connect_function($dbhost, $user); |
|
112 | - elseif ($dbhost) |
|
113 | - $conn = @$connect_function($dbhost); |
|
108 | + if($dbhost && $user && $pw) |
|
109 | + $conn=@$connect_function($dbhost, $user, $pw); |
|
110 | + elseif($dbhost && $user) |
|
111 | + $conn=@$connect_function($dbhost, $user); |
|
112 | + elseif($dbhost) |
|
113 | + $conn=@$connect_function($dbhost); |
|
114 | 114 | else |
115 | - $conn = false; |
|
115 | + $conn=false; |
|
116 | 116 | |
117 | - if (empty($conn)) |
|
117 | + if(empty($conn)) |
|
118 | 118 | { |
119 | 119 | throw new Exception('Error in connecting to '.$dsninfo); |
120 | 120 | } |
121 | 121 | |
122 | - if ($dsninfo['database']) |
|
122 | + if($dsninfo['database']) |
|
123 | 123 | { |
124 | - if (!@mysql_select_db($dsninfo['database'], $conn)) |
|
124 | + if(!@mysql_select_db($dsninfo['database'], $conn)) |
|
125 | 125 | throw new Exception('Error in connecting database, dns:'. |
126 | 126 | $dsninfo); |
127 | 127 | } |
@@ -148,25 +148,25 @@ discard block |
||
148 | 148 | */ |
149 | 149 | protected function &loadData($variant) |
150 | 150 | { |
151 | - $variant = mysql_real_escape_string($variant); |
|
151 | + $variant=mysql_real_escape_string($variant); |
|
152 | 152 | |
153 | - $statement = |
|
153 | + $statement= |
|
154 | 154 | "SELECT t.id, t.source, t.target, t.comments |
155 | 155 | FROM trans_unit t, catalogue c |
156 | 156 | WHERE c.cat_id = t.cat_id |
157 | 157 | AND c.name = '{$variant}' |
158 | 158 | ORDER BY id ASC"; |
159 | 159 | |
160 | - $rs = mysql_query($statement,$this->db); |
|
160 | + $rs=mysql_query($statement, $this->db); |
|
161 | 161 | |
162 | - $result = array(); |
|
162 | + $result=array(); |
|
163 | 163 | |
164 | - while($row = mysql_fetch_array($rs,MYSQL_NUM)) |
|
164 | + while($row=mysql_fetch_array($rs, MYSQL_NUM)) |
|
165 | 165 | { |
166 | - $source = $row[1]; |
|
167 | - $result[$source][] = $row[2]; //target |
|
168 | - $result[$source][] = $row[0]; //id |
|
169 | - $result[$source][] = $row[3]; //comments |
|
166 | + $source=$row[1]; |
|
167 | + $result[$source][]=$row[2]; //target |
|
168 | + $result[$source][]=$row[0]; //id |
|
169 | + $result[$source][]=$row[3]; //comments |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | return $result; |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | */ |
181 | 181 | protected function getLastModified($source) |
182 | 182 | { |
183 | - $source = mysql_real_escape_string($source); |
|
183 | + $source=mysql_real_escape_string($source); |
|
184 | 184 | |
185 | - $rs = mysql_query( |
|
185 | + $rs=mysql_query( |
|
186 | 186 | "SELECT date_modified FROM catalogue WHERE name = '{$source}'", |
187 | 187 | $this->db); |
188 | 188 | |
189 | - $result = $rs ? (int)mysql_result($rs,0) : 0; |
|
189 | + $result=$rs ? (int) mysql_result($rs, 0) : 0; |
|
190 | 190 | |
191 | 191 | return $result; |
192 | 192 | } |
@@ -199,15 +199,15 @@ discard block |
||
199 | 199 | */ |
200 | 200 | protected function isValidSource($variant) |
201 | 201 | { |
202 | - $variant = mysql_real_escape_string ($variant); |
|
202 | + $variant=mysql_real_escape_string($variant); |
|
203 | 203 | |
204 | - $rs = mysql_query( |
|
204 | + $rs=mysql_query( |
|
205 | 205 | "SELECT COUNT(*) FROM catalogue WHERE name = '{$variant}'", |
206 | 206 | $this->db); |
207 | 207 | |
208 | - $row = mysql_fetch_array($rs,MYSQL_NUM); |
|
208 | + $row=mysql_fetch_array($rs, MYSQL_NUM); |
|
209 | 209 | |
210 | - $result = $row && $row[0] == '1'; |
|
210 | + $result=$row && $row[0]=='1'; |
|
211 | 211 | |
212 | 212 | return $result; |
213 | 213 | } |
@@ -219,18 +219,18 @@ discard block |
||
219 | 219 | */ |
220 | 220 | protected function getCatalogueList($catalogue) |
221 | 221 | { |
222 | - $variants = explode('_',$this->culture); |
|
222 | + $variants=explode('_', $this->culture); |
|
223 | 223 | |
224 | - $catalogues = array($catalogue); |
|
224 | + $catalogues=array($catalogue); |
|
225 | 225 | |
226 | - $variant = null; |
|
226 | + $variant=null; |
|
227 | 227 | |
228 | - for($i = 0, $k = count($variants); $i < $k; ++$i) |
|
228 | + for($i=0, $k=count($variants); $i < $k; ++$i) |
|
229 | 229 | { |
230 | 230 | if(isset($variants[$i]{0})) |
231 | 231 | { |
232 | - $variant .= ($variant)?'_'.$variants[$i]:$variants[$i]; |
|
233 | - $catalogues[] = $catalogue.'.'.$variant; |
|
232 | + $variant.=($variant) ? '_'.$variants[$i] : $variants[$i]; |
|
233 | + $catalogues[]=$catalogue.'.'.$variant; |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | return array_reverse($catalogues); |
@@ -244,27 +244,27 @@ discard block |
||
244 | 244 | private function getCatalogueDetails($catalogue='messages') |
245 | 245 | { |
246 | 246 | if(empty($catalogue)) |
247 | - $catalogue = 'messages'; |
|
247 | + $catalogue='messages'; |
|
248 | 248 | |
249 | - $variant = $catalogue.'.'.$this->culture; |
|
249 | + $variant=$catalogue.'.'.$this->culture; |
|
250 | 250 | |
251 | - $name = mysql_real_escape_string($this->getSource($variant)); |
|
251 | + $name=mysql_real_escape_string($this->getSource($variant)); |
|
252 | 252 | |
253 | - $rs = mysql_query("SELECT cat_id |
|
253 | + $rs=mysql_query("SELECT cat_id |
|
254 | 254 | FROM catalogue WHERE name = '{$name}'", $this->db); |
255 | 255 | |
256 | - if(mysql_num_rows($rs) != 1) |
|
256 | + if(mysql_num_rows($rs)!=1) |
|
257 | 257 | return false; |
258 | 258 | |
259 | - $cat_id = (int)mysql_result($rs,0); |
|
259 | + $cat_id=(int) mysql_result($rs, 0); |
|
260 | 260 | |
261 | 261 | //first get the catalogue ID |
262 | - $rs = mysql_query( |
|
262 | + $rs=mysql_query( |
|
263 | 263 | "SELECT count(msg_id) |
264 | 264 | FROM trans_unit |
265 | 265 | WHERE cat_id = {$cat_id}", $this->db); |
266 | 266 | |
267 | - $count = (int)mysql_result($rs,0); |
|
267 | + $count=(int) mysql_result($rs, 0); |
|
268 | 268 | |
269 | 269 | return array($cat_id, $variant, $count); |
270 | 270 | } |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | */ |
276 | 276 | private function updateCatalogueTime($cat_id, $variant) |
277 | 277 | { |
278 | - $time = time(); |
|
278 | + $time=time(); |
|
279 | 279 | |
280 | - $result = mysql_query("UPDATE catalogue |
|
280 | + $result=mysql_query("UPDATE catalogue |
|
281 | 281 | SET date_modified = {$time} |
282 | 282 | WHERE cat_id = {$cat_id}", $this->db); |
283 | 283 | |
@@ -296,27 +296,27 @@ discard block |
||
296 | 296 | */ |
297 | 297 | function save($catalogue='messages') |
298 | 298 | { |
299 | - $messages = $this->untranslated; |
|
299 | + $messages=$this->untranslated; |
|
300 | 300 | |
301 | 301 | if(count($messages) <= 0) return false; |
302 | 302 | |
303 | - $details = $this->getCatalogueDetails($catalogue); |
|
303 | + $details=$this->getCatalogueDetails($catalogue); |
|
304 | 304 | |
305 | 305 | if($details) |
306 | - list($cat_id, $variant, $count) = $details; |
|
306 | + list($cat_id, $variant, $count)=$details; |
|
307 | 307 | else |
308 | 308 | return false; |
309 | 309 | |
310 | 310 | if($cat_id <= 0) return false; |
311 | - $inserted = 0; |
|
311 | + $inserted=0; |
|
312 | 312 | |
313 | - $time = time(); |
|
313 | + $time=time(); |
|
314 | 314 | |
315 | 315 | foreach($messages as $message) |
316 | 316 | { |
317 | 317 | $count++; $inserted++; |
318 | - $message = mysql_real_escape_string($message); |
|
319 | - $statement = "INSERT INTO trans_unit |
|
318 | + $message=mysql_real_escape_string($message); |
|
319 | + $statement="INSERT INTO trans_unit |
|
320 | 320 | (cat_id,id,source,date_added) VALUES |
321 | 321 | ({$cat_id}, {$count},'{$message}',$time)"; |
322 | 322 | mysql_query($statement, $this->db); |
@@ -335,22 +335,22 @@ discard block |
||
335 | 335 | */ |
336 | 336 | function delete($message, $catalogue='messages') |
337 | 337 | { |
338 | - $details = $this->getCatalogueDetails($catalogue); |
|
338 | + $details=$this->getCatalogueDetails($catalogue); |
|
339 | 339 | if($details) |
340 | - list($cat_id, $variant, $count) = $details; |
|
340 | + list($cat_id, $variant, $count)=$details; |
|
341 | 341 | else |
342 | 342 | return false; |
343 | 343 | |
344 | - $text = mysql_real_escape_string($message); |
|
344 | + $text=mysql_real_escape_string($message); |
|
345 | 345 | |
346 | - $statement = "DELETE FROM trans_unit WHERE |
|
346 | + $statement="DELETE FROM trans_unit WHERE |
|
347 | 347 | cat_id = {$cat_id} AND source = '{$message}'"; |
348 | - $deleted = false; |
|
348 | + $deleted=false; |
|
349 | 349 | |
350 | 350 | mysql_query($statement, $this->db); |
351 | 351 | |
352 | - if(mysql_affected_rows($this->db) == 1) |
|
353 | - $deleted = $this->updateCatalogueTime($cat_id, $variant); |
|
352 | + if(mysql_affected_rows($this->db)==1) |
|
353 | + $deleted=$this->updateCatalogueTime($cat_id, $variant); |
|
354 | 354 | |
355 | 355 | return $deleted; |
356 | 356 | |
@@ -366,30 +366,30 @@ discard block |
||
366 | 366 | */ |
367 | 367 | function update($text, $target, $comments, $catalogue='messages') |
368 | 368 | { |
369 | - $details = $this->getCatalogueDetails($catalogue); |
|
369 | + $details=$this->getCatalogueDetails($catalogue); |
|
370 | 370 | if($details) |
371 | - list($cat_id, $variant, $count) = $details; |
|
371 | + list($cat_id, $variant, $count)=$details; |
|
372 | 372 | else |
373 | 373 | return false; |
374 | 374 | |
375 | - $comments = mysql_real_escape_string($comments); |
|
376 | - $target = mysql_real_escape_string($target); |
|
377 | - $text = mysql_real_escape_string($text); |
|
375 | + $comments=mysql_real_escape_string($comments); |
|
376 | + $target=mysql_real_escape_string($target); |
|
377 | + $text=mysql_real_escape_string($text); |
|
378 | 378 | |
379 | - $time = time(); |
|
379 | + $time=time(); |
|
380 | 380 | |
381 | - $statement = "UPDATE trans_unit SET |
|
381 | + $statement="UPDATE trans_unit SET |
|
382 | 382 | target = '{$target}', |
383 | 383 | comments = '{$comments}', |
384 | 384 | date_modified = '{$time}' |
385 | 385 | WHERE cat_id = {$cat_id} |
386 | 386 | AND source = '{$text}'"; |
387 | 387 | |
388 | - $updated = false; |
|
388 | + $updated=false; |
|
389 | 389 | |
390 | 390 | mysql_query($statement, $this->db); |
391 | - if(mysql_affected_rows($this->db) == 1) |
|
392 | - $updated = $this->updateCatalogueTime($cat_id, $variant); |
|
391 | + if(mysql_affected_rows($this->db)==1) |
|
392 | + $updated=$this->updateCatalogueTime($cat_id, $variant); |
|
393 | 393 | |
394 | 394 | return $updated; |
395 | 395 | } |
@@ -400,15 +400,15 @@ discard block |
||
400 | 400 | */ |
401 | 401 | function catalogues() |
402 | 402 | { |
403 | - $statement = 'SELECT name FROM catalogue ORDER BY name'; |
|
404 | - $rs = mysql_query($statement, $this->db); |
|
405 | - $result = array(); |
|
406 | - while($row = mysql_fetch_array($rs,MYSQL_NUM)) |
|
403 | + $statement='SELECT name FROM catalogue ORDER BY name'; |
|
404 | + $rs=mysql_query($statement, $this->db); |
|
405 | + $result=array(); |
|
406 | + while($row=mysql_fetch_array($rs, MYSQL_NUM)) |
|
407 | 407 | { |
408 | - $details = explode('.',$row[0]); |
|
409 | - if(!isset($details[1])) $details[1] = null; |
|
408 | + $details=explode('.', $row[0]); |
|
409 | + if(!isset($details[1])) $details[1]=null; |
|
410 | 410 | |
411 | - $result[] = $details; |
|
411 | + $result[]=$details; |
|
412 | 412 | } |
413 | 413 | return $result; |
414 | 414 | } |
@@ -90,14 +90,14 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -54,8 +54,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -82,13 +82,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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]; |
@@ -51,44 +51,44 @@ discard block |
||
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 |
||
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 |
||
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; |
@@ -45,23 +45,23 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -52,24 +52,24 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |