@@ -140,13 +140,13 @@ |
||
140 | 140 | */ |
141 | 141 | public function getIsValid() |
142 | 142 | { |
143 | - return $this->_isValid; |
|
143 | + return $this->_isValid; |
|
144 | 144 | } |
145 | 145 | /** |
146 | 146 | * @param bool wether this control is valid. |
147 | 147 | */ |
148 | 148 | public function setIsValid($value) |
149 | 149 | { |
150 | - $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
150 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
151 | 151 | } |
152 | 152 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | protected function addAttributesToRender($writer) |
54 | 54 | { |
55 | - $writer->addAttribute('name',$this->getUniqueID()); |
|
55 | + $writer->addAttribute('name', $this->getUniqueID()); |
|
56 | 56 | parent::addAttributesToRender($writer); |
57 | 57 | } |
58 | 58 | |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | * @param array the input data collection |
74 | 74 | * @return boolean whether the data of the component has been changed |
75 | 75 | */ |
76 | - public function loadPostData($key,$values) |
|
76 | + public function loadPostData($key, $values) |
|
77 | 77 | { |
78 | 78 | if(!$this->getEnabled(true)) |
79 | 79 | return false; |
80 | 80 | $this->ensureDataBound(); |
81 | - $selection=isset($values[$key])?$values[$key]:null; |
|
81 | + $selection=isset($values[$key]) ? $values[$key] : null; |
|
82 | 82 | if($selection!==null) |
83 | 83 | { |
84 | - $index=$this->getItems()->findIndexByValue($selection,false); |
|
84 | + $index=$this->getItems()->findIndexByValue($selection, false); |
|
85 | 85 | if($this->getSelectedIndex()!==$index) |
86 | 86 | { |
87 | 87 | $this->setSelectedIndex($index); |
@@ -125,7 +125,7 @@ |
||
125 | 125 | /** |
126 | 126 | * Returns the value to be validated. |
127 | 127 | * This methid is required by \Prado\Web\UI\IValidatable interface. |
128 | - * @return mixed the value of the property to be validated. |
|
128 | + * @return string the value of the property to be validated. |
|
129 | 129 | */ |
130 | 130 | public function getValidationPropertyValue() |
131 | 131 | { |
@@ -46,50 +46,50 @@ discard block |
||
46 | 46 | * @throws TConfigurationException If XSL extension is not available |
47 | 47 | */ |
48 | 48 | public function __construct() { |
49 | - if(!class_exists('XSLTProcessor', false)) { |
|
50 | - throw new TConfigurationException('xmltransform_xslextension_required'); |
|
51 | - } |
|
49 | + if(!class_exists('XSLTProcessor', false)) { |
|
50 | + throw new TConfigurationException('xmltransform_xslextension_required'); |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
55 | 55 | * @return string The path to the XML style sheet. |
56 | 56 | */ |
57 | 57 | public function getTransformPath() { |
58 | - return $this->getViewState('TransformPath', ''); |
|
58 | + return $this->getViewState('TransformPath', ''); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @param string The path to the XML style sheet. It must be in namespace format. |
63 | 63 | */ |
64 | 64 | public function setTransformPath($value) { |
65 | - if(!is_file($value)) { |
|
66 | - $value = Prado::getPathOfNamespace($value, self::EXT_XSL_FILE); |
|
67 | - if($value === null) { |
|
65 | + if(!is_file($value)) { |
|
66 | + $value = Prado::getPathOfNamespace($value, self::EXT_XSL_FILE); |
|
67 | + if($value === null) { |
|
68 | 68 | throw new TInvalidDataValueException('xmltransform_transformpath_invalid', $value); |
69 | - } |
|
70 | - } |
|
71 | - $this->setViewState('TransformPath', $value, ''); |
|
69 | + } |
|
70 | + } |
|
71 | + $this->setViewState('TransformPath', $value, ''); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
75 | 75 | * @return string XML style sheet as string |
76 | 76 | */ |
77 | 77 | public function getTransformContent() { |
78 | - return $this->getViewState('TransformContent', ''); |
|
78 | + return $this->getViewState('TransformContent', ''); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
82 | 82 | * @param string $value XML style sheet as string |
83 | 83 | */ |
84 | 84 | public function setTransformContent($value) { |
85 | - $this->setViewState('TransformContent', $value, ''); |
|
85 | + $this->setViewState('TransformContent', $value, ''); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | 89 | * @return string The path to the XML document. It must be in namespace format. |
90 | 90 | */ |
91 | 91 | public function getDocumentPath() { |
92 | - return $this->getViewState('DocumentPath', ''); |
|
92 | + return $this->getViewState('DocumentPath', ''); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -97,27 +97,27 @@ discard block |
||
97 | 97 | * @throws TInvalidDataValueException |
98 | 98 | */ |
99 | 99 | public function setDocumentPath($value) { |
100 | - if(!is_file($value)) { |
|
101 | - $value = Prado::getPathOfNamespace($value, self::EXT_XML_FILE); |
|
102 | - if($value === null) { |
|
100 | + if(!is_file($value)) { |
|
101 | + $value = Prado::getPathOfNamespace($value, self::EXT_XML_FILE); |
|
102 | + if($value === null) { |
|
103 | 103 | throw new TInvalidDataValueException('xmltransform_documentpath_invalid', $value); |
104 | - } |
|
105 | - } |
|
106 | - $this->setViewState('DocumentPath', $value, ''); |
|
104 | + } |
|
105 | + } |
|
106 | + $this->setViewState('DocumentPath', $value, ''); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | 110 | * @return string XML data |
111 | 111 | */ |
112 | 112 | public function getDocumentContent() { |
113 | - return $this->getViewState('DocumentContent', ''); |
|
113 | + return $this->getViewState('DocumentContent', ''); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
117 | 117 | * @param string $value XML data. If not empty, it takes precedence over {@link setDocumentPath DocumentPath}. |
118 | 118 | */ |
119 | 119 | public function setDocumentContent($value) { |
120 | - $this->setViewState('DocumentContent', $value, ''); |
|
120 | + $this->setViewState('DocumentContent', $value, ''); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -125,41 +125,41 @@ discard block |
||
125 | 125 | * @return TAttributeCollection the list of custom parameters |
126 | 126 | */ |
127 | 127 | public function getParameters() { |
128 | - if($params = $this->getViewState('Parameters',null)) { |
|
129 | - return $params; |
|
130 | - } else { |
|
131 | - $params = new TAttributeCollection(); |
|
132 | - $this->setViewState('Parameters', $params, null); |
|
133 | - return $params; |
|
134 | - } |
|
128 | + if($params = $this->getViewState('Parameters',null)) { |
|
129 | + return $params; |
|
130 | + } else { |
|
131 | + $params = new TAttributeCollection(); |
|
132 | + $this->setViewState('Parameters', $params, null); |
|
133 | + return $params; |
|
134 | + } |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | private function getTransformXmlDocument() { |
138 | - if(($content = $this->getTransformContent()) !== '') { |
|
139 | - $document = new DOMDocument(); |
|
140 | - $document->loadXML($content); |
|
141 | - return $document; |
|
142 | - } else if(($path = $this->getTransformPath()) !== '') { |
|
143 | - $document = new DOMDocument(); |
|
144 | - $document->load($path); |
|
145 | - return $document; |
|
146 | - } else { |
|
147 | - throw new TConfigurationException('xmltransform_transform_required'); |
|
148 | - } |
|
138 | + if(($content = $this->getTransformContent()) !== '') { |
|
139 | + $document = new DOMDocument(); |
|
140 | + $document->loadXML($content); |
|
141 | + return $document; |
|
142 | + } else if(($path = $this->getTransformPath()) !== '') { |
|
143 | + $document = new DOMDocument(); |
|
144 | + $document->load($path); |
|
145 | + return $document; |
|
146 | + } else { |
|
147 | + throw new TConfigurationException('xmltransform_transform_required'); |
|
148 | + } |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | private function getSourceXmlDocument() { |
152 | - if(($content = $this->getDocumentContent()) !== '') { |
|
153 | - $document = new DOMDocument(); |
|
154 | - $document->loadXML($content); |
|
155 | - return $document; |
|
156 | - } else if(($path = $this->getDocumentPath()) !== '') { |
|
157 | - $document = new DOMDocument(); |
|
158 | - $document->load($path); |
|
159 | - return $document; |
|
160 | - } else { |
|
161 | - return null; |
|
162 | - } |
|
152 | + if(($content = $this->getDocumentContent()) !== '') { |
|
153 | + $document = new DOMDocument(); |
|
154 | + $document->loadXML($content); |
|
155 | + return $document; |
|
156 | + } else if(($path = $this->getDocumentPath()) !== '') { |
|
157 | + $document = new DOMDocument(); |
|
158 | + $document->load($path); |
|
159 | + return $document; |
|
160 | + } else { |
|
161 | + return null; |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -167,27 +167,27 @@ discard block |
||
167 | 167 | * @param THtmlWriter The writer used for the rendering purpose |
168 | 168 | */ |
169 | 169 | public function render($writer) { |
170 | - if(($document=$this->getSourceXmlDocument()) === null) { |
|
170 | + if(($document=$this->getSourceXmlDocument()) === null) { |
|
171 | 171 | $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
172 | 172 | parent::render($htmlWriter); |
173 | - $document = new DOMDocument(); |
|
174 | - $document->loadXML($htmlWriter->flush()); |
|
175 | - } |
|
176 | - $stylesheet = $this->getTransformXmlDocument(); |
|
177 | - |
|
178 | - // Perform XSL transformation |
|
179 | - $xslt = new XSLTProcessor(); |
|
180 | - $xslt->importStyleSheet($stylesheet); |
|
181 | - |
|
182 | - // Check for parameters |
|
183 | - $parameters = $this->getParameters(); |
|
184 | - foreach($parameters as $name => $value) { |
|
185 | - $xslt->setParameter('', $name, $value); |
|
186 | - } |
|
187 | - $output = $xslt->transformToXML($document); |
|
188 | - |
|
189 | - // Write output |
|
190 | - $writer->write($output); |
|
173 | + $document = new DOMDocument(); |
|
174 | + $document->loadXML($htmlWriter->flush()); |
|
175 | + } |
|
176 | + $stylesheet = $this->getTransformXmlDocument(); |
|
177 | + |
|
178 | + // Perform XSL transformation |
|
179 | + $xslt = new XSLTProcessor(); |
|
180 | + $xslt->importStyleSheet($stylesheet); |
|
181 | + |
|
182 | + // Check for parameters |
|
183 | + $parameters = $this->getParameters(); |
|
184 | + foreach($parameters as $name => $value) { |
|
185 | + $xslt->setParameter('', $name, $value); |
|
186 | + } |
|
187 | + $output = $xslt->transformToXML($document); |
|
188 | + |
|
189 | + // Write output |
|
190 | + $writer->write($output); |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | */ |
46 | 46 | class TXmlTransform extends \Prado\Web\UI\TControl { |
47 | 47 | |
48 | - const EXT_XML_FILE = '.xml'; |
|
49 | - const EXT_XSL_FILE = '.xsl'; |
|
48 | + const EXT_XML_FILE='.xml'; |
|
49 | + const EXT_XSL_FILE='.xsl'; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Constructor |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function setTransformPath($value) { |
74 | 74 | if(!is_file($value)) { |
75 | - $value = Prado::getPathOfNamespace($value, self::EXT_XSL_FILE); |
|
76 | - if($value === null) { |
|
75 | + $value=Prado::getPathOfNamespace($value, self::EXT_XSL_FILE); |
|
76 | + if($value===null) { |
|
77 | 77 | throw new TInvalidDataValueException('xmltransform_transformpath_invalid', $value); |
78 | 78 | } |
79 | 79 | } |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function setDocumentPath($value) { |
109 | 109 | if(!is_file($value)) { |
110 | - $value = Prado::getPathOfNamespace($value, self::EXT_XML_FILE); |
|
111 | - if($value === null) { |
|
110 | + $value=Prado::getPathOfNamespace($value, self::EXT_XML_FILE); |
|
111 | + if($value===null) { |
|
112 | 112 | throw new TInvalidDataValueException('xmltransform_documentpath_invalid', $value); |
113 | 113 | } |
114 | 114 | } |
@@ -134,22 +134,22 @@ discard block |
||
134 | 134 | * @return TAttributeCollection the list of custom parameters |
135 | 135 | */ |
136 | 136 | public function getParameters() { |
137 | - if($params = $this->getViewState('Parameters',null)) { |
|
137 | + if($params=$this->getViewState('Parameters', null)) { |
|
138 | 138 | return $params; |
139 | 139 | } else { |
140 | - $params = new TAttributeCollection(); |
|
140 | + $params=new TAttributeCollection(); |
|
141 | 141 | $this->setViewState('Parameters', $params, null); |
142 | 142 | return $params; |
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | 146 | private function getTransformXmlDocument() { |
147 | - if(($content = $this->getTransformContent()) !== '') { |
|
148 | - $document = new DOMDocument(); |
|
147 | + if(($content=$this->getTransformContent())!=='') { |
|
148 | + $document=new DOMDocument(); |
|
149 | 149 | $document->loadXML($content); |
150 | 150 | return $document; |
151 | - } else if(($path = $this->getTransformPath()) !== '') { |
|
152 | - $document = new DOMDocument(); |
|
151 | + } else if(($path=$this->getTransformPath())!=='') { |
|
152 | + $document=new DOMDocument(); |
|
153 | 153 | $document->load($path); |
154 | 154 | return $document; |
155 | 155 | } else { |
@@ -158,12 +158,12 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | private function getSourceXmlDocument() { |
161 | - if(($content = $this->getDocumentContent()) !== '') { |
|
162 | - $document = new DOMDocument(); |
|
161 | + if(($content=$this->getDocumentContent())!=='') { |
|
162 | + $document=new DOMDocument(); |
|
163 | 163 | $document->loadXML($content); |
164 | 164 | return $document; |
165 | - } else if(($path = $this->getDocumentPath()) !== '') { |
|
166 | - $document = new DOMDocument(); |
|
165 | + } else if(($path=$this->getDocumentPath())!=='') { |
|
166 | + $document=new DOMDocument(); |
|
167 | 167 | $document->load($path); |
168 | 168 | return $document; |
169 | 169 | } else { |
@@ -176,24 +176,24 @@ discard block |
||
176 | 176 | * @param THtmlWriter The writer used for the rendering purpose |
177 | 177 | */ |
178 | 178 | public function render($writer) { |
179 | - if(($document=$this->getSourceXmlDocument()) === null) { |
|
180 | - $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
179 | + if(($document=$this->getSourceXmlDocument())===null) { |
|
180 | + $htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
181 | 181 | parent::render($htmlWriter); |
182 | - $document = new DOMDocument(); |
|
182 | + $document=new DOMDocument(); |
|
183 | 183 | $document->loadXML($htmlWriter->flush()); |
184 | 184 | } |
185 | - $stylesheet = $this->getTransformXmlDocument(); |
|
185 | + $stylesheet=$this->getTransformXmlDocument(); |
|
186 | 186 | |
187 | 187 | // Perform XSL transformation |
188 | - $xslt = new XSLTProcessor(); |
|
188 | + $xslt=new XSLTProcessor(); |
|
189 | 189 | $xslt->importStyleSheet($stylesheet); |
190 | 190 | |
191 | 191 | // Check for parameters |
192 | - $parameters = $this->getParameters(); |
|
192 | + $parameters=$this->getParameters(); |
|
193 | 193 | foreach($parameters as $name => $value) { |
194 | 194 | $xslt->setParameter('', $name, $value); |
195 | 195 | } |
196 | - $output = $xslt->transformToXML($document); |
|
196 | + $output=$xslt->transformToXML($document); |
|
197 | 197 | |
198 | 198 | // Write output |
199 | 199 | $writer->write($output); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | public function setWidth($value) |
160 | 160 | { |
161 | 161 | if(($value=TPropertyValue::ensureInteger($value))<0) |
162 | - $value=-1; |
|
162 | + $value=-1; |
|
163 | 163 | $this->setViewState('Width',$value,-1); |
164 | 164 | } |
165 | 165 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | public function setHeight($value) |
178 | 178 | { |
179 | 179 | if(($value=TPropertyValue::ensureInteger($value))<0) |
180 | - $value=-1; |
|
180 | + $value=-1; |
|
181 | 181 | $this->setViewState('Height',$value,-1); |
182 | 182 | } |
183 | 183 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function getAlign() |
49 | 49 | { |
50 | - return $this->getViewState('Align',TInlineFrameAlign::NotSet); |
|
50 | + return $this->getViewState('Align', TInlineFrameAlign::NotSet); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function setAlign($value) |
57 | 57 | { |
58 | - $this->setViewState('Align',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TInlineFrameAlign'),TInlineFrameAlign::NotSet); |
|
58 | + $this->setViewState('Align', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TInlineFrameAlign'), TInlineFrameAlign::NotSet); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function getDescriptionUrl() |
65 | 65 | { |
66 | - return $this->getViewState('DescriptionUrl',''); |
|
66 | + return $this->getViewState('DescriptionUrl', ''); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function setDescriptionUrl($value) |
73 | 73 | { |
74 | - $this->setViewState('DescriptionUrl',$value,''); |
|
74 | + $this->setViewState('DescriptionUrl', $value, ''); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getShowBorder() |
81 | 81 | { |
82 | - return $this->getViewState('ShowBorder',true); |
|
82 | + return $this->getViewState('ShowBorder', true); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function setShowBorder($value) |
89 | 89 | { |
90 | - $this->setViewState('ShowBorder',TPropertyValue::ensureBoolean($value),true); |
|
90 | + $this->setViewState('ShowBorder', TPropertyValue::ensureBoolean($value), true); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function getFrameUrl() |
97 | 97 | { |
98 | - return $this->getViewState('FrameUrl',''); |
|
98 | + return $this->getViewState('FrameUrl', ''); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function setFrameUrl($value) |
105 | 105 | { |
106 | - $this->setViewState('FrameUrl',$value,''); |
|
106 | + $this->setViewState('FrameUrl', $value, ''); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function getScrollBars() |
139 | 139 | { |
140 | - return $this->getViewState('ScrollBars',TInlineFrameScrollBars::Auto); |
|
140 | + return $this->getViewState('ScrollBars', TInlineFrameScrollBars::Auto); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function setScrollBars($value) |
147 | 147 | { |
148 | - $this->setViewState('ScrollBars',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TInlineFrameScrollBars'),TInlineFrameScrollBars::Auto); |
|
148 | + $this->setViewState('ScrollBars', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TInlineFrameScrollBars'), TInlineFrameScrollBars::Auto); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function getWidth() |
155 | 155 | { |
156 | - return $this->getViewState('Width',-1); |
|
156 | + return $this->getViewState('Width', -1); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function setWidth($value) |
163 | 163 | { |
164 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
164 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
165 | 165 | $value=-1; |
166 | - $this->setViewState('Width',$value,-1); |
|
166 | + $this->setViewState('Width', $value, -1); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function getHeight() |
173 | 173 | { |
174 | - return $this->getViewState('Height',-1); |
|
174 | + return $this->getViewState('Height', -1); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function setHeight($value) |
181 | 181 | { |
182 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
182 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
183 | 183 | $value=-1; |
184 | - $this->setViewState('Height',$value,-1); |
|
184 | + $this->setViewState('Height', $value, -1); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function getMarginWidth() |
192 | 192 | { |
193 | - return $this->getViewState('MarginWidth',-1); |
|
193 | + return $this->getViewState('MarginWidth', -1); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | */ |
200 | 200 | public function setMarginWidth($value) |
201 | 201 | { |
202 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
202 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
203 | 203 | $value=-1; |
204 | - $this->setViewState('MarginWidth',$value,-1); |
|
204 | + $this->setViewState('MarginWidth', $value, -1); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | public function getMarginHeight() |
212 | 212 | { |
213 | - return $this->getViewState('MarginHeight',-1); |
|
213 | + return $this->getViewState('MarginHeight', -1); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -219,9 +219,9 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public function setMarginHeight($value) |
221 | 221 | { |
222 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
222 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
223 | 223 | $value=-1; |
224 | - $this->setViewState('MarginHeight',$value,-1); |
|
224 | + $this->setViewState('MarginHeight', $value, -1); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -232,37 +232,37 @@ discard block |
||
232 | 232 | protected function addAttributesToRender($writer) |
233 | 233 | { |
234 | 234 | if($this->getID()!=='') |
235 | - $writer->addAttribute('name',$this->getUniqueID()); |
|
235 | + $writer->addAttribute('name', $this->getUniqueID()); |
|
236 | 236 | |
237 | 237 | if(($src=$this->getFrameUrl())!=='') |
238 | - $writer->addAttribute('src',$src); |
|
238 | + $writer->addAttribute('src', $src); |
|
239 | 239 | |
240 | 240 | if(($align=strtolower($this->getAlign()))!=='notset') |
241 | - $writer->addAttribute('align',$align); |
|
241 | + $writer->addAttribute('align', $align); |
|
242 | 242 | |
243 | 243 | $scrollBars=$this->getScrollBars(); |
244 | 244 | if($scrollBars===TInlineFrameScrollBars::None) |
245 | - $writer->addAttribute('scrolling','no'); |
|
245 | + $writer->addAttribute('scrolling', 'no'); |
|
246 | 246 | else if($scrollBars===TInlineFrameScrollBars::Both) |
247 | - $writer->addAttribute('scrolling','yes'); |
|
247 | + $writer->addAttribute('scrolling', 'yes'); |
|
248 | 248 | |
249 | - if (!$this->getShowBorder()) |
|
250 | - $writer->addAttribute('frameborder','0'); |
|
249 | + if(!$this->getShowBorder()) |
|
250 | + $writer->addAttribute('frameborder', '0'); |
|
251 | 251 | |
252 | 252 | if(($longdesc=$this->getDescriptionUrl())!=='') |
253 | - $writer->addAttribute('longdesc',$longdesc); |
|
253 | + $writer->addAttribute('longdesc', $longdesc); |
|
254 | 254 | |
255 | - if (($width=$this->getWidth())!==-1) |
|
256 | - $writer->addAttribute('width',$width); |
|
255 | + if(($width=$this->getWidth())!==-1) |
|
256 | + $writer->addAttribute('width', $width); |
|
257 | 257 | |
258 | - if (($height=$this->getHeight())!==-1) |
|
259 | - $writer->addAttribute('height',$height); |
|
258 | + if(($height=$this->getHeight())!==-1) |
|
259 | + $writer->addAttribute('height', $height); |
|
260 | 260 | |
261 | 261 | if(($marginheight=$this->getMarginHeight())!==-1) |
262 | - $writer->addAttribute('marginheight',$marginheight); |
|
262 | + $writer->addAttribute('marginheight', $marginheight); |
|
263 | 263 | |
264 | 264 | if(($marginwidth=$this->getMarginWidth())!==-1) |
265 | - $writer->addAttribute('marginwidth',$marginwidth); |
|
265 | + $writer->addAttribute('marginwidth', $marginwidth); |
|
266 | 266 | |
267 | 267 | parent::addAttributesToRender($writer); |
268 | 268 | } |
@@ -84,6 +84,7 @@ |
||
84 | 84 | |
85 | 85 | /** |
86 | 86 | * @param boolean whether there should be a visual separator between the frames. |
87 | + * @param boolean $value |
|
87 | 88 | */ |
88 | 89 | public function setShowBorder($value) |
89 | 90 | { |
@@ -117,14 +117,14 @@ |
||
117 | 117 | */ |
118 | 118 | public function getIsValid() |
119 | 119 | { |
120 | - return $this->_isValid; |
|
120 | + return $this->_isValid; |
|
121 | 121 | } |
122 | 122 | /** |
123 | 123 | * @param bool wether this control is valid. |
124 | 124 | */ |
125 | 125 | public function setIsValid($value) |
126 | 126 | { |
127 | - $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
127 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -53,18 +53,18 @@ discard block |
||
53 | 53 | { |
54 | 54 | $uniqueID=$this->getUniqueID(); |
55 | 55 | $this->getPage()->ensureRenderInForm($this); |
56 | - $writer->addAttribute('type','hidden'); |
|
56 | + $writer->addAttribute('type', 'hidden'); |
|
57 | 57 | if($uniqueID!=='') |
58 | - $writer->addAttribute('name',$uniqueID); |
|
58 | + $writer->addAttribute('name', $uniqueID); |
|
59 | 59 | if($this->getID()!=='') |
60 | - $writer->addAttribute('id',$this->getClientID()); |
|
60 | + $writer->addAttribute('id', $this->getClientID()); |
|
61 | 61 | if(($value=$this->getValue())!=='') |
62 | - $writer->addAttribute('value',$value); |
|
62 | + $writer->addAttribute('value', $value); |
|
63 | 63 | |
64 | 64 | if($this->getHasAttributes()) |
65 | 65 | { |
66 | 66 | foreach($this->getAttributes() as $name=>$value) |
67 | - $writer->addAttribute($name,$value); |
|
67 | + $writer->addAttribute($name, $value); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | $writer->renderBeginTag('input'); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param array the input data collection |
79 | 79 | * @return boolean whether the data of the component has been changed |
80 | 80 | */ |
81 | - public function loadPostData($key,$values) |
|
81 | + public function loadPostData($key, $values) |
|
82 | 82 | { |
83 | 83 | $value=$values[$key]; |
84 | 84 | if($value===$this->getValue()) |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function onValueChanged($param) |
148 | 148 | { |
149 | - $this->raiseEvent('OnValueChanged',$this,$param); |
|
149 | + $this->raiseEvent('OnValueChanged', $this, $param); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function getValue() |
156 | 156 | { |
157 | - return $this->getViewState('Value',''); |
|
157 | + return $this->getViewState('Value', ''); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function setValue($value) |
165 | 165 | { |
166 | - $this->setViewState('Value',$value,''); |
|
166 | + $this->setViewState('Value', $value, ''); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -125,7 +125,7 @@ |
||
125 | 125 | /** |
126 | 126 | * Returns the value to be validated. |
127 | 127 | * This methid is required by \Prado\Web\UI\IValidatable interface. |
128 | - * @return mixed the value of the property to be validated. |
|
128 | + * @return string the value of the property to be validated. |
|
129 | 129 | */ |
130 | 130 | public function getValidationPropertyValue() |
131 | 131 | { |
@@ -251,14 +251,14 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public function getIsValid() |
253 | 253 | { |
254 | - return $this->_isValid; |
|
254 | + return $this->_isValid; |
|
255 | 255 | } |
256 | 256 | /** |
257 | 257 | * @param bool wether this control is valid. |
258 | 258 | */ |
259 | 259 | public function setIsValid($value) |
260 | 260 | { |
261 | - $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
261 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | |
330 | 330 | /** |
331 | 331 | * @return boolean a value indicating whether an automatic postback to the server |
332 | - * will occur whenever the user modifies the text in the TTextBox control and |
|
333 | - * then tabs out of the component. Defaults to false. |
|
332 | + * will occur whenever the user modifies the text in the TTextBox control and |
|
333 | + * then tabs out of the component. Defaults to false. |
|
334 | 334 | */ |
335 | 335 | public function getAutoPostBack() |
336 | 336 | { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | protected function getTagName() |
82 | 82 | { |
83 | - return ($this->getTextMode()==='MultiLine')?'textarea':'input'; |
|
83 | + return ($this->getTextMode()==='MultiLine') ? 'textarea' : 'input'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function getEnableClientScript() |
90 | 90 | { |
91 | - return $this->getViewState('EnableClientScript',true); |
|
91 | + return $this->getViewState('EnableClientScript', true); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function setEnableClientScript($value) |
98 | 98 | { |
99 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
99 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -109,106 +109,106 @@ discard block |
||
109 | 109 | $page=$this->getPage(); |
110 | 110 | $page->ensureRenderInForm($this); |
111 | 111 | if(($uid=$this->getUniqueID())!=='') |
112 | - $writer->addAttribute('name',$uid); |
|
112 | + $writer->addAttribute('name', $uid); |
|
113 | 113 | if(($textMode=$this->getTextMode())===TTextBoxMode::MultiLine) |
114 | 114 | { |
115 | - if(($rows=$this->getRows())<=0) |
|
115 | + if(($rows=$this->getRows()) <= 0) |
|
116 | 116 | $rows=self::DEFAULT_ROWS; |
117 | - if(($cols=$this->getColumns())<=0) |
|
117 | + if(($cols=$this->getColumns()) <= 0) |
|
118 | 118 | $cols=self::DEFAULT_COLUMNS; |
119 | - $writer->addAttribute('rows',"$rows"); |
|
120 | - $writer->addAttribute('cols',"$cols"); |
|
119 | + $writer->addAttribute('rows', "$rows"); |
|
120 | + $writer->addAttribute('cols', "$cols"); |
|
121 | 121 | if(!$this->getWrap()) |
122 | - $writer->addAttribute('wrap','off'); |
|
122 | + $writer->addAttribute('wrap', 'off'); |
|
123 | 123 | } |
124 | 124 | else |
125 | 125 | { |
126 | 126 | switch($textMode) |
127 | 127 | { |
128 | 128 | case TTextBoxMode::Password: |
129 | - $writer->addAttribute('type','password'); |
|
129 | + $writer->addAttribute('type', 'password'); |
|
130 | 130 | break; |
131 | 131 | case TTextBoxMode::Color: |
132 | - $writer->addAttribute('type','color'); |
|
132 | + $writer->addAttribute('type', 'color'); |
|
133 | 133 | break; |
134 | 134 | case TTextBoxMode::Date: |
135 | - $writer->addAttribute('type','date'); |
|
135 | + $writer->addAttribute('type', 'date'); |
|
136 | 136 | break; |
137 | 137 | case TTextBoxMode::Datetime: |
138 | - $writer->addAttribute('type','datetime'); |
|
138 | + $writer->addAttribute('type', 'datetime'); |
|
139 | 139 | break; |
140 | 140 | case TTextBoxMode::DatetimeLocal: |
141 | - $writer->addAttribute('type','datetime-local'); |
|
141 | + $writer->addAttribute('type', 'datetime-local'); |
|
142 | 142 | break; |
143 | 143 | case TTextBoxMode::Email: |
144 | - $writer->addAttribute('type','email'); |
|
144 | + $writer->addAttribute('type', 'email'); |
|
145 | 145 | break; |
146 | 146 | case TTextBoxMode::Month: |
147 | - $writer->addAttribute('type','month'); |
|
147 | + $writer->addAttribute('type', 'month'); |
|
148 | 148 | break; |
149 | 149 | case TTextBoxMode::Number: |
150 | - $writer->addAttribute('type','number'); |
|
150 | + $writer->addAttribute('type', 'number'); |
|
151 | 151 | break; |
152 | 152 | case TTextBoxMode::Range: |
153 | - $writer->addAttribute('type','range'); |
|
153 | + $writer->addAttribute('type', 'range'); |
|
154 | 154 | break; |
155 | 155 | case TTextBoxMode::Search: |
156 | - $writer->addAttribute('type','search'); |
|
156 | + $writer->addAttribute('type', 'search'); |
|
157 | 157 | break; |
158 | 158 | case TTextBoxMode::Tel: |
159 | - $writer->addAttribute('type','tel'); |
|
159 | + $writer->addAttribute('type', 'tel'); |
|
160 | 160 | break; |
161 | 161 | case TTextBoxMode::Time: |
162 | - $writer->addAttribute('type','time'); |
|
162 | + $writer->addAttribute('type', 'time'); |
|
163 | 163 | break; |
164 | 164 | case TTextBoxMode::Url: |
165 | - $writer->addAttribute('type','url'); |
|
165 | + $writer->addAttribute('type', 'url'); |
|
166 | 166 | break; |
167 | 167 | case TTextBoxMode::Week: |
168 | - $writer->addAttribute('type','week'); |
|
168 | + $writer->addAttribute('type', 'week'); |
|
169 | 169 | break; |
170 | 170 | case TTextBoxMode::SingleLine: |
171 | 171 | default: |
172 | - $writer->addAttribute('type','text'); |
|
172 | + $writer->addAttribute('type', 'text'); |
|
173 | 173 | break; |
174 | 174 | } |
175 | 175 | |
176 | - if(($text=$this->getText())!=='' && ($textMode !== TTextBoxMode::Password || $this->getPersistPassword())) |
|
177 | - $writer->addAttribute('value',$text); |
|
176 | + if(($text=$this->getText())!=='' && ($textMode!==TTextBoxMode::Password || $this->getPersistPassword())) |
|
177 | + $writer->addAttribute('value', $text); |
|
178 | 178 | |
179 | 179 | if(($act=$this->getAutoCompleteType())!=='None') |
180 | 180 | { |
181 | 181 | if($act==='Disabled') |
182 | - $writer->addAttribute('autocomplete','off'); |
|
182 | + $writer->addAttribute('autocomplete', 'off'); |
|
183 | 183 | else if($act==='Search') |
184 | - $writer->addAttribute('vcard_name','search'); |
|
184 | + $writer->addAttribute('vcard_name', 'search'); |
|
185 | 185 | else if($act==='HomeCountryRegion') |
186 | - $writer->addAttribute('vcard_name','HomeCountry'); |
|
186 | + $writer->addAttribute('vcard_name', 'HomeCountry'); |
|
187 | 187 | else if($act==='BusinessCountryRegion') |
188 | - $writer->addAttribute('vcard_name','BusinessCountry'); |
|
188 | + $writer->addAttribute('vcard_name', 'BusinessCountry'); |
|
189 | 189 | else |
190 | 190 | { |
191 | - if(strpos($act,'Business')===0) |
|
192 | - $act='Business'.'.'.substr($act,8); |
|
193 | - else if(strpos($act,'Home')===0) |
|
194 | - $act='Home'.'.'.substr($act,4); |
|
195 | - $writer->addAttribute('vcard_name','vCard.'.$act); |
|
191 | + if(strpos($act, 'Business')===0) |
|
192 | + $act='Business'.'.'.substr($act, 8); |
|
193 | + else if(strpos($act, 'Home')===0) |
|
194 | + $act='Home'.'.'.substr($act, 4); |
|
195 | + $writer->addAttribute('vcard_name', 'vCard.'.$act); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
199 | - if(($cols=$this->getColumns())>0) |
|
200 | - $writer->addAttribute('size',"$cols"); |
|
201 | - if(($maxLength=$this->getMaxLength())>0) |
|
202 | - $writer->addAttribute('maxlength',"$maxLength"); |
|
199 | + if(($cols=$this->getColumns()) > 0) |
|
200 | + $writer->addAttribute('size', "$cols"); |
|
201 | + if(($maxLength=$this->getMaxLength()) > 0) |
|
202 | + $writer->addAttribute('maxlength', "$maxLength"); |
|
203 | 203 | } |
204 | 204 | if($this->getReadOnly()) |
205 | - $writer->addAttribute('readonly','readonly'); |
|
205 | + $writer->addAttribute('readonly', 'readonly'); |
|
206 | 206 | $isEnabled=$this->getEnabled(true); |
207 | 207 | if(!$isEnabled && $this->getEnabled()) // in this case parent will not render 'disabled' |
208 | - $writer->addAttribute('disabled','disabled'); |
|
208 | + $writer->addAttribute('disabled', 'disabled'); |
|
209 | 209 | if($isEnabled |
210 | 210 | && $this->getEnableClientScript() |
211 | - && ( $this->getAutoPostBack() || $textMode===TTextBoxMode::SingleLine) |
|
211 | + && ($this->getAutoPostBack() || $textMode===TTextBoxMode::SingleLine) |
|
212 | 212 | && $page->getClientSupportsJavaScript()) |
213 | 213 | { |
214 | 214 | $this->renderClientControlScript($writer); |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | */ |
222 | 222 | protected function renderClientControlScript($writer) |
223 | 223 | { |
224 | - $writer->addAttribute('id',$this->getClientID()); |
|
225 | - $cs = $this->getPage()->getClientScript(); |
|
226 | - $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
224 | + $writer->addAttribute('id', $this->getClientID()); |
|
225 | + $cs=$this->getPage()->getClientScript(); |
|
226 | + $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | */ |
243 | 243 | protected function getPostBackOptions() |
244 | 244 | { |
245 | - $options['ID'] = $this->getClientID(); |
|
246 | - $options['EventTarget'] = $this->getUniqueID(); |
|
247 | - $options['AutoPostBack'] = $this->getAutoPostBack(); |
|
248 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
249 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
250 | - $options['TextMode'] = $this->getTextMode(); |
|
245 | + $options['ID']=$this->getClientID(); |
|
246 | + $options['EventTarget']=$this->getUniqueID(); |
|
247 | + $options['AutoPostBack']=$this->getAutoPostBack(); |
|
248 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
249 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
250 | + $options['TextMode']=$this->getTextMode(); |
|
251 | 251 | return $options; |
252 | 252 | } |
253 | 253 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @param array the input data collection |
259 | 259 | * @return boolean whether the data of the component has been changed |
260 | 260 | */ |
261 | - public function loadPostData($key,$values) |
|
261 | + public function loadPostData($key, $values) |
|
262 | 262 | { |
263 | 263 | $value=$values[$key]; |
264 | 264 | if($this->getAutoTrim()) |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function onTextChanged($param) |
321 | 321 | { |
322 | - $this->raiseEvent('OnTextChanged',$this,$param); |
|
322 | + $this->raiseEvent('OnTextChanged', $this, $param); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | */ |
364 | 364 | public function getAutoCompleteType() |
365 | 365 | { |
366 | - return $this->getViewState('AutoCompleteType',TTextBoxAutoCompleteType::None); |
|
366 | + return $this->getViewState('AutoCompleteType', TTextBoxAutoCompleteType::None); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | */ |
373 | 373 | public function setAutoCompleteType($value) |
374 | 374 | { |
375 | - $this->setViewState('AutoCompleteType',TPropertyValue::ensureEnum($value,'TTextBoxAutoCompleteType'),TTextBoxAutoCompleteType::None); |
|
375 | + $this->setViewState('AutoCompleteType', TPropertyValue::ensureEnum($value, 'TTextBoxAutoCompleteType'), TTextBoxAutoCompleteType::None); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | */ |
383 | 383 | public function getAutoPostBack() |
384 | 384 | { |
385 | - return $this->getViewState('AutoPostBack',false); |
|
385 | + return $this->getViewState('AutoPostBack', false); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | /** |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | */ |
394 | 394 | public function setAutoPostBack($value) |
395 | 395 | { |
396 | - $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),false); |
|
396 | + $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), false); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | /** |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | */ |
402 | 402 | public function getAutoTrim() |
403 | 403 | { |
404 | - return $this->getViewState('AutoTrim',false); |
|
404 | + return $this->getViewState('AutoTrim', false); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | /** |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | */ |
411 | 411 | public function setAutoTrim($value) |
412 | 412 | { |
413 | - $this->setViewState('AutoTrim',TPropertyValue::ensureBoolean($value),false); |
|
413 | + $this->setViewState('AutoTrim', TPropertyValue::ensureBoolean($value), false); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | /** |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | */ |
419 | 419 | public function getCausesValidation() |
420 | 420 | { |
421 | - return $this->getViewState('CausesValidation',true); |
|
421 | + return $this->getViewState('CausesValidation', true); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | /** |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | */ |
427 | 427 | public function setCausesValidation($value) |
428 | 428 | { |
429 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
429 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | /** |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | */ |
435 | 435 | public function getColumns() |
436 | 436 | { |
437 | - return $this->getViewState('Columns',0); |
|
437 | + return $this->getViewState('Columns', 0); |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | /** |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | */ |
444 | 444 | public function setColumns($value) |
445 | 445 | { |
446 | - $this->setViewState('Columns',TPropertyValue::ensureInteger($value),0); |
|
446 | + $this->setViewState('Columns', TPropertyValue::ensureInteger($value), 0); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | */ |
452 | 452 | public function getMaxLength() |
453 | 453 | { |
454 | - return $this->getViewState('MaxLength',0); |
|
454 | + return $this->getViewState('MaxLength', 0); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | /** |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | */ |
461 | 461 | public function setMaxLength($value) |
462 | 462 | { |
463 | - $this->setViewState('MaxLength',TPropertyValue::ensureInteger($value),0); |
|
463 | + $this->setViewState('MaxLength', TPropertyValue::ensureInteger($value), 0); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | /** |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | */ |
469 | 469 | public function getReadOnly() |
470 | 470 | { |
471 | - return $this->getViewState('ReadOnly',false); |
|
471 | + return $this->getViewState('ReadOnly', false); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | /** |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | */ |
477 | 477 | public function setReadOnly($value) |
478 | 478 | { |
479 | - $this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false); |
|
479 | + $this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false); |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | /** |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | */ |
485 | 485 | public function getRows() |
486 | 486 | { |
487 | - return $this->getViewState('Rows',self::DEFAULT_ROWS); |
|
487 | + return $this->getViewState('Rows', self::DEFAULT_ROWS); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | /** |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | */ |
494 | 494 | public function setRows($value) |
495 | 495 | { |
496 | - $this->setViewState('Rows',TPropertyValue::ensureInteger($value),self::DEFAULT_ROWS); |
|
496 | + $this->setViewState('Rows', TPropertyValue::ensureInteger($value), self::DEFAULT_ROWS); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | /** |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | */ |
502 | 502 | public function getPersistPassword() |
503 | 503 | { |
504 | - return $this->getViewState('PersistPassword',false); |
|
504 | + return $this->getViewState('PersistPassword', false); |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | /** |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | */ |
510 | 510 | public function setPersistPassword($value) |
511 | 511 | { |
512 | - $this->setViewState('PersistPassword',TPropertyValue::ensureBoolean($value),false); |
|
512 | + $this->setViewState('PersistPassword', TPropertyValue::ensureBoolean($value), false); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | /** |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | */ |
518 | 518 | public function getText() |
519 | 519 | { |
520 | - return $this->getViewState('Text',''); |
|
520 | + return $this->getViewState('Text', ''); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | /** |
@@ -526,8 +526,8 @@ discard block |
||
526 | 526 | */ |
527 | 527 | public function setText($value) |
528 | 528 | { |
529 | - $this->setViewState('Text',TPropertyValue::ensureString($value),''); |
|
530 | - $this->_safeText = null; |
|
529 | + $this->setViewState('Text', TPropertyValue::ensureString($value), ''); |
|
530 | + $this->_safeText=null; |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | /** |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | protected function getSafeTextParser() |
573 | 573 | { |
574 | 574 | if(!self::$_safeTextParser) |
575 | - self::$_safeTextParser= new \HTMLPurifier($this->getConfig()); |
|
575 | + self::$_safeTextParser=new \HTMLPurifier($this->getConfig()); |
|
576 | 576 | return self::$_safeTextParser; |
577 | 577 | } |
578 | 578 | |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | */ |
582 | 582 | public function getTextMode() |
583 | 583 | { |
584 | - return $this->getViewState('TextMode',TTextBoxMode::SingleLine); |
|
584 | + return $this->getViewState('TextMode', TTextBoxMode::SingleLine); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | /** |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | */ |
592 | 592 | public function setTextMode($value) |
593 | 593 | { |
594 | - $this->setViewState('TextMode',TPropertyValue::ensureEnum($value,'TTextBoxMode'),TTextBoxMode::SingleLine); |
|
594 | + $this->setViewState('TextMode', TPropertyValue::ensureEnum($value, 'TTextBoxMode'), TTextBoxMode::SingleLine); |
|
595 | 595 | } |
596 | 596 | |
597 | 597 | /** |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | */ |
600 | 600 | public function getValidationGroup() |
601 | 601 | { |
602 | - return $this->getViewState('ValidationGroup',''); |
|
602 | + return $this->getViewState('ValidationGroup', ''); |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | /** |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | */ |
608 | 608 | public function setValidationGroup($value) |
609 | 609 | { |
610 | - $this->setViewState('ValidationGroup',$value,''); |
|
610 | + $this->setViewState('ValidationGroup', $value, ''); |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | /** |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | */ |
616 | 616 | public function getWrap() |
617 | 617 | { |
618 | - return $this->getViewState('Wrap',true); |
|
618 | + return $this->getViewState('Wrap', true); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | /** |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | */ |
625 | 625 | public function setWrap($value) |
626 | 626 | { |
627 | - $this->setViewState('Wrap',TPropertyValue::ensureBoolean($value),true); |
|
627 | + $this->setViewState('Wrap', TPropertyValue::ensureBoolean($value), true); |
|
628 | 628 | } |
629 | 629 | |
630 | 630 | /** |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | */ |
642 | 642 | public function getConfig() |
643 | 643 | { |
644 | - $config = $this->getViewState('Config', null); |
|
645 | - return ($config === null) ? \HTMLPurifier_Config::createDefault() : $config; |
|
644 | + $config=$this->getViewState('Config', null); |
|
645 | + return ($config===null) ? \HTMLPurifier_Config::createDefault() : $config; |
|
646 | 646 | } |
647 | 647 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | /** |
286 | 286 | * Returns the value to be validated. |
287 | 287 | * This methid is required by \Prado\Web\UI\IValidatable interface. |
288 | - * @return mixed the value of the property to be validated. |
|
288 | + * @return string the value of the property to be validated. |
|
289 | 289 | */ |
290 | 290 | public function getValidationPropertyValue() |
291 | 291 | { |
@@ -390,6 +390,7 @@ discard block |
||
390 | 390 | * An automatic postback to the server will occur whenever the user |
391 | 391 | * modifies the text in the TTextBox control and then tabs out of the component. |
392 | 392 | * @param boolean the value indicating if postback automatically |
393 | + * @param boolean $value |
|
393 | 394 | */ |
394 | 395 | public function setAutoPostBack($value) |
395 | 396 | { |
@@ -473,6 +474,7 @@ discard block |
||
473 | 474 | |
474 | 475 | /** |
475 | 476 | * @param boolean whether the textbox is read only |
477 | + * @param boolean $value |
|
476 | 478 | */ |
477 | 479 | public function setReadOnly($value) |
478 | 480 | { |
@@ -120,8 +120,7 @@ discard block |
||
120 | 120 | $writer->addAttribute('cols',"$cols"); |
121 | 121 | if(!$this->getWrap()) |
122 | 122 | $writer->addAttribute('wrap','off'); |
123 | - } |
|
124 | - else |
|
123 | + } else |
|
125 | 124 | { |
126 | 125 | switch($textMode) |
127 | 126 | { |
@@ -267,8 +266,7 @@ discard block |
||
267 | 266 | { |
268 | 267 | $this->setText($value); |
269 | 268 | return $this->_dataChanged=true; |
270 | - } |
|
271 | - else |
|
269 | + } else |
|
272 | 270 | return false; |
273 | 271 | } |
274 | 272 |
@@ -100,21 +100,21 @@ discard block |
||
100 | 100 | $font=dirname(__FILE__).DIRECTORY_SEPARATOR.'verase.ttf'; |
101 | 101 | |
102 | 102 | if(function_exists('imagefilter')) |
103 | - imagefilter($image,IMG_FILTER_GAUSSIAN_BLUR); |
|
103 | + imagefilter($image,IMG_FILTER_GAUSSIAN_BLUR); |
|
104 | 104 | |
105 | 105 | $hasShadow=($theme&THEME_SHADOWED_TEXT); |
106 | - for($i=0;$i<$length;$i++) |
|
106 | + for($i=0;$i<$length;$i++) |
|
107 | 107 | { |
108 | - $color=imagecolorallocate($image,rand(150,220),rand(150,220),rand(150,220)); |
|
109 | - $size=rand($fontWidth-10,$fontWidth); |
|
110 | - $angle=rand(-30,30); |
|
111 | - $x=$padding+$i*$fontWidth; |
|
112 | - $y=rand($fontHeight-15,$fontHeight-10); |
|
113 | - imagettftext($image,$size,$angle,$x,$y,$color,$font,$token[$i]); |
|
114 | - if($hasShadow) |
|
115 | - imagettftext($image,$size,$angle,$x+2,$y+2,$color,$font,$token[$i]); |
|
116 | - imagecolordeallocate($image,$color); |
|
117 | - } |
|
108 | + $color=imagecolorallocate($image,rand(150,220),rand(150,220),rand(150,220)); |
|
109 | + $size=rand($fontWidth-10,$fontWidth); |
|
110 | + $angle=rand(-30,30); |
|
111 | + $x=$padding+$i*$fontWidth; |
|
112 | + $y=rand($fontHeight-15,$fontHeight-10); |
|
113 | + imagettftext($image,$size,$angle,$x,$y,$color,$font,$token[$i]); |
|
114 | + if($hasShadow) |
|
115 | + imagettftext($image,$size,$angle,$x+2,$y+2,$color,$font,$token[$i]); |
|
116 | + imagecolordeallocate($image,$color); |
|
117 | + } |
|
118 | 118 | |
119 | 119 | header('Content-Type: image/png'); |
120 | 120 | imagepng($image); |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | { |
159 | 159 | $color=imagecolorallocate($image,rand(150,220),rand(150,220),rand(150,220)); |
160 | 160 | imagesetpixel($image,$x,$y,$color); |
161 | - imagecolordeallocate($image,$color); |
|
162 | - } |
|
161 | + imagecolordeallocate($image,$color); |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | } |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | |
12 | 12 | namespace Prado\Web\UI\WebControls\assets; |
13 | 13 | |
14 | -define('THEME_OPAQUE_BACKGROUND',0x0001); |
|
15 | -define('THEME_NOISY_BACKGROUND',0x0002); |
|
16 | -define('THEME_HAS_GRID',0x0004); |
|
17 | -define('THEME_HAS_SCRIBBLE',0x0008); |
|
18 | -define('THEME_MORPH_BACKGROUND',0x0010); |
|
19 | -define('THEME_SHADOWED_TEXT',0x0020); |
|
14 | +define('THEME_OPAQUE_BACKGROUND', 0x0001); |
|
15 | +define('THEME_NOISY_BACKGROUND', 0x0002); |
|
16 | +define('THEME_HAS_GRID', 0x0004); |
|
17 | +define('THEME_HAS_SCRIBBLE', 0x0008); |
|
18 | +define('THEME_MORPH_BACKGROUND', 0x0010); |
|
19 | +define('THEME_SHADOWED_TEXT', 0x0020); |
|
20 | 20 | |
21 | 21 | require_once(dirname(__FILE__).'/captcha_key.php'); |
22 | 22 | |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | if(isset($_GET['options'])) |
27 | 27 | { |
28 | 28 | $str=base64_decode($_GET['options']); |
29 | - if(strlen($str)>32) |
|
29 | + if(strlen($str) > 32) |
|
30 | 30 | { |
31 | - $hash=substr($str,0,32); |
|
32 | - $str=substr($str,32); |
|
31 | + $hash=substr($str, 0, 32); |
|
32 | + $str=substr($str, 32); |
|
33 | 33 | if(md5($privateKey.$str)===$hash) |
34 | 34 | { |
35 | 35 | $options=unserialize($str); |
@@ -39,83 +39,82 @@ discard block |
||
39 | 39 | $alphabet=$options['alphabet']; |
40 | 40 | $fontSize=$options['fontSize']; |
41 | 41 | $theme=$options['theme']; |
42 | - if(($randomSeed=$options['randomSeed'])>0) |
|
42 | + if(($randomSeed=$options['randomSeed']) > 0) |
|
43 | 43 | srand($randomSeed); |
44 | 44 | else |
45 | - srand((int)(microtime()*1000000)); |
|
46 | - $token=generateToken($publicKey,$privateKey,$alphabet,$tokenLength,$caseSensitive); |
|
45 | + srand((int) (microtime() * 1000000)); |
|
46 | + $token=generateToken($publicKey, $privateKey, $alphabet, $tokenLength, $caseSensitive); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | -displayToken($token,$fontSize,$theme); |
|
51 | +displayToken($token, $fontSize, $theme); |
|
52 | 52 | |
53 | -function generateToken($publicKey,$privateKey,$alphabet,$tokenLength,$caseSensitive) |
|
53 | +function generateToken($publicKey, $privateKey, $alphabet, $tokenLength, $caseSensitive) |
|
54 | 54 | { |
55 | - $token=substr(hash2string(md5($publicKey.$privateKey),$alphabet).hash2string(md5($privateKey.$publicKey),$alphabet),0,$tokenLength); |
|
56 | - return $caseSensitive?$token:strtoupper($token); |
|
55 | + $token=substr(hash2string(md5($publicKey.$privateKey), $alphabet).hash2string(md5($privateKey.$publicKey), $alphabet), 0, $tokenLength); |
|
56 | + return $caseSensitive ? $token : strtoupper($token); |
|
57 | 57 | } |
58 | 58 | |
59 | -function hash2string($hex,$alphabet) |
|
59 | +function hash2string($hex, $alphabet) |
|
60 | 60 | { |
61 | - if(strlen($alphabet)<2) |
|
61 | + if(strlen($alphabet) < 2) |
|
62 | 62 | $alphabet='234578adefhijmnrtABDEFGHJLMNRT'; |
63 | 63 | $hexLength=strlen($hex); |
64 | 64 | $base=strlen($alphabet); |
65 | 65 | $result=''; |
66 | - for($i=0;$i<$hexLength;$i+=6) |
|
66 | + for($i=0; $i < $hexLength; $i+=6) |
|
67 | 67 | { |
68 | - $number=hexdec(substr($hex,$i,6)); |
|
68 | + $number=hexdec(substr($hex, $i, 6)); |
|
69 | 69 | while($number) |
70 | 70 | { |
71 | - $result.=$alphabet[$number%$base]; |
|
72 | - $number=floor($number/$base); |
|
71 | + $result.=$alphabet[$number % $base]; |
|
72 | + $number=floor($number / $base); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | return $result; |
76 | 76 | } |
77 | 77 | |
78 | -function displayToken($token,$fontSize,$theme) |
|
78 | +function displayToken($token, $fontSize, $theme) |
|
79 | 79 | { |
80 | - if(($fontSize=(int)$fontSize)<22) |
|
80 | + if(($fontSize=(int) $fontSize) < 22) |
|
81 | 81 | $fontSize=22; |
82 | - if($fontSize>100) |
|
82 | + if($fontSize > 100) |
|
83 | 83 | $fontSize=100; |
84 | 84 | $length=strlen($token); |
85 | 85 | $padding=10; |
86 | 86 | $fontWidth=$fontSize; |
87 | - $fontHeight=floor($fontWidth*1.5); |
|
88 | - $width=$fontWidth*$length+$padding*2; |
|
87 | + $fontHeight=floor($fontWidth * 1.5); |
|
88 | + $width=$fontWidth * $length + $padding * 2; |
|
89 | 89 | $height=$fontHeight; |
90 | - $image=imagecreatetruecolor($width,$height); |
|
90 | + $image=imagecreatetruecolor($width, $height); |
|
91 | 91 | |
92 | - addBackground |
|
93 | - ( |
|
92 | + addBackground( |
|
94 | 93 | $image, $width, $height, |
95 | - $theme&THEME_OPAQUE_BACKGROUND, |
|
96 | - $theme&THEME_NOISY_BACKGROUND, |
|
97 | - $theme&THEME_HAS_GRID, |
|
98 | - $theme&THEME_HAS_SCRIBBLE, |
|
99 | - $theme&THEME_MORPH_BACKGROUND |
|
94 | + $theme & THEME_OPAQUE_BACKGROUND, |
|
95 | + $theme & THEME_NOISY_BACKGROUND, |
|
96 | + $theme & THEME_HAS_GRID, |
|
97 | + $theme & THEME_HAS_SCRIBBLE, |
|
98 | + $theme & THEME_MORPH_BACKGROUND |
|
100 | 99 | ); |
101 | 100 | |
102 | 101 | $font=dirname(__FILE__).DIRECTORY_SEPARATOR.'verase.ttf'; |
103 | 102 | |
104 | 103 | if(function_exists('imagefilter')) |
105 | - imagefilter($image,IMG_FILTER_GAUSSIAN_BLUR); |
|
104 | + imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR); |
|
106 | 105 | |
107 | - $hasShadow=($theme&THEME_SHADOWED_TEXT); |
|
108 | - for($i=0;$i<$length;$i++) |
|
106 | + $hasShadow=($theme & THEME_SHADOWED_TEXT); |
|
107 | + for($i=0; $i < $length; $i++) |
|
109 | 108 | { |
110 | - $color=imagecolorallocate($image,rand(150,220),rand(150,220),rand(150,220)); |
|
111 | - $size=rand($fontWidth-10,$fontWidth); |
|
112 | - $angle=rand(-30,30); |
|
113 | - $x=$padding+$i*$fontWidth; |
|
114 | - $y=rand($fontHeight-15,$fontHeight-10); |
|
115 | - imagettftext($image,$size,$angle,$x,$y,$color,$font,$token[$i]); |
|
109 | + $color=imagecolorallocate($image, rand(150, 220), rand(150, 220), rand(150, 220)); |
|
110 | + $size=rand($fontWidth - 10, $fontWidth); |
|
111 | + $angle=rand(-30, 30); |
|
112 | + $x=$padding + $i * $fontWidth; |
|
113 | + $y=rand($fontHeight - 15, $fontHeight - 10); |
|
114 | + imagettftext($image, $size, $angle, $x, $y, $color, $font, $token[$i]); |
|
116 | 115 | if($hasShadow) |
117 | - imagettftext($image,$size,$angle,$x+2,$y+2,$color,$font,$token[$i]); |
|
118 | - imagecolordeallocate($image,$color); |
|
116 | + imagettftext($image, $size, $angle, $x + 2, $y + 2, $color, $font, $token[$i]); |
|
117 | + imagecolordeallocate($image, $color); |
|
119 | 118 | } |
120 | 119 | |
121 | 120 | header('Content-Type: image/png'); |
@@ -123,103 +122,103 @@ discard block |
||
123 | 122 | imagedestroy($image); |
124 | 123 | } |
125 | 124 | |
126 | -function addBackground($image,$width,$height,$opaque,$noisy,$hasGrid,$hasScribble,$morph) |
|
125 | +function addBackground($image, $width, $height, $opaque, $noisy, $hasGrid, $hasScribble, $morph) |
|
127 | 126 | { |
128 | - $background=imagecreatetruecolor($width*2,$height*2); |
|
129 | - $white=imagecolorallocate($background,255,255,255); |
|
130 | - imagefill($background,0,0,$white); |
|
127 | + $background=imagecreatetruecolor($width * 2, $height * 2); |
|
128 | + $white=imagecolorallocate($background, 255, 255, 255); |
|
129 | + imagefill($background, 0, 0, $white); |
|
131 | 130 | |
132 | 131 | if($opaque) |
133 | - imagefill($background,0,0,imagecolorallocate($background,100,100,100)); |
|
132 | + imagefill($background, 0, 0, imagecolorallocate($background, 100, 100, 100)); |
|
134 | 133 | |
135 | 134 | if($noisy) |
136 | - addNoise($background,$width*2,$height*2); |
|
135 | + addNoise($background, $width * 2, $height * 2); |
|
137 | 136 | |
138 | 137 | if($hasGrid) |
139 | - addGrid($background,$width*2,$height*2); |
|
138 | + addGrid($background, $width * 2, $height * 2); |
|
140 | 139 | |
141 | 140 | if($hasScribble) |
142 | - addScribble($background,$width*2,$height*2); |
|
141 | + addScribble($background, $width * 2, $height * 2); |
|
143 | 142 | |
144 | 143 | if($morph) |
145 | - morphImage($background,$width*2,$height*2); |
|
144 | + morphImage($background, $width * 2, $height * 2); |
|
146 | 145 | |
147 | - imagecopy($image,$background,0,0,30,30,$width,$height); |
|
146 | + imagecopy($image, $background, 0, 0, 30, 30, $width, $height); |
|
148 | 147 | |
149 | 148 | if(!$opaque) |
150 | - imagecolortransparent($image,$white); |
|
149 | + imagecolortransparent($image, $white); |
|
151 | 150 | } |
152 | 151 | |
153 | -function addNoise($image,$width,$height) |
|
152 | +function addNoise($image, $width, $height) |
|
154 | 153 | { |
155 | - for($x=0;$x<$width;++$x) |
|
154 | + for($x=0; $x < $width; ++$x) |
|
156 | 155 | { |
157 | - for($y=0;$y<$height;++$y) |
|
156 | + for($y=0; $y < $height; ++$y) |
|
158 | 157 | { |
159 | - if(rand(0,100)<25) |
|
158 | + if(rand(0, 100) < 25) |
|
160 | 159 | { |
161 | - $color=imagecolorallocate($image,rand(150,220),rand(150,220),rand(150,220)); |
|
162 | - imagesetpixel($image,$x,$y,$color); |
|
163 | - imagecolordeallocate($image,$color); |
|
160 | + $color=imagecolorallocate($image, rand(150, 220), rand(150, 220), rand(150, 220)); |
|
161 | + imagesetpixel($image, $x, $y, $color); |
|
162 | + imagecolordeallocate($image, $color); |
|
164 | 163 | } |
165 | 164 | } |
166 | 165 | } |
167 | 166 | } |
168 | 167 | |
169 | -function addGrid($image,$width,$height) |
|
168 | +function addGrid($image, $width, $height) |
|
170 | 169 | { |
171 | - for($i=0;$i<$width;$i+=rand(15,25)) |
|
170 | + for($i=0; $i < $width; $i+=rand(15, 25)) |
|
172 | 171 | { |
173 | - imagesetthickness($image,rand(2,6)); |
|
174 | - $color=imagecolorallocate($image,rand(100,180),rand(100,180),rand(100,180)); |
|
175 | - imageline($image,$i+rand(-10,20),0,$i+rand(-10,20),$height,$color); |
|
176 | - imagecolordeallocate($image,$color); |
|
172 | + imagesetthickness($image, rand(2, 6)); |
|
173 | + $color=imagecolorallocate($image, rand(100, 180), rand(100, 180), rand(100, 180)); |
|
174 | + imageline($image, $i + rand(-10, 20), 0, $i + rand(-10, 20), $height, $color); |
|
175 | + imagecolordeallocate($image, $color); |
|
177 | 176 | } |
178 | - for($i=0;$i<$height;$i+=rand(15,25)) |
|
177 | + for($i=0; $i < $height; $i+=rand(15, 25)) |
|
179 | 178 | { |
180 | - imagesetthickness($image,rand(2,6)); |
|
181 | - $color=imagecolorallocate($image,rand(100,180),rand(100,180),rand(100,180)); |
|
182 | - imageline($image,0,$i+rand(-10,20),$width,$i+rand(-10,20),$color); |
|
183 | - imagecolordeallocate($image,$color); |
|
179 | + imagesetthickness($image, rand(2, 6)); |
|
180 | + $color=imagecolorallocate($image, rand(100, 180), rand(100, 180), rand(100, 180)); |
|
181 | + imageline($image, 0, $i + rand(-10, 20), $width, $i + rand(-10, 20), $color); |
|
182 | + imagecolordeallocate($image, $color); |
|
184 | 183 | } |
185 | 184 | } |
186 | 185 | |
187 | -function addScribble($image,$width,$height) |
|
186 | +function addScribble($image, $width, $height) |
|
188 | 187 | { |
189 | - for($i=0;$i<8;$i++) |
|
188 | + for($i=0; $i < 8; $i++) |
|
190 | 189 | { |
191 | - $color=imagecolorallocate($image,rand(100,180),rand(100,180),rand(100,180)); |
|
190 | + $color=imagecolorallocate($image, rand(100, 180), rand(100, 180), rand(100, 180)); |
|
192 | 191 | $points=array(); |
193 | - for($j=1;$j<rand(5,10);$j++) |
|
192 | + for($j=1; $j < rand(5, 10); $j++) |
|
194 | 193 | { |
195 | - $points[]=rand(2*(20*($i+1)),2*(50*($i+1))); |
|
196 | - $points[]=rand(30,$height+30); |
|
194 | + $points[]=rand(2 * (20 * ($i + 1)), 2 * (50 * ($i + 1))); |
|
195 | + $points[]=rand(30, $height + 30); |
|
197 | 196 | } |
198 | - imagesetthickness($image,rand(2,6)); |
|
199 | - imagepolygon($image,$points,intval(sizeof($points)/2),$color); |
|
200 | - imagecolordeallocate($image,$color); |
|
197 | + imagesetthickness($image, rand(2, 6)); |
|
198 | + imagepolygon($image, $points, intval(sizeof($points) / 2), $color); |
|
199 | + imagecolordeallocate($image, $color); |
|
201 | 200 | } |
202 | 201 | } |
203 | 202 | |
204 | -function morphImage($image,$width,$height) |
|
203 | +function morphImage($image, $width, $height) |
|
205 | 204 | { |
206 | - $tempImage=imagecreatetruecolor($width,$height); |
|
207 | - $chunk=rand(1,5); |
|
208 | - for($x=$y=0;$x<$width;$x+=$chunk) |
|
205 | + $tempImage=imagecreatetruecolor($width, $height); |
|
206 | + $chunk=rand(1, 5); |
|
207 | + for($x=$y=0; $x < $width; $x+=$chunk) |
|
209 | 208 | { |
210 | - $chunk=rand(1,5); |
|
211 | - $y+=rand(-1,1); |
|
212 | - if($y>=$height) $y=$height-5; |
|
213 | - if($y<0) $y=5; |
|
214 | - imagecopy($tempImage,$image,$x,0,$x,$y,$chunk,$height); |
|
209 | + $chunk=rand(1, 5); |
|
210 | + $y+=rand(-1, 1); |
|
211 | + if($y >= $height) $y=$height - 5; |
|
212 | + if($y < 0) $y=5; |
|
213 | + imagecopy($tempImage, $image, $x, 0, $x, $y, $chunk, $height); |
|
215 | 214 | } |
216 | - for($x=$y=0;$y<$height;$y+=$chunk) |
|
215 | + for($x=$y=0; $y < $height; $y+=$chunk) |
|
217 | 216 | { |
218 | - $chunk=rand(1,5); |
|
219 | - $x+=rand(-1,1); |
|
220 | - if($x>=$width) $x=$width-5; |
|
221 | - if($x<0) $x=5; |
|
222 | - imagecopy($image,$tempImage,$x,$y,0,$y,$width,$chunk); |
|
217 | + $chunk=rand(1, 5); |
|
218 | + $x+=rand(-1, 1); |
|
219 | + if($x >= $width) $x=$width - 5; |
|
220 | + if($x < 0) $x=5; |
|
221 | + imagecopy($image, $tempImage, $x, $y, 0, $y, $width, $chunk); |
|
223 | 222 | } |
224 | 223 | } |
225 | 224 |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
84 | - * Returns the index of the active tab view. |
|
85 | - * Note, this property may not return the correct index. |
|
86 | - * To ensure the correctness, call {@link getActiveView()} first. |
|
84 | + * Returns the index of the active tab view. |
|
85 | + * Note, this property may not return the correct index. |
|
86 | + * To ensure the correctness, call {@link getActiveView()} first. |
|
87 | 87 | * @return integer the zero-based index of the active tab view. If -1, it means no active tab view. Default is 0 (the first view is active). |
88 | 88 | */ |
89 | 89 | public function getActiveViewIndex() |
@@ -100,24 +100,24 @@ discard block |
||
100 | 100 | $this->setViewState('ActiveViewIndex',TPropertyValue::ensureInteger($value),0); |
101 | 101 | } |
102 | 102 | |
103 | - /** |
|
104 | - * Returns the ID of the active tab view. |
|
105 | - * Note, this property may not return the correct ID. |
|
106 | - * To ensure the correctness, call {@link getActiveView()} first. |
|
107 | - * @return string The ID of the active tab view. Defaults to '', meaning not set. |
|
108 | - */ |
|
109 | - public function getActiveViewID() |
|
110 | - { |
|
103 | + /** |
|
104 | + * Returns the ID of the active tab view. |
|
105 | + * Note, this property may not return the correct ID. |
|
106 | + * To ensure the correctness, call {@link getActiveView()} first. |
|
107 | + * @return string The ID of the active tab view. Defaults to '', meaning not set. |
|
108 | + */ |
|
109 | + public function getActiveViewID() |
|
110 | + { |
|
111 | 111 | return $this->getViewState('ActiveViewID',''); |
112 | - } |
|
112 | + } |
|
113 | 113 | |
114 | - /** |
|
115 | - * @param string The ID of the active tab view. |
|
116 | - */ |
|
117 | - public function setActiveViewID($value) |
|
118 | - { |
|
114 | + /** |
|
115 | + * @param string The ID of the active tab view. |
|
116 | + */ |
|
117 | + public function setActiveViewID($value) |
|
118 | + { |
|
119 | 119 | $this->setViewState('ActiveViewID',$value,''); |
120 | - } |
|
120 | + } |
|
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Returns the currently active view. |
@@ -172,63 +172,63 @@ discard block |
||
172 | 172 | throw new TInvalidOperationException('tabpanel_view_inexistent'); |
173 | 173 | } |
174 | 174 | |
175 | - /** |
|
176 | - * @return bool status of automatic tab switch on hover |
|
177 | - */ |
|
178 | - public function getAutoSwitch() |
|
179 | - { |
|
180 | - return TPropertyValue::ensureBoolean($this->getViewState('AutoSwitch')); |
|
181 | - } |
|
182 | - |
|
183 | - /** |
|
184 | - * @param bool whether to enable automatic tab switch on hover |
|
185 | - */ |
|
186 | - public function setAutoSwitch($value) |
|
187 | - { |
|
188 | - $this->setViewState('AutoSwitch',TPropertyValue::ensureBoolean($value)); |
|
189 | - } |
|
190 | - |
|
191 | - |
|
192 | - /** |
|
193 | - * @return string URL for the CSS file including all relevant CSS class definitions. Defaults to ''. |
|
194 | - */ |
|
195 | - public function getCssUrl() |
|
196 | - { |
|
197 | - return $this->getViewState('CssUrl','default'); |
|
198 | - } |
|
199 | - |
|
200 | - /** |
|
201 | - * @param string URL for the CSS file including all relevant CSS class definitions. |
|
202 | - */ |
|
203 | - public function setCssUrl($value) |
|
204 | - { |
|
205 | - $this->setViewState('CssUrl',TPropertyValue::ensureString($value),''); |
|
206 | - } |
|
207 | - |
|
208 | - /** |
|
209 | - * @return string CSS class for the whole tab control div. Defaults to 'tab-panel'. |
|
210 | - */ |
|
211 | - public function getCssClass() |
|
212 | - { |
|
213 | - $cssClass=parent::getCssClass(); |
|
214 | - return $cssClass===''?'tab-panel':$cssClass; |
|
215 | - } |
|
216 | - |
|
217 | - /** |
|
218 | - * @return string CSS class for the currently displayed view div. Defaults to 'tab-view'. |
|
219 | - */ |
|
220 | - public function getViewCssClass() |
|
221 | - { |
|
222 | - return $this->getViewStyle()->getCssClass(); |
|
223 | - } |
|
224 | - |
|
225 | - /** |
|
226 | - * @param string CSS class for the currently displayed view div. |
|
227 | - */ |
|
228 | - public function setViewCssClass($value) |
|
229 | - { |
|
230 | - $this->getViewStyle()->setCssClass($value); |
|
231 | - } |
|
175 | + /** |
|
176 | + * @return bool status of automatic tab switch on hover |
|
177 | + */ |
|
178 | + public function getAutoSwitch() |
|
179 | + { |
|
180 | + return TPropertyValue::ensureBoolean($this->getViewState('AutoSwitch')); |
|
181 | + } |
|
182 | + |
|
183 | + /** |
|
184 | + * @param bool whether to enable automatic tab switch on hover |
|
185 | + */ |
|
186 | + public function setAutoSwitch($value) |
|
187 | + { |
|
188 | + $this->setViewState('AutoSwitch',TPropertyValue::ensureBoolean($value)); |
|
189 | + } |
|
190 | + |
|
191 | + |
|
192 | + /** |
|
193 | + * @return string URL for the CSS file including all relevant CSS class definitions. Defaults to ''. |
|
194 | + */ |
|
195 | + public function getCssUrl() |
|
196 | + { |
|
197 | + return $this->getViewState('CssUrl','default'); |
|
198 | + } |
|
199 | + |
|
200 | + /** |
|
201 | + * @param string URL for the CSS file including all relevant CSS class definitions. |
|
202 | + */ |
|
203 | + public function setCssUrl($value) |
|
204 | + { |
|
205 | + $this->setViewState('CssUrl',TPropertyValue::ensureString($value),''); |
|
206 | + } |
|
207 | + |
|
208 | + /** |
|
209 | + * @return string CSS class for the whole tab control div. Defaults to 'tab-panel'. |
|
210 | + */ |
|
211 | + public function getCssClass() |
|
212 | + { |
|
213 | + $cssClass=parent::getCssClass(); |
|
214 | + return $cssClass===''?'tab-panel':$cssClass; |
|
215 | + } |
|
216 | + |
|
217 | + /** |
|
218 | + * @return string CSS class for the currently displayed view div. Defaults to 'tab-view'. |
|
219 | + */ |
|
220 | + public function getViewCssClass() |
|
221 | + { |
|
222 | + return $this->getViewStyle()->getCssClass(); |
|
223 | + } |
|
224 | + |
|
225 | + /** |
|
226 | + * @param string CSS class for the currently displayed view div. |
|
227 | + */ |
|
228 | + public function setViewCssClass($value) |
|
229 | + { |
|
230 | + $this->getViewStyle()->setCssClass($value); |
|
231 | + } |
|
232 | 232 | |
233 | 233 | /** |
234 | 234 | * @return TStyle the style for all the view div |
@@ -244,21 +244,21 @@ discard block |
||
244 | 244 | return $style; |
245 | 245 | } |
246 | 246 | |
247 | - /** |
|
248 | - * @return string CSS class for non-active tabs. Defaults to 'tab-normal'. |
|
249 | - */ |
|
250 | - public function getTabCssClass() |
|
251 | - { |
|
252 | - return $this->getTabStyle()->getCssClass(); |
|
253 | - } |
|
247 | + /** |
|
248 | + * @return string CSS class for non-active tabs. Defaults to 'tab-normal'. |
|
249 | + */ |
|
250 | + public function getTabCssClass() |
|
251 | + { |
|
252 | + return $this->getTabStyle()->getCssClass(); |
|
253 | + } |
|
254 | 254 | |
255 | - /** |
|
256 | - * @param string CSS class for non-active tabs. |
|
257 | - */ |
|
258 | - public function setTabCssClass($value) |
|
259 | - { |
|
260 | - $this->getTabStyle()->setCssClass($value); |
|
261 | - } |
|
255 | + /** |
|
256 | + * @param string CSS class for non-active tabs. |
|
257 | + */ |
|
258 | + public function setTabCssClass($value) |
|
259 | + { |
|
260 | + $this->getTabStyle()->setCssClass($value); |
|
261 | + } |
|
262 | 262 | |
263 | 263 | /** |
264 | 264 | * @return TStyle the style for all the inactive tab div |
@@ -274,21 +274,21 @@ discard block |
||
274 | 274 | return $style; |
275 | 275 | } |
276 | 276 | |
277 | - /** |
|
278 | - * @return string CSS class for the active tab. Defaults to 'tab-active'. |
|
279 | - */ |
|
280 | - public function getActiveTabCssClass() |
|
281 | - { |
|
282 | - return $this->getActiveTabStyle()->getCssClass(); |
|
283 | - } |
|
284 | - |
|
285 | - /** |
|
286 | - * @param string CSS class for the active tab. |
|
287 | - */ |
|
288 | - public function setActiveTabCssClass($value) |
|
289 | - { |
|
290 | - $this->getActiveTabStyle()->setCssClass($value); |
|
291 | - } |
|
277 | + /** |
|
278 | + * @return string CSS class for the active tab. Defaults to 'tab-active'. |
|
279 | + */ |
|
280 | + public function getActiveTabCssClass() |
|
281 | + { |
|
282 | + return $this->getActiveTabStyle()->getCssClass(); |
|
283 | + } |
|
284 | + |
|
285 | + /** |
|
286 | + * @param string CSS class for the active tab. |
|
287 | + */ |
|
288 | + public function setActiveTabCssClass($value) |
|
289 | + { |
|
290 | + $this->getActiveTabStyle()->setCssClass($value); |
|
291 | + } |
|
292 | 292 | |
293 | 293 | /** |
294 | 294 | * @return TStyle the style for the active tab div |
@@ -136,15 +136,13 @@ discard block |
||
136 | 136 | $activeView=$views->itemAt($index); |
137 | 137 | else |
138 | 138 | throw new TInvalidDataValueException('tabpanel_activeviewid_invalid',$id); |
139 | - } |
|
140 | - else if(($index=$this->getActiveViewIndex())>=0) |
|
139 | + } else if(($index=$this->getActiveViewIndex())>=0) |
|
141 | 140 | { |
142 | 141 | if($index<$views->getCount()) |
143 | 142 | $activeView=$views->itemAt($index); |
144 | 143 | else |
145 | 144 | throw new TInvalidDataValueException('tabpanel_activeviewindex_invalid',$index); |
146 | - } |
|
147 | - else |
|
145 | + } else |
|
148 | 146 | { |
149 | 147 | foreach($views as $index=>$view) |
150 | 148 | { |
@@ -320,8 +318,7 @@ discard block |
||
320 | 318 | $this->setActiveViewIndex($index); |
321 | 319 | $this->setActiveViewID($view->getID(false)); |
322 | 320 | $view->setActive(true); |
323 | - } |
|
324 | - else |
|
321 | + } else |
|
325 | 322 | $v->setActive(false); |
326 | 323 | } |
327 | 324 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function getActiveViewIndex() |
96 | 96 | { |
97 | - return $this->getViewState('ActiveViewIndex',0); |
|
97 | + return $this->getViewState('ActiveViewIndex', 0); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function setActiveViewIndex($value) |
105 | 105 | { |
106 | - $this->setViewState('ActiveViewIndex',TPropertyValue::ensureInteger($value),0); |
|
106 | + $this->setViewState('ActiveViewIndex', TPropertyValue::ensureInteger($value), 0); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function getActiveViewID() |
116 | 116 | { |
117 | - return $this->getViewState('ActiveViewID',''); |
|
117 | + return $this->getViewState('ActiveViewID', ''); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function setActiveViewID($value) |
124 | 124 | { |
125 | - $this->setViewState('ActiveViewID',$value,''); |
|
125 | + $this->setViewState('ActiveViewID', $value, ''); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -138,17 +138,17 @@ discard block |
||
138 | 138 | $views=$this->getViews(); |
139 | 139 | if(($id=$this->getActiveViewID())!=='') |
140 | 140 | { |
141 | - if(($index=$views->findIndexByID($id))>=0) |
|
141 | + if(($index=$views->findIndexByID($id)) >= 0) |
|
142 | 142 | $activeView=$views->itemAt($index); |
143 | 143 | else |
144 | - throw new TInvalidDataValueException('tabpanel_activeviewid_invalid',$id); |
|
144 | + throw new TInvalidDataValueException('tabpanel_activeviewid_invalid', $id); |
|
145 | 145 | } |
146 | - else if(($index=$this->getActiveViewIndex())>=0) |
|
146 | + else if(($index=$this->getActiveViewIndex()) >= 0) |
|
147 | 147 | { |
148 | - if($index<$views->getCount()) |
|
148 | + if($index < $views->getCount()) |
|
149 | 149 | $activeView=$views->itemAt($index); |
150 | 150 | else |
151 | - throw new TInvalidDataValueException('tabpanel_activeviewindex_invalid',$index); |
|
151 | + throw new TInvalidDataValueException('tabpanel_activeviewindex_invalid', $index); |
|
152 | 152 | } |
153 | 153 | else |
154 | 154 | { |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function setActiveView($view) |
174 | 174 | { |
175 | - if($this->getViews()->indexOf($view)>=0) |
|
175 | + if($this->getViews()->indexOf($view) >= 0) |
|
176 | 176 | $this->activateView($view); |
177 | 177 | else |
178 | 178 | throw new TInvalidOperationException('tabpanel_view_inexistent'); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function setAutoSwitch($value) |
193 | 193 | { |
194 | - $this->setViewState('AutoSwitch',TPropertyValue::ensureBoolean($value)); |
|
194 | + $this->setViewState('AutoSwitch', TPropertyValue::ensureBoolean($value)); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function getCssUrl() |
202 | 202 | { |
203 | - return $this->getViewState('CssUrl','default'); |
|
203 | + return $this->getViewState('CssUrl', 'default'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function setCssUrl($value) |
210 | 210 | { |
211 | - $this->setViewState('CssUrl',TPropertyValue::ensureString($value),''); |
|
211 | + $this->setViewState('CssUrl', TPropertyValue::ensureString($value), ''); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | public function getCssClass() |
218 | 218 | { |
219 | 219 | $cssClass=parent::getCssClass(); |
220 | - return $cssClass===''?'tab-panel':$cssClass; |
|
220 | + return $cssClass==='' ? 'tab-panel' : $cssClass; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public function getViewStyle() |
243 | 243 | { |
244 | - if(($style=$this->getViewState('ViewStyle',null))===null) |
|
244 | + if(($style=$this->getViewState('ViewStyle', null))===null) |
|
245 | 245 | { |
246 | 246 | $style=new TStyle; |
247 | 247 | $style->setCssClass('tab-view'); |
248 | - $this->setViewState('ViewStyle',$style,null); |
|
248 | + $this->setViewState('ViewStyle', $style, null); |
|
249 | 249 | } |
250 | 250 | return $style; |
251 | 251 | } |
@@ -271,11 +271,11 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public function getTabStyle() |
273 | 273 | { |
274 | - if(($style=$this->getViewState('TabStyle',null))===null) |
|
274 | + if(($style=$this->getViewState('TabStyle', null))===null) |
|
275 | 275 | { |
276 | 276 | $style=new TStyle; |
277 | 277 | $style->setCssClass('tab-normal'); |
278 | - $this->setViewState('TabStyle',$style,null); |
|
278 | + $this->setViewState('TabStyle', $style, null); |
|
279 | 279 | } |
280 | 280 | return $style; |
281 | 281 | } |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | */ |
302 | 302 | public function getActiveTabStyle() |
303 | 303 | { |
304 | - if(($style=$this->getViewState('ActiveTabStyle',null))===null) |
|
304 | + if(($style=$this->getViewState('ActiveTabStyle', null))===null) |
|
305 | 305 | { |
306 | 306 | $style=new TStyle; |
307 | 307 | $style->setCssClass('tab-active'); |
308 | - $this->setViewState('ActiveTabStyle',$style,null); |
|
308 | + $this->setViewState('ActiveTabStyle', $style, null); |
|
309 | 309 | } |
310 | 310 | return $style; |
311 | 311 | } |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | * @param array the input data collection |
340 | 340 | * @return boolean whether the data of the control has been changed |
341 | 341 | */ |
342 | - public function loadPostData($key,$values) |
|
342 | + public function loadPostData($key, $values) |
|
343 | 343 | { |
344 | 344 | if(($index=$values[$this->getClientID().'_1'])!==null) |
345 | 345 | { |
346 | - $index=(int)$index; |
|
346 | + $index=(int) $index; |
|
347 | 347 | $currentIndex=$this->getActiveViewIndex(); |
348 | 348 | if($currentIndex!==$index) |
349 | 349 | { |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | */ |
384 | 384 | protected function addAttributesToRender($writer) |
385 | 385 | { |
386 | - $writer->addAttribute('id',$this->getClientID()); |
|
386 | + $writer->addAttribute('id', $this->getClientID()); |
|
387 | 387 | $this->setCssClass($this->getCssClass()); |
388 | 388 | parent::addAttributesToRender($writer); |
389 | 389 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | public function onPreRender($param) |
397 | 397 | { |
398 | 398 | parent::onPreRender($param); |
399 | - $this->getActiveView(); // determine the active view |
|
399 | + $this->getActiveView(); // determine the active view |
|
400 | 400 | $this->registerStyleSheet(); |
401 | 401 | |
402 | 402 | $page=$this->getPage(); |
@@ -411,17 +411,17 @@ discard block |
||
411 | 411 | */ |
412 | 412 | protected function registerStyleSheet() |
413 | 413 | { |
414 | - $url = $this->getCssUrl(); |
|
414 | + $url=$this->getCssUrl(); |
|
415 | 415 | |
416 | - if($url === '') { |
|
416 | + if($url==='') { |
|
417 | 417 | return; |
418 | 418 | } |
419 | 419 | |
420 | - if($url === 'default') { |
|
421 | - $url = $this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'tabpanel.css'); |
|
420 | + if($url==='default') { |
|
421 | + $url=$this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'tabpanel.css'); |
|
422 | 422 | } |
423 | 423 | |
424 | - if($url !== '') { |
|
424 | + if($url!=='') { |
|
425 | 425 | $this->getPage()->getClientScript()->registerStyleSheetFile($url, $url); |
426 | 426 | } |
427 | 427 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $code="new $className($options);"; |
440 | 440 | $cs->registerEndScript("prado:$id", $code); |
441 | 441 | // ensure an item is always active and visible |
442 | - $index = $this->getActiveViewIndex(); |
|
442 | + $index=$this->getActiveViewIndex(); |
|
443 | 443 | if(!$this->getViews()->itemAt($index)->Visible) |
444 | 444 | $index=0; |
445 | 445 | $cs->registerHiddenField($id.'_1', $index); |
@@ -460,19 +460,19 @@ discard block |
||
460 | 460 | */ |
461 | 461 | protected function getClientOptions() |
462 | 462 | { |
463 | - $options['ID'] = $this->getClientID(); |
|
464 | - $options['ActiveCssClass'] = $this->getActiveTabCssClass(); |
|
465 | - $options['NormalCssClass'] = $this->getTabCssClass(); |
|
466 | - $viewIDs = array(); |
|
467 | - $viewVis = array(); |
|
463 | + $options['ID']=$this->getClientID(); |
|
464 | + $options['ActiveCssClass']=$this->getActiveTabCssClass(); |
|
465 | + $options['NormalCssClass']=$this->getTabCssClass(); |
|
466 | + $viewIDs=array(); |
|
467 | + $viewVis=array(); |
|
468 | 468 | foreach($this->getViews() as $view) |
469 | 469 | { |
470 | - $viewIDs[] = $view->getClientID(); |
|
471 | - $viewVis[] = $view->getVisible(); |
|
470 | + $viewIDs[]=$view->getClientID(); |
|
471 | + $viewVis[]=$view->getVisible(); |
|
472 | 472 | } |
473 | - $options['Views'] = $viewIDs; |
|
474 | - $options['ViewsVis'] = $viewVis; |
|
475 | - $options['AutoSwitch'] = $this->getAutoSwitch(); |
|
473 | + $options['Views']=$viewIDs; |
|
474 | + $options['ViewsVis']=$viewVis; |
|
475 | + $options['AutoSwitch']=$this->getAutoSwitch(); |
|
476 | 476 | |
477 | 477 | return $options; |
478 | 478 | } |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | public function renderContents($writer) |
508 | 508 | { |
509 | 509 | $views=$this->getViews(); |
510 | - if($views->getCount()>0) |
|
510 | + if($views->getCount() > 0) |
|
511 | 511 | { |
512 | 512 | $writer->writeLine(); |
513 | 513 | // render tab bar |
@@ -32,8 +32,8 @@ |
||
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @return boolean a value indicating whether an automatic postback to the server |
35 | - * will occur whenever the user modifies the text in the TActiveDatePicker control and |
|
36 | - * then tabs out of the component. Defaults to true. |
|
35 | + * will occur whenever the user modifies the text in the TActiveDatePicker control and |
|
36 | + * then tabs out of the component. Defaults to true. |
|
37 | 37 | */ |
38 | 38 | public function getAutoPostBack() |
39 | 39 | { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function getAutoPostBack() |
46 | 46 | { |
47 | - return $this->getViewState('AutoPostBack',true); |
|
47 | + return $this->getViewState('AutoPostBack', true); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function setAutoPostBack($value) |
57 | 57 | { |
58 | - $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),true); |
|
58 | + $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), true); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | */ |
65 | 65 | protected function getDatePickerOptions() |
66 | 66 | { |
67 | - $options = parent::getDatePickerOptions(); |
|
67 | + $options=parent::getDatePickerOptions(); |
|
68 | 68 | $options['CausesValidation']=$this->getCausesValidation(); |
69 | 69 | $options['ValidationGroup']=$this->getValidationGroup(); |
70 | - $options['EventTarget'] = $this->getUniqueID(); |
|
71 | - $options['ShowCalendar'] = $this->getShowCalendar(); |
|
72 | - $options['AutoPostBack'] = $this->getAutoPostBack(); |
|
70 | + $options['EventTarget']=$this->getUniqueID(); |
|
71 | + $options['ShowCalendar']=$this->getShowCalendar(); |
|
72 | + $options['AutoPostBack']=$this->getAutoPostBack(); |
|
73 | 73 | return $options; |
74 | 74 | } |
75 | 75 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | /** |
88 | 88 | * @return TBaseActiveCallbackControl standard callback control options. |
89 | 89 | */ |
90 | - public function getActiveControl(){ |
|
90 | + public function getActiveControl() { |
|
91 | 91 | return $this->getAdapter()->getBaseActiveControl(); |
92 | 92 | } |
93 | 93 | |
@@ -95,21 +95,21 @@ discard block |
||
95 | 95 | * Client-side Text property can only be updated after the OnLoad stage. |
96 | 96 | * @param string text content for the textbox |
97 | 97 | */ |
98 | - public function setText($value){ |
|
99 | - if(parent::getText() === $value) |
|
98 | + public function setText($value) { |
|
99 | + if(parent::getText()===$value) |
|
100 | 100 | return; |
101 | 101 | |
102 | 102 | parent::setText($value); |
103 | - if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()){ |
|
103 | + if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()) { |
|
104 | 104 | $cb=$this->getPage()->getCallbackClient(); |
105 | 105 | $cb->setValue($this, $value); |
106 | - if ($this->getInputMode()==TDatePickerInputMode::DropDownList) |
|
106 | + if($this->getInputMode()==TDatePickerInputMode::DropDownList) |
|
107 | 107 | { |
108 | - $dt = new \DateTime; |
|
108 | + $dt=new \DateTime; |
|
109 | 109 | $dt->setTimeStamp($this->getTimeStampFromText()); |
110 | 110 | $id=$this->getClientID(); |
111 | 111 | $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'day', 'Value', $dt->format('j'), 'select'); |
112 | - $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'month', 'Value', $dt->format('n')-1, 'select'); |
|
112 | + $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'month', 'Value', $dt->format('n') - 1, 'select'); |
|
113 | 113 | $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'year', 'Value', $dt->format('Y'), 'select'); |
114 | 114 | |
115 | 115 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * This method is mainly used by framework and control developers. |
123 | 123 | * @param TCallbackEventParameter the event parameter |
124 | 124 | */ |
125 | - public function raiseCallbackEvent($param){ |
|
125 | + public function raiseCallbackEvent($param) { |
|
126 | 126 | $this->onCallback($param); |
127 | 127 | } |
128 | 128 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * handler can be invoked. |
134 | 134 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
135 | 135 | */ |
136 | - public function onCallback($param){ |
|
136 | + public function onCallback($param) { |
|
137 | 137 | $this->raiseEvent('OnCallback', $this, $param); |
138 | 138 | } |
139 | 139 | |
@@ -143,22 +143,22 @@ discard block |
||
143 | 143 | |
144 | 144 | protected function registerCalendarClientScriptPre() |
145 | 145 | { |
146 | - $cs = $this->getPage()->getClientScript(); |
|
146 | + $cs=$this->getPage()->getClientScript(); |
|
147 | 147 | $cs->registerPradoScript("activedatepicker"); |
148 | 148 | } |
149 | 149 | |
150 | 150 | protected function renderClientControlScript($writer) |
151 | 151 | { |
152 | - $cs = $this->getPage()->getClientScript(); |
|
152 | + $cs=$this->getPage()->getClientScript(); |
|
153 | 153 | if(!$cs->isEndScriptRegistered('TDatePicker.spacer')) |
154 | 154 | { |
155 | - $spacer = $this->getAssetUrl('spacer.gif'); |
|
156 | - $code = "Prado.WebUI.TDatePicker.spacer = '$spacer';"; |
|
155 | + $spacer=$this->getAssetUrl('spacer.gif'); |
|
156 | + $code="Prado.WebUI.TDatePicker.spacer = '$spacer';"; |
|
157 | 157 | $cs->registerEndScript('TDatePicker.spacer', $code); |
158 | 158 | } |
159 | 159 | |
160 | - $options = TJavaScript::encode($this->getDatePickerOptions()); |
|
161 | - $code = "new Prado.WebUI.TActiveDatePicker($options);"; |
|
160 | + $options=TJavaScript::encode($this->getDatePickerOptions()); |
|
161 | + $code="new Prado.WebUI.TActiveDatePicker($options);"; |
|
162 | 162 | $cs->registerEndScript("prado:".$this->getClientID(), $code); |
163 | 163 | } |
164 | 164 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | class TActiveHiddenField extends THiddenField implements ICallbackEventHandler, IActiveControl |
24 | 24 | { |
25 | - /** |
|
25 | + /** |
|
26 | 26 | * Creates a new callback control, sets the adapter to |
27 | 27 | * TActiveControlAdapter. If you override this class, be sure to set the |
28 | 28 | * adapter appropriately by, for example, by calling this constructor. |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function setValue($value) |
57 | 57 | { |
58 | - if(parent::getValue() === $value) |
|
58 | + if(parent::getValue()===$value) |
|
59 | 59 | return; |
60 | 60 | |
61 | 61 | parent::setValue($value); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | protected function addAttributesToRender($writer) |
112 | 112 | { |
113 | 113 | parent::addAttributesToRender($writer); |
114 | - $writer->addAttribute('id',$this->getClientID()); |
|
114 | + $writer->addAttribute('id', $this->getClientID()); |
|
115 | 115 | $this->getActiveControl()->registerCallbackClientScript( |
116 | 116 | $this->getClientClassName(), $this->getPostBackOptions()); |
117 | 117 | } |