@@ -58,8 +58,7 @@ |
||
58 | 58 | if ($this->sourcepath === NULL) |
59 | 59 | { |
60 | 60 | $this->sourcepath = $sourcepath; |
61 | - } |
|
62 | - else |
|
61 | + } else |
|
63 | 62 | { |
64 | 63 | $this->sourcepath->append($sourcepath); |
65 | 64 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function getText() |
59 | 59 | { |
60 | - return $this->getViewState('Text',''); |
|
60 | + return $this->getViewState('Text', ''); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function setText($value) |
68 | 68 | { |
69 | - $this->setViewState('Text',$value,''); |
|
69 | + $this->setViewState('Text', $value, ''); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function getDataTextField() |
76 | 76 | { |
77 | - return $this->getViewState('DataTextField',''); |
|
77 | + return $this->getViewState('DataTextField', ''); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function setDataTextField($value) |
84 | 84 | { |
85 | - $this->setViewState('DataTextField',$value,''); |
|
85 | + $this->setViewState('DataTextField', $value, ''); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function getDataTextFormatString() |
92 | 92 | { |
93 | - return $this->getViewState('DataTextFormatString',''); |
|
93 | + return $this->getViewState('DataTextFormatString', ''); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function setDataTextFormatString($value) |
100 | 100 | { |
101 | - $this->setViewState('DataTextFormatString',$value,''); |
|
101 | + $this->setViewState('DataTextFormatString', $value, ''); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function getImageUrl() |
108 | 108 | { |
109 | - return $this->getViewState('ImageUrl',''); |
|
109 | + return $this->getViewState('ImageUrl', ''); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function setImageUrl($value) |
116 | 116 | { |
117 | - $this->setViewState('ImageUrl',$value,''); |
|
117 | + $this->setViewState('ImageUrl', $value, ''); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function getDataImageUrlField() |
124 | 124 | { |
125 | - return $this->getViewState('DataImageUrlField',''); |
|
125 | + return $this->getViewState('DataImageUrlField', ''); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function setDataImageUrlField($value) |
132 | 132 | { |
133 | - $this->setViewState('DataImageUrlField',$value,''); |
|
133 | + $this->setViewState('DataImageUrlField', $value, ''); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function getDataImageUrlFormatString() |
140 | 140 | { |
141 | - return $this->getViewState('DataImageUrlFormatString',''); |
|
141 | + return $this->getViewState('DataImageUrlFormatString', ''); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function setDataImageUrlFormatString($value) |
148 | 148 | { |
149 | - $this->setViewState('DataImageUrlFormatString',$value,''); |
|
149 | + $this->setViewState('DataImageUrlFormatString', $value, ''); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function getButtonType() |
156 | 156 | { |
157 | - return $this->getViewState('ButtonType',TButtonColumnType::LinkButton); |
|
157 | + return $this->getViewState('ButtonType', TButtonColumnType::LinkButton); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function setButtonType($value) |
164 | 164 | { |
165 | - $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'TButtonColumnType'),TButtonColumnType::LinkButton); |
|
165 | + $this->setViewState('ButtonType', TPropertyValue::ensureEnum($value, 'TButtonColumnType'), TButtonColumnType::LinkButton); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function getCommandName() |
172 | 172 | { |
173 | - return $this->getViewState('CommandName',''); |
|
173 | + return $this->getViewState('CommandName', ''); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function setCommandName($value) |
181 | 181 | { |
182 | - $this->setViewState('CommandName',$value,''); |
|
182 | + $this->setViewState('CommandName', $value, ''); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function getCausesValidation() |
189 | 189 | { |
190 | - return $this->getViewState('CausesValidation',true); |
|
190 | + return $this->getViewState('CausesValidation', true); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function setCausesValidation($value) |
197 | 197 | { |
198 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
198 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function getValidationGroup() |
205 | 205 | { |
206 | - return $this->getViewState('ValidationGroup',''); |
|
206 | + return $this->getViewState('ValidationGroup', ''); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function setValidationGroup($value) |
213 | 213 | { |
214 | - $this->setViewState('ValidationGroup',$value,''); |
|
214 | + $this->setViewState('ValidationGroup', $value, ''); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @param integer the index to the Columns property that the cell resides in. |
223 | 223 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
224 | 224 | */ |
225 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
225 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
226 | 226 | { |
227 | 227 | if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::SelectedItem || $itemType===TListItemType::EditItem) |
228 | 228 | { |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | $button->setCausesValidation($this->getCausesValidation()); |
243 | 243 | $button->setValidationGroup($this->getValidationGroup()); |
244 | 244 | if($this->getDataTextField()!=='' || ($buttonType===TButtonColumnType::ImageButton && $this->getDataImageUrlField()!=='')) |
245 | - $button->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
245 | + $button->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
246 | 246 | $cell->getControls()->add($button); |
247 | - $cell->registerObject('Button',$button); |
|
247 | + $cell->registerObject('Button', $button); |
|
248 | 248 | } |
249 | 249 | else |
250 | - parent::initializeCell($cell,$columnIndex,$itemType); |
|
250 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -255,20 +255,20 @@ discard block |
||
255 | 255 | * This method is invoked when datagrid performs databinding. |
256 | 256 | * It populates the content of the cell with the relevant data from data source. |
257 | 257 | */ |
258 | - public function dataBindColumn($sender,$param) |
|
258 | + public function dataBindColumn($sender, $param) |
|
259 | 259 | { |
260 | 260 | if($sender instanceof IButtonControl) |
261 | 261 | { |
262 | 262 | if(($field=$this->getDataTextField())!=='') |
263 | 263 | { |
264 | - $value=$this->getDataFieldValue($sender->getNamingContainer()->getData(),$field); |
|
265 | - $text=$this->formatDataValue($this->getDataTextFormatString(),$value); |
|
264 | + $value=$this->getDataFieldValue($sender->getNamingContainer()->getData(), $field); |
|
265 | + $text=$this->formatDataValue($this->getDataTextFormatString(), $value); |
|
266 | 266 | $sender->setText($text); |
267 | 267 | } |
268 | 268 | if(($sender instanceof TImageButton) && ($field=$this->getDataImageUrlField())!=='') |
269 | 269 | { |
270 | - $value=$this->getDataFieldValue($sender->getNamingContainer()->getData(),$field); |
|
271 | - $url=$this->formatDataValue($this->getDataImageUrlFormatString(),$value); |
|
270 | + $value=$this->getDataFieldValue($sender->getNamingContainer()->getData(), $field); |
|
271 | + $url=$this->formatDataValue($this->getDataImageUrlFormatString(), $value); |
|
272 | 272 | $sender->setImageUrl($url); |
273 | 273 | } |
274 | 274 | } |
@@ -58,8 +58,7 @@ |
||
58 | 58 | if ($this->sourcepath === NULL) |
59 | 59 | { |
60 | 60 | $this->sourcepath = $sourcepath; |
61 | - } |
|
62 | - else |
|
61 | + } else |
|
63 | 62 | { |
64 | 63 | $this->sourcepath->append($sourcepath); |
65 | 64 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function getText() |
38 | 38 | { |
39 | - return $this->getViewState('Text',''); |
|
39 | + return $this->getViewState('Text', ''); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function setText($value) |
47 | 47 | { |
48 | - $this->setViewState('Text',TPropertyValue::ensureString($value),''); |
|
48 | + $this->setViewState('Text', TPropertyValue::ensureString($value), ''); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getEncode() |
81 | 81 | { |
82 | - return $this->getViewState('Encode',false); |
|
82 | + return $this->getViewState('Encode', false); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function setEncode($value) |
89 | 89 | { |
90 | - $this->setViewState('Encode',TPropertyValue::ensureBoolean($value),false); |
|
90 | + $this->setViewState('Encode', TPropertyValue::ensureBoolean($value), false); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -223,14 +223,12 @@ discard block |
||
223 | 223 | // this is the most secure method, file info can't be forged from client side, no matter what |
224 | 224 | $token = md5('TActiveFileUpload::Params::'.$this->ClientID.'::'+rand(1000*1000,9999*1000)); |
225 | 225 | $cache->set($token, serialize($params), 5*60); // expire in 5 minutes - the callback should arrive back in seconds, actually |
226 | - } |
|
227 | - else |
|
226 | + } else |
|
228 | 227 | if ($mgr = Prado::getApplication()->getSecurityManager()) |
229 | 228 | { |
230 | 229 | // this is a less secure method, file info can be still forged from client side, but only if attacker knows the secret application key |
231 | 230 | $token = urlencode(base64_encode($mgr->encrypt(serialize($params)))); |
232 | - } |
|
233 | - else |
|
231 | + } else |
|
234 | 232 | throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
235 | 233 | |
236 | 234 | return $token; |
@@ -244,14 +242,12 @@ discard block |
||
244 | 242 | assert($v!=''); |
245 | 243 | $cache->delete($token); // remove it from cache so it can't be used again and won't take up space either |
246 | 244 | $params = unserialize($v); |
247 | - } |
|
248 | - else |
|
245 | + } else |
|
249 | 246 | if ($mgr = Prado::getApplication()->getSecurityManager()) |
250 | 247 | { |
251 | 248 | $v = $mgr->decrypt(base64_decode(urldecode($token))); |
252 | 249 | $params = unserialize($v); |
253 | - } |
|
254 | - else |
|
250 | + } else |
|
255 | 251 | throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
256 | 252 | |
257 | 253 | assert($params instanceof TActiveFileUploadCallbackParams); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | class TActiveFileUpload extends TFileUpload implements IActiveControl, ICallbackEventHandler, INamingContainer |
44 | 44 | { |
45 | 45 | |
46 | - const SCRIPT_PATH = 'prado/activefileupload'; |
|
46 | + const SCRIPT_PATH='prado/activefileupload'; |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * @var THiddenField a flag to tell which component is doing the callback. |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * TActiveControlAdapter. If you override this class, be sure to set the |
73 | 73 | * adapter appropriately by, for example, by calling this constructor. |
74 | 74 | */ |
75 | - public function __construct(){ |
|
75 | + public function __construct() { |
|
76 | 76 | parent::__construct(); |
77 | 77 | $this->setAdapter(new TActiveControlAdapter($this)); |
78 | 78 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | protected function getAssetUrl($file='') |
86 | 86 | { |
87 | - $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
87 | + $base=$this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
88 | 88 | return $base.'/'.self::SCRIPT_PATH.'/'.$file; |
89 | 89 | } |
90 | 90 | |
@@ -97,17 +97,17 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function onFileUpload($param) |
99 | 99 | { |
100 | - if ($this->_flag->getValue() && $this->getPage()->getIsPostBack() && $param == $this->_target->getUniqueID()){ |
|
100 | + if($this->_flag->getValue() && $this->getPage()->getIsPostBack() && $param==$this->_target->getUniqueID()) { |
|
101 | 101 | // save the file so that it will persist past the end of this return. |
102 | - $localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()),'')); |
|
102 | + $localName=str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()), '')); |
|
103 | 103 | parent::saveAs($localName); |
104 | 104 | |
105 | - $params = new TActiveFileUploadCallbackParams; |
|
106 | - $params->localName = $localName; |
|
107 | - $params->fileName = addslashes($this->getFileName()); |
|
108 | - $params->fileSize = $this->getFileSize(); |
|
109 | - $params->fileType = $this->getFileType(); |
|
110 | - $params->errorCode = $this->getErrorCode(); |
|
105 | + $params=new TActiveFileUploadCallbackParams; |
|
106 | + $params->localName=$localName; |
|
107 | + $params->fileName=addslashes($this->getFileName()); |
|
108 | + $params->fileSize=$this->getFileSize(); |
|
109 | + $params->fileType=$this->getFileType(); |
|
110 | + $params->errorCode=$this->getErrorCode(); |
|
111 | 111 | |
112 | 112 | // return some javascript to display a completion status. |
113 | 113 | echo <<<EOS |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @return string the path where the uploaded file will be stored temporarily, in namespace format |
133 | 133 | * default "Application.runtime.*" |
134 | 134 | */ |
135 | - public function getTempPath(){ |
|
135 | + public function getTempPath() { |
|
136 | 136 | return $this->getViewState('TempPath', 'Application.runtime.*'); |
137 | 137 | } |
138 | 138 | |
@@ -140,15 +140,15 @@ discard block |
||
140 | 140 | * @param string the path where the uploaded file will be stored temporarily in namespace format |
141 | 141 | * default "Application.runtime.*" |
142 | 142 | */ |
143 | - public function setTempPath($value){ |
|
144 | - $this->setViewState('TempPath',$value,'Application.runtime.*'); |
|
143 | + public function setTempPath($value) { |
|
144 | + $this->setViewState('TempPath', $value, 'Application.runtime.*'); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
148 | 148 | * @return boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true. |
149 | 149 | * Note: When set to false, you will need to trigger the callback yourself. |
150 | 150 | */ |
151 | - public function getAutoPostBack(){ |
|
151 | + public function getAutoPostBack() { |
|
152 | 152 | return $this->getViewState('AutoPostBack', true); |
153 | 153 | } |
154 | 154 | |
@@ -156,28 +156,28 @@ discard block |
||
156 | 156 | * @param boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true. |
157 | 157 | * Note: When set to false, you will need to trigger the callback yourself. |
158 | 158 | */ |
159 | - public function setAutoPostBack($value){ |
|
160 | - $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),true); |
|
159 | + public function setAutoPostBack($value) { |
|
160 | + $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), true); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
164 | 164 | * @return string A chuck of javascript that will need to be called if {{@link getAutoPostBack AutoPostBack} is set to false} |
165 | 165 | */ |
166 | - public function getCallbackJavascript(){ |
|
166 | + public function getCallbackJavascript() { |
|
167 | 167 | return "Prado.WebUI.TActiveFileUpload.fileChanged(\"{$this->getClientID()}\")"; |
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
171 | 171 | * @throws TInvalidDataValueException if the {@link getTempPath TempPath} is not writable. |
172 | 172 | */ |
173 | - public function onInit($sender){ |
|
173 | + public function onInit($sender) { |
|
174 | 174 | parent::onInit($sender); |
175 | 175 | |
176 | - if (!Prado::getApplication()->getCache()) |
|
177 | - if (!Prado::getApplication()->getSecurityManager()) |
|
176 | + if(!Prado::getApplication()->getCache()) |
|
177 | + if(!Prado::getApplication()->getSecurityManager()) |
|
178 | 178 | throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
179 | 179 | |
180 | - if (!is_writable(Prado::getPathOfNamespace($this->getTempPath()))){ |
|
180 | + if(!is_writable(Prado::getPathOfNamespace($this->getTempPath()))) { |
|
181 | 181 | throw new TInvalidDataValueException("activefileupload_temppath_invalid", $this->getTempPath()); |
182 | 182 | } |
183 | 183 | } |
@@ -189,17 +189,17 @@ discard block |
||
189 | 189 | * This method is mainly used by framework and control developers. |
190 | 190 | * @param TCallbackEventParameter the event parameter |
191 | 191 | */ |
192 | - public function raiseCallbackEvent($param){ |
|
193 | - $cp = $param->getCallbackParameter(); |
|
194 | - if ($key = $cp->targetID == $this->_target->getUniqueID()){ |
|
192 | + public function raiseCallbackEvent($param) { |
|
193 | + $cp=$param->getCallbackParameter(); |
|
194 | + if($key=$cp->targetID==$this->_target->getUniqueID()) { |
|
195 | 195 | |
196 | - $params = $this->popParamsByToken($cp->callbackToken); |
|
196 | + $params=$this->popParamsByToken($cp->callbackToken); |
|
197 | 197 | |
198 | - $_FILES[$key]['name'] = stripslashes($params->fileName); |
|
199 | - $_FILES[$key]['size'] = intval($params->fileSize); |
|
200 | - $_FILES[$key]['type'] = $params->fileType; |
|
201 | - $_FILES[$key]['error'] = intval($params->errorCode); |
|
202 | - $_FILES[$key]['tmp_name'] = $params->localName; |
|
198 | + $_FILES[$key]['name']=stripslashes($params->fileName); |
|
199 | + $_FILES[$key]['size']=intval($params->fileSize); |
|
200 | + $_FILES[$key]['type']=$params->fileType; |
|
201 | + $_FILES[$key]['error']=intval($params->errorCode); |
|
202 | + $_FILES[$key]['tmp_name']=$params->localName; |
|
203 | 203 | $this->loadPostData($key, null); |
204 | 204 | |
205 | 205 | $this->raiseEvent('OnFileUpload', $this, $param); |
@@ -218,17 +218,17 @@ discard block |
||
218 | 218 | |
219 | 219 | protected function pushParamsAndGetToken(TActiveFileUploadCallbackParams $params) |
220 | 220 | { |
221 | - if ($cache = Prado::getApplication()->getCache()) |
|
221 | + if($cache=Prado::getApplication()->getCache()) |
|
222 | 222 | { |
223 | 223 | // this is the most secure method, file info can't be forged from client side, no matter what |
224 | - $token = md5('TActiveFileUpload::Params::'.$this->ClientID.'::'+rand(1000*1000,9999*1000)); |
|
225 | - $cache->set($token, serialize($params), 5*60); // expire in 5 minutes - the callback should arrive back in seconds, actually |
|
224 | + $token=md5('TActiveFileUpload::Params::'.$this->ClientID.'::'+rand(1000 * 1000, 9999 * 1000)); |
|
225 | + $cache->set($token, serialize($params), 5 * 60); // expire in 5 minutes - the callback should arrive back in seconds, actually |
|
226 | 226 | } |
227 | 227 | else |
228 | - if ($mgr = Prado::getApplication()->getSecurityManager()) |
|
228 | + if($mgr=Prado::getApplication()->getSecurityManager()) |
|
229 | 229 | { |
230 | 230 | // this is a less secure method, file info can be still forged from client side, but only if attacker knows the secret application key |
231 | - $token = urlencode(base64_encode($mgr->encrypt(serialize($params)))); |
|
231 | + $token=urlencode(base64_encode($mgr->encrypt(serialize($params)))); |
|
232 | 232 | } |
233 | 233 | else |
234 | 234 | throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
@@ -238,18 +238,18 @@ discard block |
||
238 | 238 | |
239 | 239 | protected function popParamsByToken($token) |
240 | 240 | { |
241 | - if ($cache = Prado::getApplication()->getCache()) |
|
241 | + if($cache=Prado::getApplication()->getCache()) |
|
242 | 242 | { |
243 | - $v = $cache->get($token); |
|
243 | + $v=$cache->get($token); |
|
244 | 244 | assert($v!=''); |
245 | 245 | $cache->delete($token); // remove it from cache so it can't be used again and won't take up space either |
246 | - $params = unserialize($v); |
|
246 | + $params=unserialize($v); |
|
247 | 247 | } |
248 | 248 | else |
249 | - if ($mgr = Prado::getApplication()->getSecurityManager()) |
|
249 | + if($mgr=Prado::getApplication()->getSecurityManager()) |
|
250 | 250 | { |
251 | - $v = $mgr->decrypt(base64_decode(urldecode($token))); |
|
252 | - $params = unserialize($v); |
|
251 | + $v=$mgr->decrypt(base64_decode(urldecode($token))); |
|
252 | + $params=unserialize($v); |
|
253 | 253 | } |
254 | 254 | else |
255 | 255 | throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
@@ -266,19 +266,19 @@ discard block |
||
266 | 266 | { |
267 | 267 | parent::onPreRender($param); |
268 | 268 | |
269 | - if(!$this->getPage()->getIsPostBack() && isset($_GET['TActiveFileUpload_InputId']) && isset($_GET['TActiveFileUpload_TargetId']) && $_GET['TActiveFileUpload_InputId'] == $this->getClientID()) |
|
269 | + if(!$this->getPage()->getIsPostBack() && isset($_GET['TActiveFileUpload_InputId']) && isset($_GET['TActiveFileUpload_TargetId']) && $_GET['TActiveFileUpload_InputId']==$this->getClientID()) |
|
270 | 270 | { |
271 | 271 | // tricky workaround to intercept "uploaded file too big" error: real uploads happens in onFileUpload instead |
272 | - $this->_errorCode = UPLOAD_ERR_FORM_SIZE; |
|
273 | - $localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()),'')); |
|
274 | - $fileName = addslashes($this->getFileName()); |
|
272 | + $this->_errorCode=UPLOAD_ERR_FORM_SIZE; |
|
273 | + $localName=str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()), '')); |
|
274 | + $fileName=addslashes($this->getFileName()); |
|
275 | 275 | |
276 | - $params = new TActiveFileUploadCallbackParams; |
|
277 | - $params->localName = $localName; |
|
278 | - $params->fileName = $fileName; |
|
279 | - $params->fileSize = $this->getFileSize(); |
|
280 | - $params->fileType = $this->getFileType(); |
|
281 | - $params->errorCode = $this->getErrorCode(); |
|
276 | + $params=new TActiveFileUploadCallbackParams; |
|
277 | + $params->localName=$localName; |
|
278 | + $params->fileName=$fileName; |
|
279 | + $params->fileSize=$this->getFileSize(); |
|
280 | + $params->fileType=$this->getFileType(); |
|
281 | + $params->errorCode=$this->getErrorCode(); |
|
282 | 282 | |
283 | 283 | echo <<<EOS |
284 | 284 | <script language="Javascript"> |
@@ -296,30 +296,30 @@ discard block |
||
296 | 296 | } |
297 | 297 | } |
298 | 298 | |
299 | - public function createChildControls(){ |
|
300 | - $this->_flag = Prado::createComponent('THiddenField'); |
|
299 | + public function createChildControls() { |
|
300 | + $this->_flag=Prado::createComponent('THiddenField'); |
|
301 | 301 | $this->_flag->setID('Flag'); |
302 | 302 | $this->getControls()->add($this->_flag); |
303 | 303 | |
304 | - $this->_busy = Prado::createComponent('TImage'); |
|
304 | + $this->_busy=Prado::createComponent('TImage'); |
|
305 | 305 | $this->_busy->setID('Busy'); |
306 | 306 | $this->_busy->setImageUrl($this->getAssetUrl('ActiveFileUploadIndicator.gif')); |
307 | 307 | $this->_busy->setStyle("display:none"); |
308 | 308 | $this->getControls()->add($this->_busy); |
309 | 309 | |
310 | - $this->_success = Prado::createComponent('TImage'); |
|
310 | + $this->_success=Prado::createComponent('TImage'); |
|
311 | 311 | $this->_success->setID('Success'); |
312 | 312 | $this->_success->setImageUrl($this->getAssetUrl('ActiveFileUploadComplete.png')); |
313 | 313 | $this->_success->setStyle("display:none"); |
314 | 314 | $this->getControls()->add($this->_success); |
315 | 315 | |
316 | - $this->_error = Prado::createComponent('TImage'); |
|
316 | + $this->_error=Prado::createComponent('TImage'); |
|
317 | 317 | $this->_error->setID('Error'); |
318 | 318 | $this->_error->setImageUrl($this->getAssetUrl('ActiveFileUploadError.png')); |
319 | 319 | $this->_error->setStyle("display:none"); |
320 | 320 | $this->getControls()->add($this->_error); |
321 | 321 | |
322 | - $this->_target = Prado::createComponent('TInlineFrame'); |
|
322 | + $this->_target=Prado::createComponent('TInlineFrame'); |
|
323 | 323 | $this->_target->setID('Target'); |
324 | 324 | $this->_target->setFrameUrl($this->getAssetUrl('ActiveFileUploadBlank.html')); |
325 | 325 | $this->_target->setStyle("width:0px; height:0px;"); |
@@ -331,10 +331,10 @@ discard block |
||
331 | 331 | /** |
332 | 332 | * Removes localfile on ending of the callback. |
333 | 333 | */ |
334 | - public function onUnload($param){ |
|
335 | - if ($this->getPage()->getIsCallback() && |
|
334 | + public function onUnload($param) { |
|
335 | + if($this->getPage()->getIsCallback() && |
|
336 | 336 | $this->getHasFile() && |
337 | - file_exists($this->getLocalName())){ |
|
337 | + file_exists($this->getLocalName())) { |
|
338 | 338 | unlink($this->getLocalName()); |
339 | 339 | } |
340 | 340 | parent::onUnload($param); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | /** |
344 | 344 | * @return TBaseActiveCallbackControl standard callback control options. |
345 | 345 | */ |
346 | - public function getActiveControl(){ |
|
346 | + public function getActiveControl() { |
|
347 | 347 | return $this->getAdapter()->getBaseActiveControl(); |
348 | 348 | } |
349 | 349 | |
@@ -359,18 +359,18 @@ discard block |
||
359 | 359 | * Adds ID attribute, and renders the javascript for active component. |
360 | 360 | * @param THtmlWriter the writer used for the rendering purpose |
361 | 361 | */ |
362 | - public function addAttributesToRender($writer){ |
|
362 | + public function addAttributesToRender($writer) { |
|
363 | 363 | parent::addAttributesToRender($writer); |
364 | - $writer->addAttribute('id',$this->getClientID()); |
|
364 | + $writer->addAttribute('id', $this->getClientID()); |
|
365 | 365 | |
366 | 366 | $this->getPage()->getClientScript()->registerPradoScript('activefileupload'); |
367 | - $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(),$this->getClientOptions()); |
|
367 | + $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getClientOptions()); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
371 | 371 | * @return string corresponding javascript class name for this control. |
372 | 372 | */ |
373 | - protected function getClientClassName(){ |
|
373 | + protected function getClientClassName() { |
|
374 | 374 | return 'Prado.WebUI.TActiveFileUpload'; |
375 | 375 | } |
376 | 376 | |
@@ -384,18 +384,18 @@ discard block |
||
384 | 384 | * completeID => complete client ID, |
385 | 385 | * errorID => error client ID) |
386 | 386 | */ |
387 | - protected function getClientOptions(){ |
|
388 | - $options['ID'] = $this->getClientID(); |
|
389 | - $options['EventTarget'] = $this->getUniqueID(); |
|
390 | - |
|
391 | - $options['inputID'] = $this->getClientID(); |
|
392 | - $options['flagID'] = $this->_flag->getClientID(); |
|
393 | - $options['targetID'] = $this->_target->getUniqueID(); |
|
394 | - $options['formID'] = $this->getPage()->getForm()->getClientID(); |
|
395 | - $options['indicatorID'] = $this->_busy->getClientID(); |
|
396 | - $options['completeID'] = $this->_success->getClientID(); |
|
397 | - $options['errorID'] = $this->_error->getClientID(); |
|
398 | - $options['autoPostBack'] = $this->getAutoPostBack(); |
|
387 | + protected function getClientOptions() { |
|
388 | + $options['ID']=$this->getClientID(); |
|
389 | + $options['EventTarget']=$this->getUniqueID(); |
|
390 | + |
|
391 | + $options['inputID']=$this->getClientID(); |
|
392 | + $options['flagID']=$this->_flag->getClientID(); |
|
393 | + $options['targetID']=$this->_target->getUniqueID(); |
|
394 | + $options['formID']=$this->getPage()->getForm()->getClientID(); |
|
395 | + $options['indicatorID']=$this->_busy->getClientID(); |
|
396 | + $options['completeID']=$this->_success->getClientID(); |
|
397 | + $options['errorID']=$this->_error->getClientID(); |
|
398 | + $options['autoPostBack']=$this->getAutoPostBack(); |
|
399 | 399 | return $options; |
400 | 400 | } |
401 | 401 | |
@@ -406,12 +406,12 @@ discard block |
||
406 | 406 | * If true, you will not be able to save the uploaded file again. |
407 | 407 | * @return boolean true if the file saving is successful |
408 | 408 | */ |
409 | - public function saveAs($fileName,$deleteTempFile=true){ |
|
410 | - if (($this->getErrorCode()===UPLOAD_ERR_OK) && (file_exists($this->getLocalName()))){ |
|
411 | - if ($deleteTempFile) |
|
412 | - return rename($this->getLocalName(),$fileName); |
|
409 | + public function saveAs($fileName, $deleteTempFile=true) { |
|
410 | + if(($this->getErrorCode()===UPLOAD_ERR_OK) && (file_exists($this->getLocalName()))) { |
|
411 | + if($deleteTempFile) |
|
412 | + return rename($this->getLocalName(), $fileName); |
|
413 | 413 | else |
414 | - return copy($this->getLocalName(),$fileName); |
|
414 | + return copy($this->getLocalName(), $fileName); |
|
415 | 415 | } else |
416 | 416 | return false; |
417 | 417 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | * @return TImage the image displayed when an upload |
421 | 421 | * completes successfully. |
422 | 422 | */ |
423 | - public function getSuccessImage(){ |
|
423 | + public function getSuccessImage() { |
|
424 | 424 | $this->ensureChildControls(); |
425 | 425 | return $this->_success; |
426 | 426 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @return TImage the image displayed when an upload |
430 | 430 | * does not complete successfully. |
431 | 431 | */ |
432 | - public function getErrorImage(){ |
|
432 | + public function getErrorImage() { |
|
433 | 433 | $this->ensureChildControls(); |
434 | 434 | return $this->_error; |
435 | 435 | } |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | * @return TImage the image displayed when an upload |
439 | 439 | * is in progress. |
440 | 440 | */ |
441 | - public function getBusyImage(){ |
|
441 | + public function getBusyImage() { |
|
442 | 442 | $this->ensureChildControls(); |
443 | 443 | return $this->_busy; |
444 | 444 | } |
@@ -95,8 +95,7 @@ |
||
95 | 95 | if($this->getHasPreRendered()) { |
96 | 96 | $this->renderRepeater($writer); |
97 | 97 | if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(),$writer); |
98 | - } |
|
99 | - else { |
|
98 | + } else { |
|
100 | 99 | $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
101 | 100 | } |
102 | 101 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | parent::setDataSource($value); |
58 | 58 | if($this->getActiveControl()->canUpdateClientSide()) { |
59 | 59 | $this->renderPager(); |
60 | - $this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter()); |
|
60 | + $this->getPage()->getAdapter()->registerControlToRender($this, $this->getResponse()->createHtmlWriter()); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | public function render($writer) { |
95 | 95 | if($this->getHasPreRendered()) { |
96 | 96 | $this->renderRepeater($writer); |
97 | - if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(),$writer); |
|
97 | + if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(), $writer); |
|
98 | 98 | } |
99 | 99 | else { |
100 | - $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
|
100 | + $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | foreach($pager as $item) { |
112 | 112 | if($item->ControlToPaginate==$this->ID) { |
113 | 113 | $writer=$this->getResponse()->createHtmlWriter(); |
114 | - $this->getPage()->getAdapter()->registerControlToRender($item,$writer); |
|
114 | + $this->getPage()->getAdapter()->registerControlToRender($item, $writer); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param THtmlWriter writer for the rendering purpose |
124 | 124 | */ |
125 | 125 | private function renderRepeater($writer) { |
126 | - $writer->addAttribute('id',$this->getSurroundingTagID()); |
|
126 | + $writer->addAttribute('id', $this->getSurroundingTagID()); |
|
127 | 127 | $writer->renderBeginTag($this->getSurroundingTag()); |
128 | 128 | parent::render($writer); |
129 | 129 | $writer->renderEndTag(); |
@@ -81,8 +81,7 @@ |
||
81 | 81 | $this->_d[]=$item; |
82 | 82 | ++$this->_c; |
83 | 83 | } |
84 | - } |
|
85 | - else if($data!==null) |
|
84 | + } else if($data!==null) |
|
86 | 85 | throw new TInvalidDataTypeException('queue_data_not_iterable'); |
87 | 86 | } |
88 | 87 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @package System.Collections |
33 | 33 | * @since 3.1 |
34 | 34 | */ |
35 | -class TQueue extends TComponent implements IteratorAggregate,Countable |
|
35 | +class TQueue extends TComponent implements IteratorAggregate, Countable |
|
36 | 36 | { |
37 | 37 | /** |
38 | 38 | * internal data storage |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function contains($item) |
103 | 103 | { |
104 | - return array_search($item,$this->_d,true)!==false; |
|
104 | + return array_search($item, $this->_d, true)!==false; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public function enqueue($item) |
142 | 142 | { |
143 | 143 | ++$this->_c; |
144 | - $this->_d[] = $item; |
|
144 | + $this->_d[]=$item; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function getIterator() |
153 | 153 | { |
154 | - return new ArrayIterator( $this->_d ); |
|
154 | + return new ArrayIterator($this->_d); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | */ |
258 | 258 | public function valid() |
259 | 259 | { |
260 | - return $this->_i<$this->_c; |
|
260 | + return $this->_i < $this->_c; |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 |
@@ -66,6 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | /** |
68 | 68 | * @param TXmlElement parent element of this element |
69 | + * @param TXmlElement|null $parent |
|
69 | 70 | */ |
70 | 71 | public function setParent($parent) |
71 | 72 | { |
@@ -175,6 +176,7 @@ discard block |
||
175 | 176 | } |
176 | 177 | |
177 | 178 | /** |
179 | + * @param string $tagName |
|
178 | 180 | * @return TList list of all child elements that have the specified tag-name |
179 | 181 | */ |
180 | 182 | public function getElementsByTagName($tagName) |
@@ -334,6 +336,7 @@ discard block |
||
334 | 336 | |
335 | 337 | /** |
336 | 338 | * @param string version of this XML document |
339 | + * @param string $version |
|
337 | 340 | */ |
338 | 341 | public function setVersion($version) |
339 | 342 | { |
@@ -350,6 +353,7 @@ discard block |
||
350 | 353 | |
351 | 354 | /** |
352 | 355 | * @param string encoding of this XML document |
356 | + * @param string $encoding |
|
353 | 357 | */ |
354 | 358 | public function setEncoding($encoding) |
355 | 359 | { |
@@ -473,6 +477,7 @@ discard block |
||
473 | 477 | /** |
474 | 478 | * Recursively converts DOM XML nodes into TXmlElement |
475 | 479 | * @param DOMXmlNode the node to be converted |
480 | + * @param DOMElement $node |
|
476 | 481 | * @return TXmlElement the converted TXmlElement |
477 | 482 | */ |
478 | 483 | protected function buildElement($node) |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function getHasElement() |
111 | 111 | { |
112 | - return $this->_elements!==null && $this->_elements->getCount()>0; |
|
112 | + return $this->_elements!==null && $this->_elements->getCount() > 0; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function getHasAttribute() |
119 | 119 | { |
120 | - return $this->_attributes!==null && $this->_attributes->getCount()>0; |
|
120 | + return $this->_attributes!==null && $this->_attributes->getCount() > 0; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | * @param string attribute name |
136 | 136 | * @param string attribute value |
137 | 137 | */ |
138 | - public function setAttribute($name,$value) |
|
138 | + public function setAttribute($name, $value) |
|
139 | 139 | { |
140 | - $this->getAttributes()->add($name,TPropertyValue::ensureString($value)); |
|
140 | + $this->getAttributes()->add($name, TPropertyValue::ensureString($value)); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -203,12 +203,12 @@ discard block |
||
203 | 203 | $attr.=" $name=\"$value\""; |
204 | 204 | } |
205 | 205 | } |
206 | - $prefix=str_repeat(' ',$indent*4); |
|
206 | + $prefix=str_repeat(' ', $indent * 4); |
|
207 | 207 | if($this->getHasElement()) |
208 | 208 | { |
209 | 209 | $str=$prefix."<{$this->_tagName}$attr>\n"; |
210 | 210 | foreach($this->getElements() as $element) |
211 | - $str.=$element->toString($indent+1)."\n"; |
|
211 | + $str.=$element->toString($indent + 1)."\n"; |
|
212 | 212 | $str.=$prefix."</{$this->_tagName}>"; |
213 | 213 | return $str; |
214 | 214 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | private function xmlEncode($str) |
243 | 243 | { |
244 | - return strtr($str,array( |
|
244 | + return strtr($str, array( |
|
245 | 245 | '>'=>'>', |
246 | 246 | '<'=>'<', |
247 | 247 | '&'=>'&', |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * @param string version of this XML document |
318 | 318 | * @param string encoding of this XML document |
319 | 319 | */ |
320 | - public function __construct($version='1.0',$encoding='') |
|
320 | + public function __construct($version='1.0', $encoding='') |
|
321 | 321 | { |
322 | 322 | parent::__construct(''); |
323 | 323 | $this->setVersion($version); |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | if(($str=@file_get_contents($file))!==false) |
368 | 368 | return $this->loadFromString($str); |
369 | 369 | else |
370 | - throw new TIOException('xmldocument_file_read_failed',$file); |
|
370 | + throw new TIOException('xmldocument_file_read_failed', $file); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
@@ -395,17 +395,17 @@ discard block |
||
395 | 395 | $attributes->clear(); |
396 | 396 | |
397 | 397 | static $bSimpleXml; |
398 | - if($bSimpleXml === null) |
|
399 | - $bSimpleXml = (boolean)function_exists('simplexml_load_string'); |
|
398 | + if($bSimpleXml===null) |
|
399 | + $bSimpleXml=(boolean) function_exists('simplexml_load_string'); |
|
400 | 400 | |
401 | 401 | if($bSimpleXml) |
402 | 402 | { |
403 | - $simpleDoc = simplexml_load_string($string); |
|
404 | - $docNamespaces = $simpleDoc->getDocNamespaces(false); |
|
405 | - $simpleDoc = null; |
|
403 | + $simpleDoc=simplexml_load_string($string); |
|
404 | + $docNamespaces=$simpleDoc->getDocNamespaces(false); |
|
405 | + $simpleDoc=null; |
|
406 | 406 | foreach($docNamespaces as $prefix => $uri) |
407 | 407 | { |
408 | - if($prefix === '') |
|
408 | + if($prefix==='') |
|
409 | 409 | $attributes->add('xmlns', $uri); |
410 | 410 | else |
411 | 411 | $attributes->add('xmlns:'.$prefix, $uri); |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | } |
414 | 414 | |
415 | 415 | foreach($element->attributes as $name=>$attr) |
416 | - $attributes->add(($attr->prefix === '' ? '' : $attr->prefix . ':') .$name,$attr->value); |
|
416 | + $attributes->add(($attr->prefix==='' ? '' : $attr->prefix.':').$name, $attr->value); |
|
417 | 417 | foreach($element->childNodes as $child) |
418 | 418 | { |
419 | 419 | if($child instanceof DOMElement) |
@@ -430,13 +430,13 @@ discard block |
||
430 | 430 | */ |
431 | 431 | public function saveToFile($file) |
432 | 432 | { |
433 | - if(($fw=fopen($file,'w'))!==false) |
|
433 | + if(($fw=fopen($file, 'w'))!==false) |
|
434 | 434 | { |
435 | - fwrite($fw,$this->saveToString()); |
|
435 | + fwrite($fw, $this->saveToString()); |
|
436 | 436 | fclose($fw); |
437 | 437 | } |
438 | 438 | else |
439 | - throw new TIOException('xmldocument_file_write_failed',$file); |
|
439 | + throw new TIOException('xmldocument_file_write_failed', $file); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | /** |
@@ -445,8 +445,8 @@ discard block |
||
445 | 445 | */ |
446 | 446 | public function saveToString() |
447 | 447 | { |
448 | - $version=empty($this->_version)?' version="1.0"':' version="'.$this->_version.'"'; |
|
449 | - $encoding=empty($this->_encoding)?'':' encoding="'.$this->_encoding.'"'; |
|
448 | + $version=empty($this->_version) ? ' version="1.0"' : ' version="'.$this->_version.'"'; |
|
449 | + $encoding=empty($this->_encoding) ? '' : ' encoding="'.$this->_encoding.'"'; |
|
450 | 450 | return "<?xml{$version}{$encoding}?>\n".$this->toString(0); |
451 | 451 | } |
452 | 452 | |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | $element=new TXmlElement($node->tagName); |
481 | 481 | $element->setValue($node->nodeValue); |
482 | 482 | foreach($node->attributes as $name=>$attr) |
483 | - $element->getAttributes()->add(($attr->prefix === '' ? '' : $attr->prefix . ':') . $name,$attr->value); |
|
483 | + $element->getAttributes()->add(($attr->prefix==='' ? '' : $attr->prefix.':').$name, $attr->value); |
|
484 | 484 | |
485 | 485 | foreach($node->childNodes as $child) |
486 | 486 | { |
@@ -534,11 +534,11 @@ discard block |
||
534 | 534 | * @param mixed new item |
535 | 535 | * @throws TInvalidDataTypeException if the item to be inserted is not a TXmlElement object. |
536 | 536 | */ |
537 | - public function insertAt($index,$item) |
|
537 | + public function insertAt($index, $item) |
|
538 | 538 | { |
539 | 539 | if($item instanceof TXmlElement) |
540 | 540 | { |
541 | - parent::insertAt($index,$item); |
|
541 | + parent::insertAt($index, $item); |
|
542 | 542 | if($item->getParent()!==null) |
543 | 543 | $item->getParent()->getElements()->remove($item); |
544 | 544 | $item->setParent($this->_o); |
@@ -211,13 +211,11 @@ discard block |
||
211 | 211 | $str.=$element->toString($indent+1)."\n"; |
212 | 212 | $str.=$prefix."</{$this->_tagName}>"; |
213 | 213 | return $str; |
214 | - } |
|
215 | - else if(($value=$this->getValue())!=='') |
|
214 | + } else if(($value=$this->getValue())!=='') |
|
216 | 215 | { |
217 | 216 | $value=$this->xmlEncode($value); |
218 | 217 | return $prefix."<{$this->_tagName}$attr>$value</{$this->_tagName}>"; |
219 | - } |
|
220 | - else |
|
218 | + } else |
|
221 | 219 | return $prefix."<{$this->_tagName}$attr />"; |
222 | 220 | } |
223 | 221 | |
@@ -434,8 +432,7 @@ discard block |
||
434 | 432 | { |
435 | 433 | fwrite($fw,$this->saveToString()); |
436 | 434 | fclose($fw); |
437 | - } |
|
438 | - else |
|
435 | + } else |
|
439 | 436 | throw new TIOException('xmldocument_file_write_failed',$file); |
440 | 437 | } |
441 | 438 | |
@@ -542,8 +539,7 @@ discard block |
||
542 | 539 | if($item->getParent()!==null) |
543 | 540 | $item->getParent()->getElements()->remove($item); |
544 | 541 | $item->setParent($this->_o); |
545 | - } |
|
546 | - else |
|
542 | + } else |
|
547 | 543 | throw new TInvalidDataTypeException('xmlelementlist_xmlelement_required'); |
548 | 544 | } |
549 | 545 |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | //$Id: packages.php 3319 2013-09-08 20:59:44Z ctrlaltca $ |
4 | 4 | |
5 | 5 | // To make future upgrades easier |
6 | -if (!defined('PROTOTYPE_DIR')) define ('PROTOTYPE_DIR', 'prototype-1.7'); |
|
7 | -if (!defined('JQUERY_DIR')) define ('JQUERY_DIR', 'jquery'); |
|
8 | -if (!defined('BOOTSTRAP_DIR')) define ('BOOTSTRAP_DIR', 'bootstrap3'); |
|
9 | -if (!defined('SCRIPTACULOUS_DIR')) define ('SCRIPTACULOUS_DIR', 'scriptaculous-1.9.0'); |
|
6 | +if(!defined('PROTOTYPE_DIR')) define('PROTOTYPE_DIR', 'prototype-1.7'); |
|
7 | +if(!defined('JQUERY_DIR')) define('JQUERY_DIR', 'jquery'); |
|
8 | +if(!defined('BOOTSTRAP_DIR')) define('BOOTSTRAP_DIR', 'bootstrap3'); |
|
9 | +if(!defined('SCRIPTACULOUS_DIR')) define('SCRIPTACULOUS_DIR', 'scriptaculous-1.9.0'); |
|
10 | 10 | |
11 | 11 | //package names and its contents (files relative to the current directory) |
12 | -$packages = array( |
|
12 | +$packages=array( |
|
13 | 13 | // base prado scripts |
14 | 14 | 'prado' => array( |
15 | 15 | 'prado/prado.js', |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | |
117 | 117 | //package names and their dependencies |
118 | -$dependencies = array( |
|
118 | +$dependencies=array( |
|
119 | 119 | 'jquery' => array('jquery'), |
120 | 120 | 'prado' => array('jquery', 'prado'), |
121 | 121 | 'bootstrap' => array('jquery', 'bootstrap'), |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | 'jqueryui' => array('jquery', 'jqueryui'), |
139 | 139 | 'prototype' => array('prototype'), |
140 | 140 | 'dragdrop' => array('prototype', 'jquery', 'prado', 'ajax', 'dragdrop'), |
141 | - 'dragdropextra' => array('prototype', 'jquery', 'prado', 'ajax', 'dragdrop','dragdropextra'), |
|
141 | + 'dragdropextra' => array('prototype', 'jquery', 'prado', 'ajax', 'dragdrop', 'dragdropextra'), |
|
142 | 142 | 'autocomplete' => array('prototype', 'jquery', 'prado', 'ajax', 'autocomplete'), |
143 | 143 | ); |
144 | 144 |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | * @return string URL |
65 | 65 | * @see parseUrl |
66 | 66 | */ |
67 | - public function constructUrl($serviceID,$serviceParam,$getItems,$encodeAmpersand,$encodeGetItems) |
|
67 | + public function constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems) |
|
68 | 68 | { |
69 | 69 | $url=$serviceID.'='.urlencode($serviceParam); |
70 | - $amp=$encodeAmpersand?'&':'&'; |
|
70 | + $amp=$encodeAmpersand ? '&' : '&'; |
|
71 | 71 | $request=$this->getRequest(); |
72 | 72 | if(is_array($getItems) || $getItems instanceof Traversable) |
73 | 73 | { |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | switch($request->getUrlFormat()) |
104 | 104 | { |
105 | 105 | case THttpRequestUrlFormat::Path: |
106 | - return $request->getApplicationUrl().'/'.strtr($url,array($amp=>'/','?'=>'/','='=>$request->getUrlParamSeparator())); |
|
106 | + return $request->getApplicationUrl().'/'.strtr($url, array($amp=>'/', '?'=>'/', '='=>$request->getUrlParamSeparator())); |
|
107 | 107 | case THttpRequestUrlFormat::HiddenPath: |
108 | - return rtrim(dirname($request->getApplicationUrl()), '/').'/'.strtr($url,array($amp=>'/','?'=>'/','='=>$request->getUrlParamSeparator())); |
|
108 | + return rtrim(dirname($request->getApplicationUrl()), '/').'/'.strtr($url, array($amp=>'/', '?'=>'/', '='=>$request->getUrlParamSeparator())); |
|
109 | 109 | default: |
110 | 110 | return $request->getApplicationUrl().'?'.$url; |
111 | 111 | } |
@@ -127,24 +127,24 @@ discard block |
||
127 | 127 | public function parseUrl() |
128 | 128 | { |
129 | 129 | $request=$this->getRequest(); |
130 | - $pathInfo=trim($request->getPathInfo(),'/'); |
|
130 | + $pathInfo=trim($request->getPathInfo(), '/'); |
|
131 | 131 | if(($request->getUrlFormat()===THttpRequestUrlFormat::Path || |
132 | 132 | $request->getUrlFormat()===THttpRequestUrlFormat::HiddenPath) && |
133 | 133 | $pathInfo!=='') |
134 | 134 | { |
135 | 135 | $separator=$request->getUrlParamSeparator(); |
136 | - $paths=explode('/',$pathInfo); |
|
136 | + $paths=explode('/', $pathInfo); |
|
137 | 137 | $getVariables=array(); |
138 | 138 | foreach($paths as $path) |
139 | 139 | { |
140 | 140 | if(($path=trim($path))!=='') |
141 | 141 | { |
142 | - if(($pos=strpos($path,$separator))!==false) |
|
142 | + if(($pos=strpos($path, $separator))!==false) |
|
143 | 143 | { |
144 | - $name=substr($path,0,$pos); |
|
145 | - $value=substr($path,$pos+1); |
|
146 | - if(($pos=strpos($name,'[]'))!==false) |
|
147 | - $getVariables[substr($name,0,$pos)][]=$value; |
|
144 | + $name=substr($path, 0, $pos); |
|
145 | + $value=substr($path, $pos + 1); |
|
146 | + if(($pos=strpos($name, '[]'))!==false) |
|
147 | + $getVariables[substr($name, 0, $pos)][]=$value; |
|
148 | 148 | else |
149 | 149 | $getVariables[$name]=$value; |
150 | 150 | } |
@@ -80,12 +80,10 @@ discard block |
||
80 | 80 | $name=urlencode($name.'[]'); |
81 | 81 | foreach($value as $v) |
82 | 82 | $url.=$amp.$name.'='.urlencode($v); |
83 | - } |
|
84 | - else |
|
83 | + } else |
|
85 | 84 | $url.=$amp.urlencode($name).'='.urlencode($value); |
86 | 85 | } |
87 | - } |
|
88 | - else |
|
86 | + } else |
|
89 | 87 | { |
90 | 88 | foreach($getItems as $name=>$value) |
91 | 89 | { |
@@ -93,8 +91,7 @@ discard block |
||
93 | 91 | { |
94 | 92 | foreach($value as $v) |
95 | 93 | $url.=$amp.$name.'[]='.$v; |
96 | - } |
|
97 | - else |
|
94 | + } else |
|
98 | 95 | $url.=$amp.$name.'='.$value; |
99 | 96 | } |
100 | 97 | } |
@@ -147,14 +144,12 @@ discard block |
||
147 | 144 | $getVariables[substr($name,0,$pos)][]=$value; |
148 | 145 | else |
149 | 146 | $getVariables[$name]=$value; |
150 | - } |
|
151 | - else |
|
147 | + } else |
|
152 | 148 | $getVariables[$path]=''; |
153 | 149 | } |
154 | 150 | } |
155 | 151 | return $getVariables; |
156 | - } |
|
157 | - else |
|
152 | + } else |
|
158 | 153 | return array(); |
159 | 154 | } |
160 | 155 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $this->loadConfig($dom); |
121 | 121 | } |
122 | 122 | else |
123 | - throw new TConfigurationException('soapservice_configfile_invalid',$this->_configFile); |
|
123 | + throw new TConfigurationException('soapservice_configfile_invalid', $this->_configFile); |
|
124 | 124 | } |
125 | 125 | $this->loadConfig($config); |
126 | 126 | |
@@ -137,16 +137,16 @@ discard block |
||
137 | 137 | protected function resolveRequest() |
138 | 138 | { |
139 | 139 | $serverID=$this->getRequest()->getServiceParameter(); |
140 | - if(($pos=strrpos($serverID,'.wsdl'))===strlen($serverID)-5) |
|
140 | + if(($pos=strrpos($serverID, '.wsdl'))===strlen($serverID) - 5) |
|
141 | 141 | { |
142 | - $serverID=substr($serverID,0,$pos); |
|
142 | + $serverID=substr($serverID, 0, $pos); |
|
143 | 143 | $this->_wsdlRequest=true; |
144 | 144 | } |
145 | 145 | else |
146 | 146 | $this->_wsdlRequest=false; |
147 | 147 | $this->_serverID=$serverID; |
148 | 148 | if(!isset($this->_servers[$serverID])) |
149 | - throw new THttpException(400,'soapservice_request_invalid',$serverID); |
|
149 | + throw new THttpException(400, 'soapservice_request_invalid', $serverID); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | { |
163 | 163 | foreach($config['soap'] as $id => $server) |
164 | 164 | { |
165 | - $properties = isset($server['properties'])?$server['properties']:array(); |
|
165 | + $properties=isset($server['properties']) ? $server['properties'] : array(); |
|
166 | 166 | if(isset($this->_servers[$id])) |
167 | - throw new TConfigurationException('soapservice_serverid_duplicated',$id); |
|
167 | + throw new TConfigurationException('soapservice_serverid_duplicated', $id); |
|
168 | 168 | $this->_servers[$id]=$properties; |
169 | 169 | } |
170 | 170 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | if(($id=$properties->remove('id'))===null) |
178 | 178 | throw new TConfigurationException('soapservice_serverid_required'); |
179 | 179 | if(isset($this->_servers[$id])) |
180 | - throw new TConfigurationException('soapservice_serverid_duplicated',$id); |
|
180 | + throw new TConfigurationException('soapservice_serverid_duplicated', $id); |
|
181 | 181 | $this->_servers[$id]=$properties; |
182 | 182 | } |
183 | 183 | } |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function setConfigFile($value) |
200 | 200 | { |
201 | - if(($this->_configFile=Prado::getPathOfNamespace($value,Prado::getApplication()->getConfigurationFileExt()))===null) |
|
202 | - throw new TConfigurationException('soapservice_configfile_invalid',$value); |
|
201 | + if(($this->_configFile=Prado::getPathOfNamespace($value, Prado::getApplication()->getConfigurationFileExt()))===null) |
|
202 | + throw new TConfigurationException('soapservice_configfile_invalid', $value); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | * @param boolean whether to encode the GET parameters (their names and values), defaults to true. |
211 | 211 | * @return string URL for the page and GET parameters |
212 | 212 | */ |
213 | - public function constructUrl($serverID,$getParams=null,$encodeAmpersand=true,$encodeGetItems=true) |
|
213 | + public function constructUrl($serverID, $getParams=null, $encodeAmpersand=true, $encodeGetItems=true) |
|
214 | 214 | { |
215 | - return $this->getRequest()->constructUrl($this->getID(),$serverID,$getParams,$encodeAmpersand,$encodeGetItems); |
|
215 | + return $this->getRequest()->constructUrl($this->getID(), $serverID, $getParams, $encodeAmpersand, $encodeGetItems); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -248,13 +248,13 @@ discard block |
||
248 | 248 | if($serverClass===null) |
249 | 249 | $serverClass=self::DEFAULT_SOAP_SERVER; |
250 | 250 | Prado::using($serverClass); |
251 | - $className=($pos=strrpos($serverClass,'.'))!==false?substr($serverClass,$pos+1):$serverClass; |
|
252 | - if($className!==self::DEFAULT_SOAP_SERVER && !is_subclass_of($className,self::DEFAULT_SOAP_SERVER)) |
|
253 | - throw new TConfigurationException('soapservice_server_invalid',$serverClass); |
|
251 | + $className=($pos=strrpos($serverClass, '.'))!==false ? substr($serverClass, $pos + 1) : $serverClass; |
|
252 | + if($className!==self::DEFAULT_SOAP_SERVER && !is_subclass_of($className, self::DEFAULT_SOAP_SERVER)) |
|
253 | + throw new TConfigurationException('soapservice_server_invalid', $serverClass); |
|
254 | 254 | $server=new $className; |
255 | 255 | $server->setID($this->_serverID); |
256 | 256 | foreach($properties as $name=>$value) |
257 | - $server->setSubproperty($name,$value); |
|
257 | + $server->setSubproperty($name, $value); |
|
258 | 258 | return $server; |
259 | 259 | } |
260 | 260 | |
@@ -266,21 +266,21 @@ discard block |
||
266 | 266 | */ |
267 | 267 | public function run() |
268 | 268 | { |
269 | - Prado::trace("Running SOAP service",'System.Web.Services.TSoapService'); |
|
269 | + Prado::trace("Running SOAP service", 'System.Web.Services.TSoapService'); |
|
270 | 270 | $server=$this->createServer(); |
271 | 271 | $this->getResponse()->setContentType('text/xml'); |
272 | 272 | $this->getResponse()->setCharset($server->getEncoding()); |
273 | 273 | if($this->getIsWsdlRequest()) |
274 | 274 | { |
275 | 275 | // server WSDL file |
276 | - Prado::trace("Generating WSDL",'System.Web.Services.TSoapService'); |
|
276 | + Prado::trace("Generating WSDL", 'System.Web.Services.TSoapService'); |
|
277 | 277 | $this->getResponse()->clear(); |
278 | 278 | $this->getResponse()->write($server->getWsdl()); |
279 | 279 | } |
280 | 280 | else |
281 | 281 | { |
282 | 282 | // provide SOAP service |
283 | - Prado::trace("Handling SOAP request",'System.Web.Services.TSoapService'); |
|
283 | + Prado::trace("Handling SOAP request", 'System.Web.Services.TSoapService'); |
|
284 | 284 | $server->run(); |
285 | 285 | } |
286 | 286 | } |
@@ -331,8 +331,8 @@ discard block |
||
331 | 331 | */ |
332 | 332 | public function setID($id) |
333 | 333 | { |
334 | - if(strrpos($this->_id,'.wsdl')===strlen($this->_id)-5) |
|
335 | - throw new TInvalidDataValueException('soapserver_id_invalid',$id); |
|
334 | + if(strrpos($this->_id, '.wsdl')===strlen($this->_id) - 5) |
|
335 | + throw new TInvalidDataValueException('soapserver_id_invalid', $id); |
|
336 | 336 | $this->_id=$id; |
337 | 337 | } |
338 | 338 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | if(($provider=$this->getProvider())!==null) |
345 | 345 | { |
346 | 346 | Prado::using($provider); |
347 | - $providerClass=($pos=strrpos($provider,'.'))!==false?substr($provider,$pos+1):$provider; |
|
347 | + $providerClass=($pos=strrpos($provider, '.'))!==false ? substr($provider, $pos + 1) : $provider; |
|
348 | 348 | $this->guessMethodCallRequested($providerClass); |
349 | 349 | $server=$this->createServer(); |
350 | 350 | $server->setClass($providerClass, $this); |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | { |
358 | 358 | $server->handle(); |
359 | 359 | } |
360 | - catch (Exception $e) |
|
360 | + catch(Exception $e) |
|
361 | 361 | { |
362 | 362 | if($this->getApplication()->getMode()===TApplicationMode::Debug) |
363 | 363 | $this->fault($e->getMessage(), $e->__toString()); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | */ |
377 | 377 | public function fault($title, $details='', $code='SERVER', $actor='', $name='') |
378 | 378 | { |
379 | - Prado::trace('SOAP-Fault '.$code. ' '.$title.' : '.$details, 'System.Web.Services.TSoapService'); |
|
379 | + Prado::trace('SOAP-Fault '.$code.' '.$title.' : '.$details, 'System.Web.Services.TSoapService'); |
|
380 | 380 | $this->_server->fault($code, $title, $actor, $details, $name); |
381 | 381 | } |
382 | 382 | |
@@ -387,14 +387,14 @@ discard block |
||
387 | 387 | */ |
388 | 388 | protected function guessMethodCallRequested($class) |
389 | 389 | { |
390 | - $namespace = $class.'wsdl'; |
|
391 | - $message = file_get_contents("php://input"); |
|
392 | - $matches= array(); |
|
390 | + $namespace=$class.'wsdl'; |
|
391 | + $message=file_get_contents("php://input"); |
|
392 | + $matches=array(); |
|
393 | 393 | if(preg_match('/xmlns:([^=]+)="urn:'.$namespace.'"/', $message, $matches)) |
394 | 394 | { |
395 | 395 | if(preg_match('/<'.$matches[1].':([a-zA-Z_]+[a-zA-Z0-9_]+)/', $message, $method)) |
396 | 396 | { |
397 | - $this->_requestedMethod = $method[1]; |
|
397 | + $this->_requestedMethod=$method[1]; |
|
398 | 398 | } |
399 | 399 | } |
400 | 400 | } |
@@ -417,8 +417,8 @@ discard block |
||
417 | 417 | if($this->_server===null) |
418 | 418 | { |
419 | 419 | if($this->getApplication()->getMode()===TApplicationMode::Debug) |
420 | - ini_set("soap.wsdl_cache_enabled",0); |
|
421 | - $this->_server = new SoapServer($this->getWsdlUri(),$this->getOptions()); |
|
420 | + ini_set("soap.wsdl_cache_enabled", 0); |
|
421 | + $this->_server=new SoapServer($this->getWsdlUri(), $this->getOptions()); |
|
422 | 422 | } |
423 | 423 | return $this->_server; |
424 | 424 | } |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | if($this->_wsdlUri==='') |
460 | 460 | { |
461 | 461 | $provider=$this->getProvider(); |
462 | - $providerClass=($pos=strrpos($provider,'.'))!==false?substr($provider,$pos+1):$provider; |
|
462 | + $providerClass=($pos=strrpos($provider, '.'))!==false ? substr($provider, $pos + 1) : $provider; |
|
463 | 463 | Prado::using($provider); |
464 | 464 | if($this->getApplication()->getMode()===TApplicationMode::Performance && ($cache=$this->getApplication()->getCache())!==null) |
465 | 465 | { |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | return $wsdl; |
469 | 469 | Prado::using('System.3rdParty.WsdlGen.WsdlGenerator'); |
470 | 470 | $wsdl=WsdlGenerator::generate($providerClass, $this->getUri(), $this->getEncoding()); |
471 | - $cache->set(self::WSDL_CACHE_PREFIX.$providerClass,$wsdl); |
|
471 | + $cache->set(self::WSDL_CACHE_PREFIX.$providerClass, $wsdl); |
|
472 | 472 | return $wsdl; |
473 | 473 | } |
474 | 474 | else |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | public function getWsdlUri() |
488 | 488 | { |
489 | 489 | if($this->_wsdlUri==='') |
490 | - return $this->getRequest()->getBaseUrl().$this->getService()->constructUrl($this->getID().'.wsdl',false); |
|
490 | + return $this->getRequest()->getBaseUrl().$this->getService()->constructUrl($this->getID().'.wsdl', false); |
|
491 | 491 | else |
492 | 492 | return $this->_wsdlUri; |
493 | 493 | } |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | public function getUri() |
507 | 507 | { |
508 | 508 | if($this->_uri==='') |
509 | - return $this->getRequest()->getBaseUrl().$this->getService()->constructUrl($this->getID(),false); |
|
509 | + return $this->getRequest()->getBaseUrl().$this->getService()->constructUrl($this->getID(), false); |
|
510 | 510 | else |
511 | 511 | return $this->_uri; |
512 | 512 | } |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | if($value==='1.1' || $value==='1.2' || $value==='') |
553 | 553 | $this->_version=$value; |
554 | 554 | else |
555 | - throw new TInvalidDataValueException('soapserver_version_invalid',$value); |
|
555 | + throw new TInvalidDataValueException('soapserver_version_invalid', $value); |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | /** |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | */ |
617 | 617 | public function setClassMaps($classes) |
618 | 618 | { |
619 | - $this->_classMap = $classes; |
|
619 | + $this->_classMap=$classes; |
|
620 | 620 | } |
621 | 621 | } |
622 | 622 |
@@ -118,8 +118,7 @@ discard block |
||
118 | 118 | $dom=new TXmlDocument; |
119 | 119 | $dom->loadFromFile($this->_configFile); |
120 | 120 | $this->loadConfig($dom); |
121 | - } |
|
122 | - else |
|
121 | + } else |
|
123 | 122 | throw new TConfigurationException('soapservice_configfile_invalid',$this->_configFile); |
124 | 123 | } |
125 | 124 | $this->loadConfig($config); |
@@ -141,8 +140,7 @@ discard block |
||
141 | 140 | { |
142 | 141 | $serverID=substr($serverID,0,$pos); |
143 | 142 | $this->_wsdlRequest=true; |
144 | - } |
|
145 | - else |
|
143 | + } else |
|
146 | 144 | $this->_wsdlRequest=false; |
147 | 145 | $this->_serverID=$serverID; |
148 | 146 | if(!isset($this->_servers[$serverID])) |
@@ -168,8 +166,7 @@ discard block |
||
168 | 166 | $this->_servers[$id]=$properties; |
169 | 167 | } |
170 | 168 | } |
171 | - } |
|
172 | - else |
|
169 | + } else |
|
173 | 170 | { |
174 | 171 | foreach($config->getElementsByTagName('soap') as $serverXML) |
175 | 172 | { |
@@ -276,8 +273,7 @@ discard block |
||
276 | 273 | Prado::trace("Generating WSDL",'System.Web.Services.TSoapService'); |
277 | 274 | $this->getResponse()->clear(); |
278 | 275 | $this->getResponse()->write($server->getWsdl()); |
279 | - } |
|
280 | - else |
|
276 | + } else |
|
281 | 277 | { |
282 | 278 | // provide SOAP service |
283 | 279 | Prado::trace("Handling SOAP request",'System.Web.Services.TSoapService'); |
@@ -350,14 +346,12 @@ discard block |
||
350 | 346 | $server->setClass($providerClass, $this); |
351 | 347 | if($this->_persistent) |
352 | 348 | $server->setPersistence(SOAP_PERSISTENCE_SESSION); |
353 | - } |
|
354 | - else |
|
349 | + } else |
|
355 | 350 | $server=$this->createServer(); |
356 | 351 | try |
357 | 352 | { |
358 | 353 | $server->handle(); |
359 | - } |
|
360 | - catch (Exception $e) |
|
354 | + } catch (Exception $e) |
|
361 | 355 | { |
362 | 356 | if($this->getApplication()->getMode()===TApplicationMode::Debug) |
363 | 357 | $this->fault($e->getMessage(), $e->__toString()); |
@@ -470,14 +464,12 @@ discard block |
||
470 | 464 | $wsdl=WsdlGenerator::generate($providerClass, $this->getUri(), $this->getEncoding()); |
471 | 465 | $cache->set(self::WSDL_CACHE_PREFIX.$providerClass,$wsdl); |
472 | 466 | return $wsdl; |
473 | - } |
|
474 | - else |
|
467 | + } else |
|
475 | 468 | { |
476 | 469 | Prado::using('System.3rdParty.WsdlGen.WsdlGenerator'); |
477 | 470 | return WsdlGenerator::generate($providerClass, $this->getUri(), $this->getEncoding()); |
478 | 471 | } |
479 | - } |
|
480 | - else |
|
472 | + } else |
|
481 | 473 | return file_get_contents($this->_wsdlUri); |
482 | 474 | } |
483 | 475 |