@@ -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; |
@@ -198,7 +198,9 @@ |
||
198 | 198 | |
199 | 199 | /** |
200 | 200 | * Update the catalogue last modified time. |
201 | - * @return boolean true if updated, false otherwise. |
|
201 | + * @param integer $cat_id |
|
202 | + * @param string $variant |
|
203 | + * @return \SQLiteResult true if updated, false otherwise. |
|
202 | 204 | */ |
203 | 205 | private function updateCatalogueTime($cat_id, $variant, $db) |
204 | 206 | { |
@@ -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]; |
@@ -165,6 +165,9 @@ discard block |
||
165 | 165 | return false; |
166 | 166 | } |
167 | 167 | |
168 | + /** |
|
169 | + * @param string $set |
|
170 | + */ |
|
168 | 171 | protected function isValidSetNotation($number, $set) |
169 | 172 | { |
170 | 173 | $str = '$result = '.str_replace('n', '$number', $set).';'; |
@@ -206,8 +209,9 @@ discard block |
||
206 | 209 | /** |
207 | 210 | * For the choice string, and a number, find and return the |
208 | 211 | * string that satisfied the set within the choices. |
209 | - * @param string the choices string. |
|
212 | + * @param string string choices string. |
|
210 | 213 | * @param float the number to test. |
214 | + * @param double $number |
|
211 | 215 | * @return string the choosen string. |
212 | 216 | */ |
213 | 217 | public function format($string, $number) |
@@ -172,8 +172,7 @@ |
||
172 | 172 | { |
173 | 173 | eval($str); |
174 | 174 | return $result; |
175 | - } |
|
176 | - catch(Exception $e) |
|
175 | + } catch(Exception $e) |
|
177 | 176 | { |
178 | 177 | return false; |
179 | 178 | } |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function getCharset() |
43 | 43 | { |
44 | - $app = $this->getApplication()->getGlobalization(false); |
|
44 | + $app=$this->getApplication()->getGlobalization(false); |
|
45 | 45 | |
46 | 46 | //instance charset |
47 | - $charset = $this->getViewState('Charset',''); |
|
47 | + $charset=$this->getViewState('Charset', ''); |
|
48 | 48 | |
49 | 49 | //fall back to globalization charset |
50 | 50 | if(empty($charset)) |
51 | - $charset = ($app===null) ? '' : $app->getCharset(); |
|
51 | + $charset=($app===null) ? '' : $app->getCharset(); |
|
52 | 52 | |
53 | 53 | //fall back to default charset |
54 | 54 | if(empty($charset)) |
55 | - $charset = ($app===null) ? 'UTF-8' : $app->getDefaultCharset(); |
|
55 | + $charset=($app===null) ? 'UTF-8' : $app->getDefaultCharset(); |
|
56 | 56 | |
57 | 57 | return $charset; |
58 | 58 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function setCharset($value) |
65 | 65 | { |
66 | - $this->setViewState('Charset',$value,''); |
|
66 | + $this->setViewState('Charset', $value, ''); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function getCulture() |
76 | 76 | { |
77 | - return $this->getViewState('Culture',''); |
|
77 | + return $this->getViewState('Culture', ''); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function setCulture($culture) |
85 | 85 | { |
86 | - $this->setViewState('Culture',$culture,''); |
|
86 | + $this->setViewState('Culture', $culture, ''); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function getValue() |
82 | 82 | { |
83 | - return $this->getViewState('Value',''); |
|
83 | + return $this->getViewState('Value', ''); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function setValue($value) |
91 | 91 | { |
92 | - $this->setViewState('Value',$value,''); |
|
92 | + $this->setViewState('Value', $value, ''); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | */ |
100 | 100 | protected function translateText($text, $subs) |
101 | 101 | { |
102 | - $text = parent::translateText($text, $subs); |
|
103 | - $choice = new ChoiceFormat(); |
|
104 | - $value = $this->getValue(); |
|
105 | - $string = $choice->format($text, $value); |
|
102 | + $text=parent::translateText($text, $subs); |
|
103 | + $choice=new ChoiceFormat(); |
|
104 | + $value=$this->getValue(); |
|
105 | + $string=$choice->format($text, $value); |
|
106 | 106 | if($string) |
107 | 107 | return strtr($string, array('{Value}'=> $value)); |
108 | 108 | } |
@@ -12,8 +12,8 @@ |
||
12 | 12 | namespace Prado\I18N; |
13 | 13 | |
14 | 14 | /** |
15 | - * Get the ChoiceFormat class. |
|
16 | - */ |
|
15 | + * Get the ChoiceFormat class. |
|
16 | + */ |
|
17 | 17 | use Prado\I18N\core\ChoiceFormat; |
18 | 18 | use Prado\Prado; |
19 | 19 |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function getText() |
68 | 68 | { |
69 | - return $this->getViewState('Text',''); |
|
69 | + return $this->getViewState('Text', ''); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function setText($value) |
77 | 77 | { |
78 | - $this->setViewState('Text',$value,''); |
|
78 | + $this->setViewState('Text', $value, ''); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function setKey($value) |
86 | 86 | { |
87 | - $this->setViewState('Key',$value,''); |
|
87 | + $this->setViewState('Key', $value, ''); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function getKey() |
95 | 95 | { |
96 | - return $this->getViewState('Key',''); |
|
96 | + return $this->getViewState('Key', ''); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function getCatalogue() |
104 | 104 | { |
105 | - return $this->getViewState('Catalogue',''); |
|
105 | + return $this->getViewState('Catalogue', ''); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function setCatalogue($value) |
113 | 113 | { |
114 | - $this->setViewState('Catalogue',$value,''); |
|
114 | + $this->setViewState('Catalogue', $value, ''); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function setTrim($value) |
122 | 122 | { |
123 | - $this->setViewState('Trim',TPropertyValue::ensureBoolean($value),true); |
|
123 | + $this->setViewState('Trim', TPropertyValue::ensureBoolean($value), true); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function getTrim() |
131 | 131 | { |
132 | - return $this->getViewState('Trim',true); |
|
132 | + return $this->getViewState('Trim', true); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function getParameters() |
142 | 142 | { |
143 | - if($parameters=$this->getViewState('Parameters',null)) |
|
143 | + if($parameters=$this->getViewState('Parameters', null)) |
|
144 | 144 | return $parameters; |
145 | 145 | else |
146 | 146 | { |
147 | 147 | $parameters=new TAttributeCollection; |
148 | 148 | $parameters->setCaseSensitive(true); |
149 | - $this->setViewState('Parameters',$parameters,null); |
|
149 | + $this->setViewState('Parameters', $parameters, null); |
|
150 | 150 | return $parameters; |
151 | 151 | } |
152 | 152 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function hasParameter($name) |
158 | 158 | { |
159 | - if($parameters=$this->getViewState('Parameters',null)) |
|
159 | + if($parameters=$this->getViewState('Parameters', null)) |
|
160 | 160 | return $parameters->contains($name); |
161 | 161 | else |
162 | 162 | return false; |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function getParameter($name) |
169 | 169 | { |
170 | - if($parameters=$this->getViewState('Parameters',null)) |
|
170 | + if($parameters=$this->getViewState('Parameters', null)) |
|
171 | 171 | return $parameters->itemAt($name); |
172 | 172 | else |
173 | 173 | return null; |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | * @param string parameter name |
178 | 178 | * @param string value of the parameter |
179 | 179 | */ |
180 | - public function setParameter($name,$value) |
|
180 | + public function setParameter($name, $value) |
|
181 | 181 | { |
182 | - $this->getParameters()->add($name,$value); |
|
182 | + $this->getParameters()->add($name, $value); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function removeParameter($name) |
191 | 191 | { |
192 | - if($parameters=$this->getViewState('Parameters',null)) |
|
192 | + if($parameters=$this->getViewState('Parameters', null)) |
|
193 | 193 | return $parameters->remove($name); |
194 | 194 | else |
195 | 195 | return null; |
@@ -200,25 +200,25 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function render($writer) |
202 | 202 | { |
203 | - $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
204 | - $subs = array(); |
|
203 | + $htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
204 | + $subs=array(); |
|
205 | 205 | foreach($this->getParameters() as $key => $value) |
206 | - $subs['{'.$key.'}'] = $value; |
|
206 | + $subs['{'.$key.'}']=$value; |
|
207 | 207 | foreach($this->getControls() as $control) |
208 | 208 | { |
209 | 209 | if($control instanceof TTranslateParameter) |
210 | - $subs['{'.$control->getKey().'}'] = $control->getParameter(); |
|
210 | + $subs['{'.$control->getKey().'}']=$control->getParameter(); |
|
211 | 211 | elseif($control instanceof TControl) |
212 | 212 | $control->render($htmlWriter); |
213 | 213 | elseif(is_string($control)) |
214 | 214 | $htmlWriter->write($control); |
215 | 215 | } |
216 | 216 | |
217 | - $text = $this->getText(); |
|
217 | + $text=$this->getText(); |
|
218 | 218 | if(strlen($text)==0) |
219 | - $text = $htmlWriter->flush(); |
|
219 | + $text=$htmlWriter->flush(); |
|
220 | 220 | if($this->getTrim()) |
221 | - $text = trim($text); |
|
221 | + $text=trim($text); |
|
222 | 222 | |
223 | 223 | $writer->write($this->translateText($text, $subs)); |
224 | 224 | } |
@@ -231,20 +231,20 @@ discard block |
||
231 | 231 | */ |
232 | 232 | protected function translateText($text, $subs) |
233 | 233 | { |
234 | - $app = $this->getApplication()->getGlobalization(); |
|
234 | + $app=$this->getApplication()->getGlobalization(); |
|
235 | 235 | |
236 | 236 | //no translation handler provided |
237 | - if(($config = $app->getTranslationConfiguration())===null) |
|
237 | + if(($config=$app->getTranslationConfiguration())===null) |
|
238 | 238 | return strtr($text, $subs); |
239 | 239 | |
240 | - $catalogue = $this->getCatalogue(); |
|
240 | + $catalogue=$this->getCatalogue(); |
|
241 | 241 | if(empty($catalogue) && isset($config['catalogue'])) |
242 | - $catalogue = $config['catalogue']; |
|
243 | - if (empty($catalogue)) $catalogue='messages'; |
|
242 | + $catalogue=$config['catalogue']; |
|
243 | + if(empty($catalogue)) $catalogue='messages'; |
|
244 | 244 | Translation::init($catalogue); |
245 | 245 | |
246 | - $key = $this->getKey(); |
|
247 | - if(!empty($key)) $text = $key; |
|
246 | + $key=$this->getKey(); |
|
247 | + if(!empty($key)) $text=$key; |
|
248 | 248 | |
249 | 249 | //translate it |
250 | 250 | return Translation::formatter($catalogue)->format($text, |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function getPattern() |
79 | 79 | { |
80 | - return $this->getViewState('Pattern',''); |
|
80 | + return $this->getViewState('Pattern', ''); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function setPattern($pattern) |
88 | 88 | { |
89 | - $this->setViewState('Pattern',$pattern,''); |
|
89 | + $this->setViewState('Pattern', $pattern, ''); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function getValue() |
97 | 97 | { |
98 | - return $this->getViewState('Value',''); |
|
98 | + return $this->getViewState('Value', ''); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function setValue($value) |
106 | 106 | { |
107 | - $this->setViewState('Value',$value,''); |
|
107 | + $this->setViewState('Value', $value, ''); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function getDefaultText() |
115 | 115 | { |
116 | - return $this->getViewState('DefaultText',''); |
|
116 | + return $this->getViewState('DefaultText', ''); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function setDefaultText($value) |
124 | 124 | { |
125 | - $this->setViewState('DefaultText',$value,''); |
|
125 | + $this->setViewState('DefaultText', $value, ''); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function getType() |
159 | 159 | { |
160 | - return $this->getViewState('Type','d'); |
|
160 | + return $this->getViewState('Type', 'd'); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -168,20 +168,20 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public function setType($type) |
170 | 170 | { |
171 | - $type = strtolower($type); |
|
171 | + $type=strtolower($type); |
|
172 | 172 | |
173 | 173 | switch($type) |
174 | 174 | { |
175 | 175 | case 'decimal': |
176 | - $this->setViewState('Type','d',''); break; |
|
176 | + $this->setViewState('Type', 'd', ''); break; |
|
177 | 177 | case 'currency': |
178 | - $this->setViewState('Type','c',''); break; |
|
178 | + $this->setViewState('Type', 'c', ''); break; |
|
179 | 179 | case 'percentage': |
180 | - $this->setViewState('Type','p',''); break; |
|
180 | + $this->setViewState('Type', 'p', ''); break; |
|
181 | 181 | case 'scientific': |
182 | - $this->setViewState('Type','e',''); break; |
|
182 | + $this->setViewState('Type', 'e', ''); break; |
|
183 | 183 | default: |
184 | - throw new TInvalidDataValueException('numberformat_type_invalid',$type); |
|
184 | + throw new TInvalidDataValueException('numberformat_type_invalid', $type); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function getCurrency() |
193 | 193 | { |
194 | - return $this->getViewState('Currency','USD'); |
|
194 | + return $this->getViewState('Currency', 'USD'); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function setCurrency($currency) |
203 | 203 | { |
204 | - $this->setViewState('Currency', $currency,''); |
|
204 | + $this->setViewState('Currency', $currency, ''); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -212,31 +212,31 @@ discard block |
||
212 | 212 | */ |
213 | 213 | protected function getFormattedValue() |
214 | 214 | { |
215 | - $value = $this->getValue(); |
|
216 | - $defaultText = $this->getDefaultText(); |
|
215 | + $value=$this->getValue(); |
|
216 | + $defaultText=$this->getDefaultText(); |
|
217 | 217 | if(empty($value) && !empty($defaultText)) |
218 | 218 | return $this->getDefaultText(); |
219 | 219 | |
220 | - $app = $this->getApplication()->getGlobalization(); |
|
220 | + $app=$this->getApplication()->getGlobalization(); |
|
221 | 221 | //initialized the default class wide formatter |
222 | 222 | if(self::$formatter===null) |
223 | - self::$formatter = new NumberFormat($app->getCulture()); |
|
223 | + self::$formatter=new NumberFormat($app->getCulture()); |
|
224 | 224 | |
225 | - $pattern = strlen($this->getPattern()) > 0 |
|
225 | + $pattern=strlen($this->getPattern()) > 0 |
|
226 | 226 | ? $this->getPattern() : $this->getType(); |
227 | 227 | |
228 | - $culture = $this->getCulture(); |
|
228 | + $culture=$this->getCulture(); |
|
229 | 229 | //return the specific cultural formatted number |
230 | - if(!empty($culture) && $app->getCulture() != $culture) |
|
230 | + if(!empty($culture) && $app->getCulture()!=$culture) |
|
231 | 231 | { |
232 | - $formatter = new NumberFormat($culture); |
|
233 | - return $formatter->format($this->getValue(),$pattern, |
|
232 | + $formatter=new NumberFormat($culture); |
|
233 | + return $formatter->format($this->getValue(), $pattern, |
|
234 | 234 | $this->getCurrency(), |
235 | 235 | $this->getCharset()); |
236 | 236 | } |
237 | 237 | |
238 | 238 | //return the application wide culture formatted number. |
239 | - return self::$formatter->format($this->getValue(),$pattern, |
|
239 | + return self::$formatter->format($this->getValue(), $pattern, |
|
240 | 240 | $this->getCurrency(), |
241 | 241 | $this->getCharset()); |
242 | 242 | } |
@@ -24,48 +24,48 @@ |
||
24 | 24 | */ |
25 | 25 | |
26 | 26 | /** |
27 | - * To format numbers in locale sensitive manner use |
|
28 | - * <code> |
|
29 | - * <com:TNumberFormat Pattern="0.##" value="2.0" /> |
|
30 | - * </code> |
|
31 | - * |
|
32 | - * Numbers can be formatted as currency, percentage, decimal or scientific |
|
33 | - * numbers by specifying the Type attribute. The known types are |
|
34 | - * "currency", "percentage", "decimal" and "scientific". |
|
35 | - * |
|
36 | - * If someone from US want to see sales figures from a store in |
|
37 | - * Germany (say using the EURO currency), formatted using the german |
|
38 | - * currency, you would need to use the attribute Culture="de_DE" to get |
|
39 | - * the currency right, e.g. 100,00. The decimal and grouping separator is |
|
40 | - * then also from the de_DE locale. This may lead to some confusion because |
|
41 | - * people from US know the "," as thousand separator. Therefore a "Currency" |
|
42 | - * attribute is available, so that the output from the following example |
|
43 | - * results in 100.00. |
|
44 | - * <code> |
|
45 | - * <com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" /> |
|
46 | - * </code> |
|
47 | - * |
|
48 | - * Namespace: System.I18N |
|
49 | - * |
|
50 | - * Properties |
|
51 | - * - <b>Value</b>, number, |
|
52 | - * <br>Gets or sets the number to format. The tag content is used as Value |
|
53 | - * if the Value property is not specified. |
|
54 | - * - <b>Type</b>, string, |
|
55 | - * <br>Gets or sets the formatting type. The valid types are |
|
56 | - * 'decimal', 'currency', 'percentage' and 'scientific'. |
|
57 | - * - <b>Currency</b>, string, |
|
58 | - * <br>Gets or sets the currency symbol for the currency format. |
|
59 | - * The default is 'USD' if the Currency property is not specified. |
|
60 | - * - <b>Pattern</b>, string, |
|
61 | - * <br>Gets or sets the custom number formatting pattern. |
|
62 | - * - <b>DefaultText</b>, string, |
|
63 | - * <br>Gets or sets the default text. If Value is not set, DefaultText will be |
|
64 | - * shown instead of the default currency Value/Pattern. |
|
65 | - * |
|
66 | - * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> |
|
67 | - * @package Prado\I18N |
|
68 | - */ |
|
27 | + * To format numbers in locale sensitive manner use |
|
28 | + * <code> |
|
29 | + * <com:TNumberFormat Pattern="0.##" value="2.0" /> |
|
30 | + * </code> |
|
31 | + * |
|
32 | + * Numbers can be formatted as currency, percentage, decimal or scientific |
|
33 | + * numbers by specifying the Type attribute. The known types are |
|
34 | + * "currency", "percentage", "decimal" and "scientific". |
|
35 | + * |
|
36 | + * If someone from US want to see sales figures from a store in |
|
37 | + * Germany (say using the EURO currency), formatted using the german |
|
38 | + * currency, you would need to use the attribute Culture="de_DE" to get |
|
39 | + * the currency right, e.g. 100,00. The decimal and grouping separator is |
|
40 | + * then also from the de_DE locale. This may lead to some confusion because |
|
41 | + * people from US know the "," as thousand separator. Therefore a "Currency" |
|
42 | + * attribute is available, so that the output from the following example |
|
43 | + * results in 100.00. |
|
44 | + * <code> |
|
45 | + * <com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" /> |
|
46 | + * </code> |
|
47 | + * |
|
48 | + * Namespace: System.I18N |
|
49 | + * |
|
50 | + * Properties |
|
51 | + * - <b>Value</b>, number, |
|
52 | + * <br>Gets or sets the number to format. The tag content is used as Value |
|
53 | + * if the Value property is not specified. |
|
54 | + * - <b>Type</b>, string, |
|
55 | + * <br>Gets or sets the formatting type. The valid types are |
|
56 | + * 'decimal', 'currency', 'percentage' and 'scientific'. |
|
57 | + * - <b>Currency</b>, string, |
|
58 | + * <br>Gets or sets the currency symbol for the currency format. |
|
59 | + * The default is 'USD' if the Currency property is not specified. |
|
60 | + * - <b>Pattern</b>, string, |
|
61 | + * <br>Gets or sets the custom number formatting pattern. |
|
62 | + * - <b>DefaultText</b>, string, |
|
63 | + * <br>Gets or sets the default text. If Value is not set, DefaultText will be |
|
64 | + * shown instead of the default currency Value/Pattern. |
|
65 | + * |
|
66 | + * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> |
|
67 | + * @package Prado\I18N |
|
68 | + */ |
|
69 | 69 | class TNumberFormat extends TI18NControl implements \Prado\IDataRenderer |
70 | 70 | { |
71 | 71 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function setText($value) |
89 | 89 | { |
90 | - if(parent::getText() === $value) |
|
90 | + if(parent::getText()===$value) |
|
91 | 91 | return; |
92 | 92 | |
93 | 93 | parent::setText($value); |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function setChecked($value) |
106 | 106 | { |
107 | - $value = TPropertyValue::ensureBoolean($value); |
|
108 | - if(parent::getChecked() === $value) |
|
107 | + $value=TPropertyValue::ensureBoolean($value); |
|
108 | + if(parent::getChecked()===$value) |
|
109 | 109 | return; |
110 | 110 | |
111 | 111 | parent::setChecked($value); |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | * Since 3.1.4, the javascript code is not rendered if {@link setAutoPostBack AutoPostBack} is false |
128 | 128 | * |
129 | 129 | */ |
130 | - protected function renderInputTag($writer,$clientID,$onclick) |
|
130 | + protected function renderInputTag($writer, $clientID, $onclick) |
|
131 | 131 | { |
132 | - parent::renderInputTag($writer,$clientID,$onclick); |
|
133 | - if ($this->getAutoPostBack()) |
|
132 | + parent::renderInputTag($writer, $clientID, $onclick); |
|
133 | + if($this->getAutoPostBack()) |
|
134 | 134 | $this->getActiveControl()->registerCallbackClientScript( |
135 | 135 | $this->getClientClassName(), $this->getPostBackOptions()); |
136 | 136 | } |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function getLabelAttributes() |
151 | 151 | { |
152 | - $attributes = parent::getLabelAttributes(); |
|
153 | - $attributes['id'] = $this->getDefaultLabelID(); |
|
152 | + $attributes=parent::getLabelAttributes(); |
|
153 | + $attributes['id']=$this->getDefaultLabelID(); |
|
154 | 154 | return $attributes; |
155 | 155 | } |
156 | 156 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param string radio button id |
161 | 161 | * @param string label text |
162 | 162 | */ |
163 | - protected function renderLabel($writer,$clientID,$text) |
|
163 | + protected function renderLabel($writer, $clientID, $text) |
|
164 | 164 | { |
165 | 165 | $writer->addAttribute('id', $this->getDefaultLabelID()); |
166 | 166 | parent::renderLabel($writer, $clientID, $text); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | protected function getDefaultLabelID() |
173 | 173 | { |
174 | - if($attributes=$this->getViewState('LabelAttributes',null)) |
|
174 | + if($attributes=$this->getViewState('LabelAttributes', null)) |
|
175 | 175 | return $this->getLabelAttributes()->itemAt('id'); |
176 | 176 | else |
177 | 177 | return $this->getClientID().'_label'; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function setText($value) |
64 | 64 | { |
65 | - if(parent::getText() === $value) |
|
65 | + if(parent::getText()===$value) |
|
66 | 66 | return; |
67 | 67 | |
68 | 68 | parent::setText($value); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | protected function addAttributesToRender($writer) |
119 | 119 | { |
120 | 120 | parent::addAttributesToRender($writer); |
121 | - $writer->addAttribute('id',$this->getClientID()); |
|
121 | + $writer->addAttribute('id', $this->getClientID()); |
|
122 | 122 | $this->getActiveControl()->registerCallbackClientScript( |
123 | 123 | $this->getClientClassName(), $this->getPostBackOptions()); |
124 | 124 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function setText($value) |
52 | 52 | { |
53 | - if(parent::getText() === $value) |
|
53 | + if(parent::getText()===$value) |
|
54 | 54 | return; |
55 | 55 | |
56 | 56 | parent::setText($value); |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function setImageUrl($value) |
66 | 66 | { |
67 | - if(parent::getImageUrl() === $value) |
|
67 | + if(parent::getImageUrl()===$value) |
|
68 | 68 | return; |
69 | 69 | |
70 | 70 | parent::setImageUrl($value); |
71 | - if($this->getActiveControl()->canUpdateClientSide() && $value !== '') |
|
71 | + if($this->getActiveControl()->canUpdateClientSide() && $value!=='') |
|
72 | 72 | { |
73 | - $textWriter = new TTextWriter; |
|
74 | - $renderer = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), $textWriter); |
|
73 | + $textWriter=new TTextWriter; |
|
74 | + $renderer=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), $textWriter); |
|
75 | 75 | $this->createImage($value)->renderControl($renderer); |
76 | 76 | $this->getPage()->getCallbackClient()->update($this, $textWriter->flush()); |
77 | 77 | } |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function setNavigateUrl($value) |
85 | 85 | { |
86 | - if(parent::getNavigateUrl() === $value) |
|
86 | + if(parent::getNavigateUrl()===$value) |
|
87 | 87 | return; |
88 | 88 | |
89 | 89 | parent::setNavigateUrl($value); |
90 | 90 | if($this->getActiveControl()->canUpdateClientSide()) |
91 | 91 | { |
92 | 92 | //replace & with & and urldecode the url (setting the href using javascript is literal) |
93 | - $url = urldecode(str_replace('&', '&', $value)); |
|
93 | + $url=urldecode(str_replace('&', '&', $value)); |
|
94 | 94 | $this->getPage()->getCallbackClient()->setAttribute($this, 'href', $url); |
95 | 95 | } |
96 | 96 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function setTarget($value) |
103 | 103 | { |
104 | - if(parent::getTarget() === $value) |
|
104 | + if(parent::getTarget()===$value) |
|
105 | 105 | return; |
106 | 106 | |
107 | 107 | parent::setTarget($value); |