@@ -18,7 +18,6 @@ discard block |
||
| 18 | 18 | * is especially needed when {@link TFileUpload::setMultiple} is set to true. |
| 19 | 19 | * |
| 20 | 20 | * See {@link TFileUpload} documentation for more details. |
| 21 | - |
|
| 22 | 21 | * @author LANDWEHR Computer und Software GmbH <[email protected]> |
| 23 | 22 | * @package Prado\Web\UI\WebControls |
| 24 | 23 | * @since 4.0 |
@@ -48,11 +47,11 @@ discard block |
||
| 48 | 47 | |
| 49 | 48 | public function __construct($fileName, $fileSize, $fileType, $errorCode, $localName) |
| 50 | 49 | { |
| 51 | - $this->_fileName = $fileName; |
|
| 52 | - $this->_fileSize = $fileSize; |
|
| 53 | - $this->_fileType = $fileType; |
|
| 54 | - $this->_errorCode = $errorCode; |
|
| 55 | - $this->_localName = $localName; |
|
| 50 | + $this->_fileName = $fileName; |
|
| 51 | + $this->_fileSize = $fileSize; |
|
| 52 | + $this->_fileType = $fileType; |
|
| 53 | + $this->_errorCode = $errorCode; |
|
| 54 | + $this->_localName = $localName; |
|
| 56 | 55 | } |
| 57 | 56 | |
| 58 | 57 | /** |
@@ -60,7 +59,7 @@ discard block |
||
| 60 | 59 | */ |
| 61 | 60 | public function getFileName() |
| 62 | 61 | { |
| 63 | - return $this->_fileName; |
|
| 62 | + return $this->_fileName; |
|
| 64 | 63 | } |
| 65 | 64 | |
| 66 | 65 | /** |
@@ -68,7 +67,7 @@ discard block |
||
| 68 | 67 | */ |
| 69 | 68 | public function getFileSize() |
| 70 | 69 | { |
| 71 | - return $this->_fileSize; |
|
| 70 | + return $this->_fileSize; |
|
| 72 | 71 | } |
| 73 | 72 | |
| 74 | 73 | /** |
@@ -77,7 +76,7 @@ discard block |
||
| 77 | 76 | */ |
| 78 | 77 | public function getFileType() |
| 79 | 78 | { |
| 80 | - return $this->_fileType; |
|
| 79 | + return $this->_fileType; |
|
| 81 | 80 | } |
| 82 | 81 | |
| 83 | 82 | /** |
@@ -86,7 +85,7 @@ discard block |
||
| 86 | 85 | */ |
| 87 | 86 | public function getLocalName() |
| 88 | 87 | { |
| 89 | - return $this->_localName; |
|
| 88 | + return $this->_localName; |
|
| 90 | 89 | } |
| 91 | 90 | |
| 92 | 91 | /** |
@@ -94,7 +93,7 @@ discard block |
||
| 94 | 93 | */ |
| 95 | 94 | public function setLocalName($value) |
| 96 | 95 | { |
| 97 | - $this->_localName = $value; |
|
| 96 | + $this->_localName = $value; |
|
| 98 | 97 | } |
| 99 | 98 | |
| 100 | 99 | /** |
@@ -104,7 +103,7 @@ discard block |
||
| 104 | 103 | */ |
| 105 | 104 | public function getErrorCode() |
| 106 | 105 | { |
| 107 | - return $this->_errorCode; |
|
| 106 | + return $this->_errorCode; |
|
| 108 | 107 | } |
| 109 | 108 | |
| 110 | 109 | /** |
@@ -114,7 +113,7 @@ discard block |
||
| 114 | 113 | */ |
| 115 | 114 | public function setErrorCode($value) |
| 116 | 115 | { |
| 117 | - $this->_errorCode = $value; |
|
| 116 | + $this->_errorCode = $value; |
|
| 118 | 117 | } |
| 119 | 118 | |
| 120 | 119 | /** |
@@ -122,7 +121,7 @@ discard block |
||
| 122 | 121 | */ |
| 123 | 122 | public function getHasFile() |
| 124 | 123 | { |
| 125 | - return $this->_errorCode===UPLOAD_ERR_OK; |
|
| 124 | + return $this->_errorCode===UPLOAD_ERR_OK; |
|
| 126 | 125 | } |
| 127 | 126 | |
| 128 | 127 | /** |
@@ -134,17 +133,17 @@ discard block |
||
| 134 | 133 | */ |
| 135 | 134 | public function saveAs($fileName,$deleteTempFile=true) |
| 136 | 135 | { |
| 137 | - if($this->_errorCode===UPLOAD_ERR_OK) |
|
| 138 | - { |
|
| 139 | - if($deleteTempFile) |
|
| 140 | - return move_uploaded_file($this->_localName,$fileName); |
|
| 141 | - else if(is_uploaded_file($this->_localName)) |
|
| 142 | - return file_put_contents($fileName,file_get_contents($this->_localName))!==false; |
|
| 143 | - else |
|
| 144 | - return false; |
|
| 145 | - } |
|
| 146 | - else |
|
| 147 | - return false; |
|
| 136 | + if($this->_errorCode===UPLOAD_ERR_OK) |
|
| 137 | + { |
|
| 138 | + if($deleteTempFile) |
|
| 139 | + return move_uploaded_file($this->_localName,$fileName); |
|
| 140 | + else if(is_uploaded_file($this->_localName)) |
|
| 141 | + return file_put_contents($fileName,file_get_contents($this->_localName))!==false; |
|
| 142 | + else |
|
| 143 | + return false; |
|
| 144 | + } |
|
| 145 | + else |
|
| 146 | + return false; |
|
| 148 | 147 | } |
| 149 | 148 | |
| 150 | 149 | /** |
@@ -152,13 +151,13 @@ discard block |
||
| 152 | 151 | */ |
| 153 | 152 | public function toArray() |
| 154 | 153 | { |
| 155 | - return array( |
|
| 156 | - 'fileName' => $this->_fileName, |
|
| 157 | - 'fileSize' => $this->_fileSize, |
|
| 158 | - 'fileType' => $this->_fileType, |
|
| 159 | - 'errorCode' => $this->_errorCode, |
|
| 160 | - 'localName' => $this->_localName |
|
| 161 | - ); |
|
| 154 | + return array( |
|
| 155 | + 'fileName' => $this->_fileName, |
|
| 156 | + 'fileSize' => $this->_fileSize, |
|
| 157 | + 'fileType' => $this->_fileType, |
|
| 158 | + 'errorCode' => $this->_errorCode, |
|
| 159 | + 'localName' => $this->_localName |
|
| 160 | + ); |
|
| 162 | 161 | } |
| 163 | 162 | |
| 164 | 163 | } |
| 165 | 164 | \ No newline at end of file |
@@ -110,13 +110,13 @@ |
||
| 110 | 110 | /** |
| 111 | 111 | * Factory method to instantiate a new MessageSource depending on the |
| 112 | 112 | * source type. The allowed source types are 'XLIFF', 'PHP', 'gettext' and |
| 113 | - * 'Database'. The source parameter depends on the source type. |
|
| 114 | - * For 'gettext', 'PHP' and 'XLIFF', 'source' should point to the directory |
|
| 115 | - * where the messages are stored. |
|
| 116 | - * For 'Database', 'source' must be a valid connection id. |
|
| 113 | + * 'Database'. The source parameter depends on the source type. |
|
| 114 | + * For 'gettext', 'PHP' and 'XLIFF', 'source' should point to the directory |
|
| 115 | + * where the messages are stored. |
|
| 116 | + * For 'Database', 'source' must be a valid connection id. |
|
| 117 | 117 | * |
| 118 | - * Custom message source are possible by supplying the a filename parameter |
|
| 119 | - * in the factory method. |
|
| 118 | + * Custom message source are possible by supplying the a filename parameter |
|
| 119 | + * in the factory method. |
|
| 120 | 120 | * |
| 121 | 121 | * @param string the message source type. |
| 122 | 122 | * @param string the location of the resource or the ConnectionID. |