@@ -70,137 +70,137 @@ |
||
70 | 70 | */ |
71 | 71 | private $_workbookPassword; |
72 | 72 | |
73 | - /** |
|
74 | - * Create a new PHPExcel_DocumentSecurity |
|
75 | - */ |
|
76 | - public function __construct() |
|
77 | - { |
|
78 | - // Initialise values |
|
79 | - $this->_lockRevision = false; |
|
80 | - $this->_lockStructure = false; |
|
81 | - $this->_lockWindows = false; |
|
82 | - $this->_revisionsPassword = ''; |
|
83 | - $this->_workbookPassword = ''; |
|
84 | - } |
|
85 | - |
|
86 | - /** |
|
87 | - * Is some sort of dcument security enabled? |
|
88 | - * |
|
89 | - * @return boolean |
|
90 | - */ |
|
91 | - function isSecurityEnabled() { |
|
92 | - return $this->_lockRevision || |
|
93 | - $this->_lockStructure || |
|
94 | - $this->_lockWindows; |
|
95 | - } |
|
96 | - |
|
97 | - /** |
|
98 | - * Get LockRevision |
|
99 | - * |
|
100 | - * @return boolean |
|
101 | - */ |
|
102 | - function getLockRevision() { |
|
103 | - return $this->_lockRevision; |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * Set LockRevision |
|
108 | - * |
|
109 | - * @param boolean $pValue |
|
110 | - * @return PHPExcel_DocumentSecurity |
|
111 | - */ |
|
112 | - function setLockRevision($pValue = false) { |
|
113 | - $this->_lockRevision = $pValue; |
|
114 | - return $this; |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * Get LockStructure |
|
119 | - * |
|
120 | - * @return boolean |
|
121 | - */ |
|
122 | - function getLockStructure() { |
|
123 | - return $this->_lockStructure; |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * Set LockStructure |
|
128 | - * |
|
129 | - * @param boolean $pValue |
|
130 | - * @return PHPExcel_DocumentSecurity |
|
131 | - */ |
|
132 | - function setLockStructure($pValue = false) { |
|
73 | + /** |
|
74 | + * Create a new PHPExcel_DocumentSecurity |
|
75 | + */ |
|
76 | + public function __construct() |
|
77 | + { |
|
78 | + // Initialise values |
|
79 | + $this->_lockRevision = false; |
|
80 | + $this->_lockStructure = false; |
|
81 | + $this->_lockWindows = false; |
|
82 | + $this->_revisionsPassword = ''; |
|
83 | + $this->_workbookPassword = ''; |
|
84 | + } |
|
85 | + |
|
86 | + /** |
|
87 | + * Is some sort of dcument security enabled? |
|
88 | + * |
|
89 | + * @return boolean |
|
90 | + */ |
|
91 | + function isSecurityEnabled() { |
|
92 | + return $this->_lockRevision || |
|
93 | + $this->_lockStructure || |
|
94 | + $this->_lockWindows; |
|
95 | + } |
|
96 | + |
|
97 | + /** |
|
98 | + * Get LockRevision |
|
99 | + * |
|
100 | + * @return boolean |
|
101 | + */ |
|
102 | + function getLockRevision() { |
|
103 | + return $this->_lockRevision; |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * Set LockRevision |
|
108 | + * |
|
109 | + * @param boolean $pValue |
|
110 | + * @return PHPExcel_DocumentSecurity |
|
111 | + */ |
|
112 | + function setLockRevision($pValue = false) { |
|
113 | + $this->_lockRevision = $pValue; |
|
114 | + return $this; |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * Get LockStructure |
|
119 | + * |
|
120 | + * @return boolean |
|
121 | + */ |
|
122 | + function getLockStructure() { |
|
123 | + return $this->_lockStructure; |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * Set LockStructure |
|
128 | + * |
|
129 | + * @param boolean $pValue |
|
130 | + * @return PHPExcel_DocumentSecurity |
|
131 | + */ |
|
132 | + function setLockStructure($pValue = false) { |
|
133 | 133 | $this->_lockStructure = $pValue; |
134 | 134 | return $this; |
135 | - } |
|
136 | - |
|
137 | - /** |
|
138 | - * Get LockWindows |
|
139 | - * |
|
140 | - * @return boolean |
|
141 | - */ |
|
142 | - function getLockWindows() { |
|
143 | - return $this->_lockWindows; |
|
144 | - } |
|
145 | - |
|
146 | - /** |
|
147 | - * Set LockWindows |
|
148 | - * |
|
149 | - * @param boolean $pValue |
|
150 | - * @return PHPExcel_DocumentSecurity |
|
151 | - */ |
|
152 | - function setLockWindows($pValue = false) { |
|
153 | - $this->_lockWindows = $pValue; |
|
154 | - return $this; |
|
155 | - } |
|
156 | - |
|
157 | - /** |
|
158 | - * Get RevisionsPassword (hashed) |
|
159 | - * |
|
160 | - * @return string |
|
161 | - */ |
|
162 | - function getRevisionsPassword() { |
|
163 | - return $this->_revisionsPassword; |
|
164 | - } |
|
165 | - |
|
166 | - /** |
|
167 | - * Set RevisionsPassword |
|
168 | - * |
|
169 | - * @param string $pValue |
|
170 | - * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true |
|
171 | - * @return PHPExcel_DocumentSecurity |
|
172 | - */ |
|
173 | - function setRevisionsPassword($pValue = '', $pAlreadyHashed = false) { |
|
174 | - if (!$pAlreadyHashed) { |
|
175 | - $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); |
|
176 | - } |
|
177 | - $this->_revisionsPassword = $pValue; |
|
178 | - return $this; |
|
179 | - } |
|
180 | - |
|
181 | - /** |
|
182 | - * Get WorkbookPassword (hashed) |
|
183 | - * |
|
184 | - * @return string |
|
185 | - */ |
|
186 | - function getWorkbookPassword() { |
|
187 | - return $this->_workbookPassword; |
|
188 | - } |
|
189 | - |
|
190 | - /** |
|
191 | - * Set WorkbookPassword |
|
192 | - * |
|
193 | - * @param string $pValue |
|
194 | - * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true |
|
195 | - * @return PHPExcel_DocumentSecurity |
|
196 | - */ |
|
197 | - function setWorkbookPassword($pValue = '', $pAlreadyHashed = false) { |
|
198 | - if (!$pAlreadyHashed) { |
|
199 | - $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); |
|
200 | - } |
|
135 | + } |
|
136 | + |
|
137 | + /** |
|
138 | + * Get LockWindows |
|
139 | + * |
|
140 | + * @return boolean |
|
141 | + */ |
|
142 | + function getLockWindows() { |
|
143 | + return $this->_lockWindows; |
|
144 | + } |
|
145 | + |
|
146 | + /** |
|
147 | + * Set LockWindows |
|
148 | + * |
|
149 | + * @param boolean $pValue |
|
150 | + * @return PHPExcel_DocumentSecurity |
|
151 | + */ |
|
152 | + function setLockWindows($pValue = false) { |
|
153 | + $this->_lockWindows = $pValue; |
|
154 | + return $this; |
|
155 | + } |
|
156 | + |
|
157 | + /** |
|
158 | + * Get RevisionsPassword (hashed) |
|
159 | + * |
|
160 | + * @return string |
|
161 | + */ |
|
162 | + function getRevisionsPassword() { |
|
163 | + return $this->_revisionsPassword; |
|
164 | + } |
|
165 | + |
|
166 | + /** |
|
167 | + * Set RevisionsPassword |
|
168 | + * |
|
169 | + * @param string $pValue |
|
170 | + * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true |
|
171 | + * @return PHPExcel_DocumentSecurity |
|
172 | + */ |
|
173 | + function setRevisionsPassword($pValue = '', $pAlreadyHashed = false) { |
|
174 | + if (!$pAlreadyHashed) { |
|
175 | + $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); |
|
176 | + } |
|
177 | + $this->_revisionsPassword = $pValue; |
|
178 | + return $this; |
|
179 | + } |
|
180 | + |
|
181 | + /** |
|
182 | + * Get WorkbookPassword (hashed) |
|
183 | + * |
|
184 | + * @return string |
|
185 | + */ |
|
186 | + function getWorkbookPassword() { |
|
187 | + return $this->_workbookPassword; |
|
188 | + } |
|
189 | + |
|
190 | + /** |
|
191 | + * Set WorkbookPassword |
|
192 | + * |
|
193 | + * @param string $pValue |
|
194 | + * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true |
|
195 | + * @return PHPExcel_DocumentSecurity |
|
196 | + */ |
|
197 | + function setWorkbookPassword($pValue = '', $pAlreadyHashed = false) { |
|
198 | + if (!$pAlreadyHashed) { |
|
199 | + $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); |
|
200 | + } |
|
201 | 201 | $this->_workbookPassword = $pValue; |
202 | 202 | return $this; |
203 | - } |
|
203 | + } |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Implement PHP __clone to create a deep clone, not just a shallow copy. |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | { |
78 | 78 | // Initialise values |
79 | 79 | $this->_lockRevision = false; |
80 | - $this->_lockStructure = false; |
|
80 | + $this->_lockStructure = false; |
|
81 | 81 | $this->_lockWindows = false; |
82 | - $this->_revisionsPassword = ''; |
|
83 | - $this->_workbookPassword = ''; |
|
82 | + $this->_revisionsPassword = ''; |
|
83 | + $this->_workbookPassword = ''; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @return PHPExcel_DocumentSecurity |
172 | 172 | */ |
173 | 173 | function setRevisionsPassword($pValue = '', $pAlreadyHashed = false) { |
174 | - if (!$pAlreadyHashed) { |
|
174 | + if ( ! $pAlreadyHashed) { |
|
175 | 175 | $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); |
176 | 176 | } |
177 | 177 | $this->_revisionsPassword = $pValue; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @return PHPExcel_DocumentSecurity |
196 | 196 | */ |
197 | 197 | function setWorkbookPassword($pValue = '', $pAlreadyHashed = false) { |
198 | - if (!$pAlreadyHashed) { |
|
198 | + if ( ! $pAlreadyHashed) { |
|
199 | 199 | $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); |
200 | 200 | } |
201 | 201 | $this->_workbookPassword = $pValue; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // Check if an array was passed |
74 | 74 | if ($pSource == null) { |
75 | 75 | return; |
76 | - } else if (!is_array($pSource)) { |
|
76 | + } else if ( ! is_array($pSource)) { |
|
77 | 77 | throw new Exception('Invalid array parameter passed.'); |
78 | 78 | } |
79 | 79 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function add(PHPExcel_IComparable $pSource = null) { |
92 | 92 | $hash = $pSource->getHashCode(); |
93 | - if (!isset($this->_items[$hash])) { |
|
93 | + if ( ! isset($this->_items[$hash])) { |
|
94 | 94 | $this->_items[$hash] = $pSource; |
95 | 95 | $this->_keyMap[count($this->_items) - 1] = $hash; |
96 | 96 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function getByIndex($pIndex = 0) { |
160 | 160 | if (isset($this->_keyMap[$pIndex])) { |
161 | - return $this->getByHashCode( $this->_keyMap[$pIndex] ); |
|
161 | + return $this->getByHashCode($this->_keyMap[$pIndex]); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | return null; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | // Set local members |
90 | - $this->_name = $pName; |
|
90 | + $this->_name = $pName; |
|
91 | 91 | $this->_worksheet = $pWorksheet; |
92 | 92 | $this->_range = $pRange; |
93 | 93 | $this->_localOnly = $pLocalOnly; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | // Re-attach |
119 | 119 | if ($this->_worksheet !== NULL) { |
120 | - $this->_worksheet->getParent()->removeNamedRange($this->_name,$this->_worksheet); |
|
120 | + $this->_worksheet->getParent()->removeNamedRange($this->_name, $this->_worksheet); |
|
121 | 121 | } |
122 | 122 | $this->_name = $value; |
123 | 123 |
@@ -70,164 +70,164 @@ |
||
70 | 70 | */ |
71 | 71 | private $_scope; |
72 | 72 | |
73 | - /** |
|
74 | - * Create a new NamedRange |
|
75 | - * |
|
76 | - * @param string $pName |
|
77 | - * @param PHPExcel_Worksheet $pWorksheet |
|
78 | - * @param string $pRange |
|
79 | - * @param bool $pLocalOnly |
|
80 | - * @param PHPExcel_Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope. |
|
81 | - */ |
|
82 | - public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null) |
|
83 | - { |
|
84 | - // Validate data |
|
85 | - if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) { |
|
86 | - throw new Exception('Parameters can not be null.'); |
|
87 | - } |
|
88 | - |
|
89 | - // Set local members |
|
90 | - $this->_name = $pName; |
|
91 | - $this->_worksheet = $pWorksheet; |
|
92 | - $this->_range = $pRange; |
|
93 | - $this->_localOnly = $pLocalOnly; |
|
94 | - $this->_scope = ($pLocalOnly == true) ? |
|
73 | + /** |
|
74 | + * Create a new NamedRange |
|
75 | + * |
|
76 | + * @param string $pName |
|
77 | + * @param PHPExcel_Worksheet $pWorksheet |
|
78 | + * @param string $pRange |
|
79 | + * @param bool $pLocalOnly |
|
80 | + * @param PHPExcel_Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope. |
|
81 | + */ |
|
82 | + public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null) |
|
83 | + { |
|
84 | + // Validate data |
|
85 | + if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) { |
|
86 | + throw new Exception('Parameters can not be null.'); |
|
87 | + } |
|
88 | + |
|
89 | + // Set local members |
|
90 | + $this->_name = $pName; |
|
91 | + $this->_worksheet = $pWorksheet; |
|
92 | + $this->_range = $pRange; |
|
93 | + $this->_localOnly = $pLocalOnly; |
|
94 | + $this->_scope = ($pLocalOnly == true) ? |
|
95 | 95 | (($pScope == null) ? $pWorksheet : $pScope) : null; |
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * Get name |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - public function getName() { |
|
104 | - return $this->_name; |
|
105 | - } |
|
106 | - |
|
107 | - /** |
|
108 | - * Set name |
|
109 | - * |
|
110 | - * @param string $value |
|
111 | - * @return PHPExcel_NamedRange |
|
112 | - */ |
|
113 | - public function setName($value = null) { |
|
114 | - if ($value !== NULL) { |
|
115 | - // Old title |
|
116 | - $oldTitle = $this->_name; |
|
117 | - |
|
118 | - // Re-attach |
|
119 | - if ($this->_worksheet !== NULL) { |
|
120 | - $this->_worksheet->getParent()->removeNamedRange($this->_name,$this->_worksheet); |
|
121 | - } |
|
122 | - $this->_name = $value; |
|
123 | - |
|
124 | - if ($this->_worksheet !== NULL) { |
|
125 | - $this->_worksheet->getParent()->addNamedRange($this); |
|
126 | - } |
|
127 | - |
|
128 | - // New title |
|
129 | - $newTitle = $this->_name; |
|
130 | - PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->_worksheet->getParent(), $oldTitle, $newTitle); |
|
131 | - } |
|
132 | - return $this; |
|
133 | - } |
|
134 | - |
|
135 | - /** |
|
136 | - * Get worksheet |
|
137 | - * |
|
138 | - * @return PHPExcel_Worksheet |
|
139 | - */ |
|
140 | - public function getWorksheet() { |
|
141 | - return $this->_worksheet; |
|
142 | - } |
|
143 | - |
|
144 | - /** |
|
145 | - * Set worksheet |
|
146 | - * |
|
147 | - * @param PHPExcel_Worksheet $value |
|
148 | - * @return PHPExcel_NamedRange |
|
149 | - */ |
|
150 | - public function setWorksheet(PHPExcel_Worksheet $value = null) { |
|
151 | - if ($value !== NULL) { |
|
152 | - $this->_worksheet = $value; |
|
153 | - } |
|
154 | - return $this; |
|
155 | - } |
|
156 | - |
|
157 | - /** |
|
158 | - * Get range |
|
159 | - * |
|
160 | - * @return string |
|
161 | - */ |
|
162 | - public function getRange() { |
|
163 | - return $this->_range; |
|
164 | - } |
|
165 | - |
|
166 | - /** |
|
167 | - * Set range |
|
168 | - * |
|
169 | - * @param string $value |
|
170 | - * @return PHPExcel_NamedRange |
|
171 | - */ |
|
172 | - public function setRange($value = null) { |
|
173 | - if ($value !== NULL) { |
|
174 | - $this->_range = $value; |
|
175 | - } |
|
176 | - return $this; |
|
177 | - } |
|
178 | - |
|
179 | - /** |
|
180 | - * Get localOnly |
|
181 | - * |
|
182 | - * @return bool |
|
183 | - */ |
|
184 | - public function getLocalOnly() { |
|
185 | - return $this->_localOnly; |
|
186 | - } |
|
187 | - |
|
188 | - /** |
|
189 | - * Set localOnly |
|
190 | - * |
|
191 | - * @param bool $value |
|
192 | - * @return PHPExcel_NamedRange |
|
193 | - */ |
|
194 | - public function setLocalOnly($value = false) { |
|
195 | - $this->_localOnly = $value; |
|
196 | - $this->_scope = $value ? $this->_worksheet : null; |
|
197 | - return $this; |
|
198 | - } |
|
199 | - |
|
200 | - /** |
|
201 | - * Get scope |
|
202 | - * |
|
203 | - * @return PHPExcel_Worksheet|null |
|
204 | - */ |
|
205 | - public function getScope() { |
|
206 | - return $this->_scope; |
|
207 | - } |
|
208 | - |
|
209 | - /** |
|
210 | - * Set scope |
|
211 | - * |
|
212 | - * @param PHPExcel_Worksheet|null $value |
|
213 | - * @return PHPExcel_NamedRange |
|
214 | - */ |
|
215 | - public function setScope(PHPExcel_Worksheet $value = null) { |
|
216 | - $this->_scope = $value; |
|
217 | - $this->_localOnly = ($value == null) ? false : true; |
|
218 | - return $this; |
|
219 | - } |
|
220 | - |
|
221 | - /** |
|
222 | - * Resolve a named range to a regular cell range |
|
223 | - * |
|
224 | - * @param string $pNamedRange Named range |
|
225 | - * @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope |
|
226 | - * @return PHPExcel_NamedRange |
|
227 | - */ |
|
228 | - public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet) { |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * Get name |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + public function getName() { |
|
104 | + return $this->_name; |
|
105 | + } |
|
106 | + |
|
107 | + /** |
|
108 | + * Set name |
|
109 | + * |
|
110 | + * @param string $value |
|
111 | + * @return PHPExcel_NamedRange |
|
112 | + */ |
|
113 | + public function setName($value = null) { |
|
114 | + if ($value !== NULL) { |
|
115 | + // Old title |
|
116 | + $oldTitle = $this->_name; |
|
117 | + |
|
118 | + // Re-attach |
|
119 | + if ($this->_worksheet !== NULL) { |
|
120 | + $this->_worksheet->getParent()->removeNamedRange($this->_name,$this->_worksheet); |
|
121 | + } |
|
122 | + $this->_name = $value; |
|
123 | + |
|
124 | + if ($this->_worksheet !== NULL) { |
|
125 | + $this->_worksheet->getParent()->addNamedRange($this); |
|
126 | + } |
|
127 | + |
|
128 | + // New title |
|
129 | + $newTitle = $this->_name; |
|
130 | + PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->_worksheet->getParent(), $oldTitle, $newTitle); |
|
131 | + } |
|
132 | + return $this; |
|
133 | + } |
|
134 | + |
|
135 | + /** |
|
136 | + * Get worksheet |
|
137 | + * |
|
138 | + * @return PHPExcel_Worksheet |
|
139 | + */ |
|
140 | + public function getWorksheet() { |
|
141 | + return $this->_worksheet; |
|
142 | + } |
|
143 | + |
|
144 | + /** |
|
145 | + * Set worksheet |
|
146 | + * |
|
147 | + * @param PHPExcel_Worksheet $value |
|
148 | + * @return PHPExcel_NamedRange |
|
149 | + */ |
|
150 | + public function setWorksheet(PHPExcel_Worksheet $value = null) { |
|
151 | + if ($value !== NULL) { |
|
152 | + $this->_worksheet = $value; |
|
153 | + } |
|
154 | + return $this; |
|
155 | + } |
|
156 | + |
|
157 | + /** |
|
158 | + * Get range |
|
159 | + * |
|
160 | + * @return string |
|
161 | + */ |
|
162 | + public function getRange() { |
|
163 | + return $this->_range; |
|
164 | + } |
|
165 | + |
|
166 | + /** |
|
167 | + * Set range |
|
168 | + * |
|
169 | + * @param string $value |
|
170 | + * @return PHPExcel_NamedRange |
|
171 | + */ |
|
172 | + public function setRange($value = null) { |
|
173 | + if ($value !== NULL) { |
|
174 | + $this->_range = $value; |
|
175 | + } |
|
176 | + return $this; |
|
177 | + } |
|
178 | + |
|
179 | + /** |
|
180 | + * Get localOnly |
|
181 | + * |
|
182 | + * @return bool |
|
183 | + */ |
|
184 | + public function getLocalOnly() { |
|
185 | + return $this->_localOnly; |
|
186 | + } |
|
187 | + |
|
188 | + /** |
|
189 | + * Set localOnly |
|
190 | + * |
|
191 | + * @param bool $value |
|
192 | + * @return PHPExcel_NamedRange |
|
193 | + */ |
|
194 | + public function setLocalOnly($value = false) { |
|
195 | + $this->_localOnly = $value; |
|
196 | + $this->_scope = $value ? $this->_worksheet : null; |
|
197 | + return $this; |
|
198 | + } |
|
199 | + |
|
200 | + /** |
|
201 | + * Get scope |
|
202 | + * |
|
203 | + * @return PHPExcel_Worksheet|null |
|
204 | + */ |
|
205 | + public function getScope() { |
|
206 | + return $this->_scope; |
|
207 | + } |
|
208 | + |
|
209 | + /** |
|
210 | + * Set scope |
|
211 | + * |
|
212 | + * @param PHPExcel_Worksheet|null $value |
|
213 | + * @return PHPExcel_NamedRange |
|
214 | + */ |
|
215 | + public function setScope(PHPExcel_Worksheet $value = null) { |
|
216 | + $this->_scope = $value; |
|
217 | + $this->_localOnly = ($value == null) ? false : true; |
|
218 | + return $this; |
|
219 | + } |
|
220 | + |
|
221 | + /** |
|
222 | + * Resolve a named range to a regular cell range |
|
223 | + * |
|
224 | + * @param string $pNamedRange Named range |
|
225 | + * @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope |
|
226 | + * @return PHPExcel_NamedRange |
|
227 | + */ |
|
228 | + public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet) { |
|
229 | 229 | return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet); |
230 | - } |
|
230 | + } |
|
231 | 231 | |
232 | 232 | /** |
233 | 233 | * Implement PHP __clone to create a deep clone, not just a shallow copy. |
@@ -222,7 +222,7 @@ |
||
222 | 222 | * Resolve a named range to a regular cell range |
223 | 223 | * |
224 | 224 | * @param string $pNamedRange Named range |
225 | - * @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope |
|
225 | + * @param PHPExcel_Worksheet $pSheet Scope. Use null for global scope |
|
226 | 226 | * @return PHPExcel_NamedRange |
227 | 227 | */ |
228 | 228 | public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet) { |
@@ -27,12 +27,12 @@ |
||
27 | 27 | |
28 | 28 | |
29 | 29 | /** PHPExcel root directory */ |
30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
31 | 31 | /** |
32 | 32 | * @ignore |
33 | 33 | */ |
34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -65,17 +65,17 @@ discard block |
||
65 | 65 | private $_colourMap; |
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * Create a new PHPExcel_Theme |
|
68 | + /** |
|
69 | + * Create a new PHPExcel_Theme |
|
70 | 70 | * |
71 | - */ |
|
72 | - public function __construct($themeName,$colourSchemeName,$colourMap) |
|
73 | - { |
|
71 | + */ |
|
72 | + public function __construct($themeName,$colourSchemeName,$colourMap) |
|
73 | + { |
|
74 | 74 | // Initialise values |
75 | - $this->_themeName = $themeName; |
|
75 | + $this->_themeName = $themeName; |
|
76 | 76 | $this->_colourSchemeName = $colourSchemeName; |
77 | 77 | $this->_colourMap = $colourMap; |
78 | - } |
|
78 | + } |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Get Theme Name |
@@ -87,26 +87,26 @@ discard block |
||
87 | 87 | return $this->_themeName; |
88 | 88 | } |
89 | 89 | |
90 | - /** |
|
91 | - * Get colour Scheme Name |
|
92 | - * |
|
93 | - * @return string |
|
94 | - */ |
|
95 | - public function getColourSchemeName() { |
|
90 | + /** |
|
91 | + * Get colour Scheme Name |
|
92 | + * |
|
93 | + * @return string |
|
94 | + */ |
|
95 | + public function getColourSchemeName() { |
|
96 | 96 | return $this->_colourSchemeName; |
97 | - } |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * Get colour Map Value by Position |
|
101 | - * |
|
102 | - * @return string |
|
103 | - */ |
|
104 | - public function getColourByIndex($index=0) { |
|
105 | - if (isset($this->_colourMap[$index])) { |
|
99 | + /** |
|
100 | + * Get colour Map Value by Position |
|
101 | + * |
|
102 | + * @return string |
|
103 | + */ |
|
104 | + public function getColourByIndex($index=0) { |
|
105 | + if (isset($this->_colourMap[$index])) { |
|
106 | 106 | return $this->_colourMap[$index]; |
107 | 107 | } |
108 | 108 | return null; |
109 | - } |
|
109 | + } |
|
110 | 110 | |
111 | 111 | /** |
112 | 112 | * Implement PHP __clone to create a deep clone, not just a shallow copy. |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | * Create a new PHPExcel_Theme |
70 | 70 | * |
71 | 71 | */ |
72 | - public function __construct($themeName,$colourSchemeName,$colourMap) |
|
72 | + public function __construct($themeName, $colourSchemeName, $colourMap) |
|
73 | 73 | { |
74 | 74 | // Initialise values |
75 | - $this->_themeName = $themeName; |
|
76 | - $this->_colourSchemeName = $colourSchemeName; |
|
77 | - $this->_colourMap = $colourMap; |
|
75 | + $this->_themeName = $themeName; |
|
76 | + $this->_colourSchemeName = $colourSchemeName; |
|
77 | + $this->_colourMap = $colourMap; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return string |
103 | 103 | */ |
104 | - public function getColourByIndex($index=0) { |
|
104 | + public function getColourByIndex($index = 0) { |
|
105 | 105 | if (isset($this->_colourMap[$index])) { |
106 | 106 | return $this->_colourMap[$index]; |
107 | 107 | } |
@@ -34,24 +34,24 @@ discard block |
||
34 | 34 | */ |
35 | 35 | class PHPExcel_Reader_Excel5_Escher |
36 | 36 | { |
37 | - const DGGCONTAINER = 0xF000; |
|
38 | - const BSTORECONTAINER = 0xF001; |
|
37 | + const DGGCONTAINER = 0xF000; |
|
38 | + const BSTORECONTAINER = 0xF001; |
|
39 | 39 | const DGCONTAINER = 0xF002; |
40 | - const SPGRCONTAINER = 0xF003; |
|
40 | + const SPGRCONTAINER = 0xF003; |
|
41 | 41 | const SPCONTAINER = 0xF004; |
42 | 42 | const DGG = 0xF006; |
43 | 43 | const BSE = 0xF007; |
44 | 44 | const DG = 0xF008; |
45 | - const SPGR = 0xF009; |
|
45 | + const SPGR = 0xF009; |
|
46 | 46 | const SP = 0xF00A; |
47 | - const OPT = 0xF00B; |
|
48 | - const CLIENTTEXTBOX = 0xF00D; |
|
49 | - const CLIENTANCHOR = 0xF010; |
|
50 | - const CLIENTDATA = 0xF011; |
|
51 | - const BLIPJPEG = 0xF01D; |
|
52 | - const BLIPPNG = 0xF01E; |
|
53 | - const SPLITMENUCOLORS = 0xF11E; |
|
54 | - const TERTIARYOPT = 0xF122; |
|
47 | + const OPT = 0xF00B; |
|
48 | + const CLIENTTEXTBOX = 0xF00D; |
|
49 | + const CLIENTANCHOR = 0xF010; |
|
50 | + const CLIENTDATA = 0xF011; |
|
51 | + const BLIPJPEG = 0xF01D; |
|
52 | + const BLIPPNG = 0xF01E; |
|
53 | + const SPLITMENUCOLORS = 0xF11E; |
|
54 | + const TERTIARYOPT = 0xF122; |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Escher stream data (binary) |
@@ -112,25 +112,25 @@ discard block |
||
112 | 112 | $fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2); |
113 | 113 | |
114 | 114 | switch ($fbt) { |
115 | - case self::DGGCONTAINER: $this->_readDggContainer(); break; |
|
116 | - case self::DGG: $this->_readDgg(); break; |
|
117 | - case self::BSTORECONTAINER: $this->_readBstoreContainer(); break; |
|
118 | - case self::BSE: $this->_readBSE(); break; |
|
119 | - case self::BLIPJPEG: $this->_readBlipJPEG(); break; |
|
120 | - case self::BLIPPNG: $this->_readBlipPNG(); break; |
|
121 | - case self::OPT: $this->_readOPT(); break; |
|
122 | - case self::TERTIARYOPT: $this->_readTertiaryOPT(); break; |
|
123 | - case self::SPLITMENUCOLORS: $this->_readSplitMenuColors(); break; |
|
124 | - case self::DGCONTAINER: $this->_readDgContainer(); break; |
|
125 | - case self::DG: $this->_readDg(); break; |
|
126 | - case self::SPGRCONTAINER: $this->_readSpgrContainer(); break; |
|
127 | - case self::SPCONTAINER: $this->_readSpContainer(); break; |
|
128 | - case self::SPGR: $this->_readSpgr(); break; |
|
129 | - case self::SP: $this->_readSp(); break; |
|
130 | - case self::CLIENTTEXTBOX: $this->_readClientTextbox(); break; |
|
131 | - case self::CLIENTANCHOR: $this->_readClientAnchor(); break; |
|
132 | - case self::CLIENTDATA: $this->_readClientData(); break; |
|
133 | - default: $this->_readDefault(); break; |
|
115 | + case self::DGGCONTAINER: $this->_readDggContainer(); break; |
|
116 | + case self::DGG: $this->_readDgg(); break; |
|
117 | + case self::BSTORECONTAINER: $this->_readBstoreContainer(); break; |
|
118 | + case self::BSE: $this->_readBSE(); break; |
|
119 | + case self::BLIPJPEG: $this->_readBlipJPEG(); break; |
|
120 | + case self::BLIPPNG: $this->_readBlipPNG(); break; |
|
121 | + case self::OPT: $this->_readOPT(); break; |
|
122 | + case self::TERTIARYOPT: $this->_readTertiaryOPT(); break; |
|
123 | + case self::SPLITMENUCOLORS: $this->_readSplitMenuColors(); break; |
|
124 | + case self::DGCONTAINER: $this->_readDgContainer(); break; |
|
125 | + case self::DG: $this->_readDg(); break; |
|
126 | + case self::SPGRCONTAINER: $this->_readSpgrContainer(); break; |
|
127 | + case self::SPCONTAINER: $this->_readSpContainer(); break; |
|
128 | + case self::SPGR: $this->_readSpgr(); break; |
|
129 | + case self::SP: $this->_readSp(); break; |
|
130 | + case self::CLIENTTEXTBOX: $this->_readClientTextbox(); break; |
|
131 | + case self::CLIENTANCHOR: $this->_readClientAnchor(); break; |
|
132 | + case self::CLIENTDATA: $this->_readClientData(); break; |
|
133 | + default: $this->_readDefault(); break; |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | $endOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 16); |
563 | 563 | |
564 | 564 | // set the start coordinates |
565 | - $this->_object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1)); |
|
565 | + $this->_object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1).($r1 + 1)); |
|
566 | 566 | |
567 | 567 | // set the start offsetX |
568 | 568 | $this->_object->setStartOffsetX($startOffsetX); |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | $this->_object->setStartOffsetY($startOffsetY); |
572 | 572 | |
573 | 573 | // set the end coordinates |
574 | - $this->_object->setEndCoordinates(PHPExcel_Cell::stringFromColumnIndex($c2) . ($r2 + 1)); |
|
574 | + $this->_object->setEndCoordinates(PHPExcel_Cell::stringFromColumnIndex($c2).($r2 + 1)); |
|
575 | 575 | |
576 | 576 | // set the end offsetX |
577 | 577 | $this->_object->setEndOffsetX($endOffsetX); |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | |
29 | 29 | /** PHPExcel root directory */ |
30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
31 | 31 | /** |
32 | 32 | * @ignore |
33 | 33 | */ |
34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @var string |
51 | 51 | */ |
52 | - private $_inputEncoding = 'ANSI'; |
|
52 | + private $_inputEncoding = 'ANSI'; |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * Sheet index to read |
56 | 56 | * |
57 | 57 | * @var int |
58 | 58 | */ |
59 | - private $_sheetIndex = 0; |
|
59 | + private $_sheetIndex = 0; |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Formats |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * Create a new PHPExcel_Reader_SYLK |
85 | 85 | */ |
86 | 86 | public function __construct() { |
87 | - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); |
|
87 | + $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | public function canRead($pFilename) |
99 | 99 | { |
100 | 100 | // Check if file exists |
101 | - if (!file_exists($pFilename)) { |
|
102 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
101 | + if ( ! file_exists($pFilename)) { |
|
102 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | // Read sample data (first 2 KB will do) |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | // Analyze first line looking for ID; signature |
117 | 117 | $lines = explode("\n", $data); |
118 | - if (substr($lines[0],0,4) != 'ID;P') { |
|
118 | + if (substr($lines[0], 0, 4) != 'ID;P') { |
|
119 | 119 | return false; |
120 | 120 | } |
121 | 121 | |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | public function listWorksheetInfo($pFilename) |
177 | 177 | { |
178 | 178 | // Check if file exists |
179 | - if (!file_exists($pFilename)) { |
|
180 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
179 | + if ( ! file_exists($pFilename)) { |
|
180 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | // Open file |
184 | 184 | $fileHandle = fopen($pFilename, 'r'); |
185 | 185 | if ($fileHandle === false) { |
186 | - throw new Exception("Could not open file " . $pFilename . " for reading."); |
|
186 | + throw new Exception("Could not open file ".$pFilename." for reading."); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | $worksheetInfo = array(); |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | |
207 | 207 | // explode each row at semicolons while taking into account that literal semicolon (;) |
208 | 208 | // is escaped like this (;;) |
209 | - $rowData = explode("\t",str_replace('?',';',str_replace(';',"\t",str_replace(';;','?',rtrim($rowData))))); |
|
209 | + $rowData = explode("\t", str_replace('?', ';', str_replace(';', "\t", str_replace(';;', '?', rtrim($rowData))))); |
|
210 | 210 | |
211 | 211 | $dataType = array_shift($rowData); |
212 | 212 | if ($dataType == 'C') { |
213 | 213 | // Read cell value data |
214 | - foreach($rowData as $rowDatum) { |
|
215 | - switch($rowDatum{0}) { |
|
214 | + foreach ($rowData as $rowDatum) { |
|
215 | + switch ($rowDatum{0}) { |
|
216 | 216 | case 'C' : |
217 | 217 | case 'X' : |
218 | - $columnIndex = substr($rowDatum,1) - 1; |
|
218 | + $columnIndex = substr($rowDatum, 1) - 1; |
|
219 | 219 | break; |
220 | 220 | case 'R' : |
221 | 221 | case 'Y' : |
222 | - $rowIndex = substr($rowDatum,1); |
|
222 | + $rowIndex = substr($rowDatum, 1); |
|
223 | 223 | break; |
224 | 224 | } |
225 | 225 | |
@@ -267,18 +267,18 @@ discard block |
||
267 | 267 | public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) |
268 | 268 | { |
269 | 269 | // Check if file exists |
270 | - if (!file_exists($pFilename)) { |
|
271 | - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); |
|
270 | + if ( ! file_exists($pFilename)) { |
|
271 | + throw new Exception("Could not open ".$pFilename." for reading! File does not exist."); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | // Create new PHPExcel |
275 | 275 | while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) { |
276 | 276 | $objPHPExcel->createSheet(); |
277 | 277 | } |
278 | - $objPHPExcel->setActiveSheetIndex( $this->_sheetIndex ); |
|
278 | + $objPHPExcel->setActiveSheetIndex($this->_sheetIndex); |
|
279 | 279 | |
280 | - $fromFormats = array('\-', '\ '); |
|
281 | - $toFormats = array('-', ' '); |
|
280 | + $fromFormats = array('\-', '\ '); |
|
281 | + $toFormats = array('-', ' '); |
|
282 | 282 | |
283 | 283 | // Open file |
284 | 284 | $fileHandle = fopen($pFilename, 'r'); |
@@ -298,23 +298,23 @@ discard block |
||
298 | 298 | |
299 | 299 | // explode each row at semicolons while taking into account that literal semicolon (;) |
300 | 300 | // is escaped like this (;;) |
301 | - $rowData = explode("\t",str_replace('¤',';',str_replace(';',"\t",str_replace(';;','¤',rtrim($rowData))))); |
|
301 | + $rowData = explode("\t", str_replace('¤', ';', str_replace(';', "\t", str_replace(';;', '¤', rtrim($rowData))))); |
|
302 | 302 | |
303 | 303 | $dataType = array_shift($rowData); |
304 | 304 | // Read shared styles |
305 | 305 | if ($dataType == 'P') { |
306 | 306 | $formatArray = array(); |
307 | - foreach($rowData as $rowDatum) { |
|
308 | - switch($rowDatum{0}) { |
|
309 | - case 'P' : $formatArray['numberformat']['code'] = str_replace($fromFormats,$toFormats,substr($rowDatum,1)); |
|
307 | + foreach ($rowData as $rowDatum) { |
|
308 | + switch ($rowDatum{0}) { |
|
309 | + case 'P' : $formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1)); |
|
310 | 310 | break; |
311 | 311 | case 'E' : |
312 | - case 'F' : $formatArray['font']['name'] = substr($rowDatum,1); |
|
312 | + case 'F' : $formatArray['font']['name'] = substr($rowDatum, 1); |
|
313 | 313 | break; |
314 | - case 'L' : $formatArray['font']['size'] = substr($rowDatum,1); |
|
314 | + case 'L' : $formatArray['font']['size'] = substr($rowDatum, 1); |
|
315 | 315 | break; |
316 | - case 'S' : $styleSettings = substr($rowDatum,1); |
|
317 | - for ($i=0;$i<strlen($styleSettings);++$i) { |
|
316 | + case 'S' : $styleSettings = substr($rowDatum, 1); |
|
317 | + for ($i = 0; $i < strlen($styleSettings); ++$i) { |
|
318 | 318 | switch ($styleSettings{$i}) { |
319 | 319 | case 'I' : $formatArray['font']['italic'] = true; |
320 | 320 | break; |
@@ -338,55 +338,55 @@ discard block |
||
338 | 338 | } elseif ($dataType == 'C') { |
339 | 339 | $hasCalculatedValue = false; |
340 | 340 | $cellData = $cellDataFormula = ''; |
341 | - foreach($rowData as $rowDatum) { |
|
342 | - switch($rowDatum{0}) { |
|
341 | + foreach ($rowData as $rowDatum) { |
|
342 | + switch ($rowDatum{0}) { |
|
343 | 343 | case 'C' : |
344 | - case 'X' : $column = substr($rowDatum,1); |
|
344 | + case 'X' : $column = substr($rowDatum, 1); |
|
345 | 345 | break; |
346 | 346 | case 'R' : |
347 | - case 'Y' : $row = substr($rowDatum,1); |
|
347 | + case 'Y' : $row = substr($rowDatum, 1); |
|
348 | 348 | break; |
349 | - case 'K' : $cellData = substr($rowDatum,1); |
|
349 | + case 'K' : $cellData = substr($rowDatum, 1); |
|
350 | 350 | break; |
351 | - case 'E' : $cellDataFormula = '='.substr($rowDatum,1); |
|
351 | + case 'E' : $cellDataFormula = '='.substr($rowDatum, 1); |
|
352 | 352 | // Convert R1C1 style references to A1 style references (but only when not quoted) |
353 | - $temp = explode('"',$cellDataFormula); |
|
353 | + $temp = explode('"', $cellDataFormula); |
|
354 | 354 | $key = false; |
355 | - foreach($temp as &$value) { |
|
355 | + foreach ($temp as &$value) { |
|
356 | 356 | // Only count/replace in alternate array entries |
357 | - if ($key = !$key) { |
|
358 | - preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/',$value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE); |
|
357 | + if ($key = ! $key) { |
|
358 | + preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences, PREG_SET_ORDER + PREG_OFFSET_CAPTURE); |
|
359 | 359 | // Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way |
360 | 360 | // through the formula from left to right. Reversing means that we work right to left.through |
361 | 361 | // the formula |
362 | 362 | $cellReferences = array_reverse($cellReferences); |
363 | 363 | // Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent, |
364 | 364 | // then modify the formula to use that new reference |
365 | - foreach($cellReferences as $cellReference) { |
|
365 | + foreach ($cellReferences as $cellReference) { |
|
366 | 366 | $rowReference = $cellReference[2][0]; |
367 | 367 | // Empty R reference is the current row |
368 | 368 | if ($rowReference == '') $rowReference = $row; |
369 | 369 | // Bracketed R references are relative to the current row |
370 | - if ($rowReference{0} == '[') $rowReference = $row + trim($rowReference,'[]'); |
|
370 | + if ($rowReference{0} == '[') $rowReference = $row + trim($rowReference, '[]'); |
|
371 | 371 | $columnReference = $cellReference[4][0]; |
372 | 372 | // Empty C reference is the current column |
373 | 373 | if ($columnReference == '') $columnReference = $column; |
374 | 374 | // Bracketed C references are relative to the current column |
375 | - if ($columnReference{0} == '[') $columnReference = $column + trim($columnReference,'[]'); |
|
376 | - $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference; |
|
375 | + if ($columnReference{0} == '[') $columnReference = $column + trim($columnReference, '[]'); |
|
376 | + $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference - 1).$rowReference; |
|
377 | 377 | |
378 | - $value = substr_replace($value,$A1CellReference,$cellReference[0][1],strlen($cellReference[0][0])); |
|
378 | + $value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0])); |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | } |
382 | 382 | unset($value); |
383 | 383 | // Then rebuild the formula string |
384 | - $cellDataFormula = implode('"',$temp); |
|
384 | + $cellDataFormula = implode('"', $temp); |
|
385 | 385 | $hasCalculatedValue = true; |
386 | 386 | break; |
387 | 387 | } |
388 | 388 | } |
389 | - $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1); |
|
389 | + $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column - 1); |
|
390 | 390 | $cellData = PHPExcel_Calculation::_unwrapResult($cellData); |
391 | 391 | |
392 | 392 | // Set cell value |
@@ -399,20 +399,20 @@ discard block |
||
399 | 399 | } elseif ($dataType == 'F') { |
400 | 400 | $formatStyle = $columnWidth = $styleSettings = ''; |
401 | 401 | $styleData = array(); |
402 | - foreach($rowData as $rowDatum) { |
|
403 | - switch($rowDatum{0}) { |
|
402 | + foreach ($rowData as $rowDatum) { |
|
403 | + switch ($rowDatum{0}) { |
|
404 | 404 | case 'C' : |
405 | - case 'X' : $column = substr($rowDatum,1); |
|
405 | + case 'X' : $column = substr($rowDatum, 1); |
|
406 | 406 | break; |
407 | 407 | case 'R' : |
408 | - case 'Y' : $row = substr($rowDatum,1); |
|
408 | + case 'Y' : $row = substr($rowDatum, 1); |
|
409 | 409 | break; |
410 | 410 | case 'P' : $formatStyle = $rowDatum; |
411 | 411 | break; |
412 | - case 'W' : list($startCol,$endCol,$columnWidth) = explode(' ',substr($rowDatum,1)); |
|
412 | + case 'W' : list($startCol, $endCol, $columnWidth) = explode(' ', substr($rowDatum, 1)); |
|
413 | 413 | break; |
414 | - case 'S' : $styleSettings = substr($rowDatum,1); |
|
415 | - for ($i=0;$i<strlen($styleSettings);++$i) { |
|
414 | + case 'S' : $styleSettings = substr($rowDatum, 1); |
|
415 | + for ($i = 0; $i < strlen($styleSettings); ++$i) { |
|
416 | 416 | switch ($styleSettings{$i}) { |
417 | 417 | case 'I' : $styleData['font']['italic'] = true; |
418 | 418 | break; |
@@ -432,20 +432,20 @@ discard block |
||
432 | 432 | } |
433 | 433 | } |
434 | 434 | if (($formatStyle > '') && ($column > '') && ($row > '')) { |
435 | - $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1); |
|
435 | + $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column - 1); |
|
436 | 436 | $objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->_formats[$formatStyle]); |
437 | 437 | } |
438 | - if ((!empty($styleData)) && ($column > '') && ($row > '')) { |
|
439 | - $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1); |
|
438 | + if (( ! empty($styleData)) && ($column > '') && ($row > '')) { |
|
439 | + $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column - 1); |
|
440 | 440 | $objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($styleData); |
441 | 441 | } |
442 | 442 | if ($columnWidth > '') { |
443 | 443 | if ($startCol == $endCol) { |
444 | - $startCol = PHPExcel_Cell::stringFromColumnIndex($startCol-1); |
|
444 | + $startCol = PHPExcel_Cell::stringFromColumnIndex($startCol - 1); |
|
445 | 445 | $objPHPExcel->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth); |
446 | 446 | } else { |
447 | - $startCol = PHPExcel_Cell::stringFromColumnIndex($startCol-1); |
|
448 | - $endCol = PHPExcel_Cell::stringFromColumnIndex($endCol-1); |
|
447 | + $startCol = PHPExcel_Cell::stringFromColumnIndex($startCol - 1); |
|
448 | + $endCol = PHPExcel_Cell::stringFromColumnIndex($endCol - 1); |
|
449 | 449 | $objPHPExcel->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth); |
450 | 450 | do { |
451 | 451 | $objPHPExcel->getActiveSheet()->getColumnDimension(++$startCol)->setWidth($columnWidth); |
@@ -453,13 +453,13 @@ discard block |
||
453 | 453 | } |
454 | 454 | } |
455 | 455 | } else { |
456 | - foreach($rowData as $rowDatum) { |
|
457 | - switch($rowDatum{0}) { |
|
456 | + foreach ($rowData as $rowDatum) { |
|
457 | + switch ($rowDatum{0}) { |
|
458 | 458 | case 'C' : |
459 | - case 'X' : $column = substr($rowDatum,1); |
|
459 | + case 'X' : $column = substr($rowDatum, 1); |
|
460 | 460 | break; |
461 | 461 | case 'R' : |
462 | - case 'Y' : $row = substr($rowDatum,1); |
|
462 | + case 'Y' : $row = substr($rowDatum, 1); |
|
463 | 463 | break; |
464 | 464 | } |
465 | 465 | } |
@@ -365,14 +365,22 @@ |
||
365 | 365 | foreach($cellReferences as $cellReference) { |
366 | 366 | $rowReference = $cellReference[2][0]; |
367 | 367 | // Empty R reference is the current row |
368 | - if ($rowReference == '') $rowReference = $row; |
|
368 | + if ($rowReference == '') { |
|
369 | + $rowReference = $row; |
|
370 | + } |
|
369 | 371 | // Bracketed R references are relative to the current row |
370 | - if ($rowReference{0} == '[') $rowReference = $row + trim($rowReference,'[]'); |
|
372 | + if ($rowReference{0} == '[') { |
|
373 | + $rowReference = $row + trim($rowReference,'[]'); |
|
374 | + } |
|
371 | 375 | $columnReference = $cellReference[4][0]; |
372 | 376 | // Empty C reference is the current column |
373 | - if ($columnReference == '') $columnReference = $column; |
|
377 | + if ($columnReference == '') { |
|
378 | + $columnReference = $column; |
|
379 | + } |
|
374 | 380 | // Bracketed C references are relative to the current column |
375 | - if ($columnReference{0} == '[') $columnReference = $column + trim($columnReference,'[]'); |
|
381 | + if ($columnReference{0} == '[') { |
|
382 | + $columnReference = $column + trim($columnReference,'[]'); |
|
383 | + } |
|
376 | 384 | $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference; |
377 | 385 | |
378 | 386 | $value = substr_replace($value,$A1CellReference,$cellReference[0][1],strlen($cellReference[0][0])); |
@@ -178,7 +178,7 @@ |
||
178 | 178 | /** |
179 | 179 | * Can the current PHPExcel_Reader_IReader read the file? |
180 | 180 | * |
181 | - * @param string $pFileName |
|
181 | + * @param string $pFilename |
|
182 | 182 | * @return boolean |
183 | 183 | * @throws Exception |
184 | 184 | */ |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | /** Constants */ |
39 | 39 | /** Regular Expressions */ |
40 | - const REFHELPER_REGEXP_CELLREF = '((\w*|\'[^!]*\')!)?(?<![:a-z\$])(\$?[a-z]{1,3}\$?\d+)(?=[^:!\d\'])'; |
|
40 | + const REFHELPER_REGEXP_CELLREF = '((\w*|\'[^!]*\')!)?(?<![:a-z\$])(\$?[a-z]{1,3}\$?\d+)(?=[^:!\d\'])'; |
|
41 | 41 | const REFHELPER_REGEXP_CELLRANGE = '((\w*|\'[^!]*\')!)?(\$?[a-z]{1,3}\$?\d+):(\$?[a-z]{1,3}\$?\d+)'; |
42 | 42 | const REFHELPER_REGEXP_ROWRANGE = '((\w*|\'[^!]*\')!)?(\$?\d+):(\$?\d+)'; |
43 | 43 | const REFHELPER_REGEXP_COLRANGE = '((\w*|\'[^!]*\')!)?(\$?[a-z]{1,3}):(\$?[a-z]{1,3})'; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @return PHPExcel_ReferenceHelper |
56 | 56 | */ |
57 | 57 | public static function getInstance() { |
58 | - if (!isset(self::$_instance) || (self::$_instance === NULL)) { |
|
58 | + if ( ! isset(self::$_instance) || (self::$_instance === NULL)) { |
|
59 | 59 | self::$_instance = new PHPExcel_ReferenceHelper(); |
60 | 60 | } |
61 | 61 | |
@@ -80,20 +80,20 @@ discard block |
||
80 | 80 | $aCellCollection = $pSheet->getCellCollection(); |
81 | 81 | |
82 | 82 | // Get coordinates of $pBefore |
83 | - $beforeColumn = 'A'; |
|
84 | - $beforeRow = 1; |
|
85 | - list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString( $pBefore ); |
|
83 | + $beforeColumn = 'A'; |
|
84 | + $beforeRow = 1; |
|
85 | + list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString($pBefore); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | // Clear cells if we are removing columns or rows |
89 | - $highestColumn = $pSheet->getHighestColumn(); |
|
90 | - $highestRow = $pSheet->getHighestRow(); |
|
89 | + $highestColumn = $pSheet->getHighestColumn(); |
|
90 | + $highestRow = $pSheet->getHighestRow(); |
|
91 | 91 | |
92 | 92 | // 1. Clear column strips if we are removing columns |
93 | 93 | if ($pNumCols < 0 && PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 + $pNumCols > 0) { |
94 | 94 | for ($i = 1; $i <= $highestRow - 1; ++$i) { |
95 | 95 | for ($j = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1 + $pNumCols; $j <= PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2; ++$j) { |
96 | - $coordinate = PHPExcel_Cell::stringFromColumnIndex($j) . $i; |
|
96 | + $coordinate = PHPExcel_Cell::stringFromColumnIndex($j).$i; |
|
97 | 97 | $pSheet->removeConditionalStyles($coordinate); |
98 | 98 | if ($pSheet->cellExists($coordinate)) { |
99 | 99 | $pSheet->getCell($coordinate)->setValueExplicit('', PHPExcel_Cell_DataType::TYPE_NULL); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | if ($pNumRows < 0 && $beforeRow - 1 + $pNumRows > 0) { |
108 | 108 | for ($i = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) { |
109 | 109 | for ($j = $beforeRow + $pNumRows; $j <= $beforeRow - 1; ++$j) { |
110 | - $coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . $j; |
|
110 | + $coordinate = PHPExcel_Cell::stringFromColumnIndex($i).$j; |
|
111 | 111 | $pSheet->removeConditionalStyles($coordinate); |
112 | 112 | if ($pSheet->cellExists($coordinate)) { |
113 | 113 | $pSheet->getCell($coordinate)->setValueExplicit('', PHPExcel_Cell_DataType::TYPE_NULL); |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | $cell = $pSheet->getCell($cellID); |
124 | 124 | |
125 | 125 | // New coordinates |
126 | - $newCoordinates = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1 + $pNumCols ) . ($cell->getRow() + $pNumRows); |
|
126 | + $newCoordinates = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1 + $pNumCols).($cell->getRow() + $pNumRows); |
|
127 | 127 | |
128 | 128 | // Should the cell be updated? Move value and cellXf index from one cell to another. |
129 | - if ((PHPExcel_Cell::columnIndexFromString( $cell->getColumn() ) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)) && |
|
129 | + if ((PHPExcel_Cell::columnIndexFromString($cell->getColumn()) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)) && |
|
130 | 130 | ($cell->getRow() >= $beforeRow)) { |
131 | 131 | |
132 | 132 | // Update cell styles |
@@ -161,14 +161,14 @@ discard block |
||
161 | 161 | |
162 | 162 | |
163 | 163 | // Duplicate styles for the newly inserted cells |
164 | - $highestColumn = $pSheet->getHighestColumn(); |
|
165 | - $highestRow = $pSheet->getHighestRow(); |
|
164 | + $highestColumn = $pSheet->getHighestColumn(); |
|
165 | + $highestRow = $pSheet->getHighestRow(); |
|
166 | 166 | |
167 | 167 | if ($pNumCols > 0 && PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 > 0) { |
168 | 168 | for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) { |
169 | 169 | |
170 | 170 | // Style |
171 | - $coordinate = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 ) . $i; |
|
171 | + $coordinate = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2).$i; |
|
172 | 172 | if ($pSheet->cellExists($coordinate)) { |
173 | 173 | $xfIndex = $pSheet->getCell($coordinate)->getXfIndex(); |
174 | 174 | $conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ? |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | foreach ($conditionalStyles as $conditionalStyle) { |
181 | 181 | $cloned[] = clone $conditionalStyle; |
182 | 182 | } |
183 | - $pSheet->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($j) . $i, $cloned); |
|
183 | + $pSheet->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($j).$i, $cloned); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
@@ -192,19 +192,19 @@ discard block |
||
192 | 192 | for ($i = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) { |
193 | 193 | |
194 | 194 | // Style |
195 | - $coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . ($beforeRow - 1); |
|
195 | + $coordinate = PHPExcel_Cell::stringFromColumnIndex($i).($beforeRow - 1); |
|
196 | 196 | if ($pSheet->cellExists($coordinate)) { |
197 | 197 | $xfIndex = $pSheet->getCell($coordinate)->getXfIndex(); |
198 | 198 | $conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ? |
199 | 199 | $pSheet->getConditionalStyles($coordinate) : false; |
200 | 200 | for ($j = $beforeRow; $j <= $beforeRow - 1 + $pNumRows; ++$j) { |
201 | - $pSheet->getCell(PHPExcel_Cell::stringFromColumnIndex($i) . $j)->setXfIndex($xfIndex); |
|
201 | + $pSheet->getCell(PHPExcel_Cell::stringFromColumnIndex($i).$j)->setXfIndex($xfIndex); |
|
202 | 202 | if ($conditionalStyles) { |
203 | 203 | $cloned = array(); |
204 | 204 | foreach ($conditionalStyles as $conditionalStyle) { |
205 | 205 | $cloned[] = clone $conditionalStyle; |
206 | 206 | } |
207 | - $pSheet->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($i) . $j, $cloned); |
|
207 | + $pSheet->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($i).$j, $cloned); |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | } |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | |
215 | 215 | // Update worksheet: column dimensions |
216 | 216 | $aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true); |
217 | - if (!empty($aColumnDimensions)) { |
|
217 | + if ( ! empty($aColumnDimensions)) { |
|
218 | 218 | foreach ($aColumnDimensions as $objColumnDimension) { |
219 | - $newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $pBefore, $pNumCols, $pNumRows); |
|
219 | + $newReference = $this->updateCellReference($objColumnDimension->getColumnIndex().'1', $pBefore, $pNumCols, $pNumRows); |
|
220 | 220 | list($newReference) = PHPExcel_Cell::coordinateFromString($newReference); |
221 | 221 | if ($objColumnDimension->getColumnIndex() != $newReference) { |
222 | 222 | $objColumnDimension->setColumnIndex($newReference); |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | |
229 | 229 | // Update worksheet: row dimensions |
230 | 230 | $aRowDimensions = array_reverse($pSheet->getRowDimensions(), true); |
231 | - if (!empty($aRowDimensions)) { |
|
231 | + if ( ! empty($aRowDimensions)) { |
|
232 | 232 | foreach ($aRowDimensions as $objRowDimension) { |
233 | - $newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows); |
|
233 | + $newReference = $this->updateCellReference('A'.$objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows); |
|
234 | 234 | list(, $newReference) = PHPExcel_Cell::coordinateFromString($newReference); |
235 | 235 | if ($objRowDimension->getRowIndex() != $newReference) { |
236 | 236 | $objRowDimension->setRowIndex($newReference); |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | foreach ($aBreaks as $key => $value) { |
255 | 255 | $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); |
256 | 256 | if ($key != $newReference) { |
257 | - $pSheet->setBreak( $newReference, $value ); |
|
258 | - $pSheet->setBreak( $key, PHPExcel_Worksheet::BREAK_NONE ); |
|
257 | + $pSheet->setBreak($newReference, $value); |
|
258 | + $pSheet->setBreak($key, PHPExcel_Worksheet::BREAK_NONE); |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | |
@@ -273,8 +273,8 @@ discard block |
||
273 | 273 | foreach ($aHyperlinkCollection as $key => $value) { |
274 | 274 | $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); |
275 | 275 | if ($key != $newReference) { |
276 | - $pSheet->setHyperlink( $newReference, $value ); |
|
277 | - $pSheet->setHyperlink( $key, null ); |
|
276 | + $pSheet->setHyperlink($newReference, $value); |
|
277 | + $pSheet->setHyperlink($key, null); |
|
278 | 278 | } |
279 | 279 | } |
280 | 280 | |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | foreach ($aDataValidationCollection as $key => $value) { |
285 | 285 | $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); |
286 | 286 | if ($key != $newReference) { |
287 | - $pSheet->setDataValidation( $newReference, $value ); |
|
288 | - $pSheet->setDataValidation( $key, null ); |
|
287 | + $pSheet->setDataValidation($newReference, $value); |
|
288 | + $pSheet->setDataValidation($key, null); |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
@@ -305,27 +305,27 @@ discard block |
||
305 | 305 | foreach ($aProtectedCells as $key => $value) { |
306 | 306 | $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); |
307 | 307 | if ($key != $newReference) { |
308 | - $pSheet->protectCells( $newReference, $value, true ); |
|
309 | - $pSheet->unprotectCells( $key ); |
|
308 | + $pSheet->protectCells($newReference, $value, true); |
|
309 | + $pSheet->unprotectCells($key); |
|
310 | 310 | } |
311 | 311 | } |
312 | 312 | |
313 | 313 | |
314 | 314 | // Update worksheet: autofilter |
315 | 315 | if ($pSheet->getAutoFilter() != '') { |
316 | - $pSheet->setAutoFilter( $this->updateCellReference($pSheet->getAutoFilter(), $pBefore, $pNumCols, $pNumRows) ); |
|
316 | + $pSheet->setAutoFilter($this->updateCellReference($pSheet->getAutoFilter(), $pBefore, $pNumCols, $pNumRows)); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | |
320 | 320 | // Update worksheet: freeze pane |
321 | 321 | if ($pSheet->getFreezePane() != '') { |
322 | - $pSheet->freezePane( $this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows) ); |
|
322 | + $pSheet->freezePane($this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows)); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
326 | 326 | // Page setup |
327 | 327 | if ($pSheet->getPageSetup()->isPrintAreaSet()) { |
328 | - $pSheet->getPageSetup()->setPrintArea( $this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows) ); |
|
328 | + $pSheet->getPageSetup()->setPrintArea($this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows)); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
@@ -366,29 +366,29 @@ discard block |
||
366 | 366 | */ |
367 | 367 | public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') { |
368 | 368 | // Update cell references in the formula |
369 | - $formulaBlocks = explode('"',$pFormula); |
|
369 | + $formulaBlocks = explode('"', $pFormula); |
|
370 | 370 | $i = false; |
371 | - foreach($formulaBlocks as &$formulaBlock) { |
|
371 | + foreach ($formulaBlocks as &$formulaBlock) { |
|
372 | 372 | // Ignore blocks that were enclosed in quotes (alternating entries in the $formulaBlocks array after the explode) |
373 | - if ($i = !$i) { |
|
373 | + if ($i = ! $i) { |
|
374 | 374 | $adjustCount = 0; |
375 | 375 | $newCellTokens = $cellTokens = array(); |
376 | 376 | // Search for row ranges (e.g. 'Sheet1'!3:5 or 3:5) with or without $ absolutes (e.g. $3:5) |
377 | 377 | $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_ROWRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); |
378 | 378 | if ($matchCount > 0) { |
379 | - foreach($matches as $match) { |
|
379 | + foreach ($matches as $match) { |
|
380 | 380 | $fromString = ($match[2] > '') ? $match[2].'!' : ''; |
381 | 381 | $fromString .= $match[3].':'.$match[4]; |
382 | - $modified3 = substr($this->updateCellReference('$A'.$match[3],$pBefore,$pNumCols,$pNumRows),2); |
|
383 | - $modified4 = substr($this->updateCellReference('$A'.$match[4],$pBefore,$pNumCols,$pNumRows),2); |
|
382 | + $modified3 = substr($this->updateCellReference('$A'.$match[3], $pBefore, $pNumCols, $pNumRows), 2); |
|
383 | + $modified4 = substr($this->updateCellReference('$A'.$match[4], $pBefore, $pNumCols, $pNumRows), 2); |
|
384 | 384 | |
385 | 385 | if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) { |
386 | - if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) { |
|
386 | + if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { |
|
387 | 387 | $toString = ($match[2] > '') ? $match[2].'!' : ''; |
388 | 388 | $toString .= $modified3.':'.$modified4; |
389 | 389 | // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more |
390 | 390 | $column = 100000; |
391 | - $row = 10000000+trim($match[3],'$'); |
|
391 | + $row = 10000000 + trim($match[3], '$'); |
|
392 | 392 | $cellIndex = $column.$row; |
393 | 393 | |
394 | 394 | $newCellTokens[$cellIndex] = preg_quote($toString); |
@@ -401,18 +401,18 @@ discard block |
||
401 | 401 | // Search for column ranges (e.g. 'Sheet1'!C:E or C:E) with or without $ absolutes (e.g. $C:E) |
402 | 402 | $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_COLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); |
403 | 403 | if ($matchCount > 0) { |
404 | - foreach($matches as $match) { |
|
404 | + foreach ($matches as $match) { |
|
405 | 405 | $fromString = ($match[2] > '') ? $match[2].'!' : ''; |
406 | 406 | $fromString .= $match[3].':'.$match[4]; |
407 | - $modified3 = substr($this->updateCellReference($match[3].'$1',$pBefore,$pNumCols,$pNumRows),0,-2); |
|
408 | - $modified4 = substr($this->updateCellReference($match[4].'$1',$pBefore,$pNumCols,$pNumRows),0,-2); |
|
407 | + $modified3 = substr($this->updateCellReference($match[3].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2); |
|
408 | + $modified4 = substr($this->updateCellReference($match[4].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2); |
|
409 | 409 | |
410 | 410 | if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) { |
411 | - if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) { |
|
411 | + if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { |
|
412 | 412 | $toString = ($match[2] > '') ? $match[2].'!' : ''; |
413 | 413 | $toString .= $modified3.':'.$modified4; |
414 | 414 | // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more |
415 | - $column = PHPExcel_Cell::columnIndexFromString(trim($match[3],'$')) + 100000; |
|
415 | + $column = PHPExcel_Cell::columnIndexFromString(trim($match[3], '$')) + 100000; |
|
416 | 416 | $row = 10000000; |
417 | 417 | $cellIndex = $column.$row; |
418 | 418 | |
@@ -426,20 +426,20 @@ discard block |
||
426 | 426 | // Search for cell ranges (e.g. 'Sheet1'!A3:C5 or A3:C5) with or without $ absolutes (e.g. $A1:C$5) |
427 | 427 | $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); |
428 | 428 | if ($matchCount > 0) { |
429 | - foreach($matches as $match) { |
|
429 | + foreach ($matches as $match) { |
|
430 | 430 | $fromString = ($match[2] > '') ? $match[2].'!' : ''; |
431 | 431 | $fromString .= $match[3].':'.$match[4]; |
432 | - $modified3 = $this->updateCellReference($match[3],$pBefore,$pNumCols,$pNumRows); |
|
433 | - $modified4 = $this->updateCellReference($match[4],$pBefore,$pNumCols,$pNumRows); |
|
432 | + $modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows); |
|
433 | + $modified4 = $this->updateCellReference($match[4], $pBefore, $pNumCols, $pNumRows); |
|
434 | 434 | |
435 | 435 | if ($match[3].$match[4] !== $modified3.$modified4) { |
436 | - if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) { |
|
436 | + if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { |
|
437 | 437 | $toString = ($match[2] > '') ? $match[2].'!' : ''; |
438 | 438 | $toString .= $modified3.':'.$modified4; |
439 | - list($column,$row) = PHPExcel_Cell::coordinateFromString($match[3]); |
|
439 | + list($column, $row) = PHPExcel_Cell::coordinateFromString($match[3]); |
|
440 | 440 | // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more |
441 | - $column = PHPExcel_Cell::columnIndexFromString(trim($column,'$')) + 100000; |
|
442 | - $row = trim($row,'$') + 10000000; |
|
441 | + $column = PHPExcel_Cell::columnIndexFromString(trim($column, '$')) + 100000; |
|
442 | + $row = trim($row, '$') + 10000000; |
|
443 | 443 | $cellIndex = $column.$row; |
444 | 444 | |
445 | 445 | $newCellTokens[$cellIndex] = preg_quote($toString); |
@@ -452,19 +452,19 @@ discard block |
||
452 | 452 | // Search for cell references (e.g. 'Sheet1'!A3 or C5) with or without $ absolutes (e.g. $A1 or C$5) |
453 | 453 | $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLREF.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); |
454 | 454 | if ($matchCount > 0) { |
455 | - foreach($matches as $match) { |
|
455 | + foreach ($matches as $match) { |
|
456 | 456 | $fromString = ($match[2] > '') ? $match[2].'!' : ''; |
457 | 457 | $fromString .= $match[3]; |
458 | - $modified3 = $this->updateCellReference($match[3],$pBefore,$pNumCols,$pNumRows); |
|
458 | + $modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows); |
|
459 | 459 | |
460 | 460 | if ($match[3] !== $modified3) { |
461 | - if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) { |
|
461 | + if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { |
|
462 | 462 | $toString = ($match[2] > '') ? $match[2].'!' : ''; |
463 | 463 | $toString .= $modified3; |
464 | - list($column,$row) = PHPExcel_Cell::coordinateFromString($match[3]); |
|
464 | + list($column, $row) = PHPExcel_Cell::coordinateFromString($match[3]); |
|
465 | 465 | // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more |
466 | - $column = PHPExcel_Cell::columnIndexFromString(trim($column,'$')) + 100000; |
|
467 | - $row = trim($row,'$') + 10000000; |
|
466 | + $column = PHPExcel_Cell::columnIndexFromString(trim($column, '$')) + 100000; |
|
467 | + $row = trim($row, '$') + 10000000; |
|
468 | 468 | $cellIndex = $column.$row; |
469 | 469 | |
470 | 470 | $newCellTokens[$cellIndex] = preg_quote($toString); |
@@ -478,14 +478,14 @@ discard block |
||
478 | 478 | krsort($cellTokens); |
479 | 479 | krsort($newCellTokens); |
480 | 480 | // Update cell references in the formula |
481 | - $formulaBlock = str_replace('\\','',preg_replace($cellTokens,$newCellTokens,$formulaBlock)); |
|
481 | + $formulaBlock = str_replace('\\', '', preg_replace($cellTokens, $newCellTokens, $formulaBlock)); |
|
482 | 482 | } |
483 | 483 | } |
484 | 484 | } |
485 | 485 | unset($formulaBlock); |
486 | 486 | |
487 | 487 | // Then rebuild the formula string |
488 | - return implode('"',$formulaBlocks); |
|
488 | + return implode('"', $formulaBlocks); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | /** |
@@ -533,8 +533,8 @@ discard block |
||
533 | 533 | if (($cell !== NULL) && ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA)) { |
534 | 534 | $formula = $cell->getValue(); |
535 | 535 | if (strpos($formula, $oldName) !== false) { |
536 | - $formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula); |
|
537 | - $formula = str_replace($oldName . "!", $newName . "!", $formula); |
|
536 | + $formula = str_replace("'".$oldName."'!", "'".$newName."'!", $formula); |
|
537 | + $formula = str_replace($oldName."!", $newName."!", $formula); |
|
538 | 538 | $cell->setValueExplicit($formula, PHPExcel_Cell_DataType::TYPE_FORMULA); |
539 | 539 | } |
540 | 540 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | * @throws Exception |
554 | 554 | */ |
555 | 555 | private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) { |
556 | - if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) { |
|
556 | + if (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) { |
|
557 | 557 | // Update range |
558 | 558 | $range = PHPExcel_Cell::splitRange($pCellRange); |
559 | 559 | $ic = count($range); |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | if (ctype_alpha($range[$i][$j])) { |
564 | 564 | $r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows)); |
565 | 565 | $range[$i][$j] = $r[0]; |
566 | - } elseif(ctype_digit($range[$i][$j])) { |
|
566 | + } elseif (ctype_digit($range[$i][$j])) { |
|
567 | 567 | $r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows)); |
568 | 568 | $range[$i][$j] = $r[1]; |
569 | 569 | } else { |
@@ -592,10 +592,10 @@ discard block |
||
592 | 592 | private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) { |
593 | 593 | if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) { |
594 | 594 | // Get coordinates of $pBefore |
595 | - list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString( $pBefore ); |
|
595 | + list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString($pBefore); |
|
596 | 596 | |
597 | 597 | // Get coordinates of $pCellReference |
598 | - list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString( $pCellReference ); |
|
598 | + list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString($pCellReference); |
|
599 | 599 | |
600 | 600 | // Verify which parts should be updated |
601 | 601 | $updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') && |
@@ -606,16 +606,16 @@ discard block |
||
606 | 606 | |
607 | 607 | // Create new column reference |
608 | 608 | if ($updateColumn) { |
609 | - $newColumn = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($newColumn) - 1 + $pNumCols ); |
|
609 | + $newColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($newColumn) - 1 + $pNumCols); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | // Create new row reference |
613 | 613 | if ($updateRow) { |
614 | - $newRow = $newRow + $pNumRows; |
|
614 | + $newRow = $newRow + $pNumRows; |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | // Return new reference |
618 | - return $newColumn . $newRow; |
|
618 | + return $newColumn.$newRow; |
|
619 | 619 | } else { |
620 | 620 | throw new Exception("Only single cell references may be passed to this method."); |
621 | 621 | } |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | */ |
27 | 27 | |
28 | 28 | /** PHPExcel root directory */ |
29 | -if (!defined('PHPEXCEL_ROOT')) { |
|
29 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
30 | 30 | /** |
31 | 31 | * @ignore |
32 | 32 | */ |
33 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); |
|
34 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
33 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../'); |
|
34 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -39,15 +39,15 @@ discard block |
||
39 | 39 | { |
40 | 40 | /** constants */ |
41 | 41 | /** Available Zip library classes */ |
42 | - const PCLZIP = 'PHPExcel_Shared_ZipArchive'; |
|
43 | - const ZIPARCHIVE = 'ZipArchive'; |
|
42 | + const PCLZIP = 'PHPExcel_Shared_ZipArchive'; |
|
43 | + const ZIPARCHIVE = 'ZipArchive'; |
|
44 | 44 | |
45 | 45 | /** Optional Chart Rendering libraries */ |
46 | - const CHART_RENDERER_JPGRAPH = 'jpgraph'; |
|
46 | + const CHART_RENDERER_JPGRAPH = 'jpgraph'; |
|
47 | 47 | |
48 | 48 | /** Optional PDF Rendering libraries */ |
49 | 49 | const PDF_RENDERER_TCPDF = 'tcpdf'; |
50 | - const PDF_RENDERER_DOMPDF = 'dompdf'; |
|
50 | + const PDF_RENDERER_DOMPDF = 'dompdf'; |
|
51 | 51 | const PDF_RENDERER_MPDF = 'mpdf'; |
52 | 52 | |
53 | 53 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @var string |
71 | 71 | */ |
72 | - private static $_zipClass = self::ZIPARCHIVE; |
|
72 | + private static $_zipClass = self::ZIPARCHIVE; |
|
73 | 73 | |
74 | 74 | |
75 | 75 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @param string $locale The locale code to use (e.g. "fr" or "pt_br" or "en_uk") |
176 | 176 | * @return boolean Success or failure |
177 | 177 | */ |
178 | - public static function setLocale($locale='en_us') { |
|
178 | + public static function setLocale($locale = 'en_us') { |
|
179 | 179 | return PHPExcel_Calculation::getInstance()->setLocale($locale); |
180 | 180 | } // function setLocale() |
181 | 181 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @return boolean Success or failure |
190 | 190 | */ |
191 | 191 | public static function setChartRenderer($libraryName, $libraryBaseDir) { |
192 | - if (!self::setChartRendererName($libraryName)) |
|
192 | + if ( ! self::setChartRendererName($libraryName)) |
|
193 | 193 | return FALSE; |
194 | 194 | return self::setChartRendererPath($libraryBaseDir); |
195 | 195 | } // function setChartRenderer() |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return boolean Success or failure |
204 | 204 | */ |
205 | 205 | public static function setChartRendererName($libraryName) { |
206 | - if (!in_array($libraryName,self::$_chartRenderers)) { |
|
206 | + if ( ! in_array($libraryName, self::$_chartRenderers)) { |
|
207 | 207 | return FALSE; |
208 | 208 | } |
209 | 209 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @return boolean Success or failure |
261 | 261 | */ |
262 | 262 | public static function setPdfRenderer($libraryName, $libraryBaseDir) { |
263 | - if (!self::setPdfRendererName($libraryName)) |
|
263 | + if ( ! self::setPdfRendererName($libraryName)) |
|
264 | 264 | return FALSE; |
265 | 265 | return self::setPdfRendererPath($libraryBaseDir); |
266 | 266 | } // function setPdfRenderer() |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @return boolean Success or failure |
277 | 277 | */ |
278 | 278 | public static function setPdfRendererName($libraryName) { |
279 | - if (!in_array($libraryName,self::$_pdfRenderers)) { |
|
279 | + if ( ! in_array($libraryName, self::$_pdfRenderers)) { |
|
280 | 280 | return FALSE; |
281 | 281 | } |
282 | 282 |
@@ -189,8 +189,9 @@ discard block |
||
189 | 189 | * @return boolean Success or failure |
190 | 190 | */ |
191 | 191 | public static function setChartRenderer($libraryName, $libraryBaseDir) { |
192 | - if (!self::setChartRendererName($libraryName)) |
|
193 | - return FALSE; |
|
192 | + if (!self::setChartRendererName($libraryName)) { |
|
193 | + return FALSE; |
|
194 | + } |
|
194 | 195 | return self::setChartRendererPath($libraryBaseDir); |
195 | 196 | } // function setChartRenderer() |
196 | 197 | |
@@ -260,8 +261,9 @@ discard block |
||
260 | 261 | * @return boolean Success or failure |
261 | 262 | */ |
262 | 263 | public static function setPdfRenderer($libraryName, $libraryBaseDir) { |
263 | - if (!self::setPdfRendererName($libraryName)) |
|
264 | - return FALSE; |
|
264 | + if (!self::setPdfRendererName($libraryName)) { |
|
265 | + return FALSE; |
|
266 | + } |
|
265 | 267 | return self::setPdfRendererPath($libraryBaseDir); |
266 | 268 | } // function setPdfRenderer() |
267 | 269 |
@@ -43,12 +43,12 @@ |
||
43 | 43 | const ZIPARCHIVE = 'ZipArchive'; |
44 | 44 | |
45 | 45 | /** Optional Chart Rendering libraries */ |
46 | - const CHART_RENDERER_JPGRAPH = 'jpgraph'; |
|
46 | + const CHART_RENDERER_JPGRAPH = 'jpgraph'; |
|
47 | 47 | |
48 | 48 | /** Optional PDF Rendering libraries */ |
49 | - const PDF_RENDERER_TCPDF = 'tcpdf'; |
|
50 | - const PDF_RENDERER_DOMPDF = 'dompdf'; |
|
51 | - const PDF_RENDERER_MPDF = 'mpdf'; |
|
49 | + const PDF_RENDERER_TCPDF = 'tcpdf'; |
|
50 | + const PDF_RENDERER_DOMPDF = 'dompdf'; |
|
51 | + const PDF_RENDERER_MPDF = 'mpdf'; |
|
52 | 52 | |
53 | 53 | |
54 | 54 | private static $_chartRenderers = array( |