@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | //initialized the default class wide formatter |
44 | 44 | if(!isset(self::$formatters[$catalogue])) |
45 | 45 | { |
46 | - $app = Prado::getApplication()->getGlobalization(); |
|
47 | - $config = $app->getTranslationConfiguration(); |
|
48 | - $source = MessageSource::factory($config['type'], |
|
46 | + $app=Prado::getApplication()->getGlobalization(); |
|
47 | + $config=$app->getTranslationConfiguration(); |
|
48 | + $source=MessageSource::factory($config['type'], |
|
49 | 49 | $config['source'], |
50 | 50 | $config['filename']); |
51 | 51 | |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | if(TPropertyValue::ensureBoolean($config['cache'])) |
55 | 55 | $source->setCache(new MessageCache($config['cache'])); |
56 | 56 | |
57 | - self::$formatters[$catalogue] = new MessageFormat($source, $app->getCharset()); |
|
57 | + self::$formatters[$catalogue]=new MessageFormat($source, $app->getCharset()); |
|
58 | 58 | |
59 | 59 | //mark untranslated text |
60 | 60 | if($ps=$config['marker']) |
61 | - self::$formatters[$catalogue]->setUntranslatedPS(array($ps,$ps)); |
|
61 | + self::$formatters[$catalogue]->setUntranslatedPS(array($ps, $ps)); |
|
62 | 62 | |
63 | 63 | //save the message on end request |
64 | 64 | // Do it only once ! |
@@ -86,21 +86,21 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public static function saveMessages() |
88 | 88 | { |
89 | - static $onceonly = true; |
|
89 | + static $onceonly=true; |
|
90 | 90 | |
91 | 91 | if($onceonly) |
92 | 92 | { |
93 | - foreach (self::$formatters as $catalogue=>$formatter) |
|
93 | + foreach(self::$formatters as $catalogue=>$formatter) |
|
94 | 94 | { |
95 | - $app = Prado::getApplication()->getGlobalization(); |
|
96 | - $config = $app->getTranslationConfiguration(); |
|
95 | + $app=Prado::getApplication()->getGlobalization(); |
|
96 | + $config=$app->getTranslationConfiguration(); |
|
97 | 97 | if(isset($config['autosave'])) |
98 | 98 | { |
99 | 99 | $formatter->getSource()->setCulture($app->getCulture()); |
100 | 100 | $formatter->getSource()->save($catalogue); |
101 | 101 | } |
102 | 102 | } |
103 | - $onceonly = false; |
|
103 | + $onceonly=false; |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
@@ -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 |
@@ -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 | /** |
@@ -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); |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function setInterval($value) |
45 | 45 | { |
46 | - $interval = TPropertyValue::ensureFloat($value); |
|
46 | + $interval=TPropertyValue::ensureFloat($value); |
|
47 | 47 | if($interval <= 0) |
48 | 48 | throw new TConfigurationException('callback_interval_be_positive', $this->getID()); |
49 | 49 | |
50 | - if($this->getInterval() === $value) |
|
50 | + if($this->getInterval()===$value) |
|
51 | 51 | return; |
52 | 52 | |
53 | 53 | $this->setViewState('Interval', $interval, 1); |
54 | - if ($this->getActiveControl()->canUpdateClientSide()){ |
|
55 | - $client = $this->getPage()->getCallbackClient(); |
|
54 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
55 | + $client=$this->getPage()->getCallbackClient(); |
|
56 | 56 | $client->callClientFunction('Prado.WebUI.TTimeTriggeredCallback.setTimerInterval', array($this, $interval)); |
57 | 57 | } |
58 | 58 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function startTimer() |
64 | 64 | { |
65 | - $client = $this->getPage()->getCallbackClient(); |
|
65 | + $client=$this->getPage()->getCallbackClient(); |
|
66 | 66 | $client->callClientFunction('Prado.WebUI.TTimeTriggeredCallback.start', array($this)); |
67 | 67 | } |
68 | 68 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function stopTimer() |
73 | 73 | { |
74 | - $client = $this->getPage()->getCallbackClient(); |
|
74 | + $client=$this->getPage()->getCallbackClient(); |
|
75 | 75 | $client->callClientFunction('Prado.WebUI.TTimeTriggeredCallback.stop', array($this)); |
76 | 76 | } |
77 | 77 | |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | */ |
98 | 98 | protected function getTriggerOptions() |
99 | 99 | { |
100 | - $options['ID'] = $this->getClientID(); |
|
101 | - $options['EventTarget']= $this->getUniqueID(); |
|
102 | - $options['Interval'] = $this->getInterval(); |
|
100 | + $options['ID']=$this->getClientID(); |
|
101 | + $options['EventTarget']=$this->getUniqueID(); |
|
102 | + $options['Interval']=$this->getInterval(); |
|
103 | 103 | return $options; |
104 | 104 | } |
105 | 105 | |
@@ -112,10 +112,10 @@ discard block |
||
112 | 112 | parent::render($writer); |
113 | 113 | $this->getActiveControl()->registerCallbackClientScript( |
114 | 114 | $this->getClientClassName(), $this->getTriggerOptions()); |
115 | - if($this->getStartTimerOnLoad()){ |
|
116 | - $id = $this->getClientID(); |
|
117 | - $code = "Prado.WebUI.TTimeTriggeredCallback.start('{$id}');"; |
|
118 | - $cs = $this->getPage()->getClientScript(); |
|
115 | + if($this->getStartTimerOnLoad()) { |
|
116 | + $id=$this->getClientID(); |
|
117 | + $code="Prado.WebUI.TTimeTriggeredCallback.start('{$id}');"; |
|
118 | + $cs=$this->getPage()->getClientScript(); |
|
119 | 119 | $cs->registerEndScript("{$id}:start", $code); |
120 | 120 | } |
121 | 121 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function setText($value) |
96 | 96 | { |
97 | - if(parent::getText() === $value) |
|
97 | + if(parent::getText()===$value) |
|
98 | 98 | return; |
99 | 99 | |
100 | 100 | parent::setText($value); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | protected function addAttributesToRender($writer) |
118 | 118 | { |
119 | 119 | parent::addAttributesToRender($writer); |
120 | - $writer->addAttribute('id',$this->getClientID()); |
|
120 | + $writer->addAttribute('id', $this->getClientID()); |
|
121 | 121 | $this->getActiveControl()->registerCallbackClientScript( |
122 | 122 | $this->getClientClassName(), $this->getPostBackOptions()); |
123 | 123 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function setAlternateText($value) |
50 | 50 | { |
51 | - if(parent::getAlternateText() === $value) |
|
51 | + if(parent::getAlternateText()===$value) |
|
52 | 52 | return; |
53 | 53 | |
54 | 54 | parent::setAlternateText($value); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function setImageAlign($value) |
67 | 67 | { |
68 | - if(parent::getImageAlign() === $value) |
|
68 | + if(parent::getImageAlign()===$value) |
|
69 | 69 | return; |
70 | 70 | |
71 | 71 | parent::setImageAlign($value); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function setImageUrl($value) |
80 | 80 | { |
81 | - if(parent::getImageUrl() === $value) |
|
81 | + if(parent::getImageUrl()===$value) |
|
82 | 82 | return; |
83 | 83 | |
84 | 84 | parent::setImageUrl($value); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function setDescriptionUrl($value) |
93 | 93 | { |
94 | - if(parent::getDescriptionUrl() === $value) |
|
94 | + if(parent::getDescriptionUrl()===$value) |
|
95 | 95 | return; |
96 | 96 | |
97 | 97 | parent::setDescriptionUrl($value); |
@@ -147,6 +147,7 @@ discard block |
||
147 | 147 | /** |
148 | 148 | * Sets the height of the image in the THyperLink |
149 | 149 | * @param string height of the image in the THyperLink |
150 | + * @param string $value |
|
150 | 151 | */ |
151 | 152 | public function setImageHeight($value) |
152 | 153 | { |
@@ -181,6 +182,7 @@ discard block |
||
181 | 182 | /** |
182 | 183 | * Sets the width of the image in the THyperLink |
183 | 184 | * @param string width of the image |
185 | + * @param string $value |
|
184 | 186 | */ |
185 | 187 | public function setImageWidth($value) |
186 | 188 | { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function setText($value) |
97 | 97 | { |
98 | - if(parent::getText() === $value) |
|
98 | + if(parent::getText()===$value) |
|
99 | 99 | return; |
100 | 100 | |
101 | 101 | 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 | |
123 | 123 | if($this->getEnabled(true)) |
124 | 124 | { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function setEnabled($value) |
136 | 136 | { |
137 | - if(parent::getEnabled() === $value) |
|
137 | + if(parent::getEnabled()===$value) |
|
138 | 138 | return; |
139 | 139 | |
140 | 140 | parent::setEnabled($value); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | { |
143 | 143 | if($this->getEnabled(true)) |
144 | 144 | { |
145 | - $nop = "javascript:;//".$this->getClientID(); |
|
145 | + $nop="javascript:;//".$this->getClientID(); |
|
146 | 146 | $this->getPage()->getCallbackClient()->setAttribute($this, 'href', $nop); |
147 | 147 | |
148 | 148 | $this->getActiveControl()->registerCallbackClientScript( |