Version Description
- Improved: Allow WEBP file format.
- Improved: Bulk actions for all images except one.
- Fixed: Images duplication in Add Images popup.
- Fixed: See all tags button after load more.
- Fixed: Masonry and Mosaic layouts with 10Web builder theme.
- Fixed: Instagram images ordering.
- Fixed: Scroll to gallery with enabled dynamic url.
- Fixed: Thumbnail resolution in some cases.
Download this release
Release Info
Developer | 10web |
Plugin | Photo Gallery by WD – Responsive Photo Gallery |
Version | 1.6.4 |
Comparing to | |
See all releases |
Code changes from version 1.6.3 to 1.6.4
- admin/controllers/Albums.php +23 -10
- admin/controllers/Galleries.php +42 -23
- admin/models/Albums.php +41 -19
- admin/models/Galleries.php +170 -40
- admin/views/Albums.php +2 -1
- admin/views/Editimage.php +75 -0
- admin/views/Galleries.php +2 -0
- admin/views/Options.php +119 -119
- filemanager/UploadHandler.php +16 -23
- filemanager/controller.php +2 -4
- filemanager/js/default.js +5 -2
- filemanager/view.php +1 -1
- framework/BWGOptions.php +2 -2
- framework/WDWLibrary.php +94 -31
- framework/WDWLibraryEmbed.php +1 -1
- frontend/controllers/controller.php +6 -0
- frontend/models/BWGModelGalleryBox.php +1 -3
- frontend/views/BWGViewThumbnails.php +1 -1
- frontend/views/view.php +1 -0
- js/bwg.js +84 -20
- js/bwg_embed.js +1 -1
- js/bwg_frontend.js +98 -152
- js/scripts.min.js +1 -1
- library/composer.json +5 -0
- library/composer.lock +243 -0
- library/vendor/autoload.php +7 -0
- library/vendor/composer/ClassLoader.php +445 -0
- library/vendor/composer/LICENSE +21 -0
- library/vendor/composer/autoload_classmap.php +9 -0
- library/vendor/composer/autoload_namespaces.php +9 -0
- library/vendor/composer/autoload_psr4.php +12 -0
- library/vendor/composer/autoload_real.php +55 -0
- library/vendor/composer/autoload_static.php +44 -0
- library/vendor/composer/installed.json +234 -0
- library/vendor/nelexa/zip/.phpstorm.meta.php +128 -0
- library/vendor/nelexa/zip/LICENSE +21 -0
- library/vendor/nelexa/zip/README.RU.md +816 -0
- library/vendor/nelexa/zip/README.md +832 -0
- library/vendor/nelexa/zip/composer.json +60 -0
- library/vendor/nelexa/zip/src/Constants/DosAttrs.php +33 -0
- library/vendor/nelexa/zip/src/Constants/DosCodePage.php +105 -0
- library/vendor/nelexa/zip/src/Constants/GeneralPurposeBitFlag.php +71 -0
- library/vendor/nelexa/zip/src/Constants/UnixStat.php +84 -0
- library/vendor/nelexa/zip/src/Constants/ZipCompressionLevel.php +54 -0
- library/vendor/nelexa/zip/src/Constants/ZipCompressionMethod.php +102 -0
- library/vendor/nelexa/zip/src/Constants/ZipConstants.php +99 -0
- library/vendor/nelexa/zip/src/Constants/ZipEncryptionMethod.php +93 -0
- library/vendor/nelexa/zip/src/Constants/ZipOptions.php +62 -0
- library/vendor/nelexa/zip/src/Constants/ZipPlatform.php +53 -0
- library/vendor/nelexa/zip/src/Constants/ZipVersion.php +81 -0
- library/vendor/nelexa/zip/src/Exception/Crc32Exception.php +71 -0
- library/vendor/nelexa/zip/src/Exception/InvalidArgumentException.php +14 -0
- library/vendor/nelexa/zip/src/Exception/RuntimeException.php +14 -0
- library/vendor/nelexa/zip/src/Exception/ZipAuthenticationException.php +13 -0
- library/vendor/nelexa/zip/src/Exception/ZipCryptoException.php +14 -0
- library/vendor/nelexa/zip/src/Exception/ZipEntryNotFoundException.php +40 -0
- library/vendor/nelexa/zip/src/Exception/ZipException.php +15 -0
- library/vendor/nelexa/zip/src/Exception/ZipUnsupportMethodException.php +10 -0
- library/vendor/nelexa/zip/src/IO/Filter/Cipher/Pkware/PKCryptContext.php +419 -0
- library/vendor/nelexa/zip/src/IO/Filter/Cipher/Pkware/PKDecryptionStreamFilter.php +118 -0
- library/vendor/nelexa/zip/src/IO/Filter/Cipher/Pkware/PKEncryptionStreamFilter.php +128 -0
- library/vendor/nelexa/zip/src/IO/Filter/Cipher/WinZipAes/WinZipAesContext.php +166 -0
- library/vendor/nelexa/zip/src/IO/Filter/Cipher/WinZipAes/WinZipAesDecryptionStreamFilter.php +187 -0
- library/vendor/nelexa/zip/src/IO/Filter/Cipher/WinZipAes/WinZipAesEncryptionStreamFilter.php +158 -0
- library/vendor/nelexa/zip/src/IO/Stream/ResponseStream.php +338 -0
- library/vendor/nelexa/zip/src/IO/Stream/ZipEntryStreamWrapper.php +309 -0
- library/vendor/nelexa/zip/src/IO/ZipReader.php +898 -0
- library/vendor/nelexa/zip/src/IO/ZipWriter.php +886 -0
- library/vendor/nelexa/zip/src/Model/Data/ZipFileData.php +81 -0
- library/vendor/nelexa/zip/src/Model/Data/ZipNewData.php +132 -0
- library/vendor/nelexa/zip/src/Model/Data/ZipSourceFileData.php +172 -0
- library/vendor/nelexa/zip/src/Model/EndOfCentralDirectory.php +93 -0
- library/vendor/nelexa/zip/src/Model/Extra/ExtraFieldsCollection.php +276 -0
- library/vendor/nelexa/zip/src/Model/Extra/Fields/AbstractUnicodeExtraField.php +133 -0
- library/vendor/nelexa/zip/src/Model/Extra/Fields/ApkAlignmentExtraField.php +176 -0
- library/vendor/nelexa/zip/src/Model/Extra/Fields/AsiExtraField.php +302 -0
- library/vendor/nelexa/zip/src/Model/Extra/Fields/ExtendedTimestampExtraField.php +446 -0
- library/vendor/nelexa/zip/src/Model/Extra/Fields/JarMarkerExtraField.php +118 -0
- library/vendor/nelexa/zip/src/Model/Extra/Fields/NewUnixExtraField.php +237 -0
- library/vendor/nelexa/zip/src/Model/Extra/Fields/NtfsExtraField.php +339 -0
- library/vendor/nelexa/zip/src/Model/Extra/Fields/OldUnixExtraField.php +327 -0
- library/vendor/nelexa/zip/src/Model/Extra/Fields/UnicodeCommentExtraField.php +76 -0
- library/vendor/nelexa/zip/src/Model/Extra/Fields/UnicodePathExtraField.php +77 -0
- library/vendor/nelexa/zip/src/Model/Extra/Fields/UnrecognizedExtraField.php +116 -0
- library/vendor/nelexa/zip/src/Model/Extra/Fields/WinZipAesExtraField.php +387 -0
- library/vendor/nelexa/zip/src/Model/Extra/Fields/Zip64ExtraField.php +311 -0
- library/vendor/nelexa/zip/src/Model/Extra/ZipExtraDriver.php +107 -0
- library/vendor/nelexa/zip/src/Model/Extra/ZipExtraField.php +63 -0
- library/vendor/nelexa/zip/src/Model/ImmutableZipContainer.php +72 -0
- library/vendor/nelexa/zip/src/Model/ZipContainer.php +386 -0
- library/vendor/nelexa/zip/src/Model/ZipData.php +28 -0
- library/vendor/nelexa/zip/src/Model/ZipEntry.php +1573 -0
- library/vendor/nelexa/zip/src/Model/ZipEntryMatcher.php +206 -0
- library/vendor/nelexa/zip/src/Model/ZipInfo.php +266 -0
- library/vendor/nelexa/zip/src/Util/CryptoUtil.php +77 -0
- library/vendor/nelexa/zip/src/Util/DateTimeConverter.php +99 -0
- library/vendor/nelexa/zip/src/Util/FileAttribUtil.php +108 -0
- library/vendor/nelexa/zip/src/Util/FilesUtil.php +147 -0
admin/controllers/Albums.php
CHANGED
@@ -150,7 +150,9 @@ class AlbumsController_bwg {
|
|
150 |
|
151 |
if (method_exists($this, $task)) {
|
152 |
if ($all) {
|
153 |
-
$
|
|
|
|
|
154 |
$url_arg['message'] = $message;
|
155 |
}
|
156 |
else {
|
@@ -245,11 +247,12 @@ class AlbumsController_bwg {
|
|
245 |
* @param $id
|
246 |
* @param bool $bulk
|
247 |
* @param bool $all
|
|
|
248 |
*
|
249 |
* @return int
|
250 |
*/
|
251 |
-
public function delete( $id, $bulk = FALSE, $all = FALSE ) {
|
252 |
-
$message = $this->model->delete($id, $all);
|
253 |
if ($bulk) {
|
254 |
return $message;
|
255 |
}
|
@@ -266,15 +269,20 @@ class AlbumsController_bwg {
|
|
266 |
* @param $id
|
267 |
* @param bool $bulk
|
268 |
* @param bool $all
|
|
|
269 |
*
|
270 |
* @return int
|
271 |
*/
|
272 |
-
public function publish( $id, $bulk = FALSE, $all = FALSE ) {
|
273 |
global $wpdb;
|
274 |
$where = ($all ? '' : ' WHERE id=%d');
|
275 |
if ( $where != '' ) {
|
276 |
$updated = $wpdb->query($wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_album` SET published=1' . $where, $id));
|
277 |
-
}
|
|
|
|
|
|
|
|
|
278 |
$updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_album` SET published=1' . $where);
|
279 |
}
|
280 |
$message = 2;
|
@@ -299,17 +307,21 @@ class AlbumsController_bwg {
|
|
299 |
* @param $id
|
300 |
* @param bool $bulk
|
301 |
* @param bool $all
|
|
|
302 |
*
|
303 |
* @return int
|
304 |
*/
|
305 |
-
public function unpublish( $id, $bulk = FALSE, $all = FALSE ) {
|
306 |
global $wpdb;
|
307 |
$where = ($all ? '' : ' WHERE id=%d');
|
308 |
if ( $where != '' ) {
|
309 |
$updated = $wpdb->query($wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_album` SET published=0' . $where, $id));
|
310 |
-
}
|
|
|
|
|
|
|
|
|
311 |
$updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_album` SET published=0' . $where);
|
312 |
-
|
313 |
}
|
314 |
$message = 2;
|
315 |
if ($updated) {
|
@@ -333,11 +345,12 @@ class AlbumsController_bwg {
|
|
333 |
* @param $id
|
334 |
* @param bool $bulk
|
335 |
* @param bool $all
|
|
|
336 |
*
|
337 |
* @return int
|
338 |
*/
|
339 |
-
public function duplicate( $id, $bulk = FALSE, $all = FALSE ) {
|
340 |
-
$message_id = $this->model->duplicate($id, $all);
|
341 |
if ($bulk) {
|
342 |
return $message_id;
|
343 |
}
|
150 |
|
151 |
if (method_exists($this, $task)) {
|
152 |
if ($all) {
|
153 |
+
$get_excludeIds = WDWLibrary::get('ids_exclude', FALSE);
|
154 |
+
$excludeIds = ( !empty($get_excludeIds) ) ? explode(',', $get_excludeIds) : array();
|
155 |
+
$message = $this->$task( 0, TRUE, TRUE, $excludeIds );
|
156 |
$url_arg['message'] = $message;
|
157 |
}
|
158 |
else {
|
247 |
* @param $id
|
248 |
* @param bool $bulk
|
249 |
* @param bool $all
|
250 |
+
* @param array $excludeIds
|
251 |
*
|
252 |
* @return int
|
253 |
*/
|
254 |
+
public function delete( $id, $bulk = FALSE, $all = FALSE, $excludeIds = array() ) {
|
255 |
+
$message = $this->model->delete( $id, $all, $excludeIds );
|
256 |
if ($bulk) {
|
257 |
return $message;
|
258 |
}
|
269 |
* @param $id
|
270 |
* @param bool $bulk
|
271 |
* @param bool $all
|
272 |
+
* @param array $excludeIds
|
273 |
*
|
274 |
* @return int
|
275 |
*/
|
276 |
+
public function publish( $id, $bulk = FALSE, $all = FALSE, $excludeIds = array() ) {
|
277 |
global $wpdb;
|
278 |
$where = ($all ? '' : ' WHERE id=%d');
|
279 |
if ( $where != '' ) {
|
280 |
$updated = $wpdb->query($wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_album` SET published=1' . $where, $id));
|
281 |
+
}
|
282 |
+
else {
|
283 |
+
if ( !empty($excludeIds) ) {
|
284 |
+
$where = ' WHERE `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
285 |
+
}
|
286 |
$updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_album` SET published=1' . $where);
|
287 |
}
|
288 |
$message = 2;
|
307 |
* @param $id
|
308 |
* @param bool $bulk
|
309 |
* @param bool $all
|
310 |
+
* @param array $excludeIds
|
311 |
*
|
312 |
* @return int
|
313 |
*/
|
314 |
+
public function unpublish( $id, $bulk = FALSE, $all = FALSE, $excludeIds = array() ) {
|
315 |
global $wpdb;
|
316 |
$where = ($all ? '' : ' WHERE id=%d');
|
317 |
if ( $where != '' ) {
|
318 |
$updated = $wpdb->query($wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_album` SET published=0' . $where, $id));
|
319 |
+
}
|
320 |
+
else {
|
321 |
+
if ( !empty($excludeIds) ) {
|
322 |
+
$where = ' WHERE `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
323 |
+
}
|
324 |
$updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_album` SET published=0' . $where);
|
|
|
325 |
}
|
326 |
$message = 2;
|
327 |
if ($updated) {
|
345 |
* @param $id
|
346 |
* @param bool $bulk
|
347 |
* @param bool $all
|
348 |
+
* @param array $excludeIds
|
349 |
*
|
350 |
* @return int
|
351 |
*/
|
352 |
+
public function duplicate( $id, $bulk = FALSE, $all = FALSE, $excludeIds = array() ) {
|
353 |
+
$message_id = $this->model->duplicate( $id, $all, $excludeIds );
|
354 |
if ($bulk) {
|
355 |
return $message_id;
|
356 |
}
|
admin/controllers/Galleries.php
CHANGED
@@ -159,7 +159,9 @@ class GalleriesController_bwg {
|
|
159 |
|
160 |
if ( method_exists($this, $task) ) {
|
161 |
if ( $all ) {
|
162 |
-
$
|
|
|
|
|
163 |
$url_arg['message'] = $message;
|
164 |
}
|
165 |
else {
|
@@ -189,21 +191,21 @@ class GalleriesController_bwg {
|
|
189 |
* @param $id
|
190 |
* @param bool $bulk
|
191 |
* @param bool $all
|
|
|
192 |
*
|
193 |
* @return int
|
194 |
*/
|
195 |
-
public function delete( $id, $bulk = FALSE, $all = FALSE ) {
|
196 |
-
$message = $this->model->delete($id, $all);
|
197 |
-
|
198 |
if ( $bulk ) {
|
199 |
return $message;
|
200 |
}
|
201 |
|
202 |
-
WDWLibrary::redirect(add_query_arg(array(
|
203 |
'page' => $this->page,
|
204 |
'task' => 'display',
|
205 |
'message' => $message,
|
206 |
-
), admin_url('admin.php')));
|
207 |
}
|
208 |
|
209 |
/**
|
@@ -212,19 +214,24 @@ class GalleriesController_bwg {
|
|
212 |
* @param $id
|
213 |
* @param bool $bulk
|
214 |
* @param bool $all
|
|
|
215 |
*
|
216 |
* @return int
|
217 |
*/
|
218 |
-
public function publish( $id, $bulk = FALSE, $all = FALSE ) {
|
219 |
-
|
220 |
global $wpdb;
|
221 |
$where = ($all ? '' : ' WHERE id=%d');
|
222 |
-
if( $where != '' ) {
|
223 |
-
$
|
224 |
-
|
225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
}
|
227 |
-
|
228 |
if ( $updated !== FALSE ) {
|
229 |
$message = 9;
|
230 |
}
|
@@ -250,19 +257,24 @@ class GalleriesController_bwg {
|
|
250 |
* @param $id
|
251 |
* @param bool $bulk
|
252 |
* @param bool $all
|
|
|
253 |
*
|
254 |
* @return int
|
255 |
*/
|
256 |
-
public function unpublish( $id, $bulk = FALSE, $all = FALSE ) {
|
257 |
global $wpdb;
|
258 |
$where = ($all ? '' : ' WHERE id=%d');
|
259 |
-
|
260 |
-
|
261 |
-
$updated = $wpdb->query(
|
262 |
-
}
|
263 |
-
|
|
|
|
|
|
|
|
|
|
|
264 |
}
|
265 |
-
|
266 |
if ( $updated !== FALSE ) {
|
267 |
$message = 10;
|
268 |
}
|
@@ -288,12 +300,13 @@ class GalleriesController_bwg {
|
|
288 |
* @param $id
|
289 |
* @param bool $bulk
|
290 |
* @param bool $all
|
|
|
291 |
*
|
292 |
* @return int
|
293 |
*/
|
294 |
|
295 |
-
public function duplicate( $id, $bulk = FALSE, $all = FALSE ) {
|
296 |
-
$message_id = $this->model->duplicate($id, $all);
|
297 |
if ($bulk) {
|
298 |
return $message_id;
|
299 |
}
|
@@ -371,6 +384,12 @@ class GalleriesController_bwg {
|
|
371 |
$params['orderby'] = $order_by[0];
|
372 |
$params['items_per_page'] = $this->items_per_page;
|
373 |
$page = WDWLibrary::get('paged', 1, 'intval');
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
if ( $page < 0 ) {
|
375 |
$page = 1;
|
376 |
}
|
@@ -415,7 +434,7 @@ class GalleriesController_bwg {
|
|
415 |
$message['image_message'] = WDWLibrary::get('bwg_action_last_message', '', 'intval');
|
416 |
/* check if image_id is not defined in the portion 50 ids_string skip ajax_task action */
|
417 |
if ( in_array($image_id, $ids) ) {
|
418 |
-
if( $action_image_id
|
419 |
$image_id = $action_image_id;
|
420 |
}
|
421 |
$message['image_message'] = $this->model->$ajax_task($image_id, $data['id'], $all);
|
159 |
|
160 |
if ( method_exists($this, $task) ) {
|
161 |
if ( $all ) {
|
162 |
+
$get_excludeIds = WDWLibrary::get('ids_exclude', FALSE);
|
163 |
+
$excludeIds = ( !empty($get_excludeIds) ) ? explode(',', $get_excludeIds) : array();
|
164 |
+
$message = $this->$task(0, TRUE, TRUE, $excludeIds);
|
165 |
$url_arg['message'] = $message;
|
166 |
}
|
167 |
else {
|
191 |
* @param $id
|
192 |
* @param bool $bulk
|
193 |
* @param bool $all
|
194 |
+
* @param array $excludeIds
|
195 |
*
|
196 |
* @return int
|
197 |
*/
|
198 |
+
public function delete( $id, $bulk = FALSE, $all = FALSE, $excludeIds = array() ) {
|
199 |
+
$message = $this->model->delete($id, $all, $excludeIds);
|
|
|
200 |
if ( $bulk ) {
|
201 |
return $message;
|
202 |
}
|
203 |
|
204 |
+
WDWLibrary::redirect( add_query_arg(array(
|
205 |
'page' => $this->page,
|
206 |
'task' => 'display',
|
207 |
'message' => $message,
|
208 |
+
), admin_url('admin.php')) );
|
209 |
}
|
210 |
|
211 |
/**
|
214 |
* @param $id
|
215 |
* @param bool $bulk
|
216 |
* @param bool $all
|
217 |
+
* @param array $excludeIds
|
218 |
*
|
219 |
* @return int
|
220 |
*/
|
221 |
+
public function publish( $id, $bulk = FALSE, $all = FALSE, $excludeIds = array() ) {
|
|
|
222 |
global $wpdb;
|
223 |
$where = ($all ? '' : ' WHERE id=%d');
|
224 |
+
if ( $where != '' ) {
|
225 |
+
$query = $wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_gallery` SET published=1' . $where, $id);
|
226 |
+
$updated = $wpdb->query( $query );
|
227 |
+
}
|
228 |
+
else {
|
229 |
+
if ( !empty($excludeIds) ) {
|
230 |
+
$where = ' WHERE `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
231 |
+
}
|
232 |
+
$query = 'UPDATE `' . $wpdb->prefix . 'bwg_gallery` SET published=1' . $where;
|
233 |
+
$updated = $wpdb->query( $query );
|
234 |
}
|
|
|
235 |
if ( $updated !== FALSE ) {
|
236 |
$message = 9;
|
237 |
}
|
257 |
* @param $id
|
258 |
* @param bool $bulk
|
259 |
* @param bool $all
|
260 |
+
* @param array $excludeIds
|
261 |
*
|
262 |
* @return int
|
263 |
*/
|
264 |
+
public function unpublish( $id, $bulk = FALSE, $all = FALSE, $excludeIds = array() ) {
|
265 |
global $wpdb;
|
266 |
$where = ($all ? '' : ' WHERE id=%d');
|
267 |
+
if ( $where != '' ) {
|
268 |
+
$query = $wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_gallery` SET published=0' . $where, $id);
|
269 |
+
$updated = $wpdb->query( $query );
|
270 |
+
}
|
271 |
+
else {
|
272 |
+
if ( !empty($excludeIds) ) {
|
273 |
+
$where = ' WHERE `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
274 |
+
}
|
275 |
+
$query = 'UPDATE `' . $wpdb->prefix . 'bwg_gallery` SET published=0' . $where;
|
276 |
+
$updated = $wpdb->query( $query );
|
277 |
}
|
|
|
278 |
if ( $updated !== FALSE ) {
|
279 |
$message = 10;
|
280 |
}
|
300 |
* @param $id
|
301 |
* @param bool $bulk
|
302 |
* @param bool $all
|
303 |
+
* @param array $excludeIds
|
304 |
*
|
305 |
* @return int
|
306 |
*/
|
307 |
|
308 |
+
public function duplicate( $id, $bulk = FALSE, $all = FALSE, $excludeIds = array() ) {
|
309 |
+
$message_id = $this->model->duplicate($id, $all, $excludeIds);
|
310 |
if ($bulk) {
|
311 |
return $message_id;
|
312 |
}
|
384 |
$params['orderby'] = $order_by[0];
|
385 |
$params['items_per_page'] = $this->items_per_page;
|
386 |
$page = WDWLibrary::get('paged', 1, 'intval');
|
387 |
+
// In case of "Select All" removal, when there is an exception, you need to reset "page".
|
388 |
+
$select_all = WDWLibrary::get('check_all_items', FALSE);
|
389 |
+
$image_action = WDWLibrary::get('image_bulk_action', '-1');
|
390 |
+
if ( $select_all && !empty($image_action) && $image_action == 'image_delete' ) {
|
391 |
+
$page = 1;
|
392 |
+
}
|
393 |
if ( $page < 0 ) {
|
394 |
$page = 1;
|
395 |
}
|
434 |
$message['image_message'] = WDWLibrary::get('bwg_action_last_message', '', 'intval');
|
435 |
/* check if image_id is not defined in the portion 50 ids_string skip ajax_task action */
|
436 |
if ( in_array($image_id, $ids) ) {
|
437 |
+
if ( !empty($action_image_id) ) {
|
438 |
$image_id = $action_image_id;
|
439 |
}
|
440 |
$message['image_message'] = $this->model->$ajax_task($image_id, $data['id'], $all);
|
admin/models/Albums.php
CHANGED
@@ -81,24 +81,37 @@ class AlbumsModel_bwg {
|
|
81 |
*
|
82 |
* @param $id
|
83 |
* @param bool $all
|
|
|
84 |
*
|
85 |
* @return int
|
86 |
*/
|
87 |
-
public function delete( $id, $all = FALSE ) {
|
88 |
global $wpdb;
|
89 |
$where = '';
|
90 |
$alb_gal_where = '';
|
91 |
$prepareArgs = array();
|
92 |
-
|
93 |
if ( !$all ) {
|
94 |
$where = ' WHERE id = %d';
|
95 |
$alb_gal_where = ' AND alb_gal_id = %d';
|
96 |
$prepareArgs[] = $id;
|
97 |
}
|
98 |
-
|
99 |
// Remove custom post.
|
100 |
if ( $all ) {
|
101 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
}
|
103 |
else {
|
104 |
$row = $wpdb->get_row( $wpdb->prepare('SELECT `slug` FROM `' . $wpdb->prefix . 'bwg_album` WHERE id="%d"', $id) );
|
@@ -106,14 +119,18 @@ class AlbumsModel_bwg {
|
|
106 |
WDWLibrary::bwg_remove_custom_post( array( 'slug' => $row->slug, 'post_type' => 'bwg_album') );
|
107 |
}
|
108 |
}
|
109 |
-
|
110 |
if ( !empty($prepareArgs) ) {
|
111 |
$delete = $wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'bwg_album`' . $where, $prepareArgs));
|
112 |
$wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'bwg_album_gallery` WHERE is_album="1"' . $alb_gal_where, $prepareArgs));
|
113 |
-
} else {
|
114 |
-
$delete = $wpdb->query('DELETE FROM `' . $wpdb->prefix . 'bwg_album`' . $where, $prepareArgs);
|
115 |
-
$wpdb->query('DELETE FROM `' . $wpdb->prefix . 'bwg_album_gallery` WHERE is_album="1"' . $alb_gal_where, $prepareArgs);
|
116 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
if ( $delete ) {
|
118 |
if ( $all ) {
|
119 |
$message = 5;
|
@@ -134,24 +151,29 @@ class AlbumsModel_bwg {
|
|
134 |
*
|
135 |
* @param $id
|
136 |
* @param bool $all
|
|
|
137 |
*
|
138 |
* @return int
|
139 |
*/
|
140 |
-
public function duplicate( $id, $all = FALSE ) {
|
141 |
global $wpdb;
|
142 |
$message_id = 2;
|
143 |
// Duplicate all itmes.
|
144 |
if ( !$id && $all ) {
|
145 |
-
$
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
|
|
|
|
|
|
|
|
155 |
if ( !empty($results) ) {
|
156 |
$dublicatedAlbumId = 0;
|
157 |
$album_id = 0;
|
81 |
*
|
82 |
* @param $id
|
83 |
* @param bool $all
|
84 |
+
* @param array $excludeIds
|
85 |
*
|
86 |
* @return int
|
87 |
*/
|
88 |
+
public function delete( $id, $all = FALSE, $excludeIds = array() ) {
|
89 |
global $wpdb;
|
90 |
$where = '';
|
91 |
$alb_gal_where = '';
|
92 |
$prepareArgs = array();
|
|
|
93 |
if ( !$all ) {
|
94 |
$where = ' WHERE id = %d';
|
95 |
$alb_gal_where = ' AND alb_gal_id = %d';
|
96 |
$prepareArgs[] = $id;
|
97 |
}
|
|
|
98 |
// Remove custom post.
|
99 |
if ( $all ) {
|
100 |
+
$posts_where = '';
|
101 |
+
if ( !empty($excludeIds) ) {
|
102 |
+
// get the albums that should not be deleted.
|
103 |
+
$aSlugs_tmp = $wpdb->get_results('SELECT `slug` FROM `' . $wpdb->prefix . 'bwg_album` WHERE `id` IN (' . WDWLibrary::escape_array($excludeIds) . ')');
|
104 |
+
if ( !empty($aSlugs_tmp) ) {
|
105 |
+
foreach ( $aSlugs_tmp as $val ) {
|
106 |
+
$aSlugs[] = $val->slug;
|
107 |
+
}
|
108 |
+
$posts_where = ' AND `post_name` NOT IN (' . WDWLibrary::escape_array($aSlugs) . ')';
|
109 |
+
}
|
110 |
+
$where = ' WHERE `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
111 |
+
$alb_gal_where = ' AND `alb_gal_id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
112 |
+
}
|
113 |
+
$query = $wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'posts` WHERE `post_type`=%s'. $posts_where, 'bwg_album');
|
114 |
+
$wpdb->query( $query );
|
115 |
}
|
116 |
else {
|
117 |
$row = $wpdb->get_row( $wpdb->prepare('SELECT `slug` FROM `' . $wpdb->prefix . 'bwg_album` WHERE id="%d"', $id) );
|
119 |
WDWLibrary::bwg_remove_custom_post( array( 'slug' => $row->slug, 'post_type' => 'bwg_album') );
|
120 |
}
|
121 |
}
|
|
|
122 |
if ( !empty($prepareArgs) ) {
|
123 |
$delete = $wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'bwg_album`' . $where, $prepareArgs));
|
124 |
$wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'bwg_album_gallery` WHERE is_album="1"' . $alb_gal_where, $prepareArgs));
|
|
|
|
|
|
|
125 |
}
|
126 |
+
else {
|
127 |
+
$album_delete = 'DELETE FROM `' . $wpdb->prefix . 'bwg_album`' . $where;
|
128 |
+
$delete = $wpdb->query($album_delete);
|
129 |
+
|
130 |
+
$query = 'DELETE FROM `' . $wpdb->prefix . 'bwg_album_gallery` WHERE is_album="1"' . $alb_gal_where;
|
131 |
+
$wpdb->query( $query );
|
132 |
+
}
|
133 |
+
|
134 |
if ( $delete ) {
|
135 |
if ( $all ) {
|
136 |
$message = 5;
|
151 |
*
|
152 |
* @param $id
|
153 |
* @param bool $all
|
154 |
+
* @param array $excludeIds
|
155 |
*
|
156 |
* @return int
|
157 |
*/
|
158 |
+
public function duplicate( $id, $all = FALSE, $excludeIds = array() ) {
|
159 |
global $wpdb;
|
160 |
$message_id = 2;
|
161 |
// Duplicate all itmes.
|
162 |
if ( !$id && $all ) {
|
163 |
+
$query = 'SELECT
|
164 |
+
`a`.*,
|
165 |
+
`ag`.alb_gal_id,
|
166 |
+
`ag`.is_album,
|
167 |
+
`ag`.`order` AS `ag_order`
|
168 |
+
FROM
|
169 |
+
`' . $wpdb->prefix . 'bwg_album` `a`
|
170 |
+
LEFT JOIN `' . $wpdb->prefix . 'bwg_album_gallery` `ag`
|
171 |
+
ON
|
172 |
+
`a`.`id` = `ag`.`album_id`';
|
173 |
+
if ( !empty($excludeIds) ) {
|
174 |
+
$query .= ' WHERE `a`.`id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
175 |
+
}
|
176 |
+
$results = $wpdb->get_results( $query );
|
177 |
if ( !empty($results) ) {
|
178 |
$dublicatedAlbumId = 0;
|
179 |
$album_id = 0;
|
admin/models/Galleries.php
CHANGED
@@ -88,14 +88,16 @@ class GalleriesModel_bwg {
|
|
88 |
*
|
89 |
* @param $id
|
90 |
* @param bool $all
|
|
|
91 |
*
|
92 |
* @return int
|
93 |
*/
|
94 |
-
public function delete( $id, $all = FALSE ) {
|
95 |
global $wpdb;
|
96 |
$where = '';
|
97 |
$image_where = '';
|
98 |
$alb_gal_where = '';
|
|
|
99 |
$prepareArgs = array();
|
100 |
if ( !$all ) {
|
101 |
$where = ' WHERE id=%d';
|
@@ -105,7 +107,29 @@ class GalleriesModel_bwg {
|
|
105 |
}
|
106 |
// Remove custom post.
|
107 |
if ( $all ) {
|
108 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
}
|
110 |
else {
|
111 |
$row = $wpdb->get_row($wpdb->prepare('SELECT `slug` FROM `' . $wpdb->prefix . 'bwg_gallery` WHERE id="%d"', $id));
|
@@ -125,11 +149,26 @@ class GalleriesModel_bwg {
|
|
125 |
}
|
126 |
}
|
127 |
else {
|
128 |
-
$
|
129 |
-
$wpdb->query(
|
130 |
-
|
131 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
$wpdb->update($wpdb->prefix . 'term_taxonomy', array('count' => '0'), array('taxonomy' => 'bwg_tag'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
}
|
134 |
if ( $delete ) {
|
135 |
if ( $all ) {
|
@@ -151,13 +190,18 @@ class GalleriesModel_bwg {
|
|
151 |
*
|
152 |
* @param $idtoget
|
153 |
* @param bool $all
|
|
|
154 |
*
|
155 |
* @return int
|
156 |
*/
|
157 |
-
public function duplicate( $idtoget, $all = FALSE ) {
|
158 |
global $wpdb;
|
159 |
if ( !$idtoget ) {
|
160 |
-
$
|
|
|
|
|
|
|
|
|
161 |
}
|
162 |
else {
|
163 |
$ids = array( $idtoget );
|
@@ -825,7 +869,17 @@ class GalleriesModel_bwg {
|
|
825 |
$image_message = sprintf(_n('%s item successfully %s.', '%s items successfully %s.', $checked_items_count, BWG()->prefix), $checked_items_count, $actions[$image_action]['bulk_action']);
|
826 |
}
|
827 |
if ( $all && $image_action && method_exists($this, $image_action) ) {
|
828 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
829 |
}
|
830 |
$images_saved = ($save !== FALSE) ? TRUE : FALSE;
|
831 |
|
@@ -858,10 +912,11 @@ class GalleriesModel_bwg {
|
|
858 |
* @param $id
|
859 |
* @param $gallery_id
|
860 |
* @param bool $all
|
|
|
861 |
*
|
862 |
* @return int
|
863 |
*/
|
864 |
-
public function image_delete( $id, $gallery_id = 0, $all = FALSE ) {
|
865 |
global $wpdb;
|
866 |
$prepareArgs = array();
|
867 |
if ( $gallery_id == 0 ) {
|
@@ -873,6 +928,9 @@ class GalleriesModel_bwg {
|
|
873 |
$where .= ' AND id=%d';
|
874 |
$prepareArgs[] = $id;
|
875 |
}
|
|
|
|
|
|
|
876 |
$search = WDWLibrary::get('s');
|
877 |
if ( $search ) {
|
878 |
$where .= ' AND (`alt` LIKE %s';
|
@@ -884,7 +942,8 @@ class GalleriesModel_bwg {
|
|
884 |
}
|
885 |
$image_ids = $wpdb->get_col($wpdb->prepare('SELECT `id` FROM `' . $wpdb->prefix . 'bwg_image`' . $where, $prepareArgs));
|
886 |
$thumb_urls = $wpdb->get_col($wpdb->prepare('SELECT `thumb_url` FROM `' . $wpdb->prefix . 'bwg_image`' . $where, $prepareArgs));
|
887 |
-
$
|
|
|
888 |
$message = 2;
|
889 |
if ( $delete ) {
|
890 |
$prepareArgs = array();
|
@@ -930,10 +989,11 @@ class GalleriesModel_bwg {
|
|
930 |
* @param $id
|
931 |
* @param $gallery_id
|
932 |
* @param bool $all
|
|
|
933 |
*
|
934 |
* @return int
|
935 |
*/
|
936 |
-
public function image_publish( $id, $gallery_id = 0, $all = FALSE ) {
|
937 |
global $wpdb;
|
938 |
$prepareArgs = array();
|
939 |
if ( $gallery_id == 0 ) {
|
@@ -945,6 +1005,9 @@ class GalleriesModel_bwg {
|
|
945 |
$where .= ' AND id=%d';
|
946 |
$prepareArgs[] = $id;
|
947 |
}
|
|
|
|
|
|
|
948 |
$search = WDWLibrary::get('s');
|
949 |
if ( $search ) {
|
950 |
$where .= ' AND (`alt` LIKE %s';
|
@@ -954,7 +1017,8 @@ class GalleriesModel_bwg {
|
|
954 |
$prepareArgs[] = "%" . trim($search) . "%";
|
955 |
$prepareArgs[] = "%" . trim($search) . "%";
|
956 |
}
|
957 |
-
$
|
|
|
958 |
$message = 2;
|
959 |
if ( $updated !== FALSE ) {
|
960 |
$message = 9;
|
@@ -969,10 +1033,11 @@ class GalleriesModel_bwg {
|
|
969 |
* @param $id
|
970 |
* @param $gallery_id
|
971 |
* @param bool $all
|
|
|
972 |
*
|
973 |
* @return int
|
974 |
*/
|
975 |
-
public function image_unpublish( $id, $gallery_id = 0, $all = FALSE ) {
|
976 |
global $wpdb;
|
977 |
$prepareArgs = array();
|
978 |
if ( $gallery_id == 0 ) {
|
@@ -984,6 +1049,9 @@ class GalleriesModel_bwg {
|
|
984 |
$where .= ' AND id=%d';
|
985 |
$prepareArgs[] = $id;
|
986 |
}
|
|
|
|
|
|
|
987 |
$search = WDWLibrary::get('s');
|
988 |
if ( $search ) {
|
989 |
$where .= ' AND (`alt` LIKE %s';
|
@@ -993,7 +1061,8 @@ class GalleriesModel_bwg {
|
|
993 |
$prepareArgs[] = "%" . trim($search) . "%";
|
994 |
$prepareArgs[] = "%" . trim($search) . "%";
|
995 |
}
|
996 |
-
$
|
|
|
997 |
$message = 2;
|
998 |
if ( $updated !== FALSE ) {
|
999 |
$message = 10;
|
@@ -1008,16 +1077,17 @@ class GalleriesModel_bwg {
|
|
1008 |
* @param $id
|
1009 |
* @param $gallery_id
|
1010 |
* @param bool $all
|
|
|
1011 |
*
|
1012 |
* @return int
|
1013 |
*/
|
1014 |
-
public function image_reset( $id, $gallery_id = 0, $all = FALSE ) {
|
1015 |
if ( $all ) {
|
1016 |
if ( $gallery_id == 0 ) {
|
1017 |
$gallery_id = WDWLibrary::get('current_id', 0, 'intval');
|
1018 |
}
|
1019 |
$limit = WDWLibrary::get('limit', 0, 'intval');
|
1020 |
-
WDWLibrary::bwg_image_recover_all($gallery_id, $limit);
|
1021 |
}
|
1022 |
else {
|
1023 |
global $wpdb;
|
@@ -1038,10 +1108,11 @@ class GalleriesModel_bwg {
|
|
1038 |
* @param $id
|
1039 |
* @param $gallery_id
|
1040 |
* @param bool $all
|
|
|
1041 |
*
|
1042 |
* @return int
|
1043 |
*/
|
1044 |
-
public function image_set_watermark( $id, $gallery_id = 0, $all = FALSE ) {
|
1045 |
if ( ini_get('allow_url_fopen') == 0 ) {
|
1046 |
$message_id = 27;
|
1047 |
}
|
@@ -1058,7 +1129,7 @@ class GalleriesModel_bwg {
|
|
1058 |
$gallery_id = WDWLibrary::get('current_id', 0, 'intval');
|
1059 |
}
|
1060 |
$limit = WDWLibrary::get('limit', 0, 'intval');
|
1061 |
-
$message_id = WDWLibrary::bwg_image_set_watermark($gallery_id, ($all ? 0 : $id), $limit);
|
1062 |
}
|
1063 |
}
|
1064 |
|
@@ -1071,11 +1142,12 @@ class GalleriesModel_bwg {
|
|
1071 |
* @param $id
|
1072 |
* @param $gallery_id
|
1073 |
* @param bool $all
|
|
|
1074 |
*
|
1075 |
* @return int
|
1076 |
*/
|
1077 |
-
public function image_rotate_left( $id, $gallery_id = 0, $all = FALSE ) {
|
1078 |
-
return $this->rotate(90, $id, $gallery_id, $all);
|
1079 |
}
|
1080 |
|
1081 |
/**
|
@@ -1084,11 +1156,12 @@ class GalleriesModel_bwg {
|
|
1084 |
* @param $id
|
1085 |
* @param $gallery_id
|
1086 |
* @param bool $all
|
|
|
1087 |
*
|
1088 |
* @return int
|
1089 |
*/
|
1090 |
-
public function image_rotate_right( $id, $gallery_id = 0, $all = FALSE ) {
|
1091 |
-
return $this->rotate(270, $id, $gallery_id, $all);
|
1092 |
}
|
1093 |
|
1094 |
/**
|
@@ -1098,10 +1171,11 @@ class GalleriesModel_bwg {
|
|
1098 |
* @param int $id
|
1099 |
* @param $gallery_id
|
1100 |
* @param bool $all
|
|
|
1101 |
*
|
1102 |
* @return int
|
1103 |
*/
|
1104 |
-
public function rotate( $edit_type, $id = 0, $gallery_id = 0, $all = FALSE ) {
|
1105 |
global $wpdb;
|
1106 |
$prepareArgs = array();
|
1107 |
$image_id = ($all ? 0 : $id);
|
@@ -1116,8 +1190,10 @@ class GalleriesModel_bwg {
|
|
1116 |
$where .= ' AND `id` = %d';
|
1117 |
$prepareArgs[] = $image_id;
|
1118 |
}
|
|
|
|
|
|
|
1119 |
}
|
1120 |
-
//$where = ( ($gallery_id) ? ' `gallery_id` = ' . $gallery_id . ($image_id ? ' AND `id` = ' . $image_id : '' ) : 1 );
|
1121 |
$search = WDWLibrary::get('s');
|
1122 |
if ( $search ) {
|
1123 |
$where .= ' AND (`alt` LIKE %s';
|
@@ -1128,10 +1204,12 @@ class GalleriesModel_bwg {
|
|
1128 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1129 |
}
|
1130 |
if ( !empty($prepareArgs) ) {
|
1131 |
-
$
|
|
|
1132 |
}
|
1133 |
else {
|
1134 |
-
$
|
|
|
1135 |
}
|
1136 |
@ini_set('memory_limit', '-1');
|
1137 |
foreach ( $images_data as $image_data ) {
|
@@ -1192,6 +1270,18 @@ class GalleriesModel_bwg {
|
|
1192 |
imagedestroy($thumb_source);
|
1193 |
imagedestroy($thumb_rotate);
|
1194 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1195 |
}
|
1196 |
$resolution_thumb = WDWLibrary::get_thumb_size($image_data->thumb_url);
|
1197 |
|
@@ -1210,10 +1300,11 @@ class GalleriesModel_bwg {
|
|
1210 |
* @param $id
|
1211 |
* @param $gallery_id
|
1212 |
* @param bool $all
|
|
|
1213 |
*
|
1214 |
* @return int
|
1215 |
*/
|
1216 |
-
public function image_recreate_thumbnail( $id, $gallery_id = 0, $all = FALSE ) {
|
1217 |
$image_id = ($all ? 0 : $id);
|
1218 |
global $wpdb;
|
1219 |
if ( $gallery_id == 0 ) {
|
@@ -1229,12 +1320,17 @@ class GalleriesModel_bwg {
|
|
1229 |
$where .= ' AND `id` = %d';
|
1230 |
$prepareArgs[] = $image_id;
|
1231 |
}
|
|
|
|
|
|
|
1232 |
}
|
1233 |
if ( !empty($prepareArgs) ) {
|
1234 |
-
$
|
|
|
1235 |
}
|
1236 |
else {
|
1237 |
-
$
|
|
|
1238 |
}
|
1239 |
$search = WDWLibrary::get('s');
|
1240 |
if ( $search ) {
|
@@ -1267,10 +1363,11 @@ class GalleriesModel_bwg {
|
|
1267 |
* @param $id
|
1268 |
* @param $gallery_id
|
1269 |
* @param bool $all
|
|
|
1270 |
*
|
1271 |
* @return int
|
1272 |
*/
|
1273 |
-
public function image_resize( $id, $gallery_id = 0, $all = FALSE ) {
|
1274 |
$image_id = ($all ? 0 : $id);
|
1275 |
global $wpdb;
|
1276 |
if ( $gallery_id == 0 ) {
|
@@ -1284,6 +1381,9 @@ class GalleriesModel_bwg {
|
|
1284 |
$where .= ' AND id=%d';
|
1285 |
$prepareArgs[] = $id;
|
1286 |
}
|
|
|
|
|
|
|
1287 |
$search = WDWLibrary::get('s');
|
1288 |
if ( $search ) {
|
1289 |
$where .= ' AND (`alt` LIKE %s';
|
@@ -1293,7 +1393,8 @@ class GalleriesModel_bwg {
|
|
1293 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1294 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1295 |
}
|
1296 |
-
$
|
|
|
1297 |
if ( !empty($images) ) {
|
1298 |
foreach ( $images as $image ) {
|
1299 |
$file_path = BWG()->upload_dir . $image->image_url;
|
@@ -1358,10 +1459,11 @@ class GalleriesModel_bwg {
|
|
1358 |
* @param $id
|
1359 |
* @param $gallery_id
|
1360 |
* @param bool $all
|
|
|
1361 |
*
|
1362 |
* @return int
|
1363 |
*/
|
1364 |
-
public function image_edit_alt( $id, $gallery_id = 0, $all = FALSE ) {
|
1365 |
$title = WDWLibrary::get('title');
|
1366 |
if ( $gallery_id == 0 ) {
|
1367 |
$gallery_id = WDWLibrary::get('current_id', 0, 'intval');
|
@@ -1372,6 +1474,9 @@ class GalleriesModel_bwg {
|
|
1372 |
$where .= ' AND id=%d';
|
1373 |
$prepareArgs[] = $id;
|
1374 |
}
|
|
|
|
|
|
|
1375 |
$search = WDWLibrary::get('s');
|
1376 |
if ( $search ) {
|
1377 |
$where .= ' AND (`alt` LIKE %s';
|
@@ -1382,7 +1487,8 @@ class GalleriesModel_bwg {
|
|
1382 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1383 |
}
|
1384 |
global $wpdb;
|
1385 |
-
$
|
|
|
1386 |
$message = 2;
|
1387 |
if ( $updated !== FALSE ) {
|
1388 |
$message = 25;
|
@@ -1397,10 +1503,11 @@ class GalleriesModel_bwg {
|
|
1397 |
* @param $id
|
1398 |
* @param $gallery_id
|
1399 |
* @param bool $all
|
|
|
1400 |
*
|
1401 |
* @return int
|
1402 |
*/
|
1403 |
-
public function image_edit_description( $id, $gallery_id = 0, $all = FALSE ) {
|
1404 |
if ( $gallery_id == 0 ) {
|
1405 |
$gallery_id = WDWLibrary::get('current_id', 0, 'intval');
|
1406 |
}
|
@@ -1411,6 +1518,9 @@ class GalleriesModel_bwg {
|
|
1411 |
$where .= ' AND id=%d';
|
1412 |
$prepareArgs[] = $id;
|
1413 |
}
|
|
|
|
|
|
|
1414 |
$search = WDWLibrary::get('s');
|
1415 |
if ( $search ) {
|
1416 |
$where .= ' AND (`alt` LIKE %s';
|
@@ -1421,7 +1531,8 @@ class GalleriesModel_bwg {
|
|
1421 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1422 |
}
|
1423 |
global $wpdb;
|
1424 |
-
$
|
|
|
1425 |
$message = 2;
|
1426 |
if ( $updated !== FALSE ) {
|
1427 |
$message = 25;
|
@@ -1436,10 +1547,11 @@ class GalleriesModel_bwg {
|
|
1436 |
* @param $id
|
1437 |
* @param $gallery_id
|
1438 |
* @param bool $all
|
|
|
1439 |
*
|
1440 |
* @return int
|
1441 |
*/
|
1442 |
-
public function image_edit_redirect( $id, $gallery_id = 0, $all = FALSE ) {
|
1443 |
if ( $gallery_id == 0 ) {
|
1444 |
$gallery_id = WDWLibrary::get('current_id', 0, 'intval');
|
1445 |
}
|
@@ -1450,6 +1562,9 @@ class GalleriesModel_bwg {
|
|
1450 |
$where .= ' AND id=%d';
|
1451 |
$prepareArgs[] = $id;
|
1452 |
}
|
|
|
|
|
|
|
1453 |
$search = WDWLibrary::get('s');
|
1454 |
if ( $search ) {
|
1455 |
$where .= ' AND (`alt` LIKE %s';
|
@@ -1460,7 +1575,8 @@ class GalleriesModel_bwg {
|
|
1460 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1461 |
}
|
1462 |
global $wpdb;
|
1463 |
-
$
|
|
|
1464 |
$message = 2;
|
1465 |
if ( $updated !== FALSE ) {
|
1466 |
$message = 25;
|
@@ -1469,7 +1585,17 @@ class GalleriesModel_bwg {
|
|
1469 |
return $message;
|
1470 |
}
|
1471 |
|
1472 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1473 |
if ( $gallery_id == 0 ) {
|
1474 |
$gallery_id = WDWLibrary::get('current_id', 0, 'intval');
|
1475 |
}
|
@@ -1483,6 +1609,9 @@ class GalleriesModel_bwg {
|
|
1483 |
$where .= ' AND id=%d';
|
1484 |
$prepareArgs[] = $id;
|
1485 |
}
|
|
|
|
|
|
|
1486 |
$search = WDWLibrary::get('s');
|
1487 |
if ( $search ) {
|
1488 |
$where .= ' AND (`alt` LIKE %s';
|
@@ -1492,7 +1621,8 @@ class GalleriesModel_bwg {
|
|
1492 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1493 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1494 |
}
|
1495 |
-
$
|
|
|
1496 |
foreach ( $images as $image ) {
|
1497 |
foreach ( $tag_ids_array as $tag_id ) {
|
1498 |
if ( $tag_id ) {
|
88 |
*
|
89 |
* @param $id
|
90 |
* @param bool $all
|
91 |
+
* @param array $excludeIds
|
92 |
*
|
93 |
* @return int
|
94 |
*/
|
95 |
+
public function delete( $id, $all = FALSE, $excludeIds = array() ) {
|
96 |
global $wpdb;
|
97 |
$where = '';
|
98 |
$image_where = '';
|
99 |
$alb_gal_where = '';
|
100 |
+
$image_tag_where = '';
|
101 |
$prepareArgs = array();
|
102 |
if ( !$all ) {
|
103 |
$where = ' WHERE id=%d';
|
107 |
}
|
108 |
// Remove custom post.
|
109 |
if ( $all ) {
|
110 |
+
$posts_where = '';
|
111 |
+
if ( !empty($excludeIds) ) {
|
112 |
+
// get the galleries that should not be deleted.
|
113 |
+
$gSlugs_tmp = $wpdb->get_results('SELECT `slug` FROM `' . $wpdb->prefix . 'bwg_gallery` WHERE `id` IN (' . WDWLibrary::escape_array($excludeIds) . ')');
|
114 |
+
if ( !empty($gSlugs_tmp) ) {
|
115 |
+
foreach ( $gSlugs_tmp as $val ) {
|
116 |
+
$gSlugs[] = $val->slug;
|
117 |
+
}
|
118 |
+
$posts_where = ' AND `post_name` NOT IN (' . WDWLibrary::escape_array($gSlugs) . ')';
|
119 |
+
}
|
120 |
+
$tagIds_tmp = $wpdb->get_results('SELECT `tag_id` FROM `' . $wpdb->prefix . 'bwg_image_tag` WHERE `gallery_id` IN (' . WDWLibrary::escape_array($excludeIds) . ')');
|
121 |
+
if ( !empty($tagIds_tmp) ) {
|
122 |
+
foreach ( $tagIds_tmp as $val ) {
|
123 |
+
$tagIds[] = $val->tag_id;
|
124 |
+
}
|
125 |
+
}
|
126 |
+
$where = ' WHERE `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
127 |
+
$image_where = ' WHERE `gallery_id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
128 |
+
$alb_gal_where = ' AND `alb_gal_id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
129 |
+
$image_tag_where = ' WHERE `gallery_id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
130 |
+
}
|
131 |
+
$query = $wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'posts` WHERE `post_type`="%s"' . $posts_where, 'bwg_gallery');
|
132 |
+
$wpdb->query( $query );
|
133 |
}
|
134 |
else {
|
135 |
$row = $wpdb->get_row($wpdb->prepare('SELECT `slug` FROM `' . $wpdb->prefix . 'bwg_gallery` WHERE id="%d"', $id));
|
149 |
}
|
150 |
}
|
151 |
else {
|
152 |
+
$gallery_delete = 'DELETE FROM `' . $wpdb->prefix . 'bwg_gallery`' . $where;
|
153 |
+
$delete = $wpdb->query( $gallery_delete );
|
154 |
+
|
155 |
+
$image_delete = 'DELETE FROM `' . $wpdb->prefix . 'bwg_image`' . $image_where;
|
156 |
+
$wpdb->query( $image_delete );
|
157 |
+
|
158 |
+
$album_gallery_delete = 'DELETE FROM `' . $wpdb->prefix . 'bwg_album_gallery` WHERE is_album="0"' . $alb_gal_where;
|
159 |
+
$wpdb->query( $album_gallery_delete );
|
160 |
+
|
161 |
+
$image_tag_delete = 'DELETE FROM `' . $wpdb->prefix . 'bwg_image_tag`' . $image_tag_where;
|
162 |
+
$wpdb->query( $image_tag_delete );
|
163 |
+
|
164 |
$wpdb->update($wpdb->prefix . 'term_taxonomy', array('count' => '0'), array('taxonomy' => 'bwg_tag'));
|
165 |
+
if ( !empty($tagIds) ) {
|
166 |
+
foreach ( $tagIds as $tag_id ) {
|
167 |
+
// update tag count in term_taxonomy table.
|
168 |
+
$count = $wpdb->get_var($wpdb->prepare('SELECT COUNT(image_id) FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE tag_id="%d"', $tag_id));
|
169 |
+
$wpdb->query($wpdb->prepare('UPDATE ' . $wpdb->prefix . 'term_taxonomy SET count="%d" WHERE term_id="%d"', $count, $tag_id));
|
170 |
+
}
|
171 |
+
}
|
172 |
}
|
173 |
if ( $delete ) {
|
174 |
if ( $all ) {
|
190 |
*
|
191 |
* @param $idtoget
|
192 |
* @param bool $all
|
193 |
+
* @param array $excludeIds
|
194 |
*
|
195 |
* @return int
|
196 |
*/
|
197 |
+
public function duplicate( $idtoget, $all = FALSE, $excludeIds = array() ) {
|
198 |
global $wpdb;
|
199 |
if ( !$idtoget ) {
|
200 |
+
$query = 'SELECT id FROM ' . $wpdb->prefix . 'bwg_gallery';
|
201 |
+
if ( $all && !empty($excludeIds) ) {
|
202 |
+
$query .= ' WHERE `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
203 |
+
}
|
204 |
+
$ids = $wpdb->get_col($query);
|
205 |
}
|
206 |
else {
|
207 |
$ids = array( $idtoget );
|
869 |
$image_message = sprintf(_n('%s item successfully %s.', '%s items successfully %s.', $checked_items_count, BWG()->prefix), $checked_items_count, $actions[$image_action]['bulk_action']);
|
870 |
}
|
871 |
if ( $all && $image_action && method_exists($this, $image_action) ) {
|
872 |
+
$get_excludeIds = WDWLibrary::get('ids_exclude', FALSE);
|
873 |
+
$excludeIds = array();
|
874 |
+
if ( !empty($get_excludeIds) ) {
|
875 |
+
$arr_excludeIds = explode(',', $get_excludeIds);
|
876 |
+
if ( !empty($arr_excludeIds) ) {
|
877 |
+
foreach( $arr_excludeIds as $eid ) {
|
878 |
+
$excludeIds[] = (!empty($action_image_id[$eid]) ? $action_image_id[$eid] : $eid);
|
879 |
+
}
|
880 |
+
}
|
881 |
+
}
|
882 |
+
$image_message = $this->$image_action(0, $gallery_id, TRUE, $excludeIds);
|
883 |
}
|
884 |
$images_saved = ($save !== FALSE) ? TRUE : FALSE;
|
885 |
|
912 |
* @param $id
|
913 |
* @param $gallery_id
|
914 |
* @param bool $all
|
915 |
+
* @param array $excludeIds
|
916 |
*
|
917 |
* @return int
|
918 |
*/
|
919 |
+
public function image_delete( $id, $gallery_id = 0, $all = FALSE, $excludeIds = array() ) {
|
920 |
global $wpdb;
|
921 |
$prepareArgs = array();
|
922 |
if ( $gallery_id == 0 ) {
|
928 |
$where .= ' AND id=%d';
|
929 |
$prepareArgs[] = $id;
|
930 |
}
|
931 |
+
if ( $all && !empty($excludeIds) ) {
|
932 |
+
$where .= ' AND `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
933 |
+
}
|
934 |
$search = WDWLibrary::get('s');
|
935 |
if ( $search ) {
|
936 |
$where .= ' AND (`alt` LIKE %s';
|
942 |
}
|
943 |
$image_ids = $wpdb->get_col($wpdb->prepare('SELECT `id` FROM `' . $wpdb->prefix . 'bwg_image`' . $where, $prepareArgs));
|
944 |
$thumb_urls = $wpdb->get_col($wpdb->prepare('SELECT `thumb_url` FROM `' . $wpdb->prefix . 'bwg_image`' . $where, $prepareArgs));
|
945 |
+
$query = $wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'bwg_image`' . $where, $prepareArgs);
|
946 |
+
$delete = $wpdb->query( $query );
|
947 |
$message = 2;
|
948 |
if ( $delete ) {
|
949 |
$prepareArgs = array();
|
989 |
* @param $id
|
990 |
* @param $gallery_id
|
991 |
* @param bool $all
|
992 |
+
* @param array $excludeIds
|
993 |
*
|
994 |
* @return int
|
995 |
*/
|
996 |
+
public function image_publish( $id, $gallery_id = 0, $all = FALSE, $excludeIds = array() ) {
|
997 |
global $wpdb;
|
998 |
$prepareArgs = array();
|
999 |
if ( $gallery_id == 0 ) {
|
1005 |
$where .= ' AND id=%d';
|
1006 |
$prepareArgs[] = $id;
|
1007 |
}
|
1008 |
+
if ( $all && !empty($excludeIds) ) {
|
1009 |
+
$where .= ' AND `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
1010 |
+
}
|
1011 |
$search = WDWLibrary::get('s');
|
1012 |
if ( $search ) {
|
1013 |
$where .= ' AND (`alt` LIKE %s';
|
1017 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1018 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1019 |
}
|
1020 |
+
$query = $wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_image` SET published=1' . $where, $prepareArgs);
|
1021 |
+
$updated = $wpdb->query( $query );
|
1022 |
$message = 2;
|
1023 |
if ( $updated !== FALSE ) {
|
1024 |
$message = 9;
|
1033 |
* @param $id
|
1034 |
* @param $gallery_id
|
1035 |
* @param bool $all
|
1036 |
+
* @param array $excludeIds
|
1037 |
*
|
1038 |
* @return int
|
1039 |
*/
|
1040 |
+
public function image_unpublish( $id, $gallery_id = 0, $all = FALSE, $excludeIds = array() ) {
|
1041 |
global $wpdb;
|
1042 |
$prepareArgs = array();
|
1043 |
if ( $gallery_id == 0 ) {
|
1049 |
$where .= ' AND id=%d';
|
1050 |
$prepareArgs[] = $id;
|
1051 |
}
|
1052 |
+
if ( $all && !empty($excludeIds) ) {
|
1053 |
+
$where .= ' AND `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
1054 |
+
}
|
1055 |
$search = WDWLibrary::get('s');
|
1056 |
if ( $search ) {
|
1057 |
$where .= ' AND (`alt` LIKE %s';
|
1061 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1062 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1063 |
}
|
1064 |
+
$query = $wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_image` SET published=0' . $where, $prepareArgs);
|
1065 |
+
$updated = $wpdb->query( $query );
|
1066 |
$message = 2;
|
1067 |
if ( $updated !== FALSE ) {
|
1068 |
$message = 10;
|
1077 |
* @param $id
|
1078 |
* @param $gallery_id
|
1079 |
* @param bool $all
|
1080 |
+
* @param array $excludeIds
|
1081 |
*
|
1082 |
* @return int
|
1083 |
*/
|
1084 |
+
public function image_reset( $id, $gallery_id = 0, $all = FALSE, $excludeIds = array() ) {
|
1085 |
if ( $all ) {
|
1086 |
if ( $gallery_id == 0 ) {
|
1087 |
$gallery_id = WDWLibrary::get('current_id', 0, 'intval');
|
1088 |
}
|
1089 |
$limit = WDWLibrary::get('limit', 0, 'intval');
|
1090 |
+
WDWLibrary::bwg_image_recover_all($gallery_id, $limit, $excludeIds);
|
1091 |
}
|
1092 |
else {
|
1093 |
global $wpdb;
|
1108 |
* @param $id
|
1109 |
* @param $gallery_id
|
1110 |
* @param bool $all
|
1111 |
+
* @param array $excludeIds
|
1112 |
*
|
1113 |
* @return int
|
1114 |
*/
|
1115 |
+
public function image_set_watermark( $id, $gallery_id = 0, $all = FALSE, $excludeIds = array() ) {
|
1116 |
if ( ini_get('allow_url_fopen') == 0 ) {
|
1117 |
$message_id = 27;
|
1118 |
}
|
1129 |
$gallery_id = WDWLibrary::get('current_id', 0, 'intval');
|
1130 |
}
|
1131 |
$limit = WDWLibrary::get('limit', 0, 'intval');
|
1132 |
+
$message_id = WDWLibrary::bwg_image_set_watermark($gallery_id, ($all ? 0 : $id), $limit, $excludeIds);
|
1133 |
}
|
1134 |
}
|
1135 |
|
1142 |
* @param $id
|
1143 |
* @param $gallery_id
|
1144 |
* @param bool $all
|
1145 |
+
* @param array $excludeIds
|
1146 |
*
|
1147 |
* @return int
|
1148 |
*/
|
1149 |
+
public function image_rotate_left( $id, $gallery_id = 0, $all = FALSE, $excludeIds = array() ) {
|
1150 |
+
return $this->rotate(90, $id, $gallery_id, $all, $excludeIds);
|
1151 |
}
|
1152 |
|
1153 |
/**
|
1156 |
* @param $id
|
1157 |
* @param $gallery_id
|
1158 |
* @param bool $all
|
1159 |
+
* @param array $excludeIds
|
1160 |
*
|
1161 |
* @return int
|
1162 |
*/
|
1163 |
+
public function image_rotate_right( $id, $gallery_id = 0, $all = FALSE, $excludeIds = array() ) {
|
1164 |
+
return $this->rotate(270, $id, $gallery_id, $all, $excludeIds);
|
1165 |
}
|
1166 |
|
1167 |
/**
|
1171 |
* @param int $id
|
1172 |
* @param $gallery_id
|
1173 |
* @param bool $all
|
1174 |
+
* @param array $excludeIds
|
1175 |
*
|
1176 |
* @return int
|
1177 |
*/
|
1178 |
+
public function rotate( $edit_type, $id = 0, $gallery_id = 0, $all = FALSE, $excludeIds = array() ) {
|
1179 |
global $wpdb;
|
1180 |
$prepareArgs = array();
|
1181 |
$image_id = ($all ? 0 : $id);
|
1190 |
$where .= ' AND `id` = %d';
|
1191 |
$prepareArgs[] = $image_id;
|
1192 |
}
|
1193 |
+
if ( $all && !empty($excludeIds) ) {
|
1194 |
+
$where .= ' AND `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
1195 |
+
}
|
1196 |
}
|
|
|
1197 |
$search = WDWLibrary::get('s');
|
1198 |
if ( $search ) {
|
1199 |
$where .= ' AND (`alt` LIKE %s';
|
1204 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1205 |
}
|
1206 |
if ( !empty($prepareArgs) ) {
|
1207 |
+
$query = $wpdb->prepare('SELECT id, image_url, thumb_url, resolution_thumb FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where, $prepareArgs);
|
1208 |
+
$images_data = $wpdb->get_results( $query );
|
1209 |
}
|
1210 |
else {
|
1211 |
+
$query = 'SELECT id, image_url, thumb_url, resolution_thumb FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where;
|
1212 |
+
$images_data = $wpdb->get_results($query);
|
1213 |
}
|
1214 |
@ini_set('memory_limit', '-1');
|
1215 |
foreach ( $images_data as $image_data ) {
|
1270 |
imagedestroy($thumb_source);
|
1271 |
imagedestroy($thumb_rotate);
|
1272 |
}
|
1273 |
+
elseif ( $type_rotate == 18 ) {
|
1274 |
+
$source = imagecreatefromwebp($filename);
|
1275 |
+
$thumb_source = imagecreatefromwebp($thumb_filename);
|
1276 |
+
$rotate = imagerotate($source, $edit_type, 0);
|
1277 |
+
$thumb_rotate = imagerotate($thumb_source, $edit_type, 0);
|
1278 |
+
imagewebp($thumb_rotate, $thumb_filename, BWG()->options->jpeg_quality);
|
1279 |
+
imagewebp($rotate, $filename, BWG()->options->jpeg_quality);
|
1280 |
+
imagedestroy($source);
|
1281 |
+
imagedestroy($rotate);
|
1282 |
+
imagedestroy($thumb_source);
|
1283 |
+
imagedestroy($thumb_rotate);
|
1284 |
+
}
|
1285 |
}
|
1286 |
$resolution_thumb = WDWLibrary::get_thumb_size($image_data->thumb_url);
|
1287 |
|
1300 |
* @param $id
|
1301 |
* @param $gallery_id
|
1302 |
* @param bool $all
|
1303 |
+
* @param array $excludeIds
|
1304 |
*
|
1305 |
* @return int
|
1306 |
*/
|
1307 |
+
public function image_recreate_thumbnail( $id, $gallery_id = 0, $all = FALSE, $excludeIds = array() ) {
|
1308 |
$image_id = ($all ? 0 : $id);
|
1309 |
global $wpdb;
|
1310 |
if ( $gallery_id == 0 ) {
|
1320 |
$where .= ' AND `id` = %d';
|
1321 |
$prepareArgs[] = $image_id;
|
1322 |
}
|
1323 |
+
if ( $all && !empty($excludeIds) ) {
|
1324 |
+
$where .= ' AND `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
1325 |
+
}
|
1326 |
}
|
1327 |
if ( !empty($prepareArgs) ) {
|
1328 |
+
$query = $wpdb->prepare('SELECT id, thumb_url FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where, $prepareArgs);
|
1329 |
+
$img_ids = $wpdb->get_results( $query );
|
1330 |
}
|
1331 |
else {
|
1332 |
+
$query = 'SELECT id, thumb_url FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where;
|
1333 |
+
$img_ids = $wpdb->get_results( $query );
|
1334 |
}
|
1335 |
$search = WDWLibrary::get('s');
|
1336 |
if ( $search ) {
|
1363 |
* @param $id
|
1364 |
* @param $gallery_id
|
1365 |
* @param bool $all
|
1366 |
+
* @param array $excludeIds
|
1367 |
*
|
1368 |
* @return int
|
1369 |
*/
|
1370 |
+
public function image_resize( $id, $gallery_id = 0, $all = FALSE, $excludeIds = array() ) {
|
1371 |
$image_id = ($all ? 0 : $id);
|
1372 |
global $wpdb;
|
1373 |
if ( $gallery_id == 0 ) {
|
1381 |
$where .= ' AND id=%d';
|
1382 |
$prepareArgs[] = $id;
|
1383 |
}
|
1384 |
+
if ( $all && !empty($excludeIds) ) {
|
1385 |
+
$where .= ' AND `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
1386 |
+
}
|
1387 |
$search = WDWLibrary::get('s');
|
1388 |
if ( $search ) {
|
1389 |
$where .= ' AND (`alt` LIKE %s';
|
1393 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1394 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1395 |
}
|
1396 |
+
$query = $wpdb->prepare('SELECT * FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where, $prepareArgs);
|
1397 |
+
$images = $wpdb->get_results( $query );
|
1398 |
if ( !empty($images) ) {
|
1399 |
foreach ( $images as $image ) {
|
1400 |
$file_path = BWG()->upload_dir . $image->image_url;
|
1459 |
* @param $id
|
1460 |
* @param $gallery_id
|
1461 |
* @param bool $all
|
1462 |
+
* @param array $excludeIds
|
1463 |
*
|
1464 |
* @return int
|
1465 |
*/
|
1466 |
+
public function image_edit_alt( $id, $gallery_id = 0, $all = FALSE, $excludeIds = array() ) {
|
1467 |
$title = WDWLibrary::get('title');
|
1468 |
if ( $gallery_id == 0 ) {
|
1469 |
$gallery_id = WDWLibrary::get('current_id', 0, 'intval');
|
1474 |
$where .= ' AND id=%d';
|
1475 |
$prepareArgs[] = $id;
|
1476 |
}
|
1477 |
+
if ( $all && !empty($excludeIds) ) {
|
1478 |
+
$where .= ' AND `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
1479 |
+
}
|
1480 |
$search = WDWLibrary::get('s');
|
1481 |
if ( $search ) {
|
1482 |
$where .= ' AND (`alt` LIKE %s';
|
1487 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1488 |
}
|
1489 |
global $wpdb;
|
1490 |
+
$query = $wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_image` SET `alt`="%s"' . $where, $prepareArgs);
|
1491 |
+
$updated = $wpdb->query( $query );
|
1492 |
$message = 2;
|
1493 |
if ( $updated !== FALSE ) {
|
1494 |
$message = 25;
|
1503 |
* @param $id
|
1504 |
* @param $gallery_id
|
1505 |
* @param bool $all
|
1506 |
+
* @param array $excludeIds
|
1507 |
*
|
1508 |
* @return int
|
1509 |
*/
|
1510 |
+
public function image_edit_description( $id, $gallery_id = 0, $all = FALSE, $excludeIds = array() ) {
|
1511 |
if ( $gallery_id == 0 ) {
|
1512 |
$gallery_id = WDWLibrary::get('current_id', 0, 'intval');
|
1513 |
}
|
1518 |
$where .= ' AND id=%d';
|
1519 |
$prepareArgs[] = $id;
|
1520 |
}
|
1521 |
+
if ( $all && !empty($excludeIds) ) {
|
1522 |
+
$where .= ' AND `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
1523 |
+
}
|
1524 |
$search = WDWLibrary::get('s');
|
1525 |
if ( $search ) {
|
1526 |
$where .= ' AND (`alt` LIKE %s';
|
1531 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1532 |
}
|
1533 |
global $wpdb;
|
1534 |
+
$query = $wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_image` SET `description`="%s"' . $where, $prepareArgs);
|
1535 |
+
$updated = $wpdb->query( $query );
|
1536 |
$message = 2;
|
1537 |
if ( $updated !== FALSE ) {
|
1538 |
$message = 25;
|
1547 |
* @param $id
|
1548 |
* @param $gallery_id
|
1549 |
* @param bool $all
|
1550 |
+
* @param array $excludeIds
|
1551 |
*
|
1552 |
* @return int
|
1553 |
*/
|
1554 |
+
public function image_edit_redirect( $id, $gallery_id = 0, $all = FALSE, $excludeIds = array() ) {
|
1555 |
if ( $gallery_id == 0 ) {
|
1556 |
$gallery_id = WDWLibrary::get('current_id', 0, 'intval');
|
1557 |
}
|
1562 |
$where .= ' AND id=%d';
|
1563 |
$prepareArgs[] = $id;
|
1564 |
}
|
1565 |
+
if ( $all && !empty($excludeIds) ) {
|
1566 |
+
$where .= ' AND `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
1567 |
+
}
|
1568 |
$search = WDWLibrary::get('s');
|
1569 |
if ( $search ) {
|
1570 |
$where .= ' AND (`alt` LIKE %s';
|
1575 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1576 |
}
|
1577 |
global $wpdb;
|
1578 |
+
$query = $wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_image` SET `redirect_url`="%s"' . $where, $prepareArgs);
|
1579 |
+
$updated = $wpdb->query( $query );
|
1580 |
$message = 2;
|
1581 |
if ( $updated !== FALSE ) {
|
1582 |
$message = 25;
|
1585 |
return $message;
|
1586 |
}
|
1587 |
|
1588 |
+
/**
|
1589 |
+
* Add image tag.
|
1590 |
+
*
|
1591 |
+
* @param $id
|
1592 |
+
* @param int $gallery_id
|
1593 |
+
* @param bool $all
|
1594 |
+
* @param array $excludeIds
|
1595 |
+
*
|
1596 |
+
* @return int
|
1597 |
+
*/
|
1598 |
+
public function image_add_tag( $id, $gallery_id = 0, $all = FALSE, $excludeIds = array() ) {
|
1599 |
if ( $gallery_id == 0 ) {
|
1600 |
$gallery_id = WDWLibrary::get('current_id', 0, 'intval');
|
1601 |
}
|
1609 |
$where .= ' AND id=%d';
|
1610 |
$prepareArgs[] = $id;
|
1611 |
}
|
1612 |
+
if ( $all && !empty($excludeIds) ) {
|
1613 |
+
$where .= ' AND `id` NOT IN (' . WDWLibrary::escape_array($excludeIds) . ')';
|
1614 |
+
}
|
1615 |
$search = WDWLibrary::get('s');
|
1616 |
if ( $search ) {
|
1617 |
$where .= ' AND (`alt` LIKE %s';
|
1621 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1622 |
$prepareArgs[] = "%" . trim($search) . "%";
|
1623 |
}
|
1624 |
+
$query = $wpdb->prepare('SELECT * FROM `' . $wpdb->prefix . 'bwg_image`' . $where, $prepareArgs);
|
1625 |
+
$images = $wpdb->get_results( $query );
|
1626 |
foreach ( $images as $image ) {
|
1627 |
foreach ( $tag_ids_array as $tag_id ) {
|
1628 |
if ( $tag_id ) {
|
admin/views/Albums.php
CHANGED
@@ -62,7 +62,7 @@ class AlbumsView_bwg extends AdminView_bwg {
|
|
62 |
<?php echo WDWLibrary::ordering('name', $params['orderby'], $params['order'], __('Title', BWG()->prefix), $params['page_url'], 'column-primary'); ?>
|
63 |
<?php echo WDWLibrary::ordering('author', $params['orderby'], $params['order'], __('Author', BWG()->prefix), $params['page_url']); ?>
|
64 |
</thead>
|
65 |
-
<tbody>
|
66 |
<?php
|
67 |
if ( $params['rows'] ) {
|
68 |
$alternate = 'alternate';
|
@@ -133,6 +133,7 @@ class AlbumsView_bwg extends AdminView_bwg {
|
|
133 |
<div class="tablenav bottom">
|
134 |
<?php echo $this->pagination($params['page_url'], $params['total'], $params['items_per_page']); ?>
|
135 |
</div>
|
|
|
136 |
<?php
|
137 |
}
|
138 |
|
62 |
<?php echo WDWLibrary::ordering('name', $params['orderby'], $params['order'], __('Title', BWG()->prefix), $params['page_url'], 'column-primary'); ?>
|
63 |
<?php echo WDWLibrary::ordering('author', $params['orderby'], $params['order'], __('Author', BWG()->prefix), $params['page_url']); ?>
|
64 |
</thead>
|
65 |
+
<tbody class="bwg-ordering">
|
66 |
<?php
|
67 |
if ( $params['rows'] ) {
|
68 |
$alternate = 'alternate';
|
133 |
<div class="tablenav bottom">
|
134 |
<?php echo $this->pagination($params['page_url'], $params['total'], $params['items_per_page']); ?>
|
135 |
</div>
|
136 |
+
<input type="hidden" id="ids_exclude" name="ids_exclude" value="" />
|
137 |
<?php
|
138 |
}
|
139 |
|
admin/views/Editimage.php
CHANGED
@@ -165,6 +165,19 @@ class EditimageView_bwg {
|
|
165 |
imagedestroy($img_r);
|
166 |
imagedestroy($dst_r);
|
167 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
else {
|
169 |
?>
|
170 |
<div class="message"><strong><?php echo __("You can't crop this type of image.", BWG()->prefix); ?></strong></div>
|
@@ -507,6 +520,20 @@ class EditimageView_bwg {
|
|
507 |
imagedestroy($thumb_source);
|
508 |
imagedestroy($thumb_rotate);
|
509 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
510 |
}
|
511 |
elseif ( $edit_type == 'vertical' || $edit_type == 'horizontal' || $edit_type == 'both' ) {
|
512 |
function bwg_image_flip( $imgsrc, $mode ) {
|
@@ -595,6 +622,26 @@ class EditimageView_bwg {
|
|
595 |
imagedestroy($thumb_source);
|
596 |
imagedestroy($thumb_flip);
|
597 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
598 |
}
|
599 |
elseif ( $edit_type == 'brightness' || $edit_type == 'contrast' || $edit_type == 'grayscale' || $edit_type == 'negative' || $edit_type == 'remove' || $edit_type == 'emboss' || $edit_type == 'smooth' ) {
|
600 |
switch ( $edit_type ) {
|
@@ -668,6 +715,20 @@ class EditimageView_bwg {
|
|
668 |
imagedestroy($source);
|
669 |
imagedestroy($thumb_source);
|
670 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
671 |
}
|
672 |
elseif ( $edit_type == 'sepia' || $edit_type == 'dark_slate_grey' || $edit_type == 'saturate' ) {
|
673 |
switch ( $edit_type ) {
|
@@ -731,6 +792,20 @@ class EditimageView_bwg {
|
|
731 |
imagedestroy($source);
|
732 |
imagedestroy($thumb_source);
|
733 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
734 |
}
|
735 |
elseif ( $edit_type == 'recover' ) {
|
736 |
global $wpdb;
|
165 |
imagedestroy($img_r);
|
166 |
imagedestroy($dst_r);
|
167 |
}
|
168 |
+
elseif ( $type_orig == 18 ) {
|
169 |
+
$img_r = imagecreatefromwebp($exp_filename[0]);
|
170 |
+
$dst_r = ImageCreateTrueColor($thumb_width, $thumb_height);
|
171 |
+
imageColorAllocateAlpha($dst_r, 0, 0, 0, 127);
|
172 |
+
imagealphablending($dst_r, FALSE);
|
173 |
+
imagesavealpha($dst_r, TRUE);
|
174 |
+
imagecopyresampled($dst_r, $img_r, 0, 0, $x, $y, $thumb_width, $thumb_height, $w, $h);
|
175 |
+
imagealphablending($dst_r, FALSE);
|
176 |
+
imagesavealpha($dst_r, TRUE);
|
177 |
+
imagewebp($dst_r, $thumb_filename);
|
178 |
+
imagedestroy($img_r);
|
179 |
+
imagedestroy($dst_r);
|
180 |
+
}
|
181 |
else {
|
182 |
?>
|
183 |
<div class="message"><strong><?php echo __("You can't crop this type of image.", BWG()->prefix); ?></strong></div>
|
520 |
imagedestroy($thumb_source);
|
521 |
imagedestroy($thumb_rotate);
|
522 |
}
|
523 |
+
elseif ( $type_rotate == 18 ) {
|
524 |
+
$source = imagecreatefromwebp($filename);
|
525 |
+
$thumb_source = imagecreatefromwebp($thumb_filename);
|
526 |
+
imagealphablending($source, FALSE);
|
527 |
+
imagealphablending($thumb_source, FALSE);
|
528 |
+
$rotate = imagerotate($source, $edit_type, 0);
|
529 |
+
$thumb_rotate = imagerotate($thumb_source, $edit_type, 0);
|
530 |
+
imagewebp($rotate, $filename);
|
531 |
+
imagewebp($thumb_rotate, $thumb_filename);
|
532 |
+
imagedestroy($source);
|
533 |
+
imagedestroy($rotate);
|
534 |
+
imagedestroy($thumb_source);
|
535 |
+
imagedestroy($thumb_rotate);
|
536 |
+
}
|
537 |
}
|
538 |
elseif ( $edit_type == 'vertical' || $edit_type == 'horizontal' || $edit_type == 'both' ) {
|
539 |
function bwg_image_flip( $imgsrc, $mode ) {
|
622 |
imagedestroy($thumb_source);
|
623 |
imagedestroy($thumb_flip);
|
624 |
}
|
625 |
+
elseif ( $type_rotate == 18 ) {
|
626 |
+
$source = imagecreatefromwebp($filename);
|
627 |
+
$thumb_source = imagecreatefromwebp($thumb_filename);
|
628 |
+
imagealphablending($source, FALSE);
|
629 |
+
imagealphablending($thumb_source, FALSE);
|
630 |
+
imagesavealpha($source, TRUE);
|
631 |
+
imagesavealpha($thumb_source, TRUE);
|
632 |
+
$flip = bwg_image_flip($source, $edit_type);
|
633 |
+
$thumb_flip = bwg_image_flip($thumb_source, $edit_type);
|
634 |
+
imagealphablending($flip, FALSE);
|
635 |
+
imagealphablending($thumb_flip, FALSE);
|
636 |
+
imagesavealpha($flip, TRUE);
|
637 |
+
imagesavealpha($thumb_flip, TRUE);
|
638 |
+
imagewebp($flip, $filename);
|
639 |
+
imagewebp($thumb_flip, $thumb_filename);
|
640 |
+
imagedestroy($source);
|
641 |
+
imagedestroy($flip);
|
642 |
+
imagedestroy($thumb_source);
|
643 |
+
imagedestroy($thumb_flip);
|
644 |
+
}
|
645 |
}
|
646 |
elseif ( $edit_type == 'brightness' || $edit_type == 'contrast' || $edit_type == 'grayscale' || $edit_type == 'negative' || $edit_type == 'remove' || $edit_type == 'emboss' || $edit_type == 'smooth' ) {
|
647 |
switch ( $edit_type ) {
|
715 |
imagedestroy($source);
|
716 |
imagedestroy($thumb_source);
|
717 |
}
|
718 |
+
elseif ( $img_type == 18 ) {
|
719 |
+
$source = imagecreatefromwebp($filename);
|
720 |
+
$thumb_source = imagecreatefromwebp($thumb_filename);
|
721 |
+
imagealphablending($source, FALSE);
|
722 |
+
imagealphablending($thumb_source, FALSE);
|
723 |
+
imagesavealpha($source, TRUE);
|
724 |
+
imagesavealpha($thumb_source, TRUE);
|
725 |
+
imagefilter($source, $img_filter_type, $ratio);
|
726 |
+
imagefilter($thumb_source, $img_filter_type, $ratio);
|
727 |
+
imagewebp($source, $filename);
|
728 |
+
imagewebp($thumb_source, $thumb_filename);
|
729 |
+
imagedestroy($source);
|
730 |
+
imagedestroy($thumb_source);
|
731 |
+
}
|
732 |
}
|
733 |
elseif ( $edit_type == 'sepia' || $edit_type == 'dark_slate_grey' || $edit_type == 'saturate' ) {
|
734 |
switch ( $edit_type ) {
|
792 |
imagedestroy($source);
|
793 |
imagedestroy($thumb_source);
|
794 |
}
|
795 |
+
elseif ( $img_type == 18 ) {
|
796 |
+
$source = imagecreatefromwebp($filename);
|
797 |
+
$thumb_source = imagecreatefromwebp($thumb_filename);
|
798 |
+
imagealphablending($source, FALSE);
|
799 |
+
imagealphablending($thumb_source, FALSE);
|
800 |
+
imagesavealpha($source, TRUE);
|
801 |
+
imagesavealpha($thumb_source, TRUE);
|
802 |
+
imagefilter($source, $img_filter_type, $red, $green, $blue);
|
803 |
+
imagefilter($thumb_source, $img_filter_type, $red, $green, $blue);
|
804 |
+
imagewebp($source, $filename);
|
805 |
+
imagewebp($thumb_source, $thumb_filename);
|
806 |
+
imagedestroy($source);
|
807 |
+
imagedestroy($thumb_source);
|
808 |
+
}
|
809 |
}
|
810 |
elseif ( $edit_type == 'recover' ) {
|
811 |
global $wpdb;
|
admin/views/Galleries.php
CHANGED
@@ -142,6 +142,7 @@ class GalleriesView_bwg extends AdminView_bwg {
|
|
142 |
<div class="tablenav bottom">
|
143 |
<?php echo $this->pagination($params['page_url'], $params['total'], $params['items_per_page']); ?>
|
144 |
</div>
|
|
|
145 |
<?php
|
146 |
}
|
147 |
|
@@ -892,6 +893,7 @@ class GalleriesView_bwg extends AdminView_bwg {
|
|
892 |
<?php $paged = WDWLibrary::get('paged', 1, 'intval'); ?>
|
893 |
<div class="wd-hidden-values">
|
894 |
<input type="hidden" value="<?php echo !empty($params['row']->modified_date) ? $params['row']->modified_date : time() ?>" id="modified_date" name="modified_date" />
|
|
|
895 |
<input type="hidden" id="ids_string" name="ids_string" value="<?php echo $ids_string; ?>" />
|
896 |
<input type="hidden" id="paged" name="paged" value="<?php echo $paged; ?>" />
|
897 |
<input type="hidden" id="ajax_task" name="ajax_task" value="" />
|
142 |
<div class="tablenav bottom">
|
143 |
<?php echo $this->pagination($params['page_url'], $params['total'], $params['items_per_page']); ?>
|
144 |
</div>
|
145 |
+
<input type="hidden" id="ids_exclude" name="ids_exclude" value="" />
|
146 |
<?php
|
147 |
}
|
148 |
|
893 |
<?php $paged = WDWLibrary::get('paged', 1, 'intval'); ?>
|
894 |
<div class="wd-hidden-values">
|
895 |
<input type="hidden" value="<?php echo !empty($params['row']->modified_date) ? $params['row']->modified_date : time() ?>" id="modified_date" name="modified_date" />
|
896 |
+
<input type="hidden" id="ids_exclude" name="ids_exclude" value="" />
|
897 |
<input type="hidden" id="ids_string" name="ids_string" value="<?php echo $ids_string; ?>" />
|
898 |
<input type="hidden" id="paged" name="paged" value="<?php echo $paged; ?>" />
|
899 |
<input type="hidden" id="ajax_task" name="ajax_task" value="" />
|
admin/views/Options.php
CHANGED
@@ -146,8 +146,8 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
146 |
<div class="wd-group">
|
147 |
<label class="wd-label" for="images_directory"><?php _e('Images directory', BWG()->prefix); ?></label>
|
148 |
<div class="bwg-flex">
|
149 |
-
<input id="images_directory" name="images_directory" type="text" style="display:inline-block; width:100%;" value="<?php echo $row->images_directory; ?>" />
|
150 |
-
<input type="hidden" id="old_images_directory" name="old_images_directory" value="<?php echo $row->old_images_directory; ?>" />
|
151 |
</div>
|
152 |
<p class="description"><?php _e('Provide the path of an existing folder inside the WordPress directory of your website to store uploaded images.<br />The content of the previous directory will be moved to the new one.', BWG()->prefix); ?></p>
|
153 |
</div>
|
@@ -179,8 +179,8 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
179 |
<div class="wd-group">
|
180 |
<label class="wd-label" for="upload_img_width"><?php _e('Image dimensions', BWG()->prefix); ?></label>
|
181 |
<div class="bwg-flex">
|
182 |
-
<input type="number" name="upload_img_width" id="upload_img_width" value="<?php echo $row->upload_img_width; ?>" min="0" /><span>x</span>
|
183 |
-
<input type="number" name="upload_img_height" id="upload_img_height" value="<?php echo $row->upload_img_height; ?>" min="0" /><span>px</span>
|
184 |
</div>
|
185 |
<p class="description"><?php _e('Specify the maximum dimensions of uploaded images (set 0 for original size).', BWG()->prefix); ?></p>
|
186 |
</div>
|
@@ -189,9 +189,9 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
189 |
<div class="wd-group">
|
190 |
<label class="wd-label" for="upload_thumb_width"><?php _e('Generated thumbnail dimensions', BWG()->prefix); ?></label>
|
191 |
<div class="bwg-flex">
|
192 |
-
<input type="number" name="upload_thumb_width" id="upload_thumb_width" value="<?php echo $row->upload_thumb_width; ?>" min="0" /><span>x</span>
|
193 |
-
<input type="number" name="upload_thumb_height" id="upload_thumb_height" value="<?php echo $row->upload_thumb_height; ?>" min="0" /><span>px</span>
|
194 |
-
<input type="hidden" name="imgcount" id="bwg_imgcount" value="<?php echo $imgcount; ?>">
|
195 |
<input type="submit" class="button-primary" onclick="<?php echo (BWG()->is_demo ? 'alert(\'' . addslashes(__('This option is disabled in demo.', BWG()->prefix)) . '\'); return false;' : (BWG()->wp_editor_exists ? 'return bwg_recreate_thumb(0);' : 'alert(\'' . addslashes(__('Image edit functionality is not supported by your web host.', BWG()->prefix)) . '\'); return false;')); ?>" value="<?php _e('Recreate', BWG()->prefix); ?>" />
|
196 |
</div>
|
197 |
<p class="description"><?php _e('Specify the maximum dimensions of generated thumbnails. They must be larger than frontend thumbnail dimensions.', BWG()->prefix); ?></p>
|
@@ -201,7 +201,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
201 |
<div class="wd-group">
|
202 |
<label class="wd-label" for="image_quality"><?php _e('Image quality', BWG()->prefix); ?></label>
|
203 |
<div class="bwg-flex">
|
204 |
-
<input type="number" name="image_quality" id="image_quality" value="<?php echo $row->image_quality; ?>" min="0" max="100" /><span>%</span>
|
205 |
</div>
|
206 |
<p class="description"><?php _e('Set the quality of gallery images. Provide a value from 0 to 100%.', BWG()->prefix); ?></p>
|
207 |
</div>
|
@@ -240,7 +240,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
240 |
<div class="wd-group">
|
241 |
<label class="wd-label" for="preload_images_count"><?php _e('Number of preloaded images', BWG()->prefix); ?></label>
|
242 |
<div class="bwg-flex">
|
243 |
-
<input type="number" name="preload_images_count" id="preload_images_count" value="<?php echo $row->preload_images_count; ?>" min="0" />
|
244 |
</div>
|
245 |
<p class="description"><?php _e('Specify the number of images to preload, e.g. 5 (set 0 for all).', BWG()->prefix); ?></p>
|
246 |
</div>
|
@@ -521,7 +521,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
521 |
<?php
|
522 |
foreach ($gallery_types_name as $key=>$gallery_type_name) {
|
523 |
?>
|
524 |
-
<option <?php echo selected($gallery_type_name,true); ?> value="<?php echo $key; ?>"><?php echo $gallery_type_name; ?></option>
|
525 |
<?php
|
526 |
}
|
527 |
?>
|
@@ -533,9 +533,9 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
533 |
<?php
|
534 |
foreach ($gallery_types_name as $key=>$gallery_type_name) {
|
535 |
?>
|
536 |
-
<li class="gallery-type-li" data-value="<?php echo $key; ?>">
|
537 |
-
<img src="<?php echo BWG()->plugin_url . '/images/' . $key . '.svg'; ?>">
|
538 |
-
<span><?php echo $gallery_type_name; ?> </span>
|
539 |
<?php if ( !BWG()->is_pro && ( $key == 'thumbnails_masonry' || $key == 'thumbnails_mosaic' || $key == 'blog_style' || $key == 'carousel' )) { ?>
|
540 |
<span class="pro_btn">Premium</span>
|
541 |
<?php } ?>
|
@@ -619,7 +619,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
619 |
<?php
|
620 |
foreach ($album_types_name as $key=>$album_type_name) {
|
621 |
?>
|
622 |
-
<option <?php echo selected($album_type_name,true); ?> value="<?php echo $key; ?>"><?php echo $album_type_name; ?></option>
|
623 |
<?php
|
624 |
}
|
625 |
?>
|
@@ -631,8 +631,8 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
631 |
<?php
|
632 |
foreach ($album_types_name as $key=>$album_type_name) {
|
633 |
?>
|
634 |
-
<li class="gallery-type-li" data-value="<?php echo $key; ?>">
|
635 |
-
<img src="<?php echo BWG()->plugin_url . '/images/' . $key . '.svg'; ?>">
|
636 |
<span><?php echo $album_type_name; ?> </span>
|
637 |
<?php if ( !BWG()->is_pro && ( $key == 'album_masonry_preview' ) ) { ?>
|
638 |
<span class="pro_btn">Premium</span>
|
@@ -710,7 +710,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
710 |
</div>
|
711 |
<div class="wd-box-content wd-width-100 <?php echo BWG()->is_pro ? '' : ' bwg-disabled-option'; ?>">
|
712 |
<div class="wd-group" id="login_with_instagram">
|
713 |
-
<input id="instagram_access_token" name="instagram_access_token" type="hidden" size="30" value="<?php echo $row->instagram_access_token; ?>" readonly />
|
714 |
<?php if ( empty($row->instagram_access_token) ) { ?>
|
715 |
<a <?php echo BWG()->is_pro ? 'href="' . $instagram_return_url . '"' : 'disabled="disabled"'; ?> class="bwg-connect-instagram">
|
716 |
<?php _e('Connect an Instagram Account', BWG()->prefix) ?>
|
@@ -720,11 +720,11 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
720 |
else {
|
721 |
?>
|
722 |
<ul class="bwg-accounts-list">
|
723 |
-
<li class="bwg-account-list-<?php echo $row->instagram_user_id; ?>">
|
724 |
<div class="bwg-account-block">
|
725 |
<div>
|
726 |
<div class="bwg-account-user-info">
|
727 |
-
<h4 class="bwg-account-name"><?php echo $row->instagram_username; ?></h4>
|
728 |
</div>
|
729 |
</div>
|
730 |
<div>
|
@@ -737,7 +737,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
737 |
<div>
|
738 |
<p class="bwg-input-group">
|
739 |
<label><?php _e('User ID:', BWG()->prefix) ?></label>
|
740 |
-
<input type="text" value="<?php echo $row->instagram_user_id; ?>" readonly="readonly"
|
741 |
onclick="this.focus();this.select()"
|
742 |
title="To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac).">
|
743 |
</p>
|
@@ -784,7 +784,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
784 |
<?php
|
785 |
foreach ($permissions as $key => $permission) {
|
786 |
?>
|
787 |
-
<option value="<?php echo $key; ?>" <?php if ($row->permissions == $key) echo 'selected="selected"'; ?>><?php echo $permission; ?></option>
|
788 |
<?php
|
789 |
}
|
790 |
?>
|
@@ -902,13 +902,13 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
902 |
$query_url = wp_nonce_url( $query_url, 'addImages', 'bwg_nonce' );
|
903 |
$query_url = add_query_arg(array('TB_iframe' => '1'), $query_url );
|
904 |
?>
|
905 |
-
<a href="<?php echo $query_url; ?>" id="button_add_watermark_image" class="button-primary thickbox thickbox-preview"
|
906 |
title="<?php _e('Select Image', BWG()->prefix); ?>"
|
907 |
onclick="return false;">
|
908 |
<?php _e('Select Image', BWG()->prefix); ?>
|
909 |
</a>
|
910 |
<br /><?php _e('or', BWG()->prefix); ?><br />
|
911 |
-
<input type="text" id="watermark_url" name="watermark_url" value="<?php echo $row->watermark_url; ?>" onchange="preview_watermark()" placeholder="e.g. https://example.com/uploads/watermark.png" />
|
912 |
</div>
|
913 |
<p class="description"><?php _e('Provide the absolute URL of the image you would like to use as advertisement.', BWG()->prefix) ?></p>
|
914 |
</div>
|
@@ -917,7 +917,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
917 |
<div class="wd-group">
|
918 |
<label class="wd-label" for="watermark_text"><?php _e('Advertisement text', BWG()->prefix); ?></label>
|
919 |
<div class="bwg-flex">
|
920 |
-
<input type="text" name="watermark_text" id="watermark_text" style="width: 100%;" value="<?php echo $row->watermark_text; ?>" onchange="preview_watermark()" onkeypress="preview_watermark()" />
|
921 |
</div>
|
922 |
<p class="description"><?php _e('Write the text to add to images as advertisement.', BWG()->prefix) ?></p>
|
923 |
</div>
|
@@ -926,7 +926,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
926 |
<div class="wd-group">
|
927 |
<label class="wd-label" for="watermark_link"><?php _e('Advertisement link', BWG()->prefix); ?></label>
|
928 |
<div class="bwg-flex">
|
929 |
-
<input type="text" name="watermark_link" id="watermark_link" style="width: 100%;" value="<?php echo $row->watermark_link; ?>" onchange="preview_watermark()" onkeypress="preview_watermark()" />
|
930 |
</div>
|
931 |
<p class="description"><?php _e('Provide the link to be added to advertisement on images.', BWG()->prefix) ?></p>
|
932 |
</div>
|
@@ -935,8 +935,8 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
935 |
<div class="wd-group">
|
936 |
<label class="wd-label" for="watermark_width"><?php _e('Advertisement dimensions', BWG()->prefix); ?></label>
|
937 |
<div class="bwg-flex">
|
938 |
-
<input type="number" name="watermark_width" id="watermark_width" value="<?php echo $row->watermark_width; ?>" min="0" onchange="preview_watermark()" /><span>x</span>
|
939 |
-
<input type="number" name="watermark_height" id="watermark_height" value="<?php echo $row->watermark_height; ?>" min="0" onchange="preview_watermark()" /><span>px</span>
|
940 |
</div>
|
941 |
<p class="description"><?php _e('Select the dimensions of the advertisement image.', BWG()->prefix) ?></p>
|
942 |
</div>
|
@@ -945,7 +945,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
945 |
<div class="wd-group">
|
946 |
<label class="wd-label" for="watermark_font_size"><?php _e('Advertisement font size', BWG()->prefix); ?></label>
|
947 |
<div class="bwg-flex">
|
948 |
-
<input type="number" name="watermark_font_size" id="watermark_font_size" value="<?php echo $row->watermark_font_size; ?>" min="0" onchange="preview_watermark()" /><span>px</span>
|
949 |
</div>
|
950 |
<p class="description"><?php _e('Specify the font size of the advertisement text.', BWG()->prefix) ?></p>
|
951 |
</div>
|
@@ -961,7 +961,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
961 |
$watermark_font_families = ($is_google_fonts == true) ? $google_fonts : $watermark_fonts;
|
962 |
foreach ($watermark_font_families as $watermark_font) {
|
963 |
?>
|
964 |
-
<option value="<?php echo $watermark_font; ?>" <?php if ($row->watermark_font == $watermark_font) echo 'selected="selected"'; ?>><?php echo $watermark_font; ?></option>
|
965 |
<?php
|
966 |
}
|
967 |
?>
|
@@ -980,7 +980,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
980 |
<div class="wd-group">
|
981 |
<label class="wd-label" for="watermark_color"><?php _e('Advertisement color', BWG()->prefix); ?></label>
|
982 |
<div class="bwg-flex">
|
983 |
-
<input type="text" name="watermark_color" id="watermark_color" value="<?php echo $row->watermark_color; ?>" class="jscolor" onchange="preview_watermark()" />
|
984 |
</div>
|
985 |
<p class="description"><?php _e('Choose the color for the advertisement text on images.', BWG()->prefix) ?></p>
|
986 |
</div>
|
@@ -989,7 +989,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
989 |
<div class="wd-group">
|
990 |
<label class="wd-label" for="watermark_opacity"><?php _e('Advertisement opacity', BWG()->prefix); ?></label>
|
991 |
<div class="bwg-flex">
|
992 |
-
<input type="number" name="watermark_opacity" id="watermark_opacity" value="<?php echo $row->watermark_opacity; ?>" min="0" max="100" onchange="preview_watermark()" /><span>%</span>
|
993 |
</div>
|
994 |
<p class="description"><?php _e('Specify the opacity of the advertisement. The value must be between 0 to 100.', BWG()->prefix) ?></p>
|
995 |
</div>
|
@@ -1057,13 +1057,13 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1057 |
$query_url = wp_nonce_url( $query_url, 'addImages', 'bwg_nonce' );
|
1058 |
$query_url = add_query_arg(array('TB_iframe' => '1'), $query_url );
|
1059 |
?>
|
1060 |
-
<a href="<?php echo $query_url; ?>" id="button_add_built_in_watermark_image" class="button-primary thickbox thickbox-preview"
|
1061 |
title="<?php _e('Select Image', BWG()->prefix); ?>"
|
1062 |
onclick="return false;">
|
1063 |
<?php _e('Select Image', BWG()->prefix); ?>
|
1064 |
</a>
|
1065 |
<br /><?php _e('or', BWG()->prefix); ?><br />
|
1066 |
-
<input type="text" id="built_in_watermark_url" name="built_in_watermark_url" value="<?php echo $row->built_in_watermark_url; ?>" onchange="preview_built_in_watermark()" placeholder="e.g. https://example.com/uploads/watermark.png" />
|
1067 |
</div>
|
1068 |
<p class="description"><?php _e('Provide the absolute URL of the image you would like to use as watermark.', BWG()->prefix); ?><br><?php _e('Only .png format is supported.', BWG()->prefix) ?></p>
|
1069 |
</div>
|
@@ -1081,7 +1081,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1081 |
<div class="wd-group">
|
1082 |
<label class="wd-label" for="built_in_watermark_size"><?php _e('Watermark size', BWG()->prefix); ?></label>
|
1083 |
<div class="bwg-flex">
|
1084 |
-
<input type="number" name="built_in_watermark_size" id="built_in_watermark_size" value="<?php echo $row->built_in_watermark_size; ?>" min="0" max="100" onchange="preview_built_in_watermark()" /><span>%</span>
|
1085 |
</div>
|
1086 |
<p class="description"><?php _e('Specify the size of watermark on images in percent.', BWG()->prefix) ?></p>
|
1087 |
</div>
|
@@ -1090,7 +1090,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1090 |
<div class="wd-group">
|
1091 |
<label class="wd-label" for="built_in_watermark_font_size"><?php _e('Watermark font size', BWG()->prefix); ?></label>
|
1092 |
<div class="bwg-flex">
|
1093 |
-
<input type="number" name="built_in_watermark_font_size" id="built_in_watermark_font_size" value="<?php echo $row->built_in_watermark_font_size; ?>" min="0" onchange="preview_built_in_watermark()" />
|
1094 |
</div>
|
1095 |
<p class="description"><?php _e('Specify the font size of the watermark text.', BWG()->prefix) ?></p>
|
1096 |
</div>
|
@@ -1103,7 +1103,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1103 |
<?php
|
1104 |
foreach ($built_in_watermark_fonts as $watermark_font) {
|
1105 |
?>
|
1106 |
-
<option value="<?php echo $watermark_font; ?>" <?php if ($row->built_in_watermark_font == $watermark_font) echo 'selected="selected"'; ?>><?php echo $watermark_font; ?></option>
|
1107 |
<?php
|
1108 |
}
|
1109 |
?>
|
@@ -1128,7 +1128,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1128 |
<div class="wd-group">
|
1129 |
<label class="wd-label" for="built_in_watermark_color"><?php _e('Watermark color', BWG()->prefix); ?></label>
|
1130 |
<div class="bwg-flex">
|
1131 |
-
<input type="text" name="built_in_watermark_color" id="built_in_watermark_color" value="<?php echo $row->built_in_watermark_color; ?>" class="jscolor" onchange="preview_built_in_watermark()" />
|
1132 |
</div>
|
1133 |
<p class="description"><?php _e('Choose the color for the watermark text on images.', BWG()->prefix) ?></p>
|
1134 |
</div>
|
@@ -1137,7 +1137,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1137 |
<div class="wd-group">
|
1138 |
<label class="wd-label" for="built_in_watermark_opacity"><?php _e('Watermark opacity', BWG()->prefix); ?></label>
|
1139 |
<div class="bwg-flex">
|
1140 |
-
<input type="number" name="built_in_watermark_opacity" id="built_in_watermark_opacity" value="<?php echo $row->built_in_watermark_opacity; ?>" min="0" max="100" onchange="preview_built_in_watermark()" /><span>%</span>
|
1141 |
</div>
|
1142 |
<p class="description"><?php _e('Specify the opacity of the watermark. The value must be between 0 to 100.', BWG()->prefix) ?></p>
|
1143 |
</div>
|
@@ -1186,9 +1186,9 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1186 |
<div id="loading_div" class="bwg_show"></div>
|
1187 |
<input id="recreate" name="recreate" type="hidden" value="" />
|
1188 |
<input id="watermark" name="watermark" type="hidden" value="" />
|
1189 |
-
<input id="active_tab" name="active_tab" type="hidden" value="<?php echo $params['active_tab']; ?>" />
|
1190 |
-
<input id="gallery_type" name="gallery_type" type="hidden" value="<?php echo $params['gallery_type']; ?>" />
|
1191 |
-
<input id="album_type" name="album_type" type="hidden" value="<?php echo $params['album_type']; ?>" />
|
1192 |
<script>
|
1193 |
var bwg_options_url_ajax = '<?php echo $options_url_ajax; ?>';
|
1194 |
function bwg_add_built_in_watermark_image(files) {
|
@@ -1315,8 +1315,8 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1315 |
<div class="wd-group">
|
1316 |
<label class="wd-label" for="thumb_width"><?php _e('Thumbnail dimensions', BWG()->prefix); ?></label>
|
1317 |
<div class="bwg-flex">
|
1318 |
-
<input type="number" name="thumb_width" id="thumb_width" value="<?php echo $row->thumb_width; ?>" min="0" /><span>x</span>
|
1319 |
-
<input type="number" name="thumb_height" id="thumb_height" value="<?php echo $row->thumb_height; ?>" min="0" /><span>px</span>
|
1320 |
</div>
|
1321 |
<p class="description"><?php _e('The default dimensions of thumbnails which will display on published galleries.', BWG()->prefix); ?></p>
|
1322 |
</div>
|
@@ -1325,7 +1325,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1325 |
<div class="wd-group">
|
1326 |
<label class="wd-label" for="image_column_number"><?php _e('Number of image columns', BWG()->prefix); ?></label>
|
1327 |
<div class="bwg-flex">
|
1328 |
-
<input type="number" name="image_column_number" id="image_column_number" value="<?php echo $row->image_column_number; ?>" min="0" />
|
1329 |
</div>
|
1330 |
<p class="description"><?php _e('Set the maximum number of image columns in galleries. Note, that the parent container needs to be large enough to display all columns.', BWG()->prefix); ?></p>
|
1331 |
</div>
|
@@ -1349,7 +1349,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1349 |
<div class="wd-group">
|
1350 |
<label class="wd-label" for="images_per_page"><?php _e('Images per page', BWG()->prefix); ?></label>
|
1351 |
<div class="bwg-flex">
|
1352 |
-
<input type="number" name="images_per_page" id="images_per_page" value="<?php echo $row->images_per_page; ?>" min="0" />
|
1353 |
</div>
|
1354 |
<p class="description"><?php _e('Specify the number of images to display per page on galleries. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
1355 |
</div>
|
@@ -1358,7 +1358,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1358 |
<div class="wd-group">
|
1359 |
<label class="wd-label" for="load_more_image_count"><?php _e('Images per load', BWG()->prefix); ?></label>
|
1360 |
<div class="bwg-flex">
|
1361 |
-
<input type="number" name="load_more_image_count" id="load_more_image_count" value="<?php echo $row->load_more_image_count; ?>" min="0" />
|
1362 |
</div>
|
1363 |
<p class="description"><?php _e('Specify the number of images to display per load on galleries.', BWG()->prefix); ?></p>
|
1364 |
</div>
|
@@ -1401,7 +1401,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1401 |
<div class="wd-group">
|
1402 |
<label class="wd-label" for="placeholder"><?php _e('Add placeholder to search', BWG()->prefix); ?></label>
|
1403 |
<div class="bwg-flex">
|
1404 |
-
<input type="text" name="placeholder" id="placeholder" value="<?php echo $row->placeholder; ?>" />
|
1405 |
</div>
|
1406 |
</div>
|
1407 |
</div>
|
@@ -1409,7 +1409,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1409 |
<div class="wd-group">
|
1410 |
<label class="wd-label" for="search_box_width"><?php _e('Search box maximum width', BWG()->prefix); ?></label>
|
1411 |
<div class="bwg-flex">
|
1412 |
-
<input type="number" name="search_box_width" id="search_box_width" value="<?php echo $row->search_box_width; ?>" min="0" /><span>px</span>
|
1413 |
</div>
|
1414 |
</div>
|
1415 |
</div>
|
@@ -1541,7 +1541,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1541 |
<div class="wd-group">
|
1542 |
<label class="wd-label" for="masonry_thumb_size"><?php _e('Thumbnail size', BWG()->prefix); ?></label>
|
1543 |
<div class="bwg-flex">
|
1544 |
-
<input type="number" name="masonry_thumb_size" id="masonry_thumb_size" value="<?php echo $row->masonry_thumb_size; ?>" min="0" /><span>px</span>
|
1545 |
</div>
|
1546 |
<p class="description"><?php _e('The default size of thumbnails which will display on published galleries.', BWG()->prefix); ?></p>
|
1547 |
</div>
|
@@ -1551,7 +1551,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1551 |
<label class="wd-label masonry_col_num" style="<?php echo ($row->masonry == "vertical") ? '' : 'display:none'; ?>" for="masonry_image_column_number"><?php _e('Number of image columns', BWG()->prefix); ?></label>
|
1552 |
<label class="wd-label masonry_row_num" style="<?php echo ($row->masonry == "vertical") ? 'display:none' : ''; ?>" for="masonry_image_column_number"><?php _e('Number of image rows', BWG()->prefix); ?></label>
|
1553 |
<div class="bwg-flex">
|
1554 |
-
<input type="number" name="masonry_image_column_number" id="masonry_image_column_number" value="<?php echo $row->masonry_image_column_number; ?>" min="0" />
|
1555 |
</div>
|
1556 |
<p class="description"><?php _e('Set the maximum number of image columns (or rows) in galleries. Note, that the parent container needs to be large enough to display all columns.', BWG()->prefix); ?></p>
|
1557 |
</div>
|
@@ -1575,7 +1575,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1575 |
<div class="wd-group">
|
1576 |
<label class="wd-label" for="masonry_images_per_page"><?php _e('Images per page', BWG()->prefix); ?></label>
|
1577 |
<div class="bwg-flex">
|
1578 |
-
<input type="number" name="masonry_images_per_page" id="masonry_images_per_page" value="<?php echo $row->masonry_images_per_page; ?>" min="0" />
|
1579 |
</div>
|
1580 |
<p class="description"><?php _e('Specify the number of images to display per page on galleries. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
1581 |
</div>
|
@@ -1584,7 +1584,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1584 |
<div class="wd-group">
|
1585 |
<label class="wd-label" for="masonry_load_more_image_count"><?php _e('Images per load', BWG()->prefix); ?></label>
|
1586 |
<div class="bwg-flex">
|
1587 |
-
<input type="number" name="masonry_load_more_image_count" id="masonry_load_more_image_count" value="<?php echo $row->masonry_load_more_image_count; ?>" min="0" />
|
1588 |
</div>
|
1589 |
<p class="description"><?php _e('Specify the number of images to display per load on galleries.', BWG()->prefix); ?></p>
|
1590 |
</div>
|
@@ -1627,7 +1627,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1627 |
<div class="wd-group">
|
1628 |
<label class="wd-label" for="placeholder"><?php _e('Add placeholder to search', BWG()->prefix); ?></label>
|
1629 |
<div class="bwg-flex">
|
1630 |
-
<input type="text" name="masonry_placeholder" id="masonry_placeholder" value="<?php echo $row->masonry_placeholder; ?>" />
|
1631 |
</div>
|
1632 |
</div>
|
1633 |
</div>
|
@@ -1635,7 +1635,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1635 |
<div class="wd-group">
|
1636 |
<label class="wd-label" for="masonry_search_box_width"><?php _e('Search box maximum width', BWG()->prefix); ?></label>
|
1637 |
<div class="bwg-flex">
|
1638 |
-
<input type="number" name="masonry_search_box_width" id="masonry_search_box_width" value="<?php echo $row->masonry_search_box_width; ?>" min="0" /><span>px</span>
|
1639 |
</div>
|
1640 |
</div>
|
1641 |
</div>
|
@@ -1775,7 +1775,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1775 |
<div class="wd-group">
|
1776 |
<label class="wd-label" for="mosaic_total_width"><?php _e('Width of mosaic galleries', BWG()->prefix); ?></label>
|
1777 |
<div class="bwg-flex">
|
1778 |
-
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="mosaic_total_width" id="mosaic_total_width" value="<?php echo $row->mosaic_total_width; ?>" min="0" /><span>%</span>
|
1779 |
</div>
|
1780 |
<p class="description"><?php _e('The total width of mosaic galleries as a percentage of container\'s width.', BWG()->prefix); ?></p>
|
1781 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
@@ -1785,7 +1785,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1785 |
<div class="wd-group">
|
1786 |
<label class="wd-label" for="mosaic_thumb_size"><?php _e('Thumbnail size', BWG()->prefix); ?></label>
|
1787 |
<div class="bwg-flex">
|
1788 |
-
<input type="number" name="mosaic_thumb_size" id="mosaic_thumb_size" value="<?php echo $row->mosaic_thumb_size; ?>" min="0" /><span>px</span>
|
1789 |
</div>
|
1790 |
<p class="description"><?php _e('The default size of thumbnails which will display on published galleries.', BWG()->prefix); ?></p>
|
1791 |
</div>
|
@@ -1809,7 +1809,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1809 |
<div class="wd-group">
|
1810 |
<label class="wd-label" for="mosaic_images_per_page"><?php _e('Images per page', BWG()->prefix); ?></label>
|
1811 |
<div class="bwg-flex">
|
1812 |
-
<input type="number" name="mosaic_images_per_page" id="mosaic_images_per_page" value="<?php echo $row->mosaic_images_per_page; ?>" min="0" />
|
1813 |
</div>
|
1814 |
<p class="description"><?php _e('Specify the number of images to display per page on galleries. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
1815 |
</div>
|
@@ -1818,7 +1818,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1818 |
<div class="wd-group">
|
1819 |
<label class="wd-label" for="mosaic_load_more_image_count"><?php _e('Images per load', BWG()->prefix); ?></label>
|
1820 |
<div class="bwg-flex">
|
1821 |
-
<input type="number" name="mosaic_load_more_image_count" id="mosaic_load_more_image_count" value="<?php echo $row->mosaic_load_more_image_count; ?>" min="0" />
|
1822 |
</div>
|
1823 |
<p class="description"><?php _e('Specify the number of images to display per load on galleries.', BWG()->prefix); ?></p>
|
1824 |
</div>
|
@@ -1861,7 +1861,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1861 |
<div class="wd-group">
|
1862 |
<label class="wd-label" for="mosaic_placeholder"><?php _e('Add placeholder to search', BWG()->prefix); ?></label>
|
1863 |
<div class="bwg-flex">
|
1864 |
-
<input type="text" name="mosaic_placeholder" id="mosaic_placeholder" value="<?php echo $row->mosaic_placeholder; ?>" />
|
1865 |
</div>
|
1866 |
</div>
|
1867 |
</div>
|
@@ -1869,7 +1869,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1869 |
<div class="wd-group">
|
1870 |
<label class="wd-label" for="mosaic_search_box_width"><?php _e('Search box maximum width', BWG()->prefix); ?></label>
|
1871 |
<div class="bwg-flex">
|
1872 |
-
<input type="number" name="mosaic_search_box_width" id="mosaic_search_box_width" value="<?php echo $row->mosaic_search_box_width; ?>" min="0" /><span>px</span>
|
1873 |
</div>
|
1874 |
</div>
|
1875 |
</div>
|
@@ -1979,7 +1979,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1979 |
<?php
|
1980 |
foreach ($effects as $key => $effect) {
|
1981 |
?>
|
1982 |
-
<option value="<?php echo $key; ?>"
|
1983 |
<?php echo (!BWG()->is_pro && $key != 'none' && $key != 'fade') ? 'disabled="disabled" title="' . __('This effect is disabled in free version.', BWG()->prefix) . '"' : ''; ?>
|
1984 |
<?php if ($row->slideshow_type == $key) echo 'selected="selected"'; ?>><?php echo __($effect, BWG()->prefix); ?></option>
|
1985 |
<?php
|
@@ -1994,7 +1994,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
1994 |
<div class="wd-group">
|
1995 |
<label class="wd-label" for="slideshow_effect_duration"><?php _e('Effect duration', BWG()->prefix); ?></label>
|
1996 |
<div class="bwg-flex">
|
1997 |
-
<input type="number" name="slideshow_effect_duration" id="slideshow_effect_duration" value="<?php echo $row->slideshow_effect_duration; ?>" min="0" step="0.1" /><span>sec.</span>
|
1998 |
</div>
|
1999 |
<p class="description"><?php _e('Set the duration of your slideshow animation effect.', BWG()->prefix); ?></p>
|
2000 |
</div>
|
@@ -2003,7 +2003,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2003 |
<div class="wd-group">
|
2004 |
<label class="wd-label" for="slideshow_interval"><?php _e('Time interval', BWG()->prefix); ?></label>
|
2005 |
<div class="bwg-flex">
|
2006 |
-
<input type="number" name="slideshow_interval" id="slideshow_interval" value="<?php echo $row->slideshow_interval; ?>" min="0" /><span>sec.</span>
|
2007 |
</div>
|
2008 |
<p class="description"><?php _e('Specify the time interval between slides in Photo Gallery\'s Slideshow view.', BWG()->prefix); ?></p>
|
2009 |
</div>
|
@@ -2012,8 +2012,8 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2012 |
<div class="wd-group">
|
2013 |
<label class="wd-label" for="slideshow_width"><?php _e('Slideshow dimensions', BWG()->prefix); ?></label>
|
2014 |
<div class="bwg-flex">
|
2015 |
-
<input type="number" name="slideshow_width" id="slideshow_width" value="<?php echo $row->slideshow_width; ?>" min="0" /><span>px</span>
|
2016 |
-
<input type="number" name="slideshow_height" id="slideshow_height" value="<?php echo $row->slideshow_height; ?>" min="0" /><span>px</span>
|
2017 |
</div>
|
2018 |
<p class="description"><?php _e('Set the default dimensions of your slideshow galleries.', BWG()->prefix); ?></p>
|
2019 |
</div>
|
@@ -2100,7 +2100,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2100 |
<div class="wd-group">
|
2101 |
<label class="wd-label" for="slideshow_thumbnails_count"><?php _e('Slideshow thumbnails count', BWG()->prefix); ?></label>
|
2102 |
<div class="bwg-flex">
|
2103 |
-
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="slideshow_thumbnails_count" id="slideshow_thumbnails_count" value="<?php echo $row->slideshow_thumbnails_count; ?>" min="1" />
|
2104 |
</div>
|
2105 |
<p class="description"><?php _e('Set the number of items that will be displayed in the filmstrip. This will also construct the width of the filmstrip.', BWG()->prefix); ?></p>
|
2106 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
@@ -2110,7 +2110,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2110 |
<div class="wd-group">
|
2111 |
<label class="wd-label" for="slideshow_filmstrip_height"><?php _e('Slideshow filmstrip size', BWG()->prefix); ?></label>
|
2112 |
<div class="bwg-flex">
|
2113 |
-
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="slideshow_filmstrip_height" id="slideshow_filmstrip_height" value="<?php echo $row->slideshow_filmstrip_height; ?>" min="0" /><span>px</span>
|
2114 |
</div>
|
2115 |
<p class="description"><?php _e('Set the size of your filmstrip. If the filmstrip is horizontal, this indicates its height, whereas for vertical filmstrips it sets the width.', BWG()->prefix); ?></p>
|
2116 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
@@ -2214,7 +2214,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2214 |
<div class="wd-group">
|
2215 |
<label class="wd-label" for="slideshow_audio_url"><?php _e('Audio URL', BWG()->prefix); ?></label>
|
2216 |
<div class="bwg-flex">
|
2217 |
-
<input type="text" id="slideshow_audio_url" name="slideshow_audio_url" value="<?php echo $row->slideshow_audio_url; ?>" />
|
2218 |
</div>
|
2219 |
<p class="description"><?php _e('Provide the absolute URL of the audio file you would like to play with your slideshow.', BWG()->prefix); ?></p>
|
2220 |
</div>
|
@@ -2243,7 +2243,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2243 |
<div class="wd-group">
|
2244 |
<label class="wd-label" for="image_browser_width"><?php _e('Image width', BWG()->prefix); ?></label>
|
2245 |
<div class="bwg-flex">
|
2246 |
-
<input type="number" name="image_browser_width" id="image_browser_width" value="<?php echo $row->image_browser_width; ?>" min="0" /><span>px</span>
|
2247 |
</div>
|
2248 |
<p class="description"><?php _e('Specify the default width of images in Image Browser view.', BWG()->prefix); ?></p>
|
2249 |
</div>
|
@@ -2305,7 +2305,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2305 |
<div class="wd-group">
|
2306 |
<label class="wd-label" for="image_browser_placeholder"><?php _e('Add placeholder to search', BWG()->prefix); ?></label>
|
2307 |
<div class="bwg-flex">
|
2308 |
-
<input type="text" name="image_browser_placeholder" id="image_browser_placeholder" value="<?php echo $row->image_browser_placeholder; ?>" />
|
2309 |
</div>
|
2310 |
</div>
|
2311 |
</div>
|
@@ -2313,7 +2313,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2313 |
<div class="wd-group">
|
2314 |
<label class="wd-label" for="image_browser_search_box_width"><?php _e('Search box maximum width', BWG()->prefix); ?></label>
|
2315 |
<div class="bwg-flex">
|
2316 |
-
<input type="number" name="image_browser_search_box_width" id="image_browser_search_box_width" value="<?php echo $row->image_browser_search_box_width; ?>" min="0" /><span>px</span>
|
2317 |
</div>
|
2318 |
</div>
|
2319 |
</div>
|
@@ -2383,7 +2383,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2383 |
<div class="wd-group">
|
2384 |
<label class="wd-label" for="blog_style_width"><?php _e('Image width', BWG()->prefix); ?></label>
|
2385 |
<div class="bwg-flex">
|
2386 |
-
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="blog_style_width" id="blog_style_width" value="<?php echo $row->blog_style_width; ?>" min="0" /><span>px</span>
|
2387 |
</div>
|
2388 |
<p class="description"><?php _e('Specify the default width of images in Blog Style view.', BWG()->prefix); ?></p>
|
2389 |
</div>
|
@@ -2409,7 +2409,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2409 |
<div class="wd-group">
|
2410 |
<label class="wd-label" for="blog_style_images_per_page"><?php _e('Images per page', BWG()->prefix); ?></label>
|
2411 |
<div class="bwg-flex">
|
2412 |
-
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="blog_style_images_per_page" id="blog_style_images_per_page" value="<?php echo $row->blog_style_images_per_page; ?>" min="0" />
|
2413 |
</div>
|
2414 |
<p class="description"><?php _e('Select the number of images displayed per page in Blog Style view.', BWG()->prefix); ?></p>
|
2415 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
@@ -2419,7 +2419,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2419 |
<div class="wd-group">
|
2420 |
<label class="wd-label" for="blog_style_load_more_image_count"><?php _e('Images per load', BWG()->prefix); ?></label>
|
2421 |
<div class="bwg-flex">
|
2422 |
-
<input type="number" name="blog_style_load_more_image_count" id="blog_style_load_more_image_count" value="<?php echo $row->blog_style_load_more_image_count; ?>" min="0" />
|
2423 |
</div>
|
2424 |
<p class="description"><?php _e('Specify the number of images to display per load on galleries.', BWG()->prefix); ?></p>
|
2425 |
</div>
|
@@ -2462,7 +2462,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2462 |
<div class="wd-group">
|
2463 |
<label class="wd-label" for="blog_style_placeholder"><?php _e('Add placeholder to search', BWG()->prefix); ?></label>
|
2464 |
<div class="bwg-flex">
|
2465 |
-
<input type="text" name="blog_style_placeholder" id="blog_style_placeholder" value="<?php echo $row->blog_style_placeholder; ?>" />
|
2466 |
</div>
|
2467 |
</div>
|
2468 |
</div>
|
@@ -2470,7 +2470,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2470 |
<div class="wd-group">
|
2471 |
<label class="wd-label" for="blog_style_search_box_width"><?php _e('Search box maximum width', BWG()->prefix); ?></label>
|
2472 |
<div class="bwg-flex">
|
2473 |
-
<input type="number" name="blog_style_search_box_width" id="blog_style_search_box_width" value="<?php echo $row->blog_style_search_box_width; ?>" min="0" /><span>px</span>
|
2474 |
</div>
|
2475 |
</div>
|
2476 |
</div>
|
@@ -2562,7 +2562,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2562 |
<div class="wd-group">
|
2563 |
<label class="wd-label" for="carousel_image_column_number"><?php _e('Max. number of images', BWG()->prefix); ?></label>
|
2564 |
<div class="bwg-flex">
|
2565 |
-
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="carousel_image_column_number" id="carousel_image_column_number" value="<?php echo $row->carousel_image_column_number; ?>" min="0" />
|
2566 |
</div>
|
2567 |
<p class="description"><?php _e('Set the maximum number of images that are shown with Carousel display.', BWG()->prefix); ?></p>
|
2568 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
@@ -2572,8 +2572,8 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2572 |
<div class="wd-group">
|
2573 |
<label class="wd-label" for="carousel_width"><?php _e('Image dimensions', BWG()->prefix); ?></label>
|
2574 |
<div class="bwg-flex">
|
2575 |
-
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="carousel_width" id="carousel_width" value="<?php echo $row->carousel_width; ?>" min="0" /><span>x</span>
|
2576 |
-
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="carousel_height" id="carousel_height" value="<?php echo $row->carousel_height; ?>" min="0" /><span>px</span>
|
2577 |
</div>
|
2578 |
<p class="description"><?php _e('Specify the dimensions of carousel images in pixels.', BWG()->prefix); ?></p>
|
2579 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
@@ -2583,7 +2583,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2583 |
<div class="wd-group">
|
2584 |
<label class="wd-label" for="carousel_image_par"><?php _e('Carousel ratio', BWG()->prefix); ?></label>
|
2585 |
<div class="bwg-flex">
|
2586 |
-
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="carousel_image_par" id="carousel_image_par" value="<?php echo $row->carousel_image_par; ?>" min="0" max="1" step="0.01" />
|
2587 |
</div>
|
2588 |
<p class="description"><?php _e('This option defines the proportion of dimensions between neighboring images in the carousel.', BWG()->prefix); ?></p>
|
2589 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
@@ -2593,7 +2593,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2593 |
<div class="wd-group">
|
2594 |
<label class="wd-label" for="carousel_r_width"><?php _e('Fixed width', BWG()->prefix); ?></label>
|
2595 |
<div class="bwg-flex">
|
2596 |
-
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="carousel_r_width" id="carousel_r_width" value="<?php echo $row->carousel_r_width; ?>" min="0" /><span>px</span>
|
2597 |
</div>
|
2598 |
<p class="description"><?php _e('Specify the fixed width of Carousel gallery container.', BWG()->prefix); ?></p>
|
2599 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
@@ -2638,7 +2638,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2638 |
<div class="wd-group">
|
2639 |
<label class="wd-label" for="carousel_interval"><?php _e('Time interval', BWG()->prefix); ?></label>
|
2640 |
<div class="bwg-flex">
|
2641 |
-
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="carousel_interval" id="carousel_interval" value="<?php echo $row->carousel_interval; ?>" min="0" step="0.1" /><span>sec.</span>
|
2642 |
</div>
|
2643 |
<p class="description"><?php _e('Specify the time interval between rotations in Photo Gallery\'s Carousel view.', BWG()->prefix); ?></p>
|
2644 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
@@ -2741,7 +2741,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2741 |
<div class="wd-group">
|
2742 |
<label class="wd-label" for="album_column_number"><?php _e('Number of gallery group columns', BWG()->prefix); ?></label>
|
2743 |
<div class="bwg-flex">
|
2744 |
-
<input type="number" name="album_column_number" id="album_column_number" value="<?php echo $row->album_column_number; ?>" min="0" />
|
2745 |
</div>
|
2746 |
<p class="description"><?php _e('Set the maximum number of columns in gallery groups. Note, that the parent container needs to be large enough to display all columns.', BWG()->prefix); ?></p>
|
2747 |
</div>
|
@@ -2750,8 +2750,8 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2750 |
<div class="wd-group">
|
2751 |
<label class="wd-label" for="album_thumb_width"><?php _e('Gallery group thumbnail dimensions', BWG()->prefix); ?></label>
|
2752 |
<div class="bwg-flex">
|
2753 |
-
<input type="number" name="album_thumb_width" id="album_thumb_width" value="<?php echo $row->album_thumb_width; ?>" min="0" /><span>x</span>
|
2754 |
-
<input type="number" name="album_thumb_height" id="album_thumb_height" value="<?php echo $row->album_thumb_height; ?>" min="0" /><span>px</span>
|
2755 |
</div>
|
2756 |
<p class="description"><?php _e('Specify the dimensions of thumbnails in gallery groups.', BWG()->prefix); ?></p>
|
2757 |
</div>
|
@@ -2760,7 +2760,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2760 |
<div class="wd-group">
|
2761 |
<label class="wd-label" for="album_image_column_number"><?php _e('Number of image columns', BWG()->prefix); ?></label>
|
2762 |
<div class="bwg-flex">
|
2763 |
-
<input type="number" name="album_image_column_number" id="album_image_column_number" value="<?php echo $row->album_image_column_number; ?>" min="0" />
|
2764 |
</div>
|
2765 |
<p class="description"><?php _e('Set the maximum number of image columns in galleries. Note, that the parent container needs to be large enough to display all columns.', BWG()->prefix); ?></p>
|
2766 |
</div>
|
@@ -2769,8 +2769,8 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2769 |
<div class="wd-group">
|
2770 |
<label class="wd-label" for="album_image_thumb_width"><?php _e('Thumbnail dimensions', BWG()->prefix); ?></label>
|
2771 |
<div class="bwg-flex">
|
2772 |
-
<input type="number" name="album_image_thumb_width" id="album_image_thumb_width" value="<?php echo $row->album_image_thumb_width; ?>" min="0" /><span>x</span>
|
2773 |
-
<input type="number" name="album_image_thumb_height" id="album_image_thumb_height" value="<?php echo $row->album_image_thumb_height; ?>" min="0" /><span>px</span>
|
2774 |
</div>
|
2775 |
<p class="description"><?php _e('The default dimensions of thumbnails which will display on published galleries.', BWG()->prefix); ?></p>
|
2776 |
</div>
|
@@ -2794,7 +2794,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2794 |
<div class="wd-group">
|
2795 |
<label class="wd-label" for="albums_per_page"><?php _e('Gallery groups per page', BWG()->prefix); ?></label>
|
2796 |
<div class="bwg-flex">
|
2797 |
-
<input type="number" name="albums_per_page" id="albums_per_page" value="<?php echo $row->albums_per_page; ?>" min="0" />
|
2798 |
</div>
|
2799 |
<p class="description"><?php _e('Specify the number of galleries/gallery groups to display per page. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
2800 |
</div>
|
@@ -2803,7 +2803,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2803 |
<div class="wd-group">
|
2804 |
<label class="wd-label" for="album_images_per_page"><?php _e('Images per page', BWG()->prefix); ?></label>
|
2805 |
<div class="bwg-flex">
|
2806 |
-
<input type="number" name="album_images_per_page" id="album_images_per_page" value="<?php echo $row->album_images_per_page; ?>" min="0" />
|
2807 |
</div>
|
2808 |
<p class="description"><?php _e('Specify the number of images to display per page on galleries. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
2809 |
</div>
|
@@ -2864,7 +2864,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2864 |
<div class="wd-group">
|
2865 |
<label class="wd-label" for="album_placeholder"><?php _e('Add placeholder to search', BWG()->prefix); ?></label>
|
2866 |
<div class="bwg-flex">
|
2867 |
-
<input type="text" name="album_placeholder" id="album_placeholder" value="<?php echo $row->album_placeholder; ?>" />
|
2868 |
</div>
|
2869 |
</div>
|
2870 |
</div>
|
@@ -2872,7 +2872,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2872 |
<div class="wd-group">
|
2873 |
<label class="wd-label" for="album_search_box_width"><?php _e('Search box maximum width', BWG()->prefix); ?></label>
|
2874 |
<div class="bwg-flex">
|
2875 |
-
<input type="number" name="album_search_box_width" id="album_search_box_width" value="<?php echo $row->album_search_box_width; ?>" min="0" /><span>px</span>
|
2876 |
</div>
|
2877 |
</div>
|
2878 |
</div>
|
@@ -2971,7 +2971,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
2971 |
<div class="wd-group">
|
2972 |
<label class="wd-label" for="album_mosaic_total_width"><?php _e('Width of mosaic galleries', BWG()->prefix); ?></label>
|
2973 |
<div class="bwg-flex">
|
2974 |
-
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="album_mosaic_total_width" id="album_mosaic_total_width" value="<?php echo $row->album_mosaic_total_width; ?>" min="0" /><span>%</span>
|
2975 |
</div>
|
2976 |
<p class="description"><?php _e('The total width of mosaic galleries as a percentage of container\'s width.', BWG()->prefix); ?></p>
|
2977 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
@@ -3039,7 +3039,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3039 |
<div class="wd-group">
|
3040 |
<label class="wd-label" for="album_masonry_column_number"><?php _e('Number of gallery group columns', BWG()->prefix); ?></label>
|
3041 |
<div class="bwg-flex">
|
3042 |
-
<input type="number" name="album_masonry_column_number" id="album_masonry_column_number" value="<?php echo $row->album_masonry_column_number; ?>" min="0" />
|
3043 |
</div>
|
3044 |
<p class="description"><?php _e('Set the maximum number of columns in gallery groups. Note, that the parent container needs to be large enough to display all columns.', BWG()->prefix); ?></p>
|
3045 |
</div>
|
@@ -3048,7 +3048,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3048 |
<div class="wd-group">
|
3049 |
<label class="wd-label" for="album_masonry_thumb_width"><?php _e('Gallery group thumbnail width', BWG()->prefix); ?></label>
|
3050 |
<div class="bwg-flex">
|
3051 |
-
<input type="number" name="album_masonry_thumb_width" id="album_masonry_thumb_width" value="<?php echo $row->album_masonry_thumb_width; ?>" min="0" /><span>px</span>
|
3052 |
</div>
|
3053 |
<p class="description"><?php _e('Specify the dimensions of thumbnails in gallery groups.', BWG()->prefix); ?></p>
|
3054 |
</div>
|
@@ -3057,7 +3057,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3057 |
<div class="wd-group">
|
3058 |
<label class="wd-label" for="album_masonry_image_column_number"><?php _e('Number of image columns', BWG()->prefix); ?></label>
|
3059 |
<div class="bwg-flex">
|
3060 |
-
<input type="number" name="album_masonry_image_column_number" id="album_masonry_image_column_number" value="<?php echo $row->album_masonry_image_column_number; ?>" min="0" />
|
3061 |
</div>
|
3062 |
<p class="description"><?php _e('Set the maximum number of image columns in galleries. Note, that the parent container needs to be large enough to display all columns.', BWG()->prefix); ?></p>
|
3063 |
</div>
|
@@ -3066,7 +3066,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3066 |
<div class="wd-group">
|
3067 |
<label class="wd-label" for="album_masonry_image_thumb_width"><?php _e('Thumbnail width', BWG()->prefix); ?></label>
|
3068 |
<div class="bwg-flex">
|
3069 |
-
<input type="number" name="album_masonry_image_thumb_width" id="album_masonry_image_thumb_width" value="<?php echo $row->album_masonry_image_thumb_width; ?>" min="0" /><span>px</span>
|
3070 |
</div>
|
3071 |
<p class="description"><?php _e('The default dimensions of thumbnails which will display on published galleries.', BWG()->prefix); ?></p>
|
3072 |
</div>
|
@@ -3090,7 +3090,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3090 |
<div class="wd-group">
|
3091 |
<label class="wd-label" for="albums_masonry_per_page"><?php _e('Gallery groups per page', BWG()->prefix); ?></label>
|
3092 |
<div class="bwg-flex">
|
3093 |
-
<input type="number" name="albums_masonry_per_page" id="albums_masonry_per_page" value="<?php echo $row->albums_masonry_per_page; ?>" min="0" />
|
3094 |
</div>
|
3095 |
<p class="description"><?php _e('Specify the number of galleries/gallery groups to display per page. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
3096 |
</div>
|
@@ -3099,7 +3099,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3099 |
<div class="wd-group">
|
3100 |
<label class="wd-label" for="album_masonry_images_per_page"><?php _e('Images per page', BWG()->prefix); ?></label>
|
3101 |
<div class="bwg-flex">
|
3102 |
-
<input type="number" name="album_masonry_images_per_page" id="album_masonry_images_per_page" value="<?php echo $row->album_masonry_images_per_page; ?>" min="0" />
|
3103 |
</div>
|
3104 |
<p class="description"><?php _e('Specify the number of images to display per page on galleries. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
3105 |
</div>
|
@@ -3160,7 +3160,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3160 |
<div class="wd-group">
|
3161 |
<label class="wd-label" for="album_masonry_placeholder"><?php _e('Add placeholder to search', BWG()->prefix); ?></label>
|
3162 |
<div class="bwg-flex">
|
3163 |
-
<input type="text" name="album_masonry_placeholder" id="album_masonry_placeholder" value="<?php echo $row->album_masonry_placeholder; ?>" />
|
3164 |
</div>
|
3165 |
</div>
|
3166 |
</div>
|
@@ -3168,7 +3168,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3168 |
<div class="wd-group">
|
3169 |
<label class="wd-label" for="album_masonry_search_box_width"><?php _e('Search box maximum width', BWG()->prefix); ?></label>
|
3170 |
<div class="bwg-flex">
|
3171 |
-
<input type="number" name="album_masonry_search_box_width" id="album_masonry_search_box_width" value="<?php echo $row->album_masonry_search_box_width; ?>" min="0" /><span>px</span>
|
3172 |
</div>
|
3173 |
</div>
|
3174 |
</div>
|
@@ -3265,7 +3265,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3265 |
<div class="wd-group">
|
3266 |
<label class="wd-label" for="extended_album_height"><?php _e('Extended gallery group height', BWG()->prefix); ?></label>
|
3267 |
<div class="bwg-flex">
|
3268 |
-
<input type="number" name="extended_album_height" id="extended_album_height" value="<?php echo $row->extended_album_height; ?>" min="0" /><span>px</span>
|
3269 |
</div>
|
3270 |
<p class="description"><?php _e('Set the height of blocks in Extended gallery groups.', BWG()->prefix); ?></p>
|
3271 |
</div>
|
@@ -3285,8 +3285,8 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3285 |
<div class="wd-group">
|
3286 |
<label class="wd-label" for="album_extended_thumb_width"><?php _e('Gallery group thumbnail dimensions', BWG()->prefix); ?></label>
|
3287 |
<div class="bwg-flex">
|
3288 |
-
<input type="number" name="album_extended_thumb_width" id="album_extended_thumb_width" value="<?php echo $row->album_extended_thumb_width; ?>" min="0" /><span>x</span>
|
3289 |
-
<input type="number" name="album_extended_thumb_height" id="album_extended_thumb_height" value="<?php echo $row->album_extended_thumb_height; ?>" min="0" /><span>px</span>
|
3290 |
</div>
|
3291 |
<p class="description"><?php _e('Specify the dimensions of thumbnails in gallery groups.', BWG()->prefix); ?></p>
|
3292 |
</div>
|
@@ -3295,7 +3295,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3295 |
<div class="wd-group">
|
3296 |
<label class="wd-label" for="album_extended_image_column_number"><?php _e('Number of image columns', BWG()->prefix); ?></label>
|
3297 |
<div class="bwg-flex">
|
3298 |
-
<input type="number" name="album_extended_image_column_number" id="album_extended_image_column_number" value="<?php echo $row->album_extended_image_column_number; ?>" min="0" />
|
3299 |
</div>
|
3300 |
<p class="description"><?php _e('Set the maximum number of image columns in galleries. Note, that the parent container needs to be large enough to display all columns.', BWG()->prefix); ?></p>
|
3301 |
</div>
|
@@ -3304,8 +3304,8 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3304 |
<div class="wd-group">
|
3305 |
<label class="wd-label" for="album_extended_image_thumb_width"><?php _e('Thumbnail dimensions', BWG()->prefix); ?></label>
|
3306 |
<div class="bwg-flex">
|
3307 |
-
<input type="number" name="album_extended_image_thumb_width" id="album_extended_image_thumb_width" value="<?php echo $row->album_extended_image_thumb_width; ?>" min="0" /><span>x</span>
|
3308 |
-
<input type="number" name="album_extended_image_thumb_height" id="album_extended_image_thumb_height" value="<?php echo $row->album_extended_image_thumb_height; ?>" min="0" /><span>px</span>
|
3309 |
</div>
|
3310 |
<p class="description"><?php _e('The default dimensions of thumbnails which will display on published galleries.', BWG()->prefix); ?></p>
|
3311 |
</div>
|
@@ -3329,7 +3329,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3329 |
<div class="wd-group">
|
3330 |
<label class="wd-label" for="albums_extended_per_page"><?php _e('Gallery groups per page', BWG()->prefix); ?></label>
|
3331 |
<div class="bwg-flex">
|
3332 |
-
<input type="number" name="albums_extended_per_page" id="albums_extended_per_page" value="<?php echo $row->albums_extended_per_page; ?>" min="0" />
|
3333 |
</div>
|
3334 |
<p class="description"><?php _e('Specify the number of galleries/gallery groups to display per page. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
3335 |
</div>
|
@@ -3338,7 +3338,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3338 |
<div class="wd-group">
|
3339 |
<label class="wd-label" for="album_extended_images_per_page"><?php _e('Images per page', BWG()->prefix); ?></label>
|
3340 |
<div class="bwg-flex">
|
3341 |
-
<input type="number" name="album_extended_images_per_page" id="album_extended_images_per_page" value="<?php echo $row->album_extended_images_per_page; ?>" min="0" />
|
3342 |
</div>
|
3343 |
<p class="description"><?php _e('Specify the number of images to display per page on galleries. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
3344 |
</div>
|
@@ -3399,7 +3399,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3399 |
<div class="wd-group">
|
3400 |
<label class="wd-label" for="album_extended_placeholder"><?php _e('Add placeholder to search', BWG()->prefix); ?></label>
|
3401 |
<div class="bwg-flex">
|
3402 |
-
<input type="text" name="album_extended_placeholder" id="album_extended_placeholder" value="<?php echo $row->album_extended_placeholder; ?>" />
|
3403 |
</div>
|
3404 |
</div>
|
3405 |
</div>
|
@@ -3407,7 +3407,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3407 |
<div class="wd-group">
|
3408 |
<label class="wd-label" for="album_extended_search_box_width"><?php _e('Search box maximum width', BWG()->prefix); ?></label>
|
3409 |
<div class="bwg-flex">
|
3410 |
-
<input type="number" name="album_extended_search_box_width" id="album_extended_search_box_width" value="<?php echo $row->album_extended_search_box_width; ?>" min="0" /><span>px</span>
|
3411 |
</div>
|
3412 |
</div>
|
3413 |
</div>
|
@@ -3505,7 +3505,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3505 |
<div class="wd-group">
|
3506 |
<label class="wd-label" for="album_extended_mosaic_total_width"><?php _e('Width of mosaic galleries', BWG()->prefix); ?></label>
|
3507 |
<div class="bwg-flex">
|
3508 |
-
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="album_extended_mosaic_total_width" id="album_extended_mosaic_total_width" value="<?php echo $row->album_extended_mosaic_total_width; ?>" min="0" /><span>%</span>
|
3509 |
</div>
|
3510 |
<p class="description"><?php _e('The total width of mosaic galleries as a percentage of container\'s width.', BWG()->prefix); ?></p>
|
3511 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
@@ -3611,8 +3611,8 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3611 |
<div class="wd-group">
|
3612 |
<label class="wd-label" for="popup_width"><?php _e('Lightbox dimensions', BWG()->prefix); ?></label>
|
3613 |
<div class="bwg-flex">
|
3614 |
-
<input type="number" name="popup_width" id="popup_width" value="<?php echo $row->popup_width; ?>" min="0" /><span>x</span>
|
3615 |
-
<input type="number" name="popup_height" id="popup_height" value="<?php echo $row->popup_height; ?>" min="0" /><span>px</span>
|
3616 |
</div>
|
3617 |
<p class="description"><?php _e('Set the dimensions of image lightbox.', BWG()->prefix) ?></p>
|
3618 |
</div>
|
@@ -3625,7 +3625,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3625 |
<?php
|
3626 |
foreach ($effects as $key => $effect) {
|
3627 |
?>
|
3628 |
-
<option value="<?php echo $key; ?>"
|
3629 |
<?php echo (!BWG()->is_pro && $key != 'none' && $key != 'fade') ? 'disabled="disabled" title="' . __('This effect is disabled in free version.', BWG()->prefix) . '"' : ''; ?>
|
3630 |
<?php if ($row->popup_type == $key) echo 'selected="selected"'; ?>><?php echo __($effect, BWG()->prefix); ?></option>
|
3631 |
<?php
|
@@ -3640,7 +3640,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3640 |
<div class="wd-group">
|
3641 |
<label class="wd-label" for="popup_effect_duration"><?php _e('Effect duration', BWG()->prefix); ?></label>
|
3642 |
<div class="bwg-flex">
|
3643 |
-
<input type="number" name="popup_effect_duration" id="popup_effect_duration" value="<?php echo $row->popup_effect_duration; ?>" min="0" step="0.1" /><span>sec.</span>
|
3644 |
</div>
|
3645 |
<p class="description"><?php _e('Set the duration of lightbox animation effect.', BWG()->prefix) ?></p>
|
3646 |
<p class="description"><?php _e('Note, that the value of Effect Duration can not be greater than 1/4 of Time Interval.', BWG()->prefix) ?></p>
|
@@ -3660,7 +3660,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3660 |
<div class="wd-group">
|
3661 |
<label class="wd-label" for="popup_interval"><?php _e('Time interval', BWG()->prefix); ?></label>
|
3662 |
<div class="bwg-flex">
|
3663 |
-
<input type="number" name="popup_interval" id="popup_interval" value="<?php echo $row->popup_interval; ?>" min="0" step="0.1" /><span>sec.</span>
|
3664 |
</div>
|
3665 |
<p class="description"><?php _e('Specify the time interval of autoplay in Photo Gallery lightbox.', BWG()->prefix) ?></p>
|
3666 |
</div>
|
@@ -3680,7 +3680,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3680 |
<div class="wd-group">
|
3681 |
<label class="wd-label" for="popup_filmstrip_height"><?php _e('Filmstrip size', BWG()->prefix); ?></label>
|
3682 |
<div class="bwg-flex">
|
3683 |
-
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="popup_filmstrip_height" id="popup_filmstrip_height" value="<?php echo $row->popup_filmstrip_height; ?>" min="0" /><span>px</span>
|
3684 |
</div>
|
3685 |
<p class="description"><?php _e('Set the size of your filmstrip. If the filmstrip is horizontal, this indicates its height, whereas for vertical filmstrips it sets the width.', BWG()->prefix) ?></p>
|
3686 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
@@ -3913,7 +3913,7 @@ class OptionsView_bwg extends AdminView_bwg {
|
|
3913 |
<div class="wd-group">
|
3914 |
<label class="wd-label" for="addthis_profile_id">AddThis <?php _e('profile ID', BWG()->prefix); ?></label>
|
3915 |
<div class="bwg-flex">
|
3916 |
-
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="text" name="addthis_profile_id" id="addthis_profile_id" value="<?php echo $row->addthis_profile_id; ?>" />
|
3917 |
</div>
|
3918 |
<p class="description"><?php _e('Provide the ID of your profile to connect to AddThis.', BWG()->prefix); ?><br><?php echo sprintf(__('Create an account %s.', BWG()->prefix), '<a href="https://www.addthis.com/register" target="_blank">' . __('here', BWG()->prefix) . '</a>'); ?></p>
|
3919 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
146 |
<div class="wd-group">
|
147 |
<label class="wd-label" for="images_directory"><?php _e('Images directory', BWG()->prefix); ?></label>
|
148 |
<div class="bwg-flex">
|
149 |
+
<input id="images_directory" name="images_directory" type="text" style="display:inline-block; width:100%;" value="<?php echo esc_url($row->images_directory); ?>" />
|
150 |
+
<input type="hidden" id="old_images_directory" name="old_images_directory" value="<?php echo esc_url($row->old_images_directory); ?>" />
|
151 |
</div>
|
152 |
<p class="description"><?php _e('Provide the path of an existing folder inside the WordPress directory of your website to store uploaded images.<br />The content of the previous directory will be moved to the new one.', BWG()->prefix); ?></p>
|
153 |
</div>
|
179 |
<div class="wd-group">
|
180 |
<label class="wd-label" for="upload_img_width"><?php _e('Image dimensions', BWG()->prefix); ?></label>
|
181 |
<div class="bwg-flex">
|
182 |
+
<input type="number" name="upload_img_width" id="upload_img_width" value="<?php echo intval($row->upload_img_width); ?>" min="0" /><span>x</span>
|
183 |
+
<input type="number" name="upload_img_height" id="upload_img_height" value="<?php echo intval($row->upload_img_height); ?>" min="0" /><span>px</span>
|
184 |
</div>
|
185 |
<p class="description"><?php _e('Specify the maximum dimensions of uploaded images (set 0 for original size).', BWG()->prefix); ?></p>
|
186 |
</div>
|
189 |
<div class="wd-group">
|
190 |
<label class="wd-label" for="upload_thumb_width"><?php _e('Generated thumbnail dimensions', BWG()->prefix); ?></label>
|
191 |
<div class="bwg-flex">
|
192 |
+
<input type="number" name="upload_thumb_width" id="upload_thumb_width" value="<?php echo intval($row->upload_thumb_width); ?>" min="0" /><span>x</span>
|
193 |
+
<input type="number" name="upload_thumb_height" id="upload_thumb_height" value="<?php echo intval($row->upload_thumb_height); ?>" min="0" /><span>px</span>
|
194 |
+
<input type="hidden" name="imgcount" id="bwg_imgcount" value="<?php echo intval($imgcount); ?>">
|
195 |
<input type="submit" class="button-primary" onclick="<?php echo (BWG()->is_demo ? 'alert(\'' . addslashes(__('This option is disabled in demo.', BWG()->prefix)) . '\'); return false;' : (BWG()->wp_editor_exists ? 'return bwg_recreate_thumb(0);' : 'alert(\'' . addslashes(__('Image edit functionality is not supported by your web host.', BWG()->prefix)) . '\'); return false;')); ?>" value="<?php _e('Recreate', BWG()->prefix); ?>" />
|
196 |
</div>
|
197 |
<p class="description"><?php _e('Specify the maximum dimensions of generated thumbnails. They must be larger than frontend thumbnail dimensions.', BWG()->prefix); ?></p>
|
201 |
<div class="wd-group">
|
202 |
<label class="wd-label" for="image_quality"><?php _e('Image quality', BWG()->prefix); ?></label>
|
203 |
<div class="bwg-flex">
|
204 |
+
<input type="number" name="image_quality" id="image_quality" value="<?php echo intval($row->image_quality); ?>" min="0" max="100" /><span>%</span>
|
205 |
</div>
|
206 |
<p class="description"><?php _e('Set the quality of gallery images. Provide a value from 0 to 100%.', BWG()->prefix); ?></p>
|
207 |
</div>
|
240 |
<div class="wd-group">
|
241 |
<label class="wd-label" for="preload_images_count"><?php _e('Number of preloaded images', BWG()->prefix); ?></label>
|
242 |
<div class="bwg-flex">
|
243 |
+
<input type="number" name="preload_images_count" id="preload_images_count" value="<?php echo intval($row->preload_images_count); ?>" min="0" />
|
244 |
</div>
|
245 |
<p class="description"><?php _e('Specify the number of images to preload, e.g. 5 (set 0 for all).', BWG()->prefix); ?></p>
|
246 |
</div>
|
521 |
<?php
|
522 |
foreach ($gallery_types_name as $key=>$gallery_type_name) {
|
523 |
?>
|
524 |
+
<option <?php echo selected($gallery_type_name,true); ?> value="<?php echo esc_attr($key); ?>"><?php echo esc_html($gallery_type_name); ?></option>
|
525 |
<?php
|
526 |
}
|
527 |
?>
|
533 |
<?php
|
534 |
foreach ($gallery_types_name as $key=>$gallery_type_name) {
|
535 |
?>
|
536 |
+
<li class="gallery-type-li" data-value="<?php echo esc_attr($key); ?>">
|
537 |
+
<img src="<?php echo esc_url(BWG()->plugin_url . '/images/' . $key . '.svg'); ?>">
|
538 |
+
<span><?php echo esc_html($gallery_type_name); ?> </span>
|
539 |
<?php if ( !BWG()->is_pro && ( $key == 'thumbnails_masonry' || $key == 'thumbnails_mosaic' || $key == 'blog_style' || $key == 'carousel' )) { ?>
|
540 |
<span class="pro_btn">Premium</span>
|
541 |
<?php } ?>
|
619 |
<?php
|
620 |
foreach ($album_types_name as $key=>$album_type_name) {
|
621 |
?>
|
622 |
+
<option <?php echo esc_html(selected($album_type_name,true)); ?> value="<?php echo esc_attr($key); ?>"><?php echo esc_html($album_type_name); ?></option>
|
623 |
<?php
|
624 |
}
|
625 |
?>
|
631 |
<?php
|
632 |
foreach ($album_types_name as $key=>$album_type_name) {
|
633 |
?>
|
634 |
+
<li class="gallery-type-li" data-value="<?php echo esc_attr($key); ?>">
|
635 |
+
<img src="<?php echo esc_url(BWG()->plugin_url . '/images/' . $key . '.svg'); ?>">
|
636 |
<span><?php echo $album_type_name; ?> </span>
|
637 |
<?php if ( !BWG()->is_pro && ( $key == 'album_masonry_preview' ) ) { ?>
|
638 |
<span class="pro_btn">Premium</span>
|
710 |
</div>
|
711 |
<div class="wd-box-content wd-width-100 <?php echo BWG()->is_pro ? '' : ' bwg-disabled-option'; ?>">
|
712 |
<div class="wd-group" id="login_with_instagram">
|
713 |
+
<input id="instagram_access_token" name="instagram_access_token" type="hidden" size="30" value="<?php echo esc_attr($row->instagram_access_token); ?>" readonly />
|
714 |
<?php if ( empty($row->instagram_access_token) ) { ?>
|
715 |
<a <?php echo BWG()->is_pro ? 'href="' . $instagram_return_url . '"' : 'disabled="disabled"'; ?> class="bwg-connect-instagram">
|
716 |
<?php _e('Connect an Instagram Account', BWG()->prefix) ?>
|
720 |
else {
|
721 |
?>
|
722 |
<ul class="bwg-accounts-list">
|
723 |
+
<li class="bwg-account-list-<?php echo sanitize_html_class($row->instagram_user_id); ?>">
|
724 |
<div class="bwg-account-block">
|
725 |
<div>
|
726 |
<div class="bwg-account-user-info">
|
727 |
+
<h4 class="bwg-account-name"><?php echo esc_html($row->instagram_username); ?></h4>
|
728 |
</div>
|
729 |
</div>
|
730 |
<div>
|
737 |
<div>
|
738 |
<p class="bwg-input-group">
|
739 |
<label><?php _e('User ID:', BWG()->prefix) ?></label>
|
740 |
+
<input type="text" value="<?php echo esc_attr($row->instagram_user_id); ?>" readonly="readonly"
|
741 |
onclick="this.focus();this.select()"
|
742 |
title="To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac).">
|
743 |
</p>
|
784 |
<?php
|
785 |
foreach ($permissions as $key => $permission) {
|
786 |
?>
|
787 |
+
<option value="<?php echo esc_attr($key); ?>" <?php if ($row->permissions == $key) echo 'selected="selected"'; ?>><?php echo esc_html($permission); ?></option>
|
788 |
<?php
|
789 |
}
|
790 |
?>
|
902 |
$query_url = wp_nonce_url( $query_url, 'addImages', 'bwg_nonce' );
|
903 |
$query_url = add_query_arg(array('TB_iframe' => '1'), $query_url );
|
904 |
?>
|
905 |
+
<a href="<?php echo esc_url($query_url); ?>" id="button_add_watermark_image" class="button-primary thickbox thickbox-preview"
|
906 |
title="<?php _e('Select Image', BWG()->prefix); ?>"
|
907 |
onclick="return false;">
|
908 |
<?php _e('Select Image', BWG()->prefix); ?>
|
909 |
</a>
|
910 |
<br /><?php _e('or', BWG()->prefix); ?><br />
|
911 |
+
<input type="text" id="watermark_url" name="watermark_url" value="<?php echo esc_url($row->watermark_url); ?>" onchange="preview_watermark()" placeholder="e.g. https://example.com/uploads/watermark.png" />
|
912 |
</div>
|
913 |
<p class="description"><?php _e('Provide the absolute URL of the image you would like to use as advertisement.', BWG()->prefix) ?></p>
|
914 |
</div>
|
917 |
<div class="wd-group">
|
918 |
<label class="wd-label" for="watermark_text"><?php _e('Advertisement text', BWG()->prefix); ?></label>
|
919 |
<div class="bwg-flex">
|
920 |
+
<input type="text" name="watermark_text" id="watermark_text" style="width: 100%;" value="<?php echo esc_attr($row->watermark_text); ?>" onchange="preview_watermark()" onkeypress="preview_watermark()" />
|
921 |
</div>
|
922 |
<p class="description"><?php _e('Write the text to add to images as advertisement.', BWG()->prefix) ?></p>
|
923 |
</div>
|
926 |
<div class="wd-group">
|
927 |
<label class="wd-label" for="watermark_link"><?php _e('Advertisement link', BWG()->prefix); ?></label>
|
928 |
<div class="bwg-flex">
|
929 |
+
<input type="text" name="watermark_link" id="watermark_link" style="width: 100%;" value="<?php echo esc_url($row->watermark_link); ?>" onchange="preview_watermark()" onkeypress="preview_watermark()" />
|
930 |
</div>
|
931 |
<p class="description"><?php _e('Provide the link to be added to advertisement on images.', BWG()->prefix) ?></p>
|
932 |
</div>
|
935 |
<div class="wd-group">
|
936 |
<label class="wd-label" for="watermark_width"><?php _e('Advertisement dimensions', BWG()->prefix); ?></label>
|
937 |
<div class="bwg-flex">
|
938 |
+
<input type="number" name="watermark_width" id="watermark_width" value="<?php echo intval($row->watermark_width); ?>" min="0" onchange="preview_watermark()" /><span>x</span>
|
939 |
+
<input type="number" name="watermark_height" id="watermark_height" value="<?php echo intval($row->watermark_height); ?>" min="0" onchange="preview_watermark()" /><span>px</span>
|
940 |
</div>
|
941 |
<p class="description"><?php _e('Select the dimensions of the advertisement image.', BWG()->prefix) ?></p>
|
942 |
</div>
|
945 |
<div class="wd-group">
|
946 |
<label class="wd-label" for="watermark_font_size"><?php _e('Advertisement font size', BWG()->prefix); ?></label>
|
947 |
<div class="bwg-flex">
|
948 |
+
<input type="number" name="watermark_font_size" id="watermark_font_size" value="<?php echo intval($row->watermark_font_size); ?>" min="0" onchange="preview_watermark()" /><span>px</span>
|
949 |
</div>
|
950 |
<p class="description"><?php _e('Specify the font size of the advertisement text.', BWG()->prefix) ?></p>
|
951 |
</div>
|
961 |
$watermark_font_families = ($is_google_fonts == true) ? $google_fonts : $watermark_fonts;
|
962 |
foreach ($watermark_font_families as $watermark_font) {
|
963 |
?>
|
964 |
+
<option value="<?php echo esc_attr($watermark_font); ?>" <?php if ($row->watermark_font == $watermark_font) echo 'selected="selected"'; ?>><?php echo esc_html($watermark_font); ?></option>
|
965 |
<?php
|
966 |
}
|
967 |
?>
|
980 |
<div class="wd-group">
|
981 |
<label class="wd-label" for="watermark_color"><?php _e('Advertisement color', BWG()->prefix); ?></label>
|
982 |
<div class="bwg-flex">
|
983 |
+
<input type="text" name="watermark_color" id="watermark_color" value="<?php echo esc_attr($row->watermark_color); ?>" class="jscolor" onchange="preview_watermark()" />
|
984 |
</div>
|
985 |
<p class="description"><?php _e('Choose the color for the advertisement text on images.', BWG()->prefix) ?></p>
|
986 |
</div>
|
989 |
<div class="wd-group">
|
990 |
<label class="wd-label" for="watermark_opacity"><?php _e('Advertisement opacity', BWG()->prefix); ?></label>
|
991 |
<div class="bwg-flex">
|
992 |
+
<input type="number" name="watermark_opacity" id="watermark_opacity" value="<?php echo intval($row->watermark_opacity); ?>" min="0" max="100" onchange="preview_watermark()" /><span>%</span>
|
993 |
</div>
|
994 |
<p class="description"><?php _e('Specify the opacity of the advertisement. The value must be between 0 to 100.', BWG()->prefix) ?></p>
|
995 |
</div>
|
1057 |
$query_url = wp_nonce_url( $query_url, 'addImages', 'bwg_nonce' );
|
1058 |
$query_url = add_query_arg(array('TB_iframe' => '1'), $query_url );
|
1059 |
?>
|
1060 |
+
<a href="<?php echo esc_url($query_url); ?>" id="button_add_built_in_watermark_image" class="button-primary thickbox thickbox-preview"
|
1061 |
title="<?php _e('Select Image', BWG()->prefix); ?>"
|
1062 |
onclick="return false;">
|
1063 |
<?php _e('Select Image', BWG()->prefix); ?>
|
1064 |
</a>
|
1065 |
<br /><?php _e('or', BWG()->prefix); ?><br />
|
1066 |
+
<input type="text" id="built_in_watermark_url" name="built_in_watermark_url" value="<?php echo esc_url($row->built_in_watermark_url); ?>" onchange="preview_built_in_watermark()" placeholder="e.g. https://example.com/uploads/watermark.png" />
|
1067 |
</div>
|
1068 |
<p class="description"><?php _e('Provide the absolute URL of the image you would like to use as watermark.', BWG()->prefix); ?><br><?php _e('Only .png format is supported.', BWG()->prefix) ?></p>
|
1069 |
</div>
|
1081 |
<div class="wd-group">
|
1082 |
<label class="wd-label" for="built_in_watermark_size"><?php _e('Watermark size', BWG()->prefix); ?></label>
|
1083 |
<div class="bwg-flex">
|
1084 |
+
<input type="number" name="built_in_watermark_size" id="built_in_watermark_size" value="<?php echo intval($row->built_in_watermark_size); ?>" min="0" max="100" onchange="preview_built_in_watermark()" /><span>%</span>
|
1085 |
</div>
|
1086 |
<p class="description"><?php _e('Specify the size of watermark on images in percent.', BWG()->prefix) ?></p>
|
1087 |
</div>
|
1090 |
<div class="wd-group">
|
1091 |
<label class="wd-label" for="built_in_watermark_font_size"><?php _e('Watermark font size', BWG()->prefix); ?></label>
|
1092 |
<div class="bwg-flex">
|
1093 |
+
<input type="number" name="built_in_watermark_font_size" id="built_in_watermark_font_size" value="<?php echo intval($row->built_in_watermark_font_size); ?>" min="0" onchange="preview_built_in_watermark()" />
|
1094 |
</div>
|
1095 |
<p class="description"><?php _e('Specify the font size of the watermark text.', BWG()->prefix) ?></p>
|
1096 |
</div>
|
1103 |
<?php
|
1104 |
foreach ($built_in_watermark_fonts as $watermark_font) {
|
1105 |
?>
|
1106 |
+
<option value="<?php echo esc_attr($watermark_font); ?>" <?php if ($row->built_in_watermark_font == $watermark_font) echo 'selected="selected"'; ?>><?php echo esc_html($watermark_font); ?></option>
|
1107 |
<?php
|
1108 |
}
|
1109 |
?>
|
1128 |
<div class="wd-group">
|
1129 |
<label class="wd-label" for="built_in_watermark_color"><?php _e('Watermark color', BWG()->prefix); ?></label>
|
1130 |
<div class="bwg-flex">
|
1131 |
+
<input type="text" name="built_in_watermark_color" id="built_in_watermark_color" value="<?php echo esc_attr($row->built_in_watermark_color); ?>" class="jscolor" onchange="preview_built_in_watermark()" />
|
1132 |
</div>
|
1133 |
<p class="description"><?php _e('Choose the color for the watermark text on images.', BWG()->prefix) ?></p>
|
1134 |
</div>
|
1137 |
<div class="wd-group">
|
1138 |
<label class="wd-label" for="built_in_watermark_opacity"><?php _e('Watermark opacity', BWG()->prefix); ?></label>
|
1139 |
<div class="bwg-flex">
|
1140 |
+
<input type="number" name="built_in_watermark_opacity" id="built_in_watermark_opacity" value="<?php echo intval($row->built_in_watermark_opacity); ?>" min="0" max="100" onchange="preview_built_in_watermark()" /><span>%</span>
|
1141 |
</div>
|
1142 |
<p class="description"><?php _e('Specify the opacity of the watermark. The value must be between 0 to 100.', BWG()->prefix) ?></p>
|
1143 |
</div>
|
1186 |
<div id="loading_div" class="bwg_show"></div>
|
1187 |
<input id="recreate" name="recreate" type="hidden" value="" />
|
1188 |
<input id="watermark" name="watermark" type="hidden" value="" />
|
1189 |
+
<input id="active_tab" name="active_tab" type="hidden" value="<?php echo esc_attr($params['active_tab']); ?>" />
|
1190 |
+
<input id="gallery_type" name="gallery_type" type="hidden" value="<?php echo esc_attr($params['gallery_type']); ?>" />
|
1191 |
+
<input id="album_type" name="album_type" type="hidden" value="<?php echo esc_attr($params['album_type']); ?>" />
|
1192 |
<script>
|
1193 |
var bwg_options_url_ajax = '<?php echo $options_url_ajax; ?>';
|
1194 |
function bwg_add_built_in_watermark_image(files) {
|
1315 |
<div class="wd-group">
|
1316 |
<label class="wd-label" for="thumb_width"><?php _e('Thumbnail dimensions', BWG()->prefix); ?></label>
|
1317 |
<div class="bwg-flex">
|
1318 |
+
<input type="number" name="thumb_width" id="thumb_width" value="<?php echo intval($row->thumb_width); ?>" min="0" /><span>x</span>
|
1319 |
+
<input type="number" name="thumb_height" id="thumb_height" value="<?php echo intval($row->thumb_height); ?>" min="0" /><span>px</span>
|
1320 |
</div>
|
1321 |
<p class="description"><?php _e('The default dimensions of thumbnails which will display on published galleries.', BWG()->prefix); ?></p>
|
1322 |
</div>
|
1325 |
<div class="wd-group">
|
1326 |
<label class="wd-label" for="image_column_number"><?php _e('Number of image columns', BWG()->prefix); ?></label>
|
1327 |
<div class="bwg-flex">
|
1328 |
+
<input type="number" name="image_column_number" id="image_column_number" value="<?php echo intval($row->image_column_number); ?>" min="0" />
|
1329 |
</div>
|
1330 |
<p class="description"><?php _e('Set the maximum number of image columns in galleries. Note, that the parent container needs to be large enough to display all columns.', BWG()->prefix); ?></p>
|
1331 |
</div>
|
1349 |
<div class="wd-group">
|
1350 |
<label class="wd-label" for="images_per_page"><?php _e('Images per page', BWG()->prefix); ?></label>
|
1351 |
<div class="bwg-flex">
|
1352 |
+
<input type="number" name="images_per_page" id="images_per_page" value="<?php echo intval($row->images_per_page); ?>" min="0" />
|
1353 |
</div>
|
1354 |
<p class="description"><?php _e('Specify the number of images to display per page on galleries. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
1355 |
</div>
|
1358 |
<div class="wd-group">
|
1359 |
<label class="wd-label" for="load_more_image_count"><?php _e('Images per load', BWG()->prefix); ?></label>
|
1360 |
<div class="bwg-flex">
|
1361 |
+
<input type="number" name="load_more_image_count" id="load_more_image_count" value="<?php echo intval($row->load_more_image_count); ?>" min="0" />
|
1362 |
</div>
|
1363 |
<p class="description"><?php _e('Specify the number of images to display per load on galleries.', BWG()->prefix); ?></p>
|
1364 |
</div>
|
1401 |
<div class="wd-group">
|
1402 |
<label class="wd-label" for="placeholder"><?php _e('Add placeholder to search', BWG()->prefix); ?></label>
|
1403 |
<div class="bwg-flex">
|
1404 |
+
<input type="text" name="placeholder" id="placeholder" value="<?php echo esc_attr($row->placeholder); ?>" />
|
1405 |
</div>
|
1406 |
</div>
|
1407 |
</div>
|
1409 |
<div class="wd-group">
|
1410 |
<label class="wd-label" for="search_box_width"><?php _e('Search box maximum width', BWG()->prefix); ?></label>
|
1411 |
<div class="bwg-flex">
|
1412 |
+
<input type="number" name="search_box_width" id="search_box_width" value="<?php echo intval($row->search_box_width); ?>" min="0" /><span>px</span>
|
1413 |
</div>
|
1414 |
</div>
|
1415 |
</div>
|
1541 |
<div class="wd-group">
|
1542 |
<label class="wd-label" for="masonry_thumb_size"><?php _e('Thumbnail size', BWG()->prefix); ?></label>
|
1543 |
<div class="bwg-flex">
|
1544 |
+
<input type="number" name="masonry_thumb_size" id="masonry_thumb_size" value="<?php echo intval($row->masonry_thumb_size); ?>" min="0" /><span>px</span>
|
1545 |
</div>
|
1546 |
<p class="description"><?php _e('The default size of thumbnails which will display on published galleries.', BWG()->prefix); ?></p>
|
1547 |
</div>
|
1551 |
<label class="wd-label masonry_col_num" style="<?php echo ($row->masonry == "vertical") ? '' : 'display:none'; ?>" for="masonry_image_column_number"><?php _e('Number of image columns', BWG()->prefix); ?></label>
|
1552 |
<label class="wd-label masonry_row_num" style="<?php echo ($row->masonry == "vertical") ? 'display:none' : ''; ?>" for="masonry_image_column_number"><?php _e('Number of image rows', BWG()->prefix); ?></label>
|
1553 |
<div class="bwg-flex">
|
1554 |
+
<input type="number" name="masonry_image_column_number" id="masonry_image_column_number" value="<?php echo intval($row->masonry_image_column_number); ?>" min="0" />
|
1555 |
</div>
|
1556 |
<p class="description"><?php _e('Set the maximum number of image columns (or rows) in galleries. Note, that the parent container needs to be large enough to display all columns.', BWG()->prefix); ?></p>
|
1557 |
</div>
|
1575 |
<div class="wd-group">
|
1576 |
<label class="wd-label" for="masonry_images_per_page"><?php _e('Images per page', BWG()->prefix); ?></label>
|
1577 |
<div class="bwg-flex">
|
1578 |
+
<input type="number" name="masonry_images_per_page" id="masonry_images_per_page" value="<?php echo intval($row->masonry_images_per_page); ?>" min="0" />
|
1579 |
</div>
|
1580 |
<p class="description"><?php _e('Specify the number of images to display per page on galleries. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
1581 |
</div>
|
1584 |
<div class="wd-group">
|
1585 |
<label class="wd-label" for="masonry_load_more_image_count"><?php _e('Images per load', BWG()->prefix); ?></label>
|
1586 |
<div class="bwg-flex">
|
1587 |
+
<input type="number" name="masonry_load_more_image_count" id="masonry_load_more_image_count" value="<?php echo intval($row->masonry_load_more_image_count); ?>" min="0" />
|
1588 |
</div>
|
1589 |
<p class="description"><?php _e('Specify the number of images to display per load on galleries.', BWG()->prefix); ?></p>
|
1590 |
</div>
|
1627 |
<div class="wd-group">
|
1628 |
<label class="wd-label" for="placeholder"><?php _e('Add placeholder to search', BWG()->prefix); ?></label>
|
1629 |
<div class="bwg-flex">
|
1630 |
+
<input type="text" name="masonry_placeholder" id="masonry_placeholder" value="<?php echo esc_attr($row->masonry_placeholder); ?>" />
|
1631 |
</div>
|
1632 |
</div>
|
1633 |
</div>
|
1635 |
<div class="wd-group">
|
1636 |
<label class="wd-label" for="masonry_search_box_width"><?php _e('Search box maximum width', BWG()->prefix); ?></label>
|
1637 |
<div class="bwg-flex">
|
1638 |
+
<input type="number" name="masonry_search_box_width" id="masonry_search_box_width" value="<?php echo intval($row->masonry_search_box_width); ?>" min="0" /><span>px</span>
|
1639 |
</div>
|
1640 |
</div>
|
1641 |
</div>
|
1775 |
<div class="wd-group">
|
1776 |
<label class="wd-label" for="mosaic_total_width"><?php _e('Width of mosaic galleries', BWG()->prefix); ?></label>
|
1777 |
<div class="bwg-flex">
|
1778 |
+
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="mosaic_total_width" id="mosaic_total_width" value="<?php echo intval($row->mosaic_total_width); ?>" min="0" /><span>%</span>
|
1779 |
</div>
|
1780 |
<p class="description"><?php _e('The total width of mosaic galleries as a percentage of container\'s width.', BWG()->prefix); ?></p>
|
1781 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
1785 |
<div class="wd-group">
|
1786 |
<label class="wd-label" for="mosaic_thumb_size"><?php _e('Thumbnail size', BWG()->prefix); ?></label>
|
1787 |
<div class="bwg-flex">
|
1788 |
+
<input type="number" name="mosaic_thumb_size" id="mosaic_thumb_size" value="<?php echo intval($row->mosaic_thumb_size); ?>" min="0" /><span>px</span>
|
1789 |
</div>
|
1790 |
<p class="description"><?php _e('The default size of thumbnails which will display on published galleries.', BWG()->prefix); ?></p>
|
1791 |
</div>
|
1809 |
<div class="wd-group">
|
1810 |
<label class="wd-label" for="mosaic_images_per_page"><?php _e('Images per page', BWG()->prefix); ?></label>
|
1811 |
<div class="bwg-flex">
|
1812 |
+
<input type="number" name="mosaic_images_per_page" id="mosaic_images_per_page" value="<?php echo intval($row->mosaic_images_per_page); ?>" min="0" />
|
1813 |
</div>
|
1814 |
<p class="description"><?php _e('Specify the number of images to display per page on galleries. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
1815 |
</div>
|
1818 |
<div class="wd-group">
|
1819 |
<label class="wd-label" for="mosaic_load_more_image_count"><?php _e('Images per load', BWG()->prefix); ?></label>
|
1820 |
<div class="bwg-flex">
|
1821 |
+
<input type="number" name="mosaic_load_more_image_count" id="mosaic_load_more_image_count" value="<?php echo intval($row->mosaic_load_more_image_count); ?>" min="0" />
|
1822 |
</div>
|
1823 |
<p class="description"><?php _e('Specify the number of images to display per load on galleries.', BWG()->prefix); ?></p>
|
1824 |
</div>
|
1861 |
<div class="wd-group">
|
1862 |
<label class="wd-label" for="mosaic_placeholder"><?php _e('Add placeholder to search', BWG()->prefix); ?></label>
|
1863 |
<div class="bwg-flex">
|
1864 |
+
<input type="text" name="mosaic_placeholder" id="mosaic_placeholder" value="<?php echo esc_attr($row->mosaic_placeholder); ?>" />
|
1865 |
</div>
|
1866 |
</div>
|
1867 |
</div>
|
1869 |
<div class="wd-group">
|
1870 |
<label class="wd-label" for="mosaic_search_box_width"><?php _e('Search box maximum width', BWG()->prefix); ?></label>
|
1871 |
<div class="bwg-flex">
|
1872 |
+
<input type="number" name="mosaic_search_box_width" id="mosaic_search_box_width" value="<?php echo intval($row->mosaic_search_box_width); ?>" min="0" /><span>px</span>
|
1873 |
</div>
|
1874 |
</div>
|
1875 |
</div>
|
1979 |
<?php
|
1980 |
foreach ($effects as $key => $effect) {
|
1981 |
?>
|
1982 |
+
<option value="<?php echo esc_attr($key); ?>"
|
1983 |
<?php echo (!BWG()->is_pro && $key != 'none' && $key != 'fade') ? 'disabled="disabled" title="' . __('This effect is disabled in free version.', BWG()->prefix) . '"' : ''; ?>
|
1984 |
<?php if ($row->slideshow_type == $key) echo 'selected="selected"'; ?>><?php echo __($effect, BWG()->prefix); ?></option>
|
1985 |
<?php
|
1994 |
<div class="wd-group">
|
1995 |
<label class="wd-label" for="slideshow_effect_duration"><?php _e('Effect duration', BWG()->prefix); ?></label>
|
1996 |
<div class="bwg-flex">
|
1997 |
+
<input type="number" name="slideshow_effect_duration" id="slideshow_effect_duration" value="<?php echo floatval($row->slideshow_effect_duration); ?>" min="0" step="0.1" /><span>sec.</span>
|
1998 |
</div>
|
1999 |
<p class="description"><?php _e('Set the duration of your slideshow animation effect.', BWG()->prefix); ?></p>
|
2000 |
</div>
|
2003 |
<div class="wd-group">
|
2004 |
<label class="wd-label" for="slideshow_interval"><?php _e('Time interval', BWG()->prefix); ?></label>
|
2005 |
<div class="bwg-flex">
|
2006 |
+
<input type="number" name="slideshow_interval" id="slideshow_interval" value="<?php echo intval($row->slideshow_interval); ?>" min="0" /><span>sec.</span>
|
2007 |
</div>
|
2008 |
<p class="description"><?php _e('Specify the time interval between slides in Photo Gallery\'s Slideshow view.', BWG()->prefix); ?></p>
|
2009 |
</div>
|
2012 |
<div class="wd-group">
|
2013 |
<label class="wd-label" for="slideshow_width"><?php _e('Slideshow dimensions', BWG()->prefix); ?></label>
|
2014 |
<div class="bwg-flex">
|
2015 |
+
<input type="number" name="slideshow_width" id="slideshow_width" value="<?php echo intval($row->slideshow_width); ?>" min="0" /><span>px</span>
|
2016 |
+
<input type="number" name="slideshow_height" id="slideshow_height" value="<?php echo intval($row->slideshow_height); ?>" min="0" /><span>px</span>
|
2017 |
</div>
|
2018 |
<p class="description"><?php _e('Set the default dimensions of your slideshow galleries.', BWG()->prefix); ?></p>
|
2019 |
</div>
|
2100 |
<div class="wd-group">
|
2101 |
<label class="wd-label" for="slideshow_thumbnails_count"><?php _e('Slideshow thumbnails count', BWG()->prefix); ?></label>
|
2102 |
<div class="bwg-flex">
|
2103 |
+
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="slideshow_thumbnails_count" id="slideshow_thumbnails_count" value="<?php echo intval($row->slideshow_thumbnails_count); ?>" min="1" />
|
2104 |
</div>
|
2105 |
<p class="description"><?php _e('Set the number of items that will be displayed in the filmstrip. This will also construct the width of the filmstrip.', BWG()->prefix); ?></p>
|
2106 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
2110 |
<div class="wd-group">
|
2111 |
<label class="wd-label" for="slideshow_filmstrip_height"><?php _e('Slideshow filmstrip size', BWG()->prefix); ?></label>
|
2112 |
<div class="bwg-flex">
|
2113 |
+
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="slideshow_filmstrip_height" id="slideshow_filmstrip_height" value="<?php echo intval($row->slideshow_filmstrip_height); ?>" min="0" /><span>px</span>
|
2114 |
</div>
|
2115 |
<p class="description"><?php _e('Set the size of your filmstrip. If the filmstrip is horizontal, this indicates its height, whereas for vertical filmstrips it sets the width.', BWG()->prefix); ?></p>
|
2116 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
2214 |
<div class="wd-group">
|
2215 |
<label class="wd-label" for="slideshow_audio_url"><?php _e('Audio URL', BWG()->prefix); ?></label>
|
2216 |
<div class="bwg-flex">
|
2217 |
+
<input type="text" id="slideshow_audio_url" name="slideshow_audio_url" value="<?php echo esc_url($row->slideshow_audio_url); ?>" />
|
2218 |
</div>
|
2219 |
<p class="description"><?php _e('Provide the absolute URL of the audio file you would like to play with your slideshow.', BWG()->prefix); ?></p>
|
2220 |
</div>
|
2243 |
<div class="wd-group">
|
2244 |
<label class="wd-label" for="image_browser_width"><?php _e('Image width', BWG()->prefix); ?></label>
|
2245 |
<div class="bwg-flex">
|
2246 |
+
<input type="number" name="image_browser_width" id="image_browser_width" value="<?php echo intval($row->image_browser_width); ?>" min="0" /><span>px</span>
|
2247 |
</div>
|
2248 |
<p class="description"><?php _e('Specify the default width of images in Image Browser view.', BWG()->prefix); ?></p>
|
2249 |
</div>
|
2305 |
<div class="wd-group">
|
2306 |
<label class="wd-label" for="image_browser_placeholder"><?php _e('Add placeholder to search', BWG()->prefix); ?></label>
|
2307 |
<div class="bwg-flex">
|
2308 |
+
<input type="text" name="image_browser_placeholder" id="image_browser_placeholder" value="<?php echo esc_attr($row->image_browser_placeholder); ?>" />
|
2309 |
</div>
|
2310 |
</div>
|
2311 |
</div>
|
2313 |
<div class="wd-group">
|
2314 |
<label class="wd-label" for="image_browser_search_box_width"><?php _e('Search box maximum width', BWG()->prefix); ?></label>
|
2315 |
<div class="bwg-flex">
|
2316 |
+
<input type="number" name="image_browser_search_box_width" id="image_browser_search_box_width" value="<?php echo intval($row->image_browser_search_box_width); ?>" min="0" /><span>px</span>
|
2317 |
</div>
|
2318 |
</div>
|
2319 |
</div>
|
2383 |
<div class="wd-group">
|
2384 |
<label class="wd-label" for="blog_style_width"><?php _e('Image width', BWG()->prefix); ?></label>
|
2385 |
<div class="bwg-flex">
|
2386 |
+
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="blog_style_width" id="blog_style_width" value="<?php echo intval($row->blog_style_width); ?>" min="0" /><span>px</span>
|
2387 |
</div>
|
2388 |
<p class="description"><?php _e('Specify the default width of images in Blog Style view.', BWG()->prefix); ?></p>
|
2389 |
</div>
|
2409 |
<div class="wd-group">
|
2410 |
<label class="wd-label" for="blog_style_images_per_page"><?php _e('Images per page', BWG()->prefix); ?></label>
|
2411 |
<div class="bwg-flex">
|
2412 |
+
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="blog_style_images_per_page" id="blog_style_images_per_page" value="<?php echo intval($row->blog_style_images_per_page); ?>" min="0" />
|
2413 |
</div>
|
2414 |
<p class="description"><?php _e('Select the number of images displayed per page in Blog Style view.', BWG()->prefix); ?></p>
|
2415 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
2419 |
<div class="wd-group">
|
2420 |
<label class="wd-label" for="blog_style_load_more_image_count"><?php _e('Images per load', BWG()->prefix); ?></label>
|
2421 |
<div class="bwg-flex">
|
2422 |
+
<input type="number" name="blog_style_load_more_image_count" id="blog_style_load_more_image_count" value="<?php echo intval($row->blog_style_load_more_image_count); ?>" min="0" />
|
2423 |
</div>
|
2424 |
<p class="description"><?php _e('Specify the number of images to display per load on galleries.', BWG()->prefix); ?></p>
|
2425 |
</div>
|
2462 |
<div class="wd-group">
|
2463 |
<label class="wd-label" for="blog_style_placeholder"><?php _e('Add placeholder to search', BWG()->prefix); ?></label>
|
2464 |
<div class="bwg-flex">
|
2465 |
+
<input type="text" name="blog_style_placeholder" id="blog_style_placeholder" value="<?php echo esc_attr($row->blog_style_placeholder); ?>" />
|
2466 |
</div>
|
2467 |
</div>
|
2468 |
</div>
|
2470 |
<div class="wd-group">
|
2471 |
<label class="wd-label" for="blog_style_search_box_width"><?php _e('Search box maximum width', BWG()->prefix); ?></label>
|
2472 |
<div class="bwg-flex">
|
2473 |
+
<input type="number" name="blog_style_search_box_width" id="blog_style_search_box_width" value="<?php echo intval($row->blog_style_search_box_width); ?>" min="0" /><span>px</span>
|
2474 |
</div>
|
2475 |
</div>
|
2476 |
</div>
|
2562 |
<div class="wd-group">
|
2563 |
<label class="wd-label" for="carousel_image_column_number"><?php _e('Max. number of images', BWG()->prefix); ?></label>
|
2564 |
<div class="bwg-flex">
|
2565 |
+
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="carousel_image_column_number" id="carousel_image_column_number" value="<?php echo intval($row->carousel_image_column_number); ?>" min="0" />
|
2566 |
</div>
|
2567 |
<p class="description"><?php _e('Set the maximum number of images that are shown with Carousel display.', BWG()->prefix); ?></p>
|
2568 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
2572 |
<div class="wd-group">
|
2573 |
<label class="wd-label" for="carousel_width"><?php _e('Image dimensions', BWG()->prefix); ?></label>
|
2574 |
<div class="bwg-flex">
|
2575 |
+
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="carousel_width" id="carousel_width" value="<?php echo intval($row->carousel_width); ?>" min="0" /><span>x</span>
|
2576 |
+
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="carousel_height" id="carousel_height" value="<?php echo intval($row->carousel_height); ?>" min="0" /><span>px</span>
|
2577 |
</div>
|
2578 |
<p class="description"><?php _e('Specify the dimensions of carousel images in pixels.', BWG()->prefix); ?></p>
|
2579 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
2583 |
<div class="wd-group">
|
2584 |
<label class="wd-label" for="carousel_image_par"><?php _e('Carousel ratio', BWG()->prefix); ?></label>
|
2585 |
<div class="bwg-flex">
|
2586 |
+
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="carousel_image_par" id="carousel_image_par" value="<?php echo intval($row->carousel_image_par); ?>" min="0" max="1" step="0.01" />
|
2587 |
</div>
|
2588 |
<p class="description"><?php _e('This option defines the proportion of dimensions between neighboring images in the carousel.', BWG()->prefix); ?></p>
|
2589 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
2593 |
<div class="wd-group">
|
2594 |
<label class="wd-label" for="carousel_r_width"><?php _e('Fixed width', BWG()->prefix); ?></label>
|
2595 |
<div class="bwg-flex">
|
2596 |
+
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="carousel_r_width" id="carousel_r_width" value="<?php echo intval($row->carousel_r_width); ?>" min="0" /><span>px</span>
|
2597 |
</div>
|
2598 |
<p class="description"><?php _e('Specify the fixed width of Carousel gallery container.', BWG()->prefix); ?></p>
|
2599 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
2638 |
<div class="wd-group">
|
2639 |
<label class="wd-label" for="carousel_interval"><?php _e('Time interval', BWG()->prefix); ?></label>
|
2640 |
<div class="bwg-flex">
|
2641 |
+
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="carousel_interval" id="carousel_interval" value="<?php echo floatval($row->carousel_interval); ?>" min="0" step="0.1" /><span>sec.</span>
|
2642 |
</div>
|
2643 |
<p class="description"><?php _e('Specify the time interval between rotations in Photo Gallery\'s Carousel view.', BWG()->prefix); ?></p>
|
2644 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
2741 |
<div class="wd-group">
|
2742 |
<label class="wd-label" for="album_column_number"><?php _e('Number of gallery group columns', BWG()->prefix); ?></label>
|
2743 |
<div class="bwg-flex">
|
2744 |
+
<input type="number" name="album_column_number" id="album_column_number" value="<?php echo intval($row->album_column_number); ?>" min="0" />
|
2745 |
</div>
|
2746 |
<p class="description"><?php _e('Set the maximum number of columns in gallery groups. Note, that the parent container needs to be large enough to display all columns.', BWG()->prefix); ?></p>
|
2747 |
</div>
|
2750 |
<div class="wd-group">
|
2751 |
<label class="wd-label" for="album_thumb_width"><?php _e('Gallery group thumbnail dimensions', BWG()->prefix); ?></label>
|
2752 |
<div class="bwg-flex">
|
2753 |
+
<input type="number" name="album_thumb_width" id="album_thumb_width" value="<?php echo intval($row->album_thumb_width); ?>" min="0" /><span>x</span>
|
2754 |
+
<input type="number" name="album_thumb_height" id="album_thumb_height" value="<?php echo intval($row->album_thumb_height); ?>" min="0" /><span>px</span>
|
2755 |
</div>
|
2756 |
<p class="description"><?php _e('Specify the dimensions of thumbnails in gallery groups.', BWG()->prefix); ?></p>
|
2757 |
</div>
|
2760 |
<div class="wd-group">
|
2761 |
<label class="wd-label" for="album_image_column_number"><?php _e('Number of image columns', BWG()->prefix); ?></label>
|
2762 |
<div class="bwg-flex">
|
2763 |
+
<input type="number" name="album_image_column_number" id="album_image_column_number" value="<?php echo intval($row->album_image_column_number); ?>" min="0" />
|
2764 |
</div>
|
2765 |
<p class="description"><?php _e('Set the maximum number of image columns in galleries. Note, that the parent container needs to be large enough to display all columns.', BWG()->prefix); ?></p>
|
2766 |
</div>
|
2769 |
<div class="wd-group">
|
2770 |
<label class="wd-label" for="album_image_thumb_width"><?php _e('Thumbnail dimensions', BWG()->prefix); ?></label>
|
2771 |
<div class="bwg-flex">
|
2772 |
+
<input type="number" name="album_image_thumb_width" id="album_image_thumb_width" value="<?php echo intval($row->album_image_thumb_width); ?>" min="0" /><span>x</span>
|
2773 |
+
<input type="number" name="album_image_thumb_height" id="album_image_thumb_height" value="<?php echo intval($row->album_image_thumb_height); ?>" min="0" /><span>px</span>
|
2774 |
</div>
|
2775 |
<p class="description"><?php _e('The default dimensions of thumbnails which will display on published galleries.', BWG()->prefix); ?></p>
|
2776 |
</div>
|
2794 |
<div class="wd-group">
|
2795 |
<label class="wd-label" for="albums_per_page"><?php _e('Gallery groups per page', BWG()->prefix); ?></label>
|
2796 |
<div class="bwg-flex">
|
2797 |
+
<input type="number" name="albums_per_page" id="albums_per_page" value="<?php echo intval($row->albums_per_page); ?>" min="0" />
|
2798 |
</div>
|
2799 |
<p class="description"><?php _e('Specify the number of galleries/gallery groups to display per page. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
2800 |
</div>
|
2803 |
<div class="wd-group">
|
2804 |
<label class="wd-label" for="album_images_per_page"><?php _e('Images per page', BWG()->prefix); ?></label>
|
2805 |
<div class="bwg-flex">
|
2806 |
+
<input type="number" name="album_images_per_page" id="album_images_per_page" value="<?php echo intval($row->album_images_per_page); ?>" min="0" />
|
2807 |
</div>
|
2808 |
<p class="description"><?php _e('Specify the number of images to display per page on galleries. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
2809 |
</div>
|
2864 |
<div class="wd-group">
|
2865 |
<label class="wd-label" for="album_placeholder"><?php _e('Add placeholder to search', BWG()->prefix); ?></label>
|
2866 |
<div class="bwg-flex">
|
2867 |
+
<input type="text" name="album_placeholder" id="album_placeholder" value="<?php echo esc_attr($row->album_placeholder); ?>" />
|
2868 |
</div>
|
2869 |
</div>
|
2870 |
</div>
|
2872 |
<div class="wd-group">
|
2873 |
<label class="wd-label" for="album_search_box_width"><?php _e('Search box maximum width', BWG()->prefix); ?></label>
|
2874 |
<div class="bwg-flex">
|
2875 |
+
<input type="number" name="album_search_box_width" id="album_search_box_width" value="<?php echo intval($row->album_search_box_width); ?>" min="0" /><span>px</span>
|
2876 |
</div>
|
2877 |
</div>
|
2878 |
</div>
|
2971 |
<div class="wd-group">
|
2972 |
<label class="wd-label" for="album_mosaic_total_width"><?php _e('Width of mosaic galleries', BWG()->prefix); ?></label>
|
2973 |
<div class="bwg-flex">
|
2974 |
+
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="album_mosaic_total_width" id="album_mosaic_total_width" value="<?php echo intval($row->album_mosaic_total_width); ?>" min="0" /><span>%</span>
|
2975 |
</div>
|
2976 |
<p class="description"><?php _e('The total width of mosaic galleries as a percentage of container\'s width.', BWG()->prefix); ?></p>
|
2977 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
3039 |
<div class="wd-group">
|
3040 |
<label class="wd-label" for="album_masonry_column_number"><?php _e('Number of gallery group columns', BWG()->prefix); ?></label>
|
3041 |
<div class="bwg-flex">
|
3042 |
+
<input type="number" name="album_masonry_column_number" id="album_masonry_column_number" value="<?php echo intval($row->album_masonry_column_number); ?>" min="0" />
|
3043 |
</div>
|
3044 |
<p class="description"><?php _e('Set the maximum number of columns in gallery groups. Note, that the parent container needs to be large enough to display all columns.', BWG()->prefix); ?></p>
|
3045 |
</div>
|
3048 |
<div class="wd-group">
|
3049 |
<label class="wd-label" for="album_masonry_thumb_width"><?php _e('Gallery group thumbnail width', BWG()->prefix); ?></label>
|
3050 |
<div class="bwg-flex">
|
3051 |
+
<input type="number" name="album_masonry_thumb_width" id="album_masonry_thumb_width" value="<?php echo intval($row->album_masonry_thumb_width); ?>" min="0" /><span>px</span>
|
3052 |
</div>
|
3053 |
<p class="description"><?php _e('Specify the dimensions of thumbnails in gallery groups.', BWG()->prefix); ?></p>
|
3054 |
</div>
|
3057 |
<div class="wd-group">
|
3058 |
<label class="wd-label" for="album_masonry_image_column_number"><?php _e('Number of image columns', BWG()->prefix); ?></label>
|
3059 |
<div class="bwg-flex">
|
3060 |
+
<input type="number" name="album_masonry_image_column_number" id="album_masonry_image_column_number" value="<?php echo intval($row->album_masonry_image_column_number); ?>" min="0" />
|
3061 |
</div>
|
3062 |
<p class="description"><?php _e('Set the maximum number of image columns in galleries. Note, that the parent container needs to be large enough to display all columns.', BWG()->prefix); ?></p>
|
3063 |
</div>
|
3066 |
<div class="wd-group">
|
3067 |
<label class="wd-label" for="album_masonry_image_thumb_width"><?php _e('Thumbnail width', BWG()->prefix); ?></label>
|
3068 |
<div class="bwg-flex">
|
3069 |
+
<input type="number" name="album_masonry_image_thumb_width" id="album_masonry_image_thumb_width" value="<?php echo intval($row->album_masonry_image_thumb_width); ?>" min="0" /><span>px</span>
|
3070 |
</div>
|
3071 |
<p class="description"><?php _e('The default dimensions of thumbnails which will display on published galleries.', BWG()->prefix); ?></p>
|
3072 |
</div>
|
3090 |
<div class="wd-group">
|
3091 |
<label class="wd-label" for="albums_masonry_per_page"><?php _e('Gallery groups per page', BWG()->prefix); ?></label>
|
3092 |
<div class="bwg-flex">
|
3093 |
+
<input type="number" name="albums_masonry_per_page" id="albums_masonry_per_page" value="<?php echo intval($row->albums_masonry_per_page); ?>" min="0" />
|
3094 |
</div>
|
3095 |
<p class="description"><?php _e('Specify the number of galleries/gallery groups to display per page. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
3096 |
</div>
|
3099 |
<div class="wd-group">
|
3100 |
<label class="wd-label" for="album_masonry_images_per_page"><?php _e('Images per page', BWG()->prefix); ?></label>
|
3101 |
<div class="bwg-flex">
|
3102 |
+
<input type="number" name="album_masonry_images_per_page" id="album_masonry_images_per_page" value="<?php echo intval($row->album_masonry_images_per_page); ?>" min="0" />
|
3103 |
</div>
|
3104 |
<p class="description"><?php _e('Specify the number of images to display per page on galleries. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
3105 |
</div>
|
3160 |
<div class="wd-group">
|
3161 |
<label class="wd-label" for="album_masonry_placeholder"><?php _e('Add placeholder to search', BWG()->prefix); ?></label>
|
3162 |
<div class="bwg-flex">
|
3163 |
+
<input type="text" name="album_masonry_placeholder" id="album_masonry_placeholder" value="<?php echo esc_attr($row->album_masonry_placeholder); ?>" />
|
3164 |
</div>
|
3165 |
</div>
|
3166 |
</div>
|
3168 |
<div class="wd-group">
|
3169 |
<label class="wd-label" for="album_masonry_search_box_width"><?php _e('Search box maximum width', BWG()->prefix); ?></label>
|
3170 |
<div class="bwg-flex">
|
3171 |
+
<input type="number" name="album_masonry_search_box_width" id="album_masonry_search_box_width" value="<?php echo intval($row->album_masonry_search_box_width); ?>" min="0" /><span>px</span>
|
3172 |
</div>
|
3173 |
</div>
|
3174 |
</div>
|
3265 |
<div class="wd-group">
|
3266 |
<label class="wd-label" for="extended_album_height"><?php _e('Extended gallery group height', BWG()->prefix); ?></label>
|
3267 |
<div class="bwg-flex">
|
3268 |
+
<input type="number" name="extended_album_height" id="extended_album_height" value="<?php echo intval($row->extended_album_height); ?>" min="0" /><span>px</span>
|
3269 |
</div>
|
3270 |
<p class="description"><?php _e('Set the height of blocks in Extended gallery groups.', BWG()->prefix); ?></p>
|
3271 |
</div>
|
3285 |
<div class="wd-group">
|
3286 |
<label class="wd-label" for="album_extended_thumb_width"><?php _e('Gallery group thumbnail dimensions', BWG()->prefix); ?></label>
|
3287 |
<div class="bwg-flex">
|
3288 |
+
<input type="number" name="album_extended_thumb_width" id="album_extended_thumb_width" value="<?php echo intval($row->album_extended_thumb_width); ?>" min="0" /><span>x</span>
|
3289 |
+
<input type="number" name="album_extended_thumb_height" id="album_extended_thumb_height" value="<?php echo intval($row->album_extended_thumb_height); ?>" min="0" /><span>px</span>
|
3290 |
</div>
|
3291 |
<p class="description"><?php _e('Specify the dimensions of thumbnails in gallery groups.', BWG()->prefix); ?></p>
|
3292 |
</div>
|
3295 |
<div class="wd-group">
|
3296 |
<label class="wd-label" for="album_extended_image_column_number"><?php _e('Number of image columns', BWG()->prefix); ?></label>
|
3297 |
<div class="bwg-flex">
|
3298 |
+
<input type="number" name="album_extended_image_column_number" id="album_extended_image_column_number" value="<?php echo intval($row->album_extended_image_column_number); ?>" min="0" />
|
3299 |
</div>
|
3300 |
<p class="description"><?php _e('Set the maximum number of image columns in galleries. Note, that the parent container needs to be large enough to display all columns.', BWG()->prefix); ?></p>
|
3301 |
</div>
|
3304 |
<div class="wd-group">
|
3305 |
<label class="wd-label" for="album_extended_image_thumb_width"><?php _e('Thumbnail dimensions', BWG()->prefix); ?></label>
|
3306 |
<div class="bwg-flex">
|
3307 |
+
<input type="number" name="album_extended_image_thumb_width" id="album_extended_image_thumb_width" value="<?php echo intval($row->album_extended_image_thumb_width); ?>" min="0" /><span>x</span>
|
3308 |
+
<input type="number" name="album_extended_image_thumb_height" id="album_extended_image_thumb_height" value="<?php echo intval($row->album_extended_image_thumb_height); ?>" min="0" /><span>px</span>
|
3309 |
</div>
|
3310 |
<p class="description"><?php _e('The default dimensions of thumbnails which will display on published galleries.', BWG()->prefix); ?></p>
|
3311 |
</div>
|
3329 |
<div class="wd-group">
|
3330 |
<label class="wd-label" for="albums_extended_per_page"><?php _e('Gallery groups per page', BWG()->prefix); ?></label>
|
3331 |
<div class="bwg-flex">
|
3332 |
+
<input type="number" name="albums_extended_per_page" id="albums_extended_per_page" value="<?php echo intval($row->albums_extended_per_page); ?>" min="0" />
|
3333 |
</div>
|
3334 |
<p class="description"><?php _e('Specify the number of galleries/gallery groups to display per page. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
3335 |
</div>
|
3338 |
<div class="wd-group">
|
3339 |
<label class="wd-label" for="album_extended_images_per_page"><?php _e('Images per page', BWG()->prefix); ?></label>
|
3340 |
<div class="bwg-flex">
|
3341 |
+
<input type="number" name="album_extended_images_per_page" id="album_extended_images_per_page" value="<?php echo intval($row->album_extended_images_per_page); ?>" min="0" />
|
3342 |
</div>
|
3343 |
<p class="description"><?php _e('Specify the number of images to display per page on galleries. Setting this option to 0 shows all items.', BWG()->prefix); ?></p>
|
3344 |
</div>
|
3399 |
<div class="wd-group">
|
3400 |
<label class="wd-label" for="album_extended_placeholder"><?php _e('Add placeholder to search', BWG()->prefix); ?></label>
|
3401 |
<div class="bwg-flex">
|
3402 |
+
<input type="text" name="album_extended_placeholder" id="album_extended_placeholder" value="<?php echo esc_attr($row->album_extended_placeholder); ?>" />
|
3403 |
</div>
|
3404 |
</div>
|
3405 |
</div>
|
3407 |
<div class="wd-group">
|
3408 |
<label class="wd-label" for="album_extended_search_box_width"><?php _e('Search box maximum width', BWG()->prefix); ?></label>
|
3409 |
<div class="bwg-flex">
|
3410 |
+
<input type="number" name="album_extended_search_box_width" id="album_extended_search_box_width" value="<?php echo intval($row->album_extended_search_box_width); ?>" min="0" /><span>px</span>
|
3411 |
</div>
|
3412 |
</div>
|
3413 |
</div>
|
3505 |
<div class="wd-group">
|
3506 |
<label class="wd-label" for="album_extended_mosaic_total_width"><?php _e('Width of mosaic galleries', BWG()->prefix); ?></label>
|
3507 |
<div class="bwg-flex">
|
3508 |
+
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="album_extended_mosaic_total_width" id="album_extended_mosaic_total_width" value="<?php echo intval($row->album_extended_mosaic_total_width); ?>" min="0" /><span>%</span>
|
3509 |
</div>
|
3510 |
<p class="description"><?php _e('The total width of mosaic galleries as a percentage of container\'s width.', BWG()->prefix); ?></p>
|
3511 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
3611 |
<div class="wd-group">
|
3612 |
<label class="wd-label" for="popup_width"><?php _e('Lightbox dimensions', BWG()->prefix); ?></label>
|
3613 |
<div class="bwg-flex">
|
3614 |
+
<input type="number" name="popup_width" id="popup_width" value="<?php echo intval($row->popup_width); ?>" min="0" /><span>x</span>
|
3615 |
+
<input type="number" name="popup_height" id="popup_height" value="<?php echo intval($row->popup_height); ?>" min="0" /><span>px</span>
|
3616 |
</div>
|
3617 |
<p class="description"><?php _e('Set the dimensions of image lightbox.', BWG()->prefix) ?></p>
|
3618 |
</div>
|
3625 |
<?php
|
3626 |
foreach ($effects as $key => $effect) {
|
3627 |
?>
|
3628 |
+
<option value="<?php echo esc_attr($key); ?>"
|
3629 |
<?php echo (!BWG()->is_pro && $key != 'none' && $key != 'fade') ? 'disabled="disabled" title="' . __('This effect is disabled in free version.', BWG()->prefix) . '"' : ''; ?>
|
3630 |
<?php if ($row->popup_type == $key) echo 'selected="selected"'; ?>><?php echo __($effect, BWG()->prefix); ?></option>
|
3631 |
<?php
|
3640 |
<div class="wd-group">
|
3641 |
<label class="wd-label" for="popup_effect_duration"><?php _e('Effect duration', BWG()->prefix); ?></label>
|
3642 |
<div class="bwg-flex">
|
3643 |
+
<input type="number" name="popup_effect_duration" id="popup_effect_duration" value="<?php echo floatval($row->popup_effect_duration); ?>" min="0" step="0.1" /><span>sec.</span>
|
3644 |
</div>
|
3645 |
<p class="description"><?php _e('Set the duration of lightbox animation effect.', BWG()->prefix) ?></p>
|
3646 |
<p class="description"><?php _e('Note, that the value of Effect Duration can not be greater than 1/4 of Time Interval.', BWG()->prefix) ?></p>
|
3660 |
<div class="wd-group">
|
3661 |
<label class="wd-label" for="popup_interval"><?php _e('Time interval', BWG()->prefix); ?></label>
|
3662 |
<div class="bwg-flex">
|
3663 |
+
<input type="number" name="popup_interval" id="popup_interval" value="<?php echo floatval($row->popup_interval); ?>" min="0" step="0.1" /><span>sec.</span>
|
3664 |
</div>
|
3665 |
<p class="description"><?php _e('Specify the time interval of autoplay in Photo Gallery lightbox.', BWG()->prefix) ?></p>
|
3666 |
</div>
|
3680 |
<div class="wd-group">
|
3681 |
<label class="wd-label" for="popup_filmstrip_height"><?php _e('Filmstrip size', BWG()->prefix); ?></label>
|
3682 |
<div class="bwg-flex">
|
3683 |
+
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="number" name="popup_filmstrip_height" id="popup_filmstrip_height" value="<?php echo intval($row->popup_filmstrip_height); ?>" min="0" /><span>px</span>
|
3684 |
</div>
|
3685 |
<p class="description"><?php _e('Set the size of your filmstrip. If the filmstrip is horizontal, this indicates its height, whereas for vertical filmstrips it sets the width.', BWG()->prefix) ?></p>
|
3686 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
3913 |
<div class="wd-group">
|
3914 |
<label class="wd-label" for="addthis_profile_id">AddThis <?php _e('profile ID', BWG()->prefix); ?></label>
|
3915 |
<div class="bwg-flex">
|
3916 |
+
<input <?php echo BWG()->is_pro ? '' : 'disabled="disabled"'; ?> type="text" name="addthis_profile_id" id="addthis_profile_id" value="<?php echo esc_attr($row->addthis_profile_id); ?>" />
|
3917 |
</div>
|
3918 |
<p class="description"><?php _e('Provide the ID of your profile to connect to AddThis.', BWG()->prefix); ?><br><?php echo sprintf(__('Create an account %s.', BWG()->prefix), '<a href="https://www.addthis.com/register" target="_blank">' . __('here', BWG()->prefix) . '</a>'); ?></p>
|
3919 |
<?php if ( !BWG()->is_pro ) { ?><p class="description spider_free_version"><?php echo BWG()->free_msg; ?></p><?php } ?>
|
filemanager/UploadHandler.php
CHANGED
@@ -23,7 +23,7 @@ $controller = new FilemanagerController();
|
|
23 |
$upload_handler = new bwg_upl(array(
|
24 |
'upload_dir' => $controller->uploads_dir . (isset($_GET['dir']) ? str_replace(array('\\', '../'), '', WDWLibrary::get('dir', '', 'sanitize_text_field', 'GET')) : '/'),
|
25 |
'upload_url' => $controller->uploads_url,
|
26 |
-
'accept_file_types' => '/\.(gif|jpe?g|png|svg|aac|m4a|f4a|oga|ogg|mp3|zip)$/i',
|
27 |
));
|
28 |
|
29 |
class bwg_upl {
|
@@ -500,7 +500,6 @@ class bwg_upl {
|
|
500 |
|
501 |
protected function handle_image_file( $file_path, $file ) {
|
502 |
$failed_versions = array();
|
503 |
-
|
504 |
foreach ( $this->options['image_versions'] as $version => $options ) {
|
505 |
if ( $this->create_scaled_image($file->name, $version, $options) ) {
|
506 |
if ( $version === '' && $this->options['orient_image'] ) {
|
@@ -541,16 +540,14 @@ class bwg_upl {
|
|
541 |
$image_info = @getimagesize(htmlspecialchars_decode($file->url, ENT_COMPAT | ENT_QUOTES));
|
542 |
if ( $file->type == 'svg' ) {
|
543 |
$size = WDWLibrary::get_svg_size($file->url);
|
|
|
544 |
if ( !empty($size) ) {
|
545 |
-
$file->resolution = $size['width'] .
|
546 |
-
}
|
547 |
-
else {
|
548 |
-
$file->resolution = "";
|
549 |
}
|
550 |
}
|
551 |
else {
|
552 |
if ( !empty($image_info) ) {
|
553 |
-
$file->resolution = $image_info[0] . ' x ' . $image_info[1] . ' px';
|
554 |
}
|
555 |
}
|
556 |
if ( BWG()->options->read_metadata ) {
|
@@ -647,12 +644,12 @@ class bwg_upl {
|
|
647 |
$this->create_scaled_image($file->name, 'main', $this->options);
|
648 |
}
|
649 |
// Zip Upload.
|
650 |
-
|
651 |
$file->error = FALSE;
|
652 |
if ( $extension == 'svg' ) {
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
$this->handle_image_file($ex_file, $file);
|
657 |
}
|
658 |
}
|
@@ -720,18 +717,17 @@ class bwg_upl {
|
|
720 |
$file->size = $file_size_kb . ' KB';
|
721 |
$file->date_modified = date('Y-m-d H:i:s', filemtime($file_path));
|
722 |
$image_info = @getimagesize(htmlspecialchars_decode($file_path, ENT_COMPAT | ENT_QUOTES));
|
723 |
-
|
724 |
if ( $type == 'svg' ) {
|
|
|
|
|
725 |
$size = WDWLibrary::get_svg_size($file->dir.$file->name);
|
726 |
-
if( !empty($size) ) {
|
727 |
-
$file->resolution = $size['width'] .
|
728 |
-
$file->resolution_thumb = $size['width'] .
|
729 |
-
} else {
|
730 |
-
$file->resolution = "";
|
731 |
-
$file->resolution_thumb = "";
|
732 |
}
|
733 |
-
}
|
734 |
-
|
|
|
735 |
$file->resolution_thumb = WDWLibrary::get_thumb_size($file->thumb_url);
|
736 |
}
|
737 |
if ( BWG()->options->read_metadata ) {
|
@@ -750,7 +746,6 @@ class bwg_upl {
|
|
750 |
else {
|
751 |
$file->error = TRUE;
|
752 |
}
|
753 |
-
|
754 |
return $file;
|
755 |
}
|
756 |
|
@@ -787,7 +782,6 @@ class bwg_upl {
|
|
787 |
// Non-multipart uploads (PUT method support)
|
788 |
file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0);
|
789 |
}
|
790 |
-
|
791 |
$file_size = $this->get_file_size($file_path, $append_file);
|
792 |
if ( strpos($type, 'svg') || $file_size === $file->size ) {
|
793 |
// Do not compare size if the file is svg (for the reason when script is deleted from file).
|
@@ -814,7 +808,6 @@ class bwg_upl {
|
|
814 |
}
|
815 |
$this->set_file_delete_properties($file);
|
816 |
}
|
817 |
-
|
818 |
return $file;
|
819 |
}
|
820 |
|
23 |
$upload_handler = new bwg_upl(array(
|
24 |
'upload_dir' => $controller->uploads_dir . (isset($_GET['dir']) ? str_replace(array('\\', '../'), '', WDWLibrary::get('dir', '', 'sanitize_text_field', 'GET')) : '/'),
|
25 |
'upload_url' => $controller->uploads_url,
|
26 |
+
'accept_file_types' => '/\.(gif|jpe?g|png|svg|webp|aac|m4a|f4a|oga|ogg|mp3|zip)$/i',
|
27 |
));
|
28 |
|
29 |
class bwg_upl {
|
500 |
|
501 |
protected function handle_image_file( $file_path, $file ) {
|
502 |
$failed_versions = array();
|
|
|
503 |
foreach ( $this->options['image_versions'] as $version => $options ) {
|
504 |
if ( $this->create_scaled_image($file->name, $version, $options) ) {
|
505 |
if ( $version === '' && $this->options['orient_image'] ) {
|
540 |
$image_info = @getimagesize(htmlspecialchars_decode($file->url, ENT_COMPAT | ENT_QUOTES));
|
541 |
if ( $file->type == 'svg' ) {
|
542 |
$size = WDWLibrary::get_svg_size($file->url);
|
543 |
+
$file->resolution = '';
|
544 |
if ( !empty($size) ) {
|
545 |
+
$file->resolution = WDWLibrary::format_number($size['width']) . ' x ' . WDWLibrary::format_number($size['height']) . ' px';
|
|
|
|
|
|
|
546 |
}
|
547 |
}
|
548 |
else {
|
549 |
if ( !empty($image_info) ) {
|
550 |
+
$file->resolution = WDWLibrary::format_number($image_info[0]) . ' x ' . WDWLibrary::format_number($image_info[1]) . ' px';
|
551 |
}
|
552 |
}
|
553 |
if ( BWG()->options->read_metadata ) {
|
644 |
$this->create_scaled_image($file->name, 'main', $this->options);
|
645 |
}
|
646 |
// Zip Upload.
|
647 |
+
if ( is_int($img_width) || $extension == 'svg' ) {
|
648 |
$file->error = FALSE;
|
649 |
if ( $extension == 'svg' ) {
|
650 |
+
$file_content = file_get_contents($ex_file);
|
651 |
+
file_put_contents($ex_file, preg_replace('#<script(.*?)>(.*?)</script>#is', '', $file_content));
|
652 |
+
}
|
653 |
$this->handle_image_file($ex_file, $file);
|
654 |
}
|
655 |
}
|
717 |
$file->size = $file_size_kb . ' KB';
|
718 |
$file->date_modified = date('Y-m-d H:i:s', filemtime($file_path));
|
719 |
$image_info = @getimagesize(htmlspecialchars_decode($file_path, ENT_COMPAT | ENT_QUOTES));
|
|
|
720 |
if ( $type == 'svg' ) {
|
721 |
+
$file->resolution = "";
|
722 |
+
$file->resolution_thumb = "";
|
723 |
$size = WDWLibrary::get_svg_size($file->dir.$file->name);
|
724 |
+
if ( !empty($size) ) {
|
725 |
+
$file->resolution = WDWLibrary::format_number($size['width']) . ' x ' . WDWLibrary::format_number($size['height']) . ' px';
|
726 |
+
$file->resolution_thumb = WDWLibrary::format_number($size['width'], 2) . 'x' . WDWLibrary::format_number($size['height'], 2,);
|
|
|
|
|
|
|
727 |
}
|
728 |
+
}
|
729 |
+
else {
|
730 |
+
$file->resolution = WDWLibrary::format_number($image_info[0]) . ' x ' . WDWLibrary::format_number($image_info[1]) . ' px';
|
731 |
$file->resolution_thumb = WDWLibrary::get_thumb_size($file->thumb_url);
|
732 |
}
|
733 |
if ( BWG()->options->read_metadata ) {
|
746 |
else {
|
747 |
$file->error = TRUE;
|
748 |
}
|
|
|
749 |
return $file;
|
750 |
}
|
751 |
|
782 |
// Non-multipart uploads (PUT method support)
|
783 |
file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0);
|
784 |
}
|
|
|
785 |
$file_size = $this->get_file_size($file_path, $append_file);
|
786 |
if ( strpos($type, 'svg') || $file_size === $file->size ) {
|
787 |
// Do not compare size if the file is svg (for the reason when script is deleted from file).
|
808 |
}
|
809 |
$this->set_file_delete_properties($file);
|
810 |
}
|
|
|
811 |
return $file;
|
812 |
}
|
813 |
|
filemanager/controller.php
CHANGED
@@ -62,11 +62,11 @@ class FilemanagerController {
|
|
62 |
$session_data['sort_order'] = $bwg_filemanager_sorting_array[get_current_user_id()]['sort_order'];
|
63 |
} else {
|
64 |
$session_data['sort_by'] = 'date_modified';
|
65 |
-
$session_data['sort_order'] = '
|
66 |
}
|
67 |
} else {
|
68 |
$session_data['sort_by'] = 'date_modified';
|
69 |
-
$session_data['sort_order'] = '
|
70 |
}
|
71 |
$params['orderby'] = $session_data['sort_by'];
|
72 |
$params['session_data'] = $session_data;
|
@@ -165,7 +165,6 @@ class FilemanagerController {
|
|
165 |
}
|
166 |
|
167 |
public function make_dir() {
|
168 |
-
|
169 |
global $wpdb;
|
170 |
$input_dir = (isset($_REQUEST['dir']) ? str_replace(array('\\', '../'), '', WDWLibrary::get('dir','','sanitize_text_field','REQUEST')) : '');
|
171 |
$input_dir = htmlspecialchars_decode($input_dir, ENT_COMPAT | ENT_QUOTES);
|
@@ -475,7 +474,6 @@ class FilemanagerController {
|
|
475 |
$input_dir = htmlspecialchars_decode($input_dir, ENT_COMPAT | ENT_QUOTES);
|
476 |
$input_dir = $this->esc_dir($input_dir);
|
477 |
|
478 |
-
|
479 |
$msg = '';
|
480 |
$flag = TRUE;
|
481 |
|
62 |
$session_data['sort_order'] = $bwg_filemanager_sorting_array[get_current_user_id()]['sort_order'];
|
63 |
} else {
|
64 |
$session_data['sort_by'] = 'date_modified';
|
65 |
+
$session_data['sort_order'] = 'desc';
|
66 |
}
|
67 |
} else {
|
68 |
$session_data['sort_by'] = 'date_modified';
|
69 |
+
$session_data['sort_order'] = 'desc';
|
70 |
}
|
71 |
$params['orderby'] = $session_data['sort_by'];
|
72 |
$params['session_data'] = $session_data;
|
165 |
}
|
166 |
|
167 |
public function make_dir() {
|
|
|
168 |
global $wpdb;
|
169 |
$input_dir = (isset($_REQUEST['dir']) ? str_replace(array('\\', '../'), '', WDWLibrary::get('dir','','sanitize_text_field','REQUEST')) : '');
|
170 |
$input_dir = htmlspecialchars_decode($input_dir, ENT_COMPAT | ENT_QUOTES);
|
474 |
$input_dir = htmlspecialchars_decode($input_dir, ENT_COMPAT | ENT_QUOTES);
|
475 |
$input_dir = $this->esc_dir($input_dir);
|
476 |
|
|
|
477 |
$msg = '';
|
478 |
$flag = TRUE;
|
479 |
|
filemanager/js/default.js
CHANGED
@@ -8,6 +8,8 @@ var all_files_selected = false;
|
|
8 |
var params = [];
|
9 |
var no_selected_files = [];
|
10 |
var wdb_all_files_filtered = [];
|
|
|
|
|
11 |
|
12 |
jQuery(function() {
|
13 |
var page = 1;
|
@@ -40,7 +42,7 @@ jQuery(function() {
|
|
40 |
params['page'] = page;
|
41 |
params['orderby'] = orderby;
|
42 |
params['order'] = order;
|
43 |
-
if ( (page_per * page) < files_count ) {
|
44 |
ajax_print_images( params ).then(function() {
|
45 |
page++;
|
46 |
items_count = jQuery("#explorer_body .explorer_item").length;
|
@@ -59,7 +61,7 @@ jQuery(function() {
|
|
59 |
}
|
60 |
}
|
61 |
}
|
62 |
-
checking_the_need_of_images(jQuery("#explorer_body_container"))
|
63 |
jQuery("#explorer_body_container").scroll(function () {
|
64 |
checking_the_need_of_images(jQuery(this));
|
65 |
});
|
@@ -643,6 +645,7 @@ function ajax_print_images( params ) {
|
|
643 |
var element = params['element'];
|
644 |
var is_search = params['is_search'];
|
645 |
var paged = params['page'];
|
|
|
646 |
var search = params['search'];
|
647 |
var orderby = params['orderby'];
|
648 |
var order = params['order'];
|
8 |
var params = [];
|
9 |
var no_selected_files = [];
|
10 |
var wdb_all_files_filtered = [];
|
11 |
+
/* keeping last page of image add action to avoid duplication during the scroll */
|
12 |
+
var ajax_request_count = 0;
|
13 |
|
14 |
jQuery(function() {
|
15 |
var page = 1;
|
42 |
params['page'] = page;
|
43 |
params['orderby'] = orderby;
|
44 |
params['order'] = order;
|
45 |
+
if ( (page_per * page) < files_count && ajax_request_count !== params['page'] ) {
|
46 |
ajax_print_images( params ).then(function() {
|
47 |
page++;
|
48 |
items_count = jQuery("#explorer_body .explorer_item").length;
|
61 |
}
|
62 |
}
|
63 |
}
|
64 |
+
checking_the_need_of_images(jQuery("#explorer_body_container"));
|
65 |
jQuery("#explorer_body_container").scroll(function () {
|
66 |
checking_the_need_of_images(jQuery(this));
|
67 |
});
|
645 |
var element = params['element'];
|
646 |
var is_search = params['is_search'];
|
647 |
var paged = params['page'];
|
648 |
+
ajax_request_count = paged;
|
649 |
var search = params['search'];
|
650 |
var orderby = params['orderby'];
|
651 |
var order = params['order'];
|
filemanager/view.php
CHANGED
@@ -388,7 +388,7 @@ class FilemanagerView {
|
|
388 |
fail: function (e, data) {
|
389 |
if ( data.textStatus == 'error' ) {
|
390 |
var filename = data.files[0].name;
|
391 |
-
var regex = /\.(jpe?g|png|gif|svg)$/i;
|
392 |
if ( ! regex.test(filename) ) {
|
393 |
allowed_files.push(filename);
|
394 |
errorFiles['allowed'] = allowed_files;
|
388 |
fail: function (e, data) {
|
389 |
if ( data.textStatus == 'error' ) {
|
390 |
var filename = data.files[0].name;
|
391 |
+
var regex = /\.(jpe?g|png|gif|svg|webp)$/i;
|
392 |
if ( ! regex.test(filename) ) {
|
393 |
allowed_files.push(filename);
|
394 |
errorFiles['allowed'] = allowed_files;
|
framework/BWGOptions.php
CHANGED
@@ -380,8 +380,8 @@ class WD_BWG_Options {
|
|
380 |
$this->permissions = 'manage_options';
|
381 |
}
|
382 |
|
383 |
-
$this->jpeg_quality = $this->image_quality;
|
384 |
-
$this->png_quality = 9 - round(9 * $this->image_quality / 100);
|
385 |
|
386 |
// Will access_token refresh in the last 30 dey.
|
387 |
if ( !empty( $this->instagram_access_token ) && !empty( $this->instagram_access_token_start_in ) && !empty( $this->instagram_access_token_expires_in ) ) {
|
380 |
$this->permissions = 'manage_options';
|
381 |
}
|
382 |
|
383 |
+
$this->jpeg_quality = intval($this->image_quality);
|
384 |
+
$this->png_quality = 9 - round(9 * intval($this->image_quality) / 100);
|
385 |
|
386 |
// Will access_token refresh in the last 30 dey.
|
387 |
if ( !empty( $this->instagram_access_token ) && !empty( $this->instagram_access_token_start_in ) && !empty( $this->instagram_access_token_expires_in ) ) {
|
framework/WDWLibrary.php
CHANGED
@@ -1392,7 +1392,7 @@ class WDWLibrary {
|
|
1392 |
*
|
1393 |
* @return int
|
1394 |
*/
|
1395 |
-
public static function bwg_image_set_watermark( $gallery_id, $image_id = 0, $limit = '' ) {
|
1396 |
global $wpdb;
|
1397 |
$message_id = 21;
|
1398 |
$options = new WD_BWG_Options();
|
@@ -1408,7 +1408,11 @@ class WDWLibrary {
|
|
1408 |
$prepareArgs[] = $image_id;
|
1409 |
$modified_date_prepare_args[] = $image_id;
|
1410 |
}
|
1411 |
-
|
|
|
|
|
|
|
|
|
1412 |
$where = 1;
|
1413 |
}
|
1414 |
//$where = (($gallery_id) ? ' `gallery_id`=' . $gallery_id . ($image_id ? ' AND `id`=' . $image_id : '') : 1);
|
@@ -1430,9 +1434,12 @@ class WDWLibrary {
|
|
1430 |
$prepareArgs[] = $limit;
|
1431 |
}
|
1432 |
if ( empty($prepareArgs) ) {
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
|
|
|
|
|
|
1436 |
}
|
1437 |
if ( !empty( $images ) ) {
|
1438 |
switch ( $options->built_in_watermark_type ) {
|
@@ -1470,14 +1477,12 @@ class WDWLibrary {
|
|
1470 |
public static function set_text_watermark($original_filename, $dest_filename, $watermark_text, $watermark_font, $watermark_font_size, $watermark_color, $watermark_transparency, $watermark_position) {
|
1471 |
$original_filename = htmlspecialchars_decode($original_filename, ENT_COMPAT | ENT_QUOTES);
|
1472 |
$dest_filename = htmlspecialchars_decode($dest_filename, ENT_COMPAT | ENT_QUOTES);
|
1473 |
-
|
1474 |
$watermark_transparency = 127 - ($watermark_transparency * 1.27);
|
1475 |
list($width, $height, $type) = getimagesize($original_filename);
|
1476 |
if( $width == 0 || $height == 0 ) {
|
1477 |
return FALSE;
|
1478 |
}
|
1479 |
$watermark_image = imagecreatetruecolor($width, $height);
|
1480 |
-
|
1481 |
$watermark_color = self::bwg_hex2rgb($watermark_color);
|
1482 |
$watermark_color = imagecolorallocatealpha($watermark_image, $watermark_color[0], $watermark_color[1], $watermark_color[2], $watermark_transparency);
|
1483 |
$watermark_font = BWG()->plugin_dir . '/fonts/' . $watermark_font;
|
@@ -1504,22 +1509,20 @@ class WDWLibrary {
|
|
1504 |
break;
|
1505 |
}
|
1506 |
@ini_set('memory_limit', '-1');
|
1507 |
-
if ($type == 2) {
|
1508 |
$image = imagecreatefromjpeg($original_filename);
|
1509 |
imagettftext($image, $watermark_font_size, 0, $left, $top, $watermark_color, $watermark_font, $watermark_text);
|
1510 |
imagejpeg ($image, $dest_filename, BWG()->options->jpeg_quality);
|
1511 |
-
imagedestroy($image);
|
1512 |
}
|
1513 |
-
elseif ($type == 3) {
|
1514 |
$image = imagecreatefrompng($original_filename);
|
1515 |
imagettftext($image, $watermark_font_size, 0, $left, $top, $watermark_color, $watermark_font, $watermark_text);
|
1516 |
imageColorAllocateAlpha($image, 0, 0, 0, 127);
|
1517 |
imagealphablending($image, FALSE);
|
1518 |
imagesavealpha($image, TRUE);
|
1519 |
imagepng($image, $dest_filename, BWG()->options->png_quality);
|
1520 |
-
imagedestroy($image);
|
1521 |
}
|
1522 |
-
elseif ($type == 1) {
|
1523 |
$image = imagecreatefromgif($original_filename);
|
1524 |
imageColorAllocateAlpha($watermark_image, 0, 0, 0, 127);
|
1525 |
imagecopy($watermark_image, $image, 0, 0, 0, 0, $width, $height);
|
@@ -1527,8 +1530,16 @@ class WDWLibrary {
|
|
1527 |
imagealphablending($watermark_image, FALSE);
|
1528 |
imagesavealpha($watermark_image, TRUE);
|
1529 |
imagegif($watermark_image, $dest_filename);
|
1530 |
-
imagedestroy($image);
|
1531 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1532 |
imagedestroy($watermark_image);
|
1533 |
@ini_restore('memory_limit');
|
1534 |
return TRUE;
|
@@ -1572,15 +1583,18 @@ class WDWLibrary {
|
|
1572 |
$left = ($width - $watermark_width) / 2;
|
1573 |
break;
|
1574 |
}
|
1575 |
-
if ($type_watermark == 2) {
|
1576 |
$watermark_image = imagecreatefromjpeg($watermark_url);
|
1577 |
}
|
1578 |
-
elseif ($type_watermark == 3) {
|
1579 |
$watermark_image = imagecreatefrompng($watermark_url);
|
1580 |
}
|
1581 |
-
elseif ($type_watermark == 1) {
|
1582 |
$watermark_image = imagecreatefromgif($watermark_url);
|
1583 |
}
|
|
|
|
|
|
|
1584 |
else {
|
1585 |
return false;
|
1586 |
}
|
@@ -1591,42 +1605,46 @@ class WDWLibrary {
|
|
1591 |
imagealphablending($watermark_image_resized, FALSE);
|
1592 |
imagesavealpha($watermark_image_resized, TRUE);
|
1593 |
imagecopyresampled ($watermark_image_resized, $watermark_image, 0, 0, 0, 0, $watermark_width, $watermark_height, $width_watermark, $height_watermark);
|
1594 |
-
|
1595 |
-
if ($type == 2) {
|
1596 |
$image = imagecreatefromjpeg($original_filename);
|
1597 |
imagecopy($image, $watermark_image_resized, $left, $top, 0, 0, $watermark_width, $watermark_height);
|
1598 |
if ($dest_filename <> '') {
|
1599 |
-
|
1600 |
} else {
|
1601 |
-
|
1602 |
-
|
1603 |
};
|
1604 |
-
imagedestroy($image);
|
1605 |
}
|
1606 |
-
elseif ($type == 3) {
|
1607 |
$image = imagecreatefrompng($original_filename);
|
1608 |
imagepalettetotruecolor($image);
|
1609 |
imagecopy($image, $watermark_image_resized, $left, $top, 0, 0, $watermark_width, $watermark_height);
|
1610 |
imagealphablending($image, FALSE);
|
1611 |
imagesavealpha($image, TRUE);
|
1612 |
imagepng($image, $dest_filename, BWG()->options->png_quality);
|
1613 |
-
imagedestroy($image);
|
1614 |
}
|
1615 |
-
elseif ($type == 1) {
|
1616 |
$image = imagecreatefromgif($original_filename);
|
1617 |
$tempimage = imagecreatetruecolor($width, $height);
|
1618 |
imagecopy($tempimage, $image, 0, 0, 0, 0, $width, $height);
|
1619 |
imagecopy($tempimage, $watermark_image_resized, $left, $top, 0, 0, $watermark_width, $watermark_height);
|
1620 |
imagegif($tempimage, $dest_filename);
|
1621 |
-
imagedestroy($image);
|
1622 |
imagedestroy($tempimage);
|
1623 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1624 |
imagedestroy($watermark_image);
|
1625 |
@ini_restore('memory_limit');
|
1626 |
}
|
1627 |
}
|
1628 |
|
1629 |
-
public static function bwg_image_recover_all($gallery_id, $limit = '') {
|
1630 |
$thumb_width = BWG()->options->upload_thumb_width;
|
1631 |
$width = BWG()->options->upload_img_width;
|
1632 |
global $wpdb;
|
@@ -1637,7 +1655,11 @@ class WDWLibrary {
|
|
1637 |
$where = ' `gallery_id` = %d';
|
1638 |
$prepareArgs[] = $gallery_id;
|
1639 |
$modified_date_prepare_args[] = $gallery_id;
|
1640 |
-
|
|
|
|
|
|
|
|
|
1641 |
$where = 1;
|
1642 |
}
|
1643 |
$search = WDWLibrary::get('s', '');
|
@@ -1657,7 +1679,8 @@ class WDWLibrary {
|
|
1657 |
$limitstart = ' LIMIT 50 OFFSET %d';
|
1658 |
$prepareArgs[] = $limit;
|
1659 |
}
|
1660 |
-
$
|
|
|
1661 |
if ( !empty( $images ) ) {
|
1662 |
foreach ( $images as $image ) {
|
1663 |
if ( preg_match( '/EMBED/', $image->filetype ) == 1 ) {
|
@@ -2616,9 +2639,9 @@ class WDWLibrary {
|
|
2616 |
$img_width = $get_thumb_size["width"];
|
2617 |
$img_height = $get_thumb_size["height"];
|
2618 |
$scale = min( $max_width / $img_width, $max_height / $img_height );
|
2619 |
-
$new_width
|
2620 |
$new_height = $img_height * $scale;
|
2621 |
-
$resolution_thumb = $new_width .
|
2622 |
}
|
2623 |
}
|
2624 |
return $resolution_thumb;
|
@@ -2736,6 +2759,7 @@ class WDWLibrary {
|
|
2736 |
case 'gif':
|
2737 |
case 'png':
|
2738 |
case 'svg':
|
|
|
2739 |
return TRUE;
|
2740 |
break;
|
2741 |
}
|
@@ -3367,5 +3391,44 @@ class WDWLibrary {
|
|
3367 |
}
|
3368 |
return 'order_asc';
|
3369 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3370 |
}
|
3371 |
|
1392 |
*
|
1393 |
* @return int
|
1394 |
*/
|
1395 |
+
public static function bwg_image_set_watermark( $gallery_id, $image_id = 0, $limit = '', $excludeIds = array() ) {
|
1396 |
global $wpdb;
|
1397 |
$message_id = 21;
|
1398 |
$options = new WD_BWG_Options();
|
1408 |
$prepareArgs[] = $image_id;
|
1409 |
$modified_date_prepare_args[] = $image_id;
|
1410 |
}
|
1411 |
+
if ( !empty($excludeIds) ) {
|
1412 |
+
$where .= ' AND `id` NOT IN (' . self::escape_array($excludeIds) . ')';
|
1413 |
+
}
|
1414 |
+
}
|
1415 |
+
else {
|
1416 |
$where = 1;
|
1417 |
}
|
1418 |
//$where = (($gallery_id) ? ' `gallery_id`=' . $gallery_id . ($image_id ? ' AND `id`=' . $image_id : '') : 1);
|
1434 |
$prepareArgs[] = $limit;
|
1435 |
}
|
1436 |
if ( empty($prepareArgs) ) {
|
1437 |
+
$query = 'SELECT * FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where . $limitstart;
|
1438 |
+
$images = $wpdb->get_results( $query );
|
1439 |
+
}
|
1440 |
+
else {
|
1441 |
+
$query = $wpdb->prepare('SELECT * FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where . $limitstart, $prepareArgs);
|
1442 |
+
$images = $wpdb->get_results( $query );
|
1443 |
}
|
1444 |
if ( !empty( $images ) ) {
|
1445 |
switch ( $options->built_in_watermark_type ) {
|
1477 |
public static function set_text_watermark($original_filename, $dest_filename, $watermark_text, $watermark_font, $watermark_font_size, $watermark_color, $watermark_transparency, $watermark_position) {
|
1478 |
$original_filename = htmlspecialchars_decode($original_filename, ENT_COMPAT | ENT_QUOTES);
|
1479 |
$dest_filename = htmlspecialchars_decode($dest_filename, ENT_COMPAT | ENT_QUOTES);
|
|
|
1480 |
$watermark_transparency = 127 - ($watermark_transparency * 1.27);
|
1481 |
list($width, $height, $type) = getimagesize($original_filename);
|
1482 |
if( $width == 0 || $height == 0 ) {
|
1483 |
return FALSE;
|
1484 |
}
|
1485 |
$watermark_image = imagecreatetruecolor($width, $height);
|
|
|
1486 |
$watermark_color = self::bwg_hex2rgb($watermark_color);
|
1487 |
$watermark_color = imagecolorallocatealpha($watermark_image, $watermark_color[0], $watermark_color[1], $watermark_color[2], $watermark_transparency);
|
1488 |
$watermark_font = BWG()->plugin_dir . '/fonts/' . $watermark_font;
|
1509 |
break;
|
1510 |
}
|
1511 |
@ini_set('memory_limit', '-1');
|
1512 |
+
if ( $type == 2 ) {
|
1513 |
$image = imagecreatefromjpeg($original_filename);
|
1514 |
imagettftext($image, $watermark_font_size, 0, $left, $top, $watermark_color, $watermark_font, $watermark_text);
|
1515 |
imagejpeg ($image, $dest_filename, BWG()->options->jpeg_quality);
|
|
|
1516 |
}
|
1517 |
+
elseif ( $type == 3 ) {
|
1518 |
$image = imagecreatefrompng($original_filename);
|
1519 |
imagettftext($image, $watermark_font_size, 0, $left, $top, $watermark_color, $watermark_font, $watermark_text);
|
1520 |
imageColorAllocateAlpha($image, 0, 0, 0, 127);
|
1521 |
imagealphablending($image, FALSE);
|
1522 |
imagesavealpha($image, TRUE);
|
1523 |
imagepng($image, $dest_filename, BWG()->options->png_quality);
|
|
|
1524 |
}
|
1525 |
+
elseif ( $type == 1 ) {
|
1526 |
$image = imagecreatefromgif($original_filename);
|
1527 |
imageColorAllocateAlpha($watermark_image, 0, 0, 0, 127);
|
1528 |
imagecopy($watermark_image, $image, 0, 0, 0, 0, $width, $height);
|
1530 |
imagealphablending($watermark_image, FALSE);
|
1531 |
imagesavealpha($watermark_image, TRUE);
|
1532 |
imagegif($watermark_image, $dest_filename);
|
|
|
1533 |
}
|
1534 |
+
elseif ( $type == 18 ) {
|
1535 |
+
$image = imagecreatefromwebp($original_filename);
|
1536 |
+
imageColorAllocateAlpha($image, 0, 0, 0, 127);
|
1537 |
+
imagettftext($image, $watermark_font_size, 0, $left, $top, $watermark_color, $watermark_font, $watermark_text);
|
1538 |
+
imagealphablending($image, FALSE);
|
1539 |
+
imagesavealpha($image, TRUE);
|
1540 |
+
imagewebp($image, $dest_filename, BWG()->options->png_quality);
|
1541 |
+
}
|
1542 |
+
imagedestroy($image);
|
1543 |
imagedestroy($watermark_image);
|
1544 |
@ini_restore('memory_limit');
|
1545 |
return TRUE;
|
1583 |
$left = ($width - $watermark_width) / 2;
|
1584 |
break;
|
1585 |
}
|
1586 |
+
if ( $type_watermark == 2 ) {
|
1587 |
$watermark_image = imagecreatefromjpeg($watermark_url);
|
1588 |
}
|
1589 |
+
elseif ( $type_watermark == 3 ) {
|
1590 |
$watermark_image = imagecreatefrompng($watermark_url);
|
1591 |
}
|
1592 |
+
elseif ( $type_watermark == 1 ) {
|
1593 |
$watermark_image = imagecreatefromgif($watermark_url);
|
1594 |
}
|
1595 |
+
elseif ( $type_watermark == 18 ) {
|
1596 |
+
$watermark_image = imagecreatefromwebp($watermark_url);
|
1597 |
+
}
|
1598 |
else {
|
1599 |
return false;
|
1600 |
}
|
1605 |
imagealphablending($watermark_image_resized, FALSE);
|
1606 |
imagesavealpha($watermark_image_resized, TRUE);
|
1607 |
imagecopyresampled ($watermark_image_resized, $watermark_image, 0, 0, 0, 0, $watermark_width, $watermark_height, $width_watermark, $height_watermark);
|
1608 |
+
if ( $type == 2) {
|
|
|
1609 |
$image = imagecreatefromjpeg($original_filename);
|
1610 |
imagecopy($image, $watermark_image_resized, $left, $top, 0, 0, $watermark_width, $watermark_height);
|
1611 |
if ($dest_filename <> '') {
|
1612 |
+
imagejpeg ($image, $dest_filename, BWG()->options->jpeg_quality);
|
1613 |
} else {
|
1614 |
+
header('Content-Type: image/jpeg');
|
1615 |
+
imagejpeg($image, null, BWG()->options->jpeg_quality);
|
1616 |
};
|
|
|
1617 |
}
|
1618 |
+
elseif ( $type == 3 ) {
|
1619 |
$image = imagecreatefrompng($original_filename);
|
1620 |
imagepalettetotruecolor($image);
|
1621 |
imagecopy($image, $watermark_image_resized, $left, $top, 0, 0, $watermark_width, $watermark_height);
|
1622 |
imagealphablending($image, FALSE);
|
1623 |
imagesavealpha($image, TRUE);
|
1624 |
imagepng($image, $dest_filename, BWG()->options->png_quality);
|
|
|
1625 |
}
|
1626 |
+
elseif ( $type == 1 ) {
|
1627 |
$image = imagecreatefromgif($original_filename);
|
1628 |
$tempimage = imagecreatetruecolor($width, $height);
|
1629 |
imagecopy($tempimage, $image, 0, 0, 0, 0, $width, $height);
|
1630 |
imagecopy($tempimage, $watermark_image_resized, $left, $top, 0, 0, $watermark_width, $watermark_height);
|
1631 |
imagegif($tempimage, $dest_filename);
|
|
|
1632 |
imagedestroy($tempimage);
|
1633 |
}
|
1634 |
+
elseif ( $type == 18 ) {
|
1635 |
+
$image = imagecreatefromwebp($original_filename);
|
1636 |
+
imagecopy($image, $watermark_image_resized, $left, $top, 0, 0, $watermark_width, $watermark_height);
|
1637 |
+
imagealphablending($image, FALSE);
|
1638 |
+
imagesavealpha($image, TRUE);
|
1639 |
+
imagewebp($image, $dest_filename, BWG()->options->png_quality);
|
1640 |
+
}
|
1641 |
+
imagedestroy($image);
|
1642 |
imagedestroy($watermark_image);
|
1643 |
@ini_restore('memory_limit');
|
1644 |
}
|
1645 |
}
|
1646 |
|
1647 |
+
public static function bwg_image_recover_all( $gallery_id, $limit = '', $excludeIds = array() ) {
|
1648 |
$thumb_width = BWG()->options->upload_thumb_width;
|
1649 |
$width = BWG()->options->upload_img_width;
|
1650 |
global $wpdb;
|
1655 |
$where = ' `gallery_id` = %d';
|
1656 |
$prepareArgs[] = $gallery_id;
|
1657 |
$modified_date_prepare_args[] = $gallery_id;
|
1658 |
+
if ( !empty($excludeIds) ) {
|
1659 |
+
$where .= ' AND `id` NOT IN (' . self::escape_array($excludeIds) . ')';
|
1660 |
+
}
|
1661 |
+
}
|
1662 |
+
else {
|
1663 |
$where = 1;
|
1664 |
}
|
1665 |
$search = WDWLibrary::get('s', '');
|
1679 |
$limitstart = ' LIMIT 50 OFFSET %d';
|
1680 |
$prepareArgs[] = $limit;
|
1681 |
}
|
1682 |
+
$query = $wpdb->prepare('SELECT * FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where . $limitstart, $prepareArgs);
|
1683 |
+
$images = $wpdb->get_results( $query );
|
1684 |
if ( !empty( $images ) ) {
|
1685 |
foreach ( $images as $image ) {
|
1686 |
if ( preg_match( '/EMBED/', $image->filetype ) == 1 ) {
|
2639 |
$img_width = $get_thumb_size["width"];
|
2640 |
$img_height = $get_thumb_size["height"];
|
2641 |
$scale = min( $max_width / $img_width, $max_height / $img_height );
|
2642 |
+
$new_width = $img_width * $scale;
|
2643 |
$new_height = $img_height * $scale;
|
2644 |
+
$resolution_thumb = WDWLibrary::format_number($new_width, 2) . 'x' . WDWLibrary::format_number($new_height, 2);
|
2645 |
}
|
2646 |
}
|
2647 |
return $resolution_thumb;
|
2759 |
case 'gif':
|
2760 |
case 'png':
|
2761 |
case 'svg':
|
2762 |
+
case 'webp':
|
2763 |
return TRUE;
|
2764 |
break;
|
2765 |
}
|
3391 |
}
|
3392 |
return 'order_asc';
|
3393 |
}
|
3394 |
+
/**
|
3395 |
+
* Escape array.
|
3396 |
+
*
|
3397 |
+
* @param array $args
|
3398 |
+
*
|
3399 |
+
* @return string
|
3400 |
+
*/
|
3401 |
+
public static function escape_array( $args = array() ) {
|
3402 |
+
global $wpdb;
|
3403 |
+
$escaped = array();
|
3404 |
+
foreach ( $args as $k => $v ) {
|
3405 |
+
if ( is_numeric($v) ) {
|
3406 |
+
$escaped[] = $wpdb->prepare('%d', $v);
|
3407 |
+
}
|
3408 |
+
else {
|
3409 |
+
$escaped[] = $wpdb->prepare('%s', $v);
|
3410 |
+
}
|
3411 |
+
}
|
3412 |
+
|
3413 |
+
return implode(',', $escaped);
|
3414 |
+
}
|
3415 |
+
|
3416 |
+
/**
|
3417 |
+
* Format number.
|
3418 |
+
*
|
3419 |
+
* @param $number
|
3420 |
+
* @param int $decimals
|
3421 |
+
* @param string $decPoint
|
3422 |
+
* @param string $thousandsSep
|
3423 |
+
*
|
3424 |
+
* @return string
|
3425 |
+
*/
|
3426 |
+
public static function format_number( $number, $decimals = 0, $decPoint = '.' , $thousandsSep = '' ) {
|
3427 |
+
$negation = ($number < 0) ? (-1) : 1;
|
3428 |
+
$coefficient = 10 ** $decimals;
|
3429 |
+
$number = $negation * floor((string)(abs($number) * $coefficient)) / $coefficient;
|
3430 |
+
|
3431 |
+
return number_format($number, $decimals, $decPoint, $thousandsSep);
|
3432 |
+
}
|
3433 |
}
|
3434 |
|
framework/WDWLibraryEmbed.php
CHANGED
@@ -139,7 +139,7 @@ class WDWLibraryEmbed {
|
|
139 |
*/
|
140 |
if ( !$host ) {
|
141 |
$parse = parse_url($url);
|
142 |
-
$host = ($parse['host'] == "www.instagram.com") ? 'INSTAGRAM' : FALSE;
|
143 |
}
|
144 |
|
145 |
/*return json_encode($host); for test*/
|
139 |
*/
|
140 |
if ( !$host ) {
|
141 |
$parse = parse_url($url);
|
142 |
+
$host = ( !empty($parse['host']) && $parse['host'] == "www.instagram.com") ? 'INSTAGRAM' : FALSE;
|
143 |
}
|
144 |
|
145 |
/*return json_encode($host); for test*/
|
frontend/controllers/controller.php
CHANGED
@@ -360,6 +360,12 @@ class BWGControllerSite {
|
|
360 |
$params['current_url'] = trim((is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
|
361 |
}
|
362 |
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
$params_array = array(
|
364 |
'action' => 'GalleryBox',
|
365 |
'current_view' => $bwg,
|
360 |
$params['current_url'] = trim((is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
|
361 |
}
|
362 |
|
363 |
+
$need_scroll = 0;
|
364 |
+
if( BWG()->options->front_ajax == "1" && (WDWLibrary::get('bwg_search_' . $bwg) != '' || WDWLibrary::get('filter_tag_' . $bwg) != "" || WDWLibrary::get("album_gallery_id_".$bwg) != "" || WDWLibrary::get("page_number_".$bwg)) != "" ) {
|
365 |
+
$need_scroll = 1;
|
366 |
+
}
|
367 |
+
$params['need_scroll'] = $need_scroll;
|
368 |
+
|
369 |
$params_array = array(
|
370 |
'action' => 'GalleryBox',
|
371 |
'current_view' => $bwg,
|
frontend/models/BWGModelGalleryBox.php
CHANGED
@@ -48,7 +48,6 @@ class BWGModelGalleryBox {
|
|
48 |
else {
|
49 |
$filter_tags = array_map('intval', explode(",", $bwg_filter_tag_temp));
|
50 |
}
|
51 |
-
|
52 |
$filter_search_name_temp = WDWLibrary::get('filter_search_name', '');
|
53 |
$filter_search_name = '';
|
54 |
if ( $filter_search_name_temp == '' ) { /* for thumbnail view */
|
@@ -110,8 +109,7 @@ class BWGModelGalleryBox {
|
|
110 |
} else {
|
111 |
$join .= ' LEFT JOIN (SELECT GROUP_CONCAT(tag_id order by tag_id SEPARATOR ",") AS tags_combined, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag GROUP BY image_id) AS tags ON image.id=tags.image_id';
|
112 |
}
|
113 |
-
$where .= ' AND CONCAT(",", tags.tags_combined, ",") REGEXP ",(
|
114 |
-
$prepareArgs[] = implode($compare_sign, $filter_tags);
|
115 |
}
|
116 |
|
117 |
$rate_join = '';
|
48 |
else {
|
49 |
$filter_tags = array_map('intval', explode(",", $bwg_filter_tag_temp));
|
50 |
}
|
|
|
51 |
$filter_search_name_temp = WDWLibrary::get('filter_search_name', '');
|
52 |
$filter_search_name = '';
|
53 |
if ( $filter_search_name_temp == '' ) { /* for thumbnail view */
|
109 |
} else {
|
110 |
$join .= ' LEFT JOIN (SELECT GROUP_CONCAT(tag_id order by tag_id SEPARATOR ",") AS tags_combined, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag GROUP BY image_id) AS tags ON image.id=tags.image_id';
|
111 |
}
|
112 |
+
$where .= ' AND CONCAT(",", tags.tags_combined, ",") REGEXP ",(' . implode($compare_sign, $filter_tags) . ')," ';
|
|
|
113 |
}
|
114 |
|
115 |
$rate_join = '';
|
frontend/views/BWGViewThumbnails.php
CHANGED
@@ -165,7 +165,7 @@ class BWGViewThumbnails extends BWGViewSite {
|
|
165 |
}
|
166 |
?>
|
167 |
#bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg-container-<?php echo $bwg; ?>.bwg-standard-thumbnails .bwg-item {
|
168 |
-
|
169 |
max-width: <?php echo $params['thumb_width']; ?>px;
|
170 |
<?php if ( !BWG()->options->resizable_thumbnails ) { ?>
|
171 |
width: <?php echo $params['thumb_width']; ?>px !important;
|
165 |
}
|
166 |
?>
|
167 |
#bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg-container-<?php echo $bwg; ?>.bwg-standard-thumbnails .bwg-item {
|
168 |
+
justify-content: <?php echo ($theme_row->thumb_title_pos == 'bottom' || (isset($params['show_thumb_description']) && $params['show_thumb_description'])) ? 'flex-start' : 'flex-end'; ?>;
|
169 |
max-width: <?php echo $params['thumb_width']; ?>px;
|
170 |
<?php if ( !BWG()->options->resizable_thumbnails ) { ?>
|
171 |
width: <?php echo $params['thumb_width']; ?>px !important;
|
frontend/views/view.php
CHANGED
@@ -92,6 +92,7 @@ class BWGViewSite {
|
|
92 |
class="bwg_container bwg_thumbnail bwg_<?php echo sanitize_html_class($params['gallery_type']); ?>"
|
93 |
data-right-click-protection="<?php echo esc_attr(BWG()->options->image_right_click); ?>"
|
94 |
data-bwg="<?php echo esc_attr($bwg); ?>"
|
|
|
95 |
data-gallery-type="<?php echo esc_attr($params['gallery_type']); ?>"
|
96 |
data-current-url="<?php echo esc_url(addslashes(urldecode($params_array['current_url']))); ?>"
|
97 |
data-lightbox-url="<?php echo esc_url(addslashes(add_query_arg($params_array, admin_url('admin-ajax.php')))); ?>"
|
92 |
class="bwg_container bwg_thumbnail bwg_<?php echo sanitize_html_class($params['gallery_type']); ?>"
|
93 |
data-right-click-protection="<?php echo esc_attr(BWG()->options->image_right_click); ?>"
|
94 |
data-bwg="<?php echo esc_attr($bwg); ?>"
|
95 |
+
data-scroll="<?php echo esc_attr($params['need_scroll']); ?>"
|
96 |
data-gallery-type="<?php echo esc_attr($params['gallery_type']); ?>"
|
97 |
data-current-url="<?php echo esc_url(addslashes(urldecode($params_array['current_url']))); ?>"
|
98 |
data-lightbox-url="<?php echo esc_url(addslashes(add_query_arg($params_array, admin_url('admin-ajax.php')))); ?>"
|
js/bwg.js
CHANGED
@@ -123,7 +123,7 @@ jQuery( function () {
|
|
123 |
form.attr( "action", action );
|
124 |
|
125 |
form.submit();
|
126 |
-
}
|
127 |
|
128 |
/* Options form. */
|
129 |
if ( jQuery( "form#bwg_options_form" ).length > 0 ) {
|
@@ -165,6 +165,8 @@ jQuery( function () {
|
|
165 |
} );
|
166 |
});
|
167 |
|
|
|
|
|
168 |
/* Change the popup dimensions. */
|
169 |
bwg_tb_window();
|
170 |
/* Hide loading */
|
@@ -231,7 +233,7 @@ jQuery( function () {
|
|
231 |
e.preventDefault();
|
232 |
return;
|
233 |
}
|
234 |
-
}
|
235 |
jQuery( '.search_in_options:visible' ).keyup( function ( e ) {
|
236 |
var w_key = e.key;
|
237 |
if ( ( typeof w_key == 'string' && w_key.length == 1 ) || !w_key || w_key == 'Backspace') {
|
@@ -418,10 +420,16 @@ function spider_ajax_save( form_id, tr_group, is_last_ajax, content_message_id )
|
|
418 |
post_data[ "image_current_id" ] = jQuery( "#image_current_id" ).val(); /* Current image id.*/
|
419 |
var ids_string = jQuery( "#ids_string" ).val(); /* Images ids separated by comma.*/
|
420 |
ids_string = ids_string.replace( /,\s*$/, "" );
|
|
|
421 |
post_data[ "image_bulk_action" ] = jQuery( "[name=image_bulk_action]" ).val(); /* Bulk action for images.*/
|
422 |
post_data[ "order_by" ] = jQuery( "select[name='order_by']" ).val(); /* Images sorting.*/
|
423 |
post_data[ "s" ] = jQuery( "input[name='s']" ).val(); /* Images filter.*/
|
424 |
-
|
|
|
|
|
|
|
|
|
|
|
425 |
post_data[ "bwg_nonce" ] = jQuery( "#bwg_nonce" ).val(); /* Nonce*/
|
426 |
post_data[ "image_pricelist_id" ] = jQuery( "#image_pricelist_id" ).val();
|
427 |
post_data[ "remove_pricelist" ] = jQuery( "#remove_pricelist" ).val();
|
@@ -436,8 +444,7 @@ function spider_ajax_save( form_id, tr_group, is_last_ajax, content_message_id )
|
|
436 |
|
437 |
/* Selected images count for message.*/
|
438 |
post_data[ "checked_items_count" ] = jQuery( "[name^=check]:not([id=check_all_items]):checked" ).length;
|
439 |
-
|
440 |
-
post_data[ "check_all_items" ] = jQuery( "[name=check_all_items]" ).is( ":checked" ) ? 1 : 0;
|
441 |
var limit = ( ajax_task == 'image_set_watermark'
|
442 |
|| ajax_task == 'image_reset'
|
443 |
|| ajax_task == 'image_recreate_thumbnail'
|
@@ -486,6 +493,7 @@ function spider_ajax_save( form_id, tr_group, is_last_ajax, content_message_id )
|
|
486 |
|
487 |
post_data[ "ajax_task" ] = ajax_task;
|
488 |
post_data[ "ids_string" ] = ids_string;
|
|
|
489 |
post_data[ "bwg_action_last_message" ] = content_message_id;
|
490 |
|
491 |
/* Images dimensions to resize. */
|
@@ -620,7 +628,8 @@ function spider_ajax_save( form_id, tr_group, is_last_ajax, content_message_id )
|
|
620 |
jQuery( "tbody" ).on( "click", ".toggle-row", function () {
|
621 |
jQuery( this ).closest( "tr" ).toggleClass( "is-expanded" );
|
622 |
} );
|
623 |
-
|
|
|
624 |
/* Change the popup dimensions. */
|
625 |
bwg_tb_window( "#images_table" );
|
626 |
|
@@ -765,7 +774,6 @@ function spider_check_all_items_checkbox( event ) {
|
|
765 |
.html( "<div class='notice notice-warning wd-notice'><p><strong>" + ( items_count == 1 ? bwg_objectL10B.selected_item : bwg_objectL10B.selected_items ).replace( "%d", items_count ) + "</strong></p></div>" )
|
766 |
.removeClass( "wd-hide" );
|
767 |
}
|
768 |
-
|
769 |
if ( !jQuery( "#check_all" ).is( ':checked' ) ) {
|
770 |
jQuery( '#check_all' ).trigger( 'click' );
|
771 |
}
|
@@ -780,11 +788,10 @@ function spider_check_all_items_checkbox( event ) {
|
|
780 |
|
781 |
function spider_check_all( current ) {
|
782 |
if ( !jQuery( current ).is( ':checked' ) ) {
|
783 |
-
jQuery( '
|
784 |
-
jQuery( ".ajax-msg" ).addClass( "wd-hide" );
|
785 |
}
|
|
|
786 |
}
|
787 |
-
|
788 |
/* Set uploader to button class. */
|
789 |
function spider_uploader( button_id, input_id, delete_id, img_id ) {
|
790 |
if ( typeof img_id == 'undefined' ) {
|
@@ -1446,6 +1453,8 @@ function bwg_change_gallery_type( type_to_set, warning_type, instagram_client_id
|
|
1446 |
|
1447 |
/*bulk embed handling*/
|
1448 |
function bwg_bulk_embed( from, key ) {
|
|
|
|
|
1449 |
switch ( from ) {
|
1450 |
case 'instagram': {
|
1451 |
bwg_add_instagram_gallery( key, true );
|
@@ -1612,7 +1621,9 @@ function bwg_get_embed_info( input_id ) {
|
|
1612 |
else {
|
1613 |
fileData = response_JSON;
|
1614 |
filesValid.push(fileData);
|
1615 |
-
bwg_add_image(filesValid);
|
|
|
|
|
1616 |
document.getElementById(input_id).value = '';
|
1617 |
jQuery('#loading_div').hide();
|
1618 |
return 'ok';
|
@@ -1642,6 +1653,8 @@ function bwg_change_fonts( cont, google_fonts ) {
|
|
1642 |
* @param multiple
|
1643 |
*/
|
1644 |
function spider_media_uploader( e, multiple ) {
|
|
|
|
|
1645 |
if ( typeof multiple == "undefined" ) {
|
1646 |
var multiple = false;
|
1647 |
}
|
@@ -1687,7 +1700,7 @@ function spider_media_uploader( e, multiple ) {
|
|
1687 |
result[i].description = attachment[i].description;
|
1688 |
result[i].description = bwg_media_name_clean(result[i].description);
|
1689 |
}
|
1690 |
-
bwg_add_image( result );
|
1691 |
}
|
1692 |
else {
|
1693 |
alert(bwg_objectL10B.import_failed);
|
@@ -1931,8 +1944,10 @@ var bwg_j = 'pr_' + j_int;
|
|
1931 |
* Add image to images list.
|
1932 |
*
|
1933 |
* @param files
|
|
|
1934 |
*/
|
1935 |
-
function bwg_add_image( files ) {
|
|
|
1936 |
var gallery_type = jQuery('#gallery_type option:selected').val();
|
1937 |
var ids_string = jQuery('#ids_string').val();
|
1938 |
var tr_first_id = '';
|
@@ -2040,17 +2055,27 @@ function bwg_add_image( files ) {
|
|
2040 |
description += ( ( files[ i ][ 'orientation' ] != 0 && files[ i ][ 'orientation' ] != '' ) ? 'Orientation: ' + files[ i ][ 'orientation' ] + '\n' : '' );
|
2041 |
}
|
2042 |
html = html.replace( /tempdescription/g, description );
|
2043 |
-
|
2044 |
if ( tr_first_id != '' ) {
|
2045 |
if ( is_embed ) {
|
2046 |
-
|
|
|
|
|
|
|
|
|
|
|
2047 |
}
|
2048 |
else {
|
2049 |
-
|
|
|
|
|
|
|
|
|
|
|
2050 |
}
|
2051 |
}
|
2052 |
else {
|
2053 |
-
jQuery('#tbody_arr').append(
|
2054 |
}
|
2055 |
jQuery('#tr_' + bwg_j ).html( html );
|
2056 |
|
@@ -2089,8 +2114,10 @@ function bwg_add_image( files ) {
|
|
2089 |
/* Set number column values after adding rows. */
|
2090 |
var i = 0;
|
2091 |
jQuery( "#tbody_arr .col_num" ).each( function () {
|
2092 |
-
jQuery( this ).
|
2093 |
-
|
|
|
|
|
2094 |
window.parent.jQuery( ".no-items" ).remove();
|
2095 |
jQuery( ".unsaved-msg", window.parent.document ).removeClass( "wd-hide" );
|
2096 |
jQuery( ".ajax-msg", window.parent.document ).addClass( "wd-hide" );
|
@@ -2970,7 +2997,6 @@ jQuery(document).mouseup(function(e){
|
|
2970 |
}
|
2971 |
});
|
2972 |
|
2973 |
-
|
2974 |
function applyGoogleFont(that, font) {
|
2975 |
// Replace + signs with spaces for css
|
2976 |
font = font.replace(/\+/g, ' ');
|
@@ -2987,3 +3013,41 @@ function applyGoogleFont(that, font) {
|
|
2987 |
fontWeight = +fontSpecs;
|
2988 |
that.val(fontFamily);
|
2989 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
form.attr( "action", action );
|
124 |
|
125 |
form.submit();
|
126 |
+
});
|
127 |
|
128 |
/* Options form. */
|
129 |
if ( jQuery( "form#bwg_options_form" ).length > 0 ) {
|
165 |
} );
|
166 |
});
|
167 |
|
168 |
+
/* Move the 'tr_tempid' element to the beginning of the table */
|
169 |
+
jQuery('#tr_tempid').prependTo('#images_table #tbody_arr');
|
170 |
/* Change the popup dimensions. */
|
171 |
bwg_tb_window();
|
172 |
/* Hide loading */
|
233 |
e.preventDefault();
|
234 |
return;
|
235 |
}
|
236 |
+
});
|
237 |
jQuery( '.search_in_options:visible' ).keyup( function ( e ) {
|
238 |
var w_key = e.key;
|
239 |
if ( ( typeof w_key == 'string' && w_key.length == 1 ) || !w_key || w_key == 'Backspace') {
|
420 |
post_data[ "image_current_id" ] = jQuery( "#image_current_id" ).val(); /* Current image id.*/
|
421 |
var ids_string = jQuery( "#ids_string" ).val(); /* Images ids separated by comma.*/
|
422 |
ids_string = ids_string.replace( /,\s*$/, "" );
|
423 |
+
post_data[ "check_all_items" ] = jQuery( "[name=check_all_items]" ).is( ":checked" ) ? 1 : 0; /* Select all.*/
|
424 |
post_data[ "image_bulk_action" ] = jQuery( "[name=image_bulk_action]" ).val(); /* Bulk action for images.*/
|
425 |
post_data[ "order_by" ] = jQuery( "select[name='order_by']" ).val(); /* Images sorting.*/
|
426 |
post_data[ "s" ] = jQuery( "input[name='s']" ).val(); /* Images filter.*/
|
427 |
+
var paged = jQuery( "#paged" ).val(); /* Images page number.*/
|
428 |
+
// In case of "Select All" removal, when there is an exception, you need to reset "page".
|
429 |
+
if ( post_data["check_all_items"] && post_data["image_bulk_action"] == "image_delete" ) {
|
430 |
+
paged = 1;
|
431 |
+
}
|
432 |
+
post_data[ "paged" ] = paged;
|
433 |
post_data[ "bwg_nonce" ] = jQuery( "#bwg_nonce" ).val(); /* Nonce*/
|
434 |
post_data[ "image_pricelist_id" ] = jQuery( "#image_pricelist_id" ).val();
|
435 |
post_data[ "remove_pricelist" ] = jQuery( "#remove_pricelist" ).val();
|
444 |
|
445 |
/* Selected images count for message.*/
|
446 |
post_data[ "checked_items_count" ] = jQuery( "[name^=check]:not([id=check_all_items]):checked" ).length;
|
447 |
+
|
|
|
448 |
var limit = ( ajax_task == 'image_set_watermark'
|
449 |
|| ajax_task == 'image_reset'
|
450 |
|| ajax_task == 'image_recreate_thumbnail'
|
493 |
|
494 |
post_data[ "ajax_task" ] = ajax_task;
|
495 |
post_data[ "ids_string" ] = ids_string;
|
496 |
+
post_data[ "ids_exclude" ] = jQuery( "#ids_exclude" ).val(); /* Exclude ids.*/
|
497 |
post_data[ "bwg_action_last_message" ] = content_message_id;
|
498 |
|
499 |
/* Images dimensions to resize. */
|
628 |
jQuery( "tbody" ).on( "click", ".toggle-row", function () {
|
629 |
jQuery( this ).closest( "tr" ).toggleClass( "is-expanded" );
|
630 |
} );
|
631 |
+
/* Move the 'tr_tempid' element to the beginning of the table */
|
632 |
+
jQuery('#tr_tempid').prependTo('#images_table #tbody_arr');
|
633 |
/* Change the popup dimensions. */
|
634 |
bwg_tb_window( "#images_table" );
|
635 |
|
774 |
.html( "<div class='notice notice-warning wd-notice'><p><strong>" + ( items_count == 1 ? bwg_objectL10B.selected_item : bwg_objectL10B.selected_items ).replace( "%d", items_count ) + "</strong></p></div>" )
|
775 |
.removeClass( "wd-hide" );
|
776 |
}
|
|
|
777 |
if ( !jQuery( "#check_all" ).is( ':checked' ) ) {
|
778 |
jQuery( '#check_all' ).trigger( 'click' );
|
779 |
}
|
788 |
|
789 |
function spider_check_all( current ) {
|
790 |
if ( !jQuery( current ).is( ':checked' ) ) {
|
791 |
+
jQuery( '.ajax-msg' ).addClass( 'wd-hide' );
|
|
|
792 |
}
|
793 |
+
bwg_set_excludeids_input_value(current);
|
794 |
}
|
|
|
795 |
/* Set uploader to button class. */
|
796 |
function spider_uploader( button_id, input_id, delete_id, img_id ) {
|
797 |
if ( typeof img_id == 'undefined' ) {
|
1453 |
|
1454 |
/*bulk embed handling*/
|
1455 |
function bwg_bulk_embed( from, key ) {
|
1456 |
+
/* Move the 'tr_tempid' element to the beginning of the table */
|
1457 |
+
jQuery('#tr_tempid').prependTo('#images_table #tbody_arr');
|
1458 |
switch ( from ) {
|
1459 |
case 'instagram': {
|
1460 |
bwg_add_instagram_gallery( key, true );
|
1621 |
else {
|
1622 |
fileData = response_JSON;
|
1623 |
filesValid.push(fileData);
|
1624 |
+
bwg_add_image(filesValid, 'bulk-actions');
|
1625 |
+
/* Move the 'tr_tempid' element to the beginning of the table */
|
1626 |
+
jQuery('#tr_tempid').prependTo('#images_table #tbody_arr');
|
1627 |
document.getElementById(input_id).value = '';
|
1628 |
jQuery('#loading_div').hide();
|
1629 |
return 'ok';
|
1653 |
* @param multiple
|
1654 |
*/
|
1655 |
function spider_media_uploader( e, multiple ) {
|
1656 |
+
/* Move the 'tr_tempid' element to the beginning of the table */
|
1657 |
+
jQuery('#tr_tempid').prependTo('#images_table #tbody_arr');
|
1658 |
if ( typeof multiple == "undefined" ) {
|
1659 |
var multiple = false;
|
1660 |
}
|
1700 |
result[i].description = attachment[i].description;
|
1701 |
result[i].description = bwg_media_name_clean(result[i].description);
|
1702 |
}
|
1703 |
+
bwg_add_image( result, 'media-library' );
|
1704 |
}
|
1705 |
else {
|
1706 |
alert(bwg_objectL10B.import_failed);
|
1944 |
* Add image to images list.
|
1945 |
*
|
1946 |
* @param files
|
1947 |
+
* @param add_type
|
1948 |
*/
|
1949 |
+
function bwg_add_image( files, add_type ) {
|
1950 |
+
var add_type = (typeof add_type != "undefined" ) ? add_type : 'default';
|
1951 |
var gallery_type = jQuery('#gallery_type option:selected').val();
|
1952 |
var ids_string = jQuery('#ids_string').val();
|
1953 |
var tr_first_id = '';
|
2055 |
description += ( ( files[ i ][ 'orientation' ] != 0 && files[ i ][ 'orientation' ] != '' ) ? 'Orientation: ' + files[ i ][ 'orientation' ] + '\n' : '' );
|
2056 |
}
|
2057 |
html = html.replace( /tempdescription/g, description );
|
2058 |
+
/* The sequence of creating new elements. */
|
2059 |
if ( tr_first_id != '' ) {
|
2060 |
if ( is_embed ) {
|
2061 |
+
if ( add_type == 'instagram' ) {
|
2062 |
+
jQuery("<tr id='tr_" + bwg_j + "'>").insertBefore("#tbody_arr #tr_tempid");
|
2063 |
+
}
|
2064 |
+
else if ( add_type == 'bulk-actions' ) {
|
2065 |
+
jQuery("#tbody_arr").prepend("<tr id='tr_" + bwg_j + "'>");
|
2066 |
+
}
|
2067 |
}
|
2068 |
else {
|
2069 |
+
if ( add_type == 'media-library' ) {
|
2070 |
+
jQuery("<tr id='tr_" + bwg_j + "'>").insertAfter("#tbody_arr #tr_tempid");
|
2071 |
+
}
|
2072 |
+
else {
|
2073 |
+
jQuery("<tr id='tr_" + bwg_j + "'>").insertBefore('#' + tr_first_id);
|
2074 |
+
}
|
2075 |
}
|
2076 |
}
|
2077 |
else {
|
2078 |
+
jQuery('#tbody_arr').append("<tr id='tr_" + bwg_j + "'>");
|
2079 |
}
|
2080 |
jQuery('#tr_' + bwg_j ).html( html );
|
2081 |
|
2114 |
/* Set number column values after adding rows. */
|
2115 |
var i = 0;
|
2116 |
jQuery( "#tbody_arr .col_num" ).each( function () {
|
2117 |
+
if ( ! jQuery( this ).parents('tr').hasClass('wd-template') ) {
|
2118 |
+
jQuery(this).html(++i);
|
2119 |
+
}
|
2120 |
+
});
|
2121 |
window.parent.jQuery( ".no-items" ).remove();
|
2122 |
jQuery( ".unsaved-msg", window.parent.document ).removeClass( "wd-hide" );
|
2123 |
jQuery( ".ajax-msg", window.parent.document ).addClass( "wd-hide" );
|
2997 |
}
|
2998 |
});
|
2999 |
|
|
|
3000 |
function applyGoogleFont(that, font) {
|
3001 |
// Replace + signs with spaces for css
|
3002 |
font = font.replace(/\+/g, ' ');
|
3013 |
fontWeight = +fontSpecs;
|
3014 |
that.val(fontFamily);
|
3015 |
}
|
3016 |
+
|
3017 |
+
function bwg_get_exclude_check_ids( that ) {
|
3018 |
+
var excludeIds = '';
|
3019 |
+
var excludeIdArr = new Array();
|
3020 |
+
if ( jQuery('#check_all_items').is(':checked') && jQuery('#check_all').is(':checked') && that == '#check_all' ) {
|
3021 |
+
excludeIds = '';
|
3022 |
+
}
|
3023 |
+
else if ( jQuery('#check_all_items').is(':checked') && !jQuery('#check_all').is(':checked') && that == '#check_all' ) {
|
3024 |
+
jQuery('.images_table .bwg-ordering .check-column input[type="checkbox"]:checked').each(function () {
|
3025 |
+
if ( jQuery(this).attr('id') != 'check_tempid' ) {
|
3026 |
+
var excludeId = jQuery(this).attr('id');
|
3027 |
+
if ( excludeId ) {
|
3028 |
+
excludeIdArr.push(excludeId);
|
3029 |
+
}
|
3030 |
+
}
|
3031 |
+
});
|
3032 |
+
}
|
3033 |
+
else if ( jQuery('#check_all_items').is(':checked') && that != '#check_all' ) {
|
3034 |
+
jQuery('.images_table .bwg-ordering .check-column input[type="checkbox"]:not(:checked)').each(function () {
|
3035 |
+
if ( jQuery(this).attr('id') != 'check_tempid' ) {
|
3036 |
+
var excludeId = jQuery(this).attr('id');
|
3037 |
+
if ( excludeId ) {
|
3038 |
+
excludeIdArr.push(excludeId);
|
3039 |
+
}
|
3040 |
+
}
|
3041 |
+
});
|
3042 |
+
}
|
3043 |
+
if ( excludeIdArr.length > 0 ) {
|
3044 |
+
excludeIds = excludeIdArr.join(',').replaceAll('check_', '')
|
3045 |
+
}
|
3046 |
+
|
3047 |
+
return excludeIds;
|
3048 |
+
}
|
3049 |
+
|
3050 |
+
function bwg_set_excludeids_input_value( that ) {
|
3051 |
+
var exclude_ids = bwg_get_exclude_check_ids(that);
|
3052 |
+
jQuery( '#ids_exclude' ).val(exclude_ids);
|
3053 |
+
}
|
js/bwg_embed.js
CHANGED
@@ -358,7 +358,7 @@ function bwg_add_instagram_gallery(instagram_access_token, from_popup){
|
|
358 |
filesValid.push(item);
|
359 |
}
|
360 |
}
|
361 |
-
bwg_add_image(filesValid);
|
362 |
if ( !from_popup ) {
|
363 |
bwg_gallery_update_flag();
|
364 |
jQuery('#tr_instagram_gallery_add_button').hide();
|
358 |
filesValid.push(item);
|
359 |
}
|
360 |
}
|
361 |
+
bwg_add_image( filesValid, 'instagram' );
|
362 |
if ( !from_popup ) {
|
363 |
bwg_gallery_update_flag();
|
364 |
jQuery('#tr_instagram_gallery_add_button').hide();
|
js/bwg_frontend.js
CHANGED
@@ -94,6 +94,10 @@ function bwg_remove_lazy_loader_icon() {
|
|
94 |
*/
|
95 |
function bwg_main_ready(container) {
|
96 |
var bwg = container.data('bwg');
|
|
|
|
|
|
|
|
|
97 |
|
98 |
bwg_remove_lazy_loader_icon();
|
99 |
|
@@ -844,14 +848,16 @@ function bwg_slideshow_ready( bwg ) {
|
|
844 |
jQuery(".bwg_slideshow_image_" + bwg).removeAttr("width");
|
845 |
jQuery(".bwg_slideshow_image_" + bwg).removeAttr("height");
|
846 |
/* Uses Instagram oEmbed data to create iframe tag. */
|
|
|
847 |
if ( typeof instgrm !== 'undefined' && typeof instgrm.Embeds !== 'undefined' ) {
|
848 |
-
var instagram_embed = jQuery('
|
849 |
-
var embed_max_height =
|
850 |
-
instagram_embed.
|
851 |
instgrm.Embeds.process();
|
852 |
-
|
853 |
'max-height': embed_max_height + 'px',
|
854 |
-
})
|
|
|
855 |
}
|
856 |
}
|
857 |
}
|
@@ -1245,10 +1251,8 @@ function bwg_thumbnail_mosaic_logic( container ) {
|
|
1245 |
thumb_w = mosaic_pics.get(index).naturalWidth;
|
1246 |
thumb_h = mosaic_pics.get(index).naturalHeight;
|
1247 |
}
|
1248 |
-
|
1249 |
thumb_w = thumb_w * thumbnail_height / thumb_h;
|
1250 |
-
mosaic_pics.eq(index).height
|
1251 |
-
mosaic_pics.eq(index).width(thumb_w);
|
1252 |
});
|
1253 |
/* resize */
|
1254 |
var divwidth = jQuery("#bwg_mosaic_thumbnails_div_" + bwg).width() / 100 * parseInt(container.attr('data-total-width'));
|
@@ -1343,8 +1347,9 @@ function bwg_thumbnail_mosaic_logic( container ) {
|
|
1343 |
mosaic_pics.each(function (index) {
|
1344 |
var thumb_w = mosaic_pics.eq(index).width();
|
1345 |
var thumb_h = mosaic_pics.eq(index).height();
|
1346 |
-
|
1347 |
-
|
|
|
1348 |
mosaic_pics.eq(index).parent().css({
|
1349 |
top: row_top[row_of_img[index]],
|
1350 |
left: img_left[row_of_img[index]]
|
@@ -1386,8 +1391,7 @@ function bwg_thumbnail_mosaic_logic( container ) {
|
|
1386 |
thumb_w = mosaic_pics.get(index).naturalWidth;
|
1387 |
thumb_h = mosaic_pics.get(index).naturalHeight;
|
1388 |
}
|
1389 |
-
mosaic_pics.eq(index).height(thumb_h * thumbnail_width / thumb_w);
|
1390 |
-
mosaic_pics.eq(index).width(thumbnail_width);
|
1391 |
});
|
1392 |
/* Resize.*/
|
1393 |
var divwidth = jQuery("#bwg_mosaic_thumbnails_div_" + bwg).width() / 100 * parseInt(container.attr('data-total-width'));
|
@@ -1475,8 +1479,9 @@ function bwg_thumbnail_mosaic_logic( container ) {
|
|
1475 |
mosaic_pics.each(function (index) {
|
1476 |
var thumb_w = mosaic_pics.eq(index).width();
|
1477 |
var thumb_h = mosaic_pics.eq(index).height();
|
1478 |
-
|
1479 |
-
|
|
|
1480 |
mosaic_pics.eq(index).parent().css({
|
1481 |
top: img_container_top[col_of_img[index]],
|
1482 |
left: img_container_left[col_of_img[index]]
|
@@ -2149,7 +2154,6 @@ function bwg_ajax(form_id, current_view, id, album_gallery_id, cur_album_id, typ
|
|
2149 |
}
|
2150 |
});
|
2151 |
});
|
2152 |
-
|
2153 |
if ( jQuery(".pagination-links_" + current_view).length ) {
|
2154 |
jQuery("html, body").animate({scrollTop: jQuery('#' + form_id).offset().top - 150}, 500);
|
2155 |
}
|
@@ -2745,7 +2749,6 @@ function bwg_change_watermark_container( bwg ) {
|
|
2745 |
|
2746 |
/* Set each watermark container size.*/
|
2747 |
function bwg_change_each_watermark_container(width, height, bwg) {
|
2748 |
-
|
2749 |
var defix = ( typeof bwg !== 'undefined' && bwg !== '' ) ? '_'+bwg : '';
|
2750 |
var source = ( typeof bwg !== 'undefined' && bwg !== '' ) ? '_slideshow' : '';
|
2751 |
|
@@ -2830,8 +2833,7 @@ function bwg_set_filmstrip_pos( filmStripWidth, bwg, data ) {
|
|
2830 |
jQuery(".bwg"+source+"_filmstrip_thumbnails" + defix).animate({
|
2831 |
left: imagesContainerLeft + right_left_space
|
2832 |
}, {
|
2833 |
-
duration: 500
|
2834 |
-
complete: function () { bwg_filmstrip_arrows( bwg ); }
|
2835 |
});
|
2836 |
}
|
2837 |
else {
|
@@ -2839,36 +2841,11 @@ function bwg_set_filmstrip_pos( filmStripWidth, bwg, data ) {
|
|
2839 |
top: imagesContainerLeft + top_bottom_space
|
2840 |
},
|
2841 |
{
|
2842 |
-
duration: 500
|
2843 |
-
complete: function () { bwg_filmstrip_arrows( bwg ); }
|
2844 |
});
|
2845 |
}
|
2846 |
}
|
2847 |
|
2848 |
-
/* Show/hide filmstrip arrows.*/
|
2849 |
-
function bwg_filmstrip_arrows( bwg ) {
|
2850 |
-
var source = (typeof bwg !== 'undefined' && bwg !== '') ? '_slideshow' : '';
|
2851 |
-
var filmstrip_thumbnails_type = ( typeof bwg_params[bwg] != 'undefined' && bwg_params[bwg]['slideshow_filmstrip_type'] == 2 ) ? '_filmstrip_fix_count' : '_filmstrip';
|
2852 |
-
var defix = (typeof bwg !== 'undefined' && bwg !== '') ? '_' + bwg : '';
|
2853 |
-
var width_or_height = (typeof bwg !== 'undefined' && bwg !== '' ) ? bwg_params[bwg]['width_or_heigh'] : gallery_box_data['width_or_height'];
|
2854 |
-
if ( width_or_height == 'width' ) {
|
2855 |
-
var condition1 = jQuery(".bwg" + source + "_filmstrip_thumbnails" + defix).width();
|
2856 |
-
var condition2 = jQuery(".bwg" + source + "" + filmstrip_thumbnails_type + "" + defix).width();
|
2857 |
-
}
|
2858 |
-
else {
|
2859 |
-
var condition1 = jQuery(".bwg" + source + "_filmstrip_thumbnails" + defix).height();
|
2860 |
-
var condition2 = jQuery(".bwg" + source + "" + filmstrip_thumbnails_type + "" + defix).height();
|
2861 |
-
}
|
2862 |
-
if ( condition1 < condition2 ) {
|
2863 |
-
jQuery(".bwg" + source + "_filmstrip_left" + defix).hide();
|
2864 |
-
jQuery(".bwg" + source + "_filmstrip_right" + defix).hide();
|
2865 |
-
}
|
2866 |
-
else {
|
2867 |
-
jQuery(".bwg" + source + "_filmstrip_left" + defix).hide();
|
2868 |
-
jQuery(".bwg" + source + "_filmstrip_right" + defix).show();
|
2869 |
-
}
|
2870 |
-
}
|
2871 |
-
|
2872 |
/**
|
2873 |
* Slideshow filmstrip fix dimension.
|
2874 |
*
|
@@ -2922,15 +2899,13 @@ function bwg_slideshow_filmstrip_fix_dimension( bwg ) {
|
|
2922 |
jQuery(".bwg" + source + "_filmstrip_thumbnails" + defix).animate({
|
2923 |
left: -image_left
|
2924 |
}, {
|
2925 |
-
duration: 500
|
2926 |
-
complete: function () { bwg_filmstrip_arrows( bwg ); }
|
2927 |
});
|
2928 |
} else {
|
2929 |
jQuery(".bwg" + source + "_filmstrip_thumbnails" + defix).animate({
|
2930 |
top: -image_left
|
2931 |
}, {
|
2932 |
-
duration: 500
|
2933 |
-
complete: function () { bwg_filmstrip_arrows( bwg ); }
|
2934 |
});
|
2935 |
}
|
2936 |
}
|
@@ -2939,19 +2914,13 @@ function bwg_slideshow_filmstrip_fix_dimension( bwg ) {
|
|
2939 |
jQuery(".bwg" + source + "_filmstrip_thumbnails" + defix).animate({
|
2940 |
left: -(image_right - bwg_filmstrip_width)
|
2941 |
}, {
|
2942 |
-
duration: 500
|
2943 |
-
complete: function () {
|
2944 |
-
bwg_filmstrip_arrows(bwg);
|
2945 |
-
}
|
2946 |
});
|
2947 |
} else {
|
2948 |
jQuery(".bwg" + source + "_filmstrip_thumbnails" + defix).animate({
|
2949 |
top: -(image_right - bwg_filmstrip_width)
|
2950 |
}, {
|
2951 |
-
duration: 500
|
2952 |
-
complete: function () {
|
2953 |
-
bwg_filmstrip_arrows(bwg);
|
2954 |
-
}
|
2955 |
});
|
2956 |
}
|
2957 |
}
|
@@ -3012,10 +2981,7 @@ function bwg_slideshow_filmstrip_fix_count( bwg ) {
|
|
3012 |
left: -image_left
|
3013 |
},
|
3014 |
{
|
3015 |
-
duration: 500
|
3016 |
-
complete: function () {
|
3017 |
-
bwg_filmstrip_arrows(bwg);
|
3018 |
-
}
|
3019 |
});
|
3020 |
}
|
3021 |
else {
|
@@ -3023,10 +2989,7 @@ function bwg_slideshow_filmstrip_fix_count( bwg ) {
|
|
3023 |
top: -image_left
|
3024 |
},
|
3025 |
{
|
3026 |
-
duration: 500
|
3027 |
-
complete: function () {
|
3028 |
-
bwg_filmstrip_arrows(bwg);
|
3029 |
-
}
|
3030 |
});
|
3031 |
}
|
3032 |
}
|
@@ -3036,10 +2999,7 @@ function bwg_slideshow_filmstrip_fix_count( bwg ) {
|
|
3036 |
left: -(image_right - bwg_filmstrip_width)
|
3037 |
},
|
3038 |
{
|
3039 |
-
duration: 500
|
3040 |
-
complete: function () {
|
3041 |
-
bwg_filmstrip_arrows(bwg);
|
3042 |
-
}
|
3043 |
});
|
3044 |
}
|
3045 |
else {
|
@@ -3047,10 +3007,7 @@ function bwg_slideshow_filmstrip_fix_count( bwg ) {
|
|
3047 |
top: -(image_right - bwg_filmstrip_width)
|
3048 |
},
|
3049 |
{
|
3050 |
-
duration: 500
|
3051 |
-
complete: function () {
|
3052 |
-
bwg_filmstrip_arrows(bwg);
|
3053 |
-
}
|
3054 |
});
|
3055 |
}
|
3056 |
}
|
@@ -3083,12 +3040,6 @@ function bwg_resize_slideshow_filmstrip_fix_count( args ) {
|
|
3083 |
var filmstrip_position = jQuery(slideshow_image_container).data('filmstrip-position');
|
3084 |
var filmstrip_size = jQuery(slideshow_image_container).data('filmstrip-size');
|
3085 |
var filmstrip_rl_btn_size = params['slideshow_filmstrip_rl_btn_size'];
|
3086 |
-
|
3087 |
-
//var filmstrip_thumbnail_left = jQuery(filmstrip_thumbnails).position().left;
|
3088 |
-
//var filmstrip_thumbnail_count = jQuery(filmstrip_thumbnail).length;
|
3089 |
-
//var old_filmstrip_fix_count_width = jQuery(filmstrip_fix_count).height();
|
3090 |
-
//var old_filmstrip_thumbnail_width = jQuery(filmstrip_thumbnail).height();
|
3091 |
-
|
3092 |
jQuery('#bwg_container1_' + bwg).css({ width: '100%' });
|
3093 |
jQuery('#bwg_container1_' + bwg + ' #bwg_container2_' + bwg).css({
|
3094 |
width: parent_width
|
@@ -3101,24 +3052,6 @@ function bwg_resize_slideshow_filmstrip_fix_count( args ) {
|
|
3101 |
}
|
3102 |
var resize_timer = setTimeout(function(){
|
3103 |
resize_in_progress = false;
|
3104 |
-
// @Todo This part is another calculation. Maintains the position of the filmstrip according to the number of next / prev performed.
|
3105 |
-
//var new_filmstrip_fix_count_width = jQuery(filmstrip_fix_count).width();
|
3106 |
-
//var new_filmstrip_thumbnail_width = jQuery(filmstrip_thumbnail).width();
|
3107 |
-
//var difference_filmstrip_fix_count_width = (old_filmstrip_fix_count_width - new_filmstrip_fix_count_width);
|
3108 |
-
//var difference_filmstrip_thumbnail = ((old_filmstrip_thumbnail_width - new_filmstrip_thumbnail_width) * filmstrip_thumbnail_count);
|
3109 |
-
//var left_position = 0;
|
3110 |
-
//if(jQuery('.bwg_slideshow_filmstrip_right_' + bwg + ':hidden').length) {
|
3111 |
-
// left_position = jQuery(filmstrip_thumbnails).position().left + (difference_filmstrip_thumbnail - difference_filmstrip_fix_count_width);
|
3112 |
-
//}
|
3113 |
-
//if ( filmstrip_thumbnail_left < 0 ) {
|
3114 |
-
// left_position = -parseFloat( (new_filmstrip_thumbnail_width + filmstrip_thumb_margin_hor) * bwg_slideshow_filmstrip_thumb[filmstrip_thumbnail_key]['next_prev_index'] );
|
3115 |
-
//}
|
3116 |
-
//jQuery(filmstrip_thumbnails).css({
|
3117 |
-
// left: left_position
|
3118 |
-
//});
|
3119 |
-
//
|
3120 |
-
//window.old_filmstrip_fix_count_width = new_filmstrip_fix_count_width;
|
3121 |
-
//window.old_filmstrip_thumbnail_width = new_filmstrip_thumbnail_width;
|
3122 |
var filmstrip_thumbnails_css = {};
|
3123 |
if ( filmstrip_position == 'bottom' || filmstrip_position == 'top' ) {
|
3124 |
filmstrip_thumbnails_css.left = 0;
|
@@ -3211,6 +3144,12 @@ function bwg_resize_slideshow_filmstrip_fix_count( args ) {
|
|
3211 |
jQuery(".bwg_slideshow_embed_" + bwg).css({
|
3212 |
cssText: "width:" + parent_width + "px !important; height:" + ( (parent_width * (params['image_height'] / params['image_width']) ) - slideshow_filmstrip_height) + "px !important;"
|
3213 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
3214 |
if ( filmstrip_rl_btn_size > slideshow_filmstrip_height ) {
|
3215 |
filmstrip_rl_btn_size = slideshow_filmstrip_height;
|
3216 |
}
|
@@ -3292,6 +3231,14 @@ function bwg_resize_slideshow_filmstrip_fix_count( args ) {
|
|
3292 |
jQuery(".bwg_slideshow_embed_" + bwg).css({
|
3293 |
cssText: "width:" + (parent_width - slideshow_filmstrip_width) + "px !important; height:" + parent_height + "px !important;"
|
3294 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3295 |
if ( filmstrip_rl_btn_size > slideshow_filmstrip_width ) {
|
3296 |
filmstrip_rl_btn_size = slideshow_filmstrip_width;
|
3297 |
}
|
@@ -3317,16 +3264,37 @@ function bwg_resize_slideshow_filmstrip_fix_dimension( args ) {
|
|
3317 |
var parent_width = args['parent_width'];
|
3318 |
var params = args['params'];
|
3319 |
var filmstrip_direction = params['filmstrip_direction'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3320 |
|
3321 |
-
|
3322 |
-
|
3323 |
-
|
3324 |
-
|
3325 |
-
|
3326 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3327 |
});
|
3328 |
-
jQuery(
|
3329 |
-
cssText: "width: " + (
|
3330 |
});
|
3331 |
|
3332 |
bwg_resize_instagram_post(bwg);
|
@@ -3334,12 +3302,12 @@ function bwg_resize_slideshow_filmstrip_fix_dimension( args ) {
|
|
3334 |
bwg_change_watermark_container(bwg);
|
3335 |
|
3336 |
if ( filmstrip_direction == 'horizontal' ) {
|
3337 |
-
jQuery(
|
3338 |
-
jQuery(
|
3339 |
}
|
3340 |
else {
|
3341 |
-
jQuery(
|
3342 |
-
jQuery(
|
3343 |
}
|
3344 |
}
|
3345 |
|
@@ -3389,16 +3357,14 @@ function bwg_move_dots( bwg ) {
|
|
3389 |
jQuery(".bwg_slideshow_dots_thumbnails_" + bwg).animate({
|
3390 |
left: -image_left
|
3391 |
}, {
|
3392 |
-
duration: 500
|
3393 |
-
complete: function () { }
|
3394 |
});
|
3395 |
}
|
3396 |
else if (image_right > long_filmstrip_cont_right) {
|
3397 |
jQuery(".bwg_slideshow_dots_thumbnails_" + bwg).animate({
|
3398 |
left: -(image_right - bwg_dots_width)
|
3399 |
}, {
|
3400 |
-
duration: 500
|
3401 |
-
complete: function () { }
|
3402 |
});
|
3403 |
}
|
3404 |
}
|
@@ -3576,7 +3542,7 @@ function bwg_change_image_slideshow(current_key, key, data, from_effect, bwg) {
|
|
3576 |
'data-height': maxHeight,
|
3577 |
'data-instagram-width': srcWidth,
|
3578 |
'data-instagram-height': srcHeight,
|
3579 |
-
style: 'width:
|
3580 |
});
|
3581 |
}
|
3582 |
else {
|
@@ -3617,7 +3583,7 @@ function bwg_change_image_slideshow(current_key, key, data, from_effect, bwg) {
|
|
3617 |
}
|
3618 |
}
|
3619 |
bwg_add_lightbox();
|
3620 |
-
if ( data[key].filetype == 'EMBED_OEMBED_INSTAGRAM_POST' ) {
|
3621 |
/* Uses Instagram oEmbed data to create iframe tag. */
|
3622 |
if ( typeof instgrm !== 'undefined' && typeof instgrm.Embeds !== 'undefined' ) {
|
3623 |
jQuery('.instagram-media').hide();
|
@@ -3669,19 +3635,13 @@ function bwg_preload_images( key, bwg ) {
|
|
3669 |
}
|
3670 |
|
3671 |
function bwg_popup_resize_slidshow( bwg ) {
|
3672 |
-
var bwg_container1_class_name = '#bwg_container1_' + bwg;
|
3673 |
-
var bwg_container2_class_name = bwg_container1_class_name + ' #bwg_container2_' + bwg;
|
3674 |
-
var bwg_slideshow_image_wrap_class_name = bwg_container2_class_name + ' .bwg_slideshow_image_wrap_' + bwg;
|
3675 |
-
var bwg_slideshow_image_container_class_name = bwg_container2_class_name + ' .bwg_slideshow_image_container_' + bwg;
|
3676 |
-
var bwg_slideshow_image_class_name = bwg_container2_class_name + ' .bwg_slideshow_image_' + bwg;
|
3677 |
-
|
3678 |
var slideshow_filmstrip_class_name = ".bwg_slideshow_filmstrip_" + bwg;
|
3679 |
-
|
3680 |
if ( bwg_params[bwg]['slideshow_filmstrip_type'] == 2 ) {
|
3681 |
slideshow_filmstrip_class_name = ".bwg_slideshow_filmstrip_fix_count_" + bwg;
|
3682 |
}
|
3683 |
var parentt = jQuery("#bwg_container1_" + bwg).parent();
|
3684 |
-
|
3685 |
if ( parentt.hasClass('content-area') ) {
|
3686 |
parentt.width(parentt.closest('.content-area').width());
|
3687 |
}
|
@@ -3728,14 +3688,13 @@ function bwg_popup_resize_slidshow( bwg ) {
|
|
3728 |
if ( bwg_params[bwg]['slideshow_filmstrip_type'] == 2 ) {
|
3729 |
var filmstrip_direction = bwg_params[bwg]['filmstrip_direction'];
|
3730 |
var bwg_container2 = '#bwg_container1_' + bwg + ' #bwg_container2_' + bwg;
|
3731 |
-
jQuery(bwg_container2
|
3732 |
var slideshow_filmstrip_container = bwg_container2 + ' .bwg_slideshow_filmstrip_container_' + bwg;
|
3733 |
var filmstrip_rl_btn_size = bwg_params[bwg].slideshow_filmstrip_rl_btn_size;
|
3734 |
var slideshow_filmstrip_size = jQuery('.bwg_slideshow_filmstrip_fix_count_' + bwg).width();
|
3735 |
if ( filmstrip_direction == 'horizontal' ) {
|
3736 |
slideshow_filmstrip_size = jQuery('.bwg_slideshow_filmstrip_fix_count_' + bwg).height();
|
3737 |
}
|
3738 |
-
|
3739 |
var slideshow_filmstrip_angle_display_value = (filmstrip_direction == 'horizontal') ? 'table-cell' : 'block';
|
3740 |
// Changes next / previous icon to active or passive.
|
3741 |
jQuery(slideshow_filmstrip_container).find('.bwg_slideshow_filmstrip_left_' + bwg).css({ display: 'none' });
|
@@ -3758,14 +3717,12 @@ function bwg_popup_resize_slidshow( bwg ) {
|
|
3758 |
}
|
3759 |
var slideshow_filmstrip_thumbnails = bwg_container2 + ' .bwg_slideshow_filmstrip_thumbnails_' + bwg;
|
3760 |
jQuery(slideshow_filmstrip_thumbnails).removeAttr('style');
|
3761 |
-
|
3762 |
var filmstrip_thumbnail = slideshow_filmstrip_thumbnails + ' .bwg_slideshow_filmstrip_thumbnail_' + bwg;
|
3763 |
-
jQuery(filmstrip_thumbnail).each(function(i, val) {
|
3764 |
jQuery(val).attr('style', jQuery(val).attr('data-style'));
|
3765 |
jQuery(val).find('img').attr('style', jQuery(val).attr('data-style'));
|
3766 |
});
|
3767 |
var slideshow_image_container = '#bwg_container1_' + bwg + ' #bwg_container2_' + bwg + ' .bwg_slideshow_image_container_' + bwg;
|
3768 |
-
|
3769 |
var filmstrip_position = jQuery(slideshow_image_container).data('filmstrip-position');
|
3770 |
var filmstrip_size = jQuery(slideshow_image_container).data('filmstrip-size');
|
3771 |
jQuery(slideshow_image_container).css({
|
@@ -3778,39 +3735,23 @@ function bwg_popup_resize_slidshow( bwg ) {
|
|
3778 |
}
|
3779 |
}
|
3780 |
else {
|
3781 |
-
var slideshow_ratio = bwg_params[bwg]['image_height'] / bwg_params[bwg]['image_width'];
|
3782 |
-
var new_slideshow_height = parent_width * slideshow_ratio;
|
3783 |
/* Slideshow filmstrip type is Fix dimension. */
|
3784 |
if ( bwg_params[bwg]['slideshow_filmstrip_type'] == 1 ) {
|
3785 |
-
bwg_resize_slideshow_filmstrip_fix_dimension({ 'bwg': bwg, 'params': bwg_params[bwg], 'parent_width': parent_width
|
3786 |
}
|
3787 |
/* Slideshow filmstrip type is Fix count. */
|
3788 |
if ( bwg_params[bwg]['slideshow_filmstrip_type'] == 2 ) {
|
3789 |
bwg_resize_slideshow_filmstrip_fix_count({ 'bwg': bwg, 'params': bwg_params[bwg], 'parent_width': parent_width });
|
3790 |
}
|
3791 |
-
|
3792 |
jQuery(".bwg_slideshow_dots_container_" + bwg).css({ width: parent_width });
|
3793 |
-
jQuery("#bwg_slideshow_play_pause-ico_" + bwg).css({ fontSize: (parent_width * (bwg_params[bwg]['slideshow_play_pause_btn_size'] / bwg_params[bwg]['image_width'])
|
3794 |
jQuery(".bwg_slideshow_watermark_image_" + bwg).css({
|
3795 |
-
maxWidth: (
|
3796 |
-
maxHeight: (
|
3797 |
});
|
3798 |
-
jQuery(".bwg_slideshow_watermark_text_" + bwg + ", .bwg_slideshow_watermark_text_" + bwg + ":hover").css({ fontSize: (parent_width * (bwg_params[bwg]['watermark_font_size'] / bwg_params[bwg]['image_width'])
|
3799 |
jQuery(".bwg_slideshow_title_text_" + bwg).css({ fontSize: ((parent_width) * 2 * bwg_params[bwg]['slideshow_title_font_size'] / bwg_params[bwg]['image_width']) });
|
3800 |
jQuery(".bwg_slideshow_description_text_" + bwg).css({ fontSize: ((parent_width) * 2 * bwg_params[bwg]['slideshow_description_font_size'] / bwg_params[bwg]['image_width']) });
|
3801 |
-
jQuery(bwg_slideshow_image_wrap_class_name).css({
|
3802 |
-
width: parent_width,
|
3803 |
-
height: new_slideshow_height
|
3804 |
-
});
|
3805 |
-
jQuery(bwg_slideshow_image_container_class_name).css({
|
3806 |
-
width: parent_width,
|
3807 |
-
height: new_slideshow_height
|
3808 |
-
});
|
3809 |
-
jQuery(bwg_slideshow_image_class_name).css({
|
3810 |
-
'display': 'inline-block',
|
3811 |
-
'max-width': parent_width,
|
3812 |
-
'max-height': new_slideshow_height
|
3813 |
-
});
|
3814 |
}
|
3815 |
if ( data[parseInt(jQuery("#bwg_current_image_key_" + bwg).val())]["is_embed_video"] ) {
|
3816 |
jQuery("#bwg_slideshow_play_pause_" + bwg).css({ display: 'none' });
|
@@ -3868,6 +3809,7 @@ function bwg_resize_instagram_post( bwg ) {
|
|
3868 |
bwg_change_watermark_container();
|
3869 |
}
|
3870 |
}
|
|
|
3871 |
if ( is_instagram_embed_iframe === true ) {
|
3872 |
// HoverCard, Feedback, SocialProof height from Instagram
|
3873 |
var feedback_social_proof_height = 109;
|
@@ -3883,11 +3825,15 @@ function bwg_resize_instagram_post( bwg ) {
|
|
3883 |
else {
|
3884 |
instagram_width = instagram_width + feedback_social_proof_height;
|
3885 |
}
|
3886 |
-
embed_frame.
|
3887 |
-
|
|
|
|
|
|
|
|
|
3888 |
instagram_embed.css({
|
3889 |
-
'
|
3890 |
-
'
|
3891 |
});
|
3892 |
}
|
3893 |
}
|
94 |
*/
|
95 |
function bwg_main_ready(container) {
|
96 |
var bwg = container.data('bwg');
|
97 |
+
if (container.data("scroll") === 1) {
|
98 |
+
form_id = 'gal_front_form_' + bwg;
|
99 |
+
jQuery("html, body").animate({scrollTop: jQuery('#' + form_id).offset().top - 150}, 500);
|
100 |
+
}
|
101 |
|
102 |
bwg_remove_lazy_loader_icon();
|
103 |
|
848 |
jQuery(".bwg_slideshow_image_" + bwg).removeAttr("width");
|
849 |
jQuery(".bwg_slideshow_image_" + bwg).removeAttr("height");
|
850 |
/* Uses Instagram oEmbed data to create iframe tag. */
|
851 |
+
jQuery('#instagram-embed-' + bwg).hide();
|
852 |
if ( typeof instgrm !== 'undefined' && typeof instgrm.Embeds !== 'undefined' ) {
|
853 |
+
var instagram_embed = jQuery('.bwg_embed_frame_' + bwg);
|
854 |
+
var embed_max_height = instagram_embed.data('height');
|
855 |
+
instagram_embed.css({ 'display': 'none' });
|
856 |
instgrm.Embeds.process();
|
857 |
+
jQuery('.bwg_embed_frame_' + bwg + ' #instagram-embed-' + bwg ).css({
|
858 |
'max-height': embed_max_height + 'px',
|
859 |
+
});
|
860 |
+
instagram_embed.css({ 'display': 'inline-block' });
|
861 |
}
|
862 |
}
|
863 |
}
|
1251 |
thumb_w = mosaic_pics.get(index).naturalWidth;
|
1252 |
thumb_h = mosaic_pics.get(index).naturalHeight;
|
1253 |
}
|
|
|
1254 |
thumb_w = thumb_w * thumbnail_height / thumb_h;
|
1255 |
+
mosaic_pics.eq(index).css({ cssText: 'width:' + thumb_w + 'px !important; height:' + thumbnail_height + 'px !important;' });
|
|
|
1256 |
});
|
1257 |
/* resize */
|
1258 |
var divwidth = jQuery("#bwg_mosaic_thumbnails_div_" + bwg).width() / 100 * parseInt(container.attr('data-total-width'));
|
1347 |
mosaic_pics.each(function (index) {
|
1348 |
var thumb_w = mosaic_pics.eq(index).width();
|
1349 |
var thumb_h = mosaic_pics.eq(index).height();
|
1350 |
+
var pic_width = thumb_w * stretch[row_of_img[index]];
|
1351 |
+
var pic_height = thumb_h * stretch[row_of_img[index]]
|
1352 |
+
mosaic_pics.eq(index).css({ cssText: 'width:' + pic_width + 'px !important; height:' + pic_height + 'px !important;' });
|
1353 |
mosaic_pics.eq(index).parent().css({
|
1354 |
top: row_top[row_of_img[index]],
|
1355 |
left: img_left[row_of_img[index]]
|
1391 |
thumb_w = mosaic_pics.get(index).naturalWidth;
|
1392 |
thumb_h = mosaic_pics.get(index).naturalHeight;
|
1393 |
}
|
1394 |
+
mosaic_pics.eq(index).css({ cssText: 'width:' + thumbnail_width +'px !important; height:' + (thumb_h * thumbnail_width / thumb_w) + 'px !important;' });
|
|
|
1395 |
});
|
1396 |
/* Resize.*/
|
1397 |
var divwidth = jQuery("#bwg_mosaic_thumbnails_div_" + bwg).width() / 100 * parseInt(container.attr('data-total-width'));
|
1479 |
mosaic_pics.each(function (index) {
|
1480 |
var thumb_w = mosaic_pics.eq(index).width();
|
1481 |
var thumb_h = mosaic_pics.eq(index).height();
|
1482 |
+
var pic_width = (thumb_w * stretch[col_of_img[index]]);
|
1483 |
+
var pic_height = (thumb_h * stretch[col_of_img[index]]);
|
1484 |
+
mosaic_pics.eq(index).css({ cssText: 'width:' + pic_width + 'px !important; height:' + pic_height + 'px !important;' });
|
1485 |
mosaic_pics.eq(index).parent().css({
|
1486 |
top: img_container_top[col_of_img[index]],
|
1487 |
left: img_container_left[col_of_img[index]]
|
2154 |
}
|
2155 |
});
|
2156 |
});
|
|
|
2157 |
if ( jQuery(".pagination-links_" + current_view).length ) {
|
2158 |
jQuery("html, body").animate({scrollTop: jQuery('#' + form_id).offset().top - 150}, 500);
|
2159 |
}
|
2749 |
|
2750 |
/* Set each watermark container size.*/
|
2751 |
function bwg_change_each_watermark_container(width, height, bwg) {
|
|
|
2752 |
var defix = ( typeof bwg !== 'undefined' && bwg !== '' ) ? '_'+bwg : '';
|
2753 |
var source = ( typeof bwg !== 'undefined' && bwg !== '' ) ? '_slideshow' : '';
|
2754 |
|
2833 |
jQuery(".bwg"+source+"_filmstrip_thumbnails" + defix).animate({
|
2834 |
left: imagesContainerLeft + right_left_space
|
2835 |
}, {
|
2836 |
+
duration: 500
|
|
|
2837 |
});
|
2838 |
}
|
2839 |
else {
|
2841 |
top: imagesContainerLeft + top_bottom_space
|
2842 |
},
|
2843 |
{
|
2844 |
+
duration: 500
|
|
|
2845 |
});
|
2846 |
}
|
2847 |
}
|
2848 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2849 |
/**
|
2850 |
* Slideshow filmstrip fix dimension.
|
2851 |
*
|
2899 |
jQuery(".bwg" + source + "_filmstrip_thumbnails" + defix).animate({
|
2900 |
left: -image_left
|
2901 |
}, {
|
2902 |
+
duration: 500
|
|
|
2903 |
});
|
2904 |
} else {
|
2905 |
jQuery(".bwg" + source + "_filmstrip_thumbnails" + defix).animate({
|
2906 |
top: -image_left
|
2907 |
}, {
|
2908 |
+
duration: 500
|
|
|
2909 |
});
|
2910 |
}
|
2911 |
}
|
2914 |
jQuery(".bwg" + source + "_filmstrip_thumbnails" + defix).animate({
|
2915 |
left: -(image_right - bwg_filmstrip_width)
|
2916 |
}, {
|
2917 |
+
duration: 500
|
|
|
|
|
|
|
2918 |
});
|
2919 |
} else {
|
2920 |
jQuery(".bwg" + source + "_filmstrip_thumbnails" + defix).animate({
|
2921 |
top: -(image_right - bwg_filmstrip_width)
|
2922 |
}, {
|
2923 |
+
duration: 500
|
|
|
|
|
|
|
2924 |
});
|
2925 |
}
|
2926 |
}
|
2981 |
left: -image_left
|
2982 |
},
|
2983 |
{
|
2984 |
+
duration: 500
|
|
|
|
|
|
|
2985 |
});
|
2986 |
}
|
2987 |
else {
|
2989 |
top: -image_left
|
2990 |
},
|
2991 |
{
|
2992 |
+
duration: 500
|
|
|
|
|
|
|
2993 |
});
|
2994 |
}
|
2995 |
}
|
2999 |
left: -(image_right - bwg_filmstrip_width)
|
3000 |
},
|
3001 |
{
|
3002 |
+
duration: 500
|
|
|
|
|
|
|
3003 |
});
|
3004 |
}
|
3005 |
else {
|
3007 |
top: -(image_right - bwg_filmstrip_width)
|
3008 |
},
|
3009 |
{
|
3010 |
+
duration: 500
|
|
|
|
|
|
|
3011 |
});
|
3012 |
}
|
3013 |
}
|
3040 |
var filmstrip_position = jQuery(slideshow_image_container).data('filmstrip-position');
|
3041 |
var filmstrip_size = jQuery(slideshow_image_container).data('filmstrip-size');
|
3042 |
var filmstrip_rl_btn_size = params['slideshow_filmstrip_rl_btn_size'];
|
|
|
|
|
|
|
|
|
|
|
|
|
3043 |
jQuery('#bwg_container1_' + bwg).css({ width: '100%' });
|
3044 |
jQuery('#bwg_container1_' + bwg + ' #bwg_container2_' + bwg).css({
|
3045 |
width: parent_width
|
3052 |
}
|
3053 |
var resize_timer = setTimeout(function(){
|
3054 |
resize_in_progress = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3055 |
var filmstrip_thumbnails_css = {};
|
3056 |
if ( filmstrip_position == 'bottom' || filmstrip_position == 'top' ) {
|
3057 |
filmstrip_thumbnails_css.left = 0;
|
3144 |
jQuery(".bwg_slideshow_embed_" + bwg).css({
|
3145 |
cssText: "width:" + parent_width + "px !important; height:" + ( (parent_width * (params['image_height'] / params['image_width']) ) - slideshow_filmstrip_height) + "px !important;"
|
3146 |
});
|
3147 |
+
jQuery(".bwg_embed_frame_" + bwg).css({
|
3148 |
+
'max-width': parent_width + 'px',
|
3149 |
+
'max-height': ( (parent_width * (params['image_height'] / params['image_width']) ) - slideshow_filmstrip_height) + 'px'
|
3150 |
+
});
|
3151 |
+
jQuery(".bwg_embed_frame_" + bwg).attr('data-width', parent_width);
|
3152 |
+
jQuery(".bwg_embed_frame_" + bwg).attr('data-height', ( (parent_width * (params['image_height'] / params['image_width']) ) - slideshow_filmstrip_height));
|
3153 |
if ( filmstrip_rl_btn_size > slideshow_filmstrip_height ) {
|
3154 |
filmstrip_rl_btn_size = slideshow_filmstrip_height;
|
3155 |
}
|
3231 |
jQuery(".bwg_slideshow_embed_" + bwg).css({
|
3232 |
cssText: "width:" + (parent_width - slideshow_filmstrip_width) + "px !important; height:" + parent_height + "px !important;"
|
3233 |
});
|
3234 |
+
|
3235 |
+
jQuery(".bwg_embed_frame_" + bwg).css({
|
3236 |
+
'max-width': (parent_width - slideshow_filmstrip_width) + 'px',
|
3237 |
+
'max-height': parent_height + 'px'
|
3238 |
+
});
|
3239 |
+
jQuery(".bwg_embed_frame_" + bwg).attr('data-width', (parent_width - slideshow_filmstrip_width) );
|
3240 |
+
jQuery(".bwg_embed_frame_" + bwg).attr('data-height', parent_height);
|
3241 |
+
|
3242 |
if ( filmstrip_rl_btn_size > slideshow_filmstrip_width ) {
|
3243 |
filmstrip_rl_btn_size = slideshow_filmstrip_width;
|
3244 |
}
|
3264 |
var parent_width = args['parent_width'];
|
3265 |
var params = args['params'];
|
3266 |
var filmstrip_direction = params['filmstrip_direction'];
|
3267 |
+
var filmstrip_width = params['slideshow_filmstrip_width'];
|
3268 |
+
var filmstrip_height = params['slideshow_filmstrip_height'];
|
3269 |
+
|
3270 |
+
var bwg_container1_class_name = '#bwg_container1_' + bwg;
|
3271 |
+
var bwg_container2_class_name = bwg_container1_class_name + ' #bwg_container2_' + bwg;
|
3272 |
+
var bwg_slideshow_image_wrap_class_name = bwg_container2_class_name + ' .bwg_slideshow_image_wrap_' + bwg;
|
3273 |
+
var bwg_slideshow_image_container_class_name = bwg_container2_class_name + ' .bwg_slideshow_image_container_' + bwg;
|
3274 |
+
var bwg_slideshow_image_class_name = bwg_container2_class_name + ' .bwg_slideshow_image_' + bwg;
|
3275 |
+
var bwg_slideshow_embed_class_name = bwg_container2_class_name + ' .bwg_slideshow_embed_' + bwg;
|
3276 |
|
3277 |
+
var bwg_slideshow_filmstrip_container_class_name = bwg_slideshow_image_wrap_class_name + ' .bwg_slideshow_filmstrip_container_' + bwg;
|
3278 |
+
var bwg_slideshow_filmstrip_class_name = bwg_slideshow_filmstrip_container_class_name + ' .bwg_slideshow_filmstrip_' + bwg;
|
3279 |
+
|
3280 |
+
var slideshow_width = parent_width;
|
3281 |
+
var slideshow_height = slideshow_width * (params['image_height'] / params['image_width']);
|
3282 |
+
|
3283 |
+
jQuery(bwg_slideshow_image_wrap_class_name).css({
|
3284 |
+
width: slideshow_width,
|
3285 |
+
height: slideshow_height
|
3286 |
+
});
|
3287 |
+
jQuery(bwg_slideshow_image_container_class_name).css({
|
3288 |
+
width: (slideshow_width - (filmstrip_direction == 'horizontal' ? 0 : filmstrip_width)),
|
3289 |
+
height: (slideshow_height - (filmstrip_direction == 'horizontal' ? filmstrip_height : 0))
|
3290 |
+
});
|
3291 |
+
jQuery(bwg_slideshow_image_class_name).css({
|
3292 |
+
'display': 'inline-block',
|
3293 |
+
'max-width': (slideshow_width - (filmstrip_direction == 'horizontal' ? 0 : filmstrip_width)),
|
3294 |
+
'max-height': (slideshow_height - (filmstrip_direction == 'horizontal' ? filmstrip_height : 0))
|
3295 |
});
|
3296 |
+
jQuery(bwg_slideshow_embed_class_name).css({
|
3297 |
+
cssText: "width: " + (slideshow_width - (filmstrip_direction == 'horizontal' ? 0 : filmstrip_width)) + "px !important; height: " + (slideshow_height - (filmstrip_direction == 'horizontal' ? filmstrip_height : 0) - 1) + "px !important;"
|
3298 |
});
|
3299 |
|
3300 |
bwg_resize_instagram_post(bwg);
|
3302 |
bwg_change_watermark_container(bwg);
|
3303 |
|
3304 |
if ( filmstrip_direction == 'horizontal' ) {
|
3305 |
+
jQuery(bwg_slideshow_filmstrip_container_class_name).css({ width: slideshow_width });
|
3306 |
+
jQuery(bwg_slideshow_filmstrip_class_name).css({ width: slideshow_width - 40 });
|
3307 |
}
|
3308 |
else {
|
3309 |
+
jQuery(bwg_slideshow_filmstrip_container_class_name).css({ height: slideshow_height });
|
3310 |
+
jQuery(bwg_slideshow_filmstrip_class_name).css({ height: slideshow_height - 40 });
|
3311 |
}
|
3312 |
}
|
3313 |
|
3357 |
jQuery(".bwg_slideshow_dots_thumbnails_" + bwg).animate({
|
3358 |
left: -image_left
|
3359 |
}, {
|
3360 |
+
duration: 500
|
|
|
3361 |
});
|
3362 |
}
|
3363 |
else if (image_right > long_filmstrip_cont_right) {
|
3364 |
jQuery(".bwg_slideshow_dots_thumbnails_" + bwg).animate({
|
3365 |
left: -(image_right - bwg_dots_width)
|
3366 |
}, {
|
3367 |
+
duration: 500
|
|
|
3368 |
});
|
3369 |
}
|
3370 |
}
|
3542 |
'data-height': maxHeight,
|
3543 |
'data-instagram-width': srcWidth,
|
3544 |
'data-instagram-height': srcHeight,
|
3545 |
+
style: 'width: 100%; height: 100%; max-width: 100%; max-height: 100%; vertical-align:middle; display:inline-block; position:relative;'
|
3546 |
});
|
3547 |
}
|
3548 |
else {
|
3583 |
}
|
3584 |
}
|
3585 |
bwg_add_lightbox();
|
3586 |
+
if ( typeof data[key] != 'undefined' && data[key].filetype == 'EMBED_OEMBED_INSTAGRAM_POST' ) {
|
3587 |
/* Uses Instagram oEmbed data to create iframe tag. */
|
3588 |
if ( typeof instgrm !== 'undefined' && typeof instgrm.Embeds !== 'undefined' ) {
|
3589 |
jQuery('.instagram-media').hide();
|
3635 |
}
|
3636 |
|
3637 |
function bwg_popup_resize_slidshow( bwg ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
3638 |
var slideshow_filmstrip_class_name = ".bwg_slideshow_filmstrip_" + bwg;
|
3639 |
+
/* Slideshow filmstrip type is Fix count. */
|
3640 |
if ( bwg_params[bwg]['slideshow_filmstrip_type'] == 2 ) {
|
3641 |
slideshow_filmstrip_class_name = ".bwg_slideshow_filmstrip_fix_count_" + bwg;
|
3642 |
}
|
3643 |
var parentt = jQuery("#bwg_container1_" + bwg).parent();
|
3644 |
+
/* Trick to set parent's width to wordpress content area. */
|
3645 |
if ( parentt.hasClass('content-area') ) {
|
3646 |
parentt.width(parentt.closest('.content-area').width());
|
3647 |
}
|
3688 |
if ( bwg_params[bwg]['slideshow_filmstrip_type'] == 2 ) {
|
3689 |
var filmstrip_direction = bwg_params[bwg]['filmstrip_direction'];
|
3690 |
var bwg_container2 = '#bwg_container1_' + bwg + ' #bwg_container2_' + bwg;
|
3691 |
+
jQuery(bwg_container2).removeAttr('style');
|
3692 |
var slideshow_filmstrip_container = bwg_container2 + ' .bwg_slideshow_filmstrip_container_' + bwg;
|
3693 |
var filmstrip_rl_btn_size = bwg_params[bwg].slideshow_filmstrip_rl_btn_size;
|
3694 |
var slideshow_filmstrip_size = jQuery('.bwg_slideshow_filmstrip_fix_count_' + bwg).width();
|
3695 |
if ( filmstrip_direction == 'horizontal' ) {
|
3696 |
slideshow_filmstrip_size = jQuery('.bwg_slideshow_filmstrip_fix_count_' + bwg).height();
|
3697 |
}
|
|
|
3698 |
var slideshow_filmstrip_angle_display_value = (filmstrip_direction == 'horizontal') ? 'table-cell' : 'block';
|
3699 |
// Changes next / previous icon to active or passive.
|
3700 |
jQuery(slideshow_filmstrip_container).find('.bwg_slideshow_filmstrip_left_' + bwg).css({ display: 'none' });
|
3717 |
}
|
3718 |
var slideshow_filmstrip_thumbnails = bwg_container2 + ' .bwg_slideshow_filmstrip_thumbnails_' + bwg;
|
3719 |
jQuery(slideshow_filmstrip_thumbnails).removeAttr('style');
|
|
|
3720 |
var filmstrip_thumbnail = slideshow_filmstrip_thumbnails + ' .bwg_slideshow_filmstrip_thumbnail_' + bwg;
|
3721 |
+
jQuery(filmstrip_thumbnail).each(function ( i, val ) {
|
3722 |
jQuery(val).attr('style', jQuery(val).attr('data-style'));
|
3723 |
jQuery(val).find('img').attr('style', jQuery(val).attr('data-style'));
|
3724 |
});
|
3725 |
var slideshow_image_container = '#bwg_container1_' + bwg + ' #bwg_container2_' + bwg + ' .bwg_slideshow_image_container_' + bwg;
|
|
|
3726 |
var filmstrip_position = jQuery(slideshow_image_container).data('filmstrip-position');
|
3727 |
var filmstrip_size = jQuery(slideshow_image_container).data('filmstrip-size');
|
3728 |
jQuery(slideshow_image_container).css({
|
3735 |
}
|
3736 |
}
|
3737 |
else {
|
|
|
|
|
3738 |
/* Slideshow filmstrip type is Fix dimension. */
|
3739 |
if ( bwg_params[bwg]['slideshow_filmstrip_type'] == 1 ) {
|
3740 |
+
bwg_resize_slideshow_filmstrip_fix_dimension({ 'bwg': bwg, 'params': bwg_params[bwg], 'parent_width': parent_width });
|
3741 |
}
|
3742 |
/* Slideshow filmstrip type is Fix count. */
|
3743 |
if ( bwg_params[bwg]['slideshow_filmstrip_type'] == 2 ) {
|
3744 |
bwg_resize_slideshow_filmstrip_fix_count({ 'bwg': bwg, 'params': bwg_params[bwg], 'parent_width': parent_width });
|
3745 |
}
|
|
|
3746 |
jQuery(".bwg_slideshow_dots_container_" + bwg).css({ width: parent_width });
|
3747 |
+
jQuery("#bwg_slideshow_play_pause-ico_" + bwg).css({ fontSize: (parent_width * (bwg_params[bwg]['slideshow_play_pause_btn_size'] / bwg_params[bwg]['image_width'])) });
|
3748 |
jQuery(".bwg_slideshow_watermark_image_" + bwg).css({
|
3749 |
+
maxWidth: (parent_width * (bwg_params[bwg]['watermark_width'] / bwg_params[bwg]['image_width'])),
|
3750 |
+
maxHeight: (parent_width * (bwg_params[bwg]['watermark_height'] / bwg_params[bwg]['image_width']))
|
3751 |
});
|
3752 |
+
jQuery(".bwg_slideshow_watermark_text_" + bwg + ", .bwg_slideshow_watermark_text_" + bwg + ":hover").css({ fontSize: (parent_width * (bwg_params[bwg]['watermark_font_size'] / bwg_params[bwg]['image_width'])) });
|
3753 |
jQuery(".bwg_slideshow_title_text_" + bwg).css({ fontSize: ((parent_width) * 2 * bwg_params[bwg]['slideshow_title_font_size'] / bwg_params[bwg]['image_width']) });
|
3754 |
jQuery(".bwg_slideshow_description_text_" + bwg).css({ fontSize: ((parent_width) * 2 * bwg_params[bwg]['slideshow_description_font_size'] / bwg_params[bwg]['image_width']) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3755 |
}
|
3756 |
if ( data[parseInt(jQuery("#bwg_current_image_key_" + bwg).val())]["is_embed_video"] ) {
|
3757 |
jQuery("#bwg_slideshow_play_pause_" + bwg).css({ display: 'none' });
|
3809 |
bwg_change_watermark_container();
|
3810 |
}
|
3811 |
}
|
3812 |
+
|
3813 |
if ( is_instagram_embed_iframe === true ) {
|
3814 |
// HoverCard, Feedback, SocialProof height from Instagram
|
3815 |
var feedback_social_proof_height = 109;
|
3825 |
else {
|
3826 |
instagram_width = instagram_width + feedback_social_proof_height;
|
3827 |
}
|
3828 |
+
embed_frame.css({
|
3829 |
+
'width': '100%',
|
3830 |
+
'height': '100%',
|
3831 |
+
'max-width': maxWidth,
|
3832 |
+
'max-height': maxHeight
|
3833 |
+
});
|
3834 |
instagram_embed.css({
|
3835 |
+
'min-width': instagram_width + 'px !important',
|
3836 |
+
'max-height': maxHeight + 'px'
|
3837 |
});
|
3838 |
}
|
3839 |
}
|
js/scripts.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var bwg_current_filmstrip_pos,total_thumbnail_count,key,startPoint,endPoint,bwg_image_info_pos,filmstrip_width,preloadCount,filmstrip_thumbnail_width,filmstrip_thumbnail_height,addthis_share,lightbox_comment_pos,bwg_transition_duration,bwg_playInterval,isPopUpOpened=!1,bwg_overflow_initial_value=!1,bwg_overflow_x_initial_value=!1,bwg_overflow_y_initial_value=!1;function gallery_box_ready(){filmstrip_thumbnail_width=jQuery(".bwg_filmstrip_thumbnail").width(),filmstrip_thumbnail_height=jQuery(".bwg_filmstrip_thumbnail").height(),1==gallery_box_data.open_with_fullscreen?(filmstrip_width=jQuery(window).width(),filmstrip_height=jQuery(window).height()):(filmstrip_width=jQuery(".bwg_filmstrip_container").width(),filmstrip_height=jQuery(".bwg_filmstrip_container").height()),preloadCount="horizontal"==gallery_box_data.filmstrip_direction?parseInt(filmstrip_width/filmstrip_thumbnail_width)+gallery_box_data.preload_images_count:parseInt(filmstrip_height/filmstrip_thumbnail_height)+gallery_box_data.preload_images_count,total_thumbnail_count=jQuery(".bwg_filmstrip_thumbnail").length,key=parseInt(jQuery("#bwg_current_image_key").val()),startPoint=0,endPoint=key+preloadCount,jQuery(function(){bwg_load_visible_images(key,preloadCount,total_thumbnail_count),jQuery(".pge_tabs li a").on("click",function(){return jQuery(".pge_tabs_container > div").hide(),jQuery(".pge_tabs li").removeClass("pge_active"),jQuery(jQuery(this).attr("href")).show(),jQuery(this).closest("li").addClass("pge_active"),jQuery("[name=type]").val(jQuery(this).attr("href").substr(1)),!1});var e=jQuery("#bwg_rated").attr("data-params");void 0!==e&&bwg_rating((e=JSON.parse(e)).current_rate,e.current_rate_count,e.current_avg_rating,e.current_image_key)}),1==gallery_box_data.is_pro&&1==gallery_box_data.enable_addthis&&gallery_box_data.addthis_profile_id&&(addthis_share={url:gallery_box_data.share_url}),lightbox_comment_pos=gallery_box_data.lightbox_comment_pos,bwg_image_info_pos=jQuery(".bwg_ctrl_btn_container").length?jQuery(".bwg_ctrl_btn_container").height():0,bwg_transition_duration=gallery_box_data.slideshow_interval<4*gallery_box_data.slideshow_effect_duration&&0!=gallery_box_data.slideshow_interval?1e3*gallery_box_data.slideshow_interval/4:1e3*gallery_box_data.slideshow_effect_duration,gallery_box_data.bwg_transition_duration=bwg_transition_duration,gallery_box_data.bwg_trans_in_progress=!1,(jQuery("#spider_popup_wrap").width()>=jQuery(window).width()||jQuery("#spider_popup_wrap").height()>=jQuery(window).height())&&parseInt(jQuery(".spider_popup_close").css("right"))<0&&jQuery(".spider_popup_close").attr("class","spider_popup_close_fullscreen"),window.clearInterval(bwg_playInterval),bwg_current_filmstrip_pos=gallery_box_data.current_pos,jQuery(document).on("keydown",function(e){jQuery("#bwg_name").is(":focus")||jQuery("#bwg_email").is(":focus")||jQuery("#bwg_comment").is(":focus")||jQuery("#bwg_captcha_input").is(":focus")||("ArrowRight"==e.key?parseInt(jQuery("#bwg_current_image_key").val())==gallery_box_data.data.length-1?bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),0):bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),parseInt(jQuery("#bwg_current_image_key").val())+1):"ArrowLeft"==e.key?0==parseInt(jQuery("#bwg_current_image_key").val())?bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),gallery_box_data.data.length-1):bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),parseInt(jQuery("#bwg_current_image_key").val())-1):"Escape"==e.key?spider_destroypopup(1e3):"Space"==e.key&&jQuery(".bwg_play_pause").trigger("click"))}),jQuery(window).resize(function(){void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&(jQuery.fullscreen.isFullScreen()||bwg_popup_resize())});var r=gallery_box_data.image_width,_=gallery_box_data.image_height;if(1==gallery_box_data.is_pro){1==gallery_box_data.enable_addthis&&gallery_box_data.addthis_profile_id&&jQuery(".at4-share-outer").show(),spider_set_input_value("rate_ajax_task","save_hit_count"),spider_rate_ajax_save("bwg_rate_form");var e=gallery_box_data.data,t=gallery_box_data.current_image_key;jQuery(".bwg_image_hits span").html(++e[t].hit_count);var i=window.location.hash;i&&"-1"!=i.indexOf("bwg")||(location.replace("#bwg"+gallery_box_data.gallery_id+"/"+gallery_box_data.current_image_id),history.replaceState(void 0,void 0,"#bwg"+gallery_box_data.gallery_id+"/"+gallery_box_data.current_image_id))}1==gallery_box_data.image_right_click&&(jQuery(".bwg_image_wrap").bind("contextmenu",function(e){return!1}),jQuery(".bwg_image_wrap").css("webkitTouchCallout","none")),jQuery("#spider_popup_wrap").bind("touchmove",function(e){e.preventDefault()}),void 0!==jQuery().swiperight&&jQuery.isFunction(jQuery().swiperight)&&jQuery("#spider_popup_wrap .bwg_image_wrap").swiperight(function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),(parseInt(jQuery("#bwg_current_image_key").val())+gallery_box_data.data.length-1)%gallery_box_data.data.length),!1}),void 0!==jQuery().swipeleft&&jQuery.isFunction(jQuery().swipeleft)&&jQuery("#spider_popup_wrap .bwg_image_wrap").swipeleft(function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),(parseInt(jQuery("#bwg_current_image_key").val())+1)%gallery_box_data.data.length),!1}),bwg_reset_zoom();var a=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())?"touchend":"click";jQuery("#spider_popup_left").on(a,function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),(parseInt(jQuery("#bwg_current_image_key").val())+gallery_box_data.data.length-1)%gallery_box_data.data.length),!1}),jQuery("#spider_popup_right").on(a,function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),(parseInt(jQuery("#bwg_current_image_key").val())+1)%gallery_box_data.data.length),!1}),-1!=navigator.appVersion.indexOf("MSIE 10")||-1!=navigator.appVersion.indexOf("MSIE 9")?setTimeout(function(){bwg_popup_resize()},1):bwg_popup_resize(),jQuery(".bwg_watermark").css({display:"none"}),setTimeout(function(){bwg_change_watermark_container()},500),void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&(jQuery.fullscreen.isNativelySupported()||jQuery(".bwg_fullscreen").hide()),"horizontal"==gallery_box_data.filmstrip_direction?(jQuery(".bwg_image_container").height(jQuery(".bwg_image_wrap").height()-gallery_box_data.image_filmstrip_height),jQuery(".bwg_image_container").width(jQuery(".bwg_image_wrap").width())):(jQuery(".bwg_image_container").height(jQuery(".bwg_image_wrap").height()),jQuery(".bwg_image_container").width(jQuery(".bwg_image_wrap").width()-gallery_box_data.image_filmstrip_width)),void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".bwg_comments,.bwg_ecommerce_panel, .bwg_image_info").mCustomScrollbar({scrollInertia:150,theme:"dark-thick",advanced:{updateOnContentResize:!0}});var s=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";jQuery(".bwg_filmstrip").on(s,function(e){var t=window.event||e,i=(t=t.originalEvent?t.originalEvent:t).detail?-40*t.detail:t.wheelDelta,a=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase());0<i?jQuery(".bwg_filmstrip_left").trigger(a?"touchend":"click"):jQuery(".bwg_filmstrip_right").trigger(a?"touchend":"click")}),jQuery(".bwg_filmstrip_right").on(a,function(){jQuery(".bwg_filmstrip_thumbnails").stop(!0,!1),"left"==gallery_box_data.left_or_top?"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_thumbnails").position().left>=-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width())&&(jQuery(".bwg_filmstrip_left").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().left<-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width()-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width+gallery_box_data.all_images_right_left_space))?jQuery(".bwg_filmstrip_thumbnails").animate({left:-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width()-gallery_box_data.all_images_right_left_space)},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({left:jQuery(".bwg_filmstrip_thumbnails").position().left-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_filmstrip_thumbnails").position().left==-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width())&&jQuery(".bwg_filmstrip_right").css({opacity:.3})},500)):(jQuery(".bwg_filmstrip_thumbnails").position().left>=-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height())&&(jQuery(".bwg_filmstrip_left").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().left<-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height()-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width+gallery_box_data.all_images_right_left_space))?jQuery(".bwg_filmstrip_thumbnails").animate({left:-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height()-gallery_box_data.all_images_right_left_space)},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({left:jQuery(".bwg_filmstrip_thumbnails").position().left-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_filmstrip_thumbnails").position().left==-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height())&&jQuery(".bwg_filmstrip_right").css({opacity:.3})},500)):"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_thumbnails").position().top>=-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width())&&(jQuery(".bwg_filmstrip_left").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().top<-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width()-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width+gallery_box_data.all_images_right_left_space))?jQuery(".bwg_filmstrip_thumbnails").animate({left:-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width()-gallery_box_data.all_images_right_left_space)},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({left:jQuery(".bwg_filmstrip_thumbnails").position().top-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_filmstrip_thumbnails").position().left==-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width())&&jQuery(".bwg_filmstrip_right").css({opacity:.3})},500)):(jQuery(".bwg_filmstrip_thumbnails").position().top>=-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height())&&(jQuery(".bwg_filmstrip_left").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().top<-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height()-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width+gallery_box_data.all_images_right_left_space))?jQuery(".bwg_filmstrip_thumbnails").animate({top:-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height()-gallery_box_data.all_images_right_left_space)},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({top:jQuery(".bwg_filmstrip_thumbnails").position().top-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_filmstrip_thumbnails").position().left==-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height())&&jQuery(".bwg_filmstrip_right").css({opacity:.3})},500))}),"left"==gallery_box_data.left_or_top?jQuery(".bwg_filmstrip_left").on(a,function(){jQuery(".bwg_filmstrip_thumbnails").stop(!0,!1),jQuery(".bwg_filmstrip_thumbnails").position().left<0&&(jQuery(".bwg_filmstrip_right").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().left>-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)?jQuery(".bwg_filmstrip_thumbnails").animate({left:0},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({left:jQuery(".bwg_filmstrip_thumbnails").position().left+gallery_box_data.image_filmstrip_width+gallery_box_data.filmstrip_thumb_right_left_space},500,"linear")),window.setTimeout(function(){0==jQuery(".bwg_filmstrip_thumbnails").position().left&&jQuery(".bwg_filmstrip_left").css({opacity:.3})},500)}):jQuery(".bwg_filmstrip_left").on(a,function(){jQuery(".bwg_filmstrip_thumbnails").stop(!0,!1),jQuery(".bwg_filmstrip_thumbnails").position().top<0&&(jQuery(".bwg_filmstrip_right").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().top>-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)?jQuery(".bwg_filmstrip_thumbnails").animate({top:0},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({top:jQuery(".bwg_filmstrip_thumbnails").position().top+gallery_box_data.image_filmstrip_width+gallery_box_data.filmstrip_thumb_right_left_space},500,"linear")),window.setTimeout(function(){0==jQuery(".bwg_filmstrip_thumbnails").position().top&&jQuery(".bwg_filmstrip_left").css({opacity:.3})},500)}),"width"==gallery_box_data.width_or_height?bwg_set_filmstrip_pos(jQuery(".bwg_filmstrip").width(),"",gallery_box_data):bwg_set_filmstrip_pos(jQuery(".bwg_filmstrip").height(),"",gallery_box_data),jQuery(".bwg_info").on(a,function(){if("none"==jQuery(".bwg_image_info_container1").css("display")){jQuery(".bwg_image_info_container1").css("display","table-cell"),jQuery(".bwg_info").attr("title",bwg_objectsL10n.bwg_hide_info);jQuery(".bwg_ctrl_btn_container").length&&jQuery(".bwg_ctrl_btn_container").height();jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set()}else jQuery(".bwg_image_info_container1").css("display","none"),jQuery(".bwg_info").attr("title",bwg_objectsL10n.bwg_show_info)}),jQuery(".bwg_rate").on(a,function(){"none"==jQuery(".bwg_image_rate_container1").css("display")?(jQuery(".bwg_image_rate_container1").css("display","table-cell"),jQuery(".bwg_rate").attr("title",bwg_objectsL10n.bwg_hide_rating)):(jQuery(".bwg_image_rate_container1").css("display","none"),jQuery(".bwg_rate").attr("title",bwg_objectsL10n.bwg_show_rating))}),jQuery(".bwg_zoom").on(a,function(){var e=["mousemove","touchmove"];jQuery("figure.bwg_popup_image").each(function(){var i=jQuery(this);i.hasClass("zoom")?jQuery.each(e,function(e,t){i.removeClass("zoom"),i.off(t)}):jQuery.each(e,function(e,t){i.addClass("zoom"),i.on(t,function(e){var t,i,a,r;window.clearInterval(bwg_playInterval),jQuery(".bwg_play_pause").attr("title",bwg_objectsL10n.bwg_play),jQuery(".bwg_play_pause").attr("class","bwg-icon-play bwg_ctrl_btn bwg_play_pause");var _=e.target,s=_.getBoundingClientRect();e.targetTouches&&(a=e.targetTouches[0].clientX-s.left,r=e.targetTouches[0].clientY-s.top),t=e.offsetX?e.offsetX:e.targetTouches?a:_.offsetHeight,i=e.offsetY?e.offsetY:e.targetTouches?r:_.offsetWidth,x=t/_.offsetWidth*100,y=i/_.offsetHeight*100,_.parentNode.style.backgroundPosition=x+"% "+y+"%"})})})}),jQuery(".bwg_comment, .bwg_comments_close_btn").on(a,function(){bwg_comment()}),jQuery(".bwg_ecommerce, .bwg_ecommerce_close_btn").on(a,function(){bwg_ecommerce()}),jQuery(".bwg_toggle_container").on(a,function(){var e="top"==gallery_box_data.lightbox_ctrl_btn_pos?"bwg-icon-caret-up":"bwg-icon-caret-down",t="top"==gallery_box_data.lightbox_ctrl_btn_pos?"bwg-icon-caret-down":"bwg-icon-caret-up";jQuery(".bwg_toggle_container i").hasClass(e)?(gallery_box_data.enable_image_filmstrip&&"bottom"==gallery_box_data.lightbox_filmstrip_pos||"bottom"!=gallery_box_data.lightbox_ctrl_btn_pos||"bottom"!=gallery_box_data.lightbox_rate_pos?gallery_box_data.enable_image_filmstrip&&"top"==gallery_box_data.lightbox_filmstrip_pos||"top"!=gallery_box_data.lightbox_ctrl_btn_pos||"top"!=gallery_box_data.lightbox_rate_pos||jQuery(".bwg_image_rate").animate({top:0},500):jQuery(".bwg_image_rate").animate({bottom:0},500),gallery_box_data.enable_image_filmstrip&&"bottom"==gallery_box_data.lightbox_filmstrip_pos||"bottom"!=gallery_box_data.lightbox_ctrl_btn_pos||"bottom"!=gallery_box_data.lightbox_hit_pos?gallery_box_data.enable_image_filmstrip&&"top"==gallery_box_data.lightbox_filmstrip_pos||"top"!=gallery_box_data.lightbox_ctrl_btn_pos||"top"!=gallery_box_data.lightbox_hit_pos||jQuery(".bwg_image_hit").animate({top:0},500):jQuery(".bwg_image_hit").animate({bottom:0},500),"bottom"==gallery_box_data.lightbox_ctrl_btn_pos?(jQuery(".bwg_ctrl_btn_container").animate({bottom:"-"+jQuery(".bwg_ctrl_btn_container").height()},500).addClass("closed"),jQuery(".bwg_toggle_container").animate({bottom:0},{duration:500,complete:function(){jQuery(".bwg_toggle_container i").attr("class","bwg_toggle_btn "+t)}})):(jQuery(".bwg_ctrl_btn_container").animate({top:"-"+jQuery(".bwg_ctrl_btn_container").height()},500).addClass("closed"),jQuery(".bwg_toggle_container").animate({top:0},{duration:500,complete:function(){jQuery(".bwg_toggle_container i").attr("class","bwg_toggle_btn "+t)}}))):(gallery_box_data.enable_image_filmstrip&&"bottom"==gallery_box_data.lightbox_filmstrip_pos||"bottom"!=gallery_box_data.lightbox_ctrl_btn_pos||"bottom"!=gallery_box_data.lightbox_rate_pos?gallery_box_data.enable_image_filmstrip&&"top"==gallery_box_data.lightbox_filmstrip_pos||"top"!=gallery_box_data.lightbox_ctrl_btn_pos||"top"!=gallery_box_data.lightbox_rate_pos||jQuery(".bwg_image_rate").animate({top:jQuery(".bwg_ctrl_btn_container").height()},500):jQuery(".bwg_image_rate").animate({bottom:jQuery(".bwg_ctrl_btn_container").height()},500),gallery_box_data.enable_image_filmstrip&&"bottom"==gallery_box_data.lightbox_filmstrip_pos||"bottom"!=gallery_box_data.lightbox_ctrl_btn_pos||"bottom"!=gallery_box_data.lightbox_hit_pos?gallery_box_data.enable_image_filmstrip&&"top"==gallery_box_data.lightbox_filmstrip_pos||"top"!=gallery_box_data.lightbox_ctrl_btn_pos||"top"!=gallery_box_data.lightbox_hit_pos||jQuery(".bwg_image_hit").animate({top:jQuery(".bwg_ctrl_btn_container").height()},500):jQuery(".bwg_image_hit").animate({bottom:jQuery(".bwg_ctrl_btn_container").height()},500),"bottom"==gallery_box_data.lightbox_ctrl_btn_pos?(jQuery(".bwg_ctrl_btn_container").animate({bottom:0},500).removeClass("closed"),jQuery(".bwg_toggle_container").animate({bottom:jQuery(".bwg_ctrl_btn_container").height()},{duration:500,complete:function(){jQuery(".bwg_toggle_container i").attr("class","bwg_toggle_btn "+e)}})):(jQuery(".bwg_ctrl_btn_container").animate({top:0},500).removeClass("closed"),jQuery(".bwg_toggle_container").animate({top:jQuery(".bwg_ctrl_btn_container").height()},{duration:500,complete:function(){jQuery(".bwg_toggle_container i").attr("class","bwg_toggle_btn "+e)}}))),bwg_info_position(!0)});var o=window.innerHeight;jQuery(".bwg_resize-full").on(a,function(){bwg_resize_full()}),jQuery(".bwg_fullscreen").on(a,function(){jQuery(".bwg_watermark").css({display:"none"});var e,t=0;if((jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(t=jQuery(".bwg_comment_container").width()||jQuery(".bwg_ecommerce_container").width()),void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen))if(jQuery.fullscreen.isFullScreen())jQuery.fullscreen.exit(),e=o,jQuery(window).width()>gallery_box_data.image_width&&(r=gallery_box_data.image_width),window.innerHeight>gallery_box_data.image_height&&(_=gallery_box_data.image_height),gallery_box_data.open_with_fullscreen&&(r=jQuery(window).width(),_=e),jQuery("#spider_popup_wrap").on("fscreenclose",function(){jQuery("#spider_popup_wrap").css({width:r,height:_,left:"50%",top:"50%",marginLeft:-r/2,marginTop:-_/2,zIndex:1e5}),jQuery(".bwg_image_wrap").css({width:r-t}),jQuery(".bwg_image_container").css({height:_-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:r-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxWidth:r-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:_-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:r-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:_-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),bwg_resize_instagram_post(),bwg_change_watermark_container(),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").css({width:r-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)}),jQuery(".bwg_filmstrip").css({width:r-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(r-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").css({height:_-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)}),jQuery(".bwg_filmstrip").css({height:_-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(_-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),"horizontal"!=gallery_box_data.filmstrip_direction&&jQuery(".bwg_filmstrip_right").css({top:_-jQuery(".bwg_filmstrip_right").height()})),jQuery(".bwg_resize-full").show(),jQuery(".bwg_resize-full").attr("class","bwg-icon-expand bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_maximize),jQuery(".bwg_fullscreen").attr("class","bwg-icon-arrows-out bwg_ctrl_btn bwg_fullscreen"),jQuery(".bwg_fullscreen").attr("title",bwg_objectsL10n.bwg_fullscreen),jQuery("#spider_popup_wrap").width()<jQuery(window).width()&&jQuery("#spider_popup_wrap").height()<window.innerHeight&&jQuery(".spider_popup_close_fullscreen").attr("class","spider_popup_close")});else{jQuery("#spider_popup_wrap").fullscreen();var i=screen.width,a=screen.height;jQuery("#spider_popup_wrap").css({width:i,height:a,left:0,top:0,margin:0,zIndex:1e5}),jQuery(".bwg_image_wrap").css({width:i-t}),jQuery(".bwg_image_container").css({height:a-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:i-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxWidth:i-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:a-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:i-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:a-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),bwg_resize_instagram_post(),bwg_change_watermark_container(),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").css({width:i-("horizontal"==gallery_box_data.filmstrip_direction?t:0)},500),jQuery(".bwg_filmstrip").css({width:i-("horizontal"==gallery_box_data.filmstrip_direction?t:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(i-("horizontal"==gallery_box_data.filmstrip_direction?t:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").css({height:a-("horizontal"==gallery_box_data.filmstrip_direction)?"comment_container_width":0}),jQuery(".bwg_filmstrip").css({height:a-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(a-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),"horizontal"!=gallery_box_data.filmstrip_direction&&jQuery(".bwg_filmstrip_right").css({top:a-jQuery(".bwg_filmstrip_right").height()})),jQuery(".bwg_resize-full").hide(),jQuery(".bwg_fullscreen").attr("class","bwg-icon-compress bwg_ctrl_btn bwg_fullscreen"),jQuery(".bwg_fullscreen").attr("title",bwg_objectsL10n.bwg_exit_fullscreen),jQuery(".spider_popup_close").attr("class","spider_popup_close_fullscreen")}return!1}),jQuery(".bwg_play_pause").on(a,function(){jQuery(".bwg_play_pause").length&&jQuery(".bwg_play_pause").hasClass("bwg-icon-play")&&!jQuery(".bwg_comment_container").hasClass("bwg_open")?(bwg_play(gallery_box_data.data),jQuery(".bwg_play_pause").attr("title",bwg_objectsL10n.bwg_pause),jQuery(".bwg_play_pause").attr("class","bwg-icon-pause bwg_ctrl_btn bwg_play_pause")):(window.clearInterval(bwg_playInterval),jQuery(".bwg_play_pause").attr("title",bwg_objectsL10n.bwg_play),jQuery(".bwg_play_pause").attr("class","bwg-icon-play bwg_ctrl_btn bwg_play_pause"))}),gallery_box_data.open_with_autoplay&&(bwg_play(gallery_box_data.data),jQuery(".bwg_play_pause").attr("title",bwg_objectsL10n.bwg_pause),jQuery(".bwg_play_pause").attr("class","bwg-icon-pause bwg_ctrl_btn bwg_play_pause")),gallery_box_data.open_with_fullscreen&&bwg_open_with_fullscreen(),jQuery(".bwg_popup_image").removeAttr("width"),jQuery(".bwg_popup_image").removeAttr("height"),jQuery(window).focus(function(){jQuery(".bwg_play_pause").length&&!jQuery(".bwg_play_pause").hasClass("bwg-icon-play")&&bwg_play(gallery_box_data.data)}),jQuery(window).blur(function(){event_stack=[],window.clearInterval(bwg_playInterval)});gallery_box_data.lightbox_ctrl_btn_pos;1==gallery_box_data.open_ecommerce&&setTimeout(function(){bwg_ecommerce()},400),1==gallery_box_data.open_comment&&bwg_comment()}function spider_createpopup(e,t,a,r,_,s,o,l){e=e.replace(/&/g,"&"),isPopUpOpened||(isPopUpOpened=!0,spider_isunsupporteduseragent()||(bwg_overflow_initial_value=jQuery("html").css("overflow"),bwg_overflow_x_initial_value=jQuery("html").css("overflow-x"),bwg_overflow_y_initial_value=jQuery("html").css("overflow-y"),jQuery("html").attr("style","overflow:hidden !important;"),jQuery("#bwg_spider_popup_loading_"+t).show(),jQuery("#spider_popup_overlay_"+t).css({display:"block"}),jQuery.ajax({type:"GET",url:e,success:function(e){var t=jQuery('<div id="spider_popup_wrap" class="spider_popup_wrap" style=" width:'+a+"px; height:"+r+"px; margin-top:-"+r/2+"px; margin-left: -"+a/2+'px; ">'+e+"</div>").hide().appendTo("body");if(gallery_box_ready(),spider_showpopup(s,o,t,_,l),"undefined"!=typeof addthis){jQuery(".addthis-smartlayers").show();var i=setInterval(function(){void 0!==addthis.layers.refresh&&(clearInterval(i),addthis.layers.refresh())},100)}},beforeSend:function(){},complete:function(){}})))}function spider_showpopup(e,t,i,a,r){var _=gallery_box_data.data,s=parseInt(jQuery("#bwg_current_image_key").val());if(void 0!==_[s]&&(isPopUpOpened=!0,-1<_[s].filetype.indexOf("EMBED_")?bwg_first_image_load(i,r):jQuery("#spider_popup_wrap .bwg_popup_image_spun img").prop("complete")?bwg_first_image_load(i,r):jQuery("#spider_popup_wrap .bwg_popup_image_spun img").on("load error",function(){bwg_first_image_load(i,r)}),"EMBED_OEMBED_INSTAGRAM_POST"==_[s].filetype&&"undefined"!=typeof instgrm&&void 0!==instgrm.Embeds)){instgrm.Embeds.process();var o=parseInt(jQuery("#bwg_image_container").height());jQuery(".bwg_embed_frame .instagram-media").css({"max-height":o+"px"})}}function bwg_first_image_load(e,t){e.show(),""==gallery_box_data.data[key].alt&&""==gallery_box_data.data[key].description?jQuery(".bwg_info").hide():jQuery(".bwg_info").show();var i=jQuery(".bwg_ctrl_btn_container").height();"bottom"==t?jQuery(".bwg_toggle_container").css("bottom",i+"px"):"top"==t&&jQuery(".bwg_toggle_container").css("top",i+"px"),jQuery(".bwg_spider_popup_loading").hide(),1==gallery_box_data.preload_images&&bwg_preload_images(parseInt(jQuery("#bwg_current_image_key").val())),bwg_load_filmstrip(),bwg_info_height_set()}function spider_isunsupporteduseragent(){return!window.XMLHttpRequest}function spider_destroypopup(e){jQuery(".addthis-smartlayers").hide(),null!=document.getElementById("spider_popup_wrap")&&(void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&jQuery.fullscreen.isFullScreen()&&jQuery.fullscreen.exit(),"undefined"!=typeof enable_addthis&&enable_addthis&&jQuery(".at4-share-outer").hide(),setTimeout(function(){jQuery(".spider_popup_wrap").remove(),jQuery(".bwg_spider_popup_loading").css({display:"none"}),jQuery(".spider_popup_overlay").css({display:"none"}),jQuery(document).off("keydown"),!1!==bwg_overflow_initial_value&&jQuery("html").css("overflow",bwg_overflow_initial_value),!1!==bwg_overflow_x_initial_value&&jQuery("html").css("overflow-x",bwg_overflow_x_initial_value),!1!==bwg_overflow_y_initial_value&&jQuery("html").css("overflow-y",bwg_overflow_y_initial_value)},20)),isPopUpOpened=!1;var t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),i=document.querySelector('meta[name="viewport"]');t&&i&&(i.content="width=device-width, initial-scale=1");var a=jQuery(document).scrollTop();bwg_objectsL10n.is_pro&&history.pushState(history.state,null,window.location.origin+window.location.pathname+window.location.search),jQuery(document).scrollTop(a),void 0!==gallery_box_data.bwg_playInterval&&clearInterval(gallery_box_data.bwg_playInterval)}function get_ajax_pricelist(){var e={};return jQuery(".add_to_cart_msg").html(""),e.ajax_task="display",e.image_id=jQuery("#bwg_popup_image").attr("image_id"),jQuery("#ecommerce_ajax_loading").css("height",jQuery(".bwg_ecommerce_panel").css("height")),jQuery("#ecommerce_opacity_div").css("width",jQuery(".bwg_ecommerce_panel").css("width")),jQuery("#ecommerce_opacity_div").css("height",jQuery(".bwg_ecommerce_panel").css("height")),jQuery("#ecommerce_loading_div").css("width",jQuery(".bwg_ecommerce_panel").css("width")),jQuery("#ecommerce_loading_div").css("height",jQuery(".bwg_ecommerce_panel").css("height")),jQuery("#ecommerce_opacity_div").css("display","block"),jQuery("#ecommerce_loading_div").css("display","table-cell"),jQuery.ajax({type:"POST",url:jQuery("#bwg_ecommerce_form").attr("action"),data:e,success:function(e){jQuery(".pge_tabs li a").on("click",function(){return jQuery(".pge_tabs_container > div").hide(),jQuery(".pge_tabs li").removeClass("pge_active"),jQuery(jQuery(this).attr("href")).show(),jQuery(this).closest("li").addClass("pge_active"),jQuery("[name=type]").val(jQuery(this).attr("href").substr(1)),!1});var t=jQuery(e).find(".manual").html();jQuery(".manual").html(t);var i=jQuery(e).find(".downloads").html();jQuery(".downloads").html(i);var a=jQuery(e).find(".pge_options").html();jQuery(".pge_options").html(a);var r=jQuery(e).find(".pge_add_to_cart").html();jQuery(".pge_add_to_cart").html(r)},beforeSend:function(){},complete:function(){jQuery("#ecommerce_opacity_div").css("display","none"),jQuery("#ecommerce_loading_div").css("display","none")}}),!1}function spider_ajax_save(e){var t={};return t.bwg_name=jQuery("#bwg_name").val(),t.bwg_comment=jQuery("#bwg_comment").val(),t.bwg_email=jQuery("#bwg_email").val(),t.bwg_captcha_input=jQuery("#bwg_captcha_input").val(),t.ajax_task=jQuery("#ajax_task").val(),t.image_id=jQuery("#image_id").val(),t.comment_id=jQuery("#comment_id").val(),jQuery("#ajax_loading").css("height",jQuery(".bwg_comments").css("height")),jQuery("#opacity_div").css("width",jQuery(".bwg_comments").css("width")),jQuery("#opacity_div").css("height",jQuery(".bwg_comments").css("height")),jQuery("#loading_div").css("width",jQuery(".bwg_comments").css("width")),jQuery("#loading_div").css("height",jQuery(".bwg_comments").css("height")),document.getElementById("opacity_div").style.display="",document.getElementById("loading_div").style.display="table-cell",jQuery.ajax({type:"POST",url:jQuery("#"+e).attr("action"),data:t,success:function(e){jQuery(".bwg_comments").mCustomScrollbar("destroy");var t=jQuery(e).find(".bwg_comments").html();jQuery(".bwg_comments").html(t)},beforeSend:function(){},complete:function(){document.getElementById("opacity_div").style.display="none",document.getElementById("loading_div").style.display="none",jQuery(".bwg_comments").mCustomScrollbar({scrollInertia:150,theme:"dark-thick",advanced:{updateOnContentResize:!0}}),jQuery(".bwg_comments_close_btn").click(bwg_comment),bwg_captcha_refresh("bwg_captcha")}}),!1}function spider_rate_ajax_save(i,e){var t={};return t.image_id=jQuery("#"+i+" input[name='image_id']").val(),t.rate=void 0!==e?e:jQuery("#"+i+" input[name='score']").val(),t.ajax_task=jQuery("#rate_ajax_task").val(),jQuery.ajax({type:"POST",url:jQuery("#"+i).attr("action"),data:t,success:function(e){var t=jQuery(e).find("#"+i).html();jQuery("#"+i).html(t)},beforeSend:function(){},complete:function(){}})}function spider_set_input_value(e,t){document.getElementById(e)&&(document.getElementById(e).value=t)}function spider_form_submit(e,t){document.getElementById(t)&&document.getElementById(t).submit(),e.preventDefault?e.preventDefault():e.returnValue=!1}function spider_check_required(e,t){return""==jQuery("#"+e).val()&&(alert(t+" "+bwg_objectsL10n.bwg_field_required),jQuery("#"+e).attr("style","border-color: #FF0000;"),jQuery("#"+e).focus(),!0)}function comment_check_privacy_policy(){var e=jQuery("#bwg_submit");e.removeClass("bwg-submit-disabled"),e.removeAttr("disabled"),jQuery("#bwg_comment_privacy_policy").is(":checked")||(e.addClass("bwg-submit-disabled"),e.attr("disabled","disabled"))}function spider_check_email(e){if(""!=jQuery("#"+e).val())return-1==jQuery("#"+e).val().replace(/^\s+|\s+$/g,"").search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)&&(alert(bwg_objectsL10n.bwg_mail_validation),!0)}function bwg_captcha_refresh(e){document.getElementById(e+"_img")&&document.getElementById(e+"_input")&&(srcArr=document.getElementById(e+"_img").src.split("&r="),document.getElementById(e+"_img").src=srcArr[0]+"&r="+Math.floor(100*Math.random()),document.getElementById(e+"_img").style.display="inline-block",document.getElementById(e+"_input").value="")}function bwg_play_instagram_video(e,t){jQuery(e).parent().find("video").each(function(){jQuery(this).get(0).paused?(jQuery(this).get(0).play(),jQuery(e).children().hide()):(jQuery(this).get(0).pause(),jQuery(e).children().show())})}function bwg_add_comment(){var t=jQuery("#bwg_comment_form"),e=t.attr("action"),i={ajax_task:"add_comment"};return i.comment_name=t.find("#bwg_name").val(),i.comment_email=t.find("#bwg_email").val(),i.comment_text=t.find("#bwg_comment").val(),i.comment_captcha=t.find("#bwg_captcha_input").val(),i.popup_enable_captcha=t.find("#bwg_popup_enable_captcha").val(),i.privacy_policy=t.find("#bwg_comment_privacy_policy").is(":checked")?1:0,i.comment_image_id=jQuery("#bwg_popup_image").attr("image_id"),i.comment_moderation=t.find("#bwg_comment_moderation").val(),jQuery(".bwg_spider_ajax_loading").hide(),jQuery.ajax({url:e,type:"POST",dataType:"json",data:i,success:function(e){jQuery(".bwg_comment_error").text(""),1==e.error?jQuery.each(e.error_messages,function(e,t){t&&jQuery(".bwg_comment_"+e+"_error").text(t)}):(t.find("#bwg_comment").val(""),jQuery(".bwg_comment_waiting_message").hide(),0==e.published&&jQuery(".bwg_comment_waiting_message").show(),""!=e.html_comments_block&&jQuery("#bwg_added_comments").html(e.html_comments_block).show())},beforeSend:function(){jQuery(".bwg_spider_ajax_loading").show()},complete:function(){0<t.find("#bwg_comment_privacy_policy").length&&(t.find("#bwg_comment_privacy_policy").prop("checked",!1),comment_check_privacy_policy()),bwg_captcha_refresh("bwg_captcha"),jQuery(".bwg_spider_ajax_loading").hide()},error:function(){}}),!1}function bwg_remove_comment(t){var e=jQuery("#bwg_comment_form").attr("action"),i={ajax_task:"delete_comment"};return i.id_image=jQuery("#bwg_popup_image").attr("image_id"),i.id_comment=t,jQuery.ajax({url:e,type:"POST",dataType:"json",data:i,success:function(e){0==e.error&&jQuery("#bwg_comment_block_"+t).fadeOut("slow").remove()},beforeSend:function(){},complete:function(){},error:function(){}}),!1}function bwg_gallery_box(e,t,i,a){jQuery(".bwg-validate").each(function(){jQuery(this).on("keypress change",function(){jQuery(this).parent().next().find(".bwg_comment_error").html("")})}),void 0===i&&(i=!1);var r,_=t.data("bwg");r=t.find(".bwg-container").data("lightbox-url")?t.find(".bwg-container").data("lightbox-url"):t.data("lightbox-url");var s=t.find(".cur_gal_id").val(),o=jQuery("#bwg_tag_id_"+s).val();o=o||0;var l=1==i?"&open_ecommerce=1":"",n=jQuery("#bwg_search_input_"+_).val(),g=jQuery("#bwg_order_"+_).val()?"&filtersortby="+jQuery("#bwg_order_"+_).val():"";n=n||"",void 0!==a&&(r+="&gallery_id="+a);var w="",b=jQuery("#bwg_blog_style_share_buttons_"+e).attr("data-open-comment");void 0!==b&&!1!==b&&(w="&open_comment=1"),spider_createpopup(r+"&bwg_random_seed="+jQuery("#bwg_random_seed_"+_).val()+"&image_id="+e+"&filter_tag="+o+l+w+"&filter_search_name="+n+g,_,t.data("popup-width"),t.data("popup-height"),1,"testpopup",5,t.data("buttons-position"))}function bwg_change_image_lightbox(e,a,r,t){if(jQuery("#bwg_rate_form input[name='image_id']").val(r[a].id),bwg_current_key=gallery_box_data.bwg_current_key,""==gallery_box_data.data[a].alt&&""==gallery_box_data.data[a].description?jQuery(".bwg_info").hide():jQuery(".bwg_info").show(),jQuery(".bwg_image_info").css("height","auto"),setTimeout(function(){bwg_info_height_set(),jQuery(".bwg_image_description").height()>jQuery(".bwg_image_info").height()&&jQuery(".mCSB_container").hasClass("mCS_no_scrollbar")&&jQuery(".bwg_image_info").mCustomScrollbar("destroy"),jQuery(".bwg_image_info").hasClass("mCustomScrollbar")||void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".bwg_image_info").mCustomScrollbar({scrollInertia:150,theme:"dark-thick",advanced:{updateOnContentResize:!0}})},200),jQuery("#spider_popup_left").show(),jQuery("#spider_popup_right").show(),jQuery(".bwg_image_info").hide(),0==gallery_box_data.enable_loop&&(a==parseInt(r.length)-1&&jQuery("#spider_popup_right").hide(),0==a&&jQuery("#spider_popup_left").hide()),1==gallery_box_data.ecommerceACtive&&1==gallery_box_data.enable_image_ecommerce)if(0==gallery_box_data.data[a].pricelist)jQuery(".bwg_ecommerce").hide();else{jQuery(".bwg_ecommerce").show(),jQuery(".pge_tabs li").hide(),jQuery("#downloads").hide(),jQuery("#manual").hide();var i=gallery_box_data.data[a].pricelist_sections.split(",");if(i)if(jQuery("#"+i[0]).show(),jQuery("[name=type]").val(i[0]),1<i.length)for(jQuery(".pge_tabs").show(),k=0;k<i.length;k++)jQuery("#"+i[k]+"_li").show();else jQuery(".pge_tabs").hide();else jQuery("[name=type]").val("")}if(jQuery("#bwg_image_container").find("iframe").each(function(){jQuery(this)[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*"),jQuery(this)[0].contentWindow.postMessage('{ "method": "pause" }',"*"),jQuery(this)[0].contentWindow.postMessage("pause","*")}),jQuery("#bwg_image_container").find("video").each(function(){jQuery(this).trigger("pause")}),void 0===r&&(r=gallery_box_data.data),void 0!==r[a]&&void 0!==r[e]){if(jQuery(".bwg_play_pause").length&&!jQuery(".bwg_play_pause").hasClass("bwg-icon-play")&&bwg_play(r),t||jQuery("#bwg_current_image_key").val(a),gallery_box_data.bwg_trans_in_progress)return void gallery_box_data.event_stack.push(e+"-"+a);var _="right";if(bwg_current_key>a)_="left";else if(bwg_current_key==a)return;jQuery(".bwg_image_count").html(r[a].number),jQuery(".bwg_watermark").css({display:"none"}),"width"==gallery_box_data.width_or_height?bwg_current_filmstrip_pos=a*(jQuery(".bwg_filmstrip_thumbnail").width()+2+2*gallery_box_data.lightbox_filmstrip_thumb_border_width):"height"==gallery_box_data.width_or_height&&(bwg_current_filmstrip_pos=a*(jQuery(".bwg_filmstrip_thumbnail").height()+2+2*gallery_box_data.lightbox_filmstrip_thumb_border_width)),gallery_box_data.bwg_current_key=a,bwg_objectsL10n.is_pro&&(location.replace("#bwg"+gallery_box_data.gallery_id+"/"+r[a].id),history.replaceState(void 0,void 0,"#bwg"+gallery_box_data.gallery_id+"/"+r[a].id)),jQuery("#bwg_rate_form input[name='image_id']").val(r[a].id),spider_set_input_value("rate_ajax_task","save_hit_count"),spider_rate_ajax_save("bwg_rate_form"),gallery_box_data.popup_enable_rate&&(jQuery("#bwg_star").attr("data-score",r[a].avg_rating),jQuery("#bwg_star").removeAttr("title"),r[a].cur_key=a,bwg_rating(r[a].rate,r[a].rate_count,r[a].avg_rating,a)),jQuery(".bwg_image_hits span").html(++r[a].hit_count),jQuery("#bwg_popup_image").attr("image_id",r[a].id),jQuery(".bwg_image_title").html(jQuery("<span />").html(r[a].alt).text()),jQuery(".bwg_image_description").html(jQuery("<span />").html(r[a].description).text()),jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive"),jQuery("#bwg_filmstrip_thumbnail_"+a).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active"),jQuery(".bwg_image_info").css("opacity",1),""==r[a].alt.trim()&&""==r[a].description.trim()&&jQuery(".bwg_image_info").css("opacity",0),"none"!=jQuery(".bwg_image_info_container1").css("display")?jQuery(".bwg_image_info_container1").css("display","table-cell"):jQuery(".bwg_image_info_container1").css("display","none"),"none"!=jQuery(".bwg_image_rate_container1").css("display")?jQuery(".bwg_image_rate_container1").css("display","table-cell"):jQuery(".bwg_image_rate_container1").css("display","none");var s=2==jQuery(".bwg_popup_image_spun").css("zIndex")?".bwg_popup_image_spun":".bwg_popup_image_second_spun",o=".bwg_popup_image_second_spun"==s?".bwg_popup_image_spun":".bwg_popup_image_second_spun",l=-1<r[a].filetype.indexOf("EMBED_"),n=-1<r[a].filetype.indexOf("INSTAGRAM_POST"),g=-1<r[a].filetype.indexOf("INSTAGRAM_VIDEO"),w=-1!==jQuery.inArray(r[a].filetype,["EMBED_OEMBED_YOUTUBE_VIDEO","EMBED_OEMBED_VIMEO_VIDEO","EMBED_OEMBED_FACEBOOK_VIDEO","EMBED_OEMBED_DAILYMOTION_VIDEO"]),b=jQuery(s).height(),u=jQuery(s).width(),d='<span class="bwg_popup_image_spun1" style="display: '+(l?"block":"table")+'; width: inherit; height: inherit;"><span class="bwg_popup_image_spun2" style="display:'+(l?"block":"table-cell")+'; vertical-align: middle;text-align: center;height: 100%;">';if(l){if(jQuery("#bwg_download").addClass("bwg-hidden"),d+='<span class="bwg_popup_embed bwg_popup_watermark" style="display: '+(w?"block":"table")+'; table-layout: fixed; height: 100%;">'+(g?'<div class="bwg_inst_play_btn_cont" onclick="bwg_play_instagram_video(this)" ><div class="bwg_inst_play"></div></div>':" "),n){var h=jQuery(".instagram-media"),m=jQuery(".bwg_embed_frame"),c=jQuery(".bwg_image_container").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),p=jQuery(".bwg_image_container").height()-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),y=r[a].image_width,f=r[a].image_height,j=bwg_resizing_ratio(y,f,c,p);m.attr("data-width",c),m.attr("data-height",p);var Q=j.width,v=j.height;Q<v?Q-=109:Q+=109,d+=spider_display_embed(r[a].filetype,r[a].image_url,r[a].filename,{class:"bwg_embed_frame","data-width":c,"data-height":p,"data-instagram-width":y,"data-instagram-height":f,style:"width:"+Q+"px; height:"+v+"px; vertical-align:middle; display:inline-block; position:relative;"}),h.css({"max-height":v+"px","min-width":Q+"px !important"})}else d+=spider_display_embed(r[a].filetype,r[a].image_url,r[a].filename,{class:"bwg_embed_frame",frameborder:"0",allowfullscreen:"allowfullscreen",style:"display:"+(w?"block":"table-cell")+"; width:inherit; height:inherit; vertical-align:middle;"});d+="</span>"}else{jQuery(".bwg-loading").removeClass("bwg-hidden"),jQuery("#bwg_download").removeClass("bwg-hidden");var x="'"+(gallery_box_data.site_url+jQuery("<span />").html(decodeURIComponent(r[a].image_url)).text()).split("?bwg")[0]+"'";gallery_box_data.popup_enable_zoom&&(d+='<figure style="max-height: '+b+"px; max-width: "+u+"px; background-image: url("+x+'); background-repeat: no-repeat" class="bwg_popup_image bwg_popup_watermark" alt="'+r[a].alt+'" />'),d+='<img style="max-height: '+b+"px; max-width: "+u+'px;" class="bwg_popup_image bwg_popup_watermark" src="'+gallery_box_data.site_url+jQuery("<span />").html(decodeURIComponent(r[a].image_url)).text()+'" alt="'+r[a].alt+'" />'}function z(){gallery_box_data.preload_images&&bwg_preload_images(a),window["bwg_"+gallery_box_data.bwg_image_effect](s,o,_),jQuery(s).find(".bwg_fb_video").each(function(){jQuery(this).attr("src","")}),l?jQuery("#bwg_fullsize_image").attr("href",decodeURIComponent(r[a].image_url)):(jQuery("#bwg_fullsize_image").attr("href",gallery_box_data.site_url+decodeURIComponent(r[a].image_url)),jQuery("#bwg_download").attr("href",gallery_box_data.site_url+decodeURIComponent(r[a].thumb_url).replace("/thumb/","/.original/")));var e=decodeURIComponent(r[a].image_url).split("/");jQuery("#bwg_download").attr("download",e[e.length-1].replace(/\?bwg=(\d+)$/,""));var t=encodeURIComponent(gallery_box_data.bwg_share_url)+"="+r[a].id+encodeURIComponent("#bwg"+gallery_box_data.gallery_id+"/")+r[a].id;if(l)var i=encodeURIComponent(r[a].thumb_url);else i=gallery_box_data.bwg_share_image_url+encodeURIComponent(encodeURIComponent(r[a].pure_image_url));i=i.replace(/%252F|%25252F/g,"%2F"),void 0!==addthis_share&&(addthis_share.url=t),jQuery("#bwg_facebook_a").attr("href","https://www.facebook.com/sharer/sharer.php?u="+t),jQuery("#bwg_twitter_a").attr("href","https://twitter.com/intent/tweet?url="+t),jQuery("#bwg_pinterest_a").attr("href","http://pinterest.com/pin/create/button/?s=100&url="+t+"&media="+i+"&description="+r[a].alt+"%0A"+r[a].description),jQuery("#bwg_tumblr_a").attr("href","https://www.tumblr.com/share/photo?source="+i+"&caption="+r[a].alt+"&clickthru="+t),jQuery(".bwg_comment_container").hasClass("bwg_open")&&(jQuery(".bwg_comments .mCSB_container").css("top","0"),jQuery("#bwg_added_comments").show(),spider_set_input_value("ajax_task","display"),spider_set_input_value("image_id",jQuery("#bwg_popup_image").attr("image_id")),spider_ajax_save("bwg_comment_form")),jQuery(".bwg_ecommerce_container").hasClass("bwg_open")&&(0==r[a].pricelist?(bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")),bwg_animate_image_box_for_hide_sidebar(),jQuery(".bwg_ecommerce_container").attr("class","bwg_ecommerce_container bwg_close"),jQuery(".bwg_ecommerce").attr("title",bwg_objectsL10n.bwg_show_ecommerce),jQuery(".spider_popup_close_fullscreen").show()):get_ajax_pricelist()),void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".bwg_comments").mCustomScrollbar({advanced:{updateOnContentResize:!0}}),jQuery(".bwg_comments .mCSB_scrollTools").hide(),gallery_box_data.enable_image_filmstrip&&bwg_slideshow_filmstrip_fix_dimension(),bwg_resize_instagram_post()}if(gallery_box_data.popup_enable_zoom?d+="</figure></span></span>":d+="</span></span>",jQuery(o).html(d),jQuery(o).find("img").on("load error",function(){jQuery(".bwg-loading").addClass("bwg-hidden")}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:u,maxHeight:b,height:"auto"}),l)z();else jQuery(o).find("img").one("load",function(){z()}).each(function(){this.complete&&jQuery(this).load()});"undefined"!=typeof instgrm&&void 0!==instgrm.Embeds&&(jQuery(".instagram-media").hide(),instgrm.Embeds.process(),jQuery(".instagram-media").show())}}function bwg_preload_images_lightbox(e){for(var t=gallery_box_data.data,i=t.length,a=0==gallery_box_data.preload_images_count||gallery_box_data.preload_images_count>=i?i:gallery_box_data.preload_images_count,r=0,_=1;r<a;_++){var s=1;do{var o=(e+_*s+i)%i;if(void 0!==t[o])-1<t[o].filetype.indexOf("EMBED_")||jQuery("<img/>").attr("src",gallery_box_data.site_url+jQuery("<span />").html(decodeURIComponent(t[o].image_url)).text());s*=-1,r++}while(1!=s)}}function bwg_popup_sidebar_open(e){var t=gallery_box_data.lightbox_comment_width,i=gallery_box_data.lightbox_comment_pos;if(t>jQuery(window).width()){if(t=jQuery(window).width(),e.css({width:t}),jQuery(".spider_popup_close_fullscreen").hide(),jQuery(".spider_popup_close").hide(),jQuery(".bwg_ctrl_btn").hasClass("bwg-icon-pause")){var a=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase());jQuery(".bwg_play_pause").trigger(a?"touchend":"click")}}else jQuery(".spider_popup_close_fullscreen").show();"left"==i?e.animate({left:0},100):e.animate({right:0},100)}function bwg_comment(){if(jQuery(".bwg_watermark").css({display:"none"}),jQuery(".bwg_ecommerce_wrap").css("z-index","-1"),jQuery(".bwg_comment_wrap").css("z-index","25"),jQuery(".bwg_ecommerce_container").hasClass("bwg_open")&&(bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")),jQuery(".bwg_ecommerce_container").attr("class","bwg_ecommerce_container bwg_close"),jQuery(".bwg_ecommerce").attr("title",bwg_objectsL10n.bwg_show_ecommerce)),jQuery(".bwg_comment_container").hasClass("bwg_open"))"1"==jQuery(".bwg_comment_container").attr("data-play-status")&&jQuery(".bwg_ctrl_btn.bwg_play_pause").removeClass("bwg-icon-play").addClass("bwg-icon-pause").attr("title",bwg_objectsL10n.bwg_pause),bwg_popup_sidebar_close(jQuery(".bwg_comment_container")),bwg_animate_image_box_for_hide_sidebar(),jQuery(".bwg_comment_wrap").css("z-index","-1"),jQuery(".bwg_comment_container").attr("class","bwg_comment_container bwg_close"),jQuery(".bwg_comment").attr("title",bwg_objectsL10n.bwg_show_comments),jQuery(".spider_popup_close_fullscreen").show();else{jQuery(".bwg_play_pause").hasClass("bwg-icon-pause")?jQuery(".bwg_comment_container").attr("data-play-status","1"):jQuery(".bwg_comment_container").attr("data-play-status","0"),jQuery(".bwg_ctrl_btn.bwg_play_pause").removeClass("bwg-icon-pause").addClass("bwg-icon-play").attr("title",bwg_objectsL10n.bwg_play),bwg_popup_sidebar_open(jQuery(".bwg_comment_container")),bwg_animate_image_box_for_show_sidebar(),jQuery(".bwg_comment_container").attr("class","bwg_comment_container bwg_open"),jQuery(".bwg_comment").attr("title",bwg_objectsL10n.bwg_hide_comments);var e=parseInt(jQuery("#bwg_current_image_key").val());void 0!==gallery_box_data.current_image_key&&0!=gallery_box_data.data[e].comment_count&&(jQuery("#bwg_added_comments").show(),spider_set_input_value("ajax_task","display"),spider_set_input_value("image_id",jQuery("#bwg_popup_image").attr("image_id")),spider_ajax_save("bwg_comment_form"))}jQuery(".bwg_comments").mCustomScrollbar("update",{scrollInertia:150,theme:"dark-thick",advanced:{updateOnContentResize:!0}})}function bwg_ecommerce(){jQuery(".bwg_watermark").css({display:"none"}),jQuery(".bwg_ecommerce_wrap").css("z-index","25"),jQuery(".bwg_comment_wrap").css("z-index","-1"),jQuery(".bwg_comment_container").hasClass("bwg_open")&&(bwg_popup_sidebar_close(jQuery(".bwg_comment_container")),jQuery(".bwg_comment_container").attr("class","bwg_comment_container bwg_close"),jQuery(".bwg_comment").attr("title",bwg_objectsL10n.bwg_show_comments)),jQuery(".bwg_ecommerce_container").hasClass("bwg_open")?(bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")),bwg_animate_image_box_for_hide_sidebar(),jQuery(".bwg_ecommerce_container").attr("class","bwg_ecommerce_container bwg_close"),jQuery(".bwg_ecommerce").attr("title",bwg_objectsL10n.bwg_show_ecommerce)):(bwg_popup_sidebar_open(jQuery(".bwg_ecommerce_container")),bwg_animate_image_box_for_show_sidebar(),jQuery(".bwg_ecommerce_container").attr("class","bwg_ecommerce_container bwg_open"),jQuery(".bwg_ecommerce").attr("title",bwg_objectsL10n.bwg_hide_ecommerce),get_ajax_pricelist())}function bwg_popup_sidebar_close(e){var t=parseInt(e.css("borderRightWidth"));t||(t=0),"left"==lightbox_comment_pos?e.animate({left:-e.width()-t},100):"right"==lightbox_comment_pos&&e.animate({right:-e.width()-t},100)}function bwg_animate_image_box_for_hide_sidebar(){"left"==lightbox_comment_pos?jQuery(".bwg_image_wrap").animate({left:0,width:jQuery("#spider_popup_wrap").width()},100):"right"==lightbox_comment_pos&&jQuery(".bwg_image_wrap").animate({right:0,width:jQuery("#spider_popup_wrap").width()},100),jQuery(".bwg_image_container").animate({width:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},100),jQuery(".bwg_popup_image").animate({maxWidth:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},{duration:100,complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_embed").animate({width:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},{duration:100,complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container()}}),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").animate({width:jQuery(".spider_popup_wrap").width()},100),jQuery(".bwg_filmstrip").animate({width:jQuery(".spider_popup_wrap").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},100)):"height"==gallery_box_data.width_or_height&&(jQuery(".bwg_filmstrip_container").animate({height:jQuery(".spider_popup_wrap").width()},100),jQuery(".bwg_filmstrip").animate({height:jQuery(".spider_popup_wrap").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},100)),bwg_set_filmstrip_pos(jQuery(".spider_popup_wrap").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),jQuery(".spider_popup_close_fullscreen").show(100)}function bwg_animate_image_box_for_show_sidebar(){var e=jQuery(".bwg_comment_container").width()||jQuery(".bwg_ecommerce_container").width();"left"==lightbox_comment_pos?jQuery(".bwg_image_wrap").animate({left:e,width:jQuery("#spider_popup_wrap").width()-e},100):"right"==lightbox_comment_pos&&jQuery(".bwg_image_wrap").animate({right:e,width:jQuery("#spider_popup_wrap").width()-e},100),jQuery(".bwg_image_container").animate({width:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e},100),jQuery(".bwg_popup_image").animate({maxWidth:jQuery("#spider_popup_wrap").width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},{duration:100,complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").animate({maxWidth:jQuery("#spider_popup_wrap").width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},{duration:100,complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container()}}),"width"==gallery_box_data.width_or_height&&(jQuery(".bwg_filmstrip_container").css({width:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?0:e)}),jQuery(".bwg_filmstrip").animate({width:jQuery(".bwg_filmstrip_container").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},100),bwg_set_filmstrip_pos(jQuery(".bwg_filmstrip_container").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data))}function bwg_reset_zoom(){var e=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),t=document.querySelector('meta[name="viewport"]');e&&t&&(t.content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0")}function bwg_open_with_fullscreen(){jQuery(".bwg_watermark").css({display:"none"});var e=0;(jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(e=jQuery(".bwg_comment_container").width()||jQuery(".bwg_ecommerce_container").width()),bwg_popup_current_width=jQuery(window).width(),bwg_popup_current_height=window.innerHeight,jQuery("#spider_popup_wrap").css({width:jQuery(window).width(),height:window.innerHeight,left:0,top:0,margin:0,zIndex:100002}),jQuery(".bwg_image_wrap").css({width:jQuery(window).width()-e}),jQuery(".bwg_image_container").css({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)}),jQuery(".bwg_popup_image").css({maxWidth:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_video").css({width:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container()}}),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").css({width:jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)}),jQuery(".bwg_filmstrip").css({width:jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").css({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)}),jQuery(".bwg_filmstrip").css({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)),jQuery(".bwg_resize-full").attr("class","bwg-icon-compress bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_restore),jQuery(".spider_popup_close").attr("class","spider_popup_close_fullscreen")}function bwg_resize_full(){jQuery(".bwg_watermark").css({display:"none"});var e=0;(jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(e=jQuery(".bwg_comment_container").width()||jQuery(".bwg_ecommerce_container").width()),jQuery(".bwg_resize-full").hasClass("bwg-icon-compress")?(jQuery(window).width()>gallery_box_data.image_width&&(bwg_popup_current_width=gallery_box_data.image_width),window.innerHeight>gallery_box_data.image_height&&(bwg_popup_current_height=gallery_box_data.image_height),jQuery("#spider_popup_wrap").animate({width:bwg_popup_current_width,height:bwg_popup_current_height,left:"50%",top:"50%",marginLeft:-bwg_popup_current_width/2,marginTop:-bwg_popup_current_height/2,zIndex:100002},500),jQuery(".bwg_image_wrap").animate({width:bwg_popup_current_width-e},500),jQuery(".bwg_image_container").animate({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},500),jQuery(".bwg_popup_image").animate({maxWidth:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{duration:500,complete:function(){bwg_change_watermark_container(),jQuery("#spider_popup_wrap").width()<jQuery(window).width()&&jQuery("#spider_popup_wrap").height()<window.innerHeight&&jQuery(".spider_popup_close_fullscreen").attr("class","spider_popup_close")}}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").animate({maxWidth:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{duration:500,complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container(),jQuery("#spider_popup_wrap").width()<jQuery(window).width()&&jQuery("#spider_popup_wrap").height()<window.innerHeight&&jQuery(".spider_popup_close_fullscreen").attr("class","spider_popup_close")}}),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").animate({width:bwg_popup_current_width-("horizontal"==gallery_box_data.filmstrip_direction?e:0)},500),jQuery(".bwg_filmstrip").animate({width:bwg_popup_current_width-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(bwg_popup_current_width-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").animate({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?e:0)},500),jQuery(".bwg_filmstrip").animate({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(bwg_popup_current_height-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),"horizontal"!=gallery_box_data.filmstrip_direction&&jQuery(".bwg_filmstrip_right").css({top:bwg_popup_current_height-jQuery(".bwg_filmstrip_right").height()})),jQuery(".bwg_resize-full").attr("class","bwg-icon-expand bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_maximize),setTimeout(function(){bwg_info_height_set()},500)):(bwg_popup_current_width=jQuery(window).width(),bwg_popup_current_height=window.innerHeight,jQuery("#spider_popup_wrap").animate({width:jQuery(window).width(),height:window.innerHeight,left:0,top:0,margin:0,zIndex:100002},500),jQuery(".bwg_image_wrap").animate({width:jQuery(window).width()-e},500),jQuery(".bwg_image_container").animate({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},500),jQuery(".bwg_popup_image").animate({maxWidth:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{duration:500,complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").animate({maxWidth:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{duration:500,complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container()}}),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").animate({width:jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?e:0)},500),jQuery(".bwg_filmstrip").animate({width:jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").animate({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?e:0)},500),jQuery(".bwg_filmstrip").animate({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),"horizontal"!=gallery_box_data.filmstrip_direction&&jQuery(".bwg_filmstrip_right").css({top:window.innerHeight-jQuery(".bwg_filmstrip_right").height()})),jQuery(".bwg_resize-full").attr("class","bwg-icon-compress bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_restore),jQuery(".spider_popup_close").attr("class","spider_popup_close_fullscreen")),setTimeout(function(){bwg_info_height_set()},500)}function bwg_popup_resize_lightbox(){void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&(jQuery.fullscreen.isFullScreen()||(jQuery(".bwg_resize-full").show(),jQuery(".bwg_resize-full").hasClass("bwg-icon-compress")||jQuery(".bwg_resize-full").attr("class","bwg-icon-expand bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_maximize),jQuery(".bwg_fullscreen").attr("class","bwg-icon-arrows-out bwg_ctrl_btn bwg_fullscreen"),jQuery(".bwg_fullscreen").attr("title",bwg_objectsL10n.fullscreen)));var e=0;(jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(e=gallery_box_data.lightbox_comment_width),e>jQuery(window).width()?(e=jQuery(window).width(),jQuery(".bwg_comment_container").css({width:e}),jQuery(".bwg_ecommerce_container").css({width:e}),jQuery(".spider_popup_close_fullscreen").hide()):jQuery(".spider_popup_close_fullscreen").show(),window.innerHeight>gallery_box_data.image_height&&1!=gallery_box_data.open_with_fullscreen&&!jQuery(".bwg_resize-full").hasClass("bwg-icon-compress")?(jQuery("#spider_popup_wrap").css({height:gallery_box_data.image_height,top:"50%",marginTop:-gallery_box_data.image_height/2,zIndex:100002}),jQuery(".bwg_image_container").css({height:gallery_box_data.image_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxHeight:gallery_box_data.image_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxHeight:gallery_box_data.image_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),"vertical"==gallery_box_data.filmstrip_direction&&(jQuery(".bwg_filmstrip_container").css({height:gallery_box_data.image_height}),jQuery(".bwg_filmstrip").css({height:gallery_box_data.image_height-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())})),bwg_popup_current_height=gallery_box_data.image_height):(jQuery("#spider_popup_wrap").css({height:window.innerHeight,top:0,marginTop:0,zIndex:100002}),jQuery(".bwg_image_container").css({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),"vertical"==gallery_box_data.filmstrip_direction&&(jQuery(".bwg_filmstrip_container").css({height:window.innerHeight}),jQuery(".bwg_filmstrip").css({height:window.innerHeight-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())})),bwg_popup_current_height=window.innerHeight),jQuery(window).width()>=gallery_box_data.image_width&&1!=gallery_box_data.open_with_fullscreen?(jQuery("#spider_popup_wrap").css({width:gallery_box_data.image_width,left:"50%",marginLeft:-gallery_box_data.image_width/2,zIndex:100002}),jQuery(".bwg_image_wrap").css({width:gallery_box_data.image_width-e}),jQuery(".bwg_image_container").css({width:gallery_box_data.image_width-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxWidth:gallery_box_data.image_width-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:gallery_box_data.image_width-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),"horizontal"==gallery_box_data.filmstrip_direction&&(jQuery(".bwg_filmstrip_container").css({width:gallery_box_data.image_width-e}),jQuery(".bwg_filmstrip").css({width:gallery_box_data.image_width-e-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())})),bwg_popup_current_width=gallery_box_data.image_width):(jQuery("#spider_popup_wrap").css({width:jQuery(window).width(),left:0,marginLeft:0,zIndex:100002}),jQuery(".bwg_image_wrap").css({width:jQuery(window).width()-e}),jQuery(".bwg_image_container").css({width:jQuery(window).width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),jQuery(".bwg_popup_image").css({maxWidth:jQuery(window).width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:jQuery(window).width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),"horizontal"==gallery_box_data.filmstrip_direction&&(jQuery(".bwg_filmstrip_container").css({width:jQuery(window).width()-e}),jQuery(".bwg_filmstrip").css({width:jQuery(window).width()-e-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())})),bwg_popup_current_width=jQuery(window).width()),bwg_resize_instagram_post(),bwg_change_watermark_container(),1!=gallery_box_data.open_with_fullscreen&&(gallery_box_data.lightbox_close_btn_right<0&&jQuery("#spider_popup_wrap").width()-2*gallery_box_data.lightbox_close_btn_right>=jQuery(window).width()||gallery_box_data.lightbox_close_btn_top<0&&jQuery("#spider_popup_wrap").height()-2*gallery_box_data.lightbox_close_btn_top>=jQuery(window).height()?jQuery(".spider_popup_close").attr("class","spider_popup_close_fullscreen"):jQuery(".spider_popup_close_fullscreen").attr("class","spider_popup_close"));var t=jQuery(".bwg_ctrl_btn_container").height();"bottom"==gallery_box_data.lightbox_ctrl_btn_pos&&jQuery(".bwg_toggle_container i").hasClass("bwg-icon-caret-down")&&jQuery(".bwg_toggle_container").css("bottom",t+"px"),"top"==gallery_box_data.lightbox_ctrl_btn_pos&&jQuery(".bwg_toggle_container i").hasClass("bwg-icon-caret-up")&&jQuery(".bwg_toggle_container").css("top",t+"px")}function bwg_rating(e,t,i,a){lightbox_rate_stars_count=gallery_box_data.lightbox_rate_stars_count,lightbox_rate_size=gallery_box_data.lightbox_rate_size,lightbox_rate_icon=gallery_box_data.lightbox_rate_icon;var r="Not rated yet.";if(0!=i&&""!=i&&(r=parseFloat(i).toFixed(1)+"\n Votes: "+t),void 0!==jQuery().raty&&jQuery.isFunction(jQuery().raty)){var _=parseFloat(jQuery("#bwg_star").attr("data-score"));jQuery("#bwg_star").removeAttr("data-score").html("");var s={starType:"i",number:lightbox_rate_stars_count,size:lightbox_rate_size,noRatedMsg:"Not rated yet.",readOnly:!1,score:_,starHalf:"bwg-icon-"+lightbox_rate_icon+("star"==lightbox_rate_icon?"-half":"")+"-o",starOff:"bwg-icon-"+lightbox_rate_icon+"-o",starOn:"bwg-icon-"+lightbox_rate_icon,cancelOff:"bwg-icon-minus-square-o",cancelOn:"bwg-icon-minus-square-o",cancel:!1,cancelHint:"Cancel your rating.",hints:[r,r,r,r,r],alreadyRatedMsg:parseFloat(i).toFixed(1)+"\nYou have already rated.\nVotes: "+t};e||(s.click=function(e,t){jQuery("#bwg_star").hide(),jQuery("#bwg_rated").show(),spider_set_input_value("rate_ajax_task","save_rate"),jQuery.when(spider_rate_ajax_save("bwg_rate_form",e)).then(function(){gallery_box_data.data[a].rate=e,++gallery_box_data.data[a].rate_count,gallery_box_data.data[a].avg_rating=_?((_+e)/2).toFixed(1):e.toFixed(1),bwg_rating(gallery_box_data.data[a].rate,gallery_box_data.data[a].rate_count,gallery_box_data.data[a].avg_rating,gallery_box_data.current_image_key)})}),jQuery("#bwg_star").raty(s),jQuery(".bwg_image_rate_disabled").hide(),e&&jQuery(".bwg_image_rate_disabled").show()}}function changeDownloadsTotal(e){var t=0;0==jQuery("[name=option_show_digital_items_count]").val()?jQuery("[name=selected_download_item]:checked").each(function(){t+=Number(jQuery(this).closest("tr").attr("data-price"))}):jQuery(".digital_image_count").each(function(){0!=Number(jQuery(this).val())&&(t+=Number(jQuery(this).closest("tr").attr("data-price"))*Number(jQuery(this).val()))}),t=t.toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"),jQuery(".product_downloads_price").html(t)}function changeMenualTotal(e){Number(jQuery(e).val())<=0&&jQuery(e).val("1");var t=Number(jQuery(e).val()),i=Number(jQuery(".product_manual_price").attr("data-actual-price"));i=(i*=t).toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"),jQuery(".product_manual_price").html(i)}function onSelectableParametersChange(e){var t=0,i=gallery_box_data.data[jQuery("#bwg_current_image_key").val()].pricelist_manual_price?gallery_box_data.data[jQuery("#bwg_current_image_key").val()].pricelist_manual_price:"0";i=parseFloat(i.replace(",",""));var a=jQuery(e).closest(".image_selected_parameter").attr("data-parameter-type"),r=jQuery(e).val();r=r.split("*");var _=parseFloat(r[1]),s=r[0],o=Number(jQuery(e).closest(".image_selected_parameter").find(".already_selected_values").val());if("4"==a||"5"==a){var l=parseFloat(s+_);jQuery(e).closest(".image_selected_parameter").find(".already_selected_values").val(l)}else if("6"==a){if(0==jQuery(e).is(":checked"))var n=o-parseFloat(s+_);else n=o+parseFloat(s+_);jQuery(e).closest(".image_selected_parameter").find(".already_selected_values").val(n)}jQuery(".already_selected_values").each(function(){t+=Number(jQuery(this).val())}),i+=t,jQuery(".product_manual_price").attr("data-actual-price",i),i=(i*=Number(jQuery(".image_count").val())<=0?1:Number(jQuery(".image_count").val())).toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"),jQuery(".product_manual_price").html(i)}function onBtnClickAddToCart(){var e=jQuery("[name=type]").val();if(""!=e){var t={};if("manual"==e){var i=jQuery(".image_count").val(),a={};jQuery(".manual").find(".image_selected_parameter").each(function(){var e=jQuery(this).attr("data-parameter-id"),t="";switch(jQuery(this).attr("data-parameter-type")){case"2":t=jQuery(this).find("input").val();break;case"3":t=jQuery(this).find("textarea").val();break;case"4":t=jQuery(this).find("select :selected").val();break;case"5":t=jQuery(this).find("[type=radio]:checked").val();break;case"6":var i=[];jQuery(this).find("[type=checkbox]:checked").each(function(){i.push(jQuery(this).val())}),t=i}a[e]=t}),t.count=i,t.parameters=a,t.price=jQuery(".product_manual_price").attr("data-price").replace(",","")}else{var r=[];if(0==jQuery("[name=option_show_digital_items_count]").val()){if(0==jQuery("[name=selected_download_item]:checked").length)return void jQuery(".add_to_cart_msg").html("You must select at least one item.");jQuery("[name=selected_download_item]:checked").each(function(){var e={};e.id=jQuery(this).val(),e.count=1,e.price=jQuery(this).closest("tr").attr("data-price"),r.push(e)})}else jQuery(".digital_image_count").each(function(){var e={};0<jQuery(this).val()&&(e.id=jQuery(this).closest("tr").attr("data-id"),e.price=jQuery(this).closest("tr").attr("data-price"),e.count=jQuery(this).val(),r.push(e))});if(0==(t.downloadItems=r).length)return void jQuery(".add_to_cart_msg").html("Please select at least one item")}var _=jQuery("#ajax_url").val(),s={action:"add_cart",task:"add_cart",controller:"checkout",image_id:jQuery("#bwg_popup_image").attr("image_id"),type:e,data:JSON.stringify(t)};jQuery.ajax({type:"POST",url:_,data:s,success:function(e){responseData=JSON.parse(e),jQuery(".add_to_cart_msg").html(responseData.msg),jQuery(".products_in_cart").html(responseData.products_in_cart),1==responseData.redirect&&(window.location.href="<?php echo get_permalink($options->checkout_page);?>")},beforeSend:function(){},complete:function(){}})}else jQuery(".add_to_cart_msg").html("Please select Prints and products or Downloads")}function onBtnViewCart(){var e=jQuery("[name=option_checkout_page]").val();jQuery("#bwg_ecommerce_form").attr("action",e),jQuery("#bwg_ecommerce_form").submit()}function bwg_load_visible_images(e,t,i){0<=e-t&&(startPoint=e-t),i<e+t&&(endPoint=i);for(var a=startPoint;a<=endPoint;a++){var r=jQuery("#bwg_filmstrip_thumbnail_"+a+" img");r.removeClass("bwg-hidden"),r.attr("src",r.data("url"))}}function bwg_load_filmstrip(){for(var e=1;e<=total_thumbnail_count;e++){var t;if(leftIndex=startPoint-e,rightIndex=endPoint+e,rightIndex<total_thumbnail_count)(t=jQuery("#bwg_filmstrip_thumbnail_"+rightIndex+" img")).removeClass("bwg-hidden"),t.attr("src",t.data("url"));if(0<=leftIndex)(t=jQuery("#bwg_filmstrip_thumbnail_"+leftIndex+" img")).removeClass("bwg-hidden"),t.attr("src",t.data("url"))}jQuery(".bwg_filmstrip_thumbnail").each(function(){var e=jQuery(this).find("img");void 0===e.attr("style")&&(0==e.width()?e.on("load",function(){jQuery(this).find(".bwg_filmstrip_thumbnail_img_wrap"),bwg_filmstrip_thumb_view(e)}):(jQuery(this).find(".bwg_filmstrip_thumbnail_img_wrap"),bwg_filmstrip_thumb_view(e)))})}function bwg_filmstrip_thumb_view(e){var t=gallery_box_data.image_filmstrip_height,i=gallery_box_data.image_filmstrip_width,a=i-gallery_box_data.filmstrip_thumb_right_left_space,r=t,_=Math.max(i/e.width(),t/e.height()),s=e.width()*_,o=e.height()*_;e.css({width:s,height:o,marginLeft:(a-s)/2,marginTop:(r-o)/2})}function bwg_info_height_set(){bwg_info_position(!1),jQuery(".mCustomScrollBox").length&&jQuery(".bwg_image_info_container1").height()<jQuery(".mCustomScrollBox").height()+jQuery(".bwg_toggle_container").height()+bwg_image_info_pos+2*parseInt(gallery_box_data.lightbox_info_margin)&&jQuery(".bwg_image_info").css({height:jQuery(".bwg_image_info_container1").height()-jQuery(".bwg_toggle_container").height()-bwg_image_info_pos-2*parseInt(gallery_box_data.lightbox_info_margin)})}function bwg_info_position(e){var t=0,i="none";"top"==gallery_box_data.lightbox_ctrl_btn_pos?"top"==gallery_box_data.lightbox_info_pos&&(i="top"):"bottom"==gallery_box_data.lightbox_info_pos&&(i="bottom"),jQuery(".bwg_ctrl_btn_container").hasClass("closed")||("top"==gallery_box_data.lightbox_ctrl_btn_pos?"top"==gallery_box_data.lightbox_info_pos&&(t=jQuery(".bwg_ctrl_btn_container").height()):"bottom"==gallery_box_data.lightbox_info_pos&&(t=jQuery(".bwg_ctrl_btn_container").height())),"top"==i?0==e?jQuery(".bwg_image_info").css("top",t):jQuery(".bwg_image_info").animate({top:t+"px"},500):"bottom"==i&&(0==e?jQuery(".bwg_image_info").css("bottom",t):jQuery(".bwg_image_info").animate({bottom:t+"px"},500))}function spider_display_embed(e,t,i,a){var r="";switch(e){case"EMBED_OEMBED_YOUTUBE_VIDEO":var _="<iframe ";for(attr in""!=i&&(_+=' src="//www.youtube.com/embed/'+i+'?enablejsapi=1&wmode=transparent"'),a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(_+=" "+attr+'="'+a[attr]+'"');r+=_+=" ></iframe>";break;case"EMBED_OEMBED_VIMEO_VIDEO":var s="<iframe ";for(attr in""!=i&&(s+=' src="//player.vimeo.com/video/'+i+'?enablejsapi=1"'),a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(s+=" "+attr+'="'+a[attr]+'"');r+=s+=" ></iframe>";break;case"EMBED_OEMBED_FLICKR_IMAGE":var o="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(o+=" "+attr+'="'+a[attr]+'"');o+=" >",""!=i&&(o+='<img src="'+i+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;">'),r+=o+="</div>";break;case"EMBED_OEMBED_FLICKR_VIDEO":break;case"EMBED_OEMBED_INSTAGRAM_VIDEO":var l="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(l+=" "+attr+'="'+a[attr]+'"');l+=" >",""!=t&&(l+='<video style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls><source src="'+decodeURIComponent(t)+'" type="video/mp4"> Your browser does not support the video tag. </video>'),r+=l+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_IMAGE":var n=a["data-max-width"],g=a["data-max-height"];l="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(l+=" "+attr+'="'+a[attr]+'"');l+=" >",""!=t&&(l+='<img src="'+decodeURIComponent(t)+'" style="max-width:'+n+"px; max-height:"+g+'px; width: auto; height: auto">'),r+=l+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_POST":l="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(l+=" "+attr+'="'+a[attr]+'"',"CLASS"!=attr&&"class"!=attr&&"Class"!=attr||(obj_class=a[attr]));l+=">",""!=t&&(l+='<div class="inner_instagram_iframe_'+obj_class+'" style="max-width: 100% !important; max-height: 100% !important; width: 100%; height: 100%; margin:0; vertical-align:middle;">'+atob(t)+"</div>"),r+=l+="</div>";break;case"EMBED_OEMBED_FACEBOOK_IMAGE":var w="<span ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(w+=" "+attr+'="'+a[attr]+'"');w+=" >",""!=i&&(w+='<img src="'+t+'" style=" max-width:100% !important; max-height:100% !important; width:auto; height:100%;">'),r+=w+="</span>";break;case"EMBED_OEMBED_FACEBOOK_VIDEO":var b="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(b+=" "+attr+'="'+a[attr]+'"');b+=" >",""!=i&&(b+='<iframe src="//www.facebook.com/video/embed?video_id='+t+'&enablejsapi=1&wmode=transparent" style="max-width:100% !important; max-height:100% !important; width:100%; height:100%; margin:0; display:table-cell; vertical-align:middle;"frameborder="0" class="bwg_fb_video" scrolling="no" allowtransparency="false" allowfullscreen></iframe>'),r+=b+="</div>";break;case"EMBED_OEMBED_DAILYMOTION_VIDEO":var u="<iframe ";for(attr in""!=i&&(u+=' src="//www.dailymotion.com/embed/video/'+i+'?api=postMessage"'),a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(u+=" "+attr+'="'+a[attr]+'"');r+=u+=" ></iframe>";break;case"EMBED_OEMBED_IMGUR":var d="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(l+=" "+attr+'="'+a[attr]+'"');d+=" >",""!=i&&(d+='<img src="'+i+'" style="max-width:100% !important; max-height:100% !important; width:auto; height:auto !important;">'),r+=d+="</div>";break;case"EMBED_OEMBED_GOOGLE_PHOTO_IMAGE":var h="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(h+=" "+attr+'="'+a[attr]+'"');h+=" >",""!=i&&(h+='<img src="'+t+'" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">'),r+=h+="</div>";break;default:var m={content:""};jQuery(document).trigger("bwg_display_embed",[m,e,t,i,a]),r=m.content}return r}function bwg_add_instagram_gallery(e,s){if(!0===(s=void 0!==s&&s)){if(bwg_check_instagram_gallery_input(e,s))return!1;var t="0";1==jQuery("input[name=popup_instagram_post_gallery]:checked").val()&&(t="1");var i=encodeURI(jQuery("#popup_instagram_gallery_source").val()),a=encodeURI(jQuery("#popup_instagram_image_number").val())}else{if(bwg_check_instagram_gallery_input(e,s))return!1;if(!bwg_check_gallery_empty(!1,!0))return!1;t="0";1==jQuery("input[name=instagram_post_gallery]:checked").val()&&(t="1");i=encodeURI(jQuery("#gallery_source").val());var r=jQuery("input[name=update_flag]:checked").val();a=encodeURI(jQuery("#autogallery_image_number").val())}jQuery("#bulk_embed").hide(),jQuery("#loading_div").show();var o=[],_={action:"addInstagramGallery",instagram_user:i,instagram_access_token:e,whole_post:t,autogallery_image_number:a,update_flag:r,async:!0};jQuery.post(bwg_ajax_url_nonce,_,function(e){if(0==e)return alert("Error: cannot get response from the server."),jQuery("#loading_div").hide(),s&&jQuery("#bulk_embed").show(),!1;var t=e.indexOf("WD_delimiter_start"),i=e.indexOf("WD_delimiter_end");if(-1==t||-1==i)return jQuery("#loading_div").hide(),s&&jQuery("#bulk_embed").show(),!1;if(e=e.substring(t+18,i),response_JSON=JSON.parse(e),response_JSON){if("error"==response_JSON[0])return alert("Error: "+JSON.parse(e)[1]),jQuery("#loading_div").hide(),s&&jQuery("#bulk_embed").show(),!1;for(var a=response_JSON.length,r=1;r<=a;r++)if(0!=response_JSON[a-r]){var _=response_JSON[a-r];o.push(_)}return bwg_add_image(o),s||(bwg_gallery_update_flag(),jQuery("#tr_instagram_gallery_add_button").hide()),jQuery("#loading_div").hide(),s&&jQuery(".opacity_bulk_embed").hide(),"ok"}return alert("There is some error. Cannot add Instagram gallery."),jQuery("#loading_div").hide(),s&&jQuery("#bulk_embed").show(),!1})}var bwg=0,isMobile=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),bwg_click=isMobile?"touchend":"click",bwg_slideshow_filmstrip_thumbnail_timer=!1;window.bwg_slideshow_filmstrip_thumb={};var bwg_params=[],bwg_params_ib=[],bwg_params_carousel=[];function bwg_remove_lazy_loader_icon(){1==bwg_objectsL10n.lazy_load&&jQuery("img.bwg_lazyload").Lazy({afterLoad:function(){jQuery(".lazy_loader").removeClass("lazy_loader")},onFinishedAll:function(){jQuery(".lazy_loader").removeClass("lazy_loader")}})}function bwg_main_ready(e){var t=e.data("bwg");bwg_remove_lazy_loader_icon(),0<e.find(".wd_error").length&&bwg_container_loaded(t);var i=e.find(".bwg-container");if("album"===e.data("is-album")&&i.hasClass("bwg-thumbnails"))var a="thumbnails";else a=e.data("gallery-type");switch(bwg_document_ready(e),a){case"thumbnails":case"thumbnails_masonry":case"album_compact_preview":case"album_masonry_preview":case"album_extended_preview":bwg_all_thumnails_loaded(i);break;case"thumbnails_mosaic":bwg_thumbnail_mosaic(i);break;case"slideshow":bwg_slideshow_ready(t);break;case"carousel":bwg_carousel_ready(t),bwg_carousel_onload(e);break;case"image_browser":bwg_image_browser_ready(e);break;case"blog_style":bwg_blog_style_ready(e)}}function bwg_resize_search_line(){jQuery(".search_line").each(function(){var e=jQuery(this);e.width()<410?e.addClass("bwg-search-line-responsive"):e.removeClass("bwg-search-line-responsive")})}function bwg_tags_button_section_visibility(){jQuery('div[id^="bwg_container1_"]').each(function(){var e=jQuery(this),t=e.find(".current_view").val(),i=e.find(".show_bottom_tag").val(),a=e.find(".bwg_tags_container_"+t+" .bwg_tag_button_view_container");if(a.length)var r=a[0].scrollHeight;var _=a.find(".bwg_tags_filter_buttons").outerHeight(!0),s=parseInt(2*a.find(".bwg_tags_filter_buttons").outerHeight(!0)+3);s<r?(0===jQuery(this).find(".see_all_tags.bwg_hide").length&&a.css({"min-height":_,"max-height":s,overflow:"hidden"}),a.next(".bwg_tag_button_see_all").show()):(a.css({"min-height":"auto","max-height":"100%",height:"auto",overflow:"visible"}),a.next(".bwg_tag_button_see_all").hide());var o=a.next().find(".see_all_tags").width()/2;a.next().find(".see_all_tags").attr("style","margin-left: -"+o+"px"),a.next().find(".see_all_tags").off("click").on("click",function(){jQuery(this).hasClass("bwg_show")?(jQuery(this).removeClass("bwg_show").addClass("bwg_hide").html("<span>−</span>"+bwg_objectsL10n.bwg_tag_see_less),a.css({"min-height":"auto","max-height":"100%",height:"auto",overflow:"visible"})):jQuery(this).hasClass("bwg_hide")&&(jQuery(this).removeClass("bwg_hide").addClass("bwg_show").html("<span>+</span>"+bwg_objectsL10n.bwg_tag_see_all),a.css({"min-height":_,"max-height":s,overflow:"hidden"}))}),1==i&&(jQuery(this).find(".see_all_tags").removeClass("bwg_show").addClass("bwg_hide").html("<span>−</span>"+bwg_objectsL10n.bwg_tag_see_less),a.css({"min-height":"auto","max-height":"100%",height:"auto",overflow:"visible"}))})}function bwg_slideshow_resize(){jQuery(".bwg_slideshow").each(function(){bwg=jQuery(this).attr("data-bwg"),jQuery("#bwg_slideshow_image_container_"+bwg).length&&(bwg_params[bwg]=JSON.parse(jQuery("#bwg_slideshow_image_container_"+bwg).attr("data-params")),bwg_params[bwg].event_stack=[],bwg_popup_resize(bwg))})}function bwg_blog_style_resize(){jQuery(".bwg_blog_style").each(function(){bwg=jQuery(this).attr("data-bwg"),jQuery(".bwg_embed_frame_16x9_"+bwg).each(function(e){jQuery(this).width(jQuery(this).parent().width()),jQuery(this).height(.5625*jQuery(this).width())}),jQuery(".bwg_embed_frame_instapost_"+bwg).each(function(e){jQuery(this).width(jQuery(this).parent().width()),jQuery(this).height((jQuery(this).width()-16)*jQuery(this).attr("data-height")/jQuery(this).attr("data-width")+96)})})}function bwg_blog_style_onload(){jQuery(".bwg_blog_style").each(function(){bwg=jQuery(this).attr("data-bwg");jQuery("#bwg_blog_style_"+bwg);jQuery(".bwg_embed_frame_16x9_"+bwg).each(function(e){if(jQuery(".bwg_blog_style_image_"+bwg).find(".fluid-width-video-wrapper").length){jQuery(".fluid-width-video-wrapper").removeAttr("style");var t=jQuery(this).parents(".bwg_blog_style_image_"+bwg).find(".fluid-width-video-wrapper").contents();jQuery(this).parents(".fluid-width-video-wrapper").replaceWith(t)}jQuery(this).width(jQuery(this).parents(".bwg_blog_style_image_"+bwg).width()),jQuery(this).height(.5625*jQuery(this).width())}),jQuery(".bwg_embed_frame_instapost_"+bwg).each(function(e){jQuery(this).width(jQuery(this).parents(".bwg_blog_style_image_"+bwg).width()),jQuery(this).height((jQuery(this).width()-16)*jQuery(this).attr("data-height")/jQuery(this).attr("data-width")+96)}),bwg_container_loaded(bwg)})}function bwg_blog_style_ready(t){var e=t.data("bwg");bwg_container_loaded(e);var i=!1;t.find(".bwg_lightbox_"+e).on("click",function(){var e=jQuery(this).attr("data-image-id");if(jQuery("#bwg_blog_style_share_buttons_"+e).removeAttr("data-open-comment"),!i)return i=!0,setTimeout(function(){i=!1},100),bwg_gallery_box(e,t.closest(".bwg_container")),!1}),jQuery(".bwg_lightbox_"+e+" .bwg_ecommerce").on("click",function(e){if(e.stopPropagation(),!i)return i=!0,setTimeout(function(){i=!1},100),bwg_gallery_box(t.attr("data-image-id"),t.closest(".bwg_container"),!0),!1});var a=window.location.hash.substring(1);a&&"-1"!=a.indexOf("bwg")&&(bwg_hash_array=a.replace("bwg","").split("/"),"<?php echo $params_array['gallery_id']; ?>"==bwg_hash_array[0]&&bwg_gallery_box(bwg_hash_array[1]))}function bwg_slideshow_focus(){jQuery(".bwg_slideshow").each(function(){bwg=jQuery(this).data("bwg"),jQuery(".bwg_slideshow[data-bwg="+bwg+"]")[0].offsetHeight&&jQuery("#bwg_slideshow_image_container_"+bwg).length&&(bwg_params[bwg]=JSON.parse(jQuery("#bwg_slideshow_image_container_"+bwg).attr("data-params")),bwg_params[bwg].event_stack=[],window.clearInterval(window["bwg_playInterval"+bwg]),jQuery(".bwg_ctrl_btn_"+bwg).hasClass("bwg-icon-play")||bwg_play(bwg_params[bwg].data,bwg))})}function bwg_carousel_focus(){jQuery(".bwg_carousel").each(function(){bwg=jQuery(this).data("bwg"),jQuery(".bwg_carousel[data-bwg="+bwg+"]")[0].offsetHeight&&jQuery(".bwg_carousel_image_container_"+bwg).length&&jQuery(".bwg_ctrl_btn_"+bwg).hasClass("bwg-icon-pause")&&bwg_params_carousel[bwg].carousel.start()})}function bwg_slideshow_blur(e){jQuery(".bwg_slideshow").each(function(){bwg=jQuery(this).data("bwg"),!e&&jQuery(".bwg_slideshow[data-bwg="+bwg+"]")[0].offsetHeight||jQuery("#bwg_slideshow_image_container_"+bwg).length&&(bwg_params[bwg]=JSON.parse(jQuery("#bwg_slideshow_image_container_"+bwg).attr("data-params")),bwg_params[bwg].event_stack=[],window.clearInterval(window["bwg_playInterval"+bwg]))})}function bwg_carousel_blur(e){jQuery(".bwg_carousel").each(function(){bwg=jQuery(this).data("bwg"),!e&&jQuery(".bwg_carousel[data-bwg="+bwg+"]")[0].offsetHeight||jQuery(".bwg_carousel_image_container_"+bwg).length&&void 0!==bwg_params_carousel[bwg]&&bwg_params_carousel[bwg].carousel.pause()})}function bwg_carousel_ready(t){bwg_params_carousel[t]=[],bwg_params_carousel[t].bwg_currentCenterNum=1,bwg_params_carousel[t].bwg_currentlyMoving=!1,bwg_params_carousel[t].data=[],jQuery("#spider_carousel_left-ico_"+t).on("click",function(e){bwg_params_carousel[t].carousel.prev(),e.stopPropagation(),e.stopImmediatePropagation()}),jQuery("#spider_carousel_right-ico_"+t).on("click",function(e){bwg_params_carousel[t].carousel.next(),e.stopPropagation(),e.stopImmediatePropagation()}),parseInt(bwg_params_carousel[t].carousel_enable_autoplay)&&(jQuery(".bwg_carousel_play_pause_"+t).attr("title",bwg_objectsL10n.pause),jQuery(".bwg_carousel_play_pause_"+t).attr("class","bwg-icon-pause bwg_ctrl_btn_"+t+" bwg_carousel_play_pause_"+t)),jQuery(".bwg_carousel_play_pause_"+t).on(bwg_click,function(e){jQuery(".bwg_ctrl_btn_"+t).hasClass("bwg-icon-play")?(jQuery(".bwg_carousel_play_pause_"+t).attr("title",bwg_objectsL10n.pause),jQuery(".bwg_carousel_play_pause_"+t).attr("class","bwg-icon-pause bwg_ctrl_btn_"+t+" bwg_carousel_play_pause_"+t),bwg_params_carousel[t].carousel.start()):(jQuery(".bwg_carousel_play_pause_"+t).attr("title",bwg_objectsL10n.play),jQuery(".bwg_carousel_play_pause_"+t).attr("class","bwg-icon-play bwg_ctrl_btn_"+t+" bwg_carousel_play_pause_"+t),bwg_params_carousel[t].carousel.pause()),e.stopPropagation(),e.stopImmediatePropagation()}),void 0!==jQuery().swiperight&&jQuery.isFunction(jQuery().swiperight)&&jQuery("#bwg_container1_"+t).swiperight(function(){bwg_params_carousel[t].carousel.prev()}),void 0!==jQuery().swipeleft&&jQuery.isFunction(jQuery().swipeleft)&&jQuery("#bwg_container1_"+t).swipeleft(function(){bwg_params_carousel[t].carousel.next()})}function bwg_carousel_resize(){jQuery(".bwg-carousel").each(function(){var e=jQuery(this).data("bwg");jQuery("#bwg_carousel-container"+e).length&&(bwg_carousel_params(e,!0),bwg_params_carousel[e].carousel.pause(),bwg_carousel_watermark(e),jQuery(".bwg_ctrl_btn_"+e).hasClass("bwg-icon-play")||bwg_params_carousel[e].carousel.start())})}function bwg_carousel_onload(e){var t=e.data("bwg"),i=e.find(".bwg_carousel-container"+t);i.length&&(bwg_params_carousel[t]=i.data("params"),bwg_params_carousel[t].parent_width=0,bwg_carousel_watermark(t),bwg_carousel_params(t,!1),bwg_container_loaded(t))}function bwg_carousel_params(t,e){var i=jQuery("#bwg_container1_"+t).parent();i.hasClass("elementor-tab-content")&&i.width(i.closest(".elementor-widget-wrap").width());var a=i.width(),r=1;a<bwg_params_carousel[t].carousel_r_width?r=a/bwg_params_carousel[t].carousel_r_width:a=bwg_params_carousel[t].carousel_r_width,bwg_params_carousel[t].parent_width!=a&&(bwg_params_carousel[t].parent_width=a,bwg_params_carousel[t].carousel_image_column_number>bwg_params_carousel[t].count&&(bwg_params_carousel[t].carousel_image_column_number=bwg_params_carousel[t].count),jQuery(".bwg_carousel_play_pause_"+t).css({display:parseInt(bwg_params_carousel[t].carousel_play_pause_butt)?"":"none"}),parseInt(bwg_params_carousel[t].carousel_prev_next_butt)?(jQuery("#bwg_carousel-right"+t).css({display:""}),jQuery("#bwg_carousel-left"+t).css({display:""})):(jQuery("#bwg_carousel-left"+t).css({display:"none"}),jQuery("#bwg_carousel-right"+t).css({display:"none"})),jQuery(".inner_instagram_iframe_bwg_embed_frame_"+t).each(function(){var e=jQuery(this).parent();bwg_params_carousel[t].image_height/(parseInt(e.attr("data-height"))+96)<bwg_params_carousel[t].image_width/parseInt(e.attr("data-width"))?(e.height(bwg_params_carousel[t].image_height*r),e.width((e.height()-96)*e.attr("data-width")/e.attr("data-height")+16)):(e.width(bwg_params_carousel[t].image_width*r),e.height((e.width()-16)*e.attr("data-height")/e.attr("data-width")+96))}),jQuery(".bwg_carousel_image_container_"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel_watermark_text_"+t+", .bwg_carousel_watermark_text_"+t+":hover").css({fontSize:a*(bwg_params_carousel[t].watermark_font_size/bwg_params_carousel[t].image_width)*r}),jQuery(".bwg_carousel-image "+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel_watermark_container_"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel_embed_video_"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel_watermark_spun_"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel-container"+t).css({width:a,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_video_hide"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),bwg_params_carousel[t].carousel&&!e||(e&&bwg_params_carousel[t].carousel&&bwg_params_carousel[t].carousel.pause(),bwg_params_carousel[t].carousel=jQuery("#bwg_carousel"+t).featureCarousel({containerWidth:a*r,containerHeight:bwg_params_carousel[t].image_height*r,fit_containerWidth:bwg_params_carousel[t].carousel_fit_containerWidth,largeFeatureWidth:bwg_params_carousel[t].image_width*r,largeFeatureHeight:bwg_params_carousel[t].image_height*r,smallFeaturePar:bwg_params_carousel[t].carousel_image_par,currentlyMoving:!1,startingFeature:bwg_params_carousel[t].bwg_currentCenterNum,featuresArray:[],timeoutVar:null,rotationsRemaining:0,autoPlay:1e3*bwg_params_carousel[t].car_inter,interval:1e3*bwg_params_carousel[t].carousel_interval,imagecount:bwg_params_carousel[t].carousel_image_column_number,bwg_number:t,enable_image_title:bwg_params_carousel[t].enable_image_title,borderWidth:0})))}function bwg_carousel_watermark(e){var t=1,i=jQuery("#bwg_container1_"+e).parent().width();if(i<bwg_params_carousel[e].carousel_r_width&&(t=i/bwg_params_carousel[e].carousel_r_width),i>=bwg_params_carousel[e].image_width)bwg_carousel_change_watermark_container(e),jQuery("#bwg_carousel_play_pause-ico_"+e).css({fontSize:bwg_params_carousel[e].carousel_play_pause_btn_size}),jQuery(".bwg_carousel_watermark_image_"+e).css({maxWidth:bwg_params_carousel[e].watermark_width*t,maxHeight:bwg_params_carousel[e].watermark_height*t}),jQuery(".bwg_carousel_watermark_text_"+e+", .bwg_carousel_watermark_text_"+e+":hover").css({fontSize:t*bwg_params_carousel[e].watermark_font_size});else{var a=bwg_params_carousel[e].image_width/t;bwg_carousel_change_watermark_container(e),jQuery(".bwg_carousel_watermark_image_"+e).css({maxWidth:i*bwg_params_carousel[e].watermark_width/a,maxHeight:i*bwg_params_carousel[e].watermark_height/a}),jQuery(".bwg_carousel_watermark_text_"+e+", .bwg_carousel_watermark_text_"+e+":hover").css({fontSize:i*bwg_params_carousel[e].watermark_font_size/a})}}function bwg_carousel_change_watermark_container(a){jQuery(".bwg_carousel"+a).children().each(function(){if(2==jQuery(this).css("zIndex")){var e=jQuery(this).find("img");e.length||(e=jQuery(this).find("iframe"));var t=e.width(),i=e.height();jQuery(".bwg_carousel_watermark_spun_"+a).width(t),jQuery(".bwg_carousel_watermark_spun_"+a).height(i),jQuery(".bwg_carousel_title_spun_"+a).width(t),jQuery(".bwg_carouel_title_spun_"+a).height(i),jQuery(".bwg_carousel_watermark_"+a).css({display:"none"})}})}function bwg_carousel_preload(e,t){var i=jQuery(".bwg_carousel_preload").get();t||i.reverse();var a=0;jQuery(i).each(function(){if(1<++a)return!1;jQuery(this).parent().hasClass("bwg_carousel_embed_video_"+e)||jQuery(this).parent().hasClass("bwg_embed_frame_"+e)||jQuery(this).parent().hasClass("bwg_carousel_video")?(jQuery(this).attr("src",jQuery(this).attr("data-src")),jQuery(this).on("load",function(){jQuery(this).removeClass("bwg_carousel_preload")}),jQuery(this).parent().hasClass("bwg_carousel_video")&&(jQuery(".bwg_carousel_video")[0].load(),jQuery(this).parent().parent().removeClass("bwg_carousel_preload")),jQuery(this).removeAttr("data-src")):(jQuery(this).css({"background-image":"url('"+jQuery(this).attr("data-background")+"')",height:"100%"}),jQuery(this).removeClass("bwg_carousel_preload"),jQuery(this).removeAttr("data-background"))})}function bwg_slideshow_ready(i){if(jQuery("#bwg_slideshow_image_container_"+i).length){bwg_params[i]=JSON.parse(jQuery("#bwg_slideshow_image_container_"+i).attr("data-params")),bwg_params[i].event_stack=[];var e=".bwg_slideshow_filmstrip_"+i,t="bwg_slideshow_filmstrip_thumbnail_"+i;bwg_slideshow_filmstrip_thumb[t]={},bwg_slideshow_filmstrip_thumb[t].next_prev_index=0;var a=!1;2==bwg_params[i].slideshow_filmstrip_type&&(a=!0,e=".bwg_slideshow_filmstrip_fix_count_"+i),bwg_container_loaded(i);var r=bwg_params[i].data;void 0!==jQuery().swiperight&&jQuery.isFunction(jQuery().swiperight)&&jQuery("#bwg_container1_"+i).swiperight(function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key_"+i).val()),0<=parseInt(jQuery("#bwg_current_image_key_"+i).val())-bwg_iterator(i)?(parseInt(jQuery("#bwg_current_image_key_"+i).val())-bwg_iterator(i))%r.length:r.length-1,r,"",i),!1}),void 0!==jQuery().swipeleft&&jQuery.isFunction(jQuery().swipeleft)&&jQuery("#bwg_container1_"+i).swipeleft(function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key_"+i).val()),parseInt(jQuery("#bwg_current_image_key_"+i).val())+bwg_iterator(i)%r.length,r,"",i),!1});var _=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())?"touchend":"click";bwg_popup_resize(i),jQuery(".bwg_slideshow_watermark_"+i).css({display:"none"}),jQuery(".bwg_slideshow_title_text_"+i).css({display:"none"}),jQuery(".bwg_slideshow_description_text_"+i).css({display:"none"}),setTimeout(function(){bwg_change_watermark_container(i)},500),1==bwg_params[i].slideshow_filmstrip_type&&("horizontal"==bwg_params[i].filmstrip_direction?jQuery(".bwg_slideshow_image_container_"+i).height(jQuery(".bwg_slideshow_image_wrap_"+i).height()-bwg_params[i].slideshow_filmstrip_height):jQuery(".bwg_slideshow_image_container_"+i).width(jQuery(".bwg_slideshow_image_wrap_"+i).width()-bwg_params[i].slideshow_filmstrip_width));var s=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";jQuery(e).bind(s,function(e){var t=window.event||e;return 0<((t=t.originalEvent?t.originalEvent:t).detail?-40*t.detail:t.wheelDelta)?jQuery(".bwg_slideshow_filmstrip_left_"+i).trigger("click"):jQuery(".bwg_slideshow_filmstrip_right_"+i).trigger("click"),!1});var o={bwg:i,params:bwg_params[i],slideshow_filmstrip_class_name:e};if(jQuery(".bwg_slideshow_filmstrip_right_"+i).on(_,function(){1==a?!1===bwg_slideshow_filmstrip_thumbnail_timer&&(bwg_slideshow_filmstrip_thumbnail_timer=!0,bwg_slideshow_filmstrip_next(o),setTimeout(function(){bwg_slideshow_filmstrip_thumbnail_timer=!1},505)):bwg_slideshow_filmstrip_next(o)}),jQuery(".bwg_slideshow_filmstrip_left_"+i).on(_,function(){1==a?!1===bwg_slideshow_filmstrip_thumbnail_timer&&(bwg_slideshow_filmstrip_thumbnail_timer=!0,bwg_slideshow_filmstrip_prev(o),setTimeout(function(){bwg_slideshow_filmstrip_thumbnail_timer=!1},505)):bwg_slideshow_filmstrip_prev(o)}),"width"==bwg_params[i].width_or_height?bwg_set_filmstrip_pos(jQuery(e).width(),i):bwg_set_filmstrip_pos(jQuery(e).height(),i),jQuery("#bwg_slideshow_play_pause_"+i).off(_).on(_,function(){jQuery(".bwg_ctrl_btn_"+i).hasClass("bwg-icon-play")?(bwg_play(bwg_params[i].data,i),jQuery(".bwg_slideshow_play_pause_"+i).attr("title",bwg_objectsL10n.pause),jQuery(".bwg_slideshow_play_pause_"+i).attr("class","bwg-icon-pause bwg_ctrl_btn_"+i+" bwg_slideshow_play_pause_"+i),1==bwg_params[i].enable_slideshow_music&&document.getElementById("bwg_audio_"+i).play()):(window.clearInterval(window["bwg_playInterval"+i]),jQuery(".bwg_slideshow_play_pause_"+i).attr("title","Play"),jQuery(".bwg_slideshow_play_pause_"+i).attr("class","bwg-icon-play bwg_ctrl_btn_"+i+" bwg_slideshow_play_pause_"+i),1==bwg_params[i].enable_slideshow_music&&document.getElementById("bwg_audio_"+i).pause())}),0!=bwg_params[i].enable_slideshow_autoplay&&(bwg_play(bwg_params[i].data,i),jQuery(".bwg_slideshow_play_pause_"+i).attr("title",bwg_objectsL10n.pause),jQuery(".bwg_slideshow_play_pause_"+i).attr("class","bwg-icon-pause bwg_ctrl_btn_"+i+" bwg_slideshow_play_pause_"+i),1==bwg_params[i].enable_slideshow_music&&jQuery("#bwg_audio_"+i).length&&document.getElementById("bwg_audio_"+i).play()),bwg_params[i].preload_images&&bwg_preload_images(parseInt(jQuery("#bwg_current_image_key_".$bwg).val()),i),jQuery(".bwg_slideshow_image_"+i).removeAttr("width"),jQuery(".bwg_slideshow_image_"+i).removeAttr("height"),"undefined"!=typeof instgrm&&void 0!==instgrm.Embeds){var l=jQuery("#instagram-embed-"+i),n=jQuery(".bwg_embed_frame_"+i).data("height");l.hide(),instgrm.Embeds.process(),l.css({"max-height":n+"px"}).show()}}}function bwg_image_browser_resize(){jQuery(".bwg_image_browser").each(function(){var e=jQuery(this).attr("data-bwg");jQuery(".image_browser_images_conteiner_"+e).length&&(bwg_params_ib[e]=JSON.parse(jQuery("#bwg_container1_"+e+" .image_browser_images_conteiner_"+e).attr("data-params")),bwg_image_browser(e))})}function bwg_image_browser_ready(e){var t=e.data("bwg");bwg_container_loaded(t),jQuery(".image_browser_images_conteiner_"+t).length&&(bwg_params_ib[t]=JSON.parse(jQuery(".image_browser_images_conteiner_"+t).attr("data-params")),setTimeout(function(){bwg_image_browser(t)},3))}function bwg_search_focus(e){jQuery(e).parent().find(".bwg_search_input").focus(),jQuery(e).hide()}function bwg_key_press(e){jQuery(e).parent().find(".bwg_search_reset_container").removeClass("bwg-hidden"),jQuery(e).parent().find(".bwg_search_loupe_container1").removeClass("bwg-hidden")}function bwg_all_thumnails_loaded(t){var i=0,a=jQuery(t).find("img").length;return 0==a?bwg_all_thumbnails_loaded_callback(t):jQuery(t).find("img").each(function(){var e=jQuery(this).attr("src");jQuery("<img/>").attr("src",e).on("load error",function(){++i>=a&&bwg_all_thumbnails_loaded_callback(t)})}),jQuery(".bwg_container").each(function(){var e=jQuery(this).data("bwg");0<jQuery(this).find(".wd_error").length&&bwg_container_loaded(e)}),0==a}function bwg_all_thumbnails_loaded_callback(e){jQuery(e).hasClass("bwg-thumbnails")&&!jQuery(e).hasClass("bwg-masonry-thumbnails")&&bwg_thumbnail(e),jQuery(e).hasClass("bwg-masonry-thumbnails")&&bwg_thumbnail_masonry(e),jQuery(e).hasClass("bwg-album-extended")&&bwg_album_extended(e)}function bwg_album_thumbnail(e){bwg_container_loaded(jQuery(e).data("bwg"))}function bwg_album_extended(e){var t=jQuery(e).width(),i=jQuery(e).data("thumbnail-width"),a=jQuery(e).data("spacing"),r=jQuery(e).data("max-count"),_=parseInt(t/(2*i));_<1&&(_=1),r<_&&(_=r);var s=100/_,o=jQuery(e).find(".bwg-extended-item"),l=parseInt(o.css("margin-left")),n=parseInt(o.css("margin-right"));o.css({width:"calc("+s+"% - "+(l+n)+"px)"}),o.width()<i?o.find(".bwg-extended-item0, .bwg-extended-item1").css({width:"calc(100% - "+a+"px)"}):o.width()>2*i?(o.find(".bwg-extended-item0").css({width:"calc(50% - "+a+"px)"}),o.find(".bwg-extended-item1").css({width:"calc(100% - "+(i+2*a)+"px)"})):o.find(".bwg-extended-item0, .bwg-extended-item1").css({width:"calc(50% - "+a+"px)"}),jQuery(e).children(".bwg-extended-item").each(function(){var e=jQuery(this).find("img"),t=jQuery(this).find(".bwg-item0"),i=jQuery(this).find(".bwg-item2"),a=e.data("width"),r=e.data("height");""!=a&&""!=r||(a=e.width(),r=e.height());var _=a/r;i.width()/i.height()>a/r?(i.width()>a?e.css({width:"100%",height:i.width()/_}):e.css({maxWidth:"100%",height:i.width()/_}),a=i.width(),r=i.width()/_):(i.height()>r?e.css({height:"100%",width:i.height()*_,maxWidth:"initial"}):e.css({maxHeight:"100%",width:i.height()*_,maxWidth:"initial"}),r=i.height(),a=i.height()*_),jQuery(this).find(".bwg-item2").css({marginLeft:(t.width()-a)/2,marginTop:(t.height()-r)/2})}),bwg_container_loaded(jQuery(e).data("bwg"))}function bwg_thumbnail(e){var t=jQuery(e).width(),i=jQuery(e).data("thumbnail-width"),a=jQuery(e).data("max-count"),r=parseInt(t/i)+1;a<r&&(r=a);var _=100/r;jQuery(e).find(".bwg-item").css({width:_+"%"}),jQuery(e).children(".bwg-item").each(function(){var e=jQuery(this).find("img"),t=jQuery(this).find(".bwg-item2"),i=jQuery(this).find(".bwg-item1"),a=0<t.width()?t.width():i.width(),r=0<t.height()?t.height():i.height(),_=e.data("width"),s=e.data("height");""!=_&&""!=s&&void 0!==_&&void 0!==s||(_=e.width(),s=e.height());var o=_/s;e.removeAttr("style"),o<a/r?(_<a?e.css({width:"100%",height:a/o}):e.css({maxWidth:"100%",height:Math.ceil(a/o)}),s=(_=a)/o):(r>e.height()?e.css({height:"100%",width:r*o,maxWidth:"initial"}):e.css({maxHeight:"100%",width:r*o,maxWidth:"initial"}),_=(s=r)*o),jQuery(this).find(".bwg-item2").css({marginLeft:(a-_)/2,marginTop:(r-s)/2})}),bwg_container_loaded(jQuery(e).data("bwg"))}function bwg_thumbnail_masonry(e){var t="#bwg_thumbnails_masonry_"+(bwg=jQuery(e).attr("data-bwg"));jQuery("#bwg_album_masonry_"+bwg).length&&(t="#bwg_album_masonry_"+bwg),0===jQuery(".bwg-container-temp"+bwg).length&&(jQuery(t).clone().appendTo("#bwg_container3_"+bwg).removeAttr("id").removeClass("bwg-container-"+bwg).addClass("bwg-container-temp"+bwg),jQuery(".bwg-container-temp"+bwg).empty());var a=jQuery(".bwg-container-temp"+bwg),r=jQuery(t),_=a;if(a.prepend(r.html()),_.find(".bwg-empty-item").remove(),"horizontal"==_.data("masonry-type")){var s=_.data("thumbnail-height"),o=_.data("max-count"),l=[];for(i=0;i<o;i++)l.push(0);_.find(".bwg-item").each(function(){var e=l.indexOf(Math.min.apply(Math,l));jQuery(this).css({height:s,order:e+1}),l[e]+=jQuery(this)[0].getBoundingClientRect().width});var n=Math.max.apply(Math,l);for(_.width(n),i=0;i<o;i++)l[i]<n&&_.append(jQuery('<div class="bwg-item bwg-empty-item"></div>').css({height:s,order:i+1,width:n-l[i]}))}else{_.removeAttr("style");n=_.width();var g=_.data("thumbnail-width"),w=_.data("thumbnail-border"),b=(_.data("thumbnail-padding"),o=_.data("max-count"),parseInt(n/g)+("0"==_.data("resizable-thumbnails")?0:1));o<b&&(b=o);var u=_.find(".bwg-item").length;u<b&&(b=u);var d,h,m=100/b,c=[];for(i=0;i<b;i++)c.push(0);_.find(".bwg-item").each(function(){var e=c.indexOf(Math.min.apply(Math,c)),t=jQuery(this).find("img");if(jQuery(this).css({width:m+"%",order:e+1}),void 0!==t.data("src")&&-1===t.data("src").indexOf("svg")&&0<t.attr("data-width").length&&0<t.attr("data-height").length){h=parseInt(t.data("width"))/parseInt(t.data("height")),d=t.width()/h;var i=(this.querySelector("a .bwg-zoom-effect-overlay .bwg-title2")||!this.querySelector("a .bwg-title1 .bwg-title2")?0:this.querySelector("a .bwg-title1 .bwg-title2").getClientRects()[0].height)+(0<jQuery(this).find(".bwg-masonry-thumb-description").length?jQuery(this).find(".bwg-masonry-thumb-description").height():0);jQuery(this).height(Math.floor(d+i+2*w))}c[e]+=jQuery(this)[0].getBoundingClientRect().height});var p=Math.max.apply(Math,c);for(i=0;i<b;i++)c[i]<p&&_.append(jQuery('<div class="bwg-item bwg-empty-item"></div>').css({width:m+"%",order:i+1,height:p-c[i]}));_.outerWidth(b*(g+2*w)),_.height(p)}if(""!=a.html()){r.outerWidth(b*(g+2*w)),"0"!=p?(r.css("opacity","1"),r.height(p)):r.css("opacity","0"),r.empty();var y=a.html();r.append(y),r.find(".bwg_lazyload").each(function(){null!=jQuery(this).data("src")&&""!=jQuery(this).data("src")&&(jQuery(this).attr("src",jQuery(this).data("src")),jQuery(this).on("load",function(){jQuery(this).removeClass("lazy_loader")}))}),a.empty().hide()}bwg_container_loaded(_.data("bwg"))}function bwg_container_loaded(e){jQuery("#gal_front_form_"+e).removeClass("bwg-hidden"),jQuery("#ajax_loading_"+e).addClass("bwg-hidden"),jQuery(".bwg_container img").removeAttr("width").removeAttr("height")}function bwg_thumbnail_mosaic_logic(e){var t=e.attr("data-bwg"),i=e.attr("data-block-id"),a=parseInt(e.attr("data-thumb-padding"))/2,r=parseInt(e.attr("data-thumb-border"))+a;if("horizontal"==e.attr("data-mosaic-direction")){var _=parseInt(e.attr("data-height"));if("1"==e.attr("data-resizable"))if(1920<=jQuery(window).width())var s=(1+jQuery(window).width()/1920)*_;else if(jQuery(window).width()<=640)s=jQuery(window).width()/640*_;else s=_;else s=_;(p=jQuery(".bwg_mosaic_thumb_"+t)).each(function(e){var t=jQuery(this).data("width"),i=jQuery(this).data("height");""!=t&&""!=i&&void 0!==t&&void 0!==i||(t=p.get(e).naturalWidth,i=p.get(e).naturalHeight),t=t*s/i,p.eq(e).height(s),p.eq(e).width(t)});var o=jQuery("#bwg_mosaic_thumbnails_div_"+t).width()/100*parseInt(e.attr("data-total-width"));jQuery("#"+i).width(o);var l=s+2*r,n=0,g=[];g[0]=0;var w=[],b=w[0]=0;p.each(function(e){row_cum_width2=b+p.eq(e).width()+2*r,row_cum_width2-o<0?(b=row_cum_width2,g[e]=n,w[n]++):e!==p.length-1?Math.abs(b-o)>Math.abs(row_cum_width2-o)||Math.abs(b-o)<=Math.abs(row_cum_width2-o)&&0==w[n]?e!==p.length-2?(b=row_cum_width2,g[e]=n,w[n]++,w[++n]=0,b=0):(b=row_cum_width2,g[e]=n,w[n]++):(w[++n]=1,g[e]=n,b=row_cum_width2-b):(b=row_cum_width2,g[e]=n,w[n]++)});for(var u=[],d=[],h=0;h<=n;h++)b=0,p.each(function(e){g[e]==h&&(b+=p.eq(e).width())}),u[h]=z=(o-2*w[h]*r)/b,d[h]=(l-2*r)*u[h]+2*r;if(0==n)for(h=0;h<=n;h++)d[h]>s&&(u[h]=1,d[h]=l);(O=[])[0]=0;var m=[],c=[];m[0]=0,c[0]=0;for(h=1;h<=n;h++)m[h]=m[0],c[h]=c[h-1]+d[h-1];p.each(function(e){var t=p.eq(e).width(),i=p.eq(e).height();p.eq(e).width(t*u[g[e]]),p.eq(e).height(i*u[g[e]]),p.eq(e).parent().css({top:c[g[e]],left:m[g[e]]}),m[g[e]]+=t*u[g[e]]+2*r,O[g[e]]=e}),jQuery("#"+i).height(c[n]+d[n]-c[0])}else{var p,y=parseInt(e.attr("data-width"));if("1"==e.attr("data-resizable")){if(1920<=jQuery(window).width())var f=(1+jQuery(window).width()/1920)*y;else if(jQuery(window).width()<=640)f=jQuery(window).width()/640*y;else f=y;if(0<jQuery(".header-content-with_tab").length)f=jQuery(".header-content-with_tab").width()/4-10}else f=y;(p=jQuery(".bwg_mosaic_thumb_"+t)).each(function(e){jQuery(this).removeAttr("style"),jQuery(this).parent().removeAttr("style");var t=jQuery(this).data("width"),i=jQuery(this).data("height");""!=t&&""!=i&&void 0!==t&&void 0!==i||(t=p.get(e).naturalWidth,i=p.get(e).naturalHeight),p.eq(e).height(i*f/t),p.eq(e).width(f)});o=jQuery("#bwg_mosaic_thumbnails_div_"+t).width()/100*parseInt(e.attr("data-total-width"));jQuery("#"+i).width(o);var j=f+2*r<o?f:o-2*r,Q=Math.min(Math.floor(o/(j+2*r)),p.length),v=[];v[0]=0;for(var x=[],k=[],z=0;z<Q;z++)k[z]=0,x[z]=0;p.each(function(e){for(var t=0,i=k[0],a=0;a<Q;a++)i>k[a]&&(i=k[a],t=a);v[e]=t,x[t]++,H=i,T=0+t*(j+2*r),p.eq(e).parent().css({top:H,left:T}),k[t]+=p.eq(e).height()+2*r}),(u=[])[0]=1;var C=0,I=[],E=0,M=0;for(z=0;z<Q;z++)C+=j,I[z]=0,p.each(function(e){v[e]==z&&(I[z]+=p.eq(e).height())}),0!=I[z]&&(E+=j/I[z],M+=j*x[z]*2*r/I[z]);var S=0;0!=E&&(S=(C+M)/E);for(z=0;z<Q;z++)0!=I[z]&&(u[z]=(S-2*x[z]*r)/I[z]);var O,T=[];T[0]=0;for(z=1;z<=Q;z++)T[z]=T[z-1]+j*u[z-1]+2*r;var H=[];for(z=0;z<Q;z++)H[z]=0;(O=[])[0]=0,p.each(function(e){var t=p.eq(e).width(),i=p.eq(e).height();p.eq(e).width(t*u[v[e]]),p.eq(e).height(i*u[v[e]]),p.eq(e).parent().css({top:H[v[e]],left:T[v[e]]}),H[v[e]]+=i*u[v[e]]+2*r,O[v[e]]=e}),jQuery("#"+i).width(T[Q]).height(H[0])}}function bwg_thumbnail_mosaic(e){var t=jQuery(e),i=jQuery.Deferred();if(i.done([bwg_thumbnail_mosaic_logic]).done(function(e){"1"!=e.data("mosaic-thumb-transition")&&jQuery(".bwg_mosaic_thumb_spun_"+t).css({transition:"all 0.3s ease 0s","-webkit-transition":"all 0.3s ease 0s"});var t=e.data("bwg");jQuery(".bwg_mosaic_thumbnails_"+t).css({visibility:"visible"}),jQuery(".tablenav-pages_"+t).css({visibility:"visible"}),bwg_container_loaded(t),jQuery(".bwg_mosaic_thumb_"+t).removeClass("bwg-hidden"),jQuery("#bwg_mosaic_thumbnails_div_"+t).removeClass("bwg-hidden")}),i.resolve(t),"hover"==t.attr("data-image-title")){var a=parseInt(t.attr("data-thumb-padding"))/2,r=parseInt(t.attr("data-thumb-border"))+a;bwg_mosaic_title_on_hover(t.data("bwg"),t,r)}"hover"==t.attr("data-ecommerce-icon")&&(jQuery(".bwg_mosaic_thumb_spun_"+bwg).on("mouseenter",function(){var e=jQuery(this).parents(".bwg-mosaic-thumb-span").children(".bwg_mosaic_thumb_"+bwg).width(),t=jQuery(this).parents(".bwg-mosaic-thumb-span").children(".bwg_mosaic_thumb_"+bwg).height();jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).width(e);var i=jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).width(),a=jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).height();jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).css({top:r+.5*t-.5*a,left:r+.5*e-.5*i,opacity:1})}),jQuery(".bwg_mosaic_thumb_spun_"+bwg).on("mouseleave",function(){jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).css({top:0,left:-1e4,opacity:0,padding:t.attr("data-title-margin")})}))}function bwg_mosaic_title_on_hover(t,e,i){jQuery(".bwg-mosaic-thumb-span").on("mouseenter",function(){var e=jQuery(this).children(".bwg_mosaic_thumb_"+t).width();jQuery(this).find(".bwg_mosaic_title_spun1_"+t).width(e),jQuery(this).find(".bwg_mosaic_title_spun1_"+t).css({opacity:1,"max-height":"calc(100% - "+2*i+"px)",overflow:"hidden"})}),jQuery(".bwg-mosaic-thumb-span").on("mouseleave",function(){jQuery(this).find(".bwg_mosaic_title_spun1_"+t).css({opacity:0,padding:e.attr("data-title-margin"),"max-height":"calc(100% - "+2*i+"px)",overflow:"hidden"})})}function bwg_mosaic_ajax(e,t){var i=0;jQuery(".bwg_mosaic_thumb_spun_"+e+" img").on("load",function(){++i>=t&&bwg_thumbnail_mosaic(jQuery(".bwg-mosaic-thumbnails[data-bwg="+e+"]"))}),jQuery(".bwg_mosaic_thumb_spun_"+e+" img").on("error",function(){jQuery(this).height(100),jQuery(this).width(100),++i>=t&&bwg_thumbnail_mosaic(jQuery(".bwg-mosaic-thumbnails[data-bwg="+e+"]"))}),jQuery(".bwg_container").each(function(){var e=jQuery(this).data("bwg");0<jQuery(this).find(".wd_error").length&&bwg_container_loaded(e)})}function bwg_add_album(){var t=!1;"1"!=bwg_objectsL10n.front_ajax&&jQuery(document).off("click",".bwg-album").on("click",".bwg-album",function(){if(!t){var e=jQuery(this).attr("data-bwg");return t=!0,setTimeout(function(){t=!1},100),bwg_ajax("gal_front_form_"+e,e,jQuery(this).attr("data-container_id"),jQuery(this).attr("data-alb_gal_id"),jQuery(this).attr("data-album_gallery_id"),jQuery(this).attr("data-def_type"),"",jQuery(this).attr("data-title")),!1}}),jQuery(".bwg_description_more").on("click",function(){jQuery(this).hasClass("bwg_more")?(jQuery(this).parent().find(".bwg_description_full").show(),jQuery(this).addClass("bwg_hide").removeClass("bwg_more"),jQuery(this).html(jQuery(this).data("hide-msg"))):(jQuery(this).parent().find(".bwg_description_full").hide(),jQuery(this).addClass("bwg_more").removeClass("bwg_hide"),jQuery(this).html(jQuery(this).data("more-msg")))})}function bwg_add_lightbox(){var i=!1;jQuery(document).on("click",".bwg_lightbox .bwg-item0, .bwg_lightbox .bwg_slide, .bwg_lightbox .bwg-carousel-image, .bwg_lightbox .bwg-title1",function(e){e.stopPropagation(),e.preventDefault();var t=jQuery(this).closest("a");if(!i)return i=!0,setTimeout(function(){i=!1},100),bwg_gallery_box(jQuery(t).attr("data-image-id"),jQuery(t).closest(".bwg_container")),!1}),jQuery(".bwg_lightbox .bwg_ecommerce").on("click",function(e){if(e.stopPropagation(),!i)return i=!0,setTimeout(function(){i=!1},100),bwg_gallery_box(jQuery(this).closest(".bwg_lightbox").attr("data-image-id"),jQuery(this).closest(".bwg_container"),!0),!1})}function bwg_filter_by_tag(e){var t,i="",a="",r=(a=jQuery(e).parent().parent().hasClass("bwg_tag_buttons_view")?jQuery(e).parent().parent():jQuery(e).parent().parent().parent()).find(".current_view").val(),_=a.find(".form_id").val(),s=a.find(".cur_gal_id").val(),o=a.find(".album_gallery_id").val(),l=a.find(".type").val();jQuery(e).parent().find(".opt.selected").each(function(){i=i+jQuery(e).text()+","}),""==(i=i.slice(0,-1))&&(i=bwg_objectsL10n.bwg_select_tag),jQuery(e).parent().find(".CaptionCont").attr("title",i),jQuery(e).parent().find(".CaptionCont .placeholder").html(i);var n=jQuery(".bwg_tags_container_"+r+" #bwg_tag_id_"+s).val();t="string"==typeof n&&""!==n?n.split(","):[],"object"==typeof n&&(t=n),jQuery(".bwg_tags_container_"+r+" #bwg_tag_id_"+r).val(t),bwg_select_tag(r,_,s,o,l,!1)}function bwg_document_ready(i){bwg_add_lightbox(),i.data("right-click-protection")&&bwg_disable_right_click(i),jQuery(".SumoSelect > .CaptionCont > label > i").addClass("bwg-icon-angle-down closed");var e=i.find(".search_tags");if("1"==bwg_objectsL10n.front_ajax&&e.length)for(var t=0;t<e[0].length;t++)void 0===e[0][t].attributes.selected&&(e[0][t].selected=!1);e.length&&(e.SumoSelect({triggerChangeCombined:!0,placeholder:bwg_objectsL10n.bwg_select_tag,search:!0,searchText:bwg_objectsL10n.bwg_search,forceCustomRendering:!0,noMatch:bwg_objectsL10n.bwg_tag_no_match,captionFormatAllSelected:bwg_objectsL10n.bwg_all_tags_selected,captionFormat:"{0} "+bwg_objectsL10n.bwg_tags_selected,okCancelInMulti:!0,locale:[bwg_objectsL10n.ok,bwg_objectsL10n.cancel,bwg_objectsL10n.select_all]}),e.off("change").on("change",function(){bwg_filter_by_tag(this)})),bwg_search_tag_init(i);var a=i.find(".cur_gal_id").val(),r=i.find(".current_view").val(),_=i.find(".bwg_tags_container_"+r+" .bwg_tag_button_view_container"),s=i.find("#bwg_tag_id_"+a),o=parseInt(2*_.find(".bwg_tags_filter_buttons").outerHeight(!0));_.length&&(_.find(".bwg_tags_filter_buttons").off("click").on("click",function(){if(!jQuery(this).hasClass("active")){var e=jQuery(this).position().top;o<e&&i.find(".show_bottom_tag").val("1"),""==s.val()?s.val(jQuery(this).val()):s.val(s.val()+","+jQuery(this).val()),bwg_filter_by_tag(this)}return!1}),_.find(".bwg_all_tags").off("click").on("click",function(){return jQuery(this).hasClass("active")||(s.val(""),bwg_filter_by_tag(this)),!1}),""!=s.val()&&_.find(".bwg_all_tags").removeClass("active"),s.val().split(",").forEach(function(t){_.find(".bwg_tags_filter_buttons").each(function(){if(jQuery(this).val()==t){var e=jQuery(this).position().top;o<e&&i.find(".show_bottom_tag").val("1")}})}),bwg_tags_button_section_visibility());var l=i.find(".bwg_order");l.length&&l.SumoSelect({triggerChangeCombined:!0,forceCustomRendering:!0}),jQuery(this).find("search_placeholder_title").hide(),""==jQuery(this).find(".bwg_search_input").val()&&jQuery(this).find("search_placeholder_title").show(),jQuery(".bwg_thumbnail .bwg_search_container_2").focusout(function(e){""==jQuery(this).find(".bwg_search_input").val()&&(jQuery(this).find(".search_placeholder_title").show(),jQuery(this).find(".bwg_search_loupe_container1").addClass("bwg-hidden"),jQuery(this).find(".bwg_search_reset_container").addClass("bwg-hidden"))}),jQuery(".search_tags").on("sumo:opened",function(){var e=jQuery(this).parents(".bwg_container").height(),t=jQuery(this).parents(".bwg_container").find(".wd_error").length,i=jQuery(this).parents(".bwg_container").find(".SumoSelect>.optWrapper>.options");void 0!==i&&(e-50<i.height()&&!t&&i.css("max-height",e-50));0==jQuery(this).parent().find("ul li").length&&(jQuery(".no-match").html(bwg_objectsL10n.bwg_tag_no_match),jQuery(".no-match").show())}),jQuery(".bwg_thumbnail .SumoSelect").on("sumo:closed",function(){jQuery(this).find("label i").removeClass("bwg-icon-angle-up opened"),jQuery(this).find("label i").addClass("bwg-icon-angle-down closed")}),jQuery(".bwg_thumbnail .SumoSelect").on("sumo:opened",function(){jQuery(this).find("label i").removeClass("bwg-icon-angle-down closed"),jQuery(this).find("label i").addClass("bwg-icon-angle-up opened")}),bwg_add_album();var n=window.location.hash.substring(1);if(n&&"-1"!=n.indexOf("bwg")){bwg_hash_array=n.replace("bwg","").split("/");var g=jQuery(".bwg_container");g&&bwg_gallery_box(bwg_hash_array[1],g,!1,bwg_hash_array[0])}bwg_resize_search_line()}function bwg_search_tag_init(e){jQuery(".SumoSelect > .CaptionCont > label > i").addClass("bwg-icon-angle-down closed");var t=e.find(".search_tags");if("1"==bwg_objectsL10n.front_ajax&&t.length)for(var i=0;i<t[0].length;i++)void 0===t[0][i].attributes.selected&&(t[0][i].selected=!1);t.length&&(t.SumoSelect({triggerChangeCombined:!0,placeholder:bwg_objectsL10n.bwg_select_tag,search:!0,searchText:bwg_objectsL10n.bwg_search,forceCustomRendering:!0,noMatch:bwg_objectsL10n.bwg_tag_no_match,captionFormatAllSelected:bwg_objectsL10n.bwg_all_tags_selected,captionFormat:"{0} "+bwg_objectsL10n.bwg_tags_selected,okCancelInMulti:!0,locale:[bwg_objectsL10n.ok,bwg_objectsL10n.cancel,bwg_objectsL10n.select_all]}),t.off("change").on("change",function(){bwg_filter_by_tag(this)}))}function bwg_clear_search_input(e){if("1"!=bwg_objectsL10n.front_ajax)jQuery("#bwg_search_input_"+e).val(""),jQuery("#bwg_search_container_1_"+e+" .bwg_search_loupe_container1").addClass("bwg-hidden"),jQuery("#bwg_search_container_1_"+e+" .bwg_search_reset_container").addClass("bwg-hidden");else{var t=window.location.href,i=bwg_remove_url_parameter("bwg_search_"+e,t,t);window.location.replace(i)}}function bwg_check_search_input_enter(e,t){return"Enter"!=t.key||(jQuery(e).closest(".bwg_search_container_1").find(".bwg_search").trigger("click"),!1)}function bwg_ajax(t,i,a,r,e,_,s,o,l,n,g,w){if("1"!=bwg_objectsL10n.front_ajax||!0===n){jQuery("#ajax_loading_"+i).removeClass("bwg-hidden"),jQuery(".bwg_load_more_ajax_loading").css({top:jQuery("#bwg_container1_"+bwg).height()-jQuery(".bwg_load_more_ajax_loading").height()}),"function"==typeof bwg_scroll_load_action&&jQuery(window).off("scroll",bwg_scroll_load_action),jQuery(".bwg_thumbnail .search_tags").off("sumo:closed");var b=jQuery("#"+t).data("ajax-url"),u=0;if(void 0===n)n=!1;var d,h=jQuery("#page_number_"+i).val(),m=jQuery("#bwg_search_input_"+i).val(),c={},p=jQuery("#bwg_album_breadcrumb_"+i).val();if(p&&!0!==n){var y=JSON.parse(p);if("back"==r){y.splice(-1,1);var f=y.slice(-1)[0];r=f.id,h=f.page,c["action_"+i]="back"}else"numeric"===n||s?(y.splice(-1,1),y.push({id:r,page:h,search:m})):(y.push({id:r,page:1}),h=1);c["bwg_album_breadcrumb_"+i]=JSON.stringify(y)}if(c["bwg-preview-type"]=jQuery("#"+t).data("gallery-type"),c.gallery_type=jQuery("#"+t).data("gallery-type"),c.gallery_id=jQuery("#"+t).data("gallery-id"),c.tag=jQuery("#"+t).data("tag"),c.album_id=jQuery("#"+t).data("album-id"),c.theme_id=jQuery("#"+t).data("theme-id"),c.shortcode_id=jQuery("#"+t).data("shortcode-id"),c.bwg=i,c.current_url=encodeURI(jQuery("#bwg_container1_"+i).data("current-url")),s&&(h=1),void 0===o||""==o)o="";if(void 0===g||""==g)g="";if(void 0===l||""==l)l=jQuery(".bwg_order_"+i).val();if(void 0===w)w=!0;if(1==w&&jQuery("html, body").animate({scrollTop:jQuery("#"+t).offset().top-150},500),c["page_number_"+i]=h,c["bwg_load_more_"+i]=jQuery("#bwg_load_more_"+i).val(),c["album_gallery_id_"+i]=r,c["type_"+i]=_,c["title_"+i]=o,c["description_"+i]=g,c["sortImagesByValue_"+i]=l,c["bwg_random_seed_"+i]=jQuery("#bwg_random_seed_"+i).val(),0<jQuery("#bwg_search_input_"+i).length&&(c["bwg_search_"+i]=jQuery("#bwg_search_input_"+i).val()),void 0!==c["bwg_album_breadcrumb_"+i]){var j=JSON.parse(c["bwg_album_breadcrumb_"+i]);jQuery.each(j,function(e,t){c["bwg_search_"+i]="",r==t.id&&(c["bwg_search_"+i]=t.search)})}var Q=jQuery(".bwg_tags_container_"+i+" #bwg_tag_id_"+a).val();return d="string"==typeof Q&&""!==Q?Q.split(","):[],"object"==typeof Q&&(d=Q),c["bwg_tag_id_"+a]=d,jQuery("#ajax_loading_"+i).removeClass("bwg-hidden"),jQuery(".bwg_load_more_ajax_loading").css({top:jQuery("#bwg_container1_"+bwg).height()-jQuery(".bwg_load_more_ajax_loading").height()}),jQuery.ajax({type:"POST",url:b,data:c,success:function(e){jQuery(e).find(".bwg_masonry_thumb_spun_"+i+" img").length,u=jQuery(e).find(".bwg_mosaic_thumb_spun_"+i+" img").length,!0===n?(a=="bwg_thumbnails_mosaic_"+i?jQuery("#"+a).append(jQuery(e).closest(".bwg-container-"+i).find("#"+a).html()):a=="bwg_album_compact_"+i?jQuery("#"+a).append(jQuery(e).closest(".bwg-album-thumbnails").html()):a=="bwg_thumbnails_masonry_"+i?jQuery(".bwg-container-temp"+i).append(jQuery(e).closest(".bwg-container-"+i).html()):jQuery("#"+a).append(jQuery(e).closest(".bwg-container-"+i).html()),jQuery(".bwg_nav_cont_"+i).html(jQuery(e).closest(".bwg_nav_cont_"+i).html())):jQuery("#bwg_container3_"+i).html(e),bwg_remove_lazy_loader_icon()},complete:function(){jQuery("div[id^='bwg_container1_'] img").each(function(){null!=jQuery(this).attr("data-lazy-src")&&""!=jQuery(this).attr("data-lazy-src")?jQuery(this).attr("src",jQuery(this).attr("data-lazy-src")):null!=jQuery(this).attr("data-src")&&""!=jQuery(this).attr("data-src")&&jQuery(this).attr("src",jQuery(this).attr("data-src"))}),jQuery(".blog_style_image_buttons_conteiner_"+i).find(jQuery(".bwg_blog_style_img_"+i)).on("load",function(){jQuery(".bwg_blog_style_img_"+i).closest(jQuery(".blog_style_image_buttons_conteiner_"+i)).show()}),""==d&&(d=[]),jQuery(".bwg_tags_container_"+i+" #bwg_tag_id_"+a).val(d),d.forEach(function(t){jQuery(".bwg_tags_container_"+i+" .bwg_tags_filter_buttons").each(function(){var e=parseInt(2*jQuery(this).outerHeight(!0));jQuery(this).val()==t&&(jQuery(this).addClass("active"),e<jQuery(this).position().top&&jQuery(".bwg_tags_container_"+i+" .show_bottom_tag").val("1"),jQuery(".bwg_tags_container_"+i+" .bwg_all_tags").removeClass("active"))})}),jQuery(".pagination-links_"+i).length&&jQuery("html, body").animate({scrollTop:jQuery("#"+t).offset().top-150},500),bwg_document_ready(jQuery("#bwg_container1_"+i));var e=jQuery("#bwg_container1_"+i).data("gallery-type");if(jQuery("#bwg_container1_"+i+" .bwg-album-thumbnails").length){bwg_all_thumnails_loaded(".bwg-container-"+i)&&bwg_container_loaded(i)}else{switch(e){case"thumbnails":case"thumbnails_masonry":case"album_compact_preview":case"album_masonry_preview":case"album_extended_preview":bwg_all_thumnails_loaded(".bwg-container-"+i);break;case"slideshow":bwg_slideshow_ready(i);break;case"carousel":bwg_carousel_ready(i),bwg_carousel_onload(jQuery("#bwg_container1_"+i));break;case"image_browser":bwg_image_browser_ready(jQuery("#bwg_container1_"+i));break;case"blog_style":bwg_blog_style_ready(jQuery("#bwg_container1_"+i))}bwg_mosaic_ajax(i,u)}jQuery(".blog_style_images_conteiner_"+i+" .bwg_embed_frame_16x9_"+i).each(function(e){jQuery(this).width(jQuery(this).parent().width()),jQuery(this).height(.5625*jQuery(this).width())}),jQuery(".blog_style_images_conteiner_"+i+" .bwg_embed_frame_instapost_"+i).each(function(e){jQuery(this).width(jQuery(this).parent().width()),jQuery(this).height((jQuery(this).width()-16)*jQuery(this).attr("data-height")/jQuery(this).attr("data-width")+96)}),jQuery("#bwg_embed_frame_16x9_"+i).width(jQuery("#bwg_embed_frame_16x9_"+i).parent().width()),jQuery("#bwg_embed_frame_16x9_"+i).height(.5625*jQuery("#bwg_embed_frame_16x9_"+i).width()),jQuery("#bwg_embed_frame_instapost_"+i).width(jQuery("#bwg_embed_frame_16x9_"+i).parent().width()),jQuery(".bwg_embed_frame_instapost_"+i).height((jQuery(".bwg_embed_frame_instapost_"+i).width()-16)*jQuery(".bwg_embed_frame_instapost_"+i).attr("data-height")/jQuery(".bwg_embed_frame_instapost_"+i).attr("data-width")+96),jQuery("#bwg_search_input_"+i).val(c["bwg_search_"+i]),""!=jQuery("#bwg_search_input_"+i).val()?(jQuery("#bwg_search_input_"+i).parent().find(".search_placeholder_title").hide(),jQuery("#bwg_search_input_"+i).parent().parent().find(".bwg_search_reset_container").show(),jQuery("#bwg_search_input_"+i).parent().parent().find(".bwg_search_loupe_container1").show()):jQuery("#bwg_search_input_"+i).parent().find(".search_placeholder_title").show();jQuery("#bwg_container2_"+i+" .cur_gal_id").val();""==d&&(d=[]),jQuery(".bwg_tags_container_"+i+" #bwg_tag_id_"+i).val(d)}}),!1}if("back"===r)return-1==document.referrer.indexOf(window.location.host)?(str=jQuery(location).attr("href"),void window.location.replace(str.substring(0,str.indexOf("type_0")))):void window.history.back();var v=jQuery("#bwg_search_input_"+i).val(),x=jQuery(".bwg_tags_container_"+i+" .cur_gal_id").val(),k=window.location.href,z="",C=jQuery(".bwg_tags_container_"+i+" #bwg_tag_id_"+x).val();if(jQuery(".bwg_tags_container_"+i).parent().hasClass("bwg_tag_select_view")&&(C=C.toString()),"#"==k.substr(-1)&&(k=k.slice(0,-1)),""!==v&&void 0!==v?!1!==(z=bwg_add_url_parameter(z=bwg_remove_url_parameter("page_number_"+i,k),"bwg_search_"+i,v))&&(k=z):!1!==(z=bwg_remove_url_parameter("bwg_search_"+i,k))&&(k=z),void 0!==l&&""!==l&&!1!==(z=bwg_add_url_parameter(k,"sort_by_"+i,l))&&(k=z),null!=C&&0<C.length){var I="",E=C.split(",");jQuery.each(E,function(e){var t=",";e===E.length-1&&(t=""),I+=E[e]+t}),""!==I&&!1!==(z=bwg_add_url_parameter(k,"filter_tag_"+i,I))&&(k=z)}else!1!==(z=bwg_remove_url_parameter("filter_tag_"+i,z))&&(k=z);window.location.href=k}function bwg_add_url_parameter(e,t,i){var a=new RegExp("([?&])"+t+"=.*?(&|$)","i"),r=-1!==e.indexOf("?")?"&":"?";return e.match(a)?e.replace(a,"$1"+t+"="+i+"$2"):e+r+t+"="+i}function bwg_remove_url_parameter(e,t){var i=t.split("?"),a=i[0]+"?",r="";if(void 0!==i[1]&&(r=i[1]),""===r)return t;var _,s,o=decodeURIComponent(r).split("&");for(s=0;s<o.length;s++)(_=o[s].split("="))[0]!=e&&(a=a+_[0]+"="+_[1]+"&");return a.substring(0,a.length-1)}function bwg_select_tag(e,t,i,a,r,_){_&&jQuery(".bwg_tags_container_"+e+" #bwg_tag_id_"+i).val(""),bwg_ajax(t,e,i,a,"",r,1,"")}function bwg_cube(e,t,i,a,r,_,s,o,l,n,g){var w,b=!1,u="";if(void 0!==g&&""!==g){b=!0,bwg_params[g].bwg_trans_in_progress=!0,u="_"+g,w=bwg_params[g].bwg_transition_duration;bwg_params[g].event_stack}else w=bwg_transition_duration;if(!bwg_testBrowser_cssTransitions(g))return bwg_fallback(o,l,n,g);if(!bwg_testBrowser_cssTransforms3d(g))return bwg_fallback3d(o,l,n,g);function d(){if(jQuery(o).removeAttr("style"),jQuery(l).removeAttr("style"),jQuery(".bwg_slider"+u).removeAttr("style"),jQuery(o).css({opacity:0,"z-index":1}),jQuery(l).css({opacity:1,"z-index":2}),jQuery(".bwg_image_info").show(),jQuery(o).html(""),b){bwg_change_watermark_container(g),bwg_params[g].bwg_trans_in_progress=!1;var e=bwg_params[g].data,t=bwg_params[g].event_stack}else{e="";gallery_box_data.bwg_trans_in_progress=!1;t=gallery_box_data.event_stack}if(void 0!==t&&0<t.length){var i=t[0].split("-");t.shift(),bwg_change_image(i[0],i[1],e,!0,g)}bwg_change_watermark_container()}b?(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+g).removeClass("bwg_slideshow_thumb_active_"+g).addClass("bwg_slideshow_thumb_deactive_"+g),jQuery("#bwg_filmstrip_thumbnail_"+bwg_params[g].bwg_current_key+"_"+g).removeClass("bwg_slideshow_thumb_deactive_"+g).addClass("bwg_slideshow_thumb_active_"+g),jQuery(".bwg_slideshow_dots_"+g).removeClass("bwg_slideshow_dots_active_"+g).addClass("bwg_slideshow_dots_deactive_"+g),jQuery("#bwg_dots_"+bwg_params[g].bwg_current_key+"_"+g).removeClass("bwg_slideshow_dots_deactive_"+g).addClass("bwg_slideshow_dots_active_"+g),jQuery(".bwg_slide_bg_"+g).css("perspective",1e3)):(gallery_box_data.bwg_trans_in_progress=!0,jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive"),jQuery("#bwg_filmstrip_thumbnail_"+gallery_box_data.bwg_current_key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active"),jQuery(".bwg_slide_bg").css("perspective",1e3)),jQuery(o).css({transform:"translateZ("+e+"px)",backfaceVisibility:"hidden"}),jQuery(l).css({opacity:1,backfaceVisibility:"hidden",transform:"translateY("+i+"px) translateX("+t+"px) rotateY("+r+"deg) rotateX("+a+"deg)"}),jQuery(".bwg_slider"+u).css({transform:"translateZ(-"+e+"px)",transformStyle:"preserve-3d"}),setTimeout(function(){jQuery(".bwg_slider"+u).css({transition:"all "+w+"ms ease-in-out",transform:"translateZ(-"+e+"px) rotateX("+_+"deg) rotateY("+s+"deg)"})},20),jQuery(".bwg_slider"+u).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(d)),0==w&&d()}function bwg_cubeH(e,t,i,a){var r=jQuery(e).width()/2;"right"==i?bwg_cube(r,r,0,0,90,0,-90,e,t,i,a):"left"==i&&bwg_cube(r,-r,0,0,-90,0,90,e,t,i,a)}function bwg_cubeV(e,t,i,a){var r=jQuery(e).height()/2;"right"==i?bwg_cube(r,0,-r,90,0,-90,0,e,t,i,a):"left"==i&&bwg_cube(r,0,r,-90,0,90,0,e,t,i,a)}function bwg_fade(e,t,i,a){var r,_=!1;function s(){jQuery(".bwg_image_info").show(),bwg_change_watermark_container(a),_?bwg_params[a].bwg_trans_in_progress=!1:gallery_box_data.bwg_trans_in_progress=!1}r=void 0!==a&&""!==a?(_=!0,bwg_params[a].bwg_trans_in_progress=!0,bwg_params[a].bwg_transition_duration):(gallery_box_data.bwg_trans_in_progress=!0,gallery_box_data.bwg_transition_duration),_?(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+a).removeClass("bwg_slideshow_thumb_active_"+a).addClass("bwg_slideshow_thumb_deactive_"+a),jQuery("#bwg_filmstrip_thumbnail_"+bwg_params[a].bwg_current_key+"_"+a).removeClass("bwg_slideshow_thumb_deactive_"+a).addClass("bwg_slideshow_thumb_active_"+a),jQuery(".bwg_slideshow_dots_"+a).removeClass("bwg_slideshow_dots_active_"+a).addClass("bwg_slideshow_dots_deactive_"+a),jQuery("#bwg_dots_"+bwg_params[a].bwg_current_key+"_"+a).removeClass("bwg_slideshow_dots_deactive_"+a).addClass("bwg_slideshow_dots_active_"+a)):(jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive"),jQuery("#bwg_filmstrip_thumbnail_"+gallery_box_data.bwg_current_key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active")),bwg_testBrowser_cssTransitions()?(jQuery(t).css("transition","opacity "+r+"ms linear"),jQuery(e).css("transition","opacity "+r+"ms linear"),jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),jQuery(t).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(s))):(jQuery(e).animate({opacity:0,"z-index":1},r),jQuery(t).animate({opacity:1,"z-index":2},{duration:r,complete:function(){_?bwg_params[a].bwg_trans_in_progress=!1:gallery_box_data.bwg_trans_in_progress=!1,jQuery(e).html(""),s()}}),jQuery(e).fadeTo(r,0),jQuery(t).fadeTo(r,1)),0==r&&s()}function bwg_grid(e,t,i,a,r,_,s,o,l,n,g){var w,b=!1,u="";if(event_stack=void 0!==g&&""!==g?(b=!0,bwg_params[g].bwg_trans_in_progress=!0,u="_"+g,w=bwg_params[g].bwg_transition_duration,bwg_params[g].event_stack):(w=bwg_transition_duration,gallery_box_data.bwg_trans_in_progress=!0,gallery_box_data.event_stack),!bwg_testBrowser_cssTransitions())return bwg_fallback(o,l,n);b?(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+g).removeClass("bwg_slideshow_thumb_active_"+g).addClass("bwg_slideshow_thumb_deactive_"+g),jQuery("#bwg_filmstrip_thumbnail_"+bwg_params[g].bwg_current_key+u).removeClass("bwg_slideshow_thumb_deactive_"+g).addClass("bwg_slideshow_thumb_active_"+g),jQuery(".bwg_slideshow_dots_"+g).removeClass("bwg_slideshow_dots_active_"+g).addClass("bwg_slideshow_dots_deactive_"+g),jQuery("#bwg_dots_"+bwg_params[g].bwg_current_key+u).removeClass("bwg_slideshow_dots_deactive_"+g).addClass("bwg_slideshow_dots_active_"+g)):(jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive"),jQuery("#bwg_filmstrip_thumbnail_"+gallery_box_data.bwg_current_key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active"));var d=w/(e+t);var h=jQuery(o).find("img"),m=jQuery(o).find("figure"),c=(jQuery(o).find("iframe").css("opacity",0),jQuery('<span style="display: block;" />').addClass("bwg_grid"+u));jQuery(o).prepend(c);var p,y,f,j,Q,v,x,k,z,C,I,E=jQuery(".bwg_slide_bg"+u),M=h.width(),S=h.height(),O=E.width(),T=E.height(),H=Math.floor(O/e),L=Math.floor(T/t),A=O-e*H,B=Math.ceil(A/e),W=T-t*L,D=Math.ceil(W/t),R=0,F=Math.ceil((jQuery(".bwg_slide_bg"+u).width()-h.width())/2),N=void 0===h.attr("src")?"":h.attr("src");a="min-auto"===(a="auto"===a?O:a)?-O:a,r="min-auto"===(r="auto"===r?T:r)?-T:r;for(var P=0;P<e;P++){var U=0,V=Math.floor((jQuery(".bwg_slide_bg"+u).height()-h.height())/2),q=H;if(0<A){var J=B<=A?B:A;q+=J,A-=J}for(var G=0;G<t;G++){var Y=L,$=W;0<$&&(Y+=J=D<=$?D:W,$-=J),c.append((p=q,y=Y,f=U,j=V,Q=R,v=F,x=N,k=M,z=S,C=g,void 0,I=(P+G)*d,jQuery('<span class="bwg_gridlet'+u+'" />').css({display:"block",width:p,height:y,top:f,left:Q,backgroundImage:'url("'+x+'")',backgroundColor:b?jQuery(".bwg_slideshow_image_wrap_"+C).css("background-color"):jQuery(".spider_popup_wrap").css("background-color"),backgroundRepeat:"no-repeat",backgroundPosition:v+"px "+j+"px",backgroundSize:k+"px "+z+"px",transition:"all "+w+"ms ease-in-out "+I+"ms",transform:"none"}))),U+=Y,V-=Y}F-=q,R+=q}var X=c.children().last();function K(){if(jQuery(o).css({opacity:0,"z-index":1}),jQuery(l).css({opacity:1,"z-index":2}),h.css("opacity",1),m.css("opacity",1),c.remove(),b){bwg_params[g].bwg_trans_in_progress=!1;var e=bwg_params[g].event_stack,t=bwg_params[g].data}else{gallery_box_data.bwg_trans_in_progress=!1;e=gallery_box_data.event_stack,t=""}if(jQuery(".bwg_image_info").show(),jQuery(o).html(""),void 0!==e&&0<e.length){var i=e[0].split("-");e.shift(),bwg_change_image(i[0],i[1],t,!0,g)}b?bwg_change_watermark_container(g):bwg_change_watermark_container()}c.show(),h.css("opacity",0),m.css("opacity",0),c.children().first().addClass("rs-top-left"),c.children().last().addClass("rs-bottom-right"),c.children().eq(t-1).addClass("rs-bottom-left"),c.children().eq(-t).addClass("rs-top-right"),setTimeout(function(){c.children().css({opacity:s,transform:"rotate("+i+"deg) translateX("+a+"px) translateY("+r+"px) scale("+_+")"})},1),jQuery(l).css("opacity",1),jQuery(X).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(K)),0==w&&K()}function bwg_sliceH(e,t,i,a){if("right"==i)var r="min-auto";else if("left"==i)r="auto";bwg_grid(1,8,0,r,0,1,0,e,t,i,a)}function bwg_sliceV(e,t,i,a){if("right"==i)var r="min-auto";else if("left"==i)r="auto";bwg_grid(10,1,0,0,r,1,0,e,t,i,a)}function bwg_slideV(e,t,i,a){if("right"==i)var r="auto";else if("left"==i)r="min-auto";bwg_grid(1,1,0,0,r,1,1,e,t,i,a)}function bwg_slideH(e,t,i,a){if("right"==i)var r="min-auto";else if("left"==i)r="auto";bwg_grid(1,1,0,r,0,1,1,e,t,i,a)}function bwg_scaleOut(e,t,i,a){bwg_grid(1,1,0,0,0,1.5,0,e,t,i,a)}function bwg_scaleIn(e,t,i,a){bwg_grid(1,1,0,0,0,.5,0,e,t,i,a)}function bwg_blockScale(e,t,i,a){bwg_grid(8,6,0,0,0,.6,0,e,t,i,a)}function bwg_kaleidoscope(e,t,i,a){bwg_grid(10,8,0,0,0,1,0,e,t,i,a)}function bwg_fan(e,t,i,a){if("right"==i)var r=45,_=100;else if("left"==i)r=-45,_=-100;bwg_grid(1,10,r,_,0,1,0,e,t,i,a)}function bwg_blindV(e,t,i,a){bwg_grid(1,8,0,0,0,.7,0,e,t,"",a)}function bwg_blindH(e,t,i,a){bwg_grid(10,1,0,0,0,.7,0,e,t,"",a)}function bwg_random(e,t,i,a){var r=["sliceH","sliceV","slideH","slideV","scaleOut","scaleIn","blockScale","kaleidoscope","fan","blindH","blindV"];this["bwg_"+r[Math.floor(Math.random()*r.length)]](e,t,i,a)}function bwg_change_watermark_container(t){jQuery(".bwg_slider"+(void 0!==t&&""!==t?"_"+t:"")).children().each(function(){if(2==jQuery(this).css("zIndex")){var e=jQuery(this).find("img");if(e.length)if(e.prop("complete"))bwg_change_each_watermark_container(e.width(),e.height(),t);else e.on("load",function(){bwg_change_each_watermark_container(e.width(),e.height(),t)});else(e=jQuery(this).find("iframe")).length||(e=jQuery(this).find("video")),bwg_change_each_watermark_container(e.width(),e.height(),t)}})}function bwg_change_each_watermark_container(e,t,i){var a=void 0!==i&&""!==i?"_"+i:"",r=void 0!==i&&""!==i?"_slideshow":"";if(jQuery(".bwg"+r+"_watermark_spun"+a).width(e),jQuery(".bwg"+r+"_watermark_spun"+a).height(t),jQuery(".bwg"+r+"_watermark"+a).css({display:""}),void 0===i||""===i){var _=0;(jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(_=gallery_box_data.lightbox_comment_width),e<=jQuery(window).width()-_&&(jQuery(".bwg_watermark_image").css({width:(jQuery(".spider_popup_wrap").width()-_)*gallery_box_data.watermark_font_size/gallery_box_data.image_width}),jQuery(".bwg_watermark_text, .bwg_watermark_text:hover").css({fontSize:(jQuery(".spider_popup_wrap").width()-_)*gallery_box_data.watermark_font_size/gallery_box_data.image_width}))}else jQuery(".bwg"+r+"_title_spun"+a).width(e),jQuery(".bwg"+r+"_title_spun"+a).height(t),jQuery(".bwg"+r+"_description_spun"+a).width(e),jQuery(".bwg"+r+"_description_spun"+a).height(t);jQuery.trim(jQuery(".bwg"+r+"_title_text"+a).text())&&jQuery(".bwg_slideshow_title_text"+a).css({display:""}),jQuery.trim(jQuery(".bwg"+r+"_description_text"+a).text())&&jQuery(".bwg"+r+"_description_text"+a).css({display:""})}function bwg_set_filmstrip_pos(e,t,i){var a,r=void 0!==t&&""!==t?"_"+t:"",_=void 0!==t&&""!==t?"_slideshow":"";a=void 0!==t&&""!==t?bwg_params[t].left_or_top:gallery_box_data.left_or_top;var s=parseInt(jQuery(".bwg_filmstrip_thumbnails").attr("data-all-images-top-bottom-space")),o=parseInt(jQuery(".bwg_filmstrip_thumbnails").attr("data-all-images-right-left-space"));if(void 0===t||""===t){if("outerWidth"==gallery_box_data.outerWidth_or_outerHeight)var l=-bwg_current_filmstrip_pos-jQuery(".bwg_filmstrip_thumbnail").outerWidth(!0)/2;else if("outerHeight"==gallery_box_data.outerWidth_or_outerHeight)l=-bwg_current_filmstrip_pos-jQuery(".bwg_filmstrip_thumbnail").outerHeight(!0)/2;if("width"==gallery_box_data.width_or_height)var n=Math.min(0,Math.max(e-jQuery(".bwg_filmstrip_thumbnails").width(),l+e/2));else if("height"==gallery_box_data.width_or_height)n=Math.min(0,Math.max(e-jQuery(".bwg_filmstrip_thumbnails").height(),l+e/2))}else if("width"==bwg_params[t].width_or_height)l=-bwg_params[t].bwg_current_filmstrip_pos-(jQuery(".bwg_slideshow_filmstrip_thumbnail"+r).width()+bwg_params[t].filmstrip_thumb_margin_hor)/2,n=Math.min(0,Math.max(e-jQuery(".bwg_slideshow_filmstrip_thumbnails"+r).width(),l+e/2));else l=-bwg_params[t].bwg_current_filmstrip_pos-(jQuery(".bwg_slideshow_filmstrip_thumbnail"+r).height()+bwg_params[t].filmstrip_thumb_margin_hor)/2,n=Math.min(0,Math.max(e-jQuery(".bwg_slideshow_filmstrip_thumbnails"+r).height(),l+e/2));0<n+o&&(o=0),0<n+s&&(s=0),"left"==a?jQuery(".bwg"+_+"_filmstrip_thumbnails"+r).animate({left:n+o},{duration:500,complete:function(){bwg_filmstrip_arrows(t)}}):jQuery(".bwg"+_+"_filmstrip_thumbnails"+r).animate({top:n+s},{duration:500,complete:function(){bwg_filmstrip_arrows(t)}})}function bwg_filmstrip_arrows(e){var t=void 0!==e&&""!==e?"_slideshow":"",i=void 0!==bwg_params[e]&&2==bwg_params[e].slideshow_filmstrip_type?"_filmstrip_fix_count":"_filmstrip",a=void 0!==e&&""!==e?"_"+e:"";if("width"==(void 0!==e&&""!==e?bwg_params[e].width_or_heigh:gallery_box_data.width_or_height))var r=jQuery(".bwg"+t+"_filmstrip_thumbnails"+a).width(),_=jQuery(".bwg"+t+i+a).width();else r=jQuery(".bwg"+t+"_filmstrip_thumbnails"+a).height(),_=jQuery(".bwg"+t+i+a).height();r<_?(jQuery(".bwg"+t+"_filmstrip_left"+a).hide(),jQuery(".bwg"+t+"_filmstrip_right"+a).hide()):(jQuery(".bwg"+t+"_filmstrip_left"+a).hide(),jQuery(".bwg"+t+"_filmstrip_right"+a).show())}function bwg_slideshow_filmstrip_fix_dimension(e){var t,i,a,r,_,s,o=void 0!==e&&""!==e?"_"+e:"",l=void 0!==e&&""!==e?"_slideshow":"",n=void 0!==e&&""!==e&&void 0!==bwg_params[e].outerWidth_or_outerHeight?bwg_params[e].outerWidth_or_outerHeight:gallery_box_data.outerWidth_or_outerHeight,g=void 0!==e&&""!==e&&void 0!==bwg_params[e].left_or_top?bwg_params[e].left_or_top:gallery_box_data.left_or_top;i="outerWidth"==n?(t=jQuery(".bwg"+l+"_filmstrip"+o).outerWidth(!0),jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).outerWidth(!0)):(t=jQuery(".bwg"+l+"_filmstrip"+o).outerHeight(!0),jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).outerHeight(!0)),s="left"==g?(a=jQuery(".bwg"+l+"_thumb_active"+o).position().left,r="outerWidth"==n?jQuery(".bwg"+l+"_thumb_active"+o).position().left+jQuery(".bwg"+l+"_thumb_active"+o).outerWidth(!0):jQuery(".bwg"+l+"_thumb_active"+o).position().left+jQuery(".bwg"+l+"_thumb_active"+o).outerHeight(!0),_=jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().left,Math.abs(jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().left)+t):(a=jQuery(".bwg"+l+"_thumb_active"+o).position().top,r="outerWidth"==n?jQuery(".bwg"+l+"_thumb_active"+o).position().top+jQuery(".bwg"+l+"_thumb_active"+o).outerWidth(!0):jQuery(".bwg"+l+"_thumb_active"+o).position().top+jQuery(".bwg"+l+"_thumb_active"+o).outerHeight(!0),_=jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().top,Math.abs(jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().top)+t),i<t||(a<Math.abs(_)?"left"==g?jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({left:-a},{duration:500,complete:function(){bwg_filmstrip_arrows(e)}}):jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({top:-a},{duration:500,complete:function(){bwg_filmstrip_arrows(e)}}):s<r&&("left"==g?jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({left:-(r-t)},{duration:500,complete:function(){bwg_filmstrip_arrows(e)}}):jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({top:-(r-t)},{duration:500,complete:function(){bwg_filmstrip_arrows(e)}})))}function bwg_slideshow_filmstrip_fix_count(e){var t,i,a,r,_,s,o=void 0!==e&&""!==e?"_"+e:"",l=void 0!==e&&""!==e?"_slideshow":"",n=void 0!==e&&""!==e?bwg_params[e].outerWidth_or_outerHeight:gallery_box_data.outerWidth_or_outerHeight,g=void 0!==e&&""!==e?bwg_params[e].left_or_top:gallery_box_data.left_or_top;i="outerWidth"==n?(t=jQuery(".bwg"+l+"_filmstrip_fix_count"+o).outerWidth(!0),jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).outerWidth(!0)):(t=jQuery(".bwg"+l+"_filmstrip_fix_count"+o).outerHeight(!0),jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).outerHeight(!0)),s="left"==g?(a=jQuery(".bwg"+l+"_thumb_active"+o).position().left,r="outerWidth"==n?jQuery(".bwg"+l+"_thumb_active"+o).position().left+jQuery(".bwg"+l+"_thumb_active"+o).outerWidth(!0):jQuery(".bwg"+l+"_thumb_active"+o).position().left+jQuery(".bwg"+l+"_thumb_active"+o).outerHeight(!0),_=jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().left,Math.abs(jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().left)+t):(a=jQuery(".bwg"+l+"_thumb_active"+o).position().top,r="outerWidth"==n?jQuery(".bwg"+l+"_thumb_active"+o).position().top+jQuery(".bwg"+l+"_thumb_active"+o).outerWidth(!0):jQuery(".bwg"+l+"_thumb_active"+o).position().top+jQuery(".bwg"+l+"_thumb_active"+o).outerHeight(!0),_=jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().top,Math.abs(jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().top)+t),i<t||(a<Math.abs(_)?"left"==g?jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({left:-a},{duration:500,complete:function(){bwg_filmstrip_arrows(e)}}):jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({top:-a},{duration:500,complete:function(){bwg_filmstrip_arrows(e)}}):s<r&&("left"==g?jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({left:-(r-t)},{duration:500,complete:function(){bwg_filmstrip_arrows(e)}}):jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({top:-(r-t)},{duration:500,complete:function(){bwg_filmstrip_arrows(e)}})))}function bwg_resize_slideshow_filmstrip_fix_count(e){var _=e.bwg,t=e.parent_width,i=e.params,a=i.filmstrip_direction,r=i.data,s=i.filmstrip_thumb_margin_hor,o=jQuery(window).width()<=767&&5<i.slideshow_thumbnails_count,l=o?5:i.slideshow_thumbnails_count,n="#bwg_container1_"+_+" #bwg_container2_"+_+" .bwg_slideshow_filmstrip_container_"+_,g="#bwg_container1_"+_+" #bwg_container2_"+_+" .bwg_slideshow_filmstrip_fix_count_"+_,w="#bwg_container1_"+_+" #bwg_container2_"+_+" .bwg_slideshow_filmstrip_fix_count_"+_+" .bwg_slideshow_filmstrip_thumbnails_"+_,b="#bwg_container1_"+_+" #bwg_container2_"+_+" .bwg_slideshow_filmstrip_fix_count_"+_+" .bwg_slideshow_filmstrip_thumbnails_"+_+" .bwg_slideshow_filmstrip_thumbnail_"+_,u="#bwg_container1_"+_+" #bwg_container2_"+_+" .bwg_slideshow_image_container_"+_,d=jQuery(u).data("filmstrip-position"),h=(jQuery(u).data("filmstrip-size"),i.slideshow_filmstrip_rl_btn_size);if(jQuery("#bwg_container1_"+_).css({width:"100%"}),jQuery("#bwg_container1_"+_+" #bwg_container2_"+_).css({width:t}),"undefined"==typeof resize_in_progress||!1===resize_in_progress){window.resize_in_progress=!0,void 0!==m&&clearTimeout(m);var m=setTimeout(function(){resize_in_progress=!1;var e={};"bottom"==d||"top"==d?e.left=0:e.top=0,jQuery(w).css(e);var t="horizontal"==a?"table-cell":"block";jQuery(n).find(".bwg_slideshow_filmstrip_left_"+_).css({display:"none"}),jQuery(n).find(".bwg_slideshow_filmstrip_left_disabled_"+_).css({display:t}),jQuery(n).find(".bwg_slideshow_filmstrip_right_"+_).css({display:t}),jQuery(n).find(".bwg_slideshow_filmstrip_right_disabled_"+_).css({display:"none"})},500)}if(bwg_resize_instagram_post(_),bwg_change_watermark_container(_),"horizontal"==a){var c=i.image_height/i.image_width,p=t-40,y=Math.round(c*p),f=(p-s*l)/l,j=Math.round(c*f);jQuery(n).css({width:t,height:j}),jQuery(g).css({width:p,height:j}),jQuery(b).css({width:f,height:j}),jQuery.each(r,function(e,t){var i=f,a=j;if(""!=t.image_width&&""!=t.image_height){var r=Math.max(f/t.image_width,j/t.image_height);i=t.image_width*r,a=t.thumb_height*r}""!=t.thumb_width&&""!=t.thumb_height&&(i=t.thumb_width,a=t.thumb_height);i*=r=Math.max(f/i,j/a),a*=r;jQuery(".bwg_slideshow_filmstrip_fix_count_"+_+" .bwg_slideshow_filmstrip_thumbnail_"+_+" .bwg_slideshow_filmstrip_thumbnail_img_"+_).css({width:f,height:j,"margin-left":0,"margin-top":0})}),jQuery(w).css({width:f*r.length+s*r.length,height:j}),jQuery(".bwg_slideshow_image_wrap_"+_).css({width:t,height:t*i.image_height/i.image_width}),(Q={width:t,height:t*(i.image_height/i.image_width)-j})[d]=j,jQuery(".bwg_slideshow_image_container_"+_).css(Q),jQuery(".bwg_slideshow_image_"+_).css({cssText:"max-width:"+t+"px !important; max-height:"+(t*(i.image_height/i.image_width)-j)+"px !important;"}),jQuery(".bwg_slideshow_embed_"+_).css({cssText:"width:"+t+"px !important; height:"+(t*(i.image_height/i.image_width)-j)+"px !important;"}),j<h&&(h=j),jQuery(n).find(".bwg-icon-angle-left").css({"font-size":h}),jQuery(n).find(".bwg-icon-angle-right").css({"font-size":h})}else{var Q,v=t*i.image_height/i.image_width;c=i.image_width/i.image_height,y=v-40,p=Math.round(c*y),j=(y-s*l)/l,f=Math.round(c*j);jQuery.each(r,function(e,t){var i=f,a=j;if(""!=t.image_width&&""!=t.image_height){var r=Math.max(f/t.image_width,j/t.image_height);i=t.image_width*r,a=t.thumb_height*r}""!=t.thumb_width&&""!=t.thumb_height&&(i=t.thumb_width,a=t.thumb_height);r=Math.max(f/i,j/a),i*=r,a*=r;jQuery(".bwg_slideshow_filmstrip_fix_count_"+_+" .bwg_slideshow_filmstrip_thumbnail_"+_+" .bwg_slideshow_filmstrip_thumbnail_img_"+_).css({width:f,height:j,"margin-left":0,"margin-top":0})}),jQuery(n).css({width:f,height:v}),jQuery(g).css({width:f,height:y}),jQuery(w).css({width:f,height:j*r.length+s*r.length}),jQuery(b).css({width:f,height:j}),jQuery(".bwg_slideshow_image_wrap_"+_).css({width:t,height:v}),(Q={width:t-f,height:v})[d]=f,jQuery(u).css(Q),jQuery(".bwg_slideshow_image_"+_).css({cssText:"max-width:"+(t-f)+"px !important; max-height:"+v+"px !important;"}),jQuery(".bwg_slideshow_embed_"+_).css({cssText:"width:"+(t-f)+"px !important; height:"+v+"px !important;"}),f<h&&(h=f),jQuery(n).find(".bwg-icon-angle-up").css({"font-size":h}),jQuery(n).find(".bwg-icon-angle-down").css({"font-size":h})}o&&(jQuery(n).find(".bwg-icon-angle-left").removeAttr("style"),jQuery(n).find(".bwg-icon-angle-right").removeAttr("style"),jQuery(n).find(".bwg-icon-angle-up").removeAttr("style"),jQuery(n).find(".bwg-icon-angle-down").removeAttr("style"))}function bwg_resize_slideshow_filmstrip_fix_dimension(e){var t=e.bwg,i=e.parent_width,a=e.params,r=a.filmstrip_direction;jQuery(".bwg_slideshow_image_wrap_"+t).css({width:i}),jQuery(".bwg_slideshow_image_wrap_"+t).css({height:i*(a.image_height/a.image_width)}),jQuery(".bwg_slideshow_image_container_"+t).css({width:i-("horizontal"==a.filmstrip_direction?0:a.slideshow_filmstrip_width)}),jQuery(".bwg_slideshow_image_container_"+t).css({height:i*a.image_height/a.image_width-("horizontal"==a.filmstrip_direction?a.slideshow_filmstrip_height:0)}),jQuery(".bwg_slideshow_image_"+t).css({cssText:"max-width: "+(i-("horizontal"==bwg_params[t].filmstrip_direction?0:a.slideshow_filmstrip_width))+"px !important; max-height: "+(i*(a.image_height/a.image_width)-("horizontal"==a.filmstrip_direction?a.slideshow_filmstrip_height:0)-1)+"px !important;"}),jQuery(".bwg_slideshow_embed_"+t).css({cssText:"width: "+(i-("horizontal"==a.filmstrip_direction?0:a.slideshow_filmstrip_width))+"px !important; height: "+(i*(a.image_height/a.image_width)-("horizontal"==a.filmstrip_direction?a.slideshow_filmstrip_height:0)-1)+"px !important;"}),bwg_resize_instagram_post(t),bwg_change_watermark_container(t),"horizontal"==r?(jQuery(".bwg_slideshow_filmstrip_container_"+t).css({width:i}),jQuery(".bwg_slideshow_filmstrip_"+t).css({width:i-40})):(jQuery(".bwg_slideshow_filmstrip_container_"+t).css({height:i*a.image_height/a.image_width}),jQuery(".bwg_slideshow_filmstrip_"+t).css({height:i*a.image_height/a.image_width-40}))}function bwg_calculate_slideshow_filmstrip_thumbnail_size(e){var t=e.bwg,i=e.params,a=i.slideshow_filmstrip_width;if(2==i.slideshow_filmstrip_type){var r="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_fix_count_"+t+" .bwg_slideshow_filmstrip_thumbnail_"+t;a=(i.left_or_top,"width"==i.width_or_height?jQuery(r).width():jQuery(r).height())}return parseFloat(a)}function bwg_move_dots(e){var t=jQuery(".bwg_slideshow_dots_active_"+e).position().left,i=jQuery(".bwg_slideshow_dots_active_"+e).position().left+jQuery(".bwg_slideshow_dots_active_"+e).outerWidth(!0),a=jQuery(".bwg_slideshow_dots_container_"+e).outerWidth(!0),r=jQuery(".bwg_slideshow_dots_thumbnails_"+e).outerWidth(!1),_=jQuery(".bwg_slideshow_dots_thumbnails_"+e).position().left,s=Math.abs(jQuery(".bwg_slideshow_dots_thumbnails_"+e).position().left)+a;r<a||(t<Math.abs(_)?jQuery(".bwg_slideshow_dots_thumbnails_"+e).animate({left:-t},{duration:500,complete:function(){}}):s<i&&jQuery(".bwg_slideshow_dots_thumbnails_"+e).animate({left:-(i-a)},{duration:500,complete:function(){}}))}function bwg_testBrowser_cssTransitions(e){return bwg_testDom("Transition",e)}function bwg_testBrowser_cssTransforms3d(e){return bwg_testDom("Perspective",e)}function bwg_testDom(e,t){for(var i=["","Webkit","Moz","ms","O","Khtml"],a=i.length;a--;)if(void 0!==document.body.style[i[a]+e])return!0;return!1}function bwg_fallback(e,t,i,a){bwg_fade(e,t,i,a)}function bwg_fallback3d(e,t,i,a){bwg_sliceV(e,t,i,a)}function bwg_none(e,t,i,a){var r=void 0!==a&&""!==a?"_"+a:"";if(jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),void 0!==a&&""!==a){var _=bwg_params[a].bwg_current_key;bwg_change_watermark_container(a),jQuery(".bwg_slideshow_filmstrip_thumbnail"+r).removeClass("bwg_slideshow_thumb_active"+r).addClass("bwg_slideshow_thumb_deactive"+r),jQuery("#bwg_filmstrip_thumbnail_"+_+r).removeClass("bwg_slideshow_thumb_deactive"+r).addClass("bwg_slideshow_thumb_active"+r),jQuery(".bwg_slideshow_dots"+r).removeClass("bwg_slideshow_dots_active"+r).addClass("bwg_slideshow_dots_deactive"+r),jQuery("#bwg_dots_"+_+r).removeClass("bwg_slideshow_dots_deactive"+r).addClass("bwg_slideshow_dots_active"+r)}else jQuery(".bwg_image_info").show(),gallery_box_data.bwg_trans_in_progress=!1,jQuery(e).html(""),bwg_change_watermark_container()}function bwg_iterator(e){var t=1;return void 0!==e&&""!==e&&void 0!==bwg_params[e]&&1==bwg_params[e].enable_slideshow_shuffle&&(t=Math.floor((bwg_params[e].data.length-1)*Math.random()+1)),t}function bwg_change_image_slideshow(e,t,i,a,r){i=bwg_params[r].data;if(jQuery("#bwg_slideshow_image_container_"+r).find("iframe").each(function(){jQuery(this)[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*"),jQuery(this)[0].contentWindow.postMessage('{ "method": "pause" }',"*"),jQuery(this)[0].contentWindow.postMessage("pause","*")}),jQuery("#image_id_"+r+"_"+i[e].id).find(".bwg_fb_video").each(function(){jQuery(this).attr("src",jQuery(this).attr("src"))}),i[t]){if(jQuery(".bwg_ctrl_btn_"+r).hasClass("bwg-icon-pause")&&bwg_play(bwg_params[r].data,r),a||(jQuery("#bwg_current_image_key_"+r).val(t),"-1"==e?e=jQuery(".bwg_slideshow_thumb_active_"+r).children("img").attr("image_key"):"-2"==e&&(e=jQuery(".bwg_slideshow_dots_active_"+r).attr("image_key"))),bwg_params[r].bwg_trans_in_progress)return void bwg_params[r].event_stack.push(e+"-"+t);var _="right";if(t<e)_="left";else if(e==t)return;jQuery(".bwg_slideshow_watermark_"+r).css({display:"none"}),jQuery(".bwg_slideshow_title_text_"+r).css({display:"none"}),jQuery(".bwg_slideshow_description_text_"+r).css({display:"none"}),"width"==bwg_params[r].width_or_height?bwg_params[r].bwg_current_filmstrip_pos=t*(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+r).width()+2+2*bwg_params[r].lightbox_filmstrip_thumb_border_width):bwg_params[r].bwg_current_filmstrip_pos=t*(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+r).height()+2+2*bwg_params[r].lightbox_filmstrip_thumb_border_width),e=t,bwg_params[r].bwg_current_key=e,jQuery("#bwg_slideshow_image_"+r).attr("image_id",i[t].id),jQuery(".bwg_slideshow_title_text_"+r).html(jQuery('<span style="display: block;" />').html(i[t].alt).text()),jQuery(".bwg_slideshow_description_text_"+r).html(jQuery('<span style="display: block;" />').html(i[t].description).text());var s=2==jQuery(".bwg_slideshow_image_spun_"+r).css("zIndex")?".bwg_slideshow_image_spun_"+r:".bwg_slideshow_image_second_spun_"+r,o=s==".bwg_slideshow_image_second_spun_"+r?".bwg_slideshow_image_spun_"+r:".bwg_slideshow_image_second_spun_"+r,l=-1<i[t].filetype.indexOf("EMBED_"),n=-1<i[t].filetype.indexOf("INSTAGRAM_POST"),g=-1<i[t].filetype.indexOf("INSTAGRAM_VIDEO"),w=jQuery(s).height(),b=jQuery(s).width(),u='<span class="bwg_slideshow_image_spun1_'+r+'" style="display: '+(l?"block":"table")+' ;width: inherit; height: inherit;"><span class="bwg_slideshow_image_spun2_'+r+'" style="display: '+(l?"block":"table-cell")+'; vertical-align: middle; text-align: center; ">';if(l){if(u+='<span style="height: '+w+"px; width: "+b+'px;" class="bwg_popup_embed bwg_popup_watermark">',g&&(u+='<span class="bwg_inst_play_btn_cont" onclick="bwg_play_instagram_video(this)"><span class="bwg_inst_play"></span></span>'),n){var d=jQuery(".bwg_embed_frame"),h=jQuery(".bwg_slideshow_image_container_"+r).width(),m=jQuery(".bwg_slideshow_image_container_"+r).height(),c=i[t].image_width,p=i[t].image_height,y=bwg_resizing_ratio(c,p,h,m);d.attr("data-width",h),d.attr("data-height",m);var f=y.width,j=y.height;f<j?f-=109:f+=109,u+=spider_display_embed(i[t].filetype,decodeURIComponent(i[t].image_url),i[t].filename,{class:"bwg_embed_frame","data-width":h,"data-height":m,"data-instagram-width":c,"data-instagram-height":p,style:"width:"+f+"px; height:"+j+"px; vertical-align:middle; display:inline-block; position:relative;"})}else u+=spider_display_embed(i[t].filetype,decodeURIComponent(i[t].image_url),i[t].filename,{class:"bwg_embed_frame",frameborder:"0",allowfullscreen:"allowfullscreen","data-max-width":b,"data-max-height":w,style:"width:inherit; height:inherit; vertical-align:middle; display:table-cell;"});u+="</span>"}else{if("do_nothing"!=bwg_params[r].thumb_click_action){var Q="";"open_lightbox"==bwg_params[r].thumb_click_action?Q+=' class="bwg_lightbox" data-image-id="'+i[t].id+'" data-elementor-open-lightbox="no"':"redirect_to_url"==bwg_params[r].thumb_click_action&&i[t].redirect_url&&(Q+='href="'+i[t].redirect_url+'"'+(bwg_params[r].thumb_link_target&&1==bwg_params[r].thumb_link_target?' target="_blank"':"")),u+="<a "+Q+">"}u+='<img style="max-height: '+w+"px !important; max-width: "+b+'px !important; display:inline-block;" ',u+=' class="bwg_slide bwg_slideshow_image_'+r+'" ',u+=' id="bwg_slideshow_image_'+r+'" ',u+=' src="'+bwg_params[r].upload_url+jQuery("<span style='display: block;' />").html(decodeURIComponent(i[t].image_url)).text()+'" alt="'+i[t].alt+'" image_id="'+i[t].id+'" /></a>'}u+="</span></span>",jQuery(o).html(u),bwg_params[r].preload_images&&bwg_preload_images(t,r),window["bwg_"+bwg_params[r].slideshow_effect](s,o,_,r),1==bwg_params[r].slideshow_filmstrip_type?bwg_slideshow_filmstrip_fix_dimension(r):2==bwg_params[r].slideshow_filmstrip_type?bwg_slideshow_filmstrip_fix_count(r):bwg_move_dots(r),i[t].is_embed_video?jQuery("#bwg_slideshow_play_pause_"+r).css({display:"none"}):jQuery("#bwg_slideshow_play_pause_"+r).css({display:""})}bwg_add_lightbox(),"EMBED_OEMBED_INSTAGRAM_POST"==i[t].filetype&&"undefined"!=typeof instgrm&&void 0!==instgrm.Embeds&&(jQuery(".instagram-media").hide(),instgrm.Embeds.process(),jQuery(".instagram-media").css({"max-height":j+"px","min-width":f+"px !important"}),jQuery(".instagram-media").show())}function bwg_preload_images_slideshow(e,t){var i=bwg_params[t].data;count=bwg_params[t].preload_images_count/2;var a=i.length;if(a<bwg_params[t].preload_images_count&&(count=0),0!=count)for(var r=e-count;r<e+count;r++){var _=parseInt((r+a)%a),s=-1<i[_].filetype.indexOf("EMBED_");void 0!==i[_]&&(s||jQuery("<img/>").attr("src",bwg_params[t].upload_url+jQuery('<span style="display: block;" />').html(decodeURIComponent(i[_].image_url)).text()))}else for(r=0;r<i.length;r++){s=-1<i[r].filetype.indexOf("EMBED_");void 0!==i[r]&&(s||jQuery("<img/>").attr("src",bwg_params[t].upload_url+jQuery('<span style="display: block;" />').html(decodeURIComponent(i[r].image_url)).text()))}}function bwg_preload_images(e,t){void 0!==t&&""!==t?bwg_preload_images_slideshow(e,t):bwg_preload_images_lightbox(e)}function bwg_popup_resize_slidshow(e){var t="#bwg_container1_"+e+" #bwg_container2_"+e,i=t+" .bwg_slideshow_image_wrap_"+e,a=t+" .bwg_slideshow_image_container_"+e,r=t+" .bwg_slideshow_image_"+e,_=".bwg_slideshow_filmstrip_"+e;2==bwg_params[e].slideshow_filmstrip_type&&(_=".bwg_slideshow_filmstrip_fix_count_"+e);var s=jQuery("#bwg_container1_"+e).parent();s.hasClass("content-area")&&s.width(s.closest(".content-area").width()),s.hasClass("elementor-tab-content")&&s.width(s.closest(".elementor-widget-wrap").width());var o=s.width(),l=bwg_params[e].data;if(o>=bwg_params[e].image_width){jQuery(".bwg_slideshow_image_wrap_"+e).css({width:bwg_params[e].image_width}),jQuery(".bwg_slideshow_image_wrap_"+e).css({height:bwg_params[e].image_height}),jQuery(".bwg_slideshow_image_container_"+e).css({width:"horizontal"==bwg_params[e].filmstrip_direction?bwg_params[e].image_width:bwg_params[e].image_width-bwg_params[e].slideshow_filmstrip_width}),jQuery(".bwg_slideshow_image_container_"+e).css({height:"horizontal"==bwg_params[e].filmstrip_direction?bwg_params[e].image_height-bwg_params[e].slideshow_filmstrip_height:bwg_params[e].image_height}),jQuery(".bwg_slideshow_image_"+e).css({cssText:(bwg_params[e].filmstrip_direction,bwg_params[e].image_width)}),jQuery(".bwg_slideshow_embed_"+e).css({cssText:(bwg_params[e].filmstrip_direction,bwg_params[e].image_width)}),bwg_resize_instagram_post(e),bwg_change_watermark_container(e);var n="horizontal"==bwg_params[e].filmstrip_direction?"width: "+bwg_params[e].image_width:"height: "+bwg_params[e].image_height,g="horizontal"==bwg_params[e].filmstrip_direction?"width: "+(bwg_params[e].image_width-40):"height: "+(bwg_params[e].image_height-40);if(jQuery(".bwg_slideshow_filmstrip_container_"+e).css({cssText:n}),jQuery(_).css({cssText:g}),jQuery(".bwg_slideshow_dots_container_"+e).css({width:bwg_params[e].image_width}),jQuery("#bwg_slideshow_play_pause-ico_"+e).css({fontSize:bwg_params[e].slideshow_play_pause_btn_size}),"image"==bwg_params[e].watermark_type&&jQuery(".bwg_slideshow_watermark_image_"+e).css({maxWidth:bwg_params[e].watermark_width,maxHeight:bwg_params[e].watermark_height}),"text"==bwg_params[e].watermark_type&&jQuery(".bwg_slideshow_watermark_text_"+e+", .bwg_slideshow_watermark_text_"+e+" :hover").css({fontSize:bwg_params[e].watermark_font_size}),jQuery(".bwg_slideshow_title_text_"+e).css({fontSize:2*bwg_params[e].slideshow_title_font_size}),jQuery(".bwg_slideshow_description_text_"+e).css({fontSize:2*bwg_params[e].slideshow_description_font_size}),2==bwg_params[e].slideshow_filmstrip_type){var w=bwg_params[e].filmstrip_direction,b="#bwg_container1_"+e+" #bwg_container2_"+e;jQuery(b).removeAttr("style");var u=b+" .bwg_slideshow_filmstrip_container_"+e,d=bwg_params[e].slideshow_filmstrip_rl_btn_size,h=jQuery(".bwg_slideshow_filmstrip_fix_count_"+e).width();"horizontal"==w&&(h=jQuery(".bwg_slideshow_filmstrip_fix_count_"+e).height());var m="horizontal"==w?"table-cell":"block";jQuery(u).find(".bwg_slideshow_filmstrip_left_"+e).css({display:"none"}),jQuery(u).find(".bwg_slideshow_filmstrip_left_disabled_"+e).css({display:m}),jQuery(u).find(".bwg_slideshow_filmstrip_right_"+e).css({display:m}),jQuery(u).find(".bwg_slideshow_filmstrip_right_disabled_"+e).css({display:"none"}),h<d?(d=h,jQuery(u).find(".bwg-icon-angle-left").css({"font-size":d}),jQuery(u).find(".bwg-icon-angle-right").css({"font-size":d}),jQuery(u).find(".bwg-icon-angle-up").css({"font-size":d}),jQuery(u).find(".bwg-icon-angle-down").css({"font-size":d})):(jQuery(u).find(".bwg-icon-angle-left").removeAttr("style"),jQuery(u).find(".bwg-icon-angle-right").removeAttr("style"),jQuery(u).find(".bwg-icon-angle-up").removeAttr("style"),jQuery(u).find(".bwg-icon-angle-down").removeAttr("style"));var c=b+" .bwg_slideshow_filmstrip_thumbnails_"+e;jQuery(c).removeAttr("style"),jQuery(c+" .bwg_slideshow_filmstrip_thumbnail_"+e).each(function(e,t){jQuery(t).attr("style",jQuery(t).attr("data-style")),jQuery(t).find("img").attr("style",jQuery(t).attr("data-style"))});var p="#bwg_container1_"+e+" #bwg_container2_"+e+" .bwg_slideshow_image_container_"+e,y=(jQuery(p).data("filmstrip-position"),jQuery(p).data("filmstrip-size"));jQuery(p).css({filmstrip_position:y});var f="bwg_slideshow_filmstrip_thumbnail_"+e;window.bwg_slideshow_filmstrip_thumb[f].next_prev_index&&(window.bwg_slideshow_filmstrip_thumb[f].next_prev_index=0)}}else{var j=o*(bwg_params[e].image_height/bwg_params[e].image_width);1==bwg_params[e].slideshow_filmstrip_type&&bwg_resize_slideshow_filmstrip_fix_dimension({bwg:e,params:bwg_params[e],parent_width:o-40}),2==bwg_params[e].slideshow_filmstrip_type&&bwg_resize_slideshow_filmstrip_fix_count({bwg:e,params:bwg_params[e],parent_width:o}),jQuery(".bwg_slideshow_dots_container_"+e).css({width:o}),jQuery("#bwg_slideshow_play_pause-ico_"+e).css({fontSize:o*(bwg_params[e].slideshow_play_pause_btn_size/bwg_params[e].image_width)}),jQuery(".bwg_slideshow_watermark_image_"+e).css({maxWidth:o*(bwg_params[e].watermark_width/bwg_params[e].image_width),maxHeight:o*(bwg_params[e].watermark_height/bwg_params[e].image_width)}),jQuery(".bwg_slideshow_watermark_text_"+e+", .bwg_slideshow_watermark_text_"+e+":hover").css({fontSize:o*(bwg_params[e].watermark_font_size/bwg_params[e].image_width)}),jQuery(".bwg_slideshow_title_text_"+e).css({fontSize:2*o*bwg_params[e].slideshow_title_font_size/bwg_params[e].image_width}),jQuery(".bwg_slideshow_description_text_"+e).css({fontSize:2*o*bwg_params[e].slideshow_description_font_size/bwg_params[e].image_width}),jQuery(i).css({width:o,height:j}),jQuery(a).css({width:o,height:j}),jQuery(r).css({display:"inline-block","max-width":o,"max-height":j})}l[parseInt(jQuery("#bwg_current_image_key_"+e).val())].is_embed_video?jQuery("#bwg_slideshow_play_pause_"+e).css({display:"none"}):jQuery("#bwg_slideshow_play_pause_"+e).css({display:""})}function bwg_popup_resize(e){void 0!==e&&""!==e?bwg_popup_resize_slidshow(e):bwg_popup_resize_lightbox()}function bwg_change_image(e,t,i,a,r){void 0!==r&&""!==r?bwg_change_image_slideshow(e,t,i,a,r):bwg_change_image_lightbox(e,t,i=gallery_box_data.data,a)}function bwg_resize_instagram_post(e){var t=!1;if(void 0!==e&&""!==e){if(jQuery(".inner_instagram_iframe_bwg_embed_frame_"+e).length){t=!0;var i=jQuery("#instagram-embed-"+e),a=jQuery(".bwg_slideshow_embed_"+e),r=jQuery(".bwg_embed_frame_"+e),_=void 0!==a.width()?a.width():jQuery(".bwg_slideshow_embed_"+e).width(),s=void 0!==a.height()?a.height():jQuery(".bwg_slideshow_embed_"+e).height(),o=r.data("instagram-width"),l=r.data("instagram-height");bwg_change_watermark_container(e)}}else if(jQuery(".inner_instagram_iframe_bwg_embed_frame").length){t=!0;i=jQuery(".instagram-media"),r=jQuery(".bwg_embed_frame"),_=jQuery(".bwg_image_container").width(),s=jQuery(".bwg_image_container").height(),o=r.data("instagram-width"),l=r.data("instagram-height");bwg_change_watermark_container()}if(!0===t){var n=bwg_resizing_ratio(o,l,_,s);r.attr("data-width",_),r.attr("data-height",s);var g=n.width,w=n.height;g<w?g-=109:g+=109,r.width(g),r.height(w),i.css({"max-height":w+"px","min-width":g+"px !important"})}}function bwg_play(t,i){if(void 0!==i&&""!==i)t=bwg_params[i].data;void 0!==i&&""!==i?(window.clearInterval(window["bwg_playInterval"+i]),window["bwg_playInterval"+i]=setInterval(function(){var e=1;1==bwg_params[i].enable_slideshow_shuffle&&(e=Math.floor((t.length-1)*Math.random()+1)),bwg_change_image(parseInt(jQuery("#bwg_current_image_key_"+i).val()),(parseInt(jQuery("#bwg_current_image_key_"+i).val())+e)%t.length,t,"",i)},1e3*bwg_params[i].slideshow_interval)):(window.clearInterval(gallery_box_data.bwg_playInterval),gallery_box_data.bwg_playInterval=setInterval(function(){jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_play_pause").length&&jQuery(".bwg_play_pause").hasClass("bwg-icon-play")||(void 0===t||void 0!==t[parseInt(jQuery("#bwg_current_image_key").val())+1]?bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),parseInt(jQuery("#bwg_current_image_key").val())+1):1==gallery_box_data.enable_loop&&bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),0))},1e3*gallery_box_data.slideshow_interval))}function bwg_image_browser(e){if(jQuery("#bwg_embed_frame_16x9_"+e).width(jQuery("#bwg_embed_frame_16x9_"+e).parents(".image_browser_image_buttons_"+e).width()),jQuery("#bwg_embed_frame_16x9_"+e).height(.5625*jQuery("#bwg_embed_frame_16x9_"+e).width()),jQuery("#bwg_embed_frame_instapost_"+e).width(jQuery("#bwg_embed_frame_16x9_"+e).parents(".image_browser_image_buttons_"+e).width()),jQuery(".image_browser_images_conteiner_"+e).find(".fluid-width-video-wrapper").length){var t=jQuery(".image_browser_images_conteiner_"+e).find(".fluid-width-video-wrapper").contents();jQuery(".image_browser_images_conteiner_"+e).find(".fluid-width-video-wrapper").replaceWith(t)}jQuery(".bwg_embed_frame_instapost_"+e).height((jQuery(".bwg_embed_frame_instapost_"+e).width()-16)*jQuery(".bwg_embed_frame_instapost_"+e).attr("data-height")/jQuery(".bwg_embed_frame_instapost_"+e).attr("data-width")+96);var i=jQuery(".image_browser_images_"+e).width();i<=108?jQuery(".paging-input_"+e).css("display","none"):(i<=200?(jQuery(".paging-input_"+e).css("margin","0% 0% 0% 0%"),jQuery(".paging-input_"+e).css("display","inline")):i<=580?(jQuery(".paging-input_"+e).css("display","inline"),jQuery(".tablenav-pages_"+e+" a").css("font-size","13px"),jQuery(".paging-input_"+e).css("margin","0% 7% 0% 7%")):(jQuery(".tablenav-pages_"+e+" a").css("font-size","15px"),jQuery(".paging-input_"+e).css("margin","0% 14% 0% 14%"),jQuery(".paging-input_"+e).css("display","inline")),jQuery(".tablenav-pages_"+e+" .next-page").css("margin","0% 0% 0% 0%"),jQuery(".tablenav-pages_"+e+" .prev-page").css("margin","0% 0% 0% 0%"))}function bwg_disable_right_click(e){e.bind("contextmenu",function(){return!1}),e.css("webkitTouchCallout","none")}function bwg_resizing_ratio(e,t,i,a){var r=[i/e,a/t];return{width:e*(r=Math.min(r[0],r[1])),height:t*r}}function bwg_slideshow_filmstrip_next(e){var t=e.bwg,i=e.params,a=e.slideshow_filmstrip_class_name,r=bwg_calculate_slideshow_filmstrip_thumbnail_size({bwg:t,params:i}),_="bwg_slideshow_filmstrip_thumbnail_"+t,s="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_left_"+t,o="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_left_disabled_"+t,l="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_right_"+t,n="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_right_disabled_"+t,g="horizontal"==i.filmstrip_direction?"table-cell":"block";"left"==i.left_or_top?"width"==i.width_or_height?(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left>=-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).width()-jQuery(a).width())&&(jQuery(s).css({display:g}),jQuery(o).css({display:"none"}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left<-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).width()-jQuery(a).width()-(parseInt(i.filmstrip_thumb_margin_hor)+r))?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({left:-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).width()-jQuery(a).width())},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({left:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left-(parseInt(i.filmstrip_thumb_margin_hor)+r)},500,"linear")),window.setTimeout(function(){parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left)==-parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).width()-jQuery(a).width())?(jQuery(l).css({display:"none"}),jQuery(n).css({display:g})):(jQuery(l).css({display:g}),jQuery(n).css({display:"none"}))},510)):(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left>=-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).height()-jQuery(a).height())&&(jQuery(s).css({display:g}),jQuery(o).css({display:"none"}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left<-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).height()-jQuery(a).height()-(parseInt(i.filmstrip_thumb_margin_hor)+r))?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({left:-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).height()-jQuery(a).height())},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({left:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left-(parseInt(i.filmstrip_thumb_margin_hor)+r)},500,"linear")),window.setTimeout(function(){parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left)==-parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).height()-jQuery(a).height())?(jQuery(l).css({display:"none"}),jQuery(n).css({display:g})):(jQuery(l).css({display:g}),jQuery(n).css({display:"none"}))},510)):"width"==i.width_or_height?(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top>=-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).width()-jQuery(a).width())&&(jQuery(s).css({display:g}),jQuery(o).css({display:"none"}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top<-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).width()-jQuery(a).width()-parseInt(i.filmstrip_thumb_margin_hor)+r)?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({top:-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).width()-jQuery(a).width())},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({top:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top-parseInt(i.filmstrip_thumb_margin_hor)+r},500,"linear")),window.setTimeout(function(){parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top)==-parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).width()-jQuery(a).width())?(jQuery(l).css({display:"none"}),jQuery(n).css({display:g})):(jQuery(l).css({display:g}),jQuery(n).css({display:"none"}))},510)):(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top>=-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).height()-jQuery(a).height())&&(jQuery(s).css({display:g}),jQuery(o).css({display:"none"}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top<-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).height()-jQuery(a).height()-(parseInt(i.filmstrip_thumb_margin_hor)+r))?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({top:-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).height()-jQuery(a).height())},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({top:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top-(parseInt(i.filmstrip_thumb_margin_hor)+r)},500,"linear")),window.setTimeout(function(){parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top)==-parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).height()-jQuery(a).height())?(jQuery(l).css({display:"none"}),jQuery(n).css({display:g})):(jQuery(l).css({display:g}),jQuery(n).css({display:"none"}))},510)),bwg_slideshow_filmstrip_thumb[_].next_prev_index=bwg_slideshow_filmstrip_thumb[_].next_prev_index+1}function bwg_slideshow_filmstrip_prev(e){var t=e.bwg,i=e.params,a=bwg_calculate_slideshow_filmstrip_thumbnail_size({bwg:t,params:i}),r="bwg_slideshow_filmstrip_thumbnail_"+t,_="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_left_"+t,s="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_left_disabled_"+t,o="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_right_"+t,l="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_right_disabled_"+t,n="horizontal"==i.filmstrip_direction?"table-cell":"block";"left"==i.left_or_top?(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left<0&&(jQuery(o).css({display:n}),jQuery(l).css({display:"none"}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left>-(i.filmstrip_thumb_margin_hor+a)?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({left:0},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({left:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left+parseInt(i.filmstrip_thumb_margin_hor)+a},500,"linear")),window.setTimeout(function(){0==parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left)?(jQuery(_).css({display:"none"}),jQuery(s).css({display:n})):(jQuery(_).css({display:n}),jQuery(s).css({display:"none"}))},510)):(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top<0&&(jQuery(o).css({display:n}),jQuery(l).css({display:"none"}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top>-(i.filmstrip_thumb_margin_hor+a)?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({top:0},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({top:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top+parseInt(i.filmstrip_thumb_margin_hor)+a},500,"linear")),window.setTimeout(function(){0==parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top)?(jQuery(_).css({display:"none"}),jQuery(s).css({display:n})):(jQuery(_).css({display:n}),jQuery(s).css({display:"none"}))},510)),bwg_slideshow_filmstrip_thumb[r].next_prev_index=bwg_slideshow_filmstrip_thumb[r].next_prev_index-1}jQuery(function(){function i(e){bwg_slideshow_blur(e),bwg_carousel_blur(e),0<jQuery(".bwg_play_pause").length&&window.clearInterval(gallery_box_data.bwg_playInterval)}function a(e){e&&bwg_main_ready(e),bwg_slideshow_focus(),bwg_carousel_focus(),jQuery(".bwg_play_pause").length&&jQuery(".bwg_play_pause").hasClass("bwg-icon-play")&&!jQuery(".bwg_comment_container").hasClass("bwg_open")&&bwg_play(gallery_box_data.data)}var r=!1;jQuery(".bwg_container").each(function(){if(0<jQuery(this).find(".wd_error").length&&(r=!0),!r){var e=jQuery(this);if(e[0].offsetHeight)var t=0;else t=1;setInterval(function(){e[0].offsetHeight?1==t&&(t=0,a(e)):0==t&&i(!(t=1))},200)}}),r||jQuery(window).focus(function(){a()}).blur(function(){i(!0)})}),jQuery(window).on("resize",function(){setTimeout(function(){var e=!1;jQuery(".bwg_container").each(function(){0<jQuery(this).find(".wd_error").length&&(e=!0)}),bwg_tags_button_section_visibility(),e||(jQuery(".bwg-thumbnails, .bwg-masonry-thumbnails, .bwg-album-thumbnails").each(function(){bwg_all_thumnails_loaded(this)}),bwg_slideshow_resize(),bwg_image_browser_resize(),bwg_carousel_resize(),bwg_blog_style_resize(),jQuery(".bwg-mosaic-thumbnails").each(function(){bwg_thumbnail_mosaic(this)})),bwg_resize_search_line()},0)}),jQuery(window).on("load",function(){var e=!1;jQuery(".bwg_container").each(function(){0<jQuery(this).find(".wd_error").length&&(e=!0)}),e||(bwg_blog_style_onload(),jQuery(".bwg-mosaic-thumbnails").each(function(){bwg_thumbnail_mosaic(this)}))}),jQuery(".bwg-masonry-thumb-span img, .bwg-mosaic-thumb-span img").on("error",function(){jQuery(this).height(100),jQuery(this).width(100)});
|
1 |
+
var bwg_current_filmstrip_pos,total_thumbnail_count,key,startPoint,endPoint,bwg_image_info_pos,filmstrip_width,preloadCount,filmstrip_thumbnail_width,filmstrip_thumbnail_height,addthis_share,lightbox_comment_pos,bwg_transition_duration,bwg_playInterval,isPopUpOpened=!1,bwg_overflow_initial_value=!1,bwg_overflow_x_initial_value=!1,bwg_overflow_y_initial_value=!1;function gallery_box_ready(){filmstrip_thumbnail_width=jQuery(".bwg_filmstrip_thumbnail").width(),filmstrip_thumbnail_height=jQuery(".bwg_filmstrip_thumbnail").height(),1==gallery_box_data.open_with_fullscreen?(filmstrip_width=jQuery(window).width(),filmstrip_height=jQuery(window).height()):(filmstrip_width=jQuery(".bwg_filmstrip_container").width(),filmstrip_height=jQuery(".bwg_filmstrip_container").height()),preloadCount="horizontal"==gallery_box_data.filmstrip_direction?parseInt(filmstrip_width/filmstrip_thumbnail_width)+gallery_box_data.preload_images_count:parseInt(filmstrip_height/filmstrip_thumbnail_height)+gallery_box_data.preload_images_count,total_thumbnail_count=jQuery(".bwg_filmstrip_thumbnail").length,key=parseInt(jQuery("#bwg_current_image_key").val()),startPoint=0,endPoint=key+preloadCount,jQuery(function(){bwg_load_visible_images(key,preloadCount,total_thumbnail_count),jQuery(".pge_tabs li a").on("click",function(){return jQuery(".pge_tabs_container > div").hide(),jQuery(".pge_tabs li").removeClass("pge_active"),jQuery(jQuery(this).attr("href")).show(),jQuery(this).closest("li").addClass("pge_active"),jQuery("[name=type]").val(jQuery(this).attr("href").substr(1)),!1});var e=jQuery("#bwg_rated").attr("data-params");void 0!==e&&bwg_rating((e=JSON.parse(e)).current_rate,e.current_rate_count,e.current_avg_rating,e.current_image_key)}),1==gallery_box_data.is_pro&&1==gallery_box_data.enable_addthis&&gallery_box_data.addthis_profile_id&&(addthis_share={url:gallery_box_data.share_url}),lightbox_comment_pos=gallery_box_data.lightbox_comment_pos,bwg_image_info_pos=jQuery(".bwg_ctrl_btn_container").length?jQuery(".bwg_ctrl_btn_container").height():0,bwg_transition_duration=gallery_box_data.slideshow_interval<4*gallery_box_data.slideshow_effect_duration&&0!=gallery_box_data.slideshow_interval?1e3*gallery_box_data.slideshow_interval/4:1e3*gallery_box_data.slideshow_effect_duration,gallery_box_data.bwg_transition_duration=bwg_transition_duration,gallery_box_data.bwg_trans_in_progress=!1,(jQuery("#spider_popup_wrap").width()>=jQuery(window).width()||jQuery("#spider_popup_wrap").height()>=jQuery(window).height())&&parseInt(jQuery(".spider_popup_close").css("right"))<0&&jQuery(".spider_popup_close").attr("class","spider_popup_close_fullscreen"),window.clearInterval(bwg_playInterval),bwg_current_filmstrip_pos=gallery_box_data.current_pos,jQuery(document).on("keydown",function(e){jQuery("#bwg_name").is(":focus")||jQuery("#bwg_email").is(":focus")||jQuery("#bwg_comment").is(":focus")||jQuery("#bwg_captcha_input").is(":focus")||("ArrowRight"==e.key?parseInt(jQuery("#bwg_current_image_key").val())==gallery_box_data.data.length-1?bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),0):bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),parseInt(jQuery("#bwg_current_image_key").val())+1):"ArrowLeft"==e.key?0==parseInt(jQuery("#bwg_current_image_key").val())?bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),gallery_box_data.data.length-1):bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),parseInt(jQuery("#bwg_current_image_key").val())-1):"Escape"==e.key?spider_destroypopup(1e3):"Space"==e.key&&jQuery(".bwg_play_pause").trigger("click"))}),jQuery(window).resize(function(){void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&(jQuery.fullscreen.isFullScreen()||bwg_popup_resize())});var r=gallery_box_data.image_width,_=gallery_box_data.image_height;if(1==gallery_box_data.is_pro){1==gallery_box_data.enable_addthis&&gallery_box_data.addthis_profile_id&&jQuery(".at4-share-outer").show(),spider_set_input_value("rate_ajax_task","save_hit_count"),spider_rate_ajax_save("bwg_rate_form");var e=gallery_box_data.data,t=gallery_box_data.current_image_key;jQuery(".bwg_image_hits span").html(++e[t].hit_count);var i=window.location.hash;i&&"-1"!=i.indexOf("bwg")||(location.replace("#bwg"+gallery_box_data.gallery_id+"/"+gallery_box_data.current_image_id),history.replaceState(void 0,void 0,"#bwg"+gallery_box_data.gallery_id+"/"+gallery_box_data.current_image_id))}1==gallery_box_data.image_right_click&&(jQuery(".bwg_image_wrap").bind("contextmenu",function(e){return!1}),jQuery(".bwg_image_wrap").css("webkitTouchCallout","none")),jQuery("#spider_popup_wrap").bind("touchmove",function(e){e.preventDefault()}),void 0!==jQuery().swiperight&&jQuery.isFunction(jQuery().swiperight)&&jQuery("#spider_popup_wrap .bwg_image_wrap").swiperight(function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),(parseInt(jQuery("#bwg_current_image_key").val())+gallery_box_data.data.length-1)%gallery_box_data.data.length),!1}),void 0!==jQuery().swipeleft&&jQuery.isFunction(jQuery().swipeleft)&&jQuery("#spider_popup_wrap .bwg_image_wrap").swipeleft(function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),(parseInt(jQuery("#bwg_current_image_key").val())+1)%gallery_box_data.data.length),!1}),bwg_reset_zoom();var a=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())?"touchend":"click";jQuery("#spider_popup_left").on(a,function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),(parseInt(jQuery("#bwg_current_image_key").val())+gallery_box_data.data.length-1)%gallery_box_data.data.length),!1}),jQuery("#spider_popup_right").on(a,function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),(parseInt(jQuery("#bwg_current_image_key").val())+1)%gallery_box_data.data.length),!1}),-1!=navigator.appVersion.indexOf("MSIE 10")||-1!=navigator.appVersion.indexOf("MSIE 9")?setTimeout(function(){bwg_popup_resize()},1):bwg_popup_resize(),jQuery(".bwg_watermark").css({display:"none"}),setTimeout(function(){bwg_change_watermark_container()},500),void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&(jQuery.fullscreen.isNativelySupported()||jQuery(".bwg_fullscreen").hide()),"horizontal"==gallery_box_data.filmstrip_direction?(jQuery(".bwg_image_container").height(jQuery(".bwg_image_wrap").height()-gallery_box_data.image_filmstrip_height),jQuery(".bwg_image_container").width(jQuery(".bwg_image_wrap").width())):(jQuery(".bwg_image_container").height(jQuery(".bwg_image_wrap").height()),jQuery(".bwg_image_container").width(jQuery(".bwg_image_wrap").width()-gallery_box_data.image_filmstrip_width)),void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".bwg_comments,.bwg_ecommerce_panel, .bwg_image_info").mCustomScrollbar({scrollInertia:150,theme:"dark-thick",advanced:{updateOnContentResize:!0}});var s=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";jQuery(".bwg_filmstrip").on(s,function(e){var t=window.event||e,i=(t=t.originalEvent?t.originalEvent:t).detail?-40*t.detail:t.wheelDelta,a=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase());0<i?jQuery(".bwg_filmstrip_left").trigger(a?"touchend":"click"):jQuery(".bwg_filmstrip_right").trigger(a?"touchend":"click")}),jQuery(".bwg_filmstrip_right").on(a,function(){jQuery(".bwg_filmstrip_thumbnails").stop(!0,!1),"left"==gallery_box_data.left_or_top?"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_thumbnails").position().left>=-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width())&&(jQuery(".bwg_filmstrip_left").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().left<-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width()-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width+gallery_box_data.all_images_right_left_space))?jQuery(".bwg_filmstrip_thumbnails").animate({left:-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width()-gallery_box_data.all_images_right_left_space)},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({left:jQuery(".bwg_filmstrip_thumbnails").position().left-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_filmstrip_thumbnails").position().left==-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width())&&jQuery(".bwg_filmstrip_right").css({opacity:.3})},500)):(jQuery(".bwg_filmstrip_thumbnails").position().left>=-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height())&&(jQuery(".bwg_filmstrip_left").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().left<-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height()-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width+gallery_box_data.all_images_right_left_space))?jQuery(".bwg_filmstrip_thumbnails").animate({left:-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height()-gallery_box_data.all_images_right_left_space)},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({left:jQuery(".bwg_filmstrip_thumbnails").position().left-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_filmstrip_thumbnails").position().left==-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height())&&jQuery(".bwg_filmstrip_right").css({opacity:.3})},500)):"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_thumbnails").position().top>=-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width())&&(jQuery(".bwg_filmstrip_left").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().top<-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width()-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width+gallery_box_data.all_images_right_left_space))?jQuery(".bwg_filmstrip_thumbnails").animate({left:-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width()-gallery_box_data.all_images_right_left_space)},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({left:jQuery(".bwg_filmstrip_thumbnails").position().top-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_filmstrip_thumbnails").position().left==-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width())&&jQuery(".bwg_filmstrip_right").css({opacity:.3})},500)):(jQuery(".bwg_filmstrip_thumbnails").position().top>=-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height())&&(jQuery(".bwg_filmstrip_left").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().top<-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height()-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width+gallery_box_data.all_images_right_left_space))?jQuery(".bwg_filmstrip_thumbnails").animate({top:-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height()-gallery_box_data.all_images_right_left_space)},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({top:jQuery(".bwg_filmstrip_thumbnails").position().top-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_filmstrip_thumbnails").position().left==-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height())&&jQuery(".bwg_filmstrip_right").css({opacity:.3})},500))}),"left"==gallery_box_data.left_or_top?jQuery(".bwg_filmstrip_left").on(a,function(){jQuery(".bwg_filmstrip_thumbnails").stop(!0,!1),jQuery(".bwg_filmstrip_thumbnails").position().left<0&&(jQuery(".bwg_filmstrip_right").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().left>-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)?jQuery(".bwg_filmstrip_thumbnails").animate({left:0},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({left:jQuery(".bwg_filmstrip_thumbnails").position().left+gallery_box_data.image_filmstrip_width+gallery_box_data.filmstrip_thumb_right_left_space},500,"linear")),window.setTimeout(function(){0==jQuery(".bwg_filmstrip_thumbnails").position().left&&jQuery(".bwg_filmstrip_left").css({opacity:.3})},500)}):jQuery(".bwg_filmstrip_left").on(a,function(){jQuery(".bwg_filmstrip_thumbnails").stop(!0,!1),jQuery(".bwg_filmstrip_thumbnails").position().top<0&&(jQuery(".bwg_filmstrip_right").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().top>-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)?jQuery(".bwg_filmstrip_thumbnails").animate({top:0},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({top:jQuery(".bwg_filmstrip_thumbnails").position().top+gallery_box_data.image_filmstrip_width+gallery_box_data.filmstrip_thumb_right_left_space},500,"linear")),window.setTimeout(function(){0==jQuery(".bwg_filmstrip_thumbnails").position().top&&jQuery(".bwg_filmstrip_left").css({opacity:.3})},500)}),"width"==gallery_box_data.width_or_height?bwg_set_filmstrip_pos(jQuery(".bwg_filmstrip").width(),"",gallery_box_data):bwg_set_filmstrip_pos(jQuery(".bwg_filmstrip").height(),"",gallery_box_data),jQuery(".bwg_info").on(a,function(){if("none"==jQuery(".bwg_image_info_container1").css("display")){jQuery(".bwg_image_info_container1").css("display","table-cell"),jQuery(".bwg_info").attr("title",bwg_objectsL10n.bwg_hide_info);jQuery(".bwg_ctrl_btn_container").length&&jQuery(".bwg_ctrl_btn_container").height();jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set()}else jQuery(".bwg_image_info_container1").css("display","none"),jQuery(".bwg_info").attr("title",bwg_objectsL10n.bwg_show_info)}),jQuery(".bwg_rate").on(a,function(){"none"==jQuery(".bwg_image_rate_container1").css("display")?(jQuery(".bwg_image_rate_container1").css("display","table-cell"),jQuery(".bwg_rate").attr("title",bwg_objectsL10n.bwg_hide_rating)):(jQuery(".bwg_image_rate_container1").css("display","none"),jQuery(".bwg_rate").attr("title",bwg_objectsL10n.bwg_show_rating))}),jQuery(".bwg_zoom").on(a,function(){var e=["mousemove","touchmove"];jQuery("figure.bwg_popup_image").each(function(){var i=jQuery(this);i.hasClass("zoom")?jQuery.each(e,function(e,t){i.removeClass("zoom"),i.off(t)}):jQuery.each(e,function(e,t){i.addClass("zoom"),i.on(t,function(e){var t,i,a,r;window.clearInterval(bwg_playInterval),jQuery(".bwg_play_pause").attr("title",bwg_objectsL10n.bwg_play),jQuery(".bwg_play_pause").attr("class","bwg-icon-play bwg_ctrl_btn bwg_play_pause");var _=e.target,s=_.getBoundingClientRect();e.targetTouches&&(a=e.targetTouches[0].clientX-s.left,r=e.targetTouches[0].clientY-s.top),t=e.offsetX?e.offsetX:e.targetTouches?a:_.offsetHeight,i=e.offsetY?e.offsetY:e.targetTouches?r:_.offsetWidth,x=t/_.offsetWidth*100,y=i/_.offsetHeight*100,_.parentNode.style.backgroundPosition=x+"% "+y+"%"})})})}),jQuery(".bwg_comment, .bwg_comments_close_btn").on(a,function(){bwg_comment()}),jQuery(".bwg_ecommerce, .bwg_ecommerce_close_btn").on(a,function(){bwg_ecommerce()}),jQuery(".bwg_toggle_container").on(a,function(){var e="top"==gallery_box_data.lightbox_ctrl_btn_pos?"bwg-icon-caret-up":"bwg-icon-caret-down",t="top"==gallery_box_data.lightbox_ctrl_btn_pos?"bwg-icon-caret-down":"bwg-icon-caret-up";jQuery(".bwg_toggle_container i").hasClass(e)?(gallery_box_data.enable_image_filmstrip&&"bottom"==gallery_box_data.lightbox_filmstrip_pos||"bottom"!=gallery_box_data.lightbox_ctrl_btn_pos||"bottom"!=gallery_box_data.lightbox_rate_pos?gallery_box_data.enable_image_filmstrip&&"top"==gallery_box_data.lightbox_filmstrip_pos||"top"!=gallery_box_data.lightbox_ctrl_btn_pos||"top"!=gallery_box_data.lightbox_rate_pos||jQuery(".bwg_image_rate").animate({top:0},500):jQuery(".bwg_image_rate").animate({bottom:0},500),gallery_box_data.enable_image_filmstrip&&"bottom"==gallery_box_data.lightbox_filmstrip_pos||"bottom"!=gallery_box_data.lightbox_ctrl_btn_pos||"bottom"!=gallery_box_data.lightbox_hit_pos?gallery_box_data.enable_image_filmstrip&&"top"==gallery_box_data.lightbox_filmstrip_pos||"top"!=gallery_box_data.lightbox_ctrl_btn_pos||"top"!=gallery_box_data.lightbox_hit_pos||jQuery(".bwg_image_hit").animate({top:0},500):jQuery(".bwg_image_hit").animate({bottom:0},500),"bottom"==gallery_box_data.lightbox_ctrl_btn_pos?(jQuery(".bwg_ctrl_btn_container").animate({bottom:"-"+jQuery(".bwg_ctrl_btn_container").height()},500).addClass("closed"),jQuery(".bwg_toggle_container").animate({bottom:0},{duration:500,complete:function(){jQuery(".bwg_toggle_container i").attr("class","bwg_toggle_btn "+t)}})):(jQuery(".bwg_ctrl_btn_container").animate({top:"-"+jQuery(".bwg_ctrl_btn_container").height()},500).addClass("closed"),jQuery(".bwg_toggle_container").animate({top:0},{duration:500,complete:function(){jQuery(".bwg_toggle_container i").attr("class","bwg_toggle_btn "+t)}}))):(gallery_box_data.enable_image_filmstrip&&"bottom"==gallery_box_data.lightbox_filmstrip_pos||"bottom"!=gallery_box_data.lightbox_ctrl_btn_pos||"bottom"!=gallery_box_data.lightbox_rate_pos?gallery_box_data.enable_image_filmstrip&&"top"==gallery_box_data.lightbox_filmstrip_pos||"top"!=gallery_box_data.lightbox_ctrl_btn_pos||"top"!=gallery_box_data.lightbox_rate_pos||jQuery(".bwg_image_rate").animate({top:jQuery(".bwg_ctrl_btn_container").height()},500):jQuery(".bwg_image_rate").animate({bottom:jQuery(".bwg_ctrl_btn_container").height()},500),gallery_box_data.enable_image_filmstrip&&"bottom"==gallery_box_data.lightbox_filmstrip_pos||"bottom"!=gallery_box_data.lightbox_ctrl_btn_pos||"bottom"!=gallery_box_data.lightbox_hit_pos?gallery_box_data.enable_image_filmstrip&&"top"==gallery_box_data.lightbox_filmstrip_pos||"top"!=gallery_box_data.lightbox_ctrl_btn_pos||"top"!=gallery_box_data.lightbox_hit_pos||jQuery(".bwg_image_hit").animate({top:jQuery(".bwg_ctrl_btn_container").height()},500):jQuery(".bwg_image_hit").animate({bottom:jQuery(".bwg_ctrl_btn_container").height()},500),"bottom"==gallery_box_data.lightbox_ctrl_btn_pos?(jQuery(".bwg_ctrl_btn_container").animate({bottom:0},500).removeClass("closed"),jQuery(".bwg_toggle_container").animate({bottom:jQuery(".bwg_ctrl_btn_container").height()},{duration:500,complete:function(){jQuery(".bwg_toggle_container i").attr("class","bwg_toggle_btn "+e)}})):(jQuery(".bwg_ctrl_btn_container").animate({top:0},500).removeClass("closed"),jQuery(".bwg_toggle_container").animate({top:jQuery(".bwg_ctrl_btn_container").height()},{duration:500,complete:function(){jQuery(".bwg_toggle_container i").attr("class","bwg_toggle_btn "+e)}}))),bwg_info_position(!0)});var o=window.innerHeight;jQuery(".bwg_resize-full").on(a,function(){bwg_resize_full()}),jQuery(".bwg_fullscreen").on(a,function(){jQuery(".bwg_watermark").css({display:"none"});var e,t=0;if((jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(t=jQuery(".bwg_comment_container").width()||jQuery(".bwg_ecommerce_container").width()),void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen))if(jQuery.fullscreen.isFullScreen())jQuery.fullscreen.exit(),e=o,jQuery(window).width()>gallery_box_data.image_width&&(r=gallery_box_data.image_width),window.innerHeight>gallery_box_data.image_height&&(_=gallery_box_data.image_height),gallery_box_data.open_with_fullscreen&&(r=jQuery(window).width(),_=e),jQuery("#spider_popup_wrap").on("fscreenclose",function(){jQuery("#spider_popup_wrap").css({width:r,height:_,left:"50%",top:"50%",marginLeft:-r/2,marginTop:-_/2,zIndex:1e5}),jQuery(".bwg_image_wrap").css({width:r-t}),jQuery(".bwg_image_container").css({height:_-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:r-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxWidth:r-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:_-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:r-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:_-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),bwg_resize_instagram_post(),bwg_change_watermark_container(),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").css({width:r-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)}),jQuery(".bwg_filmstrip").css({width:r-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(r-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").css({height:_-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)}),jQuery(".bwg_filmstrip").css({height:_-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(_-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),"horizontal"!=gallery_box_data.filmstrip_direction&&jQuery(".bwg_filmstrip_right").css({top:_-jQuery(".bwg_filmstrip_right").height()})),jQuery(".bwg_resize-full").show(),jQuery(".bwg_resize-full").attr("class","bwg-icon-expand bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_maximize),jQuery(".bwg_fullscreen").attr("class","bwg-icon-arrows-out bwg_ctrl_btn bwg_fullscreen"),jQuery(".bwg_fullscreen").attr("title",bwg_objectsL10n.bwg_fullscreen),jQuery("#spider_popup_wrap").width()<jQuery(window).width()&&jQuery("#spider_popup_wrap").height()<window.innerHeight&&jQuery(".spider_popup_close_fullscreen").attr("class","spider_popup_close")});else{jQuery("#spider_popup_wrap").fullscreen();var i=screen.width,a=screen.height;jQuery("#spider_popup_wrap").css({width:i,height:a,left:0,top:0,margin:0,zIndex:1e5}),jQuery(".bwg_image_wrap").css({width:i-t}),jQuery(".bwg_image_container").css({height:a-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:i-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxWidth:i-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:a-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:i-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:a-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),bwg_resize_instagram_post(),bwg_change_watermark_container(),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").css({width:i-("horizontal"==gallery_box_data.filmstrip_direction?t:0)},500),jQuery(".bwg_filmstrip").css({width:i-("horizontal"==gallery_box_data.filmstrip_direction?t:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(i-("horizontal"==gallery_box_data.filmstrip_direction?t:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").css({height:a-("horizontal"==gallery_box_data.filmstrip_direction)?"comment_container_width":0}),jQuery(".bwg_filmstrip").css({height:a-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(a-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),"horizontal"!=gallery_box_data.filmstrip_direction&&jQuery(".bwg_filmstrip_right").css({top:a-jQuery(".bwg_filmstrip_right").height()})),jQuery(".bwg_resize-full").hide(),jQuery(".bwg_fullscreen").attr("class","bwg-icon-compress bwg_ctrl_btn bwg_fullscreen"),jQuery(".bwg_fullscreen").attr("title",bwg_objectsL10n.bwg_exit_fullscreen),jQuery(".spider_popup_close").attr("class","spider_popup_close_fullscreen")}return!1}),jQuery(".bwg_play_pause").on(a,function(){jQuery(".bwg_play_pause").length&&jQuery(".bwg_play_pause").hasClass("bwg-icon-play")&&!jQuery(".bwg_comment_container").hasClass("bwg_open")?(bwg_play(gallery_box_data.data),jQuery(".bwg_play_pause").attr("title",bwg_objectsL10n.bwg_pause),jQuery(".bwg_play_pause").attr("class","bwg-icon-pause bwg_ctrl_btn bwg_play_pause")):(window.clearInterval(bwg_playInterval),jQuery(".bwg_play_pause").attr("title",bwg_objectsL10n.bwg_play),jQuery(".bwg_play_pause").attr("class","bwg-icon-play bwg_ctrl_btn bwg_play_pause"))}),gallery_box_data.open_with_autoplay&&(bwg_play(gallery_box_data.data),jQuery(".bwg_play_pause").attr("title",bwg_objectsL10n.bwg_pause),jQuery(".bwg_play_pause").attr("class","bwg-icon-pause bwg_ctrl_btn bwg_play_pause")),gallery_box_data.open_with_fullscreen&&bwg_open_with_fullscreen(),jQuery(".bwg_popup_image").removeAttr("width"),jQuery(".bwg_popup_image").removeAttr("height"),jQuery(window).focus(function(){jQuery(".bwg_play_pause").length&&!jQuery(".bwg_play_pause").hasClass("bwg-icon-play")&&bwg_play(gallery_box_data.data)}),jQuery(window).blur(function(){event_stack=[],window.clearInterval(bwg_playInterval)});gallery_box_data.lightbox_ctrl_btn_pos;1==gallery_box_data.open_ecommerce&&setTimeout(function(){bwg_ecommerce()},400),1==gallery_box_data.open_comment&&bwg_comment()}function spider_createpopup(e,t,a,r,_,s,o,l){e=e.replace(/&/g,"&"),isPopUpOpened||(isPopUpOpened=!0,spider_isunsupporteduseragent()||(bwg_overflow_initial_value=jQuery("html").css("overflow"),bwg_overflow_x_initial_value=jQuery("html").css("overflow-x"),bwg_overflow_y_initial_value=jQuery("html").css("overflow-y"),jQuery("html").attr("style","overflow:hidden !important;"),jQuery("#bwg_spider_popup_loading_"+t).show(),jQuery("#spider_popup_overlay_"+t).css({display:"block"}),jQuery.ajax({type:"GET",url:e,success:function(e){var t=jQuery('<div id="spider_popup_wrap" class="spider_popup_wrap" style=" width:'+a+"px; height:"+r+"px; margin-top:-"+r/2+"px; margin-left: -"+a/2+'px; ">'+e+"</div>").hide().appendTo("body");if(gallery_box_ready(),spider_showpopup(s,o,t,_,l),"undefined"!=typeof addthis){jQuery(".addthis-smartlayers").show();var i=setInterval(function(){void 0!==addthis.layers.refresh&&(clearInterval(i),addthis.layers.refresh())},100)}},beforeSend:function(){},complete:function(){}})))}function spider_showpopup(e,t,i,a,r){var _=gallery_box_data.data,s=parseInt(jQuery("#bwg_current_image_key").val());if(void 0!==_[s]&&(isPopUpOpened=!0,-1<_[s].filetype.indexOf("EMBED_")?bwg_first_image_load(i,r):jQuery("#spider_popup_wrap .bwg_popup_image_spun img").prop("complete")?bwg_first_image_load(i,r):jQuery("#spider_popup_wrap .bwg_popup_image_spun img").on("load error",function(){bwg_first_image_load(i,r)}),"EMBED_OEMBED_INSTAGRAM_POST"==_[s].filetype&&"undefined"!=typeof instgrm&&void 0!==instgrm.Embeds)){instgrm.Embeds.process();var o=parseInt(jQuery("#bwg_image_container").height());jQuery(".bwg_embed_frame .instagram-media").css({"max-height":o+"px"})}}function bwg_first_image_load(e,t){e.show(),""==gallery_box_data.data[key].alt&&""==gallery_box_data.data[key].description?jQuery(".bwg_info").hide():jQuery(".bwg_info").show();var i=jQuery(".bwg_ctrl_btn_container").height();"bottom"==t?jQuery(".bwg_toggle_container").css("bottom",i+"px"):"top"==t&&jQuery(".bwg_toggle_container").css("top",i+"px"),jQuery(".bwg_spider_popup_loading").hide(),1==gallery_box_data.preload_images&&bwg_preload_images(parseInt(jQuery("#bwg_current_image_key").val())),bwg_load_filmstrip(),bwg_info_height_set()}function spider_isunsupporteduseragent(){return!window.XMLHttpRequest}function spider_destroypopup(e){jQuery(".addthis-smartlayers").hide(),null!=document.getElementById("spider_popup_wrap")&&(void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&jQuery.fullscreen.isFullScreen()&&jQuery.fullscreen.exit(),"undefined"!=typeof enable_addthis&&enable_addthis&&jQuery(".at4-share-outer").hide(),setTimeout(function(){jQuery(".spider_popup_wrap").remove(),jQuery(".bwg_spider_popup_loading").css({display:"none"}),jQuery(".spider_popup_overlay").css({display:"none"}),jQuery(document).off("keydown"),!1!==bwg_overflow_initial_value&&jQuery("html").css("overflow",bwg_overflow_initial_value),!1!==bwg_overflow_x_initial_value&&jQuery("html").css("overflow-x",bwg_overflow_x_initial_value),!1!==bwg_overflow_y_initial_value&&jQuery("html").css("overflow-y",bwg_overflow_y_initial_value)},20)),isPopUpOpened=!1;var t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),i=document.querySelector('meta[name="viewport"]');t&&i&&(i.content="width=device-width, initial-scale=1");var a=jQuery(document).scrollTop();bwg_objectsL10n.is_pro&&history.pushState(history.state,null,window.location.origin+window.location.pathname+window.location.search),jQuery(document).scrollTop(a),void 0!==gallery_box_data.bwg_playInterval&&clearInterval(gallery_box_data.bwg_playInterval)}function get_ajax_pricelist(){var e={};return jQuery(".add_to_cart_msg").html(""),e.ajax_task="display",e.image_id=jQuery("#bwg_popup_image").attr("image_id"),jQuery("#ecommerce_ajax_loading").css("height",jQuery(".bwg_ecommerce_panel").css("height")),jQuery("#ecommerce_opacity_div").css("width",jQuery(".bwg_ecommerce_panel").css("width")),jQuery("#ecommerce_opacity_div").css("height",jQuery(".bwg_ecommerce_panel").css("height")),jQuery("#ecommerce_loading_div").css("width",jQuery(".bwg_ecommerce_panel").css("width")),jQuery("#ecommerce_loading_div").css("height",jQuery(".bwg_ecommerce_panel").css("height")),jQuery("#ecommerce_opacity_div").css("display","block"),jQuery("#ecommerce_loading_div").css("display","table-cell"),jQuery.ajax({type:"POST",url:jQuery("#bwg_ecommerce_form").attr("action"),data:e,success:function(e){jQuery(".pge_tabs li a").on("click",function(){return jQuery(".pge_tabs_container > div").hide(),jQuery(".pge_tabs li").removeClass("pge_active"),jQuery(jQuery(this).attr("href")).show(),jQuery(this).closest("li").addClass("pge_active"),jQuery("[name=type]").val(jQuery(this).attr("href").substr(1)),!1});var t=jQuery(e).find(".manual").html();jQuery(".manual").html(t);var i=jQuery(e).find(".downloads").html();jQuery(".downloads").html(i);var a=jQuery(e).find(".pge_options").html();jQuery(".pge_options").html(a);var r=jQuery(e).find(".pge_add_to_cart").html();jQuery(".pge_add_to_cart").html(r)},beforeSend:function(){},complete:function(){jQuery("#ecommerce_opacity_div").css("display","none"),jQuery("#ecommerce_loading_div").css("display","none")}}),!1}function spider_ajax_save(e){var t={};return t.bwg_name=jQuery("#bwg_name").val(),t.bwg_comment=jQuery("#bwg_comment").val(),t.bwg_email=jQuery("#bwg_email").val(),t.bwg_captcha_input=jQuery("#bwg_captcha_input").val(),t.ajax_task=jQuery("#ajax_task").val(),t.image_id=jQuery("#image_id").val(),t.comment_id=jQuery("#comment_id").val(),jQuery("#ajax_loading").css("height",jQuery(".bwg_comments").css("height")),jQuery("#opacity_div").css("width",jQuery(".bwg_comments").css("width")),jQuery("#opacity_div").css("height",jQuery(".bwg_comments").css("height")),jQuery("#loading_div").css("width",jQuery(".bwg_comments").css("width")),jQuery("#loading_div").css("height",jQuery(".bwg_comments").css("height")),document.getElementById("opacity_div").style.display="",document.getElementById("loading_div").style.display="table-cell",jQuery.ajax({type:"POST",url:jQuery("#"+e).attr("action"),data:t,success:function(e){jQuery(".bwg_comments").mCustomScrollbar("destroy");var t=jQuery(e).find(".bwg_comments").html();jQuery(".bwg_comments").html(t)},beforeSend:function(){},complete:function(){document.getElementById("opacity_div").style.display="none",document.getElementById("loading_div").style.display="none",jQuery(".bwg_comments").mCustomScrollbar({scrollInertia:150,theme:"dark-thick",advanced:{updateOnContentResize:!0}}),jQuery(".bwg_comments_close_btn").click(bwg_comment),bwg_captcha_refresh("bwg_captcha")}}),!1}function spider_rate_ajax_save(i,e){var t={};return t.image_id=jQuery("#"+i+" input[name='image_id']").val(),t.rate=void 0!==e?e:jQuery("#"+i+" input[name='score']").val(),t.ajax_task=jQuery("#rate_ajax_task").val(),jQuery.ajax({type:"POST",url:jQuery("#"+i).attr("action"),data:t,success:function(e){var t=jQuery(e).find("#"+i).html();jQuery("#"+i).html(t)},beforeSend:function(){},complete:function(){}})}function spider_set_input_value(e,t){document.getElementById(e)&&(document.getElementById(e).value=t)}function spider_form_submit(e,t){document.getElementById(t)&&document.getElementById(t).submit(),e.preventDefault?e.preventDefault():e.returnValue=!1}function spider_check_required(e,t){return""==jQuery("#"+e).val()&&(alert(t+" "+bwg_objectsL10n.bwg_field_required),jQuery("#"+e).attr("style","border-color: #FF0000;"),jQuery("#"+e).focus(),!0)}function comment_check_privacy_policy(){var e=jQuery("#bwg_submit");e.removeClass("bwg-submit-disabled"),e.removeAttr("disabled"),jQuery("#bwg_comment_privacy_policy").is(":checked")||(e.addClass("bwg-submit-disabled"),e.attr("disabled","disabled"))}function spider_check_email(e){if(""!=jQuery("#"+e).val())return-1==jQuery("#"+e).val().replace(/^\s+|\s+$/g,"").search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)&&(alert(bwg_objectsL10n.bwg_mail_validation),!0)}function bwg_captcha_refresh(e){document.getElementById(e+"_img")&&document.getElementById(e+"_input")&&(srcArr=document.getElementById(e+"_img").src.split("&r="),document.getElementById(e+"_img").src=srcArr[0]+"&r="+Math.floor(100*Math.random()),document.getElementById(e+"_img").style.display="inline-block",document.getElementById(e+"_input").value="")}function bwg_play_instagram_video(e,t){jQuery(e).parent().find("video").each(function(){jQuery(this).get(0).paused?(jQuery(this).get(0).play(),jQuery(e).children().hide()):(jQuery(this).get(0).pause(),jQuery(e).children().show())})}function bwg_add_comment(){var t=jQuery("#bwg_comment_form"),e=t.attr("action"),i={ajax_task:"add_comment"};return i.comment_name=t.find("#bwg_name").val(),i.comment_email=t.find("#bwg_email").val(),i.comment_text=t.find("#bwg_comment").val(),i.comment_captcha=t.find("#bwg_captcha_input").val(),i.popup_enable_captcha=t.find("#bwg_popup_enable_captcha").val(),i.privacy_policy=t.find("#bwg_comment_privacy_policy").is(":checked")?1:0,i.comment_image_id=jQuery("#bwg_popup_image").attr("image_id"),i.comment_moderation=t.find("#bwg_comment_moderation").val(),jQuery(".bwg_spider_ajax_loading").hide(),jQuery.ajax({url:e,type:"POST",dataType:"json",data:i,success:function(e){jQuery(".bwg_comment_error").text(""),1==e.error?jQuery.each(e.error_messages,function(e,t){t&&jQuery(".bwg_comment_"+e+"_error").text(t)}):(t.find("#bwg_comment").val(""),jQuery(".bwg_comment_waiting_message").hide(),0==e.published&&jQuery(".bwg_comment_waiting_message").show(),""!=e.html_comments_block&&jQuery("#bwg_added_comments").html(e.html_comments_block).show())},beforeSend:function(){jQuery(".bwg_spider_ajax_loading").show()},complete:function(){0<t.find("#bwg_comment_privacy_policy").length&&(t.find("#bwg_comment_privacy_policy").prop("checked",!1),comment_check_privacy_policy()),bwg_captcha_refresh("bwg_captcha"),jQuery(".bwg_spider_ajax_loading").hide()},error:function(){}}),!1}function bwg_remove_comment(t){var e=jQuery("#bwg_comment_form").attr("action"),i={ajax_task:"delete_comment"};return i.id_image=jQuery("#bwg_popup_image").attr("image_id"),i.id_comment=t,jQuery.ajax({url:e,type:"POST",dataType:"json",data:i,success:function(e){0==e.error&&jQuery("#bwg_comment_block_"+t).fadeOut("slow").remove()},beforeSend:function(){},complete:function(){},error:function(){}}),!1}function bwg_gallery_box(e,t,i,a){jQuery(".bwg-validate").each(function(){jQuery(this).on("keypress change",function(){jQuery(this).parent().next().find(".bwg_comment_error").html("")})}),void 0===i&&(i=!1);var r,_=t.data("bwg");r=t.find(".bwg-container").data("lightbox-url")?t.find(".bwg-container").data("lightbox-url"):t.data("lightbox-url");var s=t.find(".cur_gal_id").val(),o=jQuery("#bwg_tag_id_"+s).val();o=o||0;var l=1==i?"&open_ecommerce=1":"",n=jQuery("#bwg_search_input_"+_).val(),g=jQuery("#bwg_order_"+_).val()?"&filtersortby="+jQuery("#bwg_order_"+_).val():"";n=n||"",void 0!==a&&(r+="&gallery_id="+a);var w="",b=jQuery("#bwg_blog_style_share_buttons_"+e).attr("data-open-comment");void 0!==b&&!1!==b&&(w="&open_comment=1"),spider_createpopup(r+"&bwg_random_seed="+jQuery("#bwg_random_seed_"+_).val()+"&image_id="+e+"&filter_tag="+o+l+w+"&filter_search_name="+n+g,_,t.data("popup-width"),t.data("popup-height"),1,"testpopup",5,t.data("buttons-position"))}function bwg_change_image_lightbox(e,a,r,t){if(jQuery("#bwg_rate_form input[name='image_id']").val(r[a].id),bwg_current_key=gallery_box_data.bwg_current_key,""==gallery_box_data.data[a].alt&&""==gallery_box_data.data[a].description?jQuery(".bwg_info").hide():jQuery(".bwg_info").show(),jQuery(".bwg_image_info").css("height","auto"),setTimeout(function(){bwg_info_height_set(),jQuery(".bwg_image_description").height()>jQuery(".bwg_image_info").height()&&jQuery(".mCSB_container").hasClass("mCS_no_scrollbar")&&jQuery(".bwg_image_info").mCustomScrollbar("destroy"),jQuery(".bwg_image_info").hasClass("mCustomScrollbar")||void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".bwg_image_info").mCustomScrollbar({scrollInertia:150,theme:"dark-thick",advanced:{updateOnContentResize:!0}})},200),jQuery("#spider_popup_left").show(),jQuery("#spider_popup_right").show(),jQuery(".bwg_image_info").hide(),0==gallery_box_data.enable_loop&&(a==parseInt(r.length)-1&&jQuery("#spider_popup_right").hide(),0==a&&jQuery("#spider_popup_left").hide()),1==gallery_box_data.ecommerceACtive&&1==gallery_box_data.enable_image_ecommerce)if(0==gallery_box_data.data[a].pricelist)jQuery(".bwg_ecommerce").hide();else{jQuery(".bwg_ecommerce").show(),jQuery(".pge_tabs li").hide(),jQuery("#downloads").hide(),jQuery("#manual").hide();var i=gallery_box_data.data[a].pricelist_sections.split(",");if(i)if(jQuery("#"+i[0]).show(),jQuery("[name=type]").val(i[0]),1<i.length)for(jQuery(".pge_tabs").show(),k=0;k<i.length;k++)jQuery("#"+i[k]+"_li").show();else jQuery(".pge_tabs").hide();else jQuery("[name=type]").val("")}if(jQuery("#bwg_image_container").find("iframe").each(function(){jQuery(this)[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*"),jQuery(this)[0].contentWindow.postMessage('{ "method": "pause" }',"*"),jQuery(this)[0].contentWindow.postMessage("pause","*")}),jQuery("#bwg_image_container").find("video").each(function(){jQuery(this).trigger("pause")}),void 0===r&&(r=gallery_box_data.data),void 0!==r[a]&&void 0!==r[e]){if(jQuery(".bwg_play_pause").length&&!jQuery(".bwg_play_pause").hasClass("bwg-icon-play")&&bwg_play(r),t||jQuery("#bwg_current_image_key").val(a),gallery_box_data.bwg_trans_in_progress)return void gallery_box_data.event_stack.push(e+"-"+a);var _="right";if(bwg_current_key>a)_="left";else if(bwg_current_key==a)return;jQuery(".bwg_image_count").html(r[a].number),jQuery(".bwg_watermark").css({display:"none"}),"width"==gallery_box_data.width_or_height?bwg_current_filmstrip_pos=a*(jQuery(".bwg_filmstrip_thumbnail").width()+2+2*gallery_box_data.lightbox_filmstrip_thumb_border_width):"height"==gallery_box_data.width_or_height&&(bwg_current_filmstrip_pos=a*(jQuery(".bwg_filmstrip_thumbnail").height()+2+2*gallery_box_data.lightbox_filmstrip_thumb_border_width)),gallery_box_data.bwg_current_key=a,bwg_objectsL10n.is_pro&&(location.replace("#bwg"+gallery_box_data.gallery_id+"/"+r[a].id),history.replaceState(void 0,void 0,"#bwg"+gallery_box_data.gallery_id+"/"+r[a].id)),jQuery("#bwg_rate_form input[name='image_id']").val(r[a].id),spider_set_input_value("rate_ajax_task","save_hit_count"),spider_rate_ajax_save("bwg_rate_form"),gallery_box_data.popup_enable_rate&&(jQuery("#bwg_star").attr("data-score",r[a].avg_rating),jQuery("#bwg_star").removeAttr("title"),r[a].cur_key=a,bwg_rating(r[a].rate,r[a].rate_count,r[a].avg_rating,a)),jQuery(".bwg_image_hits span").html(++r[a].hit_count),jQuery("#bwg_popup_image").attr("image_id",r[a].id),jQuery(".bwg_image_title").html(jQuery("<span />").html(r[a].alt).text()),jQuery(".bwg_image_description").html(jQuery("<span />").html(r[a].description).text()),jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive"),jQuery("#bwg_filmstrip_thumbnail_"+a).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active"),jQuery(".bwg_image_info").css("opacity",1),""==r[a].alt.trim()&&""==r[a].description.trim()&&jQuery(".bwg_image_info").css("opacity",0),"none"!=jQuery(".bwg_image_info_container1").css("display")?jQuery(".bwg_image_info_container1").css("display","table-cell"):jQuery(".bwg_image_info_container1").css("display","none"),"none"!=jQuery(".bwg_image_rate_container1").css("display")?jQuery(".bwg_image_rate_container1").css("display","table-cell"):jQuery(".bwg_image_rate_container1").css("display","none");var s=2==jQuery(".bwg_popup_image_spun").css("zIndex")?".bwg_popup_image_spun":".bwg_popup_image_second_spun",o=".bwg_popup_image_second_spun"==s?".bwg_popup_image_spun":".bwg_popup_image_second_spun",l=-1<r[a].filetype.indexOf("EMBED_"),n=-1<r[a].filetype.indexOf("INSTAGRAM_POST"),g=-1<r[a].filetype.indexOf("INSTAGRAM_VIDEO"),w=-1!==jQuery.inArray(r[a].filetype,["EMBED_OEMBED_YOUTUBE_VIDEO","EMBED_OEMBED_VIMEO_VIDEO","EMBED_OEMBED_FACEBOOK_VIDEO","EMBED_OEMBED_DAILYMOTION_VIDEO"]),b=jQuery(s).height(),u=jQuery(s).width(),d='<span class="bwg_popup_image_spun1" style="display: '+(l?"block":"table")+'; width: inherit; height: inherit;"><span class="bwg_popup_image_spun2" style="display:'+(l?"block":"table-cell")+'; vertical-align: middle;text-align: center;height: 100%;">';if(l){if(jQuery("#bwg_download").addClass("bwg-hidden"),d+='<span class="bwg_popup_embed bwg_popup_watermark" style="display: '+(w?"block":"table")+'; table-layout: fixed; height: 100%;">'+(g?'<div class="bwg_inst_play_btn_cont" onclick="bwg_play_instagram_video(this)" ><div class="bwg_inst_play"></div></div>':" "),n){var h=jQuery(".instagram-media"),m=jQuery(".bwg_embed_frame"),c=jQuery(".bwg_image_container").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),p=jQuery(".bwg_image_container").height()-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),y=r[a].image_width,f=r[a].image_height,j=bwg_resizing_ratio(y,f,c,p);m.attr("data-width",c),m.attr("data-height",p);var Q=j.width,v=j.height;Q<v?Q-=109:Q+=109,d+=spider_display_embed(r[a].filetype,r[a].image_url,r[a].filename,{class:"bwg_embed_frame","data-width":c,"data-height":p,"data-instagram-width":y,"data-instagram-height":f,style:"width:"+Q+"px; height:"+v+"px; vertical-align:middle; display:inline-block; position:relative;"}),h.css({"max-height":v+"px","min-width":Q+"px !important"})}else d+=spider_display_embed(r[a].filetype,r[a].image_url,r[a].filename,{class:"bwg_embed_frame",frameborder:"0",allowfullscreen:"allowfullscreen",style:"display:"+(w?"block":"table-cell")+"; width:inherit; height:inherit; vertical-align:middle;"});d+="</span>"}else{jQuery(".bwg-loading").removeClass("bwg-hidden"),jQuery("#bwg_download").removeClass("bwg-hidden");var x="'"+(gallery_box_data.site_url+jQuery("<span />").html(decodeURIComponent(r[a].image_url)).text()).split("?bwg")[0]+"'";gallery_box_data.popup_enable_zoom&&(d+='<figure style="max-height: '+b+"px; max-width: "+u+"px; background-image: url("+x+'); background-repeat: no-repeat" class="bwg_popup_image bwg_popup_watermark" alt="'+r[a].alt+'" />'),d+='<img style="max-height: '+b+"px; max-width: "+u+'px;" class="bwg_popup_image bwg_popup_watermark" src="'+gallery_box_data.site_url+jQuery("<span />").html(decodeURIComponent(r[a].image_url)).text()+'" alt="'+r[a].alt+'" />'}function z(){gallery_box_data.preload_images&&bwg_preload_images(a),window["bwg_"+gallery_box_data.bwg_image_effect](s,o,_),jQuery(s).find(".bwg_fb_video").each(function(){jQuery(this).attr("src","")}),l?jQuery("#bwg_fullsize_image").attr("href",decodeURIComponent(r[a].image_url)):(jQuery("#bwg_fullsize_image").attr("href",gallery_box_data.site_url+decodeURIComponent(r[a].image_url)),jQuery("#bwg_download").attr("href",gallery_box_data.site_url+decodeURIComponent(r[a].thumb_url).replace("/thumb/","/.original/")));var e=decodeURIComponent(r[a].image_url).split("/");jQuery("#bwg_download").attr("download",e[e.length-1].replace(/\?bwg=(\d+)$/,""));var t=encodeURIComponent(gallery_box_data.bwg_share_url)+"="+r[a].id+encodeURIComponent("#bwg"+gallery_box_data.gallery_id+"/")+r[a].id;if(l)var i=encodeURIComponent(r[a].thumb_url);else i=gallery_box_data.bwg_share_image_url+encodeURIComponent(encodeURIComponent(r[a].pure_image_url));i=i.replace(/%252F|%25252F/g,"%2F"),void 0!==addthis_share&&(addthis_share.url=t),jQuery("#bwg_facebook_a").attr("href","https://www.facebook.com/sharer/sharer.php?u="+t),jQuery("#bwg_twitter_a").attr("href","https://twitter.com/intent/tweet?url="+t),jQuery("#bwg_pinterest_a").attr("href","http://pinterest.com/pin/create/button/?s=100&url="+t+"&media="+i+"&description="+r[a].alt+"%0A"+r[a].description),jQuery("#bwg_tumblr_a").attr("href","https://www.tumblr.com/share/photo?source="+i+"&caption="+r[a].alt+"&clickthru="+t),jQuery(".bwg_comment_container").hasClass("bwg_open")&&(jQuery(".bwg_comments .mCSB_container").css("top","0"),jQuery("#bwg_added_comments").show(),spider_set_input_value("ajax_task","display"),spider_set_input_value("image_id",jQuery("#bwg_popup_image").attr("image_id")),spider_ajax_save("bwg_comment_form")),jQuery(".bwg_ecommerce_container").hasClass("bwg_open")&&(0==r[a].pricelist?(bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")),bwg_animate_image_box_for_hide_sidebar(),jQuery(".bwg_ecommerce_container").attr("class","bwg_ecommerce_container bwg_close"),jQuery(".bwg_ecommerce").attr("title",bwg_objectsL10n.bwg_show_ecommerce),jQuery(".spider_popup_close_fullscreen").show()):get_ajax_pricelist()),void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".bwg_comments").mCustomScrollbar({advanced:{updateOnContentResize:!0}}),jQuery(".bwg_comments .mCSB_scrollTools").hide(),gallery_box_data.enable_image_filmstrip&&bwg_slideshow_filmstrip_fix_dimension(),bwg_resize_instagram_post()}if(gallery_box_data.popup_enable_zoom?d+="</figure></span></span>":d+="</span></span>",jQuery(o).html(d),jQuery(o).find("img").on("load error",function(){jQuery(".bwg-loading").addClass("bwg-hidden")}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:u,maxHeight:b,height:"auto"}),l)z();else jQuery(o).find("img").one("load",function(){z()}).each(function(){this.complete&&jQuery(this).load()});"undefined"!=typeof instgrm&&void 0!==instgrm.Embeds&&(jQuery(".instagram-media").hide(),instgrm.Embeds.process(),jQuery(".instagram-media").show())}}function bwg_preload_images_lightbox(e){for(var t=gallery_box_data.data,i=t.length,a=0==gallery_box_data.preload_images_count||gallery_box_data.preload_images_count>=i?i:gallery_box_data.preload_images_count,r=0,_=1;r<a;_++){var s=1;do{var o=(e+_*s+i)%i;if(void 0!==t[o])-1<t[o].filetype.indexOf("EMBED_")||jQuery("<img/>").attr("src",gallery_box_data.site_url+jQuery("<span />").html(decodeURIComponent(t[o].image_url)).text());s*=-1,r++}while(1!=s)}}function bwg_popup_sidebar_open(e){var t=gallery_box_data.lightbox_comment_width,i=gallery_box_data.lightbox_comment_pos;if(t>jQuery(window).width()){if(t=jQuery(window).width(),e.css({width:t}),jQuery(".spider_popup_close_fullscreen").hide(),jQuery(".spider_popup_close").hide(),jQuery(".bwg_ctrl_btn").hasClass("bwg-icon-pause")){var a=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase());jQuery(".bwg_play_pause").trigger(a?"touchend":"click")}}else jQuery(".spider_popup_close_fullscreen").show();"left"==i?e.animate({left:0},100):e.animate({right:0},100)}function bwg_comment(){if(jQuery(".bwg_watermark").css({display:"none"}),jQuery(".bwg_ecommerce_wrap").css("z-index","-1"),jQuery(".bwg_comment_wrap").css("z-index","25"),jQuery(".bwg_ecommerce_container").hasClass("bwg_open")&&(bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")),jQuery(".bwg_ecommerce_container").attr("class","bwg_ecommerce_container bwg_close"),jQuery(".bwg_ecommerce").attr("title",bwg_objectsL10n.bwg_show_ecommerce)),jQuery(".bwg_comment_container").hasClass("bwg_open"))"1"==jQuery(".bwg_comment_container").attr("data-play-status")&&jQuery(".bwg_ctrl_btn.bwg_play_pause").removeClass("bwg-icon-play").addClass("bwg-icon-pause").attr("title",bwg_objectsL10n.bwg_pause),bwg_popup_sidebar_close(jQuery(".bwg_comment_container")),bwg_animate_image_box_for_hide_sidebar(),jQuery(".bwg_comment_wrap").css("z-index","-1"),jQuery(".bwg_comment_container").attr("class","bwg_comment_container bwg_close"),jQuery(".bwg_comment").attr("title",bwg_objectsL10n.bwg_show_comments),jQuery(".spider_popup_close_fullscreen").show();else{jQuery(".bwg_play_pause").hasClass("bwg-icon-pause")?jQuery(".bwg_comment_container").attr("data-play-status","1"):jQuery(".bwg_comment_container").attr("data-play-status","0"),jQuery(".bwg_ctrl_btn.bwg_play_pause").removeClass("bwg-icon-pause").addClass("bwg-icon-play").attr("title",bwg_objectsL10n.bwg_play),bwg_popup_sidebar_open(jQuery(".bwg_comment_container")),bwg_animate_image_box_for_show_sidebar(),jQuery(".bwg_comment_container").attr("class","bwg_comment_container bwg_open"),jQuery(".bwg_comment").attr("title",bwg_objectsL10n.bwg_hide_comments);var e=parseInt(jQuery("#bwg_current_image_key").val());void 0!==gallery_box_data.current_image_key&&0!=gallery_box_data.data[e].comment_count&&(jQuery("#bwg_added_comments").show(),spider_set_input_value("ajax_task","display"),spider_set_input_value("image_id",jQuery("#bwg_popup_image").attr("image_id")),spider_ajax_save("bwg_comment_form"))}jQuery(".bwg_comments").mCustomScrollbar("update",{scrollInertia:150,theme:"dark-thick",advanced:{updateOnContentResize:!0}})}function bwg_ecommerce(){jQuery(".bwg_watermark").css({display:"none"}),jQuery(".bwg_ecommerce_wrap").css("z-index","25"),jQuery(".bwg_comment_wrap").css("z-index","-1"),jQuery(".bwg_comment_container").hasClass("bwg_open")&&(bwg_popup_sidebar_close(jQuery(".bwg_comment_container")),jQuery(".bwg_comment_container").attr("class","bwg_comment_container bwg_close"),jQuery(".bwg_comment").attr("title",bwg_objectsL10n.bwg_show_comments)),jQuery(".bwg_ecommerce_container").hasClass("bwg_open")?(bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")),bwg_animate_image_box_for_hide_sidebar(),jQuery(".bwg_ecommerce_container").attr("class","bwg_ecommerce_container bwg_close"),jQuery(".bwg_ecommerce").attr("title",bwg_objectsL10n.bwg_show_ecommerce)):(bwg_popup_sidebar_open(jQuery(".bwg_ecommerce_container")),bwg_animate_image_box_for_show_sidebar(),jQuery(".bwg_ecommerce_container").attr("class","bwg_ecommerce_container bwg_open"),jQuery(".bwg_ecommerce").attr("title",bwg_objectsL10n.bwg_hide_ecommerce),get_ajax_pricelist())}function bwg_popup_sidebar_close(e){var t=parseInt(e.css("borderRightWidth"));t||(t=0),"left"==lightbox_comment_pos?e.animate({left:-e.width()-t},100):"right"==lightbox_comment_pos&&e.animate({right:-e.width()-t},100)}function bwg_animate_image_box_for_hide_sidebar(){"left"==lightbox_comment_pos?jQuery(".bwg_image_wrap").animate({left:0,width:jQuery("#spider_popup_wrap").width()},100):"right"==lightbox_comment_pos&&jQuery(".bwg_image_wrap").animate({right:0,width:jQuery("#spider_popup_wrap").width()},100),jQuery(".bwg_image_container").animate({width:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},100),jQuery(".bwg_popup_image").animate({maxWidth:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},{duration:100,complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_embed").animate({width:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},{duration:100,complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container()}}),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").animate({width:jQuery(".spider_popup_wrap").width()},100),jQuery(".bwg_filmstrip").animate({width:jQuery(".spider_popup_wrap").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},100)):"height"==gallery_box_data.width_or_height&&(jQuery(".bwg_filmstrip_container").animate({height:jQuery(".spider_popup_wrap").width()},100),jQuery(".bwg_filmstrip").animate({height:jQuery(".spider_popup_wrap").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},100)),bwg_set_filmstrip_pos(jQuery(".spider_popup_wrap").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),jQuery(".spider_popup_close_fullscreen").show(100)}function bwg_animate_image_box_for_show_sidebar(){var e=jQuery(".bwg_comment_container").width()||jQuery(".bwg_ecommerce_container").width();"left"==lightbox_comment_pos?jQuery(".bwg_image_wrap").animate({left:e,width:jQuery("#spider_popup_wrap").width()-e},100):"right"==lightbox_comment_pos&&jQuery(".bwg_image_wrap").animate({right:e,width:jQuery("#spider_popup_wrap").width()-e},100),jQuery(".bwg_image_container").animate({width:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e},100),jQuery(".bwg_popup_image").animate({maxWidth:jQuery("#spider_popup_wrap").width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},{duration:100,complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").animate({maxWidth:jQuery("#spider_popup_wrap").width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},{duration:100,complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container()}}),"width"==gallery_box_data.width_or_height&&(jQuery(".bwg_filmstrip_container").css({width:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?0:e)}),jQuery(".bwg_filmstrip").animate({width:jQuery(".bwg_filmstrip_container").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},100),bwg_set_filmstrip_pos(jQuery(".bwg_filmstrip_container").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data))}function bwg_reset_zoom(){var e=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),t=document.querySelector('meta[name="viewport"]');e&&t&&(t.content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0")}function bwg_open_with_fullscreen(){jQuery(".bwg_watermark").css({display:"none"});var e=0;(jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(e=jQuery(".bwg_comment_container").width()||jQuery(".bwg_ecommerce_container").width()),bwg_popup_current_width=jQuery(window).width(),bwg_popup_current_height=window.innerHeight,jQuery("#spider_popup_wrap").css({width:jQuery(window).width(),height:window.innerHeight,left:0,top:0,margin:0,zIndex:100002}),jQuery(".bwg_image_wrap").css({width:jQuery(window).width()-e}),jQuery(".bwg_image_container").css({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)}),jQuery(".bwg_popup_image").css({maxWidth:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_video").css({width:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container()}}),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").css({width:jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)}),jQuery(".bwg_filmstrip").css({width:jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").css({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)}),jQuery(".bwg_filmstrip").css({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)),jQuery(".bwg_resize-full").attr("class","bwg-icon-compress bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_restore),jQuery(".spider_popup_close").attr("class","spider_popup_close_fullscreen")}function bwg_resize_full(){jQuery(".bwg_watermark").css({display:"none"});var e=0;(jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(e=jQuery(".bwg_comment_container").width()||jQuery(".bwg_ecommerce_container").width()),jQuery(".bwg_resize-full").hasClass("bwg-icon-compress")?(jQuery(window).width()>gallery_box_data.image_width&&(bwg_popup_current_width=gallery_box_data.image_width),window.innerHeight>gallery_box_data.image_height&&(bwg_popup_current_height=gallery_box_data.image_height),jQuery("#spider_popup_wrap").animate({width:bwg_popup_current_width,height:bwg_popup_current_height,left:"50%",top:"50%",marginLeft:-bwg_popup_current_width/2,marginTop:-bwg_popup_current_height/2,zIndex:100002},500),jQuery(".bwg_image_wrap").animate({width:bwg_popup_current_width-e},500),jQuery(".bwg_image_container").animate({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},500),jQuery(".bwg_popup_image").animate({maxWidth:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{duration:500,complete:function(){bwg_change_watermark_container(),jQuery("#spider_popup_wrap").width()<jQuery(window).width()&&jQuery("#spider_popup_wrap").height()<window.innerHeight&&jQuery(".spider_popup_close_fullscreen").attr("class","spider_popup_close")}}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").animate({maxWidth:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{duration:500,complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container(),jQuery("#spider_popup_wrap").width()<jQuery(window).width()&&jQuery("#spider_popup_wrap").height()<window.innerHeight&&jQuery(".spider_popup_close_fullscreen").attr("class","spider_popup_close")}}),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").animate({width:bwg_popup_current_width-("horizontal"==gallery_box_data.filmstrip_direction?e:0)},500),jQuery(".bwg_filmstrip").animate({width:bwg_popup_current_width-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(bwg_popup_current_width-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").animate({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?e:0)},500),jQuery(".bwg_filmstrip").animate({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(bwg_popup_current_height-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),"horizontal"!=gallery_box_data.filmstrip_direction&&jQuery(".bwg_filmstrip_right").css({top:bwg_popup_current_height-jQuery(".bwg_filmstrip_right").height()})),jQuery(".bwg_resize-full").attr("class","bwg-icon-expand bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_maximize),setTimeout(function(){bwg_info_height_set()},500)):(bwg_popup_current_width=jQuery(window).width(),bwg_popup_current_height=window.innerHeight,jQuery("#spider_popup_wrap").animate({width:jQuery(window).width(),height:window.innerHeight,left:0,top:0,margin:0,zIndex:100002},500),jQuery(".bwg_image_wrap").animate({width:jQuery(window).width()-e},500),jQuery(".bwg_image_container").animate({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},500),jQuery(".bwg_popup_image").animate({maxWidth:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{duration:500,complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").animate({maxWidth:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{duration:500,complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container()}}),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").animate({width:jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?e:0)},500),jQuery(".bwg_filmstrip").animate({width:jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").animate({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?e:0)},500),jQuery(".bwg_filmstrip").animate({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),"horizontal"!=gallery_box_data.filmstrip_direction&&jQuery(".bwg_filmstrip_right").css({top:window.innerHeight-jQuery(".bwg_filmstrip_right").height()})),jQuery(".bwg_resize-full").attr("class","bwg-icon-compress bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_restore),jQuery(".spider_popup_close").attr("class","spider_popup_close_fullscreen")),setTimeout(function(){bwg_info_height_set()},500)}function bwg_popup_resize_lightbox(){void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&(jQuery.fullscreen.isFullScreen()||(jQuery(".bwg_resize-full").show(),jQuery(".bwg_resize-full").hasClass("bwg-icon-compress")||jQuery(".bwg_resize-full").attr("class","bwg-icon-expand bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_maximize),jQuery(".bwg_fullscreen").attr("class","bwg-icon-arrows-out bwg_ctrl_btn bwg_fullscreen"),jQuery(".bwg_fullscreen").attr("title",bwg_objectsL10n.fullscreen)));var e=0;(jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(e=gallery_box_data.lightbox_comment_width),e>jQuery(window).width()?(e=jQuery(window).width(),jQuery(".bwg_comment_container").css({width:e}),jQuery(".bwg_ecommerce_container").css({width:e}),jQuery(".spider_popup_close_fullscreen").hide()):jQuery(".spider_popup_close_fullscreen").show(),window.innerHeight>gallery_box_data.image_height&&1!=gallery_box_data.open_with_fullscreen&&!jQuery(".bwg_resize-full").hasClass("bwg-icon-compress")?(jQuery("#spider_popup_wrap").css({height:gallery_box_data.image_height,top:"50%",marginTop:-gallery_box_data.image_height/2,zIndex:100002}),jQuery(".bwg_image_container").css({height:gallery_box_data.image_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxHeight:gallery_box_data.image_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxHeight:gallery_box_data.image_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),"vertical"==gallery_box_data.filmstrip_direction&&(jQuery(".bwg_filmstrip_container").css({height:gallery_box_data.image_height}),jQuery(".bwg_filmstrip").css({height:gallery_box_data.image_height-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())})),bwg_popup_current_height=gallery_box_data.image_height):(jQuery("#spider_popup_wrap").css({height:window.innerHeight,top:0,marginTop:0,zIndex:100002}),jQuery(".bwg_image_container").css({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),"vertical"==gallery_box_data.filmstrip_direction&&(jQuery(".bwg_filmstrip_container").css({height:window.innerHeight}),jQuery(".bwg_filmstrip").css({height:window.innerHeight-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())})),bwg_popup_current_height=window.innerHeight),jQuery(window).width()>=gallery_box_data.image_width&&1!=gallery_box_data.open_with_fullscreen?(jQuery("#spider_popup_wrap").css({width:gallery_box_data.image_width,left:"50%",marginLeft:-gallery_box_data.image_width/2,zIndex:100002}),jQuery(".bwg_image_wrap").css({width:gallery_box_data.image_width-e}),jQuery(".bwg_image_container").css({width:gallery_box_data.image_width-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxWidth:gallery_box_data.image_width-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:gallery_box_data.image_width-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),"horizontal"==gallery_box_data.filmstrip_direction&&(jQuery(".bwg_filmstrip_container").css({width:gallery_box_data.image_width-e}),jQuery(".bwg_filmstrip").css({width:gallery_box_data.image_width-e-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())})),bwg_popup_current_width=gallery_box_data.image_width):(jQuery("#spider_popup_wrap").css({width:jQuery(window).width(),left:0,marginLeft:0,zIndex:100002}),jQuery(".bwg_image_wrap").css({width:jQuery(window).width()-e}),jQuery(".bwg_image_container").css({width:jQuery(window).width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),jQuery(".bwg_popup_image").css({maxWidth:jQuery(window).width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:jQuery(window).width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),"horizontal"==gallery_box_data.filmstrip_direction&&(jQuery(".bwg_filmstrip_container").css({width:jQuery(window).width()-e}),jQuery(".bwg_filmstrip").css({width:jQuery(window).width()-e-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())})),bwg_popup_current_width=jQuery(window).width()),bwg_resize_instagram_post(),bwg_change_watermark_container(),1!=gallery_box_data.open_with_fullscreen&&(gallery_box_data.lightbox_close_btn_right<0&&jQuery("#spider_popup_wrap").width()-2*gallery_box_data.lightbox_close_btn_right>=jQuery(window).width()||gallery_box_data.lightbox_close_btn_top<0&&jQuery("#spider_popup_wrap").height()-2*gallery_box_data.lightbox_close_btn_top>=jQuery(window).height()?jQuery(".spider_popup_close").attr("class","spider_popup_close_fullscreen"):jQuery(".spider_popup_close_fullscreen").attr("class","spider_popup_close"));var t=jQuery(".bwg_ctrl_btn_container").height();"bottom"==gallery_box_data.lightbox_ctrl_btn_pos&&jQuery(".bwg_toggle_container i").hasClass("bwg-icon-caret-down")&&jQuery(".bwg_toggle_container").css("bottom",t+"px"),"top"==gallery_box_data.lightbox_ctrl_btn_pos&&jQuery(".bwg_toggle_container i").hasClass("bwg-icon-caret-up")&&jQuery(".bwg_toggle_container").css("top",t+"px")}function bwg_rating(e,t,i,a){lightbox_rate_stars_count=gallery_box_data.lightbox_rate_stars_count,lightbox_rate_size=gallery_box_data.lightbox_rate_size,lightbox_rate_icon=gallery_box_data.lightbox_rate_icon;var r="Not rated yet.";if(0!=i&&""!=i&&(r=parseFloat(i).toFixed(1)+"\n Votes: "+t),void 0!==jQuery().raty&&jQuery.isFunction(jQuery().raty)){var _=parseFloat(jQuery("#bwg_star").attr("data-score"));jQuery("#bwg_star").removeAttr("data-score").html("");var s={starType:"i",number:lightbox_rate_stars_count,size:lightbox_rate_size,noRatedMsg:"Not rated yet.",readOnly:!1,score:_,starHalf:"bwg-icon-"+lightbox_rate_icon+("star"==lightbox_rate_icon?"-half":"")+"-o",starOff:"bwg-icon-"+lightbox_rate_icon+"-o",starOn:"bwg-icon-"+lightbox_rate_icon,cancelOff:"bwg-icon-minus-square-o",cancelOn:"bwg-icon-minus-square-o",cancel:!1,cancelHint:"Cancel your rating.",hints:[r,r,r,r,r],alreadyRatedMsg:parseFloat(i).toFixed(1)+"\nYou have already rated.\nVotes: "+t};e||(s.click=function(e,t){jQuery("#bwg_star").hide(),jQuery("#bwg_rated").show(),spider_set_input_value("rate_ajax_task","save_rate"),jQuery.when(spider_rate_ajax_save("bwg_rate_form",e)).then(function(){gallery_box_data.data[a].rate=e,++gallery_box_data.data[a].rate_count,gallery_box_data.data[a].avg_rating=_?((_+e)/2).toFixed(1):e.toFixed(1),bwg_rating(gallery_box_data.data[a].rate,gallery_box_data.data[a].rate_count,gallery_box_data.data[a].avg_rating,gallery_box_data.current_image_key)})}),jQuery("#bwg_star").raty(s),jQuery(".bwg_image_rate_disabled").hide(),e&&jQuery(".bwg_image_rate_disabled").show()}}function changeDownloadsTotal(e){var t=0;0==jQuery("[name=option_show_digital_items_count]").val()?jQuery("[name=selected_download_item]:checked").each(function(){t+=Number(jQuery(this).closest("tr").attr("data-price"))}):jQuery(".digital_image_count").each(function(){0!=Number(jQuery(this).val())&&(t+=Number(jQuery(this).closest("tr").attr("data-price"))*Number(jQuery(this).val()))}),t=t.toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"),jQuery(".product_downloads_price").html(t)}function changeMenualTotal(e){Number(jQuery(e).val())<=0&&jQuery(e).val("1");var t=Number(jQuery(e).val()),i=Number(jQuery(".product_manual_price").attr("data-actual-price"));i=(i*=t).toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"),jQuery(".product_manual_price").html(i)}function onSelectableParametersChange(e){var t=0,i=gallery_box_data.data[jQuery("#bwg_current_image_key").val()].pricelist_manual_price?gallery_box_data.data[jQuery("#bwg_current_image_key").val()].pricelist_manual_price:"0";i=parseFloat(i.replace(",",""));var a=jQuery(e).closest(".image_selected_parameter").attr("data-parameter-type"),r=jQuery(e).val();r=r.split("*");var _=parseFloat(r[1]),s=r[0],o=Number(jQuery(e).closest(".image_selected_parameter").find(".already_selected_values").val());if("4"==a||"5"==a){var l=parseFloat(s+_);jQuery(e).closest(".image_selected_parameter").find(".already_selected_values").val(l)}else if("6"==a){if(0==jQuery(e).is(":checked"))var n=o-parseFloat(s+_);else n=o+parseFloat(s+_);jQuery(e).closest(".image_selected_parameter").find(".already_selected_values").val(n)}jQuery(".already_selected_values").each(function(){t+=Number(jQuery(this).val())}),i+=t,jQuery(".product_manual_price").attr("data-actual-price",i),i=(i*=Number(jQuery(".image_count").val())<=0?1:Number(jQuery(".image_count").val())).toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"),jQuery(".product_manual_price").html(i)}function onBtnClickAddToCart(){var e=jQuery("[name=type]").val();if(""!=e){var t={};if("manual"==e){var i=jQuery(".image_count").val(),a={};jQuery(".manual").find(".image_selected_parameter").each(function(){var e=jQuery(this).attr("data-parameter-id"),t="";switch(jQuery(this).attr("data-parameter-type")){case"2":t=jQuery(this).find("input").val();break;case"3":t=jQuery(this).find("textarea").val();break;case"4":t=jQuery(this).find("select :selected").val();break;case"5":t=jQuery(this).find("[type=radio]:checked").val();break;case"6":var i=[];jQuery(this).find("[type=checkbox]:checked").each(function(){i.push(jQuery(this).val())}),t=i}a[e]=t}),t.count=i,t.parameters=a,t.price=jQuery(".product_manual_price").attr("data-price").replace(",","")}else{var r=[];if(0==jQuery("[name=option_show_digital_items_count]").val()){if(0==jQuery("[name=selected_download_item]:checked").length)return void jQuery(".add_to_cart_msg").html("You must select at least one item.");jQuery("[name=selected_download_item]:checked").each(function(){var e={};e.id=jQuery(this).val(),e.count=1,e.price=jQuery(this).closest("tr").attr("data-price"),r.push(e)})}else jQuery(".digital_image_count").each(function(){var e={};0<jQuery(this).val()&&(e.id=jQuery(this).closest("tr").attr("data-id"),e.price=jQuery(this).closest("tr").attr("data-price"),e.count=jQuery(this).val(),r.push(e))});if(0==(t.downloadItems=r).length)return void jQuery(".add_to_cart_msg").html("Please select at least one item")}var _=jQuery("#ajax_url").val(),s={action:"add_cart",task:"add_cart",controller:"checkout",image_id:jQuery("#bwg_popup_image").attr("image_id"),type:e,data:JSON.stringify(t)};jQuery.ajax({type:"POST",url:_,data:s,success:function(e){responseData=JSON.parse(e),jQuery(".add_to_cart_msg").html(responseData.msg),jQuery(".products_in_cart").html(responseData.products_in_cart),1==responseData.redirect&&(window.location.href="<?php echo get_permalink($options->checkout_page);?>")},beforeSend:function(){},complete:function(){}})}else jQuery(".add_to_cart_msg").html("Please select Prints and products or Downloads")}function onBtnViewCart(){var e=jQuery("[name=option_checkout_page]").val();jQuery("#bwg_ecommerce_form").attr("action",e),jQuery("#bwg_ecommerce_form").submit()}function bwg_load_visible_images(e,t,i){0<=e-t&&(startPoint=e-t),i<e+t&&(endPoint=i);for(var a=startPoint;a<=endPoint;a++){var r=jQuery("#bwg_filmstrip_thumbnail_"+a+" img");r.removeClass("bwg-hidden"),r.attr("src",r.data("url"))}}function bwg_load_filmstrip(){for(var e=1;e<=total_thumbnail_count;e++){var t;if(leftIndex=startPoint-e,rightIndex=endPoint+e,rightIndex<total_thumbnail_count)(t=jQuery("#bwg_filmstrip_thumbnail_"+rightIndex+" img")).removeClass("bwg-hidden"),t.attr("src",t.data("url"));if(0<=leftIndex)(t=jQuery("#bwg_filmstrip_thumbnail_"+leftIndex+" img")).removeClass("bwg-hidden"),t.attr("src",t.data("url"))}jQuery(".bwg_filmstrip_thumbnail").each(function(){var e=jQuery(this).find("img");void 0===e.attr("style")&&(0==e.width()?e.on("load",function(){jQuery(this).find(".bwg_filmstrip_thumbnail_img_wrap"),bwg_filmstrip_thumb_view(e)}):(jQuery(this).find(".bwg_filmstrip_thumbnail_img_wrap"),bwg_filmstrip_thumb_view(e)))})}function bwg_filmstrip_thumb_view(e){var t=gallery_box_data.image_filmstrip_height,i=gallery_box_data.image_filmstrip_width,a=i-gallery_box_data.filmstrip_thumb_right_left_space,r=t,_=Math.max(i/e.width(),t/e.height()),s=e.width()*_,o=e.height()*_;e.css({width:s,height:o,marginLeft:(a-s)/2,marginTop:(r-o)/2})}function bwg_info_height_set(){bwg_info_position(!1),jQuery(".mCustomScrollBox").length&&jQuery(".bwg_image_info_container1").height()<jQuery(".mCustomScrollBox").height()+jQuery(".bwg_toggle_container").height()+bwg_image_info_pos+2*parseInt(gallery_box_data.lightbox_info_margin)&&jQuery(".bwg_image_info").css({height:jQuery(".bwg_image_info_container1").height()-jQuery(".bwg_toggle_container").height()-bwg_image_info_pos-2*parseInt(gallery_box_data.lightbox_info_margin)})}function bwg_info_position(e){var t=0,i="none";"top"==gallery_box_data.lightbox_ctrl_btn_pos?"top"==gallery_box_data.lightbox_info_pos&&(i="top"):"bottom"==gallery_box_data.lightbox_info_pos&&(i="bottom"),jQuery(".bwg_ctrl_btn_container").hasClass("closed")||("top"==gallery_box_data.lightbox_ctrl_btn_pos?"top"==gallery_box_data.lightbox_info_pos&&(t=jQuery(".bwg_ctrl_btn_container").height()):"bottom"==gallery_box_data.lightbox_info_pos&&(t=jQuery(".bwg_ctrl_btn_container").height())),"top"==i?0==e?jQuery(".bwg_image_info").css("top",t):jQuery(".bwg_image_info").animate({top:t+"px"},500):"bottom"==i&&(0==e?jQuery(".bwg_image_info").css("bottom",t):jQuery(".bwg_image_info").animate({bottom:t+"px"},500))}function spider_display_embed(e,t,i,a){var r="";switch(e){case"EMBED_OEMBED_YOUTUBE_VIDEO":var _="<iframe ";for(attr in""!=i&&(_+=' src="//www.youtube.com/embed/'+i+'?enablejsapi=1&wmode=transparent"'),a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(_+=" "+attr+'="'+a[attr]+'"');r+=_+=" ></iframe>";break;case"EMBED_OEMBED_VIMEO_VIDEO":var s="<iframe ";for(attr in""!=i&&(s+=' src="//player.vimeo.com/video/'+i+'?enablejsapi=1"'),a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(s+=" "+attr+'="'+a[attr]+'"');r+=s+=" ></iframe>";break;case"EMBED_OEMBED_FLICKR_IMAGE":var o="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(o+=" "+attr+'="'+a[attr]+'"');o+=" >",""!=i&&(o+='<img src="'+i+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;">'),r+=o+="</div>";break;case"EMBED_OEMBED_FLICKR_VIDEO":break;case"EMBED_OEMBED_INSTAGRAM_VIDEO":var l="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(l+=" "+attr+'="'+a[attr]+'"');l+=" >",""!=t&&(l+='<video style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls><source src="'+decodeURIComponent(t)+'" type="video/mp4"> Your browser does not support the video tag. </video>'),r+=l+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_IMAGE":var n=a["data-max-width"],g=a["data-max-height"];l="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(l+=" "+attr+'="'+a[attr]+'"');l+=" >",""!=t&&(l+='<img src="'+decodeURIComponent(t)+'" style="max-width:'+n+"px; max-height:"+g+'px; width: auto; height: auto">'),r+=l+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_POST":l="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(l+=" "+attr+'="'+a[attr]+'"',"CLASS"!=attr&&"class"!=attr&&"Class"!=attr||(obj_class=a[attr]));l+=">",""!=t&&(l+='<div class="inner_instagram_iframe_'+obj_class+'" style="max-width: 100% !important; max-height: 100% !important; width: 100%; height: 100%; margin:0; vertical-align:middle;">'+atob(t)+"</div>"),r+=l+="</div>";break;case"EMBED_OEMBED_FACEBOOK_IMAGE":var w="<span ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(w+=" "+attr+'="'+a[attr]+'"');w+=" >",""!=i&&(w+='<img src="'+t+'" style=" max-width:100% !important; max-height:100% !important; width:auto; height:100%;">'),r+=w+="</span>";break;case"EMBED_OEMBED_FACEBOOK_VIDEO":var b="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(b+=" "+attr+'="'+a[attr]+'"');b+=" >",""!=i&&(b+='<iframe src="//www.facebook.com/video/embed?video_id='+t+'&enablejsapi=1&wmode=transparent" style="max-width:100% !important; max-height:100% !important; width:100%; height:100%; margin:0; display:table-cell; vertical-align:middle;"frameborder="0" class="bwg_fb_video" scrolling="no" allowtransparency="false" allowfullscreen></iframe>'),r+=b+="</div>";break;case"EMBED_OEMBED_DAILYMOTION_VIDEO":var u="<iframe ";for(attr in""!=i&&(u+=' src="//www.dailymotion.com/embed/video/'+i+'?api=postMessage"'),a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(u+=" "+attr+'="'+a[attr]+'"');r+=u+=" ></iframe>";break;case"EMBED_OEMBED_IMGUR":var d="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(l+=" "+attr+'="'+a[attr]+'"');d+=" >",""!=i&&(d+='<img src="'+i+'" style="max-width:100% !important; max-height:100% !important; width:auto; height:auto !important;">'),r+=d+="</div>";break;case"EMBED_OEMBED_GOOGLE_PHOTO_IMAGE":var h="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(h+=" "+attr+'="'+a[attr]+'"');h+=" >",""!=i&&(h+='<img src="'+t+'" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">'),r+=h+="</div>";break;default:var m={content:""};jQuery(document).trigger("bwg_display_embed",[m,e,t,i,a]),r=m.content}return r}function bwg_add_instagram_gallery(e,s){if(!0===(s=void 0!==s&&s)){if(bwg_check_instagram_gallery_input(e,s))return!1;var t="0";1==jQuery("input[name=popup_instagram_post_gallery]:checked").val()&&(t="1");var i=encodeURI(jQuery("#popup_instagram_gallery_source").val()),a=encodeURI(jQuery("#popup_instagram_image_number").val())}else{if(bwg_check_instagram_gallery_input(e,s))return!1;if(!bwg_check_gallery_empty(!1,!0))return!1;t="0";1==jQuery("input[name=instagram_post_gallery]:checked").val()&&(t="1");i=encodeURI(jQuery("#gallery_source").val());var r=jQuery("input[name=update_flag]:checked").val();a=encodeURI(jQuery("#autogallery_image_number").val())}jQuery("#bulk_embed").hide(),jQuery("#loading_div").show();var o=[],_={action:"addInstagramGallery",instagram_user:i,instagram_access_token:e,whole_post:t,autogallery_image_number:a,update_flag:r,async:!0};jQuery.post(bwg_ajax_url_nonce,_,function(e){if(0==e)return alert("Error: cannot get response from the server."),jQuery("#loading_div").hide(),s&&jQuery("#bulk_embed").show(),!1;var t=e.indexOf("WD_delimiter_start"),i=e.indexOf("WD_delimiter_end");if(-1==t||-1==i)return jQuery("#loading_div").hide(),s&&jQuery("#bulk_embed").show(),!1;if(e=e.substring(t+18,i),response_JSON=JSON.parse(e),response_JSON){if("error"==response_JSON[0])return alert("Error: "+JSON.parse(e)[1]),jQuery("#loading_div").hide(),s&&jQuery("#bulk_embed").show(),!1;for(var a=response_JSON.length,r=1;r<=a;r++)if(0!=response_JSON[a-r]){var _=response_JSON[a-r];o.push(_)}return bwg_add_image(o,"instagram"),s||(bwg_gallery_update_flag(),jQuery("#tr_instagram_gallery_add_button").hide()),jQuery("#loading_div").hide(),s&&jQuery(".opacity_bulk_embed").hide(),"ok"}return alert("There is some error. Cannot add Instagram gallery."),jQuery("#loading_div").hide(),s&&jQuery("#bulk_embed").show(),!1})}var bwg=0,isMobile=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),bwg_click=isMobile?"touchend":"click",bwg_slideshow_filmstrip_thumbnail_timer=!1;window.bwg_slideshow_filmstrip_thumb={};var bwg_params=[],bwg_params_ib=[],bwg_params_carousel=[];function bwg_remove_lazy_loader_icon(){1==bwg_objectsL10n.lazy_load&&jQuery("img.bwg_lazyload").Lazy({afterLoad:function(){jQuery(".lazy_loader").removeClass("lazy_loader")},onFinishedAll:function(){jQuery(".lazy_loader").removeClass("lazy_loader")}})}function bwg_main_ready(e){var t=e.data("bwg");1===e.data("scroll")&&(form_id="gal_front_form_"+t,jQuery("html, body").animate({scrollTop:jQuery("#"+form_id).offset().top-150},500)),bwg_remove_lazy_loader_icon(),0<e.find(".wd_error").length&&bwg_container_loaded(t);var i=e.find(".bwg-container");if("album"===e.data("is-album")&&i.hasClass("bwg-thumbnails"))var a="thumbnails";else a=e.data("gallery-type");switch(bwg_document_ready(e),a){case"thumbnails":case"thumbnails_masonry":case"album_compact_preview":case"album_masonry_preview":case"album_extended_preview":bwg_all_thumnails_loaded(i);break;case"thumbnails_mosaic":bwg_thumbnail_mosaic(i);break;case"slideshow":bwg_slideshow_ready(t);break;case"carousel":bwg_carousel_ready(t),bwg_carousel_onload(e);break;case"image_browser":bwg_image_browser_ready(e);break;case"blog_style":bwg_blog_style_ready(e)}}function bwg_resize_search_line(){jQuery(".search_line").each(function(){var e=jQuery(this);e.width()<410?e.addClass("bwg-search-line-responsive"):e.removeClass("bwg-search-line-responsive")})}function bwg_tags_button_section_visibility(){jQuery('div[id^="bwg_container1_"]').each(function(){var e=jQuery(this),t=e.find(".current_view").val(),i=e.find(".show_bottom_tag").val(),a=e.find(".bwg_tags_container_"+t+" .bwg_tag_button_view_container");if(a.length)var r=a[0].scrollHeight;var _=a.find(".bwg_tags_filter_buttons").outerHeight(!0),s=parseInt(2*a.find(".bwg_tags_filter_buttons").outerHeight(!0)+3);s<r?(0===jQuery(this).find(".see_all_tags.bwg_hide").length&&a.css({"min-height":_,"max-height":s,overflow:"hidden"}),a.next(".bwg_tag_button_see_all").show()):(a.css({"min-height":"auto","max-height":"100%",height:"auto",overflow:"visible"}),a.next(".bwg_tag_button_see_all").hide());var o=a.next().find(".see_all_tags").width()/2;a.next().find(".see_all_tags").attr("style","margin-left: -"+o+"px"),a.next().find(".see_all_tags").off("click").on("click",function(){jQuery(this).hasClass("bwg_show")?(jQuery(this).removeClass("bwg_show").addClass("bwg_hide").html("<span>−</span>"+bwg_objectsL10n.bwg_tag_see_less),a.css({"min-height":"auto","max-height":"100%",height:"auto",overflow:"visible"})):jQuery(this).hasClass("bwg_hide")&&(jQuery(this).removeClass("bwg_hide").addClass("bwg_show").html("<span>+</span>"+bwg_objectsL10n.bwg_tag_see_all),a.css({"min-height":_,"max-height":s,overflow:"hidden"}))}),1==i&&(jQuery(this).find(".see_all_tags").removeClass("bwg_show").addClass("bwg_hide").html("<span>−</span>"+bwg_objectsL10n.bwg_tag_see_less),a.css({"min-height":"auto","max-height":"100%",height:"auto",overflow:"visible"}))})}function bwg_slideshow_resize(){jQuery(".bwg_slideshow").each(function(){bwg=jQuery(this).attr("data-bwg"),jQuery("#bwg_slideshow_image_container_"+bwg).length&&(bwg_params[bwg]=JSON.parse(jQuery("#bwg_slideshow_image_container_"+bwg).attr("data-params")),bwg_params[bwg].event_stack=[],bwg_popup_resize(bwg))})}function bwg_blog_style_resize(){jQuery(".bwg_blog_style").each(function(){bwg=jQuery(this).attr("data-bwg"),jQuery(".bwg_embed_frame_16x9_"+bwg).each(function(e){jQuery(this).width(jQuery(this).parent().width()),jQuery(this).height(.5625*jQuery(this).width())}),jQuery(".bwg_embed_frame_instapost_"+bwg).each(function(e){jQuery(this).width(jQuery(this).parent().width()),jQuery(this).height((jQuery(this).width()-16)*jQuery(this).attr("data-height")/jQuery(this).attr("data-width")+96)})})}function bwg_blog_style_onload(){jQuery(".bwg_blog_style").each(function(){bwg=jQuery(this).attr("data-bwg");jQuery("#bwg_blog_style_"+bwg);jQuery(".bwg_embed_frame_16x9_"+bwg).each(function(e){if(jQuery(".bwg_blog_style_image_"+bwg).find(".fluid-width-video-wrapper").length){jQuery(".fluid-width-video-wrapper").removeAttr("style");var t=jQuery(this).parents(".bwg_blog_style_image_"+bwg).find(".fluid-width-video-wrapper").contents();jQuery(this).parents(".fluid-width-video-wrapper").replaceWith(t)}jQuery(this).width(jQuery(this).parents(".bwg_blog_style_image_"+bwg).width()),jQuery(this).height(.5625*jQuery(this).width())}),jQuery(".bwg_embed_frame_instapost_"+bwg).each(function(e){jQuery(this).width(jQuery(this).parents(".bwg_blog_style_image_"+bwg).width()),jQuery(this).height((jQuery(this).width()-16)*jQuery(this).attr("data-height")/jQuery(this).attr("data-width")+96)}),bwg_container_loaded(bwg)})}function bwg_blog_style_ready(t){var e=t.data("bwg");bwg_container_loaded(e);var i=!1;t.find(".bwg_lightbox_"+e).on("click",function(){var e=jQuery(this).attr("data-image-id");if(jQuery("#bwg_blog_style_share_buttons_"+e).removeAttr("data-open-comment"),!i)return i=!0,setTimeout(function(){i=!1},100),bwg_gallery_box(e,t.closest(".bwg_container")),!1}),jQuery(".bwg_lightbox_"+e+" .bwg_ecommerce").on("click",function(e){if(e.stopPropagation(),!i)return i=!0,setTimeout(function(){i=!1},100),bwg_gallery_box(t.attr("data-image-id"),t.closest(".bwg_container"),!0),!1});var a=window.location.hash.substring(1);a&&"-1"!=a.indexOf("bwg")&&(bwg_hash_array=a.replace("bwg","").split("/"),"<?php echo $params_array['gallery_id']; ?>"==bwg_hash_array[0]&&bwg_gallery_box(bwg_hash_array[1]))}function bwg_slideshow_focus(){jQuery(".bwg_slideshow").each(function(){bwg=jQuery(this).data("bwg"),jQuery(".bwg_slideshow[data-bwg="+bwg+"]")[0].offsetHeight&&jQuery("#bwg_slideshow_image_container_"+bwg).length&&(bwg_params[bwg]=JSON.parse(jQuery("#bwg_slideshow_image_container_"+bwg).attr("data-params")),bwg_params[bwg].event_stack=[],window.clearInterval(window["bwg_playInterval"+bwg]),jQuery(".bwg_ctrl_btn_"+bwg).hasClass("bwg-icon-play")||bwg_play(bwg_params[bwg].data,bwg))})}function bwg_carousel_focus(){jQuery(".bwg_carousel").each(function(){bwg=jQuery(this).data("bwg"),jQuery(".bwg_carousel[data-bwg="+bwg+"]")[0].offsetHeight&&jQuery(".bwg_carousel_image_container_"+bwg).length&&jQuery(".bwg_ctrl_btn_"+bwg).hasClass("bwg-icon-pause")&&bwg_params_carousel[bwg].carousel.start()})}function bwg_slideshow_blur(e){jQuery(".bwg_slideshow").each(function(){bwg=jQuery(this).data("bwg"),!e&&jQuery(".bwg_slideshow[data-bwg="+bwg+"]")[0].offsetHeight||jQuery("#bwg_slideshow_image_container_"+bwg).length&&(bwg_params[bwg]=JSON.parse(jQuery("#bwg_slideshow_image_container_"+bwg).attr("data-params")),bwg_params[bwg].event_stack=[],window.clearInterval(window["bwg_playInterval"+bwg]))})}function bwg_carousel_blur(e){jQuery(".bwg_carousel").each(function(){bwg=jQuery(this).data("bwg"),!e&&jQuery(".bwg_carousel[data-bwg="+bwg+"]")[0].offsetHeight||jQuery(".bwg_carousel_image_container_"+bwg).length&&void 0!==bwg_params_carousel[bwg]&&bwg_params_carousel[bwg].carousel.pause()})}function bwg_carousel_ready(t){bwg_params_carousel[t]=[],bwg_params_carousel[t].bwg_currentCenterNum=1,bwg_params_carousel[t].bwg_currentlyMoving=!1,bwg_params_carousel[t].data=[],jQuery("#spider_carousel_left-ico_"+t).on("click",function(e){bwg_params_carousel[t].carousel.prev(),e.stopPropagation(),e.stopImmediatePropagation()}),jQuery("#spider_carousel_right-ico_"+t).on("click",function(e){bwg_params_carousel[t].carousel.next(),e.stopPropagation(),e.stopImmediatePropagation()}),parseInt(bwg_params_carousel[t].carousel_enable_autoplay)&&(jQuery(".bwg_carousel_play_pause_"+t).attr("title",bwg_objectsL10n.pause),jQuery(".bwg_carousel_play_pause_"+t).attr("class","bwg-icon-pause bwg_ctrl_btn_"+t+" bwg_carousel_play_pause_"+t)),jQuery(".bwg_carousel_play_pause_"+t).on(bwg_click,function(e){jQuery(".bwg_ctrl_btn_"+t).hasClass("bwg-icon-play")?(jQuery(".bwg_carousel_play_pause_"+t).attr("title",bwg_objectsL10n.pause),jQuery(".bwg_carousel_play_pause_"+t).attr("class","bwg-icon-pause bwg_ctrl_btn_"+t+" bwg_carousel_play_pause_"+t),bwg_params_carousel[t].carousel.start()):(jQuery(".bwg_carousel_play_pause_"+t).attr("title",bwg_objectsL10n.play),jQuery(".bwg_carousel_play_pause_"+t).attr("class","bwg-icon-play bwg_ctrl_btn_"+t+" bwg_carousel_play_pause_"+t),bwg_params_carousel[t].carousel.pause()),e.stopPropagation(),e.stopImmediatePropagation()}),void 0!==jQuery().swiperight&&jQuery.isFunction(jQuery().swiperight)&&jQuery("#bwg_container1_"+t).swiperight(function(){bwg_params_carousel[t].carousel.prev()}),void 0!==jQuery().swipeleft&&jQuery.isFunction(jQuery().swipeleft)&&jQuery("#bwg_container1_"+t).swipeleft(function(){bwg_params_carousel[t].carousel.next()})}function bwg_carousel_resize(){jQuery(".bwg-carousel").each(function(){var e=jQuery(this).data("bwg");jQuery("#bwg_carousel-container"+e).length&&(bwg_carousel_params(e,!0),bwg_params_carousel[e].carousel.pause(),bwg_carousel_watermark(e),jQuery(".bwg_ctrl_btn_"+e).hasClass("bwg-icon-play")||bwg_params_carousel[e].carousel.start())})}function bwg_carousel_onload(e){var t=e.data("bwg"),i=e.find(".bwg_carousel-container"+t);i.length&&(bwg_params_carousel[t]=i.data("params"),bwg_params_carousel[t].parent_width=0,bwg_carousel_watermark(t),bwg_carousel_params(t,!1),bwg_container_loaded(t))}function bwg_carousel_params(t,e){var i=jQuery("#bwg_container1_"+t).parent();i.hasClass("elementor-tab-content")&&i.width(i.closest(".elementor-widget-wrap").width());var a=i.width(),r=1;a<bwg_params_carousel[t].carousel_r_width?r=a/bwg_params_carousel[t].carousel_r_width:a=bwg_params_carousel[t].carousel_r_width,bwg_params_carousel[t].parent_width!=a&&(bwg_params_carousel[t].parent_width=a,bwg_params_carousel[t].carousel_image_column_number>bwg_params_carousel[t].count&&(bwg_params_carousel[t].carousel_image_column_number=bwg_params_carousel[t].count),jQuery(".bwg_carousel_play_pause_"+t).css({display:parseInt(bwg_params_carousel[t].carousel_play_pause_butt)?"":"none"}),parseInt(bwg_params_carousel[t].carousel_prev_next_butt)?(jQuery("#bwg_carousel-right"+t).css({display:""}),jQuery("#bwg_carousel-left"+t).css({display:""})):(jQuery("#bwg_carousel-left"+t).css({display:"none"}),jQuery("#bwg_carousel-right"+t).css({display:"none"})),jQuery(".inner_instagram_iframe_bwg_embed_frame_"+t).each(function(){var e=jQuery(this).parent();bwg_params_carousel[t].image_height/(parseInt(e.attr("data-height"))+96)<bwg_params_carousel[t].image_width/parseInt(e.attr("data-width"))?(e.height(bwg_params_carousel[t].image_height*r),e.width((e.height()-96)*e.attr("data-width")/e.attr("data-height")+16)):(e.width(bwg_params_carousel[t].image_width*r),e.height((e.width()-16)*e.attr("data-height")/e.attr("data-width")+96))}),jQuery(".bwg_carousel_image_container_"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel_watermark_text_"+t+", .bwg_carousel_watermark_text_"+t+":hover").css({fontSize:a*(bwg_params_carousel[t].watermark_font_size/bwg_params_carousel[t].image_width)*r}),jQuery(".bwg_carousel-image "+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel_watermark_container_"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel_embed_video_"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel_watermark_spun_"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel-container"+t).css({width:a,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_video_hide"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),bwg_params_carousel[t].carousel&&!e||(e&&bwg_params_carousel[t].carousel&&bwg_params_carousel[t].carousel.pause(),bwg_params_carousel[t].carousel=jQuery("#bwg_carousel"+t).featureCarousel({containerWidth:a*r,containerHeight:bwg_params_carousel[t].image_height*r,fit_containerWidth:bwg_params_carousel[t].carousel_fit_containerWidth,largeFeatureWidth:bwg_params_carousel[t].image_width*r,largeFeatureHeight:bwg_params_carousel[t].image_height*r,smallFeaturePar:bwg_params_carousel[t].carousel_image_par,currentlyMoving:!1,startingFeature:bwg_params_carousel[t].bwg_currentCenterNum,featuresArray:[],timeoutVar:null,rotationsRemaining:0,autoPlay:1e3*bwg_params_carousel[t].car_inter,interval:1e3*bwg_params_carousel[t].carousel_interval,imagecount:bwg_params_carousel[t].carousel_image_column_number,bwg_number:t,enable_image_title:bwg_params_carousel[t].enable_image_title,borderWidth:0})))}function bwg_carousel_watermark(e){var t=1,i=jQuery("#bwg_container1_"+e).parent().width();if(i<bwg_params_carousel[e].carousel_r_width&&(t=i/bwg_params_carousel[e].carousel_r_width),i>=bwg_params_carousel[e].image_width)bwg_carousel_change_watermark_container(e),jQuery("#bwg_carousel_play_pause-ico_"+e).css({fontSize:bwg_params_carousel[e].carousel_play_pause_btn_size}),jQuery(".bwg_carousel_watermark_image_"+e).css({maxWidth:bwg_params_carousel[e].watermark_width*t,maxHeight:bwg_params_carousel[e].watermark_height*t}),jQuery(".bwg_carousel_watermark_text_"+e+", .bwg_carousel_watermark_text_"+e+":hover").css({fontSize:t*bwg_params_carousel[e].watermark_font_size});else{var a=bwg_params_carousel[e].image_width/t;bwg_carousel_change_watermark_container(e),jQuery(".bwg_carousel_watermark_image_"+e).css({maxWidth:i*bwg_params_carousel[e].watermark_width/a,maxHeight:i*bwg_params_carousel[e].watermark_height/a}),jQuery(".bwg_carousel_watermark_text_"+e+", .bwg_carousel_watermark_text_"+e+":hover").css({fontSize:i*bwg_params_carousel[e].watermark_font_size/a})}}function bwg_carousel_change_watermark_container(a){jQuery(".bwg_carousel"+a).children().each(function(){if(2==jQuery(this).css("zIndex")){var e=jQuery(this).find("img");e.length||(e=jQuery(this).find("iframe"));var t=e.width(),i=e.height();jQuery(".bwg_carousel_watermark_spun_"+a).width(t),jQuery(".bwg_carousel_watermark_spun_"+a).height(i),jQuery(".bwg_carousel_title_spun_"+a).width(t),jQuery(".bwg_carouel_title_spun_"+a).height(i),jQuery(".bwg_carousel_watermark_"+a).css({display:"none"})}})}function bwg_carousel_preload(e,t){var i=jQuery(".bwg_carousel_preload").get();t||i.reverse();var a=0;jQuery(i).each(function(){if(1<++a)return!1;jQuery(this).parent().hasClass("bwg_carousel_embed_video_"+e)||jQuery(this).parent().hasClass("bwg_embed_frame_"+e)||jQuery(this).parent().hasClass("bwg_carousel_video")?(jQuery(this).attr("src",jQuery(this).attr("data-src")),jQuery(this).on("load",function(){jQuery(this).removeClass("bwg_carousel_preload")}),jQuery(this).parent().hasClass("bwg_carousel_video")&&(jQuery(".bwg_carousel_video")[0].load(),jQuery(this).parent().parent().removeClass("bwg_carousel_preload")),jQuery(this).removeAttr("data-src")):(jQuery(this).css({"background-image":"url('"+jQuery(this).attr("data-background")+"')",height:"100%"}),jQuery(this).removeClass("bwg_carousel_preload"),jQuery(this).removeAttr("data-background"))})}function bwg_slideshow_ready(i){if(jQuery("#bwg_slideshow_image_container_"+i).length){bwg_params[i]=JSON.parse(jQuery("#bwg_slideshow_image_container_"+i).attr("data-params")),bwg_params[i].event_stack=[];var e=".bwg_slideshow_filmstrip_"+i,t="bwg_slideshow_filmstrip_thumbnail_"+i;bwg_slideshow_filmstrip_thumb[t]={},bwg_slideshow_filmstrip_thumb[t].next_prev_index=0;var a=!1;2==bwg_params[i].slideshow_filmstrip_type&&(a=!0,e=".bwg_slideshow_filmstrip_fix_count_"+i),bwg_container_loaded(i);var r=bwg_params[i].data;void 0!==jQuery().swiperight&&jQuery.isFunction(jQuery().swiperight)&&jQuery("#bwg_container1_"+i).swiperight(function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key_"+i).val()),0<=parseInt(jQuery("#bwg_current_image_key_"+i).val())-bwg_iterator(i)?(parseInt(jQuery("#bwg_current_image_key_"+i).val())-bwg_iterator(i))%r.length:r.length-1,r,"",i),!1}),void 0!==jQuery().swipeleft&&jQuery.isFunction(jQuery().swipeleft)&&jQuery("#bwg_container1_"+i).swipeleft(function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key_"+i).val()),parseInt(jQuery("#bwg_current_image_key_"+i).val())+bwg_iterator(i)%r.length,r,"",i),!1});var _=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())?"touchend":"click";bwg_popup_resize(i),jQuery(".bwg_slideshow_watermark_"+i).css({display:"none"}),jQuery(".bwg_slideshow_title_text_"+i).css({display:"none"}),jQuery(".bwg_slideshow_description_text_"+i).css({display:"none"}),setTimeout(function(){bwg_change_watermark_container(i)},500),1==bwg_params[i].slideshow_filmstrip_type&&("horizontal"==bwg_params[i].filmstrip_direction?jQuery(".bwg_slideshow_image_container_"+i).height(jQuery(".bwg_slideshow_image_wrap_"+i).height()-bwg_params[i].slideshow_filmstrip_height):jQuery(".bwg_slideshow_image_container_"+i).width(jQuery(".bwg_slideshow_image_wrap_"+i).width()-bwg_params[i].slideshow_filmstrip_width));var s=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";jQuery(e).bind(s,function(e){var t=window.event||e;return 0<((t=t.originalEvent?t.originalEvent:t).detail?-40*t.detail:t.wheelDelta)?jQuery(".bwg_slideshow_filmstrip_left_"+i).trigger("click"):jQuery(".bwg_slideshow_filmstrip_right_"+i).trigger("click"),!1});var o={bwg:i,params:bwg_params[i],slideshow_filmstrip_class_name:e};if(jQuery(".bwg_slideshow_filmstrip_right_"+i).on(_,function(){1==a?!1===bwg_slideshow_filmstrip_thumbnail_timer&&(bwg_slideshow_filmstrip_thumbnail_timer=!0,bwg_slideshow_filmstrip_next(o),setTimeout(function(){bwg_slideshow_filmstrip_thumbnail_timer=!1},505)):bwg_slideshow_filmstrip_next(o)}),jQuery(".bwg_slideshow_filmstrip_left_"+i).on(_,function(){1==a?!1===bwg_slideshow_filmstrip_thumbnail_timer&&(bwg_slideshow_filmstrip_thumbnail_timer=!0,bwg_slideshow_filmstrip_prev(o),setTimeout(function(){bwg_slideshow_filmstrip_thumbnail_timer=!1},505)):bwg_slideshow_filmstrip_prev(o)}),"width"==bwg_params[i].width_or_height?bwg_set_filmstrip_pos(jQuery(e).width(),i):bwg_set_filmstrip_pos(jQuery(e).height(),i),jQuery("#bwg_slideshow_play_pause_"+i).off(_).on(_,function(){jQuery(".bwg_ctrl_btn_"+i).hasClass("bwg-icon-play")?(bwg_play(bwg_params[i].data,i),jQuery(".bwg_slideshow_play_pause_"+i).attr("title",bwg_objectsL10n.pause),jQuery(".bwg_slideshow_play_pause_"+i).attr("class","bwg-icon-pause bwg_ctrl_btn_"+i+" bwg_slideshow_play_pause_"+i),1==bwg_params[i].enable_slideshow_music&&document.getElementById("bwg_audio_"+i).play()):(window.clearInterval(window["bwg_playInterval"+i]),jQuery(".bwg_slideshow_play_pause_"+i).attr("title","Play"),jQuery(".bwg_slideshow_play_pause_"+i).attr("class","bwg-icon-play bwg_ctrl_btn_"+i+" bwg_slideshow_play_pause_"+i),1==bwg_params[i].enable_slideshow_music&&document.getElementById("bwg_audio_"+i).pause())}),0!=bwg_params[i].enable_slideshow_autoplay&&(bwg_play(bwg_params[i].data,i),jQuery(".bwg_slideshow_play_pause_"+i).attr("title",bwg_objectsL10n.pause),jQuery(".bwg_slideshow_play_pause_"+i).attr("class","bwg-icon-pause bwg_ctrl_btn_"+i+" bwg_slideshow_play_pause_"+i),1==bwg_params[i].enable_slideshow_music&&jQuery("#bwg_audio_"+i).length&&document.getElementById("bwg_audio_"+i).play()),bwg_params[i].preload_images&&bwg_preload_images(parseInt(jQuery("#bwg_current_image_key_".$bwg).val()),i),jQuery(".bwg_slideshow_image_"+i).removeAttr("width"),jQuery(".bwg_slideshow_image_"+i).removeAttr("height"),jQuery("#instagram-embed-"+i).hide(),"undefined"!=typeof instgrm&&void 0!==instgrm.Embeds){var l=jQuery(".bwg_embed_frame_"+i),n=l.data("height");l.css({display:"none"}),instgrm.Embeds.process(),jQuery(".bwg_embed_frame_"+i+" #instagram-embed-"+i).css({"max-height":n+"px"}),l.css({display:"inline-block"})}}}function bwg_image_browser_resize(){jQuery(".bwg_image_browser").each(function(){var e=jQuery(this).attr("data-bwg");jQuery(".image_browser_images_conteiner_"+e).length&&(bwg_params_ib[e]=JSON.parse(jQuery("#bwg_container1_"+e+" .image_browser_images_conteiner_"+e).attr("data-params")),bwg_image_browser(e))})}function bwg_image_browser_ready(e){var t=e.data("bwg");bwg_container_loaded(t),jQuery(".image_browser_images_conteiner_"+t).length&&(bwg_params_ib[t]=JSON.parse(jQuery(".image_browser_images_conteiner_"+t).attr("data-params")),setTimeout(function(){bwg_image_browser(t)},3))}function bwg_search_focus(e){jQuery(e).parent().find(".bwg_search_input").focus(),jQuery(e).hide()}function bwg_key_press(e){jQuery(e).parent().find(".bwg_search_reset_container").removeClass("bwg-hidden"),jQuery(e).parent().find(".bwg_search_loupe_container1").removeClass("bwg-hidden")}function bwg_all_thumnails_loaded(t){var i=0,a=jQuery(t).find("img").length;return 0==a?bwg_all_thumbnails_loaded_callback(t):jQuery(t).find("img").each(function(){var e=jQuery(this).attr("src");jQuery("<img/>").attr("src",e).on("load error",function(){++i>=a&&bwg_all_thumbnails_loaded_callback(t)})}),jQuery(".bwg_container").each(function(){var e=jQuery(this).data("bwg");0<jQuery(this).find(".wd_error").length&&bwg_container_loaded(e)}),0==a}function bwg_all_thumbnails_loaded_callback(e){jQuery(e).hasClass("bwg-thumbnails")&&!jQuery(e).hasClass("bwg-masonry-thumbnails")&&bwg_thumbnail(e),jQuery(e).hasClass("bwg-masonry-thumbnails")&&bwg_thumbnail_masonry(e),jQuery(e).hasClass("bwg-album-extended")&&bwg_album_extended(e)}function bwg_album_thumbnail(e){bwg_container_loaded(jQuery(e).data("bwg"))}function bwg_album_extended(e){var t=jQuery(e).width(),i=jQuery(e).data("thumbnail-width"),a=jQuery(e).data("spacing"),r=jQuery(e).data("max-count"),_=parseInt(t/(2*i));_<1&&(_=1),r<_&&(_=r);var s=100/_,o=jQuery(e).find(".bwg-extended-item"),l=parseInt(o.css("margin-left")),n=parseInt(o.css("margin-right"));o.css({width:"calc("+s+"% - "+(l+n)+"px)"}),o.width()<i?o.find(".bwg-extended-item0, .bwg-extended-item1").css({width:"calc(100% - "+a+"px)"}):o.width()>2*i?(o.find(".bwg-extended-item0").css({width:"calc(50% - "+a+"px)"}),o.find(".bwg-extended-item1").css({width:"calc(100% - "+(i+2*a)+"px)"})):o.find(".bwg-extended-item0, .bwg-extended-item1").css({width:"calc(50% - "+a+"px)"}),jQuery(e).children(".bwg-extended-item").each(function(){var e=jQuery(this).find("img"),t=jQuery(this).find(".bwg-item0"),i=jQuery(this).find(".bwg-item2"),a=e.data("width"),r=e.data("height");""!=a&&""!=r||(a=e.width(),r=e.height());var _=a/r;i.width()/i.height()>a/r?(i.width()>a?e.css({width:"100%",height:i.width()/_}):e.css({maxWidth:"100%",height:i.width()/_}),a=i.width(),r=i.width()/_):(i.height()>r?e.css({height:"100%",width:i.height()*_,maxWidth:"initial"}):e.css({maxHeight:"100%",width:i.height()*_,maxWidth:"initial"}),r=i.height(),a=i.height()*_),jQuery(this).find(".bwg-item2").css({marginLeft:(t.width()-a)/2,marginTop:(t.height()-r)/2})}),bwg_container_loaded(jQuery(e).data("bwg"))}function bwg_thumbnail(e){var t=jQuery(e).width(),i=jQuery(e).data("thumbnail-width"),a=jQuery(e).data("max-count"),r=parseInt(t/i)+1;a<r&&(r=a);var _=100/r;jQuery(e).find(".bwg-item").css({width:_+"%"}),jQuery(e).children(".bwg-item").each(function(){var e=jQuery(this).find("img"),t=jQuery(this).find(".bwg-item2"),i=jQuery(this).find(".bwg-item1"),a=0<t.width()?t.width():i.width(),r=0<t.height()?t.height():i.height(),_=e.data("width"),s=e.data("height");""!=_&&""!=s&&void 0!==_&&void 0!==s||(_=e.width(),s=e.height());var o=_/s;e.removeAttr("style"),o<a/r?(_<a?e.css({width:"100%",height:a/o}):e.css({maxWidth:"100%",height:Math.ceil(a/o)}),s=(_=a)/o):(r>e.height()?e.css({height:"100%",width:r*o,maxWidth:"initial"}):e.css({maxHeight:"100%",width:r*o,maxWidth:"initial"}),_=(s=r)*o),jQuery(this).find(".bwg-item2").css({marginLeft:(a-_)/2,marginTop:(r-s)/2})}),bwg_container_loaded(jQuery(e).data("bwg"))}function bwg_thumbnail_masonry(e){var t="#bwg_thumbnails_masonry_"+(bwg=jQuery(e).attr("data-bwg"));jQuery("#bwg_album_masonry_"+bwg).length&&(t="#bwg_album_masonry_"+bwg),0===jQuery(".bwg-container-temp"+bwg).length&&(jQuery(t).clone().appendTo("#bwg_container3_"+bwg).removeAttr("id").removeClass("bwg-container-"+bwg).addClass("bwg-container-temp"+bwg),jQuery(".bwg-container-temp"+bwg).empty());var a=jQuery(".bwg-container-temp"+bwg),r=jQuery(t),_=a;if(a.prepend(r.html()),_.find(".bwg-empty-item").remove(),"horizontal"==_.data("masonry-type")){var s=_.data("thumbnail-height"),o=_.data("max-count"),l=[];for(i=0;i<o;i++)l.push(0);_.find(".bwg-item").each(function(){var e=l.indexOf(Math.min.apply(Math,l));jQuery(this).css({height:s,order:e+1}),l[e]+=jQuery(this)[0].getBoundingClientRect().width});var n=Math.max.apply(Math,l);for(_.width(n),i=0;i<o;i++)l[i]<n&&_.append(jQuery('<div class="bwg-item bwg-empty-item"></div>').css({height:s,order:i+1,width:n-l[i]}))}else{_.removeAttr("style");n=_.width();var g=_.data("thumbnail-width"),w=_.data("thumbnail-border"),b=(_.data("thumbnail-padding"),o=_.data("max-count"),parseInt(n/g)+("0"==_.data("resizable-thumbnails")?0:1));o<b&&(b=o);var u=_.find(".bwg-item").length;u<b&&(b=u);var d,h,m=100/b,c=[];for(i=0;i<b;i++)c.push(0);_.find(".bwg-item").each(function(){var e=c.indexOf(Math.min.apply(Math,c)),t=jQuery(this).find("img");if(jQuery(this).css({width:m+"%",order:e+1}),void 0!==t.data("src")&&-1===t.data("src").indexOf("svg")&&0<t.attr("data-width").length&&0<t.attr("data-height").length){h=parseInt(t.data("width"))/parseInt(t.data("height")),d=t.width()/h;var i=(this.querySelector("a .bwg-zoom-effect-overlay .bwg-title2")||!this.querySelector("a .bwg-title1 .bwg-title2")?0:this.querySelector("a .bwg-title1 .bwg-title2").getClientRects()[0].height)+(0<jQuery(this).find(".bwg-masonry-thumb-description").length?jQuery(this).find(".bwg-masonry-thumb-description").height():0);jQuery(this).height(Math.floor(d+i+2*w))}c[e]+=jQuery(this)[0].getBoundingClientRect().height});var p=Math.max.apply(Math,c);for(i=0;i<b;i++)c[i]<p&&_.append(jQuery('<div class="bwg-item bwg-empty-item"></div>').css({width:m+"%",order:i+1,height:p-c[i]}));_.outerWidth(b*(g+2*w)),_.height(p)}if(""!=a.html()){r.outerWidth(b*(g+2*w)),"0"!=p?(r.css("opacity","1"),r.height(p)):r.css("opacity","0"),r.empty();var y=a.html();r.append(y),r.find(".bwg_lazyload").each(function(){null!=jQuery(this).data("src")&&""!=jQuery(this).data("src")&&(jQuery(this).attr("src",jQuery(this).data("src")),jQuery(this).on("load",function(){jQuery(this).removeClass("lazy_loader")}))}),a.empty().hide()}bwg_container_loaded(_.data("bwg"))}function bwg_container_loaded(e){jQuery("#gal_front_form_"+e).removeClass("bwg-hidden"),jQuery("#ajax_loading_"+e).addClass("bwg-hidden"),jQuery(".bwg_container img").removeAttr("width").removeAttr("height")}function bwg_thumbnail_mosaic_logic(e){var t=e.attr("data-bwg"),i=e.attr("data-block-id"),a=parseInt(e.attr("data-thumb-padding"))/2,_=parseInt(e.attr("data-thumb-border"))+a;if("horizontal"==e.attr("data-mosaic-direction")){var r=parseInt(e.attr("data-height"));if("1"==e.attr("data-resizable"))if(1920<=jQuery(window).width())var s=(1+jQuery(window).width()/1920)*r;else if(jQuery(window).width()<=640)s=jQuery(window).width()/640*r;else s=r;else s=r;(p=jQuery(".bwg_mosaic_thumb_"+t)).each(function(e){var t=jQuery(this).data("width"),i=jQuery(this).data("height");""!=t&&""!=i&&void 0!==t&&void 0!==i||(t=p.get(e).naturalWidth,i=p.get(e).naturalHeight),t=t*s/i,p.eq(e).css({cssText:"width:"+t+"px !important; height:"+s+"px !important;"})});var o=jQuery("#bwg_mosaic_thumbnails_div_"+t).width()/100*parseInt(e.attr("data-total-width"));jQuery("#"+i).width(o);var l=s+2*_,n=0,g=[];g[0]=0;var w=[],b=w[0]=0;p.each(function(e){row_cum_width2=b+p.eq(e).width()+2*_,row_cum_width2-o<0?(b=row_cum_width2,g[e]=n,w[n]++):e!==p.length-1?Math.abs(b-o)>Math.abs(row_cum_width2-o)||Math.abs(b-o)<=Math.abs(row_cum_width2-o)&&0==w[n]?e!==p.length-2?(b=row_cum_width2,g[e]=n,w[n]++,w[++n]=0,b=0):(b=row_cum_width2,g[e]=n,w[n]++):(w[++n]=1,g[e]=n,b=row_cum_width2-b):(b=row_cum_width2,g[e]=n,w[n]++)});for(var u=[],d=[],h=0;h<=n;h++)b=0,p.each(function(e){g[e]==h&&(b+=p.eq(e).width())}),u[h]=z=(o-2*w[h]*_)/b,d[h]=(l-2*_)*u[h]+2*_;if(0==n)for(h=0;h<=n;h++)d[h]>s&&(u[h]=1,d[h]=l);(O=[])[0]=0;var m=[],c=[];m[0]=0,c[0]=0;for(h=1;h<=n;h++)m[h]=m[0],c[h]=c[h-1]+d[h-1];p.each(function(e){var t=p.eq(e).width(),i=p.eq(e).height(),a=t*u[g[e]],r=i*u[g[e]];p.eq(e).css({cssText:"width:"+a+"px !important; height:"+r+"px !important;"}),p.eq(e).parent().css({top:c[g[e]],left:m[g[e]]}),m[g[e]]+=t*u[g[e]]+2*_,O[g[e]]=e}),jQuery("#"+i).height(c[n]+d[n]-c[0])}else{var p,y=parseInt(e.attr("data-width"));if("1"==e.attr("data-resizable")){if(1920<=jQuery(window).width())var f=(1+jQuery(window).width()/1920)*y;else if(jQuery(window).width()<=640)f=jQuery(window).width()/640*y;else f=y;if(0<jQuery(".header-content-with_tab").length)f=jQuery(".header-content-with_tab").width()/4-10}else f=y;(p=jQuery(".bwg_mosaic_thumb_"+t)).each(function(e){jQuery(this).removeAttr("style"),jQuery(this).parent().removeAttr("style");var t=jQuery(this).data("width"),i=jQuery(this).data("height");""!=t&&""!=i&&void 0!==t&&void 0!==i||(t=p.get(e).naturalWidth,i=p.get(e).naturalHeight),p.eq(e).css({cssText:"width:"+f+"px !important; height:"+i*f/t+"px !important;"})});o=jQuery("#bwg_mosaic_thumbnails_div_"+t).width()/100*parseInt(e.attr("data-total-width"));jQuery("#"+i).width(o);var j=f+2*_<o?f:o-2*_,Q=Math.min(Math.floor(o/(j+2*_)),p.length),v=[];v[0]=0;for(var x=[],k=[],z=0;z<Q;z++)k[z]=0,x[z]=0;p.each(function(e){for(var t=0,i=k[0],a=0;a<Q;a++)i>k[a]&&(i=k[a],t=a);v[e]=t,x[t]++,H=i,T=0+t*(j+2*_),p.eq(e).parent().css({top:H,left:T}),k[t]+=p.eq(e).height()+2*_}),(u=[])[0]=1;var C=0,I=[],E=0,M=0;for(z=0;z<Q;z++)C+=j,I[z]=0,p.each(function(e){v[e]==z&&(I[z]+=p.eq(e).height())}),0!=I[z]&&(E+=j/I[z],M+=j*x[z]*2*_/I[z]);var S=0;0!=E&&(S=(C+M)/E);for(z=0;z<Q;z++)0!=I[z]&&(u[z]=(S-2*x[z]*_)/I[z]);var O,T=[];T[0]=0;for(z=1;z<=Q;z++)T[z]=T[z-1]+j*u[z-1]+2*_;var H=[];for(z=0;z<Q;z++)H[z]=0;(O=[])[0]=0,p.each(function(e){var t=p.eq(e).width(),i=p.eq(e).height(),a=t*u[v[e]],r=i*u[v[e]];p.eq(e).css({cssText:"width:"+a+"px !important; height:"+r+"px !important;"}),p.eq(e).parent().css({top:H[v[e]],left:T[v[e]]}),H[v[e]]+=i*u[v[e]]+2*_,O[v[e]]=e}),jQuery("#"+i).width(T[Q]).height(H[0])}}function bwg_thumbnail_mosaic(e){var t=jQuery(e),i=jQuery.Deferred();if(i.done([bwg_thumbnail_mosaic_logic]).done(function(e){"1"!=e.data("mosaic-thumb-transition")&&jQuery(".bwg_mosaic_thumb_spun_"+t).css({transition:"all 0.3s ease 0s","-webkit-transition":"all 0.3s ease 0s"});var t=e.data("bwg");jQuery(".bwg_mosaic_thumbnails_"+t).css({visibility:"visible"}),jQuery(".tablenav-pages_"+t).css({visibility:"visible"}),bwg_container_loaded(t),jQuery(".bwg_mosaic_thumb_"+t).removeClass("bwg-hidden"),jQuery("#bwg_mosaic_thumbnails_div_"+t).removeClass("bwg-hidden")}),i.resolve(t),"hover"==t.attr("data-image-title")){var a=parseInt(t.attr("data-thumb-padding"))/2,r=parseInt(t.attr("data-thumb-border"))+a;bwg_mosaic_title_on_hover(t.data("bwg"),t,r)}"hover"==t.attr("data-ecommerce-icon")&&(jQuery(".bwg_mosaic_thumb_spun_"+bwg).on("mouseenter",function(){var e=jQuery(this).parents(".bwg-mosaic-thumb-span").children(".bwg_mosaic_thumb_"+bwg).width(),t=jQuery(this).parents(".bwg-mosaic-thumb-span").children(".bwg_mosaic_thumb_"+bwg).height();jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).width(e);var i=jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).width(),a=jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).height();jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).css({top:r+.5*t-.5*a,left:r+.5*e-.5*i,opacity:1})}),jQuery(".bwg_mosaic_thumb_spun_"+bwg).on("mouseleave",function(){jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).css({top:0,left:-1e4,opacity:0,padding:t.attr("data-title-margin")})}))}function bwg_mosaic_title_on_hover(t,e,i){jQuery(".bwg-mosaic-thumb-span").on("mouseenter",function(){var e=jQuery(this).children(".bwg_mosaic_thumb_"+t).width();jQuery(this).find(".bwg_mosaic_title_spun1_"+t).width(e),jQuery(this).find(".bwg_mosaic_title_spun1_"+t).css({opacity:1,"max-height":"calc(100% - "+2*i+"px)",overflow:"hidden"})}),jQuery(".bwg-mosaic-thumb-span").on("mouseleave",function(){jQuery(this).find(".bwg_mosaic_title_spun1_"+t).css({opacity:0,padding:e.attr("data-title-margin"),"max-height":"calc(100% - "+2*i+"px)",overflow:"hidden"})})}function bwg_mosaic_ajax(e,t){var i=0;jQuery(".bwg_mosaic_thumb_spun_"+e+" img").on("load",function(){++i>=t&&bwg_thumbnail_mosaic(jQuery(".bwg-mosaic-thumbnails[data-bwg="+e+"]"))}),jQuery(".bwg_mosaic_thumb_spun_"+e+" img").on("error",function(){jQuery(this).height(100),jQuery(this).width(100),++i>=t&&bwg_thumbnail_mosaic(jQuery(".bwg-mosaic-thumbnails[data-bwg="+e+"]"))}),jQuery(".bwg_container").each(function(){var e=jQuery(this).data("bwg");0<jQuery(this).find(".wd_error").length&&bwg_container_loaded(e)})}function bwg_add_album(){var t=!1;"1"!=bwg_objectsL10n.front_ajax&&jQuery(document).off("click",".bwg-album").on("click",".bwg-album",function(){if(!t){var e=jQuery(this).attr("data-bwg");return t=!0,setTimeout(function(){t=!1},100),bwg_ajax("gal_front_form_"+e,e,jQuery(this).attr("data-container_id"),jQuery(this).attr("data-alb_gal_id"),jQuery(this).attr("data-album_gallery_id"),jQuery(this).attr("data-def_type"),"",jQuery(this).attr("data-title")),!1}}),jQuery(".bwg_description_more").on("click",function(){jQuery(this).hasClass("bwg_more")?(jQuery(this).parent().find(".bwg_description_full").show(),jQuery(this).addClass("bwg_hide").removeClass("bwg_more"),jQuery(this).html(jQuery(this).data("hide-msg"))):(jQuery(this).parent().find(".bwg_description_full").hide(),jQuery(this).addClass("bwg_more").removeClass("bwg_hide"),jQuery(this).html(jQuery(this).data("more-msg")))})}function bwg_add_lightbox(){var i=!1;jQuery(document).on("click",".bwg_lightbox .bwg-item0, .bwg_lightbox .bwg_slide, .bwg_lightbox .bwg-carousel-image, .bwg_lightbox .bwg-title1",function(e){e.stopPropagation(),e.preventDefault();var t=jQuery(this).closest("a");if(!i)return i=!0,setTimeout(function(){i=!1},100),bwg_gallery_box(jQuery(t).attr("data-image-id"),jQuery(t).closest(".bwg_container")),!1}),jQuery(".bwg_lightbox .bwg_ecommerce").on("click",function(e){if(e.stopPropagation(),!i)return i=!0,setTimeout(function(){i=!1},100),bwg_gallery_box(jQuery(this).closest(".bwg_lightbox").attr("data-image-id"),jQuery(this).closest(".bwg_container"),!0),!1})}function bwg_filter_by_tag(e){var t,i="",a="",r=(a=jQuery(e).parent().parent().hasClass("bwg_tag_buttons_view")?jQuery(e).parent().parent():jQuery(e).parent().parent().parent()).find(".current_view").val(),_=a.find(".form_id").val(),s=a.find(".cur_gal_id").val(),o=a.find(".album_gallery_id").val(),l=a.find(".type").val();jQuery(e).parent().find(".opt.selected").each(function(){i=i+jQuery(e).text()+","}),""==(i=i.slice(0,-1))&&(i=bwg_objectsL10n.bwg_select_tag),jQuery(e).parent().find(".CaptionCont").attr("title",i),jQuery(e).parent().find(".CaptionCont .placeholder").html(i);var n=jQuery(".bwg_tags_container_"+r+" #bwg_tag_id_"+s).val();t="string"==typeof n&&""!==n?n.split(","):[],"object"==typeof n&&(t=n),jQuery(".bwg_tags_container_"+r+" #bwg_tag_id_"+r).val(t),bwg_select_tag(r,_,s,o,l,!1)}function bwg_document_ready(i){bwg_add_lightbox(),i.data("right-click-protection")&&bwg_disable_right_click(i),jQuery(".SumoSelect > .CaptionCont > label > i").addClass("bwg-icon-angle-down closed");var e=i.find(".search_tags");if("1"==bwg_objectsL10n.front_ajax&&e.length)for(var t=0;t<e[0].length;t++)void 0===e[0][t].attributes.selected&&(e[0][t].selected=!1);e.length&&(e.SumoSelect({triggerChangeCombined:!0,placeholder:bwg_objectsL10n.bwg_select_tag,search:!0,searchText:bwg_objectsL10n.bwg_search,forceCustomRendering:!0,noMatch:bwg_objectsL10n.bwg_tag_no_match,captionFormatAllSelected:bwg_objectsL10n.bwg_all_tags_selected,captionFormat:"{0} "+bwg_objectsL10n.bwg_tags_selected,okCancelInMulti:!0,locale:[bwg_objectsL10n.ok,bwg_objectsL10n.cancel,bwg_objectsL10n.select_all]}),e.off("change").on("change",function(){bwg_filter_by_tag(this)})),bwg_search_tag_init(i);var a=i.find(".cur_gal_id").val(),r=i.find(".current_view").val(),_=i.find(".bwg_tags_container_"+r+" .bwg_tag_button_view_container"),s=i.find("#bwg_tag_id_"+a),o=parseInt(2*_.find(".bwg_tags_filter_buttons").outerHeight(!0));_.length&&(_.find(".bwg_tags_filter_buttons").off("click").on("click",function(){if(!jQuery(this).hasClass("active")){var e=jQuery(this).position().top;o<e&&i.find(".show_bottom_tag").val("1"),""==s.val()?s.val(jQuery(this).val()):s.val(s.val()+","+jQuery(this).val()),bwg_filter_by_tag(this)}return!1}),_.find(".bwg_all_tags").off("click").on("click",function(){return jQuery(this).hasClass("active")||(s.val(""),bwg_filter_by_tag(this)),!1}),""!=s.val()&&_.find(".bwg_all_tags").removeClass("active"),s.val().split(",").forEach(function(t){_.find(".bwg_tags_filter_buttons").each(function(){if(jQuery(this).val()==t){var e=jQuery(this).position().top;o<e&&i.find(".show_bottom_tag").val("1")}})}),bwg_tags_button_section_visibility());var l=i.find(".bwg_order");l.length&&l.SumoSelect({triggerChangeCombined:!0,forceCustomRendering:!0}),jQuery(this).find("search_placeholder_title").hide(),""==jQuery(this).find(".bwg_search_input").val()&&jQuery(this).find("search_placeholder_title").show(),jQuery(".bwg_thumbnail .bwg_search_container_2").focusout(function(e){""==jQuery(this).find(".bwg_search_input").val()&&(jQuery(this).find(".search_placeholder_title").show(),jQuery(this).find(".bwg_search_loupe_container1").addClass("bwg-hidden"),jQuery(this).find(".bwg_search_reset_container").addClass("bwg-hidden"))}),jQuery(".search_tags").on("sumo:opened",function(){var e=jQuery(this).parents(".bwg_container").height(),t=jQuery(this).parents(".bwg_container").find(".wd_error").length,i=jQuery(this).parents(".bwg_container").find(".SumoSelect>.optWrapper>.options");void 0!==i&&(e-50<i.height()&&!t&&i.css("max-height",e-50));0==jQuery(this).parent().find("ul li").length&&(jQuery(".no-match").html(bwg_objectsL10n.bwg_tag_no_match),jQuery(".no-match").show())}),jQuery(".bwg_thumbnail .SumoSelect").on("sumo:closed",function(){jQuery(this).find("label i").removeClass("bwg-icon-angle-up opened"),jQuery(this).find("label i").addClass("bwg-icon-angle-down closed")}),jQuery(".bwg_thumbnail .SumoSelect").on("sumo:opened",function(){jQuery(this).find("label i").removeClass("bwg-icon-angle-down closed"),jQuery(this).find("label i").addClass("bwg-icon-angle-up opened")}),bwg_add_album();var n=window.location.hash.substring(1);if(n&&"-1"!=n.indexOf("bwg")){bwg_hash_array=n.replace("bwg","").split("/");var g=jQuery(".bwg_container");g&&bwg_gallery_box(bwg_hash_array[1],g,!1,bwg_hash_array[0])}bwg_resize_search_line()}function bwg_search_tag_init(e){jQuery(".SumoSelect > .CaptionCont > label > i").addClass("bwg-icon-angle-down closed");var t=e.find(".search_tags");if("1"==bwg_objectsL10n.front_ajax&&t.length)for(var i=0;i<t[0].length;i++)void 0===t[0][i].attributes.selected&&(t[0][i].selected=!1);t.length&&(t.SumoSelect({triggerChangeCombined:!0,placeholder:bwg_objectsL10n.bwg_select_tag,search:!0,searchText:bwg_objectsL10n.bwg_search,forceCustomRendering:!0,noMatch:bwg_objectsL10n.bwg_tag_no_match,captionFormatAllSelected:bwg_objectsL10n.bwg_all_tags_selected,captionFormat:"{0} "+bwg_objectsL10n.bwg_tags_selected,okCancelInMulti:!0,locale:[bwg_objectsL10n.ok,bwg_objectsL10n.cancel,bwg_objectsL10n.select_all]}),t.off("change").on("change",function(){bwg_filter_by_tag(this)}))}function bwg_clear_search_input(e){if("1"!=bwg_objectsL10n.front_ajax)jQuery("#bwg_search_input_"+e).val(""),jQuery("#bwg_search_container_1_"+e+" .bwg_search_loupe_container1").addClass("bwg-hidden"),jQuery("#bwg_search_container_1_"+e+" .bwg_search_reset_container").addClass("bwg-hidden");else{var t=window.location.href,i=bwg_remove_url_parameter("bwg_search_"+e,t,t);window.location.replace(i)}}function bwg_check_search_input_enter(e,t){return"Enter"!=t.key||(jQuery(e).closest(".bwg_search_container_1").find(".bwg_search").trigger("click"),!1)}function bwg_ajax(t,i,a,r,e,_,s,o,l,n,g,w){if("1"!=bwg_objectsL10n.front_ajax||!0===n){jQuery("#ajax_loading_"+i).removeClass("bwg-hidden"),jQuery(".bwg_load_more_ajax_loading").css({top:jQuery("#bwg_container1_"+bwg).height()-jQuery(".bwg_load_more_ajax_loading").height()}),"function"==typeof bwg_scroll_load_action&&jQuery(window).off("scroll",bwg_scroll_load_action),jQuery(".bwg_thumbnail .search_tags").off("sumo:closed");var b=jQuery("#"+t).data("ajax-url"),u=0;if(void 0===n)n=!1;var d,h=jQuery("#page_number_"+i).val(),m=jQuery("#bwg_search_input_"+i).val(),c={},p=jQuery("#bwg_album_breadcrumb_"+i).val();if(p&&!0!==n){var y=JSON.parse(p);if("back"==r){y.splice(-1,1);var f=y.slice(-1)[0];r=f.id,h=f.page,c["action_"+i]="back"}else"numeric"===n||s?(y.splice(-1,1),y.push({id:r,page:h,search:m})):(y.push({id:r,page:1}),h=1);c["bwg_album_breadcrumb_"+i]=JSON.stringify(y)}if(c["bwg-preview-type"]=jQuery("#"+t).data("gallery-type"),c.gallery_type=jQuery("#"+t).data("gallery-type"),c.gallery_id=jQuery("#"+t).data("gallery-id"),c.tag=jQuery("#"+t).data("tag"),c.album_id=jQuery("#"+t).data("album-id"),c.theme_id=jQuery("#"+t).data("theme-id"),c.shortcode_id=jQuery("#"+t).data("shortcode-id"),c.bwg=i,c.current_url=encodeURI(jQuery("#bwg_container1_"+i).data("current-url")),s&&(h=1),void 0===o||""==o)o="";if(void 0===g||""==g)g="";if(void 0===l||""==l)l=jQuery(".bwg_order_"+i).val();if(void 0===w)w=!0;if(1==w&&jQuery("html, body").animate({scrollTop:jQuery("#"+t).offset().top-150},500),c["page_number_"+i]=h,c["bwg_load_more_"+i]=jQuery("#bwg_load_more_"+i).val(),c["album_gallery_id_"+i]=r,c["type_"+i]=_,c["title_"+i]=o,c["description_"+i]=g,c["sortImagesByValue_"+i]=l,c["bwg_random_seed_"+i]=jQuery("#bwg_random_seed_"+i).val(),0<jQuery("#bwg_search_input_"+i).length&&(c["bwg_search_"+i]=jQuery("#bwg_search_input_"+i).val()),void 0!==c["bwg_album_breadcrumb_"+i]){var j=JSON.parse(c["bwg_album_breadcrumb_"+i]);jQuery.each(j,function(e,t){c["bwg_search_"+i]="",r==t.id&&(c["bwg_search_"+i]=t.search)})}var Q=jQuery(".bwg_tags_container_"+i+" #bwg_tag_id_"+a).val();return d="string"==typeof Q&&""!==Q?Q.split(","):[],"object"==typeof Q&&(d=Q),c["bwg_tag_id_"+a]=d,jQuery("#ajax_loading_"+i).removeClass("bwg-hidden"),jQuery(".bwg_load_more_ajax_loading").css({top:jQuery("#bwg_container1_"+bwg).height()-jQuery(".bwg_load_more_ajax_loading").height()}),jQuery.ajax({type:"POST",url:b,data:c,success:function(e){jQuery(e).find(".bwg_masonry_thumb_spun_"+i+" img").length,u=jQuery(e).find(".bwg_mosaic_thumb_spun_"+i+" img").length,!0===n?(a=="bwg_thumbnails_mosaic_"+i?jQuery("#"+a).append(jQuery(e).closest(".bwg-container-"+i).find("#"+a).html()):a=="bwg_album_compact_"+i?jQuery("#"+a).append(jQuery(e).closest(".bwg-album-thumbnails").html()):a=="bwg_thumbnails_masonry_"+i?jQuery(".bwg-container-temp"+i).append(jQuery(e).closest(".bwg-container-"+i).html()):jQuery("#"+a).append(jQuery(e).closest(".bwg-container-"+i).html()),jQuery(".bwg_nav_cont_"+i).html(jQuery(e).closest(".bwg_nav_cont_"+i).html())):jQuery("#bwg_container3_"+i).html(e),bwg_remove_lazy_loader_icon()},complete:function(){jQuery("div[id^='bwg_container1_'] img").each(function(){null!=jQuery(this).attr("data-lazy-src")&&""!=jQuery(this).attr("data-lazy-src")?jQuery(this).attr("src",jQuery(this).attr("data-lazy-src")):null!=jQuery(this).attr("data-src")&&""!=jQuery(this).attr("data-src")&&jQuery(this).attr("src",jQuery(this).attr("data-src"))}),jQuery(".blog_style_image_buttons_conteiner_"+i).find(jQuery(".bwg_blog_style_img_"+i)).on("load",function(){jQuery(".bwg_blog_style_img_"+i).closest(jQuery(".blog_style_image_buttons_conteiner_"+i)).show()}),""==d&&(d=[]),jQuery(".bwg_tags_container_"+i+" #bwg_tag_id_"+a).val(d),d.forEach(function(t){jQuery(".bwg_tags_container_"+i+" .bwg_tags_filter_buttons").each(function(){var e=parseInt(2*jQuery(this).outerHeight(!0));jQuery(this).val()==t&&(jQuery(this).addClass("active"),e<jQuery(this).position().top&&jQuery(".bwg_tags_container_"+i+" .show_bottom_tag").val("1"),jQuery(".bwg_tags_container_"+i+" .bwg_all_tags").removeClass("active"))})}),jQuery(".pagination-links_"+i).length&&jQuery("html, body").animate({scrollTop:jQuery("#"+t).offset().top-150},500),bwg_document_ready(jQuery("#bwg_container1_"+i));var e=jQuery("#bwg_container1_"+i).data("gallery-type");if(jQuery("#bwg_container1_"+i+" .bwg-album-thumbnails").length){bwg_all_thumnails_loaded(".bwg-container-"+i)&&bwg_container_loaded(i)}else{switch(e){case"thumbnails":case"thumbnails_masonry":case"album_compact_preview":case"album_masonry_preview":case"album_extended_preview":bwg_all_thumnails_loaded(".bwg-container-"+i);break;case"slideshow":bwg_slideshow_ready(i);break;case"carousel":bwg_carousel_ready(i),bwg_carousel_onload(jQuery("#bwg_container1_"+i));break;case"image_browser":bwg_image_browser_ready(jQuery("#bwg_container1_"+i));break;case"blog_style":bwg_blog_style_ready(jQuery("#bwg_container1_"+i))}bwg_mosaic_ajax(i,u)}jQuery(".blog_style_images_conteiner_"+i+" .bwg_embed_frame_16x9_"+i).each(function(e){jQuery(this).width(jQuery(this).parent().width()),jQuery(this).height(.5625*jQuery(this).width())}),jQuery(".blog_style_images_conteiner_"+i+" .bwg_embed_frame_instapost_"+i).each(function(e){jQuery(this).width(jQuery(this).parent().width()),jQuery(this).height((jQuery(this).width()-16)*jQuery(this).attr("data-height")/jQuery(this).attr("data-width")+96)}),jQuery("#bwg_embed_frame_16x9_"+i).width(jQuery("#bwg_embed_frame_16x9_"+i).parent().width()),jQuery("#bwg_embed_frame_16x9_"+i).height(.5625*jQuery("#bwg_embed_frame_16x9_"+i).width()),jQuery("#bwg_embed_frame_instapost_"+i).width(jQuery("#bwg_embed_frame_16x9_"+i).parent().width()),jQuery(".bwg_embed_frame_instapost_"+i).height((jQuery(".bwg_embed_frame_instapost_"+i).width()-16)*jQuery(".bwg_embed_frame_instapost_"+i).attr("data-height")/jQuery(".bwg_embed_frame_instapost_"+i).attr("data-width")+96),jQuery("#bwg_search_input_"+i).val(c["bwg_search_"+i]),""!=jQuery("#bwg_search_input_"+i).val()?(jQuery("#bwg_search_input_"+i).parent().find(".search_placeholder_title").hide(),jQuery("#bwg_search_input_"+i).parent().parent().find(".bwg_search_reset_container").show(),jQuery("#bwg_search_input_"+i).parent().parent().find(".bwg_search_loupe_container1").show()):jQuery("#bwg_search_input_"+i).parent().find(".search_placeholder_title").show();jQuery("#bwg_container2_"+i+" .cur_gal_id").val();""==d&&(d=[]),jQuery(".bwg_tags_container_"+i+" #bwg_tag_id_"+i).val(d)}}),!1}if("back"===r)return-1==document.referrer.indexOf(window.location.host)?(str=jQuery(location).attr("href"),void window.location.replace(str.substring(0,str.indexOf("type_0")))):void window.history.back();var v=jQuery("#bwg_search_input_"+i).val(),x=jQuery(".bwg_tags_container_"+i+" .cur_gal_id").val(),k=window.location.href,z="",C=jQuery(".bwg_tags_container_"+i+" #bwg_tag_id_"+x).val();if(jQuery(".bwg_tags_container_"+i).parent().hasClass("bwg_tag_select_view")&&(C=C.toString()),"#"==k.substr(-1)&&(k=k.slice(0,-1)),""!==v&&void 0!==v?!1!==(z=bwg_add_url_parameter(z=bwg_remove_url_parameter("page_number_"+i,k),"bwg_search_"+i,v))&&(k=z):!1!==(z=bwg_remove_url_parameter("bwg_search_"+i,k))&&(k=z),void 0!==l&&""!==l&&!1!==(z=bwg_add_url_parameter(k,"sort_by_"+i,l))&&(k=z),null!=C&&0<C.length){var I="",E=C.split(",");jQuery.each(E,function(e){var t=",";e===E.length-1&&(t=""),I+=E[e]+t}),""!==I&&!1!==(z=bwg_add_url_parameter(k,"filter_tag_"+i,I))&&(k=z)}else!1!==(z=bwg_remove_url_parameter("filter_tag_"+i,z))&&(k=z);window.location.href=k}function bwg_add_url_parameter(e,t,i){var a=new RegExp("([?&])"+t+"=.*?(&|$)","i"),r=-1!==e.indexOf("?")?"&":"?";return e.match(a)?e.replace(a,"$1"+t+"="+i+"$2"):e+r+t+"="+i}function bwg_remove_url_parameter(e,t){var i=t.split("?"),a=i[0]+"?",r="";if(void 0!==i[1]&&(r=i[1]),""===r)return t;var _,s,o=decodeURIComponent(r).split("&");for(s=0;s<o.length;s++)(_=o[s].split("="))[0]!=e&&(a=a+_[0]+"="+_[1]+"&");return a.substring(0,a.length-1)}function bwg_select_tag(e,t,i,a,r,_){_&&jQuery(".bwg_tags_container_"+e+" #bwg_tag_id_"+i).val(""),bwg_ajax(t,e,i,a,"",r,1,"")}function bwg_cube(e,t,i,a,r,_,s,o,l,n,g){var w,b=!1,u="";if(void 0!==g&&""!==g){b=!0,bwg_params[g].bwg_trans_in_progress=!0,u="_"+g,w=bwg_params[g].bwg_transition_duration;bwg_params[g].event_stack}else w=bwg_transition_duration;if(!bwg_testBrowser_cssTransitions(g))return bwg_fallback(o,l,n,g);if(!bwg_testBrowser_cssTransforms3d(g))return bwg_fallback3d(o,l,n,g);function d(){if(jQuery(o).removeAttr("style"),jQuery(l).removeAttr("style"),jQuery(".bwg_slider"+u).removeAttr("style"),jQuery(o).css({opacity:0,"z-index":1}),jQuery(l).css({opacity:1,"z-index":2}),jQuery(".bwg_image_info").show(),jQuery(o).html(""),b){bwg_change_watermark_container(g),bwg_params[g].bwg_trans_in_progress=!1;var e=bwg_params[g].data,t=bwg_params[g].event_stack}else{e="";gallery_box_data.bwg_trans_in_progress=!1;t=gallery_box_data.event_stack}if(void 0!==t&&0<t.length){var i=t[0].split("-");t.shift(),bwg_change_image(i[0],i[1],e,!0,g)}bwg_change_watermark_container()}b?(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+g).removeClass("bwg_slideshow_thumb_active_"+g).addClass("bwg_slideshow_thumb_deactive_"+g),jQuery("#bwg_filmstrip_thumbnail_"+bwg_params[g].bwg_current_key+"_"+g).removeClass("bwg_slideshow_thumb_deactive_"+g).addClass("bwg_slideshow_thumb_active_"+g),jQuery(".bwg_slideshow_dots_"+g).removeClass("bwg_slideshow_dots_active_"+g).addClass("bwg_slideshow_dots_deactive_"+g),jQuery("#bwg_dots_"+bwg_params[g].bwg_current_key+"_"+g).removeClass("bwg_slideshow_dots_deactive_"+g).addClass("bwg_slideshow_dots_active_"+g),jQuery(".bwg_slide_bg_"+g).css("perspective",1e3)):(gallery_box_data.bwg_trans_in_progress=!0,jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive"),jQuery("#bwg_filmstrip_thumbnail_"+gallery_box_data.bwg_current_key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active"),jQuery(".bwg_slide_bg").css("perspective",1e3)),jQuery(o).css({transform:"translateZ("+e+"px)",backfaceVisibility:"hidden"}),jQuery(l).css({opacity:1,backfaceVisibility:"hidden",transform:"translateY("+i+"px) translateX("+t+"px) rotateY("+r+"deg) rotateX("+a+"deg)"}),jQuery(".bwg_slider"+u).css({transform:"translateZ(-"+e+"px)",transformStyle:"preserve-3d"}),setTimeout(function(){jQuery(".bwg_slider"+u).css({transition:"all "+w+"ms ease-in-out",transform:"translateZ(-"+e+"px) rotateX("+_+"deg) rotateY("+s+"deg)"})},20),jQuery(".bwg_slider"+u).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(d)),0==w&&d()}function bwg_cubeH(e,t,i,a){var r=jQuery(e).width()/2;"right"==i?bwg_cube(r,r,0,0,90,0,-90,e,t,i,a):"left"==i&&bwg_cube(r,-r,0,0,-90,0,90,e,t,i,a)}function bwg_cubeV(e,t,i,a){var r=jQuery(e).height()/2;"right"==i?bwg_cube(r,0,-r,90,0,-90,0,e,t,i,a):"left"==i&&bwg_cube(r,0,r,-90,0,90,0,e,t,i,a)}function bwg_fade(e,t,i,a){var r,_=!1;function s(){jQuery(".bwg_image_info").show(),bwg_change_watermark_container(a),_?bwg_params[a].bwg_trans_in_progress=!1:gallery_box_data.bwg_trans_in_progress=!1}r=void 0!==a&&""!==a?(_=!0,bwg_params[a].bwg_trans_in_progress=!0,bwg_params[a].bwg_transition_duration):(gallery_box_data.bwg_trans_in_progress=!0,gallery_box_data.bwg_transition_duration),_?(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+a).removeClass("bwg_slideshow_thumb_active_"+a).addClass("bwg_slideshow_thumb_deactive_"+a),jQuery("#bwg_filmstrip_thumbnail_"+bwg_params[a].bwg_current_key+"_"+a).removeClass("bwg_slideshow_thumb_deactive_"+a).addClass("bwg_slideshow_thumb_active_"+a),jQuery(".bwg_slideshow_dots_"+a).removeClass("bwg_slideshow_dots_active_"+a).addClass("bwg_slideshow_dots_deactive_"+a),jQuery("#bwg_dots_"+bwg_params[a].bwg_current_key+"_"+a).removeClass("bwg_slideshow_dots_deactive_"+a).addClass("bwg_slideshow_dots_active_"+a)):(jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive"),jQuery("#bwg_filmstrip_thumbnail_"+gallery_box_data.bwg_current_key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active")),bwg_testBrowser_cssTransitions()?(jQuery(t).css("transition","opacity "+r+"ms linear"),jQuery(e).css("transition","opacity "+r+"ms linear"),jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),jQuery(t).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(s))):(jQuery(e).animate({opacity:0,"z-index":1},r),jQuery(t).animate({opacity:1,"z-index":2},{duration:r,complete:function(){_?bwg_params[a].bwg_trans_in_progress=!1:gallery_box_data.bwg_trans_in_progress=!1,jQuery(e).html(""),s()}}),jQuery(e).fadeTo(r,0),jQuery(t).fadeTo(r,1)),0==r&&s()}function bwg_grid(e,t,i,a,r,_,s,o,l,n,g){var w,b=!1,u="";if(event_stack=void 0!==g&&""!==g?(b=!0,bwg_params[g].bwg_trans_in_progress=!0,u="_"+g,w=bwg_params[g].bwg_transition_duration,bwg_params[g].event_stack):(w=bwg_transition_duration,gallery_box_data.bwg_trans_in_progress=!0,gallery_box_data.event_stack),!bwg_testBrowser_cssTransitions())return bwg_fallback(o,l,n);b?(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+g).removeClass("bwg_slideshow_thumb_active_"+g).addClass("bwg_slideshow_thumb_deactive_"+g),jQuery("#bwg_filmstrip_thumbnail_"+bwg_params[g].bwg_current_key+u).removeClass("bwg_slideshow_thumb_deactive_"+g).addClass("bwg_slideshow_thumb_active_"+g),jQuery(".bwg_slideshow_dots_"+g).removeClass("bwg_slideshow_dots_active_"+g).addClass("bwg_slideshow_dots_deactive_"+g),jQuery("#bwg_dots_"+bwg_params[g].bwg_current_key+u).removeClass("bwg_slideshow_dots_deactive_"+g).addClass("bwg_slideshow_dots_active_"+g)):(jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive"),jQuery("#bwg_filmstrip_thumbnail_"+gallery_box_data.bwg_current_key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active"));var d=w/(e+t);var h=jQuery(o).find("img"),m=jQuery(o).find("figure"),c=(jQuery(o).find("iframe").css("opacity",0),jQuery('<span style="display: block;" />').addClass("bwg_grid"+u));jQuery(o).prepend(c);var p,y,f,j,Q,v,x,k,z,C,I,E=jQuery(".bwg_slide_bg"+u),M=h.width(),S=h.height(),O=E.width(),T=E.height(),H=Math.floor(O/e),L=Math.floor(T/t),A=O-e*H,B=Math.ceil(A/e),W=T-t*L,D=Math.ceil(W/t),R=0,F=Math.ceil((jQuery(".bwg_slide_bg"+u).width()-h.width())/2),N=void 0===h.attr("src")?"":h.attr("src");a="min-auto"===(a="auto"===a?O:a)?-O:a,r="min-auto"===(r="auto"===r?T:r)?-T:r;for(var P=0;P<e;P++){var U=0,V=Math.floor((jQuery(".bwg_slide_bg"+u).height()-h.height())/2),q=H;if(0<A){var J=B<=A?B:A;q+=J,A-=J}for(var G=0;G<t;G++){var Y=L,$=W;0<$&&(Y+=J=D<=$?D:W,$-=J),c.append((p=q,y=Y,f=U,j=V,Q=R,v=F,x=N,k=M,z=S,C=g,void 0,I=(P+G)*d,jQuery('<span class="bwg_gridlet'+u+'" />').css({display:"block",width:p,height:y,top:f,left:Q,backgroundImage:'url("'+x+'")',backgroundColor:b?jQuery(".bwg_slideshow_image_wrap_"+C).css("background-color"):jQuery(".spider_popup_wrap").css("background-color"),backgroundRepeat:"no-repeat",backgroundPosition:v+"px "+j+"px",backgroundSize:k+"px "+z+"px",transition:"all "+w+"ms ease-in-out "+I+"ms",transform:"none"}))),U+=Y,V-=Y}F-=q,R+=q}var X=c.children().last();function K(){if(jQuery(o).css({opacity:0,"z-index":1}),jQuery(l).css({opacity:1,"z-index":2}),h.css("opacity",1),m.css("opacity",1),c.remove(),b){bwg_params[g].bwg_trans_in_progress=!1;var e=bwg_params[g].event_stack,t=bwg_params[g].data}else{gallery_box_data.bwg_trans_in_progress=!1;e=gallery_box_data.event_stack,t=""}if(jQuery(".bwg_image_info").show(),jQuery(o).html(""),void 0!==e&&0<e.length){var i=e[0].split("-");e.shift(),bwg_change_image(i[0],i[1],t,!0,g)}b?bwg_change_watermark_container(g):bwg_change_watermark_container()}c.show(),h.css("opacity",0),m.css("opacity",0),c.children().first().addClass("rs-top-left"),c.children().last().addClass("rs-bottom-right"),c.children().eq(t-1).addClass("rs-bottom-left"),c.children().eq(-t).addClass("rs-top-right"),setTimeout(function(){c.children().css({opacity:s,transform:"rotate("+i+"deg) translateX("+a+"px) translateY("+r+"px) scale("+_+")"})},1),jQuery(l).css("opacity",1),jQuery(X).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(K)),0==w&&K()}function bwg_sliceH(e,t,i,a){if("right"==i)var r="min-auto";else if("left"==i)r="auto";bwg_grid(1,8,0,r,0,1,0,e,t,i,a)}function bwg_sliceV(e,t,i,a){if("right"==i)var r="min-auto";else if("left"==i)r="auto";bwg_grid(10,1,0,0,r,1,0,e,t,i,a)}function bwg_slideV(e,t,i,a){if("right"==i)var r="auto";else if("left"==i)r="min-auto";bwg_grid(1,1,0,0,r,1,1,e,t,i,a)}function bwg_slideH(e,t,i,a){if("right"==i)var r="min-auto";else if("left"==i)r="auto";bwg_grid(1,1,0,r,0,1,1,e,t,i,a)}function bwg_scaleOut(e,t,i,a){bwg_grid(1,1,0,0,0,1.5,0,e,t,i,a)}function bwg_scaleIn(e,t,i,a){bwg_grid(1,1,0,0,0,.5,0,e,t,i,a)}function bwg_blockScale(e,t,i,a){bwg_grid(8,6,0,0,0,.6,0,e,t,i,a)}function bwg_kaleidoscope(e,t,i,a){bwg_grid(10,8,0,0,0,1,0,e,t,i,a)}function bwg_fan(e,t,i,a){if("right"==i)var r=45,_=100;else if("left"==i)r=-45,_=-100;bwg_grid(1,10,r,_,0,1,0,e,t,i,a)}function bwg_blindV(e,t,i,a){bwg_grid(1,8,0,0,0,.7,0,e,t,"",a)}function bwg_blindH(e,t,i,a){bwg_grid(10,1,0,0,0,.7,0,e,t,"",a)}function bwg_random(e,t,i,a){var r=["sliceH","sliceV","slideH","slideV","scaleOut","scaleIn","blockScale","kaleidoscope","fan","blindH","blindV"];this["bwg_"+r[Math.floor(Math.random()*r.length)]](e,t,i,a)}function bwg_change_watermark_container(t){jQuery(".bwg_slider"+(void 0!==t&&""!==t?"_"+t:"")).children().each(function(){if(2==jQuery(this).css("zIndex")){var e=jQuery(this).find("img");if(e.length)if(e.prop("complete"))bwg_change_each_watermark_container(e.width(),e.height(),t);else e.on("load",function(){bwg_change_each_watermark_container(e.width(),e.height(),t)});else(e=jQuery(this).find("iframe")).length||(e=jQuery(this).find("video")),bwg_change_each_watermark_container(e.width(),e.height(),t)}})}function bwg_change_each_watermark_container(e,t,i){var a=void 0!==i&&""!==i?"_"+i:"",r=void 0!==i&&""!==i?"_slideshow":"";if(jQuery(".bwg"+r+"_watermark_spun"+a).width(e),jQuery(".bwg"+r+"_watermark_spun"+a).height(t),jQuery(".bwg"+r+"_watermark"+a).css({display:""}),void 0===i||""===i){var _=0;(jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(_=gallery_box_data.lightbox_comment_width),e<=jQuery(window).width()-_&&(jQuery(".bwg_watermark_image").css({width:(jQuery(".spider_popup_wrap").width()-_)*gallery_box_data.watermark_font_size/gallery_box_data.image_width}),jQuery(".bwg_watermark_text, .bwg_watermark_text:hover").css({fontSize:(jQuery(".spider_popup_wrap").width()-_)*gallery_box_data.watermark_font_size/gallery_box_data.image_width}))}else jQuery(".bwg"+r+"_title_spun"+a).width(e),jQuery(".bwg"+r+"_title_spun"+a).height(t),jQuery(".bwg"+r+"_description_spun"+a).width(e),jQuery(".bwg"+r+"_description_spun"+a).height(t);jQuery.trim(jQuery(".bwg"+r+"_title_text"+a).text())&&jQuery(".bwg_slideshow_title_text"+a).css({display:""}),jQuery.trim(jQuery(".bwg"+r+"_description_text"+a).text())&&jQuery(".bwg"+r+"_description_text"+a).css({display:""})}function bwg_set_filmstrip_pos(e,t,i){var a,r=void 0!==t&&""!==t?"_"+t:"",_=void 0!==t&&""!==t?"_slideshow":"";a=void 0!==t&&""!==t?bwg_params[t].left_or_top:gallery_box_data.left_or_top;var s=parseInt(jQuery(".bwg_filmstrip_thumbnails").attr("data-all-images-top-bottom-space")),o=parseInt(jQuery(".bwg_filmstrip_thumbnails").attr("data-all-images-right-left-space"));if(void 0===t||""===t){if("outerWidth"==gallery_box_data.outerWidth_or_outerHeight)var l=-bwg_current_filmstrip_pos-jQuery(".bwg_filmstrip_thumbnail").outerWidth(!0)/2;else if("outerHeight"==gallery_box_data.outerWidth_or_outerHeight)l=-bwg_current_filmstrip_pos-jQuery(".bwg_filmstrip_thumbnail").outerHeight(!0)/2;if("width"==gallery_box_data.width_or_height)var n=Math.min(0,Math.max(e-jQuery(".bwg_filmstrip_thumbnails").width(),l+e/2));else if("height"==gallery_box_data.width_or_height)n=Math.min(0,Math.max(e-jQuery(".bwg_filmstrip_thumbnails").height(),l+e/2))}else if("width"==bwg_params[t].width_or_height)l=-bwg_params[t].bwg_current_filmstrip_pos-(jQuery(".bwg_slideshow_filmstrip_thumbnail"+r).width()+bwg_params[t].filmstrip_thumb_margin_hor)/2,n=Math.min(0,Math.max(e-jQuery(".bwg_slideshow_filmstrip_thumbnails"+r).width(),l+e/2));else l=-bwg_params[t].bwg_current_filmstrip_pos-(jQuery(".bwg_slideshow_filmstrip_thumbnail"+r).height()+bwg_params[t].filmstrip_thumb_margin_hor)/2,n=Math.min(0,Math.max(e-jQuery(".bwg_slideshow_filmstrip_thumbnails"+r).height(),l+e/2));0<n+o&&(o=0),0<n+s&&(s=0),"left"==a?jQuery(".bwg"+_+"_filmstrip_thumbnails"+r).animate({left:n+o},{duration:500}):jQuery(".bwg"+_+"_filmstrip_thumbnails"+r).animate({top:n+s},{duration:500})}function bwg_slideshow_filmstrip_fix_dimension(e){var t,i,a,r,_,s,o=void 0!==e&&""!==e?"_"+e:"",l=void 0!==e&&""!==e?"_slideshow":"",n=void 0!==e&&""!==e&&void 0!==bwg_params[e].outerWidth_or_outerHeight?bwg_params[e].outerWidth_or_outerHeight:gallery_box_data.outerWidth_or_outerHeight,g=void 0!==e&&""!==e&&void 0!==bwg_params[e].left_or_top?bwg_params[e].left_or_top:gallery_box_data.left_or_top;i="outerWidth"==n?(t=jQuery(".bwg"+l+"_filmstrip"+o).outerWidth(!0),jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).outerWidth(!0)):(t=jQuery(".bwg"+l+"_filmstrip"+o).outerHeight(!0),jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).outerHeight(!0)),s="left"==g?(a=jQuery(".bwg"+l+"_thumb_active"+o).position().left,r="outerWidth"==n?jQuery(".bwg"+l+"_thumb_active"+o).position().left+jQuery(".bwg"+l+"_thumb_active"+o).outerWidth(!0):jQuery(".bwg"+l+"_thumb_active"+o).position().left+jQuery(".bwg"+l+"_thumb_active"+o).outerHeight(!0),_=jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().left,Math.abs(jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().left)+t):(a=jQuery(".bwg"+l+"_thumb_active"+o).position().top,r="outerWidth"==n?jQuery(".bwg"+l+"_thumb_active"+o).position().top+jQuery(".bwg"+l+"_thumb_active"+o).outerWidth(!0):jQuery(".bwg"+l+"_thumb_active"+o).position().top+jQuery(".bwg"+l+"_thumb_active"+o).outerHeight(!0),_=jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().top,Math.abs(jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().top)+t),i<t||(a<Math.abs(_)?"left"==g?jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({left:-a},{duration:500}):jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({top:-a},{duration:500}):s<r&&("left"==g?jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({left:-(r-t)},{duration:500}):jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({top:-(r-t)},{duration:500})))}function bwg_slideshow_filmstrip_fix_count(e){var t,i,a,r,_,s,o=void 0!==e&&""!==e?"_"+e:"",l=void 0!==e&&""!==e?"_slideshow":"",n=void 0!==e&&""!==e?bwg_params[e].outerWidth_or_outerHeight:gallery_box_data.outerWidth_or_outerHeight,g=void 0!==e&&""!==e?bwg_params[e].left_or_top:gallery_box_data.left_or_top;i="outerWidth"==n?(t=jQuery(".bwg"+l+"_filmstrip_fix_count"+o).outerWidth(!0),jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).outerWidth(!0)):(t=jQuery(".bwg"+l+"_filmstrip_fix_count"+o).outerHeight(!0),jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).outerHeight(!0)),s="left"==g?(a=jQuery(".bwg"+l+"_thumb_active"+o).position().left,r="outerWidth"==n?jQuery(".bwg"+l+"_thumb_active"+o).position().left+jQuery(".bwg"+l+"_thumb_active"+o).outerWidth(!0):jQuery(".bwg"+l+"_thumb_active"+o).position().left+jQuery(".bwg"+l+"_thumb_active"+o).outerHeight(!0),_=jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().left,Math.abs(jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().left)+t):(a=jQuery(".bwg"+l+"_thumb_active"+o).position().top,r="outerWidth"==n?jQuery(".bwg"+l+"_thumb_active"+o).position().top+jQuery(".bwg"+l+"_thumb_active"+o).outerWidth(!0):jQuery(".bwg"+l+"_thumb_active"+o).position().top+jQuery(".bwg"+l+"_thumb_active"+o).outerHeight(!0),_=jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().top,Math.abs(jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().top)+t),i<t||(a<Math.abs(_)?"left"==g?jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({left:-a},{duration:500}):jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({top:-a},{duration:500}):s<r&&("left"==g?jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({left:-(r-t)},{duration:500}):jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({top:-(r-t)},{duration:500})))}function bwg_resize_slideshow_filmstrip_fix_count(e){var _=e.bwg,t=e.parent_width,i=e.params,a=i.filmstrip_direction,r=i.data,s=i.filmstrip_thumb_margin_hor,o=jQuery(window).width()<=767&&5<i.slideshow_thumbnails_count,l=o?5:i.slideshow_thumbnails_count,n="#bwg_container1_"+_+" #bwg_container2_"+_+" .bwg_slideshow_filmstrip_container_"+_,g="#bwg_container1_"+_+" #bwg_container2_"+_+" .bwg_slideshow_filmstrip_fix_count_"+_,w="#bwg_container1_"+_+" #bwg_container2_"+_+" .bwg_slideshow_filmstrip_fix_count_"+_+" .bwg_slideshow_filmstrip_thumbnails_"+_,b="#bwg_container1_"+_+" #bwg_container2_"+_+" .bwg_slideshow_filmstrip_fix_count_"+_+" .bwg_slideshow_filmstrip_thumbnails_"+_+" .bwg_slideshow_filmstrip_thumbnail_"+_,u="#bwg_container1_"+_+" #bwg_container2_"+_+" .bwg_slideshow_image_container_"+_,d=jQuery(u).data("filmstrip-position"),h=(jQuery(u).data("filmstrip-size"),i.slideshow_filmstrip_rl_btn_size);if(jQuery("#bwg_container1_"+_).css({width:"100%"}),jQuery("#bwg_container1_"+_+" #bwg_container2_"+_).css({width:t}),"undefined"==typeof resize_in_progress||!1===resize_in_progress){window.resize_in_progress=!0,void 0!==m&&clearTimeout(m);var m=setTimeout(function(){resize_in_progress=!1;var e={};"bottom"==d||"top"==d?e.left=0:e.top=0,jQuery(w).css(e);var t="horizontal"==a?"table-cell":"block";jQuery(n).find(".bwg_slideshow_filmstrip_left_"+_).css({display:"none"}),jQuery(n).find(".bwg_slideshow_filmstrip_left_disabled_"+_).css({display:t}),jQuery(n).find(".bwg_slideshow_filmstrip_right_"+_).css({display:t}),jQuery(n).find(".bwg_slideshow_filmstrip_right_disabled_"+_).css({display:"none"})},500)}if(bwg_resize_instagram_post(_),bwg_change_watermark_container(_),"horizontal"==a){var c=i.image_height/i.image_width,p=t-40,y=Math.round(c*p),f=(p-s*l)/l,j=Math.round(c*f);jQuery(n).css({width:t,height:j}),jQuery(g).css({width:p,height:j}),jQuery(b).css({width:f,height:j}),jQuery.each(r,function(e,t){var i=f,a=j;if(""!=t.image_width&&""!=t.image_height){var r=Math.max(f/t.image_width,j/t.image_height);i=t.image_width*r,a=t.thumb_height*r}""!=t.thumb_width&&""!=t.thumb_height&&(i=t.thumb_width,a=t.thumb_height);i*=r=Math.max(f/i,j/a),a*=r;jQuery(".bwg_slideshow_filmstrip_fix_count_"+_+" .bwg_slideshow_filmstrip_thumbnail_"+_+" .bwg_slideshow_filmstrip_thumbnail_img_"+_).css({width:f,height:j,"margin-left":0,"margin-top":0})}),jQuery(w).css({width:f*r.length+s*r.length,height:j}),jQuery(".bwg_slideshow_image_wrap_"+_).css({width:t,height:t*i.image_height/i.image_width}),(Q={width:t,height:t*(i.image_height/i.image_width)-j})[d]=j,jQuery(".bwg_slideshow_image_container_"+_).css(Q),jQuery(".bwg_slideshow_image_"+_).css({cssText:"max-width:"+t+"px !important; max-height:"+(t*(i.image_height/i.image_width)-j)+"px !important;"}),jQuery(".bwg_slideshow_embed_"+_).css({cssText:"width:"+t+"px !important; height:"+(t*(i.image_height/i.image_width)-j)+"px !important;"}),jQuery(".bwg_embed_frame_"+_).css({"max-width":t+"px","max-height":t*(i.image_height/i.image_width)-j+"px"}),jQuery(".bwg_embed_frame_"+_).attr("data-width",t),jQuery(".bwg_embed_frame_"+_).attr("data-height",t*(i.image_height/i.image_width)-j),j<h&&(h=j),jQuery(n).find(".bwg-icon-angle-left").css({"font-size":h}),jQuery(n).find(".bwg-icon-angle-right").css({"font-size":h})}else{var Q,v=t*i.image_height/i.image_width;c=i.image_width/i.image_height,y=v-40,p=Math.round(c*y),j=(y-s*l)/l,f=Math.round(c*j);jQuery.each(r,function(e,t){var i=f,a=j;if(""!=t.image_width&&""!=t.image_height){var r=Math.max(f/t.image_width,j/t.image_height);i=t.image_width*r,a=t.thumb_height*r}""!=t.thumb_width&&""!=t.thumb_height&&(i=t.thumb_width,a=t.thumb_height);r=Math.max(f/i,j/a),i*=r,a*=r;jQuery(".bwg_slideshow_filmstrip_fix_count_"+_+" .bwg_slideshow_filmstrip_thumbnail_"+_+" .bwg_slideshow_filmstrip_thumbnail_img_"+_).css({width:f,height:j,"margin-left":0,"margin-top":0})}),jQuery(n).css({width:f,height:v}),jQuery(g).css({width:f,height:y}),jQuery(w).css({width:f,height:j*r.length+s*r.length}),jQuery(b).css({width:f,height:j}),jQuery(".bwg_slideshow_image_wrap_"+_).css({width:t,height:v}),(Q={width:t-f,height:v})[d]=f,jQuery(u).css(Q),jQuery(".bwg_slideshow_image_"+_).css({cssText:"max-width:"+(t-f)+"px !important; max-height:"+v+"px !important;"}),jQuery(".bwg_slideshow_embed_"+_).css({cssText:"width:"+(t-f)+"px !important; height:"+v+"px !important;"}),jQuery(".bwg_embed_frame_"+_).css({"max-width":t-f+"px","max-height":v+"px"}),jQuery(".bwg_embed_frame_"+_).attr("data-width",t-f),jQuery(".bwg_embed_frame_"+_).attr("data-height",v),f<h&&(h=f),jQuery(n).find(".bwg-icon-angle-up").css({"font-size":h}),jQuery(n).find(".bwg-icon-angle-down").css({"font-size":h})}o&&(jQuery(n).find(".bwg-icon-angle-left").removeAttr("style"),jQuery(n).find(".bwg-icon-angle-right").removeAttr("style"),jQuery(n).find(".bwg-icon-angle-up").removeAttr("style"),jQuery(n).find(".bwg-icon-angle-down").removeAttr("style"))}function bwg_resize_slideshow_filmstrip_fix_dimension(e){var t=e.bwg,i=e.parent_width,a=e.params,r=a.filmstrip_direction,_=a.slideshow_filmstrip_width,s=a.slideshow_filmstrip_height,o="#bwg_container1_"+t+" #bwg_container2_"+t,l=o+" .bwg_slideshow_image_wrap_"+t,n=o+" .bwg_slideshow_image_container_"+t,g=o+" .bwg_slideshow_image_"+t,w=o+" .bwg_slideshow_embed_"+t,b=l+" .bwg_slideshow_filmstrip_container_"+t,u=b+" .bwg_slideshow_filmstrip_"+t,d=i,h=d*(a.image_height/a.image_width);jQuery(l).css({width:d,height:h}),jQuery(n).css({width:d-("horizontal"==r?0:_),height:h-("horizontal"==r?s:0)}),jQuery(g).css({display:"inline-block","max-width":d-("horizontal"==r?0:_),"max-height":h-("horizontal"==r?s:0)}),jQuery(w).css({cssText:"width: "+(d-("horizontal"==r?0:_))+"px !important; height: "+(h-("horizontal"==r?s:0)-1)+"px !important;"}),bwg_resize_instagram_post(t),bwg_change_watermark_container(t),"horizontal"==r?(jQuery(b).css({width:d}),jQuery(u).css({width:d-40})):(jQuery(b).css({height:h}),jQuery(u).css({height:h-40}))}function bwg_calculate_slideshow_filmstrip_thumbnail_size(e){var t=e.bwg,i=e.params,a=i.slideshow_filmstrip_width;if(2==i.slideshow_filmstrip_type){var r="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_fix_count_"+t+" .bwg_slideshow_filmstrip_thumbnail_"+t;a=(i.left_or_top,"width"==i.width_or_height?jQuery(r).width():jQuery(r).height())}return parseFloat(a)}function bwg_move_dots(e){var t=jQuery(".bwg_slideshow_dots_active_"+e).position().left,i=jQuery(".bwg_slideshow_dots_active_"+e).position().left+jQuery(".bwg_slideshow_dots_active_"+e).outerWidth(!0),a=jQuery(".bwg_slideshow_dots_container_"+e).outerWidth(!0),r=jQuery(".bwg_slideshow_dots_thumbnails_"+e).outerWidth(!1),_=jQuery(".bwg_slideshow_dots_thumbnails_"+e).position().left,s=Math.abs(jQuery(".bwg_slideshow_dots_thumbnails_"+e).position().left)+a;r<a||(t<Math.abs(_)?jQuery(".bwg_slideshow_dots_thumbnails_"+e).animate({left:-t},{duration:500}):s<i&&jQuery(".bwg_slideshow_dots_thumbnails_"+e).animate({left:-(i-a)},{duration:500}))}function bwg_testBrowser_cssTransitions(e){return bwg_testDom("Transition",e)}function bwg_testBrowser_cssTransforms3d(e){return bwg_testDom("Perspective",e)}function bwg_testDom(e,t){for(var i=["","Webkit","Moz","ms","O","Khtml"],a=i.length;a--;)if(void 0!==document.body.style[i[a]+e])return!0;return!1}function bwg_fallback(e,t,i,a){bwg_fade(e,t,i,a)}function bwg_fallback3d(e,t,i,a){bwg_sliceV(e,t,i,a)}function bwg_none(e,t,i,a){var r=void 0!==a&&""!==a?"_"+a:"";if(jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),void 0!==a&&""!==a){var _=bwg_params[a].bwg_current_key;bwg_change_watermark_container(a),jQuery(".bwg_slideshow_filmstrip_thumbnail"+r).removeClass("bwg_slideshow_thumb_active"+r).addClass("bwg_slideshow_thumb_deactive"+r),jQuery("#bwg_filmstrip_thumbnail_"+_+r).removeClass("bwg_slideshow_thumb_deactive"+r).addClass("bwg_slideshow_thumb_active"+r),jQuery(".bwg_slideshow_dots"+r).removeClass("bwg_slideshow_dots_active"+r).addClass("bwg_slideshow_dots_deactive"+r),jQuery("#bwg_dots_"+_+r).removeClass("bwg_slideshow_dots_deactive"+r).addClass("bwg_slideshow_dots_active"+r)}else jQuery(".bwg_image_info").show(),gallery_box_data.bwg_trans_in_progress=!1,jQuery(e).html(""),bwg_change_watermark_container()}function bwg_iterator(e){var t=1;return void 0!==e&&""!==e&&void 0!==bwg_params[e]&&1==bwg_params[e].enable_slideshow_shuffle&&(t=Math.floor((bwg_params[e].data.length-1)*Math.random()+1)),t}function bwg_change_image_slideshow(e,t,i,a,r){i=bwg_params[r].data;if(jQuery("#bwg_slideshow_image_container_"+r).find("iframe").each(function(){jQuery(this)[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*"),jQuery(this)[0].contentWindow.postMessage('{ "method": "pause" }',"*"),jQuery(this)[0].contentWindow.postMessage("pause","*")}),jQuery("#image_id_"+r+"_"+i[e].id).find(".bwg_fb_video").each(function(){jQuery(this).attr("src",jQuery(this).attr("src"))}),i[t]){if(jQuery(".bwg_ctrl_btn_"+r).hasClass("bwg-icon-pause")&&bwg_play(bwg_params[r].data,r),a||(jQuery("#bwg_current_image_key_"+r).val(t),"-1"==e?e=jQuery(".bwg_slideshow_thumb_active_"+r).children("img").attr("image_key"):"-2"==e&&(e=jQuery(".bwg_slideshow_dots_active_"+r).attr("image_key"))),bwg_params[r].bwg_trans_in_progress)return void bwg_params[r].event_stack.push(e+"-"+t);var _="right";if(t<e)_="left";else if(e==t)return;jQuery(".bwg_slideshow_watermark_"+r).css({display:"none"}),jQuery(".bwg_slideshow_title_text_"+r).css({display:"none"}),jQuery(".bwg_slideshow_description_text_"+r).css({display:"none"}),"width"==bwg_params[r].width_or_height?bwg_params[r].bwg_current_filmstrip_pos=t*(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+r).width()+2+2*bwg_params[r].lightbox_filmstrip_thumb_border_width):bwg_params[r].bwg_current_filmstrip_pos=t*(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+r).height()+2+2*bwg_params[r].lightbox_filmstrip_thumb_border_width),e=t,bwg_params[r].bwg_current_key=e,jQuery("#bwg_slideshow_image_"+r).attr("image_id",i[t].id),jQuery(".bwg_slideshow_title_text_"+r).html(jQuery('<span style="display: block;" />').html(i[t].alt).text()),jQuery(".bwg_slideshow_description_text_"+r).html(jQuery('<span style="display: block;" />').html(i[t].description).text());var s=2==jQuery(".bwg_slideshow_image_spun_"+r).css("zIndex")?".bwg_slideshow_image_spun_"+r:".bwg_slideshow_image_second_spun_"+r,o=s==".bwg_slideshow_image_second_spun_"+r?".bwg_slideshow_image_spun_"+r:".bwg_slideshow_image_second_spun_"+r,l=-1<i[t].filetype.indexOf("EMBED_"),n=-1<i[t].filetype.indexOf("INSTAGRAM_POST"),g=-1<i[t].filetype.indexOf("INSTAGRAM_VIDEO"),w=jQuery(s).height(),b=jQuery(s).width(),u='<span class="bwg_slideshow_image_spun1_'+r+'" style="display: '+(l?"block":"table")+' ;width: inherit; height: inherit;"><span class="bwg_slideshow_image_spun2_'+r+'" style="display: '+(l?"block":"table-cell")+'; vertical-align: middle; text-align: center; ">';if(l){if(u+='<span style="height: '+w+"px; width: "+b+'px;" class="bwg_popup_embed bwg_popup_watermark">',g&&(u+='<span class="bwg_inst_play_btn_cont" onclick="bwg_play_instagram_video(this)"><span class="bwg_inst_play"></span></span>'),n){var d=jQuery(".bwg_embed_frame"),h=jQuery(".bwg_slideshow_image_container_"+r).width(),m=jQuery(".bwg_slideshow_image_container_"+r).height(),c=i[t].image_width,p=i[t].image_height,y=bwg_resizing_ratio(c,p,h,m);d.attr("data-width",h),d.attr("data-height",m);var f=y.width,j=y.height;f<j?f-=109:f+=109,u+=spider_display_embed(i[t].filetype,decodeURIComponent(i[t].image_url),i[t].filename,{class:"bwg_embed_frame","data-width":h,"data-height":m,"data-instagram-width":c,"data-instagram-height":p,style:"width: 100%; height: 100%; max-width: 100%; max-height: 100%; vertical-align:middle; display:inline-block; position:relative;"})}else u+=spider_display_embed(i[t].filetype,decodeURIComponent(i[t].image_url),i[t].filename,{class:"bwg_embed_frame",frameborder:"0",allowfullscreen:"allowfullscreen","data-max-width":b,"data-max-height":w,style:"width:inherit; height:inherit; vertical-align:middle; display:table-cell;"});u+="</span>"}else{if("do_nothing"!=bwg_params[r].thumb_click_action){var Q="";"open_lightbox"==bwg_params[r].thumb_click_action?Q+=' class="bwg_lightbox" data-image-id="'+i[t].id+'" data-elementor-open-lightbox="no"':"redirect_to_url"==bwg_params[r].thumb_click_action&&i[t].redirect_url&&(Q+='href="'+i[t].redirect_url+'"'+(bwg_params[r].thumb_link_target&&1==bwg_params[r].thumb_link_target?' target="_blank"':"")),u+="<a "+Q+">"}u+='<img style="max-height: '+w+"px !important; max-width: "+b+'px !important; display:inline-block;" ',u+=' class="bwg_slide bwg_slideshow_image_'+r+'" ',u+=' id="bwg_slideshow_image_'+r+'" ',u+=' src="'+bwg_params[r].upload_url+jQuery("<span style='display: block;' />").html(decodeURIComponent(i[t].image_url)).text()+'" alt="'+i[t].alt+'" image_id="'+i[t].id+'" /></a>'}u+="</span></span>",jQuery(o).html(u),bwg_params[r].preload_images&&bwg_preload_images(t,r),window["bwg_"+bwg_params[r].slideshow_effect](s,o,_,r),1==bwg_params[r].slideshow_filmstrip_type?bwg_slideshow_filmstrip_fix_dimension(r):2==bwg_params[r].slideshow_filmstrip_type?bwg_slideshow_filmstrip_fix_count(r):bwg_move_dots(r),i[t].is_embed_video?jQuery("#bwg_slideshow_play_pause_"+r).css({display:"none"}):jQuery("#bwg_slideshow_play_pause_"+r).css({display:""})}bwg_add_lightbox(),void 0!==i[t]&&"EMBED_OEMBED_INSTAGRAM_POST"==i[t].filetype&&"undefined"!=typeof instgrm&&void 0!==instgrm.Embeds&&(jQuery(".instagram-media").hide(),instgrm.Embeds.process(),jQuery(".instagram-media").css({"max-height":j+"px","min-width":f+"px !important"}),jQuery(".instagram-media").show())}function bwg_preload_images_slideshow(e,t){var i=bwg_params[t].data;count=bwg_params[t].preload_images_count/2;var a=i.length;if(a<bwg_params[t].preload_images_count&&(count=0),0!=count)for(var r=e-count;r<e+count;r++){var _=parseInt((r+a)%a),s=-1<i[_].filetype.indexOf("EMBED_");void 0!==i[_]&&(s||jQuery("<img/>").attr("src",bwg_params[t].upload_url+jQuery('<span style="display: block;" />').html(decodeURIComponent(i[_].image_url)).text()))}else for(r=0;r<i.length;r++){s=-1<i[r].filetype.indexOf("EMBED_");void 0!==i[r]&&(s||jQuery("<img/>").attr("src",bwg_params[t].upload_url+jQuery('<span style="display: block;" />').html(decodeURIComponent(i[r].image_url)).text()))}}function bwg_preload_images(e,t){void 0!==t&&""!==t?bwg_preload_images_slideshow(e,t):bwg_preload_images_lightbox(e)}function bwg_popup_resize_slidshow(e){var t=".bwg_slideshow_filmstrip_"+e;2==bwg_params[e].slideshow_filmstrip_type&&(t=".bwg_slideshow_filmstrip_fix_count_"+e);var i=jQuery("#bwg_container1_"+e).parent();i.hasClass("content-area")&&i.width(i.closest(".content-area").width()),i.hasClass("elementor-tab-content")&&i.width(i.closest(".elementor-widget-wrap").width());var a=i.width(),r=bwg_params[e].data;if(a>=bwg_params[e].image_width){jQuery(".bwg_slideshow_image_wrap_"+e).css({width:bwg_params[e].image_width}),jQuery(".bwg_slideshow_image_wrap_"+e).css({height:bwg_params[e].image_height}),jQuery(".bwg_slideshow_image_container_"+e).css({width:"horizontal"==bwg_params[e].filmstrip_direction?bwg_params[e].image_width:bwg_params[e].image_width-bwg_params[e].slideshow_filmstrip_width}),jQuery(".bwg_slideshow_image_container_"+e).css({height:"horizontal"==bwg_params[e].filmstrip_direction?bwg_params[e].image_height-bwg_params[e].slideshow_filmstrip_height:bwg_params[e].image_height}),jQuery(".bwg_slideshow_image_"+e).css({cssText:(bwg_params[e].filmstrip_direction,bwg_params[e].image_width)}),jQuery(".bwg_slideshow_embed_"+e).css({cssText:(bwg_params[e].filmstrip_direction,bwg_params[e].image_width)}),bwg_resize_instagram_post(e),bwg_change_watermark_container(e);var _="horizontal"==bwg_params[e].filmstrip_direction?"width: "+bwg_params[e].image_width:"height: "+bwg_params[e].image_height,s="horizontal"==bwg_params[e].filmstrip_direction?"width: "+(bwg_params[e].image_width-40):"height: "+(bwg_params[e].image_height-40);if(jQuery(".bwg_slideshow_filmstrip_container_"+e).css({cssText:_}),jQuery(t).css({cssText:s}),jQuery(".bwg_slideshow_dots_container_"+e).css({width:bwg_params[e].image_width}),jQuery("#bwg_slideshow_play_pause-ico_"+e).css({fontSize:bwg_params[e].slideshow_play_pause_btn_size}),"image"==bwg_params[e].watermark_type&&jQuery(".bwg_slideshow_watermark_image_"+e).css({maxWidth:bwg_params[e].watermark_width,maxHeight:bwg_params[e].watermark_height}),"text"==bwg_params[e].watermark_type&&jQuery(".bwg_slideshow_watermark_text_"+e+", .bwg_slideshow_watermark_text_"+e+" :hover").css({fontSize:bwg_params[e].watermark_font_size}),jQuery(".bwg_slideshow_title_text_"+e).css({fontSize:2*bwg_params[e].slideshow_title_font_size}),jQuery(".bwg_slideshow_description_text_"+e).css({fontSize:2*bwg_params[e].slideshow_description_font_size}),2==bwg_params[e].slideshow_filmstrip_type){var o=bwg_params[e].filmstrip_direction,l="#bwg_container1_"+e+" #bwg_container2_"+e;jQuery(l).removeAttr("style");var n=l+" .bwg_slideshow_filmstrip_container_"+e,g=bwg_params[e].slideshow_filmstrip_rl_btn_size,w=jQuery(".bwg_slideshow_filmstrip_fix_count_"+e).width();"horizontal"==o&&(w=jQuery(".bwg_slideshow_filmstrip_fix_count_"+e).height());var b="horizontal"==o?"table-cell":"block";jQuery(n).find(".bwg_slideshow_filmstrip_left_"+e).css({display:"none"}),jQuery(n).find(".bwg_slideshow_filmstrip_left_disabled_"+e).css({display:b}),jQuery(n).find(".bwg_slideshow_filmstrip_right_"+e).css({display:b}),jQuery(n).find(".bwg_slideshow_filmstrip_right_disabled_"+e).css({display:"none"}),w<g?(g=w,jQuery(n).find(".bwg-icon-angle-left").css({"font-size":g}),jQuery(n).find(".bwg-icon-angle-right").css({"font-size":g}),jQuery(n).find(".bwg-icon-angle-up").css({"font-size":g}),jQuery(n).find(".bwg-icon-angle-down").css({"font-size":g})):(jQuery(n).find(".bwg-icon-angle-left").removeAttr("style"),jQuery(n).find(".bwg-icon-angle-right").removeAttr("style"),jQuery(n).find(".bwg-icon-angle-up").removeAttr("style"),jQuery(n).find(".bwg-icon-angle-down").removeAttr("style"));var u=l+" .bwg_slideshow_filmstrip_thumbnails_"+e;jQuery(u).removeAttr("style"),jQuery(u+" .bwg_slideshow_filmstrip_thumbnail_"+e).each(function(e,t){jQuery(t).attr("style",jQuery(t).attr("data-style")),jQuery(t).find("img").attr("style",jQuery(t).attr("data-style"))});var d="#bwg_container1_"+e+" #bwg_container2_"+e+" .bwg_slideshow_image_container_"+e,h=(jQuery(d).data("filmstrip-position"),jQuery(d).data("filmstrip-size"));jQuery(d).css({filmstrip_position:h});var m="bwg_slideshow_filmstrip_thumbnail_"+e;window.bwg_slideshow_filmstrip_thumb[m].next_prev_index&&(window.bwg_slideshow_filmstrip_thumb[m].next_prev_index=0)}}else 1==bwg_params[e].slideshow_filmstrip_type&&bwg_resize_slideshow_filmstrip_fix_dimension({bwg:e,params:bwg_params[e],parent_width:a}),2==bwg_params[e].slideshow_filmstrip_type&&bwg_resize_slideshow_filmstrip_fix_count({bwg:e,params:bwg_params[e],parent_width:a}),jQuery(".bwg_slideshow_dots_container_"+e).css({width:a}),jQuery("#bwg_slideshow_play_pause-ico_"+e).css({fontSize:a*(bwg_params[e].slideshow_play_pause_btn_size/bwg_params[e].image_width)}),jQuery(".bwg_slideshow_watermark_image_"+e).css({maxWidth:a*(bwg_params[e].watermark_width/bwg_params[e].image_width),maxHeight:a*(bwg_params[e].watermark_height/bwg_params[e].image_width)}),jQuery(".bwg_slideshow_watermark_text_"+e+", .bwg_slideshow_watermark_text_"+e+":hover").css({fontSize:a*(bwg_params[e].watermark_font_size/bwg_params[e].image_width)}),jQuery(".bwg_slideshow_title_text_"+e).css({fontSize:2*a*bwg_params[e].slideshow_title_font_size/bwg_params[e].image_width}),jQuery(".bwg_slideshow_description_text_"+e).css({fontSize:2*a*bwg_params[e].slideshow_description_font_size/bwg_params[e].image_width});r[parseInt(jQuery("#bwg_current_image_key_"+e).val())].is_embed_video?jQuery("#bwg_slideshow_play_pause_"+e).css({display:"none"}):jQuery("#bwg_slideshow_play_pause_"+e).css({display:""})}function bwg_popup_resize(e){void 0!==e&&""!==e?bwg_popup_resize_slidshow(e):bwg_popup_resize_lightbox()}function bwg_change_image(e,t,i,a,r){void 0!==r&&""!==r?bwg_change_image_slideshow(e,t,i,a,r):bwg_change_image_lightbox(e,t,i=gallery_box_data.data,a)}function bwg_resize_instagram_post(e){var t=!1;if(void 0!==e&&""!==e){if(jQuery(".inner_instagram_iframe_bwg_embed_frame_"+e).length){t=!0;var i=jQuery("#instagram-embed-"+e),a=jQuery(".bwg_slideshow_embed_"+e),r=jQuery(".bwg_embed_frame_"+e),_=void 0!==a.width()?a.width():jQuery(".bwg_slideshow_embed_"+e).width(),s=void 0!==a.height()?a.height():jQuery(".bwg_slideshow_embed_"+e).height(),o=r.data("instagram-width"),l=r.data("instagram-height");bwg_change_watermark_container(e)}}else if(jQuery(".inner_instagram_iframe_bwg_embed_frame").length){t=!0;i=jQuery(".instagram-media"),r=jQuery(".bwg_embed_frame"),_=jQuery(".bwg_image_container").width(),s=jQuery(".bwg_image_container").height(),o=r.data("instagram-width"),l=r.data("instagram-height");bwg_change_watermark_container()}if(!0===t){var n=bwg_resizing_ratio(o,l,_,s);r.attr("data-width",_),r.attr("data-height",s);var g=n.width;g<n.height?g-=109:g+=109,r.css({width:"100%",height:"100%","max-width":_,"max-height":s}),i.css({"min-width":g+"px !important","max-height":s+"px"})}}function bwg_play(t,i){if(void 0!==i&&""!==i)t=bwg_params[i].data;void 0!==i&&""!==i?(window.clearInterval(window["bwg_playInterval"+i]),window["bwg_playInterval"+i]=setInterval(function(){var e=1;1==bwg_params[i].enable_slideshow_shuffle&&(e=Math.floor((t.length-1)*Math.random()+1)),bwg_change_image(parseInt(jQuery("#bwg_current_image_key_"+i).val()),(parseInt(jQuery("#bwg_current_image_key_"+i).val())+e)%t.length,t,"",i)},1e3*bwg_params[i].slideshow_interval)):(window.clearInterval(gallery_box_data.bwg_playInterval),gallery_box_data.bwg_playInterval=setInterval(function(){jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_play_pause").length&&jQuery(".bwg_play_pause").hasClass("bwg-icon-play")||(void 0===t||void 0!==t[parseInt(jQuery("#bwg_current_image_key").val())+1]?bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),parseInt(jQuery("#bwg_current_image_key").val())+1):1==gallery_box_data.enable_loop&&bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),0))},1e3*gallery_box_data.slideshow_interval))}function bwg_image_browser(e){if(jQuery("#bwg_embed_frame_16x9_"+e).width(jQuery("#bwg_embed_frame_16x9_"+e).parents(".image_browser_image_buttons_"+e).width()),jQuery("#bwg_embed_frame_16x9_"+e).height(.5625*jQuery("#bwg_embed_frame_16x9_"+e).width()),jQuery("#bwg_embed_frame_instapost_"+e).width(jQuery("#bwg_embed_frame_16x9_"+e).parents(".image_browser_image_buttons_"+e).width()),jQuery(".image_browser_images_conteiner_"+e).find(".fluid-width-video-wrapper").length){var t=jQuery(".image_browser_images_conteiner_"+e).find(".fluid-width-video-wrapper").contents();jQuery(".image_browser_images_conteiner_"+e).find(".fluid-width-video-wrapper").replaceWith(t)}jQuery(".bwg_embed_frame_instapost_"+e).height((jQuery(".bwg_embed_frame_instapost_"+e).width()-16)*jQuery(".bwg_embed_frame_instapost_"+e).attr("data-height")/jQuery(".bwg_embed_frame_instapost_"+e).attr("data-width")+96);var i=jQuery(".image_browser_images_"+e).width();i<=108?jQuery(".paging-input_"+e).css("display","none"):(i<=200?(jQuery(".paging-input_"+e).css("margin","0% 0% 0% 0%"),jQuery(".paging-input_"+e).css("display","inline")):i<=580?(jQuery(".paging-input_"+e).css("display","inline"),jQuery(".tablenav-pages_"+e+" a").css("font-size","13px"),jQuery(".paging-input_"+e).css("margin","0% 7% 0% 7%")):(jQuery(".tablenav-pages_"+e+" a").css("font-size","15px"),jQuery(".paging-input_"+e).css("margin","0% 14% 0% 14%"),jQuery(".paging-input_"+e).css("display","inline")),jQuery(".tablenav-pages_"+e+" .next-page").css("margin","0% 0% 0% 0%"),jQuery(".tablenav-pages_"+e+" .prev-page").css("margin","0% 0% 0% 0%"))}function bwg_disable_right_click(e){e.bind("contextmenu",function(){return!1}),e.css("webkitTouchCallout","none")}function bwg_resizing_ratio(e,t,i,a){var r=[i/e,a/t];return{width:e*(r=Math.min(r[0],r[1])),height:t*r}}function bwg_slideshow_filmstrip_next(e){var t=e.bwg,i=e.params,a=e.slideshow_filmstrip_class_name,r=bwg_calculate_slideshow_filmstrip_thumbnail_size({bwg:t,params:i}),_="bwg_slideshow_filmstrip_thumbnail_"+t,s="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_left_"+t,o="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_left_disabled_"+t,l="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_right_"+t,n="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_right_disabled_"+t,g="horizontal"==i.filmstrip_direction?"table-cell":"block";"left"==i.left_or_top?"width"==i.width_or_height?(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left>=-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).width()-jQuery(a).width())&&(jQuery(s).css({display:g}),jQuery(o).css({display:"none"}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left<-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).width()-jQuery(a).width()-(parseInt(i.filmstrip_thumb_margin_hor)+r))?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({left:-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).width()-jQuery(a).width())},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({left:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left-(parseInt(i.filmstrip_thumb_margin_hor)+r)},500,"linear")),window.setTimeout(function(){parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left)==-parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).width()-jQuery(a).width())?(jQuery(l).css({display:"none"}),jQuery(n).css({display:g})):(jQuery(l).css({display:g}),jQuery(n).css({display:"none"}))},510)):(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left>=-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).height()-jQuery(a).height())&&(jQuery(s).css({display:g}),jQuery(o).css({display:"none"}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left<-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).height()-jQuery(a).height()-(parseInt(i.filmstrip_thumb_margin_hor)+r))?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({left:-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).height()-jQuery(a).height())},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({left:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left-(parseInt(i.filmstrip_thumb_margin_hor)+r)},500,"linear")),window.setTimeout(function(){parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left)==-parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).height()-jQuery(a).height())?(jQuery(l).css({display:"none"}),jQuery(n).css({display:g})):(jQuery(l).css({display:g}),jQuery(n).css({display:"none"}))},510)):"width"==i.width_or_height?(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top>=-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).width()-jQuery(a).width())&&(jQuery(s).css({display:g}),jQuery(o).css({display:"none"}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top<-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).width()-jQuery(a).width()-parseInt(i.filmstrip_thumb_margin_hor)+r)?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({top:-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).width()-jQuery(a).width())},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({top:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top-parseInt(i.filmstrip_thumb_margin_hor)+r},500,"linear")),window.setTimeout(function(){parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top)==-parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).width()-jQuery(a).width())?(jQuery(l).css({display:"none"}),jQuery(n).css({display:g})):(jQuery(l).css({display:g}),jQuery(n).css({display:"none"}))},510)):(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top>=-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).height()-jQuery(a).height())&&(jQuery(s).css({display:g}),jQuery(o).css({display:"none"}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top<-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).height()-jQuery(a).height()-(parseInt(i.filmstrip_thumb_margin_hor)+r))?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({top:-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).height()-jQuery(a).height())},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({top:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top-(parseInt(i.filmstrip_thumb_margin_hor)+r)},500,"linear")),window.setTimeout(function(){parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top)==-parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).height()-jQuery(a).height())?(jQuery(l).css({display:"none"}),jQuery(n).css({display:g})):(jQuery(l).css({display:g}),jQuery(n).css({display:"none"}))},510)),bwg_slideshow_filmstrip_thumb[_].next_prev_index=bwg_slideshow_filmstrip_thumb[_].next_prev_index+1}function bwg_slideshow_filmstrip_prev(e){var t=e.bwg,i=e.params,a=bwg_calculate_slideshow_filmstrip_thumbnail_size({bwg:t,params:i}),r="bwg_slideshow_filmstrip_thumbnail_"+t,_="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_left_"+t,s="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_left_disabled_"+t,o="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_right_"+t,l="#bwg_container1_"+t+" #bwg_container2_"+t+" .bwg_slideshow_filmstrip_right_disabled_"+t,n="horizontal"==i.filmstrip_direction?"table-cell":"block";"left"==i.left_or_top?(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left<0&&(jQuery(o).css({display:n}),jQuery(l).css({display:"none"}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left>-(i.filmstrip_thumb_margin_hor+a)?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({left:0},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({left:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left+parseInt(i.filmstrip_thumb_margin_hor)+a},500,"linear")),window.setTimeout(function(){0==parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().left)?(jQuery(_).css({display:"none"}),jQuery(s).css({display:n})):(jQuery(_).css({display:n}),jQuery(s).css({display:"none"}))},510)):(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top<0&&(jQuery(o).css({display:n}),jQuery(l).css({display:"none"}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top>-(i.filmstrip_thumb_margin_hor+a)?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({top:0},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).animate({top:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top+parseInt(i.filmstrip_thumb_margin_hor)+a},500,"linear")),window.setTimeout(function(){0==parseInt(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+t).position().top)?(jQuery(_).css({display:"none"}),jQuery(s).css({display:n})):(jQuery(_).css({display:n}),jQuery(s).css({display:"none"}))},510)),bwg_slideshow_filmstrip_thumb[r].next_prev_index=bwg_slideshow_filmstrip_thumb[r].next_prev_index-1}jQuery(function(){function i(e){bwg_slideshow_blur(e),bwg_carousel_blur(e),0<jQuery(".bwg_play_pause").length&&window.clearInterval(gallery_box_data.bwg_playInterval)}function a(e){e&&bwg_main_ready(e),bwg_slideshow_focus(),bwg_carousel_focus(),jQuery(".bwg_play_pause").length&&jQuery(".bwg_play_pause").hasClass("bwg-icon-play")&&!jQuery(".bwg_comment_container").hasClass("bwg_open")&&bwg_play(gallery_box_data.data)}var r=!1;jQuery(".bwg_container").each(function(){if(0<jQuery(this).find(".wd_error").length&&(r=!0),!r){var e=jQuery(this);if(e[0].offsetHeight)var t=0;else t=1;setInterval(function(){e[0].offsetHeight?1==t&&(t=0,a(e)):0==t&&i(!(t=1))},200)}}),r||jQuery(window).focus(function(){a()}).blur(function(){i(!0)})}),jQuery(window).on("resize",function(){setTimeout(function(){var e=!1;jQuery(".bwg_container").each(function(){0<jQuery(this).find(".wd_error").length&&(e=!0)}),bwg_tags_button_section_visibility(),e||(jQuery(".bwg-thumbnails, .bwg-masonry-thumbnails, .bwg-album-thumbnails").each(function(){bwg_all_thumnails_loaded(this)}),bwg_slideshow_resize(),bwg_image_browser_resize(),bwg_carousel_resize(),bwg_blog_style_resize(),jQuery(".bwg-mosaic-thumbnails").each(function(){bwg_thumbnail_mosaic(this)})),bwg_resize_search_line()},0)}),jQuery(window).on("load",function(){var e=!1;jQuery(".bwg_container").each(function(){0<jQuery(this).find(".wd_error").length&&(e=!0)}),e||(bwg_blog_style_onload(),jQuery(".bwg-mosaic-thumbnails").each(function(){bwg_thumbnail_mosaic(this)}))}),jQuery(".bwg-masonry-thumb-span img, .bwg-mosaic-thumb-span img").on("error",function(){jQuery(this).height(100),jQuery(this).width(100)});
|
library/composer.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"require": {
|
3 |
+
"nelexa/zip": "^3.3"
|
4 |
+
}
|
5 |
+
}
|
library/composer.lock
ADDED
@@ -0,0 +1,243 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_readme": [
|
3 |
+
"This file locks the dependencies of your project to a known state",
|
4 |
+
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
5 |
+
"This file is @generated automatically"
|
6 |
+
],
|
7 |
+
"content-hash": "dc4537a601225d89f3349e44fc30dfdb",
|
8 |
+
"packages": [
|
9 |
+
{
|
10 |
+
"name": "nelexa/zip",
|
11 |
+
"version": "3.3.3",
|
12 |
+
"source": {
|
13 |
+
"type": "git",
|
14 |
+
"url": "https://github.com/Ne-Lexa/php-zip.git",
|
15 |
+
"reference": "501b52f6fc393a599b44ff348a42740e1eaac7c6"
|
16 |
+
},
|
17 |
+
"dist": {
|
18 |
+
"type": "zip",
|
19 |
+
"url": "https://api.github.com/repos/Ne-Lexa/php-zip/zipball/501b52f6fc393a599b44ff348a42740e1eaac7c6",
|
20 |
+
"reference": "501b52f6fc393a599b44ff348a42740e1eaac7c6",
|
21 |
+
"shasum": ""
|
22 |
+
},
|
23 |
+
"require": {
|
24 |
+
"ext-zlib": "*",
|
25 |
+
"paragonie/random_compat": "*",
|
26 |
+
"php": "^5.5.9 || ^7.0",
|
27 |
+
"psr/http-message": "^1.0",
|
28 |
+
"symfony/finder": "^3.0|^4.0|^5.0"
|
29 |
+
},
|
30 |
+
"require-dev": {
|
31 |
+
"ext-bz2": "*",
|
32 |
+
"ext-fileinfo": "*",
|
33 |
+
"ext-openssl": "*",
|
34 |
+
"ext-xml": "*",
|
35 |
+
"guzzlehttp/psr7": "^1.6",
|
36 |
+
"phpunit/phpunit": "^4.8|^5.7",
|
37 |
+
"symfony/var-dumper": "^3.0|^4.0|^5.0"
|
38 |
+
},
|
39 |
+
"suggest": {
|
40 |
+
"ext-bz2": "Needed to support BZIP2 compression",
|
41 |
+
"ext-fileinfo": "Needed to get mime-type file",
|
42 |
+
"ext-mcrypt": "Needed to support encrypt zip entries or use ext-openssl",
|
43 |
+
"ext-openssl": "Needed to support encrypt zip entries or use ext-mcrypt"
|
44 |
+
},
|
45 |
+
"type": "library",
|
46 |
+
"autoload": {
|
47 |
+
"psr-4": {
|
48 |
+
"PhpZip\\": "src/"
|
49 |
+
}
|
50 |
+
},
|
51 |
+
"notification-url": "https://packagist.org/downloads/",
|
52 |
+
"license": [
|
53 |
+
"MIT"
|
54 |
+
],
|
55 |
+
"authors": [
|
56 |
+
{
|
57 |
+
"name": "Ne-Lexa",
|
58 |
+
"email": "alexey@nelexa.ru",
|
59 |
+
"role": "Developer"
|
60 |
+
}
|
61 |
+
],
|
62 |
+
"description": "PhpZip is a php-library for extended work with ZIP-archives. Open, create, update, delete, extract and get info tool. Supports appending to existing ZIP files, WinZip AES encryption, Traditional PKWARE Encryption, ZipAlign tool, BZIP2 compression, external file attributes and ZIP64 extensions. Alternative ZipArchive. It does not require php-zip extension.",
|
63 |
+
"homepage": "https://github.com/Ne-Lexa/php-zip",
|
64 |
+
"keywords": [
|
65 |
+
"archive",
|
66 |
+
"extract",
|
67 |
+
"unzip",
|
68 |
+
"winzip",
|
69 |
+
"zip",
|
70 |
+
"zipalign",
|
71 |
+
"ziparchive"
|
72 |
+
],
|
73 |
+
"time": "2020-07-11T21:01:42+00:00"
|
74 |
+
},
|
75 |
+
{
|
76 |
+
"name": "paragonie/random_compat",
|
77 |
+
"version": "v9.99.99",
|
78 |
+
"source": {
|
79 |
+
"type": "git",
|
80 |
+
"url": "https://github.com/paragonie/random_compat.git",
|
81 |
+
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95"
|
82 |
+
},
|
83 |
+
"dist": {
|
84 |
+
"type": "zip",
|
85 |
+
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
|
86 |
+
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
|
87 |
+
"shasum": ""
|
88 |
+
},
|
89 |
+
"require": {
|
90 |
+
"php": "^7"
|
91 |
+
},
|
92 |
+
"require-dev": {
|
93 |
+
"phpunit/phpunit": "4.*|5.*",
|
94 |
+
"vimeo/psalm": "^1"
|
95 |
+
},
|
96 |
+
"suggest": {
|
97 |
+
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
|
98 |
+
},
|
99 |
+
"type": "library",
|
100 |
+
"notification-url": "https://packagist.org/downloads/",
|
101 |
+
"license": [
|
102 |
+
"MIT"
|
103 |
+
],
|
104 |
+
"authors": [
|
105 |
+
{
|
106 |
+
"name": "Paragon Initiative Enterprises",
|
107 |
+
"email": "security@paragonie.com",
|
108 |
+
"homepage": "https://paragonie.com"
|
109 |
+
}
|
110 |
+
],
|
111 |
+
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
|
112 |
+
"keywords": [
|
113 |
+
"csprng",
|
114 |
+
"polyfill",
|
115 |
+
"pseudorandom",
|
116 |
+
"random"
|
117 |
+
],
|
118 |
+
"time": "2018-07-02T15:55:56+00:00"
|
119 |
+
},
|
120 |
+
{
|
121 |
+
"name": "psr/http-message",
|
122 |
+
"version": "1.0.1",
|
123 |
+
"source": {
|
124 |
+
"type": "git",
|
125 |
+
"url": "https://github.com/php-fig/http-message.git",
|
126 |
+
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
|
127 |
+
},
|
128 |
+
"dist": {
|
129 |
+
"type": "zip",
|
130 |
+
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
|
131 |
+
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
|
132 |
+
"shasum": ""
|
133 |
+
},
|
134 |
+
"require": {
|
135 |
+
"php": ">=5.3.0"
|
136 |
+
},
|
137 |
+
"type": "library",
|
138 |
+
"extra": {
|
139 |
+
"branch-alias": {
|
140 |
+
"dev-master": "1.0.x-dev"
|
141 |
+
}
|
142 |
+
},
|
143 |
+
"autoload": {
|
144 |
+
"psr-4": {
|
145 |
+
"Psr\\Http\\Message\\": "src/"
|
146 |
+
}
|
147 |
+
},
|
148 |
+
"notification-url": "https://packagist.org/downloads/",
|
149 |
+
"license": [
|
150 |
+
"MIT"
|
151 |
+
],
|
152 |
+
"authors": [
|
153 |
+
{
|
154 |
+
"name": "PHP-FIG",
|
155 |
+
"homepage": "http://www.php-fig.org/"
|
156 |
+
}
|
157 |
+
],
|
158 |
+
"description": "Common interface for HTTP messages",
|
159 |
+
"homepage": "https://github.com/php-fig/http-message",
|
160 |
+
"keywords": [
|
161 |
+
"http",
|
162 |
+
"http-message",
|
163 |
+
"psr",
|
164 |
+
"psr-7",
|
165 |
+
"request",
|
166 |
+
"response"
|
167 |
+
],
|
168 |
+
"time": "2016-08-06T14:39:51+00:00"
|
169 |
+
},
|
170 |
+
{
|
171 |
+
"name": "symfony/finder",
|
172 |
+
"version": "v5.1.5",
|
173 |
+
"source": {
|
174 |
+
"type": "git",
|
175 |
+
"url": "https://github.com/symfony/finder.git",
|
176 |
+
"reference": "2b765f0cf6612b3636e738c0689b29aa63088d5d"
|
177 |
+
},
|
178 |
+
"dist": {
|
179 |
+
"type": "zip",
|
180 |
+
"url": "https://api.github.com/repos/symfony/finder/zipball/2b765f0cf6612b3636e738c0689b29aa63088d5d",
|
181 |
+
"reference": "2b765f0cf6612b3636e738c0689b29aa63088d5d",
|
182 |
+
"shasum": ""
|
183 |
+
},
|
184 |
+
"require": {
|
185 |
+
"php": ">=7.2.5"
|
186 |
+
},
|
187 |
+
"type": "library",
|
188 |
+
"extra": {
|
189 |
+
"branch-alias": {
|
190 |
+
"dev-master": "5.1-dev"
|
191 |
+
}
|
192 |
+
},
|
193 |
+
"autoload": {
|
194 |
+
"psr-4": {
|
195 |
+
"Symfony\\Component\\Finder\\": ""
|
196 |
+
},
|
197 |
+
"exclude-from-classmap": [
|
198 |
+
"/Tests/"
|
199 |
+
]
|
200 |
+
},
|
201 |
+
"notification-url": "https://packagist.org/downloads/",
|
202 |
+
"license": [
|
203 |
+
"MIT"
|
204 |
+
],
|
205 |
+
"authors": [
|
206 |
+
{
|
207 |
+
"name": "Fabien Potencier",
|
208 |
+
"email": "fabien@symfony.com"
|
209 |
+
},
|
210 |
+
{
|
211 |
+
"name": "Symfony Community",
|
212 |
+
"homepage": "https://symfony.com/contributors"
|
213 |
+
}
|
214 |
+
],
|
215 |
+
"description": "Symfony Finder Component",
|
216 |
+
"homepage": "https://symfony.com",
|
217 |
+
"funding": [
|
218 |
+
{
|
219 |
+
"url": "https://symfony.com/sponsor",
|
220 |
+
"type": "custom"
|
221 |
+
},
|
222 |
+
{
|
223 |
+
"url": "https://github.com/fabpot",
|
224 |
+
"type": "github"
|
225 |
+
},
|
226 |
+
{
|
227 |
+
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
228 |
+
"type": "tidelift"
|
229 |
+
}
|
230 |
+
],
|
231 |
+
"time": "2020-08-17T10:01:29+00:00"
|
232 |
+
}
|
233 |
+
],
|
234 |
+
"packages-dev": [],
|
235 |
+
"aliases": [],
|
236 |
+
"minimum-stability": "stable",
|
237 |
+
"stability-flags": [],
|
238 |
+
"prefer-stable": false,
|
239 |
+
"prefer-lowest": false,
|
240 |
+
"platform": [],
|
241 |
+
"platform-dev": [],
|
242 |
+
"plugin-api-version": "1.1.0"
|
243 |
+
}
|
library/vendor/autoload.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload.php @generated by Composer
|
4 |
+
|
5 |
+
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
+
|
7 |
+
return ComposerAutoloaderInit4b35fc66a698aefa074a656d3a7816ae::getLoader();
|
library/vendor/composer/ClassLoader.php
ADDED
@@ -0,0 +1,445 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace Composer\Autoload;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
17 |
+
*
|
18 |
+
* $loader = new \Composer\Autoload\ClassLoader();
|
19 |
+
*
|
20 |
+
* // register classes with namespaces
|
21 |
+
* $loader->add('Symfony\Component', __DIR__.'/component');
|
22 |
+
* $loader->add('Symfony', __DIR__.'/framework');
|
23 |
+
*
|
24 |
+
* // activate the autoloader
|
25 |
+
* $loader->register();
|
26 |
+
*
|
27 |
+
* // to enable searching the include path (eg. for PEAR packages)
|
28 |
+
* $loader->setUseIncludePath(true);
|
29 |
+
*
|
30 |
+
* In this example, if you try to use a class in the Symfony\Component
|
31 |
+
* namespace or one of its children (Symfony\Component\Console for instance),
|
32 |
+
* the autoloader will first look for the class under the component/
|
33 |
+
* directory, and it will then fallback to the framework/ directory if not
|
34 |
+
* found before giving up.
|
35 |
+
*
|
36 |
+
* This class is loosely based on the Symfony UniversalClassLoader.
|
37 |
+
*
|
38 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
+
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
+
* @see http://www.php-fig.org/psr/psr-0/
|
41 |
+
* @see http://www.php-fig.org/psr/psr-4/
|
42 |
+
*/
|
43 |
+
class ClassLoader
|
44 |
+
{
|
45 |
+
// PSR-4
|
46 |
+
private $prefixLengthsPsr4 = array();
|
47 |
+
private $prefixDirsPsr4 = array();
|
48 |
+
private $fallbackDirsPsr4 = array();
|
49 |
+
|
50 |
+
// PSR-0
|
51 |
+
private $prefixesPsr0 = array();
|
52 |
+
private $fallbackDirsPsr0 = array();
|
53 |
+
|
54 |
+
private $useIncludePath = false;
|
55 |
+
private $classMap = array();
|
56 |
+
private $classMapAuthoritative = false;
|
57 |
+
private $missingClasses = array();
|
58 |
+
private $apcuPrefix;
|
59 |
+
|
60 |
+
public function getPrefixes()
|
61 |
+
{
|
62 |
+
if (!empty($this->prefixesPsr0)) {
|
63 |
+
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
64 |
+
}
|
65 |
+
|
66 |
+
return array();
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getPrefixesPsr4()
|
70 |
+
{
|
71 |
+
return $this->prefixDirsPsr4;
|
72 |
+
}
|
73 |
+
|
74 |
+
public function getFallbackDirs()
|
75 |
+
{
|
76 |
+
return $this->fallbackDirsPsr0;
|
77 |
+
}
|
78 |
+
|
79 |
+
public function getFallbackDirsPsr4()
|
80 |
+
{
|
81 |
+
return $this->fallbackDirsPsr4;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function getClassMap()
|
85 |
+
{
|
86 |
+
return $this->classMap;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @param array $classMap Class to filename map
|
91 |
+
*/
|
92 |
+
public function addClassMap(array $classMap)
|
93 |
+
{
|
94 |
+
if ($this->classMap) {
|
95 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
96 |
+
} else {
|
97 |
+
$this->classMap = $classMap;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Registers a set of PSR-0 directories for a given prefix, either
|
103 |
+
* appending or prepending to the ones previously set for this prefix.
|
104 |
+
*
|
105 |
+
* @param string $prefix The prefix
|
106 |
+
* @param array|string $paths The PSR-0 root directories
|
107 |
+
* @param bool $prepend Whether to prepend the directories
|
108 |
+
*/
|
109 |
+
public function add($prefix, $paths, $prepend = false)
|
110 |
+
{
|
111 |
+
if (!$prefix) {
|
112 |
+
if ($prepend) {
|
113 |
+
$this->fallbackDirsPsr0 = array_merge(
|
114 |
+
(array) $paths,
|
115 |
+
$this->fallbackDirsPsr0
|
116 |
+
);
|
117 |
+
} else {
|
118 |
+
$this->fallbackDirsPsr0 = array_merge(
|
119 |
+
$this->fallbackDirsPsr0,
|
120 |
+
(array) $paths
|
121 |
+
);
|
122 |
+
}
|
123 |
+
|
124 |
+
return;
|
125 |
+
}
|
126 |
+
|
127 |
+
$first = $prefix[0];
|
128 |
+
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
129 |
+
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
130 |
+
|
131 |
+
return;
|
132 |
+
}
|
133 |
+
if ($prepend) {
|
134 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
135 |
+
(array) $paths,
|
136 |
+
$this->prefixesPsr0[$first][$prefix]
|
137 |
+
);
|
138 |
+
} else {
|
139 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
140 |
+
$this->prefixesPsr0[$first][$prefix],
|
141 |
+
(array) $paths
|
142 |
+
);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Registers a set of PSR-4 directories for a given namespace, either
|
148 |
+
* appending or prepending to the ones previously set for this namespace.
|
149 |
+
*
|
150 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
151 |
+
* @param array|string $paths The PSR-4 base directories
|
152 |
+
* @param bool $prepend Whether to prepend the directories
|
153 |
+
*
|
154 |
+
* @throws \InvalidArgumentException
|
155 |
+
*/
|
156 |
+
public function addPsr4($prefix, $paths, $prepend = false)
|
157 |
+
{
|
158 |
+
if (!$prefix) {
|
159 |
+
// Register directories for the root namespace.
|
160 |
+
if ($prepend) {
|
161 |
+
$this->fallbackDirsPsr4 = array_merge(
|
162 |
+
(array) $paths,
|
163 |
+
$this->fallbackDirsPsr4
|
164 |
+
);
|
165 |
+
} else {
|
166 |
+
$this->fallbackDirsPsr4 = array_merge(
|
167 |
+
$this->fallbackDirsPsr4,
|
168 |
+
(array) $paths
|
169 |
+
);
|
170 |
+
}
|
171 |
+
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
172 |
+
// Register directories for a new namespace.
|
173 |
+
$length = strlen($prefix);
|
174 |
+
if ('\\' !== $prefix[$length - 1]) {
|
175 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
176 |
+
}
|
177 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
178 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
179 |
+
} elseif ($prepend) {
|
180 |
+
// Prepend directories for an already registered namespace.
|
181 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
182 |
+
(array) $paths,
|
183 |
+
$this->prefixDirsPsr4[$prefix]
|
184 |
+
);
|
185 |
+
} else {
|
186 |
+
// Append directories for an already registered namespace.
|
187 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
188 |
+
$this->prefixDirsPsr4[$prefix],
|
189 |
+
(array) $paths
|
190 |
+
);
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Registers a set of PSR-0 directories for a given prefix,
|
196 |
+
* replacing any others previously set for this prefix.
|
197 |
+
*
|
198 |
+
* @param string $prefix The prefix
|
199 |
+
* @param array|string $paths The PSR-0 base directories
|
200 |
+
*/
|
201 |
+
public function set($prefix, $paths)
|
202 |
+
{
|
203 |
+
if (!$prefix) {
|
204 |
+
$this->fallbackDirsPsr0 = (array) $paths;
|
205 |
+
} else {
|
206 |
+
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Registers a set of PSR-4 directories for a given namespace,
|
212 |
+
* replacing any others previously set for this namespace.
|
213 |
+
*
|
214 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
215 |
+
* @param array|string $paths The PSR-4 base directories
|
216 |
+
*
|
217 |
+
* @throws \InvalidArgumentException
|
218 |
+
*/
|
219 |
+
public function setPsr4($prefix, $paths)
|
220 |
+
{
|
221 |
+
if (!$prefix) {
|
222 |
+
$this->fallbackDirsPsr4 = (array) $paths;
|
223 |
+
} else {
|
224 |
+
$length = strlen($prefix);
|
225 |
+
if ('\\' !== $prefix[$length - 1]) {
|
226 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
227 |
+
}
|
228 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
229 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Turns on searching the include path for class files.
|
235 |
+
*
|
236 |
+
* @param bool $useIncludePath
|
237 |
+
*/
|
238 |
+
public function setUseIncludePath($useIncludePath)
|
239 |
+
{
|
240 |
+
$this->useIncludePath = $useIncludePath;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Can be used to check if the autoloader uses the include path to check
|
245 |
+
* for classes.
|
246 |
+
*
|
247 |
+
* @return bool
|
248 |
+
*/
|
249 |
+
public function getUseIncludePath()
|
250 |
+
{
|
251 |
+
return $this->useIncludePath;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Turns off searching the prefix and fallback directories for classes
|
256 |
+
* that have not been registered with the class map.
|
257 |
+
*
|
258 |
+
* @param bool $classMapAuthoritative
|
259 |
+
*/
|
260 |
+
public function setClassMapAuthoritative($classMapAuthoritative)
|
261 |
+
{
|
262 |
+
$this->classMapAuthoritative = $classMapAuthoritative;
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Should class lookup fail if not found in the current class map?
|
267 |
+
*
|
268 |
+
* @return bool
|
269 |
+
*/
|
270 |
+
public function isClassMapAuthoritative()
|
271 |
+
{
|
272 |
+
return $this->classMapAuthoritative;
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
277 |
+
*
|
278 |
+
* @param string|null $apcuPrefix
|
279 |
+
*/
|
280 |
+
public function setApcuPrefix($apcuPrefix)
|
281 |
+
{
|
282 |
+
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* The APCu prefix in use, or null if APCu caching is not enabled.
|
287 |
+
*
|
288 |
+
* @return string|null
|
289 |
+
*/
|
290 |
+
public function getApcuPrefix()
|
291 |
+
{
|
292 |
+
return $this->apcuPrefix;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Registers this instance as an autoloader.
|
297 |
+
*
|
298 |
+
* @param bool $prepend Whether to prepend the autoloader or not
|
299 |
+
*/
|
300 |
+
public function register($prepend = false)
|
301 |
+
{
|
302 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Unregisters this instance as an autoloader.
|
307 |
+
*/
|
308 |
+
public function unregister()
|
309 |
+
{
|
310 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Loads the given class or interface.
|
315 |
+
*
|
316 |
+
* @param string $class The name of the class
|
317 |
+
* @return bool|null True if loaded, null otherwise
|
318 |
+
*/
|
319 |
+
public function loadClass($class)
|
320 |
+
{
|
321 |
+
if ($file = $this->findFile($class)) {
|
322 |
+
includeFile($file);
|
323 |
+
|
324 |
+
return true;
|
325 |
+
}
|
326 |
+
}
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Finds the path to the file where the class is defined.
|
330 |
+
*
|
331 |
+
* @param string $class The name of the class
|
332 |
+
*
|
333 |
+
* @return string|false The path if found, false otherwise
|
334 |
+
*/
|
335 |
+
public function findFile($class)
|
336 |
+
{
|
337 |
+
// class map lookup
|
338 |
+
if (isset($this->classMap[$class])) {
|
339 |
+
return $this->classMap[$class];
|
340 |
+
}
|
341 |
+
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
342 |
+
return false;
|
343 |
+
}
|
344 |
+
if (null !== $this->apcuPrefix) {
|
345 |
+
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
346 |
+
if ($hit) {
|
347 |
+
return $file;
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
$file = $this->findFileWithExtension($class, '.php');
|
352 |
+
|
353 |
+
// Search for Hack files if we are running on HHVM
|
354 |
+
if (false === $file && defined('HHVM_VERSION')) {
|
355 |
+
$file = $this->findFileWithExtension($class, '.hh');
|
356 |
+
}
|
357 |
+
|
358 |
+
if (null !== $this->apcuPrefix) {
|
359 |
+
apcu_add($this->apcuPrefix.$class, $file);
|
360 |
+
}
|
361 |
+
|
362 |
+
if (false === $file) {
|
363 |
+
// Remember that this class does not exist.
|
364 |
+
$this->missingClasses[$class] = true;
|
365 |
+
}
|
366 |
+
|
367 |
+
return $file;
|
368 |
+
}
|
369 |
+
|
370 |
+
private function findFileWithExtension($class, $ext)
|
371 |
+
{
|
372 |
+
// PSR-4 lookup
|
373 |
+
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
374 |
+
|
375 |
+
$first = $class[0];
|
376 |
+
if (isset($this->prefixLengthsPsr4[$first])) {
|
377 |
+
$subPath = $class;
|
378 |
+
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
379 |
+
$subPath = substr($subPath, 0, $lastPos);
|
380 |
+
$search = $subPath . '\\';
|
381 |
+
if (isset($this->prefixDirsPsr4[$search])) {
|
382 |
+
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
383 |
+
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
384 |
+
if (file_exists($file = $dir . $pathEnd)) {
|
385 |
+
return $file;
|
386 |
+
}
|
387 |
+
}
|
388 |
+
}
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
// PSR-4 fallback dirs
|
393 |
+
foreach ($this->fallbackDirsPsr4 as $dir) {
|
394 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
395 |
+
return $file;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
// PSR-0 lookup
|
400 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
401 |
+
// namespaced class name
|
402 |
+
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
403 |
+
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
404 |
+
} else {
|
405 |
+
// PEAR-like class name
|
406 |
+
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
407 |
+
}
|
408 |
+
|
409 |
+
if (isset($this->prefixesPsr0[$first])) {
|
410 |
+
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
411 |
+
if (0 === strpos($class, $prefix)) {
|
412 |
+
foreach ($dirs as $dir) {
|
413 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
414 |
+
return $file;
|
415 |
+
}
|
416 |
+
}
|
417 |
+
}
|
418 |
+
}
|
419 |
+
}
|
420 |
+
|
421 |
+
// PSR-0 fallback dirs
|
422 |
+
foreach ($this->fallbackDirsPsr0 as $dir) {
|
423 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
424 |
+
return $file;
|
425 |
+
}
|
426 |
+
}
|
427 |
+
|
428 |
+
// PSR-0 include paths.
|
429 |
+
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
430 |
+
return $file;
|
431 |
+
}
|
432 |
+
|
433 |
+
return false;
|
434 |
+
}
|
435 |
+
}
|
436 |
+
|
437 |
+
/**
|
438 |
+
* Scope isolated include.
|
439 |
+
*
|
440 |
+
* Prevents access to $this/self from included files.
|
441 |
+
*/
|
442 |
+
function includeFile($file)
|
443 |
+
{
|
444 |
+
include $file;
|
445 |
+
}
|
library/vendor/composer/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
Copyright (c) Nils Adermann, Jordi Boggiano
|
3 |
+
|
4 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5 |
+
of this software and associated documentation files (the "Software"), to deal
|
6 |
+
in the Software without restriction, including without limitation the rights
|
7 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
9 |
+
to do so, subject to the following conditions:
|
10 |
+
|
11 |
+
The above copyright notice and this permission notice shall be included in all
|
12 |
+
copies or substantial portions of the Software.
|
13 |
+
|
14 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20 |
+
THE SOFTWARE.
|
21 |
+
|
library/vendor/composer/autoload_classmap.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_classmap.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
library/vendor/composer/autoload_namespaces.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_namespaces.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
library/vendor/composer/autoload_psr4.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_psr4.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
|
10 |
+
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
|
11 |
+
'PhpZip\\' => array($vendorDir . '/nelexa/zip/src'),
|
12 |
+
);
|
library/vendor/composer/autoload_real.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_real.php @generated by Composer
|
4 |
+
|
5 |
+
class ComposerAutoloaderInit4b35fc66a698aefa074a656d3a7816ae
|
6 |
+
{
|
7 |
+
private static $loader;
|
8 |
+
|
9 |
+
public static function loadClassLoader($class)
|
10 |
+
{
|
11 |
+
if ('Composer\Autoload\ClassLoader' === $class) {
|
12 |
+
require __DIR__ . '/ClassLoader.php';
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @return \Composer\Autoload\ClassLoader
|
18 |
+
*/
|
19 |
+
public static function getLoader()
|
20 |
+
{
|
21 |
+
if (null !== self::$loader) {
|
22 |
+
return self::$loader;
|
23 |
+
}
|
24 |
+
|
25 |
+
spl_autoload_register(array('ComposerAutoloaderInit4b35fc66a698aefa074a656d3a7816ae', 'loadClassLoader'), true, true);
|
26 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit4b35fc66a698aefa074a656d3a7816ae', 'loadClassLoader'));
|
28 |
+
|
29 |
+
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
+
if ($useStaticLoader) {
|
31 |
+
require_once __DIR__ . '/autoload_static.php';
|
32 |
+
|
33 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit4b35fc66a698aefa074a656d3a7816ae::getInitializer($loader));
|
34 |
+
} else {
|
35 |
+
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
+
foreach ($map as $namespace => $path) {
|
37 |
+
$loader->set($namespace, $path);
|
38 |
+
}
|
39 |
+
|
40 |
+
$map = require __DIR__ . '/autoload_psr4.php';
|
41 |
+
foreach ($map as $namespace => $path) {
|
42 |
+
$loader->setPsr4($namespace, $path);
|
43 |
+
}
|
44 |
+
|
45 |
+
$classMap = require __DIR__ . '/autoload_classmap.php';
|
46 |
+
if ($classMap) {
|
47 |
+
$loader->addClassMap($classMap);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
$loader->register(true);
|
52 |
+
|
53 |
+
return $loader;
|
54 |
+
}
|
55 |
+
}
|
library/vendor/composer/autoload_static.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_static.php @generated by Composer
|
4 |
+
|
5 |
+
namespace Composer\Autoload;
|
6 |
+
|
7 |
+
class ComposerStaticInit4b35fc66a698aefa074a656d3a7816ae
|
8 |
+
{
|
9 |
+
public static $prefixLengthsPsr4 = array (
|
10 |
+
'S' =>
|
11 |
+
array (
|
12 |
+
'Symfony\\Component\\Finder\\' => 25,
|
13 |
+
),
|
14 |
+
'P' =>
|
15 |
+
array (
|
16 |
+
'Psr\\Http\\Message\\' => 17,
|
17 |
+
'PhpZip\\' => 7,
|
18 |
+
),
|
19 |
+
);
|
20 |
+
|
21 |
+
public static $prefixDirsPsr4 = array (
|
22 |
+
'Symfony\\Component\\Finder\\' =>
|
23 |
+
array (
|
24 |
+
0 => __DIR__ . '/..' . '/symfony/finder',
|
25 |
+
),
|
26 |
+
'Psr\\Http\\Message\\' =>
|
27 |
+
array (
|
28 |
+
0 => __DIR__ . '/..' . '/psr/http-message/src',
|
29 |
+
),
|
30 |
+
'PhpZip\\' =>
|
31 |
+
array (
|
32 |
+
0 => __DIR__ . '/..' . '/nelexa/zip/src',
|
33 |
+
),
|
34 |
+
);
|
35 |
+
|
36 |
+
public static function getInitializer(ClassLoader $loader)
|
37 |
+
{
|
38 |
+
return \Closure::bind(function () use ($loader) {
|
39 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit4b35fc66a698aefa074a656d3a7816ae::$prefixLengthsPsr4;
|
40 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit4b35fc66a698aefa074a656d3a7816ae::$prefixDirsPsr4;
|
41 |
+
|
42 |
+
}, null, ClassLoader::class);
|
43 |
+
}
|
44 |
+
}
|
library/vendor/composer/installed.json
ADDED
@@ -0,0 +1,234 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"name": "nelexa/zip",
|
4 |
+
"version": "3.3.3",
|
5 |
+
"version_normalized": "3.3.3.0",
|
6 |
+
"source": {
|
7 |
+
"type": "git",
|
8 |
+
"url": "https://github.com/Ne-Lexa/php-zip.git",
|
9 |
+
"reference": "501b52f6fc393a599b44ff348a42740e1eaac7c6"
|
10 |
+
},
|
11 |
+
"dist": {
|
12 |
+
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/Ne-Lexa/php-zip/zipball/501b52f6fc393a599b44ff348a42740e1eaac7c6",
|
14 |
+
"reference": "501b52f6fc393a599b44ff348a42740e1eaac7c6",
|
15 |
+
"shasum": ""
|
16 |
+
},
|
17 |
+
"require": {
|
18 |
+
"ext-zlib": "*",
|
19 |
+
"paragonie/random_compat": "*",
|
20 |
+
"php": "^5.5.9 || ^7.0",
|
21 |
+
"psr/http-message": "^1.0",
|
22 |
+
"symfony/finder": "^3.0|^4.0|^5.0"
|
23 |
+
},
|
24 |
+
"require-dev": {
|
25 |
+
"ext-bz2": "*",
|
26 |
+
"ext-fileinfo": "*",
|
27 |
+
"ext-openssl": "*",
|
28 |
+
"ext-xml": "*",
|
29 |
+
"guzzlehttp/psr7": "^1.6",
|
30 |
+
"phpunit/phpunit": "^4.8|^5.7",
|
31 |
+
"symfony/var-dumper": "^3.0|^4.0|^5.0"
|
32 |
+
},
|
33 |
+
"suggest": {
|
34 |
+
"ext-bz2": "Needed to support BZIP2 compression",
|
35 |
+
"ext-fileinfo": "Needed to get mime-type file",
|
36 |
+
"ext-mcrypt": "Needed to support encrypt zip entries or use ext-openssl",
|
37 |
+
"ext-openssl": "Needed to support encrypt zip entries or use ext-mcrypt"
|
38 |
+
},
|
39 |
+
"time": "2020-07-11T21:01:42+00:00",
|
40 |
+
"type": "library",
|
41 |
+
"installation-source": "dist",
|
42 |
+
"autoload": {
|
43 |
+
"psr-4": {
|
44 |
+
"PhpZip\\": "src/"
|
45 |
+
}
|
46 |
+
},
|
47 |
+
"notification-url": "https://packagist.org/downloads/",
|
48 |
+
"license": [
|
49 |
+
"MIT"
|
50 |
+
],
|
51 |
+
"authors": [
|
52 |
+
{
|
53 |
+
"name": "Ne-Lexa",
|
54 |
+
"email": "alexey@nelexa.ru",
|
55 |
+
"role": "Developer"
|
56 |
+
}
|
57 |
+
],
|
58 |
+
"description": "PhpZip is a php-library for extended work with ZIP-archives. Open, create, update, delete, extract and get info tool. Supports appending to existing ZIP files, WinZip AES encryption, Traditional PKWARE Encryption, ZipAlign tool, BZIP2 compression, external file attributes and ZIP64 extensions. Alternative ZipArchive. It does not require php-zip extension.",
|
59 |
+
"homepage": "https://github.com/Ne-Lexa/php-zip",
|
60 |
+
"keywords": [
|
61 |
+
"archive",
|
62 |
+
"extract",
|
63 |
+
"unzip",
|
64 |
+
"winzip",
|
65 |
+
"zip",
|
66 |
+
"zipalign",
|
67 |
+
"ziparchive"
|
68 |
+
]
|
69 |
+
},
|
70 |
+
{
|
71 |
+
"name": "paragonie/random_compat",
|
72 |
+
"version": "v9.99.99",
|
73 |
+
"version_normalized": "9.99.99.0",
|
74 |
+
"source": {
|
75 |
+
"type": "git",
|
76 |
+
"url": "https://github.com/paragonie/random_compat.git",
|
77 |
+
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95"
|
78 |
+
},
|
79 |
+
"dist": {
|
80 |
+
"type": "zip",
|
81 |
+
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
|
82 |
+
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
|
83 |
+
"shasum": ""
|
84 |
+
},
|
85 |
+
"require": {
|
86 |
+
"php": "^7"
|
87 |
+
},
|
88 |
+
"require-dev": {
|
89 |
+
"phpunit/phpunit": "4.*|5.*",
|
90 |
+
"vimeo/psalm": "^1"
|
91 |
+
},
|
92 |
+
"suggest": {
|
93 |
+
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
|
94 |
+
},
|
95 |
+
"time": "2018-07-02T15:55:56+00:00",
|
96 |
+
"type": "library",
|
97 |
+
"installation-source": "dist",
|
98 |
+
"notification-url": "https://packagist.org/downloads/",
|
99 |
+
"license": [
|
100 |
+
"MIT"
|
101 |
+
],
|
102 |
+
"authors": [
|
103 |
+
{
|
104 |
+
"name": "Paragon Initiative Enterprises",
|
105 |
+
"email": "security@paragonie.com",
|
106 |
+
"homepage": "https://paragonie.com"
|
107 |
+
}
|
108 |
+
],
|
109 |
+
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
|
110 |
+
"keywords": [
|
111 |
+
"csprng",
|
112 |
+
"polyfill",
|
113 |
+
"pseudorandom",
|
114 |
+
"random"
|
115 |
+
]
|
116 |
+
},
|
117 |
+
{
|
118 |
+
"name": "psr/http-message",
|
119 |
+
"version": "1.0.1",
|
120 |
+
"version_normalized": "1.0.1.0",
|
121 |
+
"source": {
|
122 |
+
"type": "git",
|
123 |
+
"url": "https://github.com/php-fig/http-message.git",
|
124 |
+
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
|
125 |
+
},
|
126 |
+
"dist": {
|
127 |
+
"type": "zip",
|
128 |
+
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
|
129 |
+
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
|
130 |
+
"shasum": ""
|
131 |
+
},
|
132 |
+
"require": {
|
133 |
+
"php": ">=5.3.0"
|
134 |
+
},
|
135 |
+
"time": "2016-08-06T14:39:51+00:00",
|
136 |
+
"type": "library",
|
137 |
+
"extra": {
|
138 |
+
"branch-alias": {
|
139 |
+
"dev-master": "1.0.x-dev"
|
140 |
+
}
|
141 |
+
},
|
142 |
+
"installation-source": "dist",
|
143 |
+
"autoload": {
|
144 |
+
"psr-4": {
|
145 |
+
"Psr\\Http\\Message\\": "src/"
|
146 |
+
}
|
147 |
+
},
|
148 |
+
"notification-url": "https://packagist.org/downloads/",
|
149 |
+
"license": [
|
150 |
+
"MIT"
|
151 |
+
],
|
152 |
+
"authors": [
|
153 |
+
{
|
154 |
+
"name": "PHP-FIG",
|
155 |
+
"homepage": "http://www.php-fig.org/"
|
156 |
+
}
|
157 |
+
],
|
158 |
+
"description": "Common interface for HTTP messages",
|
159 |
+
"homepage": "https://github.com/php-fig/http-message",
|
160 |
+
"keywords": [
|
161 |
+
"http",
|
162 |
+
"http-message",
|
163 |
+
"psr",
|
164 |
+
"psr-7",
|
165 |
+
"request",
|
166 |
+
"response"
|
167 |
+
]
|
168 |
+
},
|
169 |
+
{
|
170 |
+
"name": "symfony/finder",
|
171 |
+
"version": "v5.1.5",
|
172 |
+
"version_normalized": "5.1.5.0",
|
173 |
+
"source": {
|
174 |
+
"type": "git",
|
175 |
+
"url": "https://github.com/symfony/finder.git",
|
176 |
+
"reference": "2b765f0cf6612b3636e738c0689b29aa63088d5d"
|
177 |
+
},
|
178 |
+
"dist": {
|
179 |
+
"type": "zip",
|
180 |
+
"url": "https://api.github.com/repos/symfony/finder/zipball/2b765f0cf6612b3636e738c0689b29aa63088d5d",
|
181 |
+
"reference": "2b765f0cf6612b3636e738c0689b29aa63088d5d",
|
182 |
+
"shasum": ""
|
183 |
+
},
|
184 |
+
"require": {
|
185 |
+
"php": ">=7.2.5"
|
186 |
+
},
|
187 |
+
"time": "2020-08-17T10:01:29+00:00",
|
188 |
+
"type": "library",
|
189 |
+
"extra": {
|
190 |
+
"branch-alias": {
|
191 |
+
"dev-master": "5.1-dev"
|
192 |
+
}
|
193 |
+
},
|
194 |
+
"installation-source": "dist",
|
195 |
+
"autoload": {
|
196 |
+
"psr-4": {
|
197 |
+
"Symfony\\Component\\Finder\\": ""
|
198 |
+
},
|
199 |
+
"exclude-from-classmap": [
|
200 |
+
"/Tests/"
|
201 |
+
]
|
202 |
+
},
|
203 |
+
"notification-url": "https://packagist.org/downloads/",
|
204 |
+
"license": [
|
205 |
+
"MIT"
|
206 |
+
],
|
207 |
+
"authors": [
|
208 |
+
{
|
209 |
+
"name": "Fabien Potencier",
|
210 |
+
"email": "fabien@symfony.com"
|
211 |
+
},
|
212 |
+
{
|
213 |
+
"name": "Symfony Community",
|
214 |
+
"homepage": "https://symfony.com/contributors"
|
215 |
+
}
|
216 |
+
],
|
217 |
+
"description": "Symfony Finder Component",
|
218 |
+
"homepage": "https://symfony.com",
|
219 |
+
"funding": [
|
220 |
+
{
|
221 |
+
"url": "https://symfony.com/sponsor",
|
222 |
+
"type": "custom"
|
223 |
+
},
|
224 |
+
{
|
225 |
+
"url": "https://github.com/fabpot",
|
226 |
+
"type": "github"
|
227 |
+
},
|
228 |
+
{
|
229 |
+
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
230 |
+
"type": "tidelift"
|
231 |
+
}
|
232 |
+
]
|
233 |
+
}
|
234 |
+
]
|
library/vendor/nelexa/zip/.phpstorm.meta.php
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PHPSTORM_META {
|
4 |
+
|
5 |
+
registerArgumentsSet(
|
6 |
+
"bool",
|
7 |
+
true,
|
8 |
+
false
|
9 |
+
);
|
10 |
+
|
11 |
+
registerArgumentsSet(
|
12 |
+
"compression_methods",
|
13 |
+
\PhpZip\Constants\ZipCompressionMethod::STORED,
|
14 |
+
\PhpZip\Constants\ZipCompressionMethod::DEFLATED,
|
15 |
+
\PhpZip\Constants\ZipCompressionMethod::BZIP2
|
16 |
+
);
|
17 |
+
expectedArguments(\PhpZip\ZipFile::addFile(), 2, argumentsSet("compression_methods"));
|
18 |
+
expectedArguments(\PhpZip\ZipFile::addFromStream(), 2, argumentsSet("compression_methods"));
|
19 |
+
expectedArguments(\PhpZip\ZipFile::addFromString(), 2, argumentsSet("compression_methods"));
|
20 |
+
expectedArguments(\PhpZip\ZipFile::addDir(), 2, argumentsSet("compression_methods"));
|
21 |
+
expectedArguments(\PhpZip\ZipFile::addDirRecursive(), 2, argumentsSet("compression_methods"));
|
22 |
+
expectedArguments(\PhpZip\ZipFile::addFilesFromIterator(), 2, argumentsSet("compression_methods"));
|
23 |
+
expectedArguments(\PhpZip\ZipFile::addFilesFromIterator(), 2, argumentsSet("compression_methods"));
|
24 |
+
expectedArguments(\PhpZip\ZipFile::addFilesFromGlob(), 3, argumentsSet("compression_methods"));
|
25 |
+
expectedArguments(\PhpZip\ZipFile::addFilesFromGlobRecursive(), 3, argumentsSet("compression_methods"));
|
26 |
+
expectedArguments(\PhpZip\ZipFile::addFilesFromRegex(), 3, argumentsSet("compression_methods"));
|
27 |
+
expectedArguments(\PhpZip\ZipFile::addFilesFromRegexRecursive(), 3, argumentsSet("compression_methods"));
|
28 |
+
expectedArguments(\PhpZip\ZipFile::setCompressionMethodEntry(), 1, argumentsSet("compression_methods"));
|
29 |
+
expectedArguments(\PhpZip\Model\ZipEntry::setCompressionMethod(), 0, argumentsSet("compression_methods"));
|
30 |
+
expectedArguments(\PhpZip\Model\ZipEntry::setMethod(), 0, argumentsSet("compression_methods"));
|
31 |
+
|
32 |
+
registerArgumentsSet(
|
33 |
+
'compression_levels',
|
34 |
+
\PhpZip\Constants\ZipCompressionLevel::MAXIMUM,
|
35 |
+
\PhpZip\Constants\ZipCompressionLevel::NORMAL,
|
36 |
+
\PhpZip\Constants\ZipCompressionLevel::FAST,
|
37 |
+
\PhpZip\Constants\ZipCompressionLevel::SUPER_FAST
|
38 |
+
);
|
39 |
+
expectedArguments(\PhpZip\ZipFile::setCompressionLevel(), 0, argumentsSet("compression_levels"));
|
40 |
+
expectedArguments(\PhpZip\ZipFile::setCompressionLevelEntry(), 1, argumentsSet("compression_levels"));
|
41 |
+
expectedArguments(\PhpZip\Model\ZipEntry::setCompressionLevel(), 0, argumentsSet("compression_levels"));
|
42 |
+
|
43 |
+
registerArgumentsSet(
|
44 |
+
'encryption_methods',
|
45 |
+
\PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_256,
|
46 |
+
\PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_192,
|
47 |
+
\PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_128,
|
48 |
+
\PhpZip\Constants\ZipEncryptionMethod::PKWARE
|
49 |
+
);
|
50 |
+
expectedArguments(\PhpZip\ZipFile::setPassword(), 1, argumentsSet("encryption_methods"));
|
51 |
+
expectedArguments(\PhpZip\ZipFile::setPasswordEntry(), 2, argumentsSet("encryption_methods"));
|
52 |
+
expectedArguments(\PhpZip\Model\ZipEntry::setEncryptionMethod(), 0, argumentsSet("encryption_methods"));
|
53 |
+
expectedArguments(\PhpZip\Model\ZipEntry::setPassword(), 1, argumentsSet("encryption_methods"));
|
54 |
+
|
55 |
+
registerArgumentsSet(
|
56 |
+
'zip_mime_types',
|
57 |
+
null,
|
58 |
+
'application/zip',
|
59 |
+
'application/vnd.android.package-archive',
|
60 |
+
'application/java-archive'
|
61 |
+
);
|
62 |
+
expectedArguments(\PhpZip\ZipFile::outputAsAttachment(), 1, argumentsSet("zip_mime_types"));
|
63 |
+
expectedArguments(\PhpZip\ZipFile::outputAsAttachment(), 2, argumentsSet("bool"));
|
64 |
+
|
65 |
+
expectedArguments(\PhpZip\ZipFile::outputAsResponse(), 2, argumentsSet("zip_mime_types"));
|
66 |
+
expectedArguments(\PhpZip\ZipFile::outputAsResponse(), 3, argumentsSet("bool"));
|
67 |
+
|
68 |
+
registerArgumentsSet(
|
69 |
+
'dos_charset',
|
70 |
+
\PhpZip\Constants\DosCodePage::CP_LATIN_US,
|
71 |
+
\PhpZip\Constants\DosCodePage::CP_GREEK,
|
72 |
+
\PhpZip\Constants\DosCodePage::CP_BALT_RIM,
|
73 |
+
\PhpZip\Constants\DosCodePage::CP_LATIN1,
|
74 |
+
\PhpZip\Constants\DosCodePage::CP_LATIN2,
|
75 |
+
\PhpZip\Constants\DosCodePage::CP_CYRILLIC,
|
76 |
+
\PhpZip\Constants\DosCodePage::CP_TURKISH,
|
77 |
+
\PhpZip\Constants\DosCodePage::CP_PORTUGUESE,
|
78 |
+
\PhpZip\Constants\DosCodePage::CP_ICELANDIC,
|
79 |
+
\PhpZip\Constants\DosCodePage::CP_HEBREW,
|
80 |
+
\PhpZip\Constants\DosCodePage::CP_CANADA,
|
81 |
+
\PhpZip\Constants\DosCodePage::CP_ARABIC,
|
82 |
+
\PhpZip\Constants\DosCodePage::CP_NORDIC,
|
83 |
+
\PhpZip\Constants\DosCodePage::CP_CYRILLIC_RUSSIAN,
|
84 |
+
\PhpZip\Constants\DosCodePage::CP_GREEK2,
|
85 |
+
\PhpZip\Constants\DosCodePage::CP_THAI
|
86 |
+
);
|
87 |
+
expectedArguments(\PhpZip\Model\ZipEntry::setCharset(), 0, argumentsSet('dos_charset'));
|
88 |
+
expectedArguments(\PhpZip\Constants\DosCodePage::toUTF8(), 1, argumentsSet('dos_charset'));
|
89 |
+
expectedArguments(\PhpZip\Constants\DosCodePage::fromUTF8(), 1, argumentsSet('dos_charset'));
|
90 |
+
|
91 |
+
registerArgumentsSet(
|
92 |
+
"zip_os",
|
93 |
+
\PhpZip\Constants\ZipPlatform::OS_UNIX,
|
94 |
+
\PhpZip\Constants\ZipPlatform::OS_DOS,
|
95 |
+
\PhpZip\Constants\ZipPlatform::OS_MAC_OSX
|
96 |
+
);
|
97 |
+
expectedArguments(\PhpZip\Model\ZipEntry::setCreatedOS(), 0, argumentsSet('zip_os'));
|
98 |
+
expectedArguments(\PhpZip\Model\ZipEntry::setExtractedOS(), 0, argumentsSet('zip_os'));
|
99 |
+
expectedArguments(\PhpZip\Model\ZipEntry::setPlatform(), 0, argumentsSet('zip_os'));
|
100 |
+
|
101 |
+
registerArgumentsSet(
|
102 |
+
"zip_gpbf",
|
103 |
+
\PhpZip\Constants\GeneralPurposeBitFlag::ENCRYPTION |
|
104 |
+
\PhpZip\Constants\GeneralPurposeBitFlag::DATA_DESCRIPTOR |
|
105 |
+
\PhpZip\Constants\GeneralPurposeBitFlag::COMPRESSION_FLAG1 |
|
106 |
+
\PhpZip\Constants\GeneralPurposeBitFlag::COMPRESSION_FLAG2 |
|
107 |
+
\PhpZip\Constants\GeneralPurposeBitFlag::UTF8
|
108 |
+
);
|
109 |
+
expectedArguments(\PhpZip\Model\ZipEntry::setGeneralPurposeBitFlags(), 0, argumentsSet('zip_gpbf'));
|
110 |
+
|
111 |
+
registerArgumentsSet(
|
112 |
+
"winzip_aes_vendor_version",
|
113 |
+
\PhpZip\Model\Extra\Fields\WinZipAesExtraField::VERSION_AE1,
|
114 |
+
\PhpZip\Model\Extra\Fields\WinZipAesExtraField::VERSION_AE2
|
115 |
+
);
|
116 |
+
registerArgumentsSet(
|
117 |
+
"winzip_aes_key_strength",
|
118 |
+
\PhpZip\Model\Extra\Fields\WinZipAesExtraField::KEY_STRENGTH_256BIT,
|
119 |
+
\PhpZip\Model\Extra\Fields\WinZipAesExtraField::KEY_STRENGTH_128BIT,
|
120 |
+
\PhpZip\Model\Extra\Fields\WinZipAesExtraField::KEY_STRENGTH_192BIT
|
121 |
+
);
|
122 |
+
expectedArguments(\PhpZip\Model\Extra\Fields\WinZipAesExtraField::__construct(), 0, argumentsSet('winzip_aes_vendor_version'));
|
123 |
+
expectedArguments(\PhpZip\Model\Extra\Fields\WinZipAesExtraField::__construct(), 1, argumentsSet('winzip_aes_key_strength'));
|
124 |
+
expectedArguments(\PhpZip\Model\Extra\Fields\WinZipAesExtraField::__construct(), 2, argumentsSet('compression_methods'));
|
125 |
+
expectedArguments(\PhpZip\Model\Extra\Fields\WinZipAesExtraField::setVendorVersion(), 0, argumentsSet('winzip_aes_vendor_version'));
|
126 |
+
expectedArguments(\PhpZip\Model\Extra\Fields\WinZipAesExtraField::setKeyStrength(), 0, argumentsSet('winzip_aes_key_strength'));
|
127 |
+
expectedArguments(\PhpZip\Model\Extra\Fields\WinZipAesExtraField::setCompressionMethod(), 0, argumentsSet('compression_methods'));
|
128 |
+
}
|
library/vendor/nelexa/zip/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2016-2020 Ne-Lexa
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
library/vendor/nelexa/zip/README.RU.md
ADDED
@@ -0,0 +1,816 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
`PhpZip`
|
2 |
+
========
|
3 |
+
`PhpZip` - php библиотека для продвинутой работы с ZIP-архивами.
|
4 |
+
|
5 |
+
[![Build Status](https://travis-ci.org/Ne-Lexa/php-zip.svg?branch=master)](https://travis-ci.org/Ne-Lexa/php-zip)
|
6 |
+
[![Code Coverage](https://scrutinizer-ci.com/g/Ne-Lexa/php-zip/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/Ne-Lexa/php-zip/?branch=master)
|
7 |
+
[![Latest Stable Version](https://poser.pugx.org/nelexa/zip/v/stable)](https://packagist.org/packages/nelexa/zip)
|
8 |
+
[![Total Downloads](https://poser.pugx.org/nelexa/zip/downloads)](https://packagist.org/packages/nelexa/zip)
|
9 |
+
[![Minimum PHP Version](http://img.shields.io/badge/php-%3E%3D%205.5-8892BF.svg)](https://php.net/)
|
10 |
+
[![License](https://poser.pugx.org/nelexa/zip/license)](https://packagist.org/packages/nelexa/zip)
|
11 |
+
|
12 |
+
[English Documentation](README.md)
|
13 |
+
|
14 |
+
Содержание
|
15 |
+
----------
|
16 |
+
- [Функционал](#Features)
|
17 |
+
- [Требования](#Requirements)
|
18 |
+
- [Установка](#Installation)
|
19 |
+
- [Примеры](#Examples)
|
20 |
+
- [Глоссарий](#Glossary)
|
21 |
+
- [Документация](#Documentation)
|
22 |
+
+ [Обзор методов класса `\PhpZip\ZipFile`](#Documentation-Overview)
|
23 |
+
+ [Создание/Открытие ZIP-архива](#Documentation-Open-Zip-Archive)
|
24 |
+
+ [Чтение записей из архива](#Documentation-Open-Zip-Entries)
|
25 |
+
+ [Перебор записей/Итератор](#Documentation-Zip-Iterate)
|
26 |
+
+ [Получение информации о записях](#Documentation-Zip-Info)
|
27 |
+
+ [Добавление записей в архив](#Documentation-Add-Zip-Entries)
|
28 |
+
+ [Удаление записей из архива](#Documentation-Remove-Zip-Entries)
|
29 |
+
+ [Работа с записями и с архивом](#Documentation-Entries)
|
30 |
+
+ [Работа с паролями](#Documentation-Password)
|
31 |
+
+ [zipalign - выравнивание архива для оптимизации Android пакетов (APK)](#Documentation-ZipAlign-Usage)
|
32 |
+
+ [Отмена изменений](#Documentation-Unchanged)
|
33 |
+
+ [Сохранение файла или вывод в браузер](#Documentation-Save-Or-Output-Entries)
|
34 |
+
+ [Закрытие архива](#Documentation-Close-Zip-Archive)
|
35 |
+
- [Запуск тестов](#Running-Tests)
|
36 |
+
- [История изменений](#Changelog)
|
37 |
+
- [Обновление версий](#Upgrade)
|
38 |
+
+ [Обновление с версии 2 до версии 3.0](#Upgrade-v2-to-v3)
|
39 |
+
|
40 |
+
### <a name="Features"></a> Функционал
|
41 |
+
- Открытие и разархивирование ZIP-архивов.
|
42 |
+
- Создание ZIP-архивов.
|
43 |
+
- Модификация ZIP-архивов.
|
44 |
+
- Чистый php (не требуется расширение `php-zip` и класс `\ZipArchive`).
|
45 |
+
- Поддерживается сохранение архива в файл, вывод архива в браузер или вывод в виде строки, без сохранения в файл.
|
46 |
+
- Поддерживаются комментарии архива и комментарии отдельных записей.
|
47 |
+
- Получение подробной информации о каждой записи в архиве.
|
48 |
+
- Поддерживаются только следующие методы сжатия:
|
49 |
+
+ Без сжатия (Stored).
|
50 |
+
+ Deflate сжатие.
|
51 |
+
+ BZIP2 сжатие при наличии расширения `php-bz2`.
|
52 |
+
- Поддержка `ZIP64` (размер файла более 4 GB или количество записей в архиве более 65535).
|
53 |
+
- Встроенная поддержка выравнивания архива для оптимизации Android пакетов (APK) [`zipalign`](https://developer.android.com/studio/command-line/zipalign.html).
|
54 |
+
- Работа с паролями для PHP 5.5
|
55 |
+
> **Внимание!**
|
56 |
+
>
|
57 |
+
> Для 32-bit систем, в данный момент не поддерживается метод шифрование `Traditional PKWARE Encryption (ZipCrypto)`.
|
58 |
+
> Используйте метод шифрования `WinZIP AES Encryption`, когда это возможно.
|
59 |
+
+ Установка пароля для чтения архива глобально или для некоторых записей.
|
60 |
+
+ Изменение пароля архива, в том числе и для отдельных записей.
|
61 |
+
+ Удаление пароля архива глобально или для отдельных записей.
|
62 |
+
+ Установка пароля и/или метода шифрования, как для всех, так и для отдельных записей в архиве.
|
63 |
+
+ Установка разных паролей и методов шифрования для разных записей.
|
64 |
+
+ Удаление пароля для всех или для некоторых записей.
|
65 |
+
+ Поддержка методов шифрования `Traditional PKWARE Encryption (ZipCrypto)` и `WinZIP AES Encryption (128, 192 или 256 bit)`.
|
66 |
+
+ Установка метода шифрования для всех или для отдельных записей в архиве.
|
67 |
+
|
68 |
+
### <a name="Requirements"></a> Требования
|
69 |
+
- `PHP` >= 5.5 (предпочтительно 64-bit).
|
70 |
+
- Опционально php-расширение `bzip2` для поддержки BZIP2 компрессии.
|
71 |
+
- Опционально php-расширение `openssl` или `mcrypt` для `WinZip Aes Encryption` шифрования.
|
72 |
+
|
73 |
+
### <a name="Installation"></a> Установка
|
74 |
+
`composer require nelexa/zip`
|
75 |
+
|
76 |
+
Последняя стабильная версия: [![Latest Stable Version](https://poser.pugx.org/nelexa/zip/v/stable)](https://packagist.org/packages/nelexa/zip)
|
77 |
+
|
78 |
+
### <a name="Examples"></a> Примеры
|
79 |
+
```php
|
80 |
+
// создание нового архива
|
81 |
+
$zipFile = new \PhpZip\ZipFile();
|
82 |
+
try{
|
83 |
+
$zipFile
|
84 |
+
->addFromString('zip/entry/filename', "Is file content") // добавить запись из строки
|
85 |
+
->addFile('/path/to/file', 'data/tofile') // добавить запись из файла
|
86 |
+
->addDir(__DIR__, 'to/path/') // добавить файлы из директории
|
87 |
+
->saveAsFile($outputFilename) // сохранить архив в файл
|
88 |
+
->close(); // закрыть архив
|
89 |
+
|
90 |
+
// открытие архива, извлечение файлов, удаление файлов, добавление файлов, установка пароля и вывод архива в браузер.
|
91 |
+
$zipFile
|
92 |
+
->openFile($outputFilename) // открыть архив из файла
|
93 |
+
->extractTo($outputDirExtract) // извлечь файлы в заданную директорию
|
94 |
+
->deleteFromRegex('~^\.~') // удалить все скрытые (Unix) файлы
|
95 |
+
->addFromString('dir/file.txt', 'Test file') // добавить новую запись из строки
|
96 |
+
->setPassword('password') // установить пароль на все записи
|
97 |
+
->outputAsAttachment('library.jar'); // вывести в браузер без сохранения в файл
|
98 |
+
}
|
99 |
+
catch(\PhpZip\Exception\ZipException $e){
|
100 |
+
// обработка исключения
|
101 |
+
}
|
102 |
+
finally{
|
103 |
+
$zipFile->close();
|
104 |
+
}
|
105 |
+
```
|
106 |
+
Другие примеры можно посмотреть в папке `tests/`.
|
107 |
+
|
108 |
+
### <a name="Glossary"></a> Глоссарий
|
109 |
+
**Запись в ZIP-архиве (Zip Entry)** - файл или папка в ZIP-архиве. У каждой записи в архиве есть определённые свойства, например: имя файла, метод сжатия, метод шифрования, размер файла до сжатия, размер файла после сжатия, CRC32 и другие.
|
110 |
+
|
111 |
+
### <a name="Documentation"></a> Документация
|
112 |
+
#### <a name="Documentation-Overview"></a> Обзор методов класса `\PhpZip\ZipFile`
|
113 |
+
- [ZipFile::__construct](#Documentation-ZipFile-__construct) - инициализацирует ZIP-архив.
|
114 |
+
- [ZipFile::addAll](#Documentation-ZipFile-addAll) - добавляет все записи из массива.
|
115 |
+
- [ZipFile::addDir](#Documentation-ZipFile-addDir) - добавляет файлы из директории по указанному пути без вложенных директорий.
|
116 |
+
- [ZipFile::addDirRecursive](#Documentation-ZipFile-addDirRecursive) - добавляет файлы из директории по указанному пути c вложенными директориями.
|
117 |
+
- [ZipFile::addEmptyDir](#Documentation-ZipFile-addEmptyDir) - добавляет в ZIP-архив новую директорию.
|
118 |
+
- [ZipFile::addFile](#Documentation-ZipFile-addFile) - добавляет в ZIP-архив файл по указанному пути.
|
119 |
+
- [ZipFile::addSplFile](#Documentation-ZipFile-addSplFile) - добавляет объект `\SplFileInfo` в zip-архив.
|
120 |
+
- [ZipFile::addFromFinder](#Documentation-ZipFile-addFromFinder) - добавляет файлы из `Symfony\Component\Finder\Finder` в zip архив.
|
121 |
+
- [ZipFile::addFilesFromIterator](#Documentation-ZipFile-addFilesFromIterator) - добавляет файлы из итератора директорий.
|
122 |
+
- [ZipFile::addFilesFromGlob](#Documentation-ZipFile-addFilesFromGlob) - добавляет файлы из директории в соответствии с glob шаблоном без вложенных директорий.
|
123 |
+
- [ZipFile::addFilesFromGlobRecursive](#Documentation-ZipFile-addFilesFromGlobRecursive) - добавляет файлы из директории в соответствии с glob шаблоном c вложенными директориями.
|
124 |
+
- [ZipFile::addFilesFromRegex](#Documentation-ZipFile-addFilesFromRegex) - добавляет файлы из директории в соответствии с регулярным выражением без вложенных директорий.
|
125 |
+
- [ZipFile::addFilesFromRegexRecursive](#Documentation-ZipFile-addFilesFromRegexRecursive) - добавляет файлы из директории в соответствии с регулярным выражением c вложенными директориями.
|
126 |
+
- [ZipFile::addFromStream](#Documentation-ZipFile-addFromStream) - добавляет в ZIP-архив запись из потока.
|
127 |
+
- [ZipFile::addFromString](#Documentation-ZipFile-addFromString) - добавляет файл в ZIP-архив, используя его содержимое в виде строки.
|
128 |
+
- [ZipFile::close](#Documentation-ZipFile-close) - закрывает ZIP-архив.
|
129 |
+
- [ZipFile::count](#Documentation-ZipFile-count) - возвращает количество записей в архиве.
|
130 |
+
- [ZipFile::deleteFromName](#Documentation-ZipFile-deleteFromName) - удаляет запись по имени.
|
131 |
+
- [ZipFile::deleteFromGlob](#Documentation-ZipFile-deleteFromGlob) - удаляет записи в соответствии с glob шаблоном.
|
132 |
+
- [ZipFile::deleteFromRegex](#Documentation-ZipFile-deleteFromRegex) - удаляет записи в соответствии с регулярным выражением.
|
133 |
+
- [ZipFile::deleteAll](#Documentation-ZipFile-deleteAll) - удаляет все записи в ZIP-архиве.
|
134 |
+
- [ZipFile::disableEncryption](#Documentation-ZipFile-disableEncryption) - отключает шифрования всех записей, находящихся в архиве.
|
135 |
+
- [ZipFile::disableEncryptionEntry](#Documentation-ZipFile-disableEncryptionEntry) - отключает шифрование записи по её имени.
|
136 |
+
- [ZipFile::extractTo](#Documentation-ZipFile-extractTo) - извлекает содержимое архива в заданную директорию.
|
137 |
+
- [ZipFile::getAllInfo](#Documentation-ZipFile-getAllInfo) - возвращает подробную информацию обо всех записях в архиве.
|
138 |
+
- [ZipFile::getArchiveComment](#Documentation-ZipFile-getArchiveComment) - возвращает комментарий ZIP-архива.
|
139 |
+
- [ZipFile::getEntryComment](#Documentation-ZipFile-getEntryComment) - возвращает комментарий к записи, используя её имя.
|
140 |
+
- [ZipFile::getEntryContent](#Documentation-ZipFile-getEntryContent) - возвращает содержимое записи.
|
141 |
+
- [ZipFile::getEntryInfo](#Documentation-ZipFile-getEntryInfo) - возвращает подробную информацию о записи в архиве.
|
142 |
+
- [ZipFile::getListFiles](#Documentation-ZipFile-getListFiles) - возвращает список файлов архива.
|
143 |
+
- [ZipFile::hasEntry](#Documentation-ZipFile-hasEntry) - проверяет, присутствует ли запись в архиве.
|
144 |
+
- [ZipFile::isDirectory](#Documentation-ZipFile-isDirectory) - проверяет, является ли запись в архиве директорией.
|
145 |
+
- [ZipFile::matcher](#Documentation-ZipFile-matcher) - выборка записей в архиве для проведения операций над выбранными записями.
|
146 |
+
- [ZipFile::openFile](#Documentation-ZipFile-openFile) - открывает ZIP-архив из файла.
|
147 |
+
- [ZipFile::openFromString](#Documentation-ZipFile-openFromString) - открывает ZIP-архив из строки.
|
148 |
+
- [ZipFile::openFromStream](#Documentation-ZipFile-openFromStream) - открывает ZIP-архив из потока.
|
149 |
+
- [ZipFile::outputAsAttachment](#Documentation-ZipFile-outputAsAttachment) - выводит ZIP-архив в браузер.
|
150 |
+
- [ZipFile::outputAsResponse](#Documentation-ZipFile-outputAsResponse) - выводит ZIP-архив, как Response PSR-7.
|
151 |
+
- [ZipFile::outputAsString](#Documentation-ZipFile-outputAsString) - выводит ZIP-архив в виде строки.
|
152 |
+
- [ZipFile::rename](#Documentation-ZipFile-rename) - переименовывает запись по имени.
|
153 |
+
- [ZipFile::rewrite](#Documentation-ZipFile-rewrite) - сохраняет изменения и заново открывает изменившийся архив.
|
154 |
+
- [ZipFile::saveAsFile](#Documentation-ZipFile-saveAsFile) - сохраняет архив в файл.
|
155 |
+
- [ZipFile::saveAsStream](#Documentation-ZipFile-saveAsStream) - записывает архив в поток.
|
156 |
+
- [ZipFile::setArchiveComment](#Documentation-ZipFile-setArchiveComment) - устанавливает комментарий к ZIP-архиву.
|
157 |
+
- [ZipFile::setCompressionLevel](#Documentation-ZipFile-setCompressionLevel) - устанавливает уровень сжатия для всех файлов, находящихся в архиве.
|
158 |
+
- [ZipFile::setCompressionLevelEntry](#Documentation-ZipFile-setCompressionLevelEntry) - устанавливает уровень сжатия для определённой записи в архиве.
|
159 |
+
- [ZipFile::setCompressionMethodEntry](#Documentation-ZipFile-setCompressionMethodEntry) - устанавливает метод сжатия для определённой записи в архиве.
|
160 |
+
- [ZipFile::setEntryComment](#Documentation-ZipFile-setEntryComment) - устанавливает комментарий к записи, используя её имя.
|
161 |
+
- [ZipFile::setReadPassword](#Documentation-ZipFile-setReadPassword) - устанавливает пароль на чтение открытого запароленного архива для всех зашифрованных записей.
|
162 |
+
- [ZipFile::setReadPasswordEntry](#Documentation-ZipFile-setReadPasswordEntry) - устанавливает пароль на чтение конкретной зашифрованной записи открытого запароленного архива.
|
163 |
+
- ~~ZipFile::withNewPassword~~ - устаревший метод (**deprecated**) используйте метод [ZipFile::setPassword](#Documentation-ZipFile-setPassword).
|
164 |
+
- [ZipFile::setPassword](#Documentation-ZipFile-setPassword) - устанавливает новый пароль для всех файлов, находящихся в архиве.
|
165 |
+
- [ZipFile::setPasswordEntry](#Documentation-ZipFile-setPasswordEntry) - устанавливает новый пароль для конкретного файла.
|
166 |
+
- [ZipFile::setZipAlign](#Documentation-ZipFile-setZipAlign) - устанавливает выравнивание архива для оптимизации APK файлов (Android packages).
|
167 |
+
- [ZipFile::unchangeAll](#Documentation-ZipFile-unchangeAll) - отменяет все изменения, сделанные в архиве.
|
168 |
+
- [ZipFile::unchangeArchiveComment](#Documentation-ZipFile-unchangeArchiveComment) - отменяет изменения в комментарии к архиву.
|
169 |
+
- [ZipFile::unchangeEntry](#Documentation-ZipFile-unchangeEntry) - отменяет изменения для конкретной записи архива.
|
170 |
+
- ~~ZipFile::withoutPassword~~ - устаревший метод (**deprecated**) используйте метод [ZipFile::disableEncryption](#Documentation-ZipFile-disableEncryption).
|
171 |
+
- ~~ZipFile::withReadPassword~~ - устаревший метод (**deprecated**) используйте метод [ZipFile::setReadPassword](#Documentation-ZipFile-setReadPassword).
|
172 |
+
|
173 |
+
#### <a name="Documentation-Open-Zip-Archive"></a> Создание/Открытие ZIP-архива
|
174 |
+
<a name="Documentation-ZipFile-__construct"></a>**ZipFile::__construct** - Инициализацирует ZIP-архив.
|
175 |
+
```php
|
176 |
+
$zipFile = new \PhpZip\ZipFile();
|
177 |
+
```
|
178 |
+
<a name="Documentation-ZipFile-openFile"></a> **ZipFile::openFile** - открывает ZIP-архив из файла.
|
179 |
+
```php
|
180 |
+
$zipFile = new \PhpZip\ZipFile();
|
181 |
+
$zipFile->openFile('file.zip');
|
182 |
+
```
|
183 |
+
<a name="Documentation-ZipFile-openFromString"></a> **ZipFile::openFromString** - открывает ZIP-архив из строки.
|
184 |
+
```php
|
185 |
+
$zipFile = new \PhpZip\ZipFile();
|
186 |
+
$zipFile->openFromString($stringContents);
|
187 |
+
```
|
188 |
+
<a name="Documentation-ZipFile-openFromStream"></a> **ZipFile::openFromStream** - открывает ZIP-архив из потока.
|
189 |
+
```php
|
190 |
+
$stream = fopen('file.zip', 'rb');
|
191 |
+
|
192 |
+
$zipFile = new \PhpZip\ZipFile();
|
193 |
+
$zipFile->openFromStream($stream);
|
194 |
+
```
|
195 |
+
#### <a name="Documentation-Open-Zip-Entries"></a> Чтение записей из архива
|
196 |
+
<a name="Documentation-ZipFile-count"></a> **ZipFile::count** - возвращает количество записей в архиве.
|
197 |
+
```php
|
198 |
+
$zipFile = new \PhpZip\ZipFile();
|
199 |
+
|
200 |
+
$count = count($zipFile);
|
201 |
+
// или
|
202 |
+
$count = $zipFile->count();
|
203 |
+
```
|
204 |
+
<a name="Documentation-ZipFile-getListFiles"></a> **ZipFile::getListFiles** - возвращает список файлов архива.
|
205 |
+
```php
|
206 |
+
$zipFile = new \PhpZip\ZipFile();
|
207 |
+
$listFiles = $zipFile->getListFiles();
|
208 |
+
|
209 |
+
// Пример содержимого массива:
|
210 |
+
// array (
|
211 |
+
// 0 => 'info.txt',
|
212 |
+
// 1 => 'path/to/file.jpg',
|
213 |
+
// 2 => 'another path/',
|
214 |
+
// )
|
215 |
+
```
|
216 |
+
<a name="Documentation-ZipFile-getEntryContent"></a> **ZipFile::getEntryContent** - возвращает содержимое записи.
|
217 |
+
```php
|
218 |
+
// $entryName = 'path/to/example-entry-name.txt';
|
219 |
+
$zipFile = new \PhpZip\ZipFile();
|
220 |
+
|
221 |
+
$contents = $zipFile[$entryName];
|
222 |
+
// или
|
223 |
+
$contents = $zipFile->getEntryContents($entryName);
|
224 |
+
```
|
225 |
+
<a name="Documentation-ZipFile-hasEntry"></a> **ZipFile::hasEntry** - проверяет, присутствует ли запись в архиве.
|
226 |
+
```php
|
227 |
+
// $entryName = 'path/to/example-entry-name.txt';
|
228 |
+
$zipFile = new \PhpZip\ZipFile();
|
229 |
+
|
230 |
+
$hasEntry = isset($zipFile[$entryName]);
|
231 |
+
// или
|
232 |
+
$hasEntry = $zipFile->hasEntry($entryName);
|
233 |
+
```
|
234 |
+
<a name="Documentation-ZipFile-isDirectory"></a> **ZipFile::isDirectory** - проверяет, является ли запись в архиве директорией.
|
235 |
+
```php
|
236 |
+
// $entryName = 'path/to/';
|
237 |
+
$zipFile = new \PhpZip\ZipFile();
|
238 |
+
|
239 |
+
$isDirectory = $zipFile->isDirectory($entryName);
|
240 |
+
```
|
241 |
+
<a name="Documentation-ZipFile-extractTo"></a> **ZipFile::extractTo** - извлекает содержимое архива в заданную директорию.
|
242 |
+
Директория должна существовать.
|
243 |
+
```php
|
244 |
+
$zipFile = new \PhpZip\ZipFile();
|
245 |
+
$zipFile->extractTo($directory);
|
246 |
+
```
|
247 |
+
Можно извлечь только некоторые записи в заданную директорию.
|
248 |
+
Директория должна существовать.
|
249 |
+
```php
|
250 |
+
$extractOnlyFiles = [
|
251 |
+
'filename1',
|
252 |
+
'filename2',
|
253 |
+
'dir/dir/dir/'
|
254 |
+
];
|
255 |
+
$zipFile = new \PhpZip\ZipFile();
|
256 |
+
$zipFile->extractTo($toDirectory, $extractOnlyFiles);
|
257 |
+
```
|
258 |
+
#### <a name="Documentation-Zip-Iterate"></a> Перебор записей/Итератор
|
259 |
+
`ZipFile` является итератором.
|
260 |
+
Можно перебрать все записи, через цикл `foreach`.
|
261 |
+
```php
|
262 |
+
foreach($zipFile as $entryName => $contents){
|
263 |
+
echo "Файл: $entryName" . PHP_EOL;
|
264 |
+
echo "Содержимое: $contents" . PHP_EOL;
|
265 |
+
echo '-----------------------------' . PHP_EOL;
|
266 |
+
}
|
267 |
+
```
|
268 |
+
Можно использовать паттерн `Iterator`.
|
269 |
+
```php
|
270 |
+
$iterator = new \ArrayIterator($zipFile);
|
271 |
+
while ($iterator->valid())
|
272 |
+
{
|
273 |
+
$entryName = $iterator->key();
|
274 |
+
$contents = $iterator->current();
|
275 |
+
|
276 |
+
echo "Файл: $entryName" . PHP_EOL;
|
277 |
+
echo "Содержимое: $contents" . PHP_EOL;
|
278 |
+
echo '-----------------------------' . PHP_EOL;
|
279 |
+
|
280 |
+
$iterator->next();
|
281 |
+
}
|
282 |
+
```
|
283 |
+
#### <a name="Documentation-Zip-Info"></a> Получение информации о записях
|
284 |
+
<a name="Documentation-ZipFile-getArchiveComment"></a> **ZipFile::getArchiveComment** - возвращает комментарий ZIP-архива.
|
285 |
+
```php
|
286 |
+
$commentArchive = $zipFile->getArchiveComment();
|
287 |
+
```
|
288 |
+
<a name="Documentation-ZipFile-getEntryComment"></a> **ZipFile::getEntryComment** - возвращает комментарий к записи, используя её имя.
|
289 |
+
```php
|
290 |
+
$commentEntry = $zipFile->getEntryComment($entryName);
|
291 |
+
```
|
292 |
+
<a name="Documentation-ZipFile-getEntryInfo"></a> **ZipFile::getEntryInfo** - возвращает подробную информацию о записи в архиве.
|
293 |
+
```php
|
294 |
+
$zipFile = new \PhpZip\ZipFile();
|
295 |
+
$zipInfo = $zipFile->getEntryInfo('file.txt');
|
296 |
+
```
|
297 |
+
<a name="Documentation-ZipFile-getAllInfo"></a> **ZipFile::getAllInfo** - возвращает подробную информацию обо всех записях в архиве.
|
298 |
+
```php
|
299 |
+
$zipAllInfo = $zipFile->getAllInfo();
|
300 |
+
```
|
301 |
+
#### <a name="Documentation-Add-Zip-Entries"></a> Добавление записей в архив
|
302 |
+
|
303 |
+
Все методы добавления записей в ZIP-архив позволяют указать метод сжатия содержимого.
|
304 |
+
|
305 |
+
Доступны следующие методы сжатия:
|
306 |
+
- `\PhpZip\Constants\ZipCompressionMethod::STORED` - без сжатия
|
307 |
+
- `\PhpZip\Constants\ZipCompressionMethod::DEFLATED` - Deflate сжатие
|
308 |
+
- `\PhpZip\Constants\ZipCompressionMethod::BZIP2` - Bzip2 сжатие при наличии расширения `ext-bz2`
|
309 |
+
|
310 |
+
<a name="Documentation-ZipFile-addFile"></a> **ZipFile::addFile** - добавляет в ZIP-архив файл по указанному пути из файловой системы.
|
311 |
+
```php
|
312 |
+
$zipFile = new \PhpZip\ZipFile();
|
313 |
+
// $file = '...../file.ext';
|
314 |
+
$zipFile->addFile($file);
|
315 |
+
|
316 |
+
// можно указать имя записи в архиве (если null, то используется последний компонент из имени файла)
|
317 |
+
$zipFile->addFile($file, $entryName);
|
318 |
+
|
319 |
+
// можно указать метод сжатия
|
320 |
+
$zipFile->addFile($file, $entryName, \PhpZip\Constants\ZipCompressionMethod::STORED); // Без сжатия
|
321 |
+
$zipFile->addFile($file, $entryName, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate сжатие
|
322 |
+
$zipFile->addFile($file, $entryName, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 сжатие
|
323 |
+
```
|
324 |
+
<a name="Documentation-ZipFile-addSplFile"></a>
|
325 |
+
**ZipFile::addSplFile"** - добавляет объект `\SplFileInfo` в zip-архив.
|
326 |
+
```php
|
327 |
+
// $file = '...../file.ext';
|
328 |
+
// $entryName = 'file2.ext'
|
329 |
+
$zipFile = new \PhpZip\ZipFile();
|
330 |
+
|
331 |
+
$splFile = new \SplFileInfo('README.md');
|
332 |
+
|
333 |
+
$zipFile->addSplFile($splFile);
|
334 |
+
$zipFile->addSplFile($splFile, $entryName);
|
335 |
+
// or
|
336 |
+
$zipFile[$entryName] = new \SplFileInfo($file);
|
337 |
+
|
338 |
+
// установить метод сжатия
|
339 |
+
$zipFile->addSplFile($splFile, $entryName, $options = [
|
340 |
+
\PhpZip\Constants\ZipOptions::COMPRESSION_METHOD => \PhpZip\Constants\ZipCompressionMethod::DEFLATED,
|
341 |
+
]);
|
342 |
+
```
|
343 |
+
<a name="Documentation-ZipFile-addFromFinder"></a>
|
344 |
+
**ZipFile::addFromFinder"** - добавляет файлы из `Symfony\Component\Finder\Finder` в zip архив.
|
345 |
+
https://symfony.com/doc/current/components/finder.html
|
346 |
+
```php
|
347 |
+
$finder = new \Symfony\Component\Finder\Finder();
|
348 |
+
$finder
|
349 |
+
->files()
|
350 |
+
->name('*.{jpg,jpeg,gif,png}')
|
351 |
+
->name('/^[0-9a-f]\./')
|
352 |
+
->contains('/lorem\s+ipsum$/i')
|
353 |
+
->in('path');
|
354 |
+
|
355 |
+
$zipFile = new \PhpZip\ZipFile();
|
356 |
+
$zipFile->addFromFinder($finder, $options = [
|
357 |
+
\PhpZip\Constants\ZipOptions::COMPRESSION_METHOD => \PhpZip\Constants\ZipCompressionMethod::DEFLATED,
|
358 |
+
\PhpZip\Constants\ZipOptions::MODIFIED_TIME => new \DateTimeImmutable('-1 day 5 min')
|
359 |
+
]);
|
360 |
+
```
|
361 |
+
<a name="Documentation-ZipFile-addFromString"></a> **ZipFile::addFromString** - добавляет файл в ZIP-архив, используя его содержимое в виде строки.
|
362 |
+
```php
|
363 |
+
$zipFile = new \PhpZip\ZipFile();
|
364 |
+
|
365 |
+
$zipFile[$entryName] = $contents;
|
366 |
+
// или
|
367 |
+
$zipFile->addFromString($entryName, $contents);
|
368 |
+
|
369 |
+
// можно указать метод сжатия
|
370 |
+
$zipFile->addFromString($entryName, $contents, \PhpZip\Constants\ZipCompressionMethod::STORED); // Без сжатия
|
371 |
+
$zipFile->addFromString($entryName, $contents, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate сжатие
|
372 |
+
$zipFile->addFromString($entryName, $contents, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 сжатие
|
373 |
+
```
|
374 |
+
<a name="Documentation-ZipFile-addFromStream"></a> **ZipFile::addFromStream** - добавляет в ZIP-архив запись из потока.
|
375 |
+
```php
|
376 |
+
// $stream = fopen(..., 'rb');
|
377 |
+
|
378 |
+
$zipFile->addFromStream($stream, $entryName);
|
379 |
+
|
380 |
+
// можно указать метод сжатия
|
381 |
+
$zipFile->addFromStream($stream, $entryName, \PhpZip\Constants\ZipCompressionMethod::STORED); // Без сжатия
|
382 |
+
$zipFile->addFromStream($stream, $entryName, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate сжатие
|
383 |
+
$zipFile->addFromStream($stream, $entryName, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 сжатие
|
384 |
+
```
|
385 |
+
<a name="Documentation-ZipFile-addEmptyDir"></a> **ZipFile::addEmptyDir** - добавляет в ZIP-архив новую (пустую) директорию.
|
386 |
+
```php
|
387 |
+
// $path = "path/to/";
|
388 |
+
|
389 |
+
$zipFile->addEmptyDir($path);
|
390 |
+
// или
|
391 |
+
$zipFile[$path] = null;
|
392 |
+
```
|
393 |
+
<a name="Documentation-ZipFile-addAll"></a> **ZipFile::addAll** - добавляет все записи из массива.
|
394 |
+
```php
|
395 |
+
$entries = [
|
396 |
+
'file.txt' => 'file contents', // запись из строки данных
|
397 |
+
'empty dir/' => null, // пустой каталог
|
398 |
+
'path/to/file.jpg' => fopen('..../filename', 'r'), // запись из потока
|
399 |
+
'path/to/file.dat' => new \SplFileInfo('..../filename'), // запись из файла
|
400 |
+
];
|
401 |
+
|
402 |
+
$zipFile->addAll($entries);
|
403 |
+
```
|
404 |
+
<a name="Documentation-ZipFile-addDir"></a> **ZipFile::addDir** - добавляет файлы из директории по указанному пути без вложенных директорий.
|
405 |
+
```php
|
406 |
+
$zipFile->addDir($dirName);
|
407 |
+
|
408 |
+
// можно указать путь в архиве в который необходимо поместить записи
|
409 |
+
$localPath = "to/path/";
|
410 |
+
$zipFile->addDir($dirName, $localPath);
|
411 |
+
|
412 |
+
// можно указать метод сжатия
|
413 |
+
$zipFile->addDir($dirName, $localPath, \PhpZip\Constants\ZipCompressionMethod::STORED); // Без сжатия
|
414 |
+
$zipFile->addDir($dirName, $localPath, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate сжатие
|
415 |
+
$zipFile->addDir($dirName, $localPath, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 сжатие
|
416 |
+
```
|
417 |
+
<a name="Documentation-ZipFile-addDirRecursive"></a> **ZipFile::addDirRecursive** - добавляет файлы из директории по указанному пути c вложенными директориями.
|
418 |
+
```php
|
419 |
+
$zipFile->addDirRecursive($dirName);
|
420 |
+
|
421 |
+
// можно указать путь в архиве в который необходимо поместить записи
|
422 |
+
$localPath = "to/path/";
|
423 |
+
$zipFile->addDirRecursive($dirName, $localPath);
|
424 |
+
|
425 |
+
// можно указать метод сжатия
|
426 |
+
$zipFile->addDirRecursive($dirName, $localPath, \PhpZip\Constants\ZipCompressionMethod::STORED); // Без сжатия
|
427 |
+
$zipFile->addDirRecursive($dirName, $localPath, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate сжатие
|
428 |
+
$zipFile->addDirRecursive($dirName, $localPath, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 сжатие
|
429 |
+
```
|
430 |
+
<a name="Documentation-ZipFile-addFilesFromIterator"></a> **ZipFile::addFilesFromIterator** - добавляет файлы из итератора директорий.
|
431 |
+
```php
|
432 |
+
// $directoryIterator = new \DirectoryIterator($dir); // без вложенных директорий
|
433 |
+
// $directoryIterator = new \RecursiveDirectoryIterator($dir); // с вложенными директориями
|
434 |
+
|
435 |
+
$zipFile->addFilesFromIterator($directoryIterator);
|
436 |
+
|
437 |
+
// можно указать путь в архиве в который необходимо поместить записи
|
438 |
+
$localPath = "to/path/";
|
439 |
+
$zipFile->addFilesFromIterator($directoryIterator, $localPath);
|
440 |
+
// или
|
441 |
+
$zipFile[$localPath] = $directoryIterator;
|
442 |
+
|
443 |
+
// можно указать метод сжатия
|
444 |
+
$zipFile->addFilesFromIterator($directoryIterator, $localPath, \PhpZip\Constants\ZipCompressionMethod::STORED); // Без сжатия
|
445 |
+
$zipFile->addFilesFromIterator($directoryIterator, $localPath, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate сжатие
|
446 |
+
$zipFile->addFilesFromIterator($directoryIterator, $localPath, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 сжатие
|
447 |
+
```
|
448 |
+
Пример добавления файлов из директории в архив с игнорированием некоторых файлов при помощи итератора директорий.
|
449 |
+
```php
|
450 |
+
$ignoreFiles = [
|
451 |
+
"file_ignore.txt",
|
452 |
+
"dir_ignore/sub dir ignore/"
|
453 |
+
];
|
454 |
+
|
455 |
+
// $directoryIterator = new \DirectoryIterator($dir); // без вложенных директорий
|
456 |
+
// $directoryIterator = new \RecursiveDirectoryIterator($dir); // с вложенными директориями
|
457 |
+
|
458 |
+
// используйте \PhpZip\Util\Iterator\IgnoreFilesFilterIterator для не рекурсивного поиска
|
459 |
+
$ignoreIterator = new \PhpZip\Util\Iterator\IgnoreFilesRecursiveFilterIterator(
|
460 |
+
$directoryIterator,
|
461 |
+
$ignoreFiles
|
462 |
+
);
|
463 |
+
|
464 |
+
$zipFile->addFilesFromIterator($ignoreIterator);
|
465 |
+
```
|
466 |
+
<a name="Documentation-ZipFile-addFilesFromGlob"></a> **ZipFile::addFilesFromGlob** - добавляет файлы из директории в соответствии с [glob шаблоном](https://en.wikipedia.org/wiki/Glob_(programming)) без вложенных директорий.
|
467 |
+
```php
|
468 |
+
$globPattern = '**.{jpg,jpeg,png,gif}'; // пример glob шаблона -> добавить все .jpg, .jpeg, .png и .gif файлы
|
469 |
+
|
470 |
+
$zipFile->addFilesFromGlob($dir, $globPattern);
|
471 |
+
|
472 |
+
// можно указать путь в архиве в который необходимо поместить записи
|
473 |
+
$localPath = "to/path/";
|
474 |
+
$zipFile->addFilesFromGlob($dir, $globPattern, $localPath);
|
475 |
+
|
476 |
+
// можно указать метод сжатия
|
477 |
+
$zipFile->addFilesFromGlob($dir, $globPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::STORED); // Без сжатия
|
478 |
+
$zipFile->addFilesFromGlob($dir, $globPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate сжатие
|
479 |
+
$zipFile->addFilesFromGlob($dir, $globPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 сжатие
|
480 |
+
```
|
481 |
+
<a name="Documentation-ZipFile-addFilesFromGlobRecursive"></a> **ZipFile::addFilesFromGlobRecursive** - добавляет файлы из директории в соответствии с [glob шаблоном](https://en.wikipedia.org/wiki/Glob_(programming)) c вложенными директориями.
|
482 |
+
```php
|
483 |
+
$globPattern = '**.{jpg,jpeg,png,gif}'; // пример glob шаблона -> добавить все .jpg, .jpeg, .png и .gif файлы
|
484 |
+
|
485 |
+
$zipFile->addFilesFromGlobRecursive($dir, $globPattern);
|
486 |
+
|
487 |
+
// можно указать путь в архиве в который необходимо поместить записи
|
488 |
+
$localPath = "to/path/";
|
489 |
+
$zipFile->addFilesFromGlobRecursive($dir, $globPattern, $localPath);
|
490 |
+
|
491 |
+
// можно указать метод сжатия
|
492 |
+
$zipFile->addFilesFromGlobRecursive($dir, $globPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::STORED); // Без сжатия
|
493 |
+
$zipFile->addFilesFromGlobRecursive($dir, $globPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate сжатие
|
494 |
+
$zipFile->addFilesFromGlobRecursive($dir, $globPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 сжатие
|
495 |
+
```
|
496 |
+
<a name="Documentation-ZipFile-addFilesFromRegex"></a> **ZipFile::addFilesFromRegex** - добавляет файлы из директории в соответствии с [регулярным выражением](https://en.wikipedia.org/wiki/Regular_expression) без вложенных директорий.
|
497 |
+
```php
|
498 |
+
$regexPattern = '/\.(jpe?g|png|gif)$/si'; // пример регулярного выражения -> добавить все .jpg, .jpeg, .png и .gif файлы
|
499 |
+
|
500 |
+
$zipFile->addFilesFromRegex($dir, $regexPattern);
|
501 |
+
|
502 |
+
// можно указать путь в архиве в который необходимо поместить записи
|
503 |
+
$localPath = "to/path/";
|
504 |
+
$zipFile->addFilesFromRegex($dir, $regexPattern, $localPath);
|
505 |
+
|
506 |
+
// можно указать метод сжатия
|
507 |
+
$zipFile->addFilesFromRegex($dir, $regexPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::STORED); // Без сжатия
|
508 |
+
$zipFile->addFilesFromRegex($dir, $regexPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate сжатие
|
509 |
+
$zipFile->addFilesFromRegex($dir, $regexPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 сжатие
|
510 |
+
```
|
511 |
+
<a name="Documentation-ZipFile-addFilesFromRegexRecursive"></a> **ZipFile::addFilesFromRegexRecursive** - добавляет файлы из директории в соответствии с [регулярным выражением](https://en.wikipedia.org/wiki/Regular_expression) с вложенными директориями.
|
512 |
+
```php
|
513 |
+
$regexPattern = '/\.(jpe?g|png|gif)$/si'; // пример регулярного выражения -> добавить все .jpg, .jpeg, .png и .gif файлы
|
514 |
+
|
515 |
+
$zipFile->addFilesFromRegexRecursive($dir, $regexPattern);
|
516 |
+
|
517 |
+
// можно указать путь в архиве в который необходимо поместить записи
|
518 |
+
$localPath = "to/path/";
|
519 |
+
$zipFile->addFilesFromRegexRecursive($dir, $regexPattern, $localPath);
|
520 |
+
|
521 |
+
// можно указать метод сжатия
|
522 |
+
$zipFile->addFilesFromRegexRecursive($dir, $regexPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::STORED); // Без сжатия
|
523 |
+
$zipFile->addFilesFromRegexRecursive($dir, $regexPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate сжатие
|
524 |
+
$zipFile->addFilesFromRegexRecursive($dir, $regexPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 сжатие
|
525 |
+
```
|
526 |
+
#### <a name="Documentation-Remove-Zip-Entries"></a> Удаление записей из архива
|
527 |
+
<a name="Documentation-ZipFile-deleteFromName"></a> **ZipFile::deleteFromName** - удаляет запись по имени.
|
528 |
+
```php
|
529 |
+
$zipFile->deleteFromName($entryName);
|
530 |
+
```
|
531 |
+
<a name="Documentation-ZipFile-deleteFromGlob"></a> **ZipFile::deleteFromGlob** - удаляет записи в соответствии с [glob шаблоном](https://en.wikipedia.org/wiki/Glob_(programming)).
|
532 |
+
```php
|
533 |
+
$globPattern = '**.{jpg,jpeg,png,gif}'; // пример glob шаблона -> удалить все .jpg, .jpeg, .png и .gif файлы
|
534 |
+
|
535 |
+
$zipFile->deleteFromGlob($globPattern);
|
536 |
+
```
|
537 |
+
<a name="Documentation-ZipFile-deleteFromRegex"></a> **ZipFile::deleteFromRegex** - удаляет записи в соответствии с [регулярным выражением](https://en.wikipedia.org/wiki/Regular_expression).
|
538 |
+
```php
|
539 |
+
$regexPattern = '/\.(jpe?g|png|gif)$/si'; // пример регулярному выражения -> удалить все .jpg, .jpeg, .png и .gif файлы
|
540 |
+
|
541 |
+
$zipFile->deleteFromRegex($regexPattern);
|
542 |
+
```
|
543 |
+
<a name="Documentation-ZipFile-deleteAll"></a> **ZipFile::deleteAll** - удаляет все записи в ZIP-архиве.
|
544 |
+
```php
|
545 |
+
$zipFile->deleteAll();
|
546 |
+
```
|
547 |
+
#### <a name="Documentation-Entries"></a> Работа с записями и с архивом
|
548 |
+
<a name="Documentation-ZipFile-rename"></a> **ZipFile::rename** - переименовывает запись по имени.
|
549 |
+
```php
|
550 |
+
$zipFile->rename($oldName, $newName);
|
551 |
+
```
|
552 |
+
<a name="Documentation-ZipFile-setCompressionLevel"></a> **ZipFile::setCompressionLevel** - устанавливает уровень сжатия для всех файлов, находящихся в архиве.
|
553 |
+
|
554 |
+
> _Обратите внимание, что действие данного метода не распространяется на записи, добавленные после выполнения этого метода._
|
555 |
+
|
556 |
+
По умолчанию используется уровень сжатия 5 (`\PhpZip\Constants\ZipCompressionLevel::NORMAL`) или уровень сжатия, определённый в архиве для Deflate сжатия.
|
557 |
+
|
558 |
+
Поддерживаются диапазон значений от 1 (`\PhpZip\Constants\ZipCompressionLevel::SUPER_FAST`) до 9 (`\PhpZip\Constants\ZipCompressionLevel::MAXIMUM`). Чем выше число, тем лучше и дольше сжатие.
|
559 |
+
```php
|
560 |
+
$zipFile->setCompressionLevel(\PhpZip\Constants\ZipCompressionLevel::MAXIMUM);
|
561 |
+
```
|
562 |
+
<a name="Documentation-ZipFile-setCompressionLevelEntry"></a> **ZipFile::setCompressionLevelEntry** - устанавливает уровень сжатия для определённой записи в архиве.
|
563 |
+
|
564 |
+
Поддерживаются диапазон значений от 1 (`\PhpZip\Constants\ZipCompressionLevel::SUPER_FAST`) до 9 (`\PhpZip\Constants\ZipCompressionLevel::MAXIMUM`). Чем выше число, тем лучше и дольше сжатие.
|
565 |
+
```php
|
566 |
+
$zipFile->setCompressionLevelEntry($entryName, \PhpZip\Constants\ZipCompressionLevel::MAXIMUM);
|
567 |
+
```
|
568 |
+
<a name="Documentation-ZipFile-setCompressionMethodEntry"></a> **ZipFile::setCompressionMethodEntry** - устанавливает метод сжатия для определённой записи в архиве.
|
569 |
+
|
570 |
+
Доступны следующие методы сжатия:
|
571 |
+
- `\PhpZip\Constants\ZipCompressionMethod::STORED` - без сжатия
|
572 |
+
- `\PhpZip\Constants\ZipCompressionMethod::DEFLATED` - Deflate сжатие
|
573 |
+
- `\PhpZip\Constants\ZipCompressionMethod::BZIP2` - Bzip2 сжатие при наличии расширения `ext-bz2`
|
574 |
+
```php
|
575 |
+
$zipFile->setCompressionMethodEntry($entryName, \PhpZip\Constants\ZipCompressionMethod::DEFLATED);
|
576 |
+
```
|
577 |
+
<a name="Documentation-ZipFile-setArchiveComment"></a> **ZipFile::setArchiveComment** - устанавливает комментарий к ZIP-архиву.
|
578 |
+
```php
|
579 |
+
$zipFile->setArchiveComment($commentArchive);
|
580 |
+
```
|
581 |
+
<a name="Documentation-ZipFile-setEntryComment"></a> **ZipFile::setEntryComment** - устанавливает комментарий к записи, используя её имя.
|
582 |
+
```php
|
583 |
+
$zipFile->setEntryComment($entryName, $comment);
|
584 |
+
```
|
585 |
+
<a name="Documentation-ZipFile-matcher"></a> **ZipFile::matcher** - выборка записей в архиве для проведения операций над выбранными записями.
|
586 |
+
```php
|
587 |
+
$matcher = $zipFile->matcher();
|
588 |
+
```
|
589 |
+
Выбор файлов из архива по одному:
|
590 |
+
```php
|
591 |
+
$matcher
|
592 |
+
->add('entry name')
|
593 |
+
->add('another entry');
|
594 |
+
```
|
595 |
+
Выбор нескольких файлов в архиве:
|
596 |
+
```php
|
597 |
+
$matcher->add([
|
598 |
+
'entry name',
|
599 |
+
'another entry name',
|
600 |
+
'path/'
|
601 |
+
]);
|
602 |
+
```
|
603 |
+
Выбор файлов по регулярному выражению:
|
604 |
+
```php
|
605 |
+
$matcher->match('~\.jpe?g$~i');
|
606 |
+
```
|
607 |
+
Выбор всех файлов в архиве:
|
608 |
+
```php
|
609 |
+
$matcher->all();
|
610 |
+
```
|
611 |
+
count() - получает количество выбранных записей:
|
612 |
+
```php
|
613 |
+
$count = count($matcher);
|
614 |
+
// или
|
615 |
+
$count = $matcher->count();
|
616 |
+
```
|
617 |
+
getMatches() - получает список выбранных записей:
|
618 |
+
```php
|
619 |
+
$entries = $matcher->getMatches();
|
620 |
+
// пример содержимого: ['entry name', 'another entry name'];
|
621 |
+
```
|
622 |
+
invoke() - выполняет пользовательскую функцию над выбранными записями:
|
623 |
+
```php
|
624 |
+
// пример
|
625 |
+
$matcher->invoke(function($entryName) use($zipFile) {
|
626 |
+
$newName = preg_replace('~\.(jpe?g)$~i', '.no_optimize.$1', $entryName);
|
627 |
+
$zipFile->rename($entryName, $newName);
|
628 |
+
});
|
629 |
+
```
|
630 |
+
Функции для работы над выбранными записями:
|
631 |
+
```php
|
632 |
+
$matcher->delete(); // удалет выбранные записи из ZIP-архива
|
633 |
+
$matcher->setPassword($password); // устанавливает новый пароль на выбранные записи
|
634 |
+
$matcher->setPassword($password, $encryptionMethod); // устанавливает новый пароль и метод шифрования на выбранные записи
|
635 |
+
$matcher->setEncryptionMethod($encryptionMethod); // устанавливает метод шифрования на выбранные записи
|
636 |
+
$matcher->disableEncryption(); // отключает шифрование для выбранных записей
|
637 |
+
```
|
638 |
+
#### <a name="Documentation-Password"></a> Работа с паролями
|
639 |
+
|
640 |
+
Реализована поддержка методов шифрования:
|
641 |
+
- `\PhpZip\Constants\ZipEncryptionMethod::PKWARE` - Traditional PKWARE encryption
|
642 |
+
- `\PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_256` - WinZip AES encryption 256 bit (рекомендуемое)
|
643 |
+
- `\PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_192` - WinZip AES encryption 192 bit
|
644 |
+
- `\PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_128` - WinZip AES encryption 128 bit
|
645 |
+
|
646 |
+
<a name="Documentation-ZipFile-setReadPassword"></a> **ZipFile::setReadPassword** - устанавливает пароль на чтение открытого запароленного архива для всех зашифрованных записей.
|
647 |
+
|
648 |
+
> _Установка пароля не является обязательной для добавления новых записей или удаления существующих, но если вы захотите извлечь контент или изменить метод/уровень сжатия, метод шифрования или изменить пароль, то в этом случае пароль необходимо указать._
|
649 |
+
```php
|
650 |
+
$zipFile->setReadPassword($password);
|
651 |
+
```
|
652 |
+
<a name="Documentation-ZipFile-setReadPasswordEntry"></a> **ZipFile::setReadPasswordEntry** - устанавливает пароль на чтение конкретной зашифрованной записи открытого запароленного архива.
|
653 |
+
```php
|
654 |
+
$zipFile->setReadPasswordEntry($entryName, $password);
|
655 |
+
```
|
656 |
+
<a name="Documentation-ZipFile-setPassword"></a> **ZipFile::setPassword** - устанавливает новый пароль для всех файлов, находящихся в архиве.
|
657 |
+
|
658 |
+
> _Обратите внимание, что действие данного метода не распространяется на записи, добавленные после выполнения этого метода._
|
659 |
+
```php
|
660 |
+
$zipFile->setPassword($password);
|
661 |
+
```
|
662 |
+
Можно установить метод шифрования:
|
663 |
+
```php
|
664 |
+
$encryptionMethod = \PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_256;
|
665 |
+
$zipFile->setPassword($password, $encryptionMethod);
|
666 |
+
```
|
667 |
+
<a name="Documentation-ZipFile-setPasswordEntry"></a> **ZipFile::setPasswordEntry** - устанавливает новый пароль для конкретного файла.
|
668 |
+
```php
|
669 |
+
$zipFile->setPasswordEntry($entryName, $password);
|
670 |
+
```
|
671 |
+
Можно установить метод шифрования:
|
672 |
+
```php
|
673 |
+
$encryptionMethod = \PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_256;
|
674 |
+
$zipFile->setPasswordEntry($entryName, $password, $encryptionMethod);
|
675 |
+
```
|
676 |
+
<a name="Documentation-ZipFile-disableEncryption"></a> **ZipFile::disableEncryption** - отключает шифрования всех записей, находящихся в архиве.
|
677 |
+
|
678 |
+
> _Обратите внимание, что действие данного метода не распространяется на записи, добавленные после выполнения этого метода._
|
679 |
+
```php
|
680 |
+
$zipFile->disableEncryption();
|
681 |
+
```
|
682 |
+
<a name="Documentation-ZipFile-disableEncryptionEntry"></a> **ZipFile::disableEncryptionEntry** - отключает шифрование записи по её имени.
|
683 |
+
```php
|
684 |
+
$zipFile->disableEncryptionEntry($entryName);
|
685 |
+
```
|
686 |
+
#### <a name="Documentation-ZipAlign-Usage"></a> zipalign
|
687 |
+
<a name="Documentation-ZipFile-setZipAlign"></a> **ZipFile::setZipAlign** - устанавливает выравнивание архива для оптимизации APK файлов (Android packages).
|
688 |
+
|
689 |
+
Метод добавляет паддинги незашифрованным и не сжатым записям, для оптимизации расхода памяти в системе Android. Рекомендуется использовать для `APK` файлов. Файл может незначительно увеличиться.
|
690 |
+
|
691 |
+
Этот метод является альтернативой вызова команды `zipalign -f -v 4 filename.zip`.
|
692 |
+
|
693 |
+
Подробнее можно ознакомиться по [ссылке](https://developer.android.com/studio/command-line/zipalign.html).
|
694 |
+
```php
|
695 |
+
// вызовите до сохранения или вывода архива
|
696 |
+
$zipFile->setZipAlign(4);
|
697 |
+
```
|
698 |
+
#### <a name="Documentation-Unchanged"></a> Отмена изменений
|
699 |
+
<a name="Documentation-ZipFile-unchangeAll"></a> **ZipFile::unchangeAll** - отменяет все изменения, сделанные в архиве.
|
700 |
+
```php
|
701 |
+
$zipFile->unchangeAll();
|
702 |
+
```
|
703 |
+
<a name="Documentation-ZipFile-unchangeArchiveComment"></a> **ZipFile::unchangeArchiveComment** - отменяет изменения в комментарии к архиву.
|
704 |
+
```php
|
705 |
+
$zipFile->unchangeArchiveComment();
|
706 |
+
```
|
707 |
+
<a name="Documentation-ZipFile-unchangeEntry"></a> **ZipFile::unchangeEntry** - отменяет изменения для конкретной записи архива.
|
708 |
+
```php
|
709 |
+
$zipFile->unchangeEntry($entryName);
|
710 |
+
```
|
711 |
+
#### <a name="Documentation-Save-Or-Output-Entries"></a> Сохранение файла или вывод в браузер
|
712 |
+
<a name="Documentation-ZipFile-saveAsFile"></a> **ZipFile::saveAsFile** - сохраняет архив в файл.
|
713 |
+
```php
|
714 |
+
$zipFile->saveAsFile($filename);
|
715 |
+
```
|
716 |
+
<a name="Documentation-ZipFile-saveAsStream"></a> **ZipFile::saveAsStream** - записывает архив в поток.
|
717 |
+
```php
|
718 |
+
// $fp = fopen($filename, 'w+b');
|
719 |
+
|
720 |
+
$zipFile->saveAsStream($fp);
|
721 |
+
```
|
722 |
+
<a name="Documentation-ZipFile-outputAsString"></a> **ZipFile::outputAsString** - выводит ZIP-архив в виде строки.
|
723 |
+
```php
|
724 |
+
$rawZipArchiveBytes = $zipFile->outputAsString();
|
725 |
+
```
|
726 |
+
<a name="Documentation-ZipFile-outputAsAttachment"></a> **ZipFile::outputAsAttachment** - выводит ZIP-архив в браузер.
|
727 |
+
|
728 |
+
При выводе устанавливаются необходимые заголовки, а после вывода завершается работа скрипта.
|
729 |
+
```php
|
730 |
+
$zipFile->outputAsAttachment($outputFilename);
|
731 |
+
```
|
732 |
+
Можно установить MIME-тип:
|
733 |
+
```php
|
734 |
+
$mimeType = 'application/zip'
|
735 |
+
$zipFile->outputAsAttachment($outputFilename, $mimeType);
|
736 |
+
```
|
737 |
+
<a name="Documentation-ZipFile-outputAsResponse"></a> **ZipFile::outputAsResponse** - выводит ZIP-архив, как Response [PSR-7](http://www.php-fig.org/psr/psr-7/).
|
738 |
+
|
739 |
+
Метод вывода может использоваться в любом PSR-7 совместимом фреймворке.
|
740 |
+
```php
|
741 |
+
// $response = ....; // instance Psr\Http\Message\ResponseInterface
|
742 |
+
$zipFile->outputAsResponse($response, $outputFilename);
|
743 |
+
```
|
744 |
+
Можно установить MIME-тип:
|
745 |
+
```php
|
746 |
+
$mimeType = 'application/zip'
|
747 |
+
$zipFile->outputAsResponse($response, $outputFilename, $mimeType);
|
748 |
+
```
|
749 |
+
Пример для Slim Framework:
|
750 |
+
```php
|
751 |
+
$app = new \Slim\App;
|
752 |
+
$app->get('/download', function ($req, $res, $args) {
|
753 |
+
$zipFile = new \PhpZip\ZipFile();
|
754 |
+
$zipFile['file.txt'] = 'content';
|
755 |
+
return $zipFile->outputAsResponse($res, 'file.zip');
|
756 |
+
});
|
757 |
+
$app->run();
|
758 |
+
```
|
759 |
+
<a name="Documentation-ZipFile-rewrite"></a> **ZipFile::rewrite** - сохраняет изменения и заново открывает изменившийся архив.
|
760 |
+
```php
|
761 |
+
$zipFile->rewrite();
|
762 |
+
```
|
763 |
+
#### <a name="Documentation-Close-Zip-Archive"></a> Закрытие архива
|
764 |
+
<a name="Documentation-ZipFile-close"></a> **ZipFile::close** - закрывает ZIP-архив.
|
765 |
+
```php
|
766 |
+
$zipFile->close();
|
767 |
+
```
|
768 |
+
### <a name="Running-Tests"></a> Запуск тестов
|
769 |
+
Установите зависимости для разработки.
|
770 |
+
```bash
|
771 |
+
composer install --dev
|
772 |
+
```
|
773 |
+
Запустите тесты:
|
774 |
+
```bash
|
775 |
+
vendor/bin/phpunit -v -c phpunit.xml
|
776 |
+
```
|
777 |
+
### <a name="Changelog"></a> История изменений
|
778 |
+
История изменений на [странице релизов](https://github.com/Ne-Lexa/php-zip/releases).
|
779 |
+
|
780 |
+
### <a name="Upgrade"></a> Обновление версий
|
781 |
+
#### <a name="Upgrade-v2-to-v3"></a> Обновление с версии 2 до версии 3.0
|
782 |
+
Обновите мажорную версию в файле `composer.json` до `^3.0`.
|
783 |
+
```json
|
784 |
+
{
|
785 |
+
"require": {
|
786 |
+
"nelexa/zip": "^3.0"
|
787 |
+
}
|
788 |
+
}
|
789 |
+
```
|
790 |
+
Затем установите обновления с помощью `Composer`:
|
791 |
+
```bash
|
792 |
+
composer update nelexa/zip
|
793 |
+
```
|
794 |
+
Обновите ваш код для работы с новой версией:
|
795 |
+
- Класс `ZipOutputFile` объединён с `ZipFile` и удалён.
|
796 |
+
+ Замените `new \PhpZip\ZipOutputFile()` на `new \PhpZip\ZipFile()`
|
797 |
+
- Статичиская инициализация методов стала не статической.
|
798 |
+
+ Замените `\PhpZip\ZipFile::openFromFile($filename);` на `(new \PhpZip\ZipFile())->openFile($filename);`
|
799 |
+
+ Замените `\PhpZip\ZipOutputFile::openFromFile($filename);` на `(new \PhpZip\ZipFile())->openFile($filename);`
|
800 |
+
+ Замените `\PhpZip\ZipFile::openFromString($contents);` на `(new \PhpZip\ZipFile())->openFromString($contents);`
|
801 |
+
+ Замените `\PhpZip\ZipFile::openFromStream($stream);` на `(new \PhpZip\ZipFile())->openFromStream($stream);`
|
802 |
+
+ Замените `\PhpZip\ZipOutputFile::create()` на `new \PhpZip\ZipFile()`
|
803 |
+
+ Замените `\PhpZip\ZipOutputFile::openFromZipFile($zipFile)` на `(new \PhpZip\ZipFile())->openFile($filename);`
|
804 |
+
- Переименуйте методы:
|
805 |
+
+ `addFromFile` в `addFile`
|
806 |
+
+ `setLevel` в `setCompressionLevel`
|
807 |
+
+ `ZipFile::setPassword` в `ZipFile::withReadPassword`
|
808 |
+
+ `ZipOutputFile::setPassword` в `ZipFile::withNewPassword`
|
809 |
+
+ `ZipOutputFile::disableEncryptionAllEntries` в `ZipFile::withoutPassword`
|
810 |
+
+ `ZipOutputFile::setComment` в `ZipFile::setArchiveComment`
|
811 |
+
+ `ZipFile::getComment` в `ZipFile::getArchiveComment`
|
812 |
+
- Изменились сигнатуры для методов `addDir`, `addFilesFromGlob`, `addFilesFromRegex`.
|
813 |
+
- Удалены методы:
|
814 |
+
+ `getLevel`
|
815 |
+
+ `setCompressionMethod`
|
816 |
+
+ `setEntryPassword`
|
library/vendor/nelexa/zip/README.md
ADDED
@@ -0,0 +1,832 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
`PhpZip`
|
2 |
+
========
|
3 |
+
`PhpZip` is a php-library for extended work with ZIP-archives.
|
4 |
+
|
5 |
+
[![Build Status](https://travis-ci.org/Ne-Lexa/php-zip.svg?branch=master)](https://travis-ci.org/Ne-Lexa/php-zip)
|
6 |
+
[![Code Coverage](https://scrutinizer-ci.com/g/Ne-Lexa/php-zip/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/Ne-Lexa/php-zip/?branch=master)
|
7 |
+
[![Latest Stable Version](https://poser.pugx.org/nelexa/zip/v/stable)](https://packagist.org/packages/nelexa/zip)
|
8 |
+
[![Total Downloads](https://poser.pugx.org/nelexa/zip/downloads)](https://packagist.org/packages/nelexa/zip)
|
9 |
+
[![Minimum PHP Version](http://img.shields.io/badge/php-%3E%3D%205.5-8892BF.svg)](https://php.net/)
|
10 |
+
[![License](https://poser.pugx.org/nelexa/zip/license)](https://packagist.org/packages/nelexa/zip)
|
11 |
+
|
12 |
+
[Russian Documentation](README.RU.md)
|
13 |
+
|
14 |
+
Table of contents
|
15 |
+
-----------------
|
16 |
+
- [Features](#Features)
|
17 |
+
- [Requirements](#Requirements)
|
18 |
+
- [Installation](#Installation)
|
19 |
+
- [Examples](#Examples)
|
20 |
+
- [Glossary](#Glossary)
|
21 |
+
- [Documentation](#Documentation)
|
22 |
+
+ [Overview of methods of the class `\PhpZip\ZipFile`](#Documentation-Overview)
|
23 |
+
+ [Creation/Opening of ZIP-archive](#Documentation-Open-Zip-Archive)
|
24 |
+
+ [Reading entries from the archive](#Documentation-Open-Zip-Entries)
|
25 |
+
+ [Iterating entries](#Documentation-Zip-Iterate)
|
26 |
+
+ [Getting information about entries](#Documentation-Zip-Info)
|
27 |
+
+ [Adding entries to the archive](#Documentation-Add-Zip-Entries)
|
28 |
+
+ [Deleting entries from the archive](#Documentation-Remove-Zip-Entries)
|
29 |
+
+ [Working with entries and archive](#Documentation-Entries)
|
30 |
+
+ [Working with passwords](#Documentation-Password)
|
31 |
+
+ [zipalign - alignment tool for Android (APK) files](#Documentation-ZipAlign-Usage)
|
32 |
+
+ [Undo changes](#Documentation-Unchanged)
|
33 |
+
+ [Saving a file or output to a browser](#Documentation-Save-Or-Output-Entries)
|
34 |
+
+ [Closing the archive](#Documentation-Close-Zip-Archive)
|
35 |
+
- [Running the tests](#Running-Tests)
|
36 |
+
- [Changelog](#Changelog)
|
37 |
+
- [Upgrade](#Upgrade)
|
38 |
+
+ [Upgrade version 2 to version 3.0](#Upgrade-v2-to-v3)
|
39 |
+
|
40 |
+
### <a name="Features"></a> Features
|
41 |
+
- Opening and unzipping zip files.
|
42 |
+
- Creating ZIP-archives.
|
43 |
+
- Modifying ZIP archives.
|
44 |
+
- Pure php (not require extension `php-zip` and class `\ZipArchive`).
|
45 |
+
- It supports saving the archive to a file, outputting the archive to the browser, or outputting it as a string without saving it to a file.
|
46 |
+
- Archival comments and comments of individual entry are supported.
|
47 |
+
- Get information about each entry in the archive.
|
48 |
+
- Only the following compression methods are supported:
|
49 |
+
+ No compressed (Stored).
|
50 |
+
+ Deflate compression.
|
51 |
+
+ BZIP2 compression with the extension `php-bz2`.
|
52 |
+
- Support for `ZIP64` (file size is more than 4 GB or the number of entries in the archive is more than 65535).
|
53 |
+
- Built-in support for aligning the archive to optimize Android packages (APK) [`zipalign`](https://developer.android.com/studio/command-line/zipalign.html).
|
54 |
+
- Working with passwords for PHP 5.5
|
55 |
+
> **Attention!**
|
56 |
+
>
|
57 |
+
> For 32-bit systems, the `Traditional PKWARE Encryption (ZipCrypto)` encryption method is not currently supported.
|
58 |
+
> Use the encryption method `WinZIP AES Encryption`, whenever possible.
|
59 |
+
+ Set the password to read the archive for all entries or only for some.
|
60 |
+
+ Change the password for the archive, including for individual entries.
|
61 |
+
+ Delete the archive password for all or individual entries.
|
62 |
+
+ Set the password and/or the encryption method, both for all, and for individual entries in the archive.
|
63 |
+
+ Set different passwords and encryption methods for different entries.
|
64 |
+
+ Delete the password for all or some entries.
|
65 |
+
+ Support `Traditional PKWARE Encryption (ZipCrypto)` and `WinZIP AES Encryption` encryption methods.
|
66 |
+
+ Set the encryption method for all or individual entries in the archive.
|
67 |
+
|
68 |
+
### <a name="Requirements"></a> Requirements
|
69 |
+
- `PHP` >= 5.5 (preferably 64-bit).
|
70 |
+
- Optional php-extension `bzip2` for BZIP2 compression.
|
71 |
+
- Optional php-extension `openssl` or `mcrypt` for `WinZip Aes Encryption` support.
|
72 |
+
|
73 |
+
### <a name="Installation"></a> Installation
|
74 |
+
`composer require nelexa/zip`
|
75 |
+
|
76 |
+
Latest stable version: [![Latest Stable Version](https://poser.pugx.org/nelexa/zip/v/stable)](https://packagist.org/packages/nelexa/zip)
|
77 |
+
|
78 |
+
### <a name="Examples"></a> Examples
|
79 |
+
```php
|
80 |
+
// create new archive
|
81 |
+
$zipFile = new \PhpZip\ZipFile();
|
82 |
+
try{
|
83 |
+
$zipFile
|
84 |
+
->addFromString('zip/entry/filename', 'Is file content') // add an entry from the string
|
85 |
+
->addFile('/path/to/file', 'data/tofile') // add an entry from the file
|
86 |
+
->addDir(__DIR__, 'to/path/') // add files from the directory
|
87 |
+
->saveAsFile($outputFilename) // save the archive to a file
|
88 |
+
->close(); // close archive
|
89 |
+
|
90 |
+
// open archive, extract, add files, set password and output to browser.
|
91 |
+
$zipFile
|
92 |
+
->openFile($outputFilename) // open archive from file
|
93 |
+
->extractTo($outputDirExtract) // extract files to the specified directory
|
94 |
+
->deleteFromRegex('~^\.~') // delete all hidden (Unix) files
|
95 |
+
->addFromString('dir/file.txt', 'Test file') // add a new entry from the string
|
96 |
+
->setPassword('password') // set password for all entries
|
97 |
+
->outputAsAttachment('library.jar'); // output to the browser without saving to a file
|
98 |
+
}
|
99 |
+
catch(\PhpZip\Exception\ZipException $e){
|
100 |
+
// handle exception
|
101 |
+
}
|
102 |
+
finally{
|
103 |
+
$zipFile->close();
|
104 |
+
}
|
105 |
+
```
|
106 |
+
Other examples can be found in the `tests/` folder
|
107 |
+
|
108 |
+
### <a name="Glossary"></a> Glossary
|
109 |
+
**Zip Entry** - file or folder in a ZIP-archive. Each entry in the archive has certain properties, for example: file name, compression method, encryption method, file size before compression, file size after compression, CRC32 and others.
|
110 |
+
|
111 |
+
### <a name="Documentation"></a> Documentation:
|
112 |
+
#### <a name="Documentation-Overview"></a> Overview of methods of the class `\PhpZip\ZipFile`
|
113 |
+
- [ZipFile::__construct](#Documentation-ZipFile-__construct) - initializes the ZIP archive.
|
114 |
+
- [ZipFile::addAll](#Documentation-ZipFile-addAll) - adds all entries from an array.
|
115 |
+
- [ZipFile::addDir](#Documentation-ZipFile-addDir) - adds files to the archive from the directory on the specified path without subdirectories.
|
116 |
+
- [ZipFile::addDirRecursive](#Documentation-ZipFile-addDirRecursive) - adds files to the archive from the directory on the specified path with subdirectories.
|
117 |
+
- [ZipFile::addEmptyDir](#Documentation-ZipFile-addEmptyDir) - add a new directory.
|
118 |
+
- [ZipFile::addFile](#Documentation-ZipFile-addFile) - adds a file to a ZIP archive from the given path.
|
119 |
+
- [ZipFile::addSplFile](#Documentation-ZipFile-addSplFile) - adds a `\SplFileInfo` to a ZIP archive.
|
120 |
+
- [ZipFile::addFromFinder](#Documentation-ZipFile-addFromFinder) - adds files from the `Symfony\Component\Finder\Finder` to a ZIP archive.
|
121 |
+
- [ZipFile::addFilesFromIterator](#Documentation-ZipFile-addFilesFromIterator) - adds files from the iterator of directories.
|
122 |
+
- [ZipFile::addFilesFromGlob](#Documentation-ZipFile-addFilesFromGlob) - adds files from a directory by glob pattern without subdirectories.
|
123 |
+
- [ZipFile::addFilesFromGlobRecursive](#Documentation-ZipFile-addFilesFromGlobRecursive) - adds files from a directory by glob pattern with subdirectories.
|
124 |
+
- [ZipFile::addFilesFromRegex](#Documentation-ZipFile-addFilesFromRegex) - adds files from a directory by PCRE pattern without subdirectories.
|
125 |
+
- [ZipFile::addFilesFromRegexRecursive](#Documentation-ZipFile-addFilesFromRegexRecursive) - adds files from a directory by PCRE pattern with subdirectories.
|
126 |
+
- [ZipFile::addFromStream](#Documentation-ZipFile-addFromStream) - adds a entry from the stream to the ZIP archive.
|
127 |
+
- [ZipFile::addFromString](#Documentation-ZipFile-addFromString) - adds a file to a ZIP archive using its contents.
|
128 |
+
- [ZipFile::close](#Documentation-ZipFile-close) - close the archive.
|
129 |
+
- [ZipFile::count](#Documentation-ZipFile-count) - returns the number of entries in the archive.
|
130 |
+
- [ZipFile::deleteFromName](#Documentation-ZipFile-deleteFromName) - deletes an entry in the archive using its name.
|
131 |
+
- [ZipFile::deleteFromGlob](#Documentation-ZipFile-deleteFromGlob) - deletes a entries in the archive using glob pattern.
|
132 |
+
- [ZipFile::deleteFromRegex](#Documentation-ZipFile-deleteFromRegex) - deletes a entries in the archive using PCRE pattern.
|
133 |
+
- [ZipFile::deleteAll](#Documentation-ZipFile-deleteAll) - deletes all entries in the ZIP archive.
|
134 |
+
- [ZipFile::disableEncryption](#Documentation-ZipFile-disableEncryption) - disable encryption for all entries that are already in the archive.
|
135 |
+
- [ZipFile::disableEncryptionEntry](#Documentation-ZipFile-disableEncryptionEntry) - disable encryption of an entry defined by its name.
|
136 |
+
- [ZipFile::extractTo](#Documentation-ZipFile-extractTo) - extract the archive contents.
|
137 |
+
- [ZipFile::getAllInfo](#Documentation-ZipFile-getAllInfo) - returns detailed information about all entries in the archive.
|
138 |
+
- [ZipFile::getArchiveComment](#Documentation-ZipFile-getArchiveComment) - returns the Zip archive comment.
|
139 |
+
- [ZipFile::getEntryComment](#Documentation-ZipFile-getEntryComment) - returns the comment of an entry using the entry name.
|
140 |
+
- [ZipFile::getEntryContent](#Documentation-ZipFile-getEntryContent) - returns the entry contents using its name.
|
141 |
+
- [ZipFile::getEntryInfo](#Documentation-ZipFile-getEntryInfo) - returns detailed information about the entry in the archive.
|
142 |
+
- [ZipFile::getListFiles](#Documentation-ZipFile-getListFiles) - returns list of archive files.
|
143 |
+
- [ZipFile::hasEntry](#Documentation-ZipFile-hasEntry) - checks if there is an entry in the archive.
|
144 |
+
- [ZipFile::isDirectory](#Documentation-ZipFile-isDirectory) - checks that the entry in the archive is a directory.
|
145 |
+
- [ZipFile::matcher](#Documentation-ZipFile-matcher) - selecting entries in the archive to perform operations on them.
|
146 |
+
- [ZipFile::openFile](#Documentation-ZipFile-openFile) - opens a zip-archive from a file.
|
147 |
+
- [ZipFile::openFromString](#Documentation-ZipFile-openFromString) - opens a zip-archive from a string.
|
148 |
+
- [ZipFile::openFromStream](#Documentation-ZipFile-openFromStream) - opens a zip-archive from the stream.
|
149 |
+
- [ZipFile::outputAsAttachment](#Documentation-ZipFile-outputAsAttachment) - outputs a ZIP-archive to the browser.
|
150 |
+
- [ZipFile::outputAsResponse](#Documentation-ZipFile-outputAsResponse) - outputs a ZIP-archive as PSR-7 Response.
|
151 |
+
- [ZipFile::outputAsString](#Documentation-ZipFile-outputAsString) - outputs a ZIP-archive as string.
|
152 |
+
- [ZipFile::rename](#Documentation-ZipFile-rename) - renames an entry defined by its name.
|
153 |
+
- [ZipFile::rewrite](#Documentation-ZipFile-rewrite) - save changes and re-open the changed archive.
|
154 |
+
- [ZipFile::saveAsFile](#Documentation-ZipFile-saveAsFile) - saves the archive to a file.
|
155 |
+
- [ZipFile::saveAsStream](#Documentation-ZipFile-saveAsStream) - writes the archive to the stream.
|
156 |
+
- [ZipFile::setArchiveComment](#Documentation-ZipFile-setArchiveComment) - set the comment of a ZIP archive.
|
157 |
+
- [ZipFile::setCompressionLevel](#Documentation-ZipFile-setCompressionLevel) - set the compression level for all files in the archive.
|
158 |
+
- [ZipFile::setCompressionLevelEntry](#Documentation-ZipFile-setCompressionLevelEntry) - sets the compression level for the entry by its name.
|
159 |
+
- [ZipFile::setCompressionMethodEntry](#Documentation-ZipFile-setCompressionMethodEntry) - sets the compression method for the entry by its name.
|
160 |
+
- [ZipFile::setEntryComment](#Documentation-ZipFile-setEntryComment) - set the comment of an entry defined by its name.
|
161 |
+
- [ZipFile::setReadPassword](#Documentation-ZipFile-setReadPassword) - set the password for the open archive.
|
162 |
+
- [ZipFile::setReadPasswordEntry](#Documentation-ZipFile-setReadPasswordEntry) - sets a password for reading of an entry defined by its name.
|
163 |
+
- ~~ZipFile::withNewPassword~~ - is an deprecated method, use the [ZipFile::setPassword](#Documentation-ZipFile-setPassword) method.
|
164 |
+
- [ZipFile::setPassword](#Documentation-ZipFile-setPassword) - sets a new password for all files in the archive.
|
165 |
+
- [ZipFile::setPasswordEntry](#Documentation-ZipFile-setPasswordEntry) - sets a new password of an entry defined by its name.
|
166 |
+
- [ZipFile::setZipAlign](#Documentation-ZipFile-setZipAlign) - sets the alignment of the archive to optimize APK files (Android packages).
|
167 |
+
- [ZipFile::unchangeAll](#Documentation-ZipFile-unchangeAll) - undo all changes done in the archive.
|
168 |
+
- [ZipFile::unchangeArchiveComment](#Documentation-ZipFile-unchangeArchiveComment) - undo changes to the archive comment.
|
169 |
+
- [ZipFile::unchangeEntry](#Documentation-ZipFile-unchangeEntry) - undo changes of an entry defined by its name.
|
170 |
+
- ~~ZipFile::withoutPassword~~ - is an deprecated method, use the [ZipFile::disableEncryption](#Documentation-ZipFile-disableEncryption) method.
|
171 |
+
- ~~ZipFile::withReadPassword~~ - is an deprecated method, use the [ZipFile::setReadPassword](#Documentation-ZipFile-setReadPassword) method.
|
172 |
+
|
173 |
+
#### <a name="Documentation-Open-Zip-Archive"></a> Creation/Opening of ZIP-archive
|
174 |
+
<a name="Documentation-ZipFile-__construct"></a>**ZipFile::__construct** - initializes the ZIP archive.
|
175 |
+
```php
|
176 |
+
$zipFile = new \PhpZip\ZipFile();
|
177 |
+
```
|
178 |
+
<a name="Documentation-ZipFile-openFile"></a> **ZipFile::openFile** - opens a zip-archive from a file.
|
179 |
+
```php
|
180 |
+
$zipFile = new \PhpZip\ZipFile();
|
181 |
+
$zipFile->openFile('file.zip');
|
182 |
+
```
|
183 |
+
<a name="Documentation-ZipFile-openFromString"></a> **ZipFile::openFromString** - opens a zip-archive from a string.
|
184 |
+
```php
|
185 |
+
$zipFile = new \PhpZip\ZipFile();
|
186 |
+
$zipFile->openFromString($stringContents);
|
187 |
+
```
|
188 |
+
<a name="Documentation-ZipFile-openFromStream"></a> **ZipFile::openFromStream** - opens a zip-archive from the stream.
|
189 |
+
```php
|
190 |
+
$stream = fopen('file.zip', 'rb');
|
191 |
+
|
192 |
+
$zipFile = new \PhpZip\ZipFile();
|
193 |
+
$zipFile->openFromStream($stream);
|
194 |
+
```
|
195 |
+
#### <a name="Documentation-Open-Zip-Entries"></a> Reading entries from the archive
|
196 |
+
<a name="Documentation-ZipFile-count"></a> **ZipFile::count** - returns the number of entries in the archive.
|
197 |
+
```php
|
198 |
+
$zipFile = new \PhpZip\ZipFile();
|
199 |
+
|
200 |
+
$count = count($zipFile);
|
201 |
+
// or
|
202 |
+
$count = $zipFile->count();
|
203 |
+
```
|
204 |
+
<a name="Documentation-ZipFile-getListFiles"></a> **ZipFile::getListFiles** - returns list of archive files.
|
205 |
+
```php
|
206 |
+
$zipFile = new \PhpZip\ZipFile();
|
207 |
+
$listFiles = $zipFile->getListFiles();
|
208 |
+
|
209 |
+
// example array contents:
|
210 |
+
// array (
|
211 |
+
// 0 => 'info.txt',
|
212 |
+
// 1 => 'path/to/file.jpg',
|
213 |
+
// 2 => 'another path/',
|
214 |
+
// 3 => '0',
|
215 |
+
// )
|
216 |
+
```
|
217 |
+
<a name="Documentation-ZipFile-getEntryContent"></a> **ZipFile::getEntryContent** - returns the entry contents using its name.
|
218 |
+
```php
|
219 |
+
// $entryName = 'path/to/example-entry-name.txt';
|
220 |
+
$zipFile = new \PhpZip\ZipFile();
|
221 |
+
|
222 |
+
$contents = $zipFile[$entryName];
|
223 |
+
// or
|
224 |
+
$contents = $zipFile->getEntryContents($entryName);
|
225 |
+
```
|
226 |
+
<a name="Documentation-ZipFile-hasEntry"></a> **ZipFile::hasEntry** - checks if there is an entry in the archive.
|
227 |
+
```php
|
228 |
+
// $entryName = 'path/to/example-entry-name.txt';
|
229 |
+
$zipFile = new \PhpZip\ZipFile();
|
230 |
+
|
231 |
+
$hasEntry = isset($zipFile[$entryName]);
|
232 |
+
// or
|
233 |
+
$hasEntry = $zipFile->hasEntry($entryName);
|
234 |
+
```
|
235 |
+
<a name="Documentation-ZipFile-isDirectory"></a> **ZipFile::isDirectory** - checks that the entry in the archive is a directory.
|
236 |
+
```php
|
237 |
+
// $entryName = 'path/to/';
|
238 |
+
$zipFile = new \PhpZip\ZipFile();
|
239 |
+
|
240 |
+
$isDirectory = $zipFile->isDirectory($entryName);
|
241 |
+
```
|
242 |
+
<a name="Documentation-ZipFile-extractTo"></a> **ZipFile::extractTo** - extract the archive contents.
|
243 |
+
The directory must exist.
|
244 |
+
```php
|
245 |
+
$zipFile = new \PhpZip\ZipFile();
|
246 |
+
$zipFile->extractTo($directory);
|
247 |
+
```
|
248 |
+
Extract some files to the directory.
|
249 |
+
The directory must exist.
|
250 |
+
```php
|
251 |
+
// $toDirectory = '/tmp';
|
252 |
+
$extractOnlyFiles = [
|
253 |
+
'filename1',
|
254 |
+
'filename2',
|
255 |
+
'dir/dir/dir/'
|
256 |
+
];
|
257 |
+
$zipFile = new \PhpZip\ZipFile();
|
258 |
+
$zipFile->extractTo($toDirectory, $extractOnlyFiles);
|
259 |
+
```
|
260 |
+
#### <a name="Documentation-Zip-Iterate"></a> Iterating entries
|
261 |
+
`ZipFile` is an iterator.
|
262 |
+
Can iterate all the entries in the `foreach` loop.
|
263 |
+
```php
|
264 |
+
foreach($zipFile as $entryName => $contents){
|
265 |
+
echo "Filename: $entryName" . PHP_EOL;
|
266 |
+
echo "Contents: $contents" . PHP_EOL;
|
267 |
+
echo '-----------------------------' . PHP_EOL;
|
268 |
+
}
|
269 |
+
```
|
270 |
+
Can iterate through the `Iterator`.
|
271 |
+
```php
|
272 |
+
$iterator = new \ArrayIterator($zipFile);
|
273 |
+
while ($iterator->valid())
|
274 |
+
{
|
275 |
+
$entryName = $iterator->key();
|
276 |
+
$contents = $iterator->current();
|
277 |
+
|
278 |
+
echo "Filename: $entryName" . PHP_EOL;
|
279 |
+
echo "Contents: $contents" . PHP_EOL;
|
280 |
+
echo '-----------------------------' . PHP_EOL;
|
281 |
+
|
282 |
+
$iterator->next();
|
283 |
+
}
|
284 |
+
```
|
285 |
+
#### <a name="Documentation-Zip-Info"></a> Getting information about entries
|
286 |
+
<a name="Documentation-ZipFile-getArchiveComment"></a> **ZipFile::getArchiveComment** - returns the Zip archive comment.
|
287 |
+
```php
|
288 |
+
$zipFile = new \PhpZip\ZipFile();
|
289 |
+
$commentArchive = $zipFile->getArchiveComment();
|
290 |
+
```
|
291 |
+
<a name="Documentation-ZipFile-getEntryComment"></a> **ZipFile::getEntryComment** - returns the comment of an entry using the entry name.
|
292 |
+
```php
|
293 |
+
$zipFile = new \PhpZip\ZipFile();
|
294 |
+
$commentEntry = $zipFile->getEntryComment($entryName);
|
295 |
+
```
|
296 |
+
<a name="Documentation-ZipFile-getEntryInfo"></a> **ZipFile::getEntryInfo** - returns detailed information about the entry in the archive
|
297 |
+
```php
|
298 |
+
$zipFile = new \PhpZip\ZipFile();
|
299 |
+
$zipInfo = $zipFile->getEntryInfo('file.txt');
|
300 |
+
```
|
301 |
+
<a name="Documentation-ZipFile-getAllInfo"></a> **ZipFile::getAllInfo** - returns detailed information about all entries in the archive.
|
302 |
+
```php
|
303 |
+
$zipAllInfo = $zipFile->getAllInfo();
|
304 |
+
```
|
305 |
+
#### <a name="Documentation-Add-Zip-Entries"></a> Adding entries to the archive
|
306 |
+
|
307 |
+
All methods of adding entries to a ZIP archive allow you to specify a method for compressing content.
|
308 |
+
|
309 |
+
The following methods of compression are available:
|
310 |
+
- `\PhpZip\Constants\ZipCompressionMethod::STORED` - no compression
|
311 |
+
- `\PhpZip\Constants\ZipCompressionMethod::DEFLATED` - Deflate compression
|
312 |
+
- `\PhpZip\Constants\ZipCompressionMethod::BZIP2` - Bzip2 compression with the extension `ext-bz2`
|
313 |
+
|
314 |
+
<a name="Documentation-ZipFile-addFile"></a> **ZipFile::addFile** - adds a file to a ZIP archive from the given path.
|
315 |
+
```php
|
316 |
+
$zipFile = new \PhpZip\ZipFile();
|
317 |
+
// $file = '...../file.ext';
|
318 |
+
// $entryName = 'file2.ext'
|
319 |
+
$zipFile->addFile($file);
|
320 |
+
|
321 |
+
// you can specify the name of the entry in the archive (if null, then the last component from the file name is used)
|
322 |
+
$zipFile->addFile($file, $entryName);
|
323 |
+
|
324 |
+
// you can specify a compression method
|
325 |
+
$zipFile->addFile($file, $entryName, \PhpZip\Constants\ZipCompressionMethod::STORED); // No compression
|
326 |
+
$zipFile->addFile($file, $entryName, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate compression
|
327 |
+
$zipFile->addFile($file, $entryName, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 compression
|
328 |
+
```
|
329 |
+
<a name="Documentation-ZipFile-addSplFile"></a>
|
330 |
+
**ZipFile::addSplFile"** - adds a `\SplFileInfo` to a ZIP archive.
|
331 |
+
```php
|
332 |
+
// $file = '...../file.ext';
|
333 |
+
// $entryName = 'file2.ext'
|
334 |
+
$zipFile = new \PhpZip\ZipFile();
|
335 |
+
|
336 |
+
$splFile = new \SplFileInfo('README.md');
|
337 |
+
|
338 |
+
$zipFile->addSplFile($splFile);
|
339 |
+
$zipFile->addSplFile($splFile, $entryName);
|
340 |
+
// or
|
341 |
+
$zipFile[$entryName] = new \SplFileInfo($file);
|
342 |
+
|
343 |
+
// set compression method
|
344 |
+
$zipFile->addSplFile($splFile, $entryName, $options = [
|
345 |
+
\PhpZip\Constants\ZipOptions::COMPRESSION_METHOD => \PhpZip\Constants\ZipCompressionMethod::DEFLATED,
|
346 |
+
]);
|
347 |
+
```
|
348 |
+
<a name="Documentation-ZipFile-addFromFinder"></a>
|
349 |
+
**ZipFile::addFromFinder"** - adds files from the `Symfony\Component\Finder\Finder` to a ZIP archive.
|
350 |
+
https://symfony.com/doc/current/components/finder.html
|
351 |
+
```php
|
352 |
+
$finder = new \Symfony\Component\Finder\Finder();
|
353 |
+
$finder
|
354 |
+
->files()
|
355 |
+
->name('*.{jpg,jpeg,gif,png}')
|
356 |
+
->name('/^[0-9a-f]\./')
|
357 |
+
->contains('/lorem\s+ipsum$/i')
|
358 |
+
->in('path');
|
359 |
+
|
360 |
+
$zipFile = new \PhpZip\ZipFile();
|
361 |
+
$zipFile->addFromFinder($finder, $options = [
|
362 |
+
\PhpZip\Constants\ZipOptions::COMPRESSION_METHOD => \PhpZip\Constants\ZipCompressionMethod::DEFLATED,
|
363 |
+
\PhpZip\Constants\ZipOptions::MODIFIED_TIME => new \DateTimeImmutable('-1 day 5 min')
|
364 |
+
]);
|
365 |
+
```
|
366 |
+
<a name="Documentation-ZipFile-addFromString"></a> **ZipFile::addFromString** - adds a file to a ZIP archive using its contents.
|
367 |
+
```php
|
368 |
+
$zipFile = new \PhpZip\ZipFile();
|
369 |
+
|
370 |
+
$zipFile[$entryName] = $contents;
|
371 |
+
// or
|
372 |
+
$zipFile->addFromString($entryName, $contents);
|
373 |
+
|
374 |
+
// you can specify a compression method
|
375 |
+
$zipFile->addFromString($entryName, $contents, \PhpZip\Constants\ZipCompressionMethod::STORED); // No compression
|
376 |
+
$zipFile->addFromString($entryName, $contents, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate compression
|
377 |
+
$zipFile->addFromString($entryName, $contents, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 compression
|
378 |
+
```
|
379 |
+
<a name="Documentation-ZipFile-addFromStream"></a> **ZipFile::addFromStream** - adds a entry from the stream to the ZIP archive.
|
380 |
+
```php
|
381 |
+
$zipFile = new \PhpZip\ZipFile();
|
382 |
+
// $stream = fopen(..., 'rb');
|
383 |
+
|
384 |
+
$zipFile->addFromStream($stream, $entryName);
|
385 |
+
// or
|
386 |
+
$zipFile[$entryName] = $stream;
|
387 |
+
|
388 |
+
// you can specify a compression method
|
389 |
+
$zipFile->addFromStream($stream, $entryName, \PhpZip\Constants\ZipCompressionMethod::STORED); // No compression
|
390 |
+
$zipFile->addFromStream($stream, $entryName, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate compression
|
391 |
+
$zipFile->addFromStream($stream, $entryName, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 compression
|
392 |
+
```
|
393 |
+
<a name="Documentation-ZipFile-addEmptyDir"></a> **ZipFile::addEmptyDir** - add a new directory.
|
394 |
+
```php
|
395 |
+
$zipFile = new \PhpZip\ZipFile();
|
396 |
+
// $path = "path/to/";
|
397 |
+
$zipFile->addEmptyDir($path);
|
398 |
+
// or
|
399 |
+
$zipFile[$path] = null;
|
400 |
+
```
|
401 |
+
<a name="Documentation-ZipFile-addAll"></a> **ZipFile::addAll** - adds all entries from an array.
|
402 |
+
```php
|
403 |
+
$entries = [
|
404 |
+
'file.txt' => 'file contents', // add an entry from the string contents
|
405 |
+
'empty dir/' => null, // add empty directory
|
406 |
+
'path/to/file.jpg' => fopen('..../filename', 'rb'), // add an entry from the stream
|
407 |
+
'path/to/file.dat' => new \SplFileInfo('..../filename'), // add an entry from the file
|
408 |
+
];
|
409 |
+
|
410 |
+
$zipFile = new \PhpZip\ZipFile();
|
411 |
+
$zipFile->addAll($entries);
|
412 |
+
```
|
413 |
+
<a name="Documentation-ZipFile-addDir"></a> **ZipFile::addDir** - adds files to the archive from the directory on the specified path without subdirectories.
|
414 |
+
```php
|
415 |
+
$zipFile = new \PhpZip\ZipFile();
|
416 |
+
$zipFile->addDir($dirName);
|
417 |
+
|
418 |
+
// you can specify the path in the archive to which you want to put entries
|
419 |
+
$localPath = 'to/path/';
|
420 |
+
$zipFile->addDir($dirName, $localPath);
|
421 |
+
|
422 |
+
// you can specify a compression method
|
423 |
+
$zipFile->addDir($dirName, $localPath, \PhpZip\Constants\ZipCompressionMethod::STORED); // No compression
|
424 |
+
$zipFile->addDir($dirName, $localPath, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate compression
|
425 |
+
$zipFile->addDir($dirName, $localPath, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 compression
|
426 |
+
```
|
427 |
+
<a name="Documentation-ZipFile-addDirRecursive"></a> **ZipFile::addDirRecursive** - adds files to the archive from the directory on the specified path with subdirectories.
|
428 |
+
```php
|
429 |
+
$zipFile = new \PhpZip\ZipFile();
|
430 |
+
$zipFile->addDirRecursive($dirName);
|
431 |
+
|
432 |
+
// you can specify the path in the archive to which you want to put entries
|
433 |
+
$localPath = 'to/path/';
|
434 |
+
$zipFile->addDirRecursive($dirName, $localPath);
|
435 |
+
|
436 |
+
// you can specify a compression method
|
437 |
+
$zipFile->addDirRecursive($dirName, $localPath, \PhpZip\Constants\ZipCompressionMethod::STORED); // No compression
|
438 |
+
$zipFile->addDirRecursive($dirName, $localPath, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate compression
|
439 |
+
$zipFile->addDirRecursive($dirName, $localPath, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 compression
|
440 |
+
```
|
441 |
+
<a name="Documentation-ZipFile-addFilesFromIterator"></a> **ZipFile::addFilesFromIterator** - adds files from the iterator of directories.
|
442 |
+
```php
|
443 |
+
// $directoryIterator = new \DirectoryIterator($dir); // without subdirectories
|
444 |
+
// $directoryIterator = new \RecursiveDirectoryIterator($dir); // with subdirectories
|
445 |
+
$zipFile = new \PhpZip\ZipFile();
|
446 |
+
$zipFile->addFilesFromIterator($directoryIterator);
|
447 |
+
|
448 |
+
// you can specify the path in the archive to which you want to put entries
|
449 |
+
$localPath = 'to/path/';
|
450 |
+
$zipFile->addFilesFromIterator($directoryIterator, $localPath);
|
451 |
+
// or
|
452 |
+
$zipFile[$localPath] = $directoryIterator;
|
453 |
+
|
454 |
+
// you can specify a compression method
|
455 |
+
$zipFile->addFilesFromIterator($directoryIterator, $localPath, \PhpZip\Constants\ZipCompressionMethod::STORED); // No compression
|
456 |
+
$zipFile->addFilesFromIterator($directoryIterator, $localPath, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate compression
|
457 |
+
$zipFile->addFilesFromIterator($directoryIterator, $localPath, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 compression
|
458 |
+
```
|
459 |
+
Example with some files ignoring:
|
460 |
+
```php
|
461 |
+
$ignoreFiles = [
|
462 |
+
'file_ignore.txt',
|
463 |
+
'dir_ignore/sub dir ignore/'
|
464 |
+
];
|
465 |
+
|
466 |
+
// $directoryIterator = new \DirectoryIterator($dir); // without subdirectories
|
467 |
+
// $directoryIterator = new \RecursiveDirectoryIterator($dir); // with subdirectories
|
468 |
+
// use \PhpZip\Util\Iterator\IgnoreFilesFilterIterator for non-recursive search
|
469 |
+
|
470 |
+
$zipFile = new \PhpZip\ZipFile();
|
471 |
+
$ignoreIterator = new \PhpZip\Util\Iterator\IgnoreFilesRecursiveFilterIterator(
|
472 |
+
$directoryIterator,
|
473 |
+
$ignoreFiles
|
474 |
+
);
|
475 |
+
|
476 |
+
$zipFile->addFilesFromIterator($ignoreIterator);
|
477 |
+
```
|
478 |
+
<a name="Documentation-ZipFile-addFilesFromGlob"></a> **ZipFile::addFilesFromGlob** - adds files from a directory by [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)) without subdirectories.
|
479 |
+
```php
|
480 |
+
$globPattern = '**.{jpg,jpeg,png,gif}'; // example glob pattern -> add all .jpg, .jpeg, .png and .gif files
|
481 |
+
|
482 |
+
$zipFile = new \PhpZip\ZipFile();
|
483 |
+
$zipFile->addFilesFromGlob($dir, $globPattern);
|
484 |
+
|
485 |
+
// you can specify the path in the archive to which you want to put entries
|
486 |
+
$localPath = 'to/path/';
|
487 |
+
$zipFile->addFilesFromGlob($dir, $globPattern, $localPath);
|
488 |
+
|
489 |
+
// you can specify a compression method
|
490 |
+
$zipFile->addFilesFromGlob($dir, $globPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::STORED); // No compression
|
491 |
+
$zipFile->addFilesFromGlob($dir, $globPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate compression
|
492 |
+
$zipFile->addFilesFromGlob($dir, $globPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 compression
|
493 |
+
```
|
494 |
+
<a name="Documentation-ZipFile-addFilesFromGlobRecursive"></a> **ZipFile::addFilesFromGlobRecursive** - adds files from a directory by [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)) with subdirectories.
|
495 |
+
```php
|
496 |
+
$globPattern = '**.{jpg,jpeg,png,gif}'; // example glob pattern -> add all .jpg, .jpeg, .png and .gif files
|
497 |
+
|
498 |
+
$zipFile = new \PhpZip\ZipFile();
|
499 |
+
$zipFile->addFilesFromGlobRecursive($dir, $globPattern);
|
500 |
+
|
501 |
+
// you can specify the path in the archive to which you want to put entries
|
502 |
+
$localPath = 'to/path/';
|
503 |
+
$zipFile->addFilesFromGlobRecursive($dir, $globPattern, $localPath);
|
504 |
+
|
505 |
+
// you can specify a compression method
|
506 |
+
$zipFile->addFilesFromGlobRecursive($dir, $globPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::STORED); // No compression
|
507 |
+
$zipFile->addFilesFromGlobRecursive($dir, $globPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate compression
|
508 |
+
$zipFile->addFilesFromGlobRecursive($dir, $globPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 compression
|
509 |
+
```
|
510 |
+
<a name="Documentation-ZipFile-addFilesFromRegex"></a> **ZipFile::addFilesFromRegex** - adds files from a directory by [PCRE pattern](https://en.wikipedia.org/wiki/Regular_expression) without subdirectories.
|
511 |
+
```php
|
512 |
+
$regexPattern = '/\.(jpe?g|png|gif)$/si'; // example regex pattern -> add all .jpg, .jpeg, .png and .gif files
|
513 |
+
|
514 |
+
$zipFile = new \PhpZip\ZipFile();
|
515 |
+
$zipFile->addFilesFromRegex($dir, $regexPattern);
|
516 |
+
|
517 |
+
// you can specify the path in the archive to which you want to put entries
|
518 |
+
$localPath = 'to/path/';
|
519 |
+
$zipFile->addFilesFromRegex($dir, $regexPattern, $localPath);
|
520 |
+
|
521 |
+
// you can specify a compression method
|
522 |
+
$zipFile->addFilesFromRegex($dir, $regexPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::STORED); // No compression
|
523 |
+
$zipFile->addFilesFromRegex($dir, $regexPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate compression
|
524 |
+
$zipFile->addFilesFromRegex($dir, $regexPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 compression
|
525 |
+
```
|
526 |
+
<a name="Documentation-ZipFile-addFilesFromRegexRecursive"></a> **ZipFile::addFilesFromRegexRecursive** - adds files from a directory by [PCRE pattern](https://en.wikipedia.org/wiki/Regular_expression) with subdirectories.
|
527 |
+
```php
|
528 |
+
$regexPattern = '/\.(jpe?g|png|gif)$/si'; // example regex pattern -> add all .jpg, .jpeg, .png and .gif files
|
529 |
+
|
530 |
+
|
531 |
+
$zipFile->addFilesFromRegexRecursive($dir, $regexPattern);
|
532 |
+
|
533 |
+
// you can specify the path in the archive to which you want to put entries
|
534 |
+
$localPath = 'to/path/';
|
535 |
+
$zipFile->addFilesFromRegexRecursive($dir, $regexPattern, $localPath);
|
536 |
+
|
537 |
+
// you can specify a compression method
|
538 |
+
$zipFile->addFilesFromRegexRecursive($dir, $regexPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::STORED); // No compression
|
539 |
+
$zipFile->addFilesFromRegexRecursive($dir, $regexPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate compression
|
540 |
+
$zipFile->addFilesFromRegexRecursive($dir, $regexPattern, $localPath, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 compression
|
541 |
+
```
|
542 |
+
#### <a name="Documentation-Remove-Zip-Entries"></a> Deleting entries from the archive
|
543 |
+
<a name="Documentation-ZipFile-deleteFromName"></a> **ZipFile::deleteFromName** - deletes an entry in the archive using its name.
|
544 |
+
```php
|
545 |
+
$zipFile = new \PhpZip\ZipFile();
|
546 |
+
$zipFile->deleteFromName($entryName);
|
547 |
+
```
|
548 |
+
<a name="Documentation-ZipFile-deleteFromGlob"></a> **ZipFile::deleteFromGlob** - deletes a entries in the archive using [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)).
|
549 |
+
```php
|
550 |
+
$globPattern = '**.{jpg,jpeg,png,gif}'; // example glob pattern -> delete all .jpg, .jpeg, .png and .gif files
|
551 |
+
|
552 |
+
$zipFile = new \PhpZip\ZipFile();
|
553 |
+
$zipFile->deleteFromGlob($globPattern);
|
554 |
+
```
|
555 |
+
<a name="Documentation-ZipFile-deleteFromRegex"></a> **ZipFile::deleteFromRegex** - deletes a entries in the archive using [PCRE pattern](https://en.wikipedia.org/wiki/Regular_expression).
|
556 |
+
```php
|
557 |
+
$regexPattern = '/\.(jpe?g|png|gif)$/si'; // example regex pattern -> delete all .jpg, .jpeg, .png and .gif files
|
558 |
+
|
559 |
+
$zipFile = new \PhpZip\ZipFile();
|
560 |
+
$zipFile->deleteFromRegex($regexPattern);
|
561 |
+
```
|
562 |
+
<a name="Documentation-ZipFile-deleteAll"></a> **ZipFile::deleteAll** - deletes all entries in the ZIP archive.
|
563 |
+
```php
|
564 |
+
$zipFile = new \PhpZip\ZipFile();
|
565 |
+
$zipFile->deleteAll();
|
566 |
+
```
|
567 |
+
#### <a name="Documentation-Entries"></a> Working with entries and archive
|
568 |
+
<a name="Documentation-ZipFile-rename"></a> **ZipFile::rename** - renames an entry defined by its name.
|
569 |
+
```php
|
570 |
+
$zipFile = new \PhpZip\ZipFile();
|
571 |
+
$zipFile->rename($oldName, $newName);
|
572 |
+
```
|
573 |
+
<a name="Documentation-ZipFile-setCompressionLevel"></a> **ZipFile::setCompressionLevel** - set the compression level for all files in the archive.
|
574 |
+
|
575 |
+
> _Note that this method does not apply to entries that are added after this method is run._
|
576 |
+
|
577 |
+
By default, the compression level is 5 (`\PhpZip\Constants\ZipCompressionLevel::NORMAL`) or the compression level specified in the archive for Deflate compression.
|
578 |
+
|
579 |
+
The values range from 1 (`\PhpZip\Constants\ZipCompressionLevel::SUPER_FAST`) to 9 (`\PhpZip\Constants\ZipCompressionLevel::MAXIMUM`) are supported. The higher the number, the better and longer the compression.
|
580 |
+
```php
|
581 |
+
$zipFile = new \PhpZip\ZipFile();
|
582 |
+
$zipFile->setCompressionLevel(\PhpZip\Constants\ZipCompressionLevel::MAXIMUM);
|
583 |
+
```
|
584 |
+
<a name="Documentation-ZipFile-setCompressionLevelEntry"></a> **ZipFile::setCompressionLevelEntry** - sets the compression level for the entry by its name.
|
585 |
+
|
586 |
+
The values range from 1 (`\PhpZip\Constants\ZipCompressionLevel::SUPER_FAST`) to 9 (`\PhpZip\Constants\ZipCompressionLevel::MAXIMUM`) are supported. The higher the number, the better and longer the compression.
|
587 |
+
```php
|
588 |
+
$zipFile = new \PhpZip\ZipFile();
|
589 |
+
$zipFile->setCompressionLevelEntry($entryName, \PhpZip\Constants\ZipCompressionLevel::FAST);
|
590 |
+
```
|
591 |
+
<a name="Documentation-ZipFile-setCompressionMethodEntry"></a> **ZipFile::setCompressionMethodEntry** - sets the compression method for the entry by its name.
|
592 |
+
|
593 |
+
The following compression methods are available:
|
594 |
+
- `\PhpZip\Constants\ZipCompressionMethod::STORED` - No compression
|
595 |
+
- `\PhpZip\Constants\ZipCompressionMethod::DEFLATED` - Deflate compression
|
596 |
+
- `\PhpZip\Constants\ZipCompressionMethod::BZIP2` - Bzip2 compression with the extension `ext-bz2`
|
597 |
+
```php
|
598 |
+
$zipFile = new \PhpZip\ZipFile();
|
599 |
+
$zipFile->setCompressionMethodEntry($entryName, \PhpZip\Constants\ZipCompressionMethod::DEFLATED);
|
600 |
+
```
|
601 |
+
<a name="Documentation-ZipFile-setArchiveComment"></a> **ZipFile::setArchiveComment** - set the comment of a ZIP archive.
|
602 |
+
```php
|
603 |
+
$zipFile = new \PhpZip\ZipFile();
|
604 |
+
$zipFile->setArchiveComment($commentArchive);
|
605 |
+
```
|
606 |
+
<a name="Documentation-ZipFile-setEntryComment"></a> **ZipFile::setEntryComment** - set the comment of an entry defined by its name.
|
607 |
+
```php
|
608 |
+
$zipFile = new \PhpZip\ZipFile();
|
609 |
+
$zipFile->setEntryComment($entryName, $comment);
|
610 |
+
```
|
611 |
+
<a name="Documentation-ZipFile-matcher"></a> **ZipFile::matcher** - selecting entries in the archive to perform operations on them.
|
612 |
+
```php
|
613 |
+
$zipFile = new \PhpZip\ZipFile();
|
614 |
+
$matcher = $zipFile->matcher();
|
615 |
+
```
|
616 |
+
Selecting files from the archive one at a time:
|
617 |
+
```php
|
618 |
+
$matcher
|
619 |
+
->add('entry name')
|
620 |
+
->add('another entry');
|
621 |
+
```
|
622 |
+
Select multiple files in the archive:
|
623 |
+
```php
|
624 |
+
$matcher->add([
|
625 |
+
'entry name',
|
626 |
+
'another entry name',
|
627 |
+
'path/'
|
628 |
+
]);
|
629 |
+
```
|
630 |
+
Selecting files by regular expression:
|
631 |
+
```php
|
632 |
+
$matcher->match('~\.jpe?g$~i');
|
633 |
+
```
|
634 |
+
Select all files in the archive:
|
635 |
+
```php
|
636 |
+
$matcher->all();
|
637 |
+
```
|
638 |
+
count() - gets the number of selected entries:
|
639 |
+
```php
|
640 |
+
$count = count($matcher);
|
641 |
+
// or
|
642 |
+
$count = $matcher->count();
|
643 |
+
```
|
644 |
+
getMatches() - returns a list of selected entries:
|
645 |
+
```php
|
646 |
+
$entries = $matcher->getMatches();
|
647 |
+
// example array contents: ['entry name', 'another entry name'];
|
648 |
+
```
|
649 |
+
invoke() - invoke a callable function on selected entries:
|
650 |
+
```php
|
651 |
+
// example
|
652 |
+
$matcher->invoke(static function($entryName) use($zipFile) {
|
653 |
+
$newName = preg_replace('~\.(jpe?g)$~i', '.no_optimize.$1', $entryName);
|
654 |
+
$zipFile->rename($entryName, $newName);
|
655 |
+
});
|
656 |
+
```
|
657 |
+
Functions for working on the selected entries:
|
658 |
+
```php
|
659 |
+
$matcher->delete(); // remove selected entries from a ZIP archive
|
660 |
+
$matcher->setPassword($password); // sets a new password for the selected entries
|
661 |
+
$matcher->setPassword($password, $encryptionMethod); // sets a new password and encryption method to selected entries
|
662 |
+
$matcher->setEncryptionMethod($encryptionMethod); // sets the encryption method to the selected entries
|
663 |
+
$matcher->disableEncryption(); // disables encryption for selected entries
|
664 |
+
```
|
665 |
+
#### <a name="Documentation-Password"></a> Working with passwords
|
666 |
+
|
667 |
+
Implemented support for encryption methods:
|
668 |
+
- `\PhpZip\Constants\ZipEncryptionMethod::PKWARE` - Traditional PKWARE encryption (legacy)
|
669 |
+
- `\PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_256` - WinZip AES encryption 256 bit (recommended)
|
670 |
+
- `\PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_192` - WinZip AES encryption 192 bit
|
671 |
+
- `\PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_128` - WinZip AES encryption 128 bit
|
672 |
+
|
673 |
+
<a name="Documentation-ZipFile-setReadPassword"></a> **ZipFile::setReadPassword** - set the password for the open archive.
|
674 |
+
|
675 |
+
> _Setting a password is not required for adding new entries or deleting existing ones, but if you want to extract the content or change the method / compression level, the encryption method, or change the password, in this case the password must be specified._
|
676 |
+
```php
|
677 |
+
$zipFile->setReadPassword($password);
|
678 |
+
```
|
679 |
+
<a name="Documentation-ZipFile-setReadPasswordEntry"></a> **ZipFile::setReadPasswordEntry** - gets a password for reading of an entry defined by its name.
|
680 |
+
```php
|
681 |
+
$zipFile->setReadPasswordEntry($entryName, $password);
|
682 |
+
```
|
683 |
+
<a name="Documentation-ZipFile-setPassword"></a> **ZipFile::setPassword** - sets a new password for all files in the archive.
|
684 |
+
|
685 |
+
> _Note that this method does not apply to entries that are added after this method is run._
|
686 |
+
```php
|
687 |
+
$zipFile->setPassword($password);
|
688 |
+
```
|
689 |
+
You can set the encryption method:
|
690 |
+
```php
|
691 |
+
$encryptionMethod = \PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_256;
|
692 |
+
$zipFile->setPassword($password, $encryptionMethod);
|
693 |
+
```
|
694 |
+
<a name="Documentation-ZipFile-setPasswordEntry"></a> **ZipFile::setPasswordEntry** - sets a new password of an entry defined by its name.
|
695 |
+
```php
|
696 |
+
$zipFile->setPasswordEntry($entryName, $password);
|
697 |
+
```
|
698 |
+
You can set the encryption method:
|
699 |
+
```php
|
700 |
+
$encryptionMethod = \PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_256;
|
701 |
+
$zipFile->setPasswordEntry($entryName, $password, $encryptionMethod);
|
702 |
+
```
|
703 |
+
<a name="Documentation-ZipFile-disableEncryption"></a> **ZipFile::disableEncryption** - disable encryption for all entries that are already in the archive.
|
704 |
+
|
705 |
+
> _Note that this method does not apply to entries that are added after this method is run._
|
706 |
+
```php
|
707 |
+
$zipFile->disableEncryption();
|
708 |
+
```
|
709 |
+
<a name="Documentation-ZipFile-disableEncryptionEntry"></a> **ZipFile::disableEncryptionEntry** - disable encryption of an entry defined by its name.
|
710 |
+
```php
|
711 |
+
$zipFile->disableEncryptionEntry($entryName);
|
712 |
+
```
|
713 |
+
#### <a name="Documentation-ZipAlign-Usage"></a> zipalign
|
714 |
+
<a name="Documentation-ZipFile-setZipAlign"></a> **ZipFile::setZipAlign** - sets the alignment of the archive to optimize APK files (Android packages).
|
715 |
+
|
716 |
+
This method adds padding to unencrypted and not compressed entries, to optimize memory consumption in the Android system. It is recommended to use for `APK` files. The file may grow slightly.
|
717 |
+
|
718 |
+
This method is an alternative to executing the `zipalign -f -v 4 filename.zip`.
|
719 |
+
|
720 |
+
More details can be found on the [link](https://developer.android.com/studio/command-line/zipalign.html).
|
721 |
+
```php
|
722 |
+
$zipFile->setZipAlign(4);
|
723 |
+
```
|
724 |
+
#### <a name="Documentation-Unchanged"></a> Undo changes
|
725 |
+
<a name="Documentation-ZipFile-unchangeAll"></a> **ZipFile::unchangeAll** - undo all changes done in the archive.
|
726 |
+
```php
|
727 |
+
$zipFile->unchangeAll();
|
728 |
+
```
|
729 |
+
<a name="Documentation-ZipFile-unchangeArchiveComment"></a> **ZipFile::unchangeArchiveComment** - undo changes to the archive comment.
|
730 |
+
```php
|
731 |
+
$zipFile->unchangeArchiveComment();
|
732 |
+
```
|
733 |
+
<a name="Documentation-ZipFile-unchangeEntry"></a> **ZipFile::unchangeEntry** - undo changes of an entry defined by its name.
|
734 |
+
```php
|
735 |
+
$zipFile->unchangeEntry($entryName);
|
736 |
+
```
|
737 |
+
#### <a name="Documentation-Save-Or-Output-Entries"></a> Saving a file or output to a browser
|
738 |
+
<a name="Documentation-ZipFile-saveAsFile"></a> **ZipFile::saveAsFile** - saves the archive to a file.
|
739 |
+
```php
|
740 |
+
$zipFile->saveAsFile($filename);
|
741 |
+
```
|
742 |
+
<a name="Documentation-ZipFile-saveAsStream"></a> **ZipFile::saveAsStream** - writes the archive to the stream.
|
743 |
+
```php
|
744 |
+
// $fp = fopen($filename, 'w+b');
|
745 |
+
|
746 |
+
$zipFile->saveAsStream($fp);
|
747 |
+
```
|
748 |
+
<a name="Documentation-ZipFile-outputAsString"></a> **ZipFile::outputAsString** - outputs a ZIP-archive as string.
|
749 |
+
```php
|
750 |
+
$rawZipArchiveBytes = $zipFile->outputAsString();
|
751 |
+
```
|
752 |
+
<a name="Documentation-ZipFile-outputAsAttachment"></a> **ZipFile::outputAsAttachment** - outputs a ZIP-archive to the browser.
|
753 |
+
```php
|
754 |
+
$zipFile->outputAsAttachment($outputFilename);
|
755 |
+
```
|
756 |
+
You can set the Mime-Type:
|
757 |
+
```php
|
758 |
+
$mimeType = 'application/zip';
|
759 |
+
$zipFile->outputAsAttachment($outputFilename, $mimeType);
|
760 |
+
```
|
761 |
+
<a name="Documentation-ZipFile-outputAsResponse"></a> **ZipFile::outputAsResponse** - outputs a ZIP-archive as [PSR-7 Response](http://www.php-fig.org/psr/psr-7/).
|
762 |
+
|
763 |
+
The output method can be used in any PSR-7 compatible framework.
|
764 |
+
```php
|
765 |
+
// $response = ....; // instance Psr\Http\Message\ResponseInterface
|
766 |
+
$zipFile->outputAsResponse($response, $outputFilename);
|
767 |
+
```
|
768 |
+
You can set the Mime-Type:
|
769 |
+
```php
|
770 |
+
$mimeType = 'application/zip';
|
771 |
+
$zipFile->outputAsResponse($response, $outputFilename, $mimeType);
|
772 |
+
```
|
773 |
+
<a name="Documentation-ZipFile-rewrite"></a> **ZipFile::rewrite** - save changes and re-open the changed archive.
|
774 |
+
```php
|
775 |
+
$zipFile->rewrite();
|
776 |
+
```
|
777 |
+
#### <a name="Documentation-Close-Zip-Archive"></a> Closing the archive
|
778 |
+
<a name="Documentation-ZipFile-close"></a> **ZipFile::close** - close the archive.
|
779 |
+
```php
|
780 |
+
$zipFile->close();
|
781 |
+
```
|
782 |
+
### <a name="Running-Tests"></a> Running the tests
|
783 |
+
Install the dependencies for the development:
|
784 |
+
```bash
|
785 |
+
composer install --dev
|
786 |
+
```
|
787 |
+
Run the tests:
|
788 |
+
```bash
|
789 |
+
vendor/bin/phpunit
|
790 |
+
```
|
791 |
+
### <a name="Changelog"></a> Changelog
|
792 |
+
Changes are documented in the [releases page](https://github.com/Ne-Lexa/php-zip/releases).
|
793 |
+
|
794 |
+
### <a name="Upgrade"></a> Upgrade
|
795 |
+
#### <a name="Upgrade-v2-to-v3"></a> Upgrade version 2 to version 3.0
|
796 |
+
Update the major version in the file `composer.json` to `^3.0`.
|
797 |
+
```json
|
798 |
+
{
|
799 |
+
"require": {
|
800 |
+
"nelexa/zip": "^3.0"
|
801 |
+
}
|
802 |
+
}
|
803 |
+
```
|
804 |
+
Then install updates using `Composer`:
|
805 |
+
```bash
|
806 |
+
composer update nelexa/zip
|
807 |
+
```
|
808 |
+
Update your code to work with the new version:
|
809 |
+
- Class `ZipOutputFile` merged to `ZipFile` and removed.
|
810 |
+
+ `new \PhpZip\ZipOutputFile()` to `new \PhpZip\ZipFile()`
|
811 |
+
- Static initialization methods are now not static.
|
812 |
+
+ `\PhpZip\ZipFile::openFromFile($filename);` to `(new \PhpZip\ZipFile())->openFile($filename);`
|
813 |
+
+ `\PhpZip\ZipOutputFile::openFromFile($filename);` to `(new \PhpZip\ZipFile())->openFile($filename);`
|
814 |
+
+ `\PhpZip\ZipFile::openFromString($contents);` to `(new \PhpZip\ZipFile())->openFromString($contents);`
|
815 |
+
+ `\PhpZip\ZipFile::openFromStream($stream);` to `(new \PhpZip\ZipFile())->openFromStream($stream);`
|
816 |
+
+ `\PhpZip\ZipOutputFile::create()` to `new \PhpZip\ZipFile()`
|
817 |
+
+ `\PhpZip\ZipOutputFile::openFromZipFile(\PhpZip\ZipFile $zipFile)` > `(new \PhpZip\ZipFile())->openFile($filename);`
|
818 |
+
- Rename methods:
|
819 |
+
+ `addFromFile` to `addFile`
|
820 |
+
+ `setLevel` to `setCompressionLevel`
|
821 |
+
+ `ZipFile::setPassword` to `ZipFile::withReadPassword`
|
822 |
+
+ `ZipOutputFile::setPassword` to `ZipFile::withNewPassword`
|
823 |
+
+ `ZipOutputFile::disableEncryptionAllEntries` to `ZipFile::withoutPassword`
|
824 |
+
+ `ZipOutputFile::setComment` to `ZipFile::setArchiveComment`
|
825 |
+
+ `ZipFile::getComment` to `ZipFile::getArchiveComment`
|
826 |
+
- Changed signature for methods `addDir`, `addFilesFromGlob`, `addFilesFromRegex`.
|
827 |
+
- Remove methods:
|
828 |
+
+ `getLevel`
|
829 |
+
+ `setCompressionMethod`
|
830 |
+
+ `setEntryPassword`
|
831 |
+
|
832 |
+
|
library/vendor/nelexa/zip/composer.json
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "nelexa/zip",
|
3 |
+
"type": "library",
|
4 |
+
"description": "PhpZip is a php-library for extended work with ZIP-archives. Open, create, update, delete, extract and get info tool. Supports appending to existing ZIP files, WinZip AES encryption, Traditional PKWARE Encryption, ZipAlign tool, BZIP2 compression, external file attributes and ZIP64 extensions. Alternative ZipArchive. It does not require php-zip extension.",
|
5 |
+
"keywords": [
|
6 |
+
"zip",
|
7 |
+
"unzip",
|
8 |
+
"archive",
|
9 |
+
"extract",
|
10 |
+
"winzip",
|
11 |
+
"zipalign",
|
12 |
+
"ziparchive"
|
13 |
+
],
|
14 |
+
"homepage": "https://github.com/Ne-Lexa/php-zip",
|
15 |
+
"license": "MIT",
|
16 |
+
"authors": [
|
17 |
+
{
|
18 |
+
"name": "Ne-Lexa",
|
19 |
+
"email": "alexey@nelexa.ru",
|
20 |
+
"role": "Developer"
|
21 |
+
}
|
22 |
+
],
|
23 |
+
"require": {
|
24 |
+
"php": "^5.5.9 || ^7.0",
|
25 |
+
"ext-zlib": "*",
|
26 |
+
"psr/http-message": "^1.0",
|
27 |
+
"paragonie/random_compat": "*",
|
28 |
+
"symfony/finder": "^3.0|^4.0|^5.0"
|
29 |
+
},
|
30 |
+
"require-dev": {
|
31 |
+
"ext-bz2": "*",
|
32 |
+
"ext-openssl": "*",
|
33 |
+
"ext-fileinfo": "*",
|
34 |
+
"ext-xml": "*",
|
35 |
+
"guzzlehttp/psr7": "^1.6",
|
36 |
+
"phpunit/phpunit": "^4.8|^5.7",
|
37 |
+
"symfony/var-dumper": "^3.0|^4.0|^5.0"
|
38 |
+
},
|
39 |
+
"autoload": {
|
40 |
+
"psr-4": {
|
41 |
+
"PhpZip\\": "src/"
|
42 |
+
}
|
43 |
+
},
|
44 |
+
"autoload-dev": {
|
45 |
+
"psr-4": {
|
46 |
+
"PhpZip\\Tests\\": "tests/"
|
47 |
+
}
|
48 |
+
},
|
49 |
+
"suggest": {
|
50 |
+
"ext-openssl": "Needed to support encrypt zip entries or use ext-mcrypt",
|
51 |
+
"ext-mcrypt": "Needed to support encrypt zip entries or use ext-openssl",
|
52 |
+
"ext-bz2": "Needed to support BZIP2 compression",
|
53 |
+
"ext-fileinfo": "Needed to get mime-type file"
|
54 |
+
},
|
55 |
+
"minimum-stability": "stable",
|
56 |
+
"scripts": {
|
57 |
+
"php:fix": "php .php_cs --force",
|
58 |
+
"php:fix:debug": "php .php_cs"
|
59 |
+
}
|
60 |
+
}
|
library/vendor/nelexa/zip/src/Constants/DosAttrs.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Constants;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Interface DosAttrs.
|
7 |
+
*/
|
8 |
+
interface DosAttrs
|
9 |
+
{
|
10 |
+
/** @var int DOS File Attribute Read Only */
|
11 |
+
const DOS_READ_ONLY = 0x01;
|
12 |
+
|
13 |
+
/** @var int DOS File Attribute Hidden */
|
14 |
+
const DOS_HIDDEN = 0x02;
|
15 |
+
|
16 |
+
/** @var int DOS File Attribute System */
|
17 |
+
const DOS_SYSTEM = 0x04;
|
18 |
+
|
19 |
+
/** @var int DOS File Attribute Label */
|
20 |
+
const DOS_LABEL = 0x08;
|
21 |
+
|
22 |
+
/** @var int DOS File Attribute Directory */
|
23 |
+
const DOS_DIRECTORY = 0x10;
|
24 |
+
|
25 |
+
/** @var int DOS File Attribute Archive */
|
26 |
+
const DOS_ARCHIVE = 0x20;
|
27 |
+
|
28 |
+
/** @var int DOS File Attribute Link */
|
29 |
+
const DOS_LINK = 0x40;
|
30 |
+
|
31 |
+
/** @var int DOS File Attribute Execute */
|
32 |
+
const DOS_EXE = 0x80;
|
33 |
+
}
|
library/vendor/nelexa/zip/src/Constants/DosCodePage.php
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @noinspection PhpComposerExtensionStubsInspection */
|
4 |
+
|
5 |
+
namespace PhpZip\Constants;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Class DosCodePage.
|
9 |
+
*/
|
10 |
+
final class DosCodePage
|
11 |
+
{
|
12 |
+
const CP_LATIN_US = 'cp437';
|
13 |
+
|
14 |
+
const CP_GREEK = 'cp737';
|
15 |
+
|
16 |
+
const CP_BALT_RIM = 'cp775';
|
17 |
+
|
18 |
+
const CP_LATIN1 = 'cp850';
|
19 |
+
|
20 |
+
const CP_LATIN2 = 'cp852';
|
21 |
+
|
22 |
+
const CP_CYRILLIC = 'cp855';
|
23 |
+
|
24 |
+
const CP_TURKISH = 'cp857';
|
25 |
+
|
26 |
+
const CP_PORTUGUESE = 'cp860';
|
27 |
+
|
28 |
+
const CP_ICELANDIC = 'cp861';
|
29 |
+
|
30 |
+
const CP_HEBREW = 'cp862';
|
31 |
+
|
32 |
+
const CP_CANADA = 'cp863';
|
33 |
+
|
34 |
+
const CP_ARABIC = 'cp864';
|
35 |
+
|
36 |
+
const CP_NORDIC = 'cp865';
|
37 |
+
|
38 |
+
const CP_CYRILLIC_RUSSIAN = 'cp866';
|
39 |
+
|
40 |
+
const CP_GREEK2 = 'cp869';
|
41 |
+
|
42 |
+
const CP_THAI = 'cp874';
|
43 |
+
|
44 |
+
/** @var string[] */
|
45 |
+
private static $CP_CHARSETS = [
|
46 |
+
self::CP_LATIN_US,
|
47 |
+
self::CP_GREEK,
|
48 |
+
self::CP_BALT_RIM,
|
49 |
+
self::CP_LATIN1,
|
50 |
+
self::CP_LATIN2,
|
51 |
+
self::CP_CYRILLIC,
|
52 |
+
self::CP_TURKISH,
|
53 |
+
self::CP_PORTUGUESE,
|
54 |
+
self::CP_ICELANDIC,
|
55 |
+
self::CP_HEBREW,
|
56 |
+
self::CP_CANADA,
|
57 |
+
self::CP_ARABIC,
|
58 |
+
self::CP_NORDIC,
|
59 |
+
self::CP_CYRILLIC_RUSSIAN,
|
60 |
+
self::CP_GREEK2,
|
61 |
+
self::CP_THAI,
|
62 |
+
];
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @param string $str
|
66 |
+
* @param string $sourceEncoding
|
67 |
+
*
|
68 |
+
* @return string
|
69 |
+
*/
|
70 |
+
public static function toUTF8($str, $sourceEncoding)
|
71 |
+
{
|
72 |
+
$s = iconv($sourceEncoding, 'UTF-8', $str);
|
73 |
+
|
74 |
+
if ($s === false) {
|
75 |
+
return $str;
|
76 |
+
}
|
77 |
+
|
78 |
+
return $s;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* @param string $str
|
83 |
+
* @param string $destEncoding
|
84 |
+
*
|
85 |
+
* @return string
|
86 |
+
*/
|
87 |
+
public static function fromUTF8($str, $destEncoding)
|
88 |
+
{
|
89 |
+
$s = iconv('UTF-8', $destEncoding, $str);
|
90 |
+
|
91 |
+
if ($s === false) {
|
92 |
+
return $str;
|
93 |
+
}
|
94 |
+
|
95 |
+
return $s;
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* @return string[]
|
100 |
+
*/
|
101 |
+
public static function getCodePages()
|
102 |
+
{
|
103 |
+
return self::$CP_CHARSETS;
|
104 |
+
}
|
105 |
+
}
|
library/vendor/nelexa/zip/src/Constants/GeneralPurposeBitFlag.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Constants;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* General purpose bit flag constants.
|
7 |
+
*/
|
8 |
+
interface GeneralPurposeBitFlag
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* General Purpose Bit Flag mask for encrypted data.
|
12 |
+
* Bit 0: If set, indicates that the file is encrypted.
|
13 |
+
*/
|
14 |
+
const ENCRYPTION = 1; // 1 << 0
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Compression Flag Bit 1 for method Deflating.
|
18 |
+
*
|
19 |
+
* Bit 2 Bit 1
|
20 |
+
* 0 0 Normal compression
|
21 |
+
* 0 1 Maximum compression
|
22 |
+
* 1 0 Fast compression
|
23 |
+
* 1 1 Super Fast compression
|
24 |
+
*
|
25 |
+
* @see GeneralPurposeBitFlag::COMPRESSION_FLAG2
|
26 |
+
*/
|
27 |
+
const COMPRESSION_FLAG1 = 2; // 1 << 1
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Compression Flag Bit 2 for method Deflating.
|
31 |
+
*
|
32 |
+
* Bit 2 Bit 1
|
33 |
+
* 0 0 Normal compression
|
34 |
+
* 0 1 Maximum compression
|
35 |
+
* 1 0 Fast compression
|
36 |
+
* 1 1 Super Fast compression
|
37 |
+
*
|
38 |
+
* @see GeneralPurposeBitFlag::COMPRESSION_FLAG1
|
39 |
+
*/
|
40 |
+
const COMPRESSION_FLAG2 = 4; // 1 << 2
|
41 |
+
|
42 |
+
/**
|
43 |
+
* General Purpose Bit Flag mask for data descriptor.
|
44 |
+
*
|
45 |
+
* Bit 3: If this bit is set, the fields crc-32, compressed
|
46 |
+
* size and uncompressed size are set to zero in the
|
47 |
+
* local header. The correct values are put in the data
|
48 |
+
* descriptor immediately following the compressed data.
|
49 |
+
*/
|
50 |
+
const DATA_DESCRIPTOR = 8; // 1 << 3
|
51 |
+
|
52 |
+
/**
|
53 |
+
* General Purpose Bit Flag mask for strong encryption.
|
54 |
+
*
|
55 |
+
* Bit 6: Strong encryption.
|
56 |
+
* If this bit is set, you MUST set the version needed to extract
|
57 |
+
* value to at least 50 and you MUST also set bit 0.
|
58 |
+
* If AES encryption is used, the version needed to extract value
|
59 |
+
* MUST be at least 51.
|
60 |
+
*/
|
61 |
+
const STRONG_ENCRYPTION = 64; // 1 << 6
|
62 |
+
|
63 |
+
/**
|
64 |
+
* General Purpose Bit Flag mask for UTF-8.
|
65 |
+
*
|
66 |
+
* Bit 11: Language encoding flag (EFS).
|
67 |
+
* If this bit is set, the filename and comment fields
|
68 |
+
* for this file MUST be encoded using UTF-8. (see APPENDIX D)
|
69 |
+
*/
|
70 |
+
const UTF8 = 2048; // 1 << 11
|
71 |
+
}
|
library/vendor/nelexa/zip/src/Constants/UnixStat.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Constants;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Unix stat constants.
|
7 |
+
*
|
8 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
9 |
+
* @license MIT
|
10 |
+
*/
|
11 |
+
interface UnixStat
|
12 |
+
{
|
13 |
+
/** @var int unix file type mask */
|
14 |
+
const UNX_IFMT = 0170000;
|
15 |
+
|
16 |
+
/** @var int unix regular file */
|
17 |
+
const UNX_IFREG = 0100000;
|
18 |
+
|
19 |
+
/** @var int unix socket (BSD, not SysV or Amiga) */
|
20 |
+
const UNX_IFSOCK = 0140000;
|
21 |
+
|
22 |
+
/** @var int unix symbolic link (not SysV, Amiga) */
|
23 |
+
const UNX_IFLNK = 0120000;
|
24 |
+
|
25 |
+
/** @var int unix block special (not Amiga) */
|
26 |
+
const UNX_IFBLK = 0060000;
|
27 |
+
|
28 |
+
/** @var int unix directory */
|
29 |
+
const UNX_IFDIR = 0040000;
|
30 |
+
|
31 |
+
/** @var int unix character special (not Amiga) */
|
32 |
+
const UNX_IFCHR = 0020000;
|
33 |
+
|
34 |
+
/** @var int unix fifo (BCC, not MSC or Amiga) */
|
35 |
+
const UNX_IFIFO = 0010000;
|
36 |
+
|
37 |
+
/** @var int unix set user id on execution */
|
38 |
+
const UNX_ISUID = 04000;
|
39 |
+
|
40 |
+
/** @var int unix set group id on execution */
|
41 |
+
const UNX_ISGID = 02000;
|
42 |
+
|
43 |
+
/** @var int unix directory permissions control */
|
44 |
+
const UNX_ISVTX = 01000;
|
45 |
+
|
46 |
+
/** @var int unix record locking enforcement flag */
|
47 |
+
const UNX_ENFMT = 02000;
|
48 |
+
|
49 |
+
/** @var int unix read, write, execute: owner */
|
50 |
+
const UNX_IRWXU = 00700;
|
51 |
+
|
52 |
+
/** @var int unix read permission: owner */
|
53 |
+
const UNX_IRUSR = 00400;
|
54 |
+
|
55 |
+
/** @var int unix write permission: owner */
|
56 |
+
const UNX_IWUSR = 00200;
|
57 |
+
|
58 |
+
/** @var int unix execute permission: owner */
|
59 |
+
const UNX_IXUSR = 00100;
|
60 |
+
|
61 |
+
/** @var int unix read, write, execute: group */
|
62 |
+
const UNX_IRWXG = 00070;
|
63 |
+
|
64 |
+
/** @var int unix read permission: group */
|
65 |
+
const UNX_IRGRP = 00040;
|
66 |
+
|
67 |
+
/** @var int unix write permission: group */
|
68 |
+
const UNX_IWGRP = 00020;
|
69 |
+
|
70 |
+
/** @var int unix execute permission: group */
|
71 |
+
const UNX_IXGRP = 00010;
|
72 |
+
|
73 |
+
/** @var int unix read, write, execute: other */
|
74 |
+
const UNX_IRWXO = 00007;
|
75 |
+
|
76 |
+
/** @var int unix read permission: other */
|
77 |
+
const UNX_IROTH = 00004;
|
78 |
+
|
79 |
+
/** @var int unix write permission: other */
|
80 |
+
const UNX_IWOTH = 00002;
|
81 |
+
|
82 |
+
/** @var int unix execute permission: other */
|
83 |
+
const UNX_IXOTH = 00001;
|
84 |
+
}
|
library/vendor/nelexa/zip/src/Constants/ZipCompressionLevel.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Constants;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Compression levels for Deflate and BZIP2.
|
7 |
+
*
|
8 |
+
* {@see https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT} Section 4.4.4:
|
9 |
+
*
|
10 |
+
* For Methods 8 and 9 - Deflating
|
11 |
+
* -------------------------------
|
12 |
+
* Bit 2 Bit 1
|
13 |
+
* 0 0 Normal (-en) compression option was used.
|
14 |
+
* 0 1 Maximum (-exx/-ex) compression option was used.
|
15 |
+
* 1 0 Fast (-ef) compression option was used.
|
16 |
+
* 1 1 Super Fast (-es) compression option was used.
|
17 |
+
*
|
18 |
+
* Different programs encode compression level information in different ways:
|
19 |
+
*
|
20 |
+
* Deflate Compress Level pkzip zip 7z, WinRAR WinZip
|
21 |
+
* ---------------------- ---------------- ------- ---------- ------
|
22 |
+
* Super Fast compression 1 1
|
23 |
+
* Fast compression 2 1, 2
|
24 |
+
* Normal Compression 3 - 8 (5 default) 3 - 7 1 - 9
|
25 |
+
* Maximum compression 9 8, 9 9
|
26 |
+
*/
|
27 |
+
interface ZipCompressionLevel
|
28 |
+
{
|
29 |
+
/** @var int Compression level for super fast compression. */
|
30 |
+
const SUPER_FAST = 1;
|
31 |
+
|
32 |
+
/** @var int compression level for fast compression */
|
33 |
+
const FAST = 2;
|
34 |
+
|
35 |
+
/** @var int compression level for normal compression */
|
36 |
+
const NORMAL = 5;
|
37 |
+
|
38 |
+
/** @var int compression level for maximum compression */
|
39 |
+
const MAXIMUM = 9;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @var int int Minimum compression level
|
43 |
+
*
|
44 |
+
* @internal
|
45 |
+
*/
|
46 |
+
const LEVEL_MIN = self::SUPER_FAST;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @var int int Maximum compression level
|
50 |
+
*
|
51 |
+
* @internal
|
52 |
+
*/
|
53 |
+
const LEVEL_MAX = self::MAXIMUM;
|
54 |
+
}
|
library/vendor/nelexa/zip/src/Constants/ZipCompressionMethod.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Constants;
|
4 |
+
|
5 |
+
use PhpZip\Exception\ZipUnsupportMethodException;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Class ZipCompressionMethod.
|
9 |
+
*/
|
10 |
+
final class ZipCompressionMethod
|
11 |
+
{
|
12 |
+
/** @var int Compression method Store */
|
13 |
+
const STORED = 0;
|
14 |
+
|
15 |
+
/** @var int Compression method Deflate */
|
16 |
+
const DEFLATED = 8;
|
17 |
+
|
18 |
+
/** @var int Compression method Bzip2 */
|
19 |
+
const BZIP2 = 12;
|
20 |
+
|
21 |
+
/** @var int Compression method AES-Encryption */
|
22 |
+
const WINZIP_AES = 99;
|
23 |
+
|
24 |
+
/** @var array Compression Methods */
|
25 |
+
private static $ZIP_COMPRESSION_METHODS = [
|
26 |
+
self::STORED => 'Stored',
|
27 |
+
1 => 'Shrunk',
|
28 |
+
2 => 'Reduced compression factor 1',
|
29 |
+
3 => 'Reduced compression factor 2',
|
30 |
+
4 => 'Reduced compression factor 3',
|
31 |
+
5 => 'Reduced compression factor 4',
|
32 |
+
6 => 'Imploded',
|
33 |
+
7 => 'Reserved for Tokenizing compression algorithm',
|
34 |
+
self::DEFLATED => 'Deflated',
|
35 |
+
9 => 'Enhanced Deflating using Deflate64(tm)',
|
36 |
+
10 => 'PKWARE Data Compression Library Imploding',
|
37 |
+
11 => 'Reserved by PKWARE',
|
38 |
+
self::BZIP2 => 'BZIP2',
|
39 |
+
13 => 'Reserved by PKWARE',
|
40 |
+
14 => 'LZMA',
|
41 |
+
15 => 'Reserved by PKWARE',
|
42 |
+
16 => 'Reserved by PKWARE',
|
43 |
+
17 => 'Reserved by PKWARE',
|
44 |
+
18 => 'File is compressed using IBM TERSE (new)',
|
45 |
+
19 => 'IBM LZ77 z Architecture (PFS)',
|
46 |
+
96 => 'WinZip JPEG Compression',
|
47 |
+
97 => 'WavPack compressed data',
|
48 |
+
98 => 'PPMd version I, Rev 1',
|
49 |
+
self::WINZIP_AES => 'AES Encryption',
|
50 |
+
];
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @param int $value
|
54 |
+
*
|
55 |
+
* @return string
|
56 |
+
*/
|
57 |
+
public static function getCompressionMethodName($value)
|
58 |
+
{
|
59 |
+
return isset(self::$ZIP_COMPRESSION_METHODS[$value]) ?
|
60 |
+
self::$ZIP_COMPRESSION_METHODS[$value] :
|
61 |
+
'Unknown Method';
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @return int[]
|
66 |
+
*/
|
67 |
+
public static function getSupportMethods()
|
68 |
+
{
|
69 |
+
static $methods;
|
70 |
+
|
71 |
+
if ($methods === null) {
|
72 |
+
$methods = [
|
73 |
+
self::STORED,
|
74 |
+
self::DEFLATED,
|
75 |
+
];
|
76 |
+
|
77 |
+
if (\extension_loaded('bz2')) {
|
78 |
+
$methods[] = self::BZIP2;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
return $methods;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* @param int $compressionMethod
|
87 |
+
*
|
88 |
+
* @throws ZipUnsupportMethodException
|
89 |
+
*/
|
90 |
+
public static function checkSupport($compressionMethod)
|
91 |
+
{
|
92 |
+
$compressionMethod = (int) $compressionMethod;
|
93 |
+
|
94 |
+
if (!\in_array($compressionMethod, self::getSupportMethods(), true)) {
|
95 |
+
throw new ZipUnsupportMethodException(sprintf(
|
96 |
+
'Compression method %d (%s) is not supported.',
|
97 |
+
$compressionMethod,
|
98 |
+
self::getCompressionMethodName($compressionMethod)
|
99 |
+
));
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
library/vendor/nelexa/zip/src/Constants/ZipConstants.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Constants;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Zip Constants.
|
7 |
+
*
|
8 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
9 |
+
* @license MIT
|
10 |
+
*/
|
11 |
+
interface ZipConstants
|
12 |
+
{
|
13 |
+
/** @var int End Of Central Directory Record signature. */
|
14 |
+
const END_CD = 0x06054B50; // "PK\005\006"
|
15 |
+
|
16 |
+
/** @var int Zip64 End Of Central Directory Record. */
|
17 |
+
const ZIP64_END_CD = 0x06064B50; // "PK\006\006"
|
18 |
+
|
19 |
+
/** @var int Zip64 End Of Central Directory Locator. */
|
20 |
+
const ZIP64_END_CD_LOC = 0x07064B50; // "PK\006\007"
|
21 |
+
|
22 |
+
/** @var int Central File Header signature. */
|
23 |
+
const CENTRAL_FILE_HEADER = 0x02014B50; // "PK\001\002"
|
24 |
+
|
25 |
+
/** @var int Local File Header signature. */
|
26 |
+
const LOCAL_FILE_HEADER = 0x04034B50; // "PK\003\004"
|
27 |
+
|
28 |
+
/** @var int Data Descriptor signature. */
|
29 |
+
const DATA_DESCRIPTOR = 0x08074B50; // "PK\007\008"
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @var int value stored in four-byte size and similar fields
|
33 |
+
* if ZIP64 extensions are used
|
34 |
+
*/
|
35 |
+
const ZIP64_MAGIC = 0xFFFFFFFF;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Local File Header signature 4
|
39 |
+
* Version Needed To Extract 2
|
40 |
+
* General Purpose Bit Flags 2
|
41 |
+
* Compression Method 2
|
42 |
+
* Last Mod File Time 2
|
43 |
+
* Last Mod File Date 2
|
44 |
+
* CRC-32 4
|
45 |
+
* Compressed Size 4
|
46 |
+
* Uncompressed Size 4.
|
47 |
+
*
|
48 |
+
* @var int Local File Header filename position
|
49 |
+
*/
|
50 |
+
const LFH_FILENAME_LENGTH_POS = 26;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* The minimum length of the Local File Header record.
|
54 |
+
*
|
55 |
+
* local file header signature 4
|
56 |
+
* version needed to extract 2
|
57 |
+
* general purpose bit flag 2
|
58 |
+
* compression method 2
|
59 |
+
* last mod file time 2
|
60 |
+
* last mod file date 2
|
61 |
+
* crc-32 4
|
62 |
+
* compressed size 4
|
63 |
+
* uncompressed size 4
|
64 |
+
* file name length 2
|
65 |
+
* extra field length 2
|
66 |
+
*/
|
67 |
+
const LFH_FILENAME_POS = 30;
|
68 |
+
|
69 |
+
/** @var int the length of the Zip64 End Of Central Directory Locator */
|
70 |
+
const ZIP64_END_CD_LOC_LEN = 20;
|
71 |
+
|
72 |
+
/** @var int the minimum length of the End Of Central Directory Record */
|
73 |
+
const END_CD_MIN_LEN = 22;
|
74 |
+
|
75 |
+
/**
|
76 |
+
* The minimum length of the Zip64 End Of Central Directory Record.
|
77 |
+
*
|
78 |
+
* zip64 end of central dir
|
79 |
+
* signature 4
|
80 |
+
* size of zip64 end of central
|
81 |
+
* directory record 8
|
82 |
+
* version made by 2
|
83 |
+
* version needed to extract 2
|
84 |
+
* number of this disk 4
|
85 |
+
* number of the disk with the
|
86 |
+
* start of the central directory 4
|
87 |
+
* total number of entries in the
|
88 |
+
* central directory on this disk 8
|
89 |
+
* total number of entries in
|
90 |
+
* the central directory 8
|
91 |
+
* size of the central directory 8
|
92 |
+
* offset of start of central
|
93 |
+
* directory with respect to
|
94 |
+
* the starting disk number 8
|
95 |
+
*
|
96 |
+
* @var int ZIP64 End Of Central Directory length
|
97 |
+
*/
|
98 |
+
const ZIP64_END_OF_CD_LEN = 56;
|
99 |
+
}
|
library/vendor/nelexa/zip/src/Constants/ZipEncryptionMethod.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Constants;
|
4 |
+
|
5 |
+
use PhpZip\Exception\InvalidArgumentException;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Class ZipEncryptionMethod.
|
9 |
+
*/
|
10 |
+
final class ZipEncryptionMethod
|
11 |
+
{
|
12 |
+
const NONE = -1;
|
13 |
+
|
14 |
+
/** @var int Traditional PKWARE encryption. */
|
15 |
+
const PKWARE = 0;
|
16 |
+
|
17 |
+
/** @var int WinZip AES-256 */
|
18 |
+
const WINZIP_AES_256 = 1;
|
19 |
+
|
20 |
+
/** @var int WinZip AES-128 */
|
21 |
+
const WINZIP_AES_128 = 2;
|
22 |
+
|
23 |
+
/** @var int WinZip AES-192 */
|
24 |
+
const WINZIP_AES_192 = 3;
|
25 |
+
|
26 |
+
/** @var array<int, string> */
|
27 |
+
private static $ENCRYPTION_METHODS = [
|
28 |
+
self::NONE => 'no encryption',
|
29 |
+
self::PKWARE => 'Traditional PKWARE encryption',
|
30 |
+
self::WINZIP_AES_128 => 'WinZip AES-128',
|
31 |
+
self::WINZIP_AES_192 => 'WinZip AES-192',
|
32 |
+
self::WINZIP_AES_256 => 'WinZip AES-256',
|
33 |
+
];
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @param int $value
|
37 |
+
*
|
38 |
+
* @return string
|
39 |
+
*/
|
40 |
+
public static function getEncryptionMethodName($value)
|
41 |
+
{
|
42 |
+
$value = (int) $value;
|
43 |
+
|
44 |
+
return isset(self::$ENCRYPTION_METHODS[$value]) ?
|
45 |
+
self::$ENCRYPTION_METHODS[$value] :
|
46 |
+
'Unknown Encryption Method';
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @param int $encryptionMethod
|
51 |
+
*
|
52 |
+
* @return bool
|
53 |
+
*/
|
54 |
+
public static function hasEncryptionMethod($encryptionMethod)
|
55 |
+
{
|
56 |
+
return isset(self::$ENCRYPTION_METHODS[$encryptionMethod]);
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @param int $encryptionMethod
|
61 |
+
*
|
62 |
+
* @return bool
|
63 |
+
*/
|
64 |
+
public static function isWinZipAesMethod($encryptionMethod)
|
65 |
+
{
|
66 |
+
return \in_array(
|
67 |
+
(int) $encryptionMethod,
|
68 |
+
[
|
69 |
+
self::WINZIP_AES_256,
|
70 |
+
self::WINZIP_AES_192,
|
71 |
+
self::WINZIP_AES_128,
|
72 |
+
],
|
73 |
+
true
|
74 |
+
);
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* @param int $encryptionMethod
|
79 |
+
*
|
80 |
+
* @throws InvalidArgumentException
|
81 |
+
*/
|
82 |
+
public static function checkSupport($encryptionMethod)
|
83 |
+
{
|
84 |
+
$encryptionMethod = (int) $encryptionMethod;
|
85 |
+
|
86 |
+
if (!self::hasEncryptionMethod($encryptionMethod)) {
|
87 |
+
throw new InvalidArgumentException(sprintf(
|
88 |
+
'Encryption method %d is not supported.',
|
89 |
+
$encryptionMethod
|
90 |
+
));
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
library/vendor/nelexa/zip/src/Constants/ZipOptions.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Constants;
|
4 |
+
|
5 |
+
use PhpZip\IO\ZipReader;
|
6 |
+
use PhpZip\ZipFile;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Interface ZipOptions.
|
10 |
+
*/
|
11 |
+
interface ZipOptions
|
12 |
+
{
|
13 |
+
/**
|
14 |
+
* Boolean option for store just file names (skip directory names).
|
15 |
+
*
|
16 |
+
* @see ZipFile::addFromFinder()
|
17 |
+
*/
|
18 |
+
const STORE_ONLY_FILES = 'only_files';
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Uses the specified compression method.
|
22 |
+
*
|
23 |
+
* @see ZipFile::addFromFinder()
|
24 |
+
* @see ZipFile::addSplFile()
|
25 |
+
*/
|
26 |
+
const COMPRESSION_METHOD = 'compression_method';
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Set the specified record modification time.
|
30 |
+
* The value can be {@see \DateTimeInterface}, integer timestamp
|
31 |
+
* or a string of any format.
|
32 |
+
*
|
33 |
+
* @see ZipFile::addFromFinder()
|
34 |
+
* @see ZipFile::addSplFile()
|
35 |
+
*/
|
36 |
+
const MODIFIED_TIME = 'mtime';
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Specifies the encoding of the record name for cases when the UTF-8
|
40 |
+
* usage flag is not set.
|
41 |
+
*
|
42 |
+
* The most commonly used encodings are compiled into the constants
|
43 |
+
* of the {@see DosCodePage} class.
|
44 |
+
*
|
45 |
+
* @see ZipFile::openFile()
|
46 |
+
* @see ZipFile::openFromString()
|
47 |
+
* @see ZipFile::openFromStream()
|
48 |
+
* @see ZipReader::getDefaultOptions()
|
49 |
+
* @see DosCodePage::getCodePages()
|
50 |
+
*/
|
51 |
+
const CHARSET = 'charset';
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Allows ({@see true}) or denies ({@see false}) unpacking unix symlinks.
|
55 |
+
*
|
56 |
+
* This is a potentially dangerous operation for uncontrolled zip files.
|
57 |
+
* By default is ({@see false}).
|
58 |
+
*
|
59 |
+
* @see https://josipfranjkovic.blogspot.com/2014/12/reading-local-files-from-facebooks.html
|
60 |
+
*/
|
61 |
+
const EXTRACT_SYMLINKS = 'extract_symlinks';
|
62 |
+
}
|
library/vendor/nelexa/zip/src/Constants/ZipPlatform.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Constants;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class ZipPlatform.
|
7 |
+
*/
|
8 |
+
final class ZipPlatform
|
9 |
+
{
|
10 |
+
/** @var int MS-DOS OS */
|
11 |
+
const OS_DOS = 0;
|
12 |
+
|
13 |
+
/** @var int Unix OS */
|
14 |
+
const OS_UNIX = 3;
|
15 |
+
|
16 |
+
/** MacOS platform */
|
17 |
+
const OS_MAC_OSX = 19;
|
18 |
+
|
19 |
+
/** @var array Zip Platforms */
|
20 |
+
private static $platforms = [
|
21 |
+
self::OS_DOS => 'MS-DOS',
|
22 |
+
1 => 'Amiga',
|
23 |
+
2 => 'OpenVMS',
|
24 |
+
self::OS_UNIX => 'Unix',
|
25 |
+
4 => 'VM/CMS',
|
26 |
+
5 => 'Atari ST',
|
27 |
+
6 => 'HPFS (OS/2, NT 3.x)',
|
28 |
+
7 => 'Macintosh',
|
29 |
+
8 => 'Z-System',
|
30 |
+
9 => 'CP/M',
|
31 |
+
10 => 'Windows NTFS or TOPS-20',
|
32 |
+
11 => 'MVS or NTFS',
|
33 |
+
12 => 'VSE or SMS/QDOS',
|
34 |
+
13 => 'Acorn RISC OS',
|
35 |
+
14 => 'VFAT',
|
36 |
+
15 => 'alternate MVS',
|
37 |
+
16 => 'BeOS',
|
38 |
+
17 => 'Tandem',
|
39 |
+
18 => 'OS/400',
|
40 |
+
self::OS_MAC_OSX => 'OS/X (Darwin)',
|
41 |
+
30 => 'AtheOS/Syllable',
|
42 |
+
];
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @param int $platform
|
46 |
+
*
|
47 |
+
* @return string
|
48 |
+
*/
|
49 |
+
public static function getPlatformName($platform)
|
50 |
+
{
|
51 |
+
return isset(self::$platforms[$platform]) ? self::$platforms[$platform] : 'Unknown';
|
52 |
+
}
|
53 |
+
}
|
library/vendor/nelexa/zip/src/Constants/ZipVersion.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Constants;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Version needed to extract or software version.
|
7 |
+
*
|
8 |
+
* @see https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT Section 4.4.3
|
9 |
+
*
|
10 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
11 |
+
* @license MIT
|
12 |
+
*/
|
13 |
+
interface ZipVersion
|
14 |
+
{
|
15 |
+
/** @var int 1.0 - Default value */
|
16 |
+
const v10_DEFAULT_MIN = 10;
|
17 |
+
|
18 |
+
/** @var int 1.1 - File is a volume label */
|
19 |
+
const v11_FILE_VOLUME_LABEL = 11;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* 2.0 - File is a folder (directory)
|
23 |
+
* 2.0 - File is compressed using Deflate compression
|
24 |
+
* 2.0 - File is encrypted using traditional PKWARE encryption.
|
25 |
+
*
|
26 |
+
* @var int
|
27 |
+
*/
|
28 |
+
const v20_DEFLATED_FOLDER_ZIPCRYPTO = 20;
|
29 |
+
|
30 |
+
/** @var int 2.1 - File is compressed using Deflate64(tm) */
|
31 |
+
const v21_DEFLATED64 = 21;
|
32 |
+
|
33 |
+
/** @var int 2.5 - File is compressed using PKWARE DCL Implode */
|
34 |
+
const v25_IMPLODED = 25;
|
35 |
+
|
36 |
+
/** @var int 2.7 - File is a patch data set */
|
37 |
+
const v27_PATCH_DATA = 27;
|
38 |
+
|
39 |
+
/** @var int 4.5 - File uses ZIP64 format extensions */
|
40 |
+
const v45_ZIP64_EXT = 45;
|
41 |
+
|
42 |
+
/** @var int 4.6 - File is compressed using BZIP2 compression */
|
43 |
+
const v46_BZIP2 = 46;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* 5.0 - File is encrypted using DES
|
47 |
+
* 5.0 - File is encrypted using 3DES
|
48 |
+
* 5.0 - File is encrypted using original RC2 encryption
|
49 |
+
* 5.0 - File is encrypted using RC4 encryption.
|
50 |
+
*
|
51 |
+
* @var int
|
52 |
+
*/
|
53 |
+
const v50_ENCR_DES_3DES_RC2_ORIG_RC4 = 50;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* 5.1 - File is encrypted using AES encryption
|
57 |
+
* 5.1 - File is encrypted using corrected RC2 encryption**.
|
58 |
+
*
|
59 |
+
* @var int
|
60 |
+
*/
|
61 |
+
const v51_ENCR_AES_RC2_CORRECT = 51;
|
62 |
+
|
63 |
+
/** @var int 5.2 - File is encrypted using corrected RC2-64 encryption** */
|
64 |
+
const v52_ENCR_RC2_64_CORRECT = 52;
|
65 |
+
|
66 |
+
/** @var int 6.1 - File is encrypted using non-OAEP key wrapping*** */
|
67 |
+
const v61_ENCR_NON_OAE_KEY_WRAP = 61;
|
68 |
+
|
69 |
+
/** @var int 6.2 - Central directory encryption */
|
70 |
+
const v62_ENCR_CENTRAL_DIR = 62;
|
71 |
+
|
72 |
+
/**
|
73 |
+
* 6.3 - File is compressed using LZMA
|
74 |
+
* 6.3 - File is compressed using PPMd+
|
75 |
+
* 6.3 - File is encrypted using Blowfish
|
76 |
+
* 6.3 - File is encrypted using Twofish.
|
77 |
+
*
|
78 |
+
* @var int
|
79 |
+
*/
|
80 |
+
const v63_LZMA_PPMD_BLOWFISH_TWOFISH = 63;
|
81 |
+
}
|
library/vendor/nelexa/zip/src/Exception/Crc32Exception.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Exception;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Thrown to indicate a CRC32 mismatch between the declared value in the
|
7 |
+
* Central File Header and the Data Descriptor or between the declared value
|
8 |
+
* and the computed value from the decompressed data.
|
9 |
+
*
|
10 |
+
* The exception detail message is the name of the ZIP entry.
|
11 |
+
*
|
12 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
13 |
+
* @license MIT
|
14 |
+
*/
|
15 |
+
class Crc32Exception extends ZipException
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* Expected crc.
|
19 |
+
*
|
20 |
+
* @var int
|
21 |
+
*/
|
22 |
+
private $expectedCrc;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Actual crc.
|
26 |
+
*
|
27 |
+
* @var int
|
28 |
+
*/
|
29 |
+
private $actualCrc;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Crc32Exception constructor.
|
33 |
+
*
|
34 |
+
* @param string $name
|
35 |
+
* @param int $expected
|
36 |
+
* @param int $actual
|
37 |
+
*/
|
38 |
+
public function __construct($name, $expected, $actual)
|
39 |
+
{
|
40 |
+
parent::__construct(
|
41 |
+
sprintf(
|
42 |
+
'%s (expected CRC32 value 0x%x, but is actually 0x%x)',
|
43 |
+
$name,
|
44 |
+
$expected,
|
45 |
+
$actual
|
46 |
+
)
|
47 |
+
);
|
48 |
+
$this->expectedCrc = $expected;
|
49 |
+
$this->actualCrc = $actual;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Returns expected crc.
|
54 |
+
*
|
55 |
+
* @return int
|
56 |
+
*/
|
57 |
+
public function getExpectedCrc()
|
58 |
+
{
|
59 |
+
return $this->expectedCrc;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Returns actual crc.
|
64 |
+
*
|
65 |
+
* @return int
|
66 |
+
*/
|
67 |
+
public function getActualCrc()
|
68 |
+
{
|
69 |
+
return $this->actualCrc;
|
70 |
+
}
|
71 |
+
}
|
library/vendor/nelexa/zip/src/Exception/InvalidArgumentException.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Exception;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Thrown to indicate that a method has been passed an illegal or
|
7 |
+
* inappropriate argument.
|
8 |
+
*
|
9 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
10 |
+
* @license MIT
|
11 |
+
*/
|
12 |
+
class InvalidArgumentException extends RuntimeException
|
13 |
+
{
|
14 |
+
}
|
library/vendor/nelexa/zip/src/Exception/RuntimeException.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Exception;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Runtime exception.
|
7 |
+
* Exception thrown if an error which can only be found on runtime occurs.
|
8 |
+
*
|
9 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
10 |
+
* @license MIT
|
11 |
+
*/
|
12 |
+
class RuntimeException extends \RuntimeException
|
13 |
+
{
|
14 |
+
}
|
library/vendor/nelexa/zip/src/Exception/ZipAuthenticationException.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Exception;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Thrown to indicate that an authenticated ZIP entry has been tampered with.
|
7 |
+
*
|
8 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
9 |
+
* @license MIT
|
10 |
+
*/
|
11 |
+
class ZipAuthenticationException extends ZipCryptoException
|
12 |
+
{
|
13 |
+
}
|
library/vendor/nelexa/zip/src/Exception/ZipCryptoException.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Exception;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Thrown if there is an issue when reading or writing an encrypted ZIP file
|
7 |
+
* or entry.
|
8 |
+
*
|
9 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
10 |
+
* @license MIT
|
11 |
+
*/
|
12 |
+
class ZipCryptoException extends ZipException
|
13 |
+
{
|
14 |
+
}
|
library/vendor/nelexa/zip/src/Exception/ZipEntryNotFoundException.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Exception;
|
4 |
+
|
5 |
+
use PhpZip\Model\ZipEntry;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Thrown if entry not found.
|
9 |
+
*
|
10 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
11 |
+
* @license MIT
|
12 |
+
*/
|
13 |
+
class ZipEntryNotFoundException extends ZipException
|
14 |
+
{
|
15 |
+
/** @var string */
|
16 |
+
private $entryName;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* ZipEntryNotFoundException constructor.
|
20 |
+
*
|
21 |
+
* @param ZipEntry|string $entryName
|
22 |
+
*/
|
23 |
+
public function __construct($entryName)
|
24 |
+
{
|
25 |
+
$entryName = $entryName instanceof ZipEntry ? $entryName->getName() : $entryName;
|
26 |
+
parent::__construct(sprintf(
|
27 |
+
'Zip Entry "%s" was not found in the archive.',
|
28 |
+
$entryName
|
29 |
+
));
|
30 |
+
$this->entryName = $entryName;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @return string
|
35 |
+
*/
|
36 |
+
public function getEntryName()
|
37 |
+
{
|
38 |
+
return $this->entryName;
|
39 |
+
}
|
40 |
+
}
|
library/vendor/nelexa/zip/src/Exception/ZipException.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Exception;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Signals that a Zip exception of some sort has occurred.
|
7 |
+
*
|
8 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
9 |
+
* @license MIT
|
10 |
+
*
|
11 |
+
* @see \Exception
|
12 |
+
*/
|
13 |
+
class ZipException extends \Exception
|
14 |
+
{
|
15 |
+
}
|
library/vendor/nelexa/zip/src/Exception/ZipUnsupportMethodException.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Exception;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class ZipUnsupportMethodException.
|
7 |
+
*/
|
8 |
+
class ZipUnsupportMethodException extends ZipException
|
9 |
+
{
|
10 |
+
}
|
library/vendor/nelexa/zip/src/IO/Filter/Cipher/Pkware/PKCryptContext.php
ADDED
@@ -0,0 +1,419 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\IO\Filter\Cipher\Pkware;
|
4 |
+
|
5 |
+
use PhpZip\Exception\RuntimeException;
|
6 |
+
use PhpZip\Exception\ZipAuthenticationException;
|
7 |
+
use PhpZip\Util\PackUtil;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Traditional PKWARE Encryption Engine.
|
11 |
+
*
|
12 |
+
* @see https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT .ZIP File Format Specification
|
13 |
+
*
|
14 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
15 |
+
* @license MIT
|
16 |
+
*/
|
17 |
+
class PKCryptContext
|
18 |
+
{
|
19 |
+
/** Encryption header size */
|
20 |
+
const STD_DEC_HDR_SIZE = 12;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Crc table.
|
24 |
+
*
|
25 |
+
* @var int[]|array
|
26 |
+
*/
|
27 |
+
private static $CRC_TABLE = [
|
28 |
+
0x00000000,
|
29 |
+
0x77073096,
|
30 |
+
0xee0e612c,
|
31 |
+
0x990951ba,
|
32 |
+
0x076dc419,
|
33 |
+
0x706af48f,
|
34 |
+
0xe963a535,
|
35 |
+
0x9e6495a3,
|
36 |
+
0x0edb8832,
|
37 |
+
0x79dcb8a4,
|
38 |
+
0xe0d5e91e,
|
39 |
+
0x97d2d988,
|
40 |
+
0x09b64c2b,
|
41 |
+
0x7eb17cbd,
|
42 |
+
0xe7b82d07,
|
43 |
+
0x90bf1d91,
|
44 |
+
0x1db71064,
|
45 |
+
0x6ab020f2,
|
46 |
+
0xf3b97148,
|
47 |
+
0x84be41de,
|
48 |
+
0x1adad47d,
|
49 |
+
0x6ddde4eb,
|
50 |
+
0xf4d4b551,
|
51 |
+
0x83d385c7,
|
52 |
+
0x136c9856,
|
53 |
+
0x646ba8c0,
|
54 |
+
0xfd62f97a,
|
55 |
+
0x8a65c9ec,
|
56 |
+
0x14015c4f,
|
57 |
+
0x63066cd9,
|
58 |
+
0xfa0f3d63,
|
59 |
+
0x8d080df5,
|
60 |
+
0x3b6e20c8,
|
61 |
+
0x4c69105e,
|
62 |
+
0xd56041e4,
|
63 |
+
0xa2677172,
|
64 |
+
0x3c03e4d1,
|
65 |
+
0x4b04d447,
|
66 |
+
0xd20d85fd,
|
67 |
+
0xa50ab56b,
|
68 |
+
0x35b5a8fa,
|
69 |
+
0x42b2986c,
|
70 |
+
0xdbbbc9d6,
|
71 |
+
0xacbcf940,
|
72 |
+
0x32d86ce3,
|
73 |
+
0x45df5c75,
|
74 |
+
0xdcd60dcf,
|
75 |
+
0xabd13d59,
|
76 |
+
0x26d930ac,
|
77 |
+
0x51de003a,
|
78 |
+
0xc8d75180,
|
79 |
+
0xbfd06116,
|
80 |
+
0x21b4f4b5,
|
81 |
+
0x56b3c423,
|
82 |
+
0xcfba9599,
|
83 |
+
0xb8bda50f,
|
84 |
+
0x2802b89e,
|
85 |
+
0x5f058808,
|
86 |
+
0xc60cd9b2,
|
87 |
+
0xb10be924,
|
88 |
+
0x2f6f7c87,
|
89 |
+
0x58684c11,
|
90 |
+
0xc1611dab,
|
91 |
+
0xb6662d3d,
|
92 |
+
0x76dc4190,
|
93 |
+
0x01db7106,
|
94 |
+
0x98d220bc,
|
95 |
+
0xefd5102a,
|
96 |
+
0x71b18589,
|
97 |
+
0x06b6b51f,
|
98 |
+
0x9fbfe4a5,
|
99 |
+
0xe8b8d433,
|
100 |
+
0x7807c9a2,
|
101 |
+
0x0f00f934,
|
102 |
+
0x9609a88e,
|
103 |
+
0xe10e9818,
|
104 |
+
0x7f6a0dbb,
|
105 |
+
0x086d3d2d,
|
106 |
+
0x91646c97,
|
107 |
+
0xe6635c01,
|
108 |
+
0x6b6b51f4,
|
109 |
+
0x1c6c6162,
|
110 |
+
0x856530d8,
|
111 |
+
0xf262004e,
|
112 |
+
0x6c0695ed,
|
113 |
+
0x1b01a57b,
|
114 |
+
0x8208f4c1,
|
115 |
+
0xf50fc457,
|
116 |
+
0x65b0d9c6,
|
117 |
+
0x12b7e950,
|
118 |
+
0x8bbeb8ea,
|
119 |
+
0xfcb9887c,
|
120 |
+
0x62dd1ddf,
|
121 |
+
0x15da2d49,
|
122 |
+
0x8cd37cf3,
|
123 |
+
0xfbd44c65,
|
124 |
+
0x4db26158,
|
125 |
+
0x3ab551ce,
|
126 |
+
0xa3bc0074,
|
127 |
+
0xd4bb30e2,
|
128 |
+
0x4adfa541,
|
129 |
+
0x3dd895d7,
|
130 |
+
0xa4d1c46d,
|
131 |
+
0xd3d6f4fb,
|
132 |
+
0x4369e96a,
|
133 |
+
0x346ed9fc,
|
134 |
+
0xad678846,
|
135 |
+
0xda60b8d0,
|
136 |
+
0x44042d73,
|
137 |
+
0x33031de5,
|
138 |
+
0xaa0a4c5f,
|
139 |
+
0xdd0d7cc9,
|
140 |
+
0x5005713c,
|
141 |
+
0x270241aa,
|
142 |
+
0xbe0b1010,
|
143 |
+
0xc90c2086,
|
144 |
+
0x5768b525,
|
145 |
+
0x206f85b3,
|
146 |
+
0xb966d409,
|
147 |
+
0xce61e49f,
|
148 |
+
0x5edef90e,
|
149 |
+
0x29d9c998,
|
150 |
+
0xb0d09822,
|
151 |
+
0xc7d7a8b4,
|
152 |
+
0x59b33d17,
|
153 |
+
0x2eb40d81,
|
154 |
+
0xb7bd5c3b,
|
155 |
+
0xc0ba6cad,
|
156 |
+
0xedb88320,
|
157 |
+
0x9abfb3b6,
|
158 |
+
0x03b6e20c,
|
159 |
+
0x74b1d29a,
|
160 |
+
0xead54739,
|
161 |
+
0x9dd277af,
|
162 |
+
0x04db2615,
|
163 |
+
0x73dc1683,
|
164 |
+
0xe3630b12,
|
165 |
+
0x94643b84,
|
166 |
+
0x0d6d6a3e,
|
167 |
+
0x7a6a5aa8,
|
168 |
+
0xe40ecf0b,
|
169 |
+
0x9309ff9d,
|
170 |
+
0x0a00ae27,
|
171 |
+
0x7d079eb1,
|
172 |
+
0xf00f9344,
|
173 |
+
0x8708a3d2,
|
174 |
+
0x1e01f268,
|
175 |
+
0x6906c2fe,
|
176 |
+
0xf762575d,
|
177 |
+
0x806567cb,
|
178 |
+
0x196c3671,
|
179 |
+
0x6e6b06e7,
|
180 |
+
0xfed41b76,
|
181 |
+
0x89d32be0,
|
182 |
+
0x10da7a5a,
|
183 |
+
0x67dd4acc,
|
184 |
+
0xf9b9df6f,
|
185 |
+
0x8ebeeff9,
|
186 |
+
0x17b7be43,
|
187 |
+
0x60b08ed5,
|
188 |
+
0xd6d6a3e8,
|
189 |
+
0xa1d1937e,
|
190 |
+
0x38d8c2c4,
|
191 |
+
0x4fdff252,
|
192 |
+
0xd1bb67f1,
|
193 |
+
0xa6bc5767,
|
194 |
+
0x3fb506dd,
|
195 |
+
0x48b2364b,
|
196 |
+
0xd80d2bda,
|
197 |
+
0xaf0a1b4c,
|
198 |
+
0x36034af6,
|
199 |
+
0x41047a60,
|
200 |
+
0xdf60efc3,
|
201 |
+
0xa867df55,
|
202 |
+
0x316e8eef,
|
203 |
+
0x4669be79,
|
204 |
+
0xcb61b38c,
|
205 |
+
0xbc66831a,
|
206 |
+
0x256fd2a0,
|
207 |
+
0x5268e236,
|
208 |
+
0xcc0c7795,
|
209 |
+
0xbb0b4703,
|
210 |
+
0x220216b9,
|
211 |
+
0x5505262f,
|
212 |
+
0xc5ba3bbe,
|
213 |
+
0xb2bd0b28,
|
214 |
+
0x2bb45a92,
|
215 |
+
0x5cb36a04,
|
216 |
+
0xc2d7ffa7,
|
217 |
+
0xb5d0cf31,
|
218 |
+
0x2cd99e8b,
|
219 |
+
0x5bdeae1d,
|
220 |
+
0x9b64c2b0,
|
221 |
+
0xec63f226,
|
222 |
+
0x756aa39c,
|
223 |
+
0x026d930a,
|
224 |
+
0x9c0906a9,
|
225 |
+
0xeb0e363f,
|
226 |
+
0x72076785,
|
227 |
+
0x05005713,
|
228 |
+
0x95bf4a82,
|
229 |
+
0xe2b87a14,
|
230 |
+
0x7bb12bae,
|
231 |
+
0x0cb61b38,
|
232 |
+
0x92d28e9b,
|
233 |
+
0xe5d5be0d,
|
234 |
+
0x7cdcefb7,
|
235 |
+
0x0bdbdf21,
|
236 |
+
0x86d3d2d4,
|
237 |
+
0xf1d4e242,
|
238 |
+
0x68ddb3f8,
|
239 |
+
0x1fda836e,
|
240 |
+
0x81be16cd,
|
241 |
+
0xf6b9265b,
|
242 |
+
0x6fb077e1,
|
243 |
+
0x18b74777,
|
244 |
+
0x88085ae6,
|
245 |
+
0xff0f6a70,
|
246 |
+
0x66063bca,
|
247 |
+
0x11010b5c,
|
248 |
+
0x8f659eff,
|
249 |
+
0xf862ae69,
|
250 |
+
0x616bffd3,
|
251 |
+
0x166ccf45,
|
252 |
+
0xa00ae278,
|
253 |
+
0xd70dd2ee,
|
254 |
+
0x4e048354,
|
255 |
+
0x3903b3c2,
|
256 |
+
0xa7672661,
|
257 |
+
0xd06016f7,
|
258 |
+
0x4969474d,
|
259 |
+
0x3e6e77db,
|
260 |
+
0xaed16a4a,
|
261 |
+
0xd9d65adc,
|
262 |
+
0x40df0b66,
|
263 |
+
0x37d83bf0,
|
264 |
+
0xa9bcae53,
|
265 |
+
0xdebb9ec5,
|
266 |
+
0x47b2cf7f,
|
267 |
+
0x30b5ffe9,
|
268 |
+
0xbdbdf21c,
|
269 |
+
0xcabac28a,
|
270 |
+
0x53b39330,
|
271 |
+
0x24b4a3a6,
|
272 |
+
0xbad03605,
|
273 |
+
0xcdd70693,
|
274 |
+
0x54de5729,
|
275 |
+
0x23d967bf,
|
276 |
+
0xb3667a2e,
|
277 |
+
0xc4614ab8,
|
278 |
+
0x5d681b02,
|
279 |
+
0x2a6f2b94,
|
280 |
+
0xb40bbe37,
|
281 |
+
0xc30c8ea1,
|
282 |
+
0x5a05df1b,
|
283 |
+
0x2d02ef8d,
|
284 |
+
];
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Encryption keys.
|
288 |
+
*
|
289 |
+
* @var array
|
290 |
+
*/
|
291 |
+
private $keys;
|
292 |
+
|
293 |
+
/**
|
294 |
+
* PKCryptContext constructor.
|
295 |
+
*
|
296 |
+
* @param string $password
|
297 |
+
*/
|
298 |
+
public function __construct($password)
|
299 |
+
{
|
300 |
+
if (\PHP_INT_SIZE === 4) {
|
301 |
+
throw new RuntimeException('Traditional PKWARE Encryption is not supported in 32-bit PHP.');
|
302 |
+
}
|
303 |
+
|
304 |
+
$this->keys = [
|
305 |
+
305419896,
|
306 |
+
591751049,
|
307 |
+
878082192,
|
308 |
+
];
|
309 |
+
|
310 |
+
foreach (unpack('C*', $password) as $b) {
|
311 |
+
$this->updateKeys($b);
|
312 |
+
}
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* @param string $header
|
317 |
+
* @param int $checkByte
|
318 |
+
*
|
319 |
+
* @throws ZipAuthenticationException
|
320 |
+
*/
|
321 |
+
public function checkHeader($header, $checkByte)
|
322 |
+
{
|
323 |
+
$byte = 0;
|
324 |
+
|
325 |
+
foreach (unpack('C*', $header) as $byte) {
|
326 |
+
$byte = ($byte ^ $this->decryptByte()) & 0xff;
|
327 |
+
$this->updateKeys($byte);
|
328 |
+
}
|
329 |
+
|
330 |
+
if ($byte !== $checkByte) {
|
331 |
+
throw new ZipAuthenticationException(sprintf('Invalid password'));
|
332 |
+
}
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* @param string $content
|
337 |
+
*
|
338 |
+
* @return string
|
339 |
+
*/
|
340 |
+
public function decryptString($content)
|
341 |
+
{
|
342 |
+
$decryptContent = '';
|
343 |
+
|
344 |
+
foreach (unpack('C*', $content) as $byte) {
|
345 |
+
$byte = ($byte ^ $this->decryptByte()) & 0xff;
|
346 |
+
$this->updateKeys($byte);
|
347 |
+
$decryptContent .= \chr($byte);
|
348 |
+
}
|
349 |
+
|
350 |
+
return $decryptContent;
|
351 |
+
}
|
352 |
+
|
353 |
+
/**
|
354 |
+
* Decrypt byte.
|
355 |
+
*
|
356 |
+
* @return int
|
357 |
+
*/
|
358 |
+
private function decryptByte()
|
359 |
+
{
|
360 |
+
$temp = $this->keys[2] | 2;
|
361 |
+
|
362 |
+
return (($temp * ($temp ^ 1)) >> 8) & 0xffffff;
|
363 |
+
}
|
364 |
+
|
365 |
+
/**
|
366 |
+
* Update keys.
|
367 |
+
*
|
368 |
+
* @param int $charAt
|
369 |
+
*/
|
370 |
+
private function updateKeys($charAt)
|
371 |
+
{
|
372 |
+
$this->keys[0] = $this->crc32($this->keys[0], $charAt);
|
373 |
+
$this->keys[1] += ($this->keys[0] & 0xff);
|
374 |
+
$this->keys[1] = PackUtil::toSignedInt32($this->keys[1] * 134775813 + 1);
|
375 |
+
$this->keys[2] = PackUtil::toSignedInt32($this->crc32($this->keys[2], ($this->keys[1] >> 24) & 0xff));
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* Update crc.
|
380 |
+
*
|
381 |
+
* @param int $oldCrc
|
382 |
+
* @param int $charAt
|
383 |
+
*
|
384 |
+
* @return int
|
385 |
+
*/
|
386 |
+
private function crc32($oldCrc, $charAt)
|
387 |
+
{
|
388 |
+
return (($oldCrc >> 8) & 0xffffff) ^ self::$CRC_TABLE[($oldCrc ^ $charAt) & 0xff];
|
389 |
+
}
|
390 |
+
|
391 |
+
/**
|
392 |
+
* @param string $content
|
393 |
+
*
|
394 |
+
* @return string
|
395 |
+
*/
|
396 |
+
public function encryptString($content)
|
397 |
+
{
|
398 |
+
$encryptContent = '';
|
399 |
+
|
400 |
+
foreach (unpack('C*', $content) as $val) {
|
401 |
+
$encryptContent .= pack('c', $this->encryptByte($val));
|
402 |
+
}
|
403 |
+
|
404 |
+
return $encryptContent;
|
405 |
+
}
|
406 |
+
|
407 |
+
/**
|
408 |
+
* @param int $byte
|
409 |
+
*
|
410 |
+
* @return int
|
411 |
+
*/
|
412 |
+
private function encryptByte($byte)
|
413 |
+
{
|
414 |
+
$tempVal = $byte ^ $this->decryptByte() & 0xff;
|
415 |
+
$this->updateKeys($byte);
|
416 |
+
|
417 |
+
return $tempVal;
|
418 |
+
}
|
419 |
+
}
|
library/vendor/nelexa/zip/src/IO/Filter/Cipher/Pkware/PKDecryptionStreamFilter.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\IO\Filter\Cipher\Pkware;
|
4 |
+
|
5 |
+
use PhpZip\Exception\ZipException;
|
6 |
+
use PhpZip\Model\ZipEntry;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Decryption PKWARE Traditional Encryption.
|
10 |
+
*/
|
11 |
+
class PKDecryptionStreamFilter extends \php_user_filter
|
12 |
+
{
|
13 |
+
const FILTER_NAME = 'phpzip.decryption.pkware';
|
14 |
+
|
15 |
+
/** @var int */
|
16 |
+
private $checkByte = 0;
|
17 |
+
|
18 |
+
/** @var int */
|
19 |
+
private $readLength = 0;
|
20 |
+
|
21 |
+
/** @var int */
|
22 |
+
private $size = 0;
|
23 |
+
|
24 |
+
/** @var bool */
|
25 |
+
private $readHeader = false;
|
26 |
+
|
27 |
+
/** @var PKCryptContext */
|
28 |
+
private $context;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @return bool
|
32 |
+
*/
|
33 |
+
public static function register()
|
34 |
+
{
|
35 |
+
return stream_filter_register(self::FILTER_NAME, __CLASS__);
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @see https://php.net/manual/en/php-user-filter.oncreate.php
|
40 |
+
*
|
41 |
+
* @return bool
|
42 |
+
*/
|
43 |
+
public function onCreate()
|
44 |
+
{
|
45 |
+
if (!isset($this->params['entry'])) {
|
46 |
+
return false;
|
47 |
+
}
|
48 |
+
|
49 |
+
if (!($this->params['entry'] instanceof ZipEntry)) {
|
50 |
+
throw new \RuntimeException('ZipEntry expected');
|
51 |
+
}
|
52 |
+
/** @var ZipEntry $entry */
|
53 |
+
$entry = $this->params['entry'];
|
54 |
+
$password = $entry->getPassword();
|
55 |
+
|
56 |
+
if ($password === null) {
|
57 |
+
return false;
|
58 |
+
}
|
59 |
+
|
60 |
+
$this->size = $entry->getCompressedSize();
|
61 |
+
|
62 |
+
// init context
|
63 |
+
$this->context = new PKCryptContext($password);
|
64 |
+
|
65 |
+
// init check byte
|
66 |
+
if ($entry->isDataDescriptorEnabled()) {
|
67 |
+
$this->checkByte = ($entry->getDosTime() >> 8) & 0xff;
|
68 |
+
} else {
|
69 |
+
$this->checkByte = ($entry->getCrc() >> 24) & 0xff;
|
70 |
+
}
|
71 |
+
|
72 |
+
$this->readLength = 0;
|
73 |
+
$this->readHeader = false;
|
74 |
+
|
75 |
+
return true;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Decryption filter.
|
80 |
+
*
|
81 |
+
* @param resource $in
|
82 |
+
* @param resource $out
|
83 |
+
* @param int $consumed
|
84 |
+
* @param bool $closing
|
85 |
+
*
|
86 |
+
* @throws ZipException
|
87 |
+
*
|
88 |
+
* @return int
|
89 |
+
*
|
90 |
+
* @todo USE FFI in php 7.4
|
91 |
+
*/
|
92 |
+
public function filter($in, $out, &$consumed, $closing)
|
93 |
+
{
|
94 |
+
while ($bucket = stream_bucket_make_writeable($in)) {
|
95 |
+
$buffer = $bucket->data;
|
96 |
+
$this->readLength += $bucket->datalen;
|
97 |
+
|
98 |
+
if ($this->readLength > $this->size) {
|
99 |
+
$buffer = substr($buffer, 0, $this->size - $this->readLength);
|
100 |
+
}
|
101 |
+
|
102 |
+
if (!$this->readHeader) {
|
103 |
+
$header = substr($buffer, 0, PKCryptContext::STD_DEC_HDR_SIZE);
|
104 |
+
$this->context->checkHeader($header, $this->checkByte);
|
105 |
+
|
106 |
+
$buffer = substr($buffer, PKCryptContext::STD_DEC_HDR_SIZE);
|
107 |
+
$this->readHeader = true;
|
108 |
+
}
|
109 |
+
|
110 |
+
$bucket->data = $this->context->decryptString($buffer);
|
111 |
+
|
112 |
+
$consumed += $bucket->datalen;
|
113 |
+
stream_bucket_append($out, $bucket);
|
114 |
+
}
|
115 |
+
|
116 |
+
return \PSFS_PASS_ON;
|
117 |
+
}
|
118 |
+
}
|
library/vendor/nelexa/zip/src/IO/Filter/Cipher/Pkware/PKEncryptionStreamFilter.php
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\IO\Filter\Cipher\Pkware;
|
4 |
+
|
5 |
+
use PhpZip\Exception\RuntimeException;
|
6 |
+
use PhpZip\Model\ZipEntry;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Encryption PKWARE Traditional Encryption.
|
10 |
+
*/
|
11 |
+
class PKEncryptionStreamFilter extends \php_user_filter
|
12 |
+
{
|
13 |
+
const FILTER_NAME = 'phpzip.encryption.pkware';
|
14 |
+
|
15 |
+
/** @var int */
|
16 |
+
private $size;
|
17 |
+
|
18 |
+
/** @var string */
|
19 |
+
private $headerBytes;
|
20 |
+
|
21 |
+
/** @var int */
|
22 |
+
private $writeLength;
|
23 |
+
|
24 |
+
/** @var bool */
|
25 |
+
private $writeHeader;
|
26 |
+
|
27 |
+
/** @var PKCryptContext */
|
28 |
+
private $context;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @return bool
|
32 |
+
*/
|
33 |
+
public static function register()
|
34 |
+
{
|
35 |
+
return stream_filter_register(self::FILTER_NAME, __CLASS__);
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @see https://php.net/manual/en/php-user-filter.oncreate.php
|
40 |
+
*
|
41 |
+
* @return bool
|
42 |
+
*/
|
43 |
+
public function onCreate()
|
44 |
+
{
|
45 |
+
if (\PHP_INT_SIZE === 4) {
|
46 |
+
throw new RuntimeException('Traditional PKWARE Encryption is not supported in 32-bit PHP.');
|
47 |
+
}
|
48 |
+
|
49 |
+
if (!isset($this->params['entry'], $this->params['size'])) {
|
50 |
+
return false;
|
51 |
+
}
|
52 |
+
|
53 |
+
if (!($this->params['entry'] instanceof ZipEntry)) {
|
54 |
+
throw new \RuntimeException('ZipEntry expected');
|
55 |
+
}
|
56 |
+
/** @var ZipEntry $entry */
|
57 |
+
$entry = $this->params['entry'];
|
58 |
+
$password = $entry->getPassword();
|
59 |
+
|
60 |
+
if ($password === null) {
|
61 |
+
return false;
|
62 |
+
}
|
63 |
+
|
64 |
+
$this->size = (int) $this->params['size'];
|
65 |
+
|
66 |
+
// init keys
|
67 |
+
$this->context = new PKCryptContext($password);
|
68 |
+
|
69 |
+
$crc = $entry->isDataDescriptorRequired() || $entry->getCrc() === ZipEntry::UNKNOWN ?
|
70 |
+
($entry->getDosTime() & 0x0000ffff) << 16 :
|
71 |
+
$entry->getCrc();
|
72 |
+
|
73 |
+
try {
|
74 |
+
$headerBytes = random_bytes(PKCryptContext::STD_DEC_HDR_SIZE);
|
75 |
+
} catch (\Exception $e) {
|
76 |
+
throw new \RuntimeException('Oops, our server is bust and cannot generate any random data.', 1, $e);
|
77 |
+
}
|
78 |
+
|
79 |
+
$headerBytes[PKCryptContext::STD_DEC_HDR_SIZE - 1] = pack('c', ($crc >> 24) & 0xff);
|
80 |
+
$headerBytes[PKCryptContext::STD_DEC_HDR_SIZE - 2] = pack('c', ($crc >> 16) & 0xff);
|
81 |
+
|
82 |
+
$this->headerBytes = $headerBytes;
|
83 |
+
$this->writeLength = 0;
|
84 |
+
$this->writeHeader = false;
|
85 |
+
|
86 |
+
return true;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Encryption filter.
|
91 |
+
*
|
92 |
+
* @param resource $in
|
93 |
+
* @param resource $out
|
94 |
+
* @param int $consumed
|
95 |
+
* @param bool $closing
|
96 |
+
*
|
97 |
+
* @return int
|
98 |
+
*
|
99 |
+
* @todo USE FFI in php 7.4
|
100 |
+
*/
|
101 |
+
public function filter($in, $out, &$consumed, $closing)
|
102 |
+
{
|
103 |
+
while ($bucket = stream_bucket_make_writeable($in)) {
|
104 |
+
$buffer = $bucket->data;
|
105 |
+
$this->writeLength += $bucket->datalen;
|
106 |
+
|
107 |
+
if ($this->writeLength > $this->size) {
|
108 |
+
$buffer = substr($buffer, 0, $this->size - $this->writeLength);
|
109 |
+
}
|
110 |
+
|
111 |
+
$data = '';
|
112 |
+
|
113 |
+
if (!$this->writeHeader) {
|
114 |
+
$data .= $this->context->encryptString($this->headerBytes);
|
115 |
+
$this->writeHeader = true;
|
116 |
+
}
|
117 |
+
|
118 |
+
$data .= $this->context->encryptString($buffer);
|
119 |
+
|
120 |
+
$bucket->data = $data;
|
121 |
+
|
122 |
+
$consumed += $bucket->datalen;
|
123 |
+
stream_bucket_append($out, $bucket);
|
124 |
+
}
|
125 |
+
|
126 |
+
return \PSFS_PASS_ON;
|
127 |
+
}
|
128 |
+
}
|
library/vendor/nelexa/zip/src/IO/Filter/Cipher/WinZipAes/WinZipAesContext.php
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\IO\Filter\Cipher\WinZipAes;
|
4 |
+
|
5 |
+
use PhpZip\Exception\RuntimeException;
|
6 |
+
use PhpZip\Exception\ZipAuthenticationException;
|
7 |
+
use PhpZip\Util\CryptoUtil;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* WinZip Aes Encryption.
|
11 |
+
*
|
12 |
+
* @see https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT APPENDIX E
|
13 |
+
* @see https://www.winzip.com/win/en/aes_info.html
|
14 |
+
*
|
15 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
16 |
+
* @license MIT
|
17 |
+
*
|
18 |
+
* @internal
|
19 |
+
*/
|
20 |
+
class WinZipAesContext
|
21 |
+
{
|
22 |
+
/** @var int AES Block size */
|
23 |
+
const BLOCK_SIZE = self::IV_SIZE;
|
24 |
+
|
25 |
+
/** @var int Footer size */
|
26 |
+
const FOOTER_SIZE = 10;
|
27 |
+
|
28 |
+
/** @var int The iteration count for the derived keys of the cipher, KLAC and MAC. */
|
29 |
+
const ITERATION_COUNT = 1000;
|
30 |
+
|
31 |
+
/** @var int Password verifier size */
|
32 |
+
const PASSWORD_VERIFIER_SIZE = 2;
|
33 |
+
|
34 |
+
/** @var int IV size */
|
35 |
+
const IV_SIZE = 16;
|
36 |
+
|
37 |
+
/** @var string */
|
38 |
+
private $iv;
|
39 |
+
|
40 |
+
/** @var string */
|
41 |
+
private $key;
|
42 |
+
|
43 |
+
/** @var \HashContext|resource */
|
44 |
+
private $hmacContext;
|
45 |
+
|
46 |
+
/** @var string */
|
47 |
+
private $passwordVerifier;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* WinZipAesContext constructor.
|
51 |
+
*
|
52 |
+
* @param int $encryptionStrengthBits
|
53 |
+
* @param string $password
|
54 |
+
* @param string $salt
|
55 |
+
*/
|
56 |
+
public function __construct($encryptionStrengthBits, $password, $salt)
|
57 |
+
{
|
58 |
+
$encryptionStrengthBits = (int) $encryptionStrengthBits;
|
59 |
+
|
60 |
+
if ($password === '') {
|
61 |
+
throw new RuntimeException('$password is empty');
|
62 |
+
}
|
63 |
+
|
64 |
+
if (empty($salt)) {
|
65 |
+
throw new RuntimeException('$salt is empty');
|
66 |
+
}
|
67 |
+
|
68 |
+
// WinZip 99-character limit https://sourceforge.net/p/p7zip/discussion/383044/thread/c859a2f0/
|
69 |
+
$password = substr($password, 0, 99);
|
70 |
+
|
71 |
+
$this->iv = str_repeat("\0", self::IV_SIZE);
|
72 |
+
$keyStrengthBytes = (int) ($encryptionStrengthBits / 8);
|
73 |
+
$hashLength = $keyStrengthBytes * 2 + self::PASSWORD_VERIFIER_SIZE * 8;
|
74 |
+
|
75 |
+
$hash = hash_pbkdf2(
|
76 |
+
'sha1',
|
77 |
+
$password,
|
78 |
+
$salt,
|
79 |
+
self::ITERATION_COUNT,
|
80 |
+
$hashLength,
|
81 |
+
true
|
82 |
+
);
|
83 |
+
|
84 |
+
$this->key = substr($hash, 0, $keyStrengthBytes);
|
85 |
+
$sha1Mac = substr($hash, $keyStrengthBytes, $keyStrengthBytes);
|
86 |
+
$this->hmacContext = hash_init('sha1', \HASH_HMAC, $sha1Mac);
|
87 |
+
$this->passwordVerifier = substr($hash, 2 * $keyStrengthBytes, self::PASSWORD_VERIFIER_SIZE);
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* @return string
|
92 |
+
*/
|
93 |
+
public function getPasswordVerifier()
|
94 |
+
{
|
95 |
+
return $this->passwordVerifier;
|
96 |
+
}
|
97 |
+
|
98 |
+
public function updateIv()
|
99 |
+
{
|
100 |
+
for ($ivCharIndex = 0; $ivCharIndex < self::IV_SIZE; $ivCharIndex++) {
|
101 |
+
$ivByte = \ord($this->iv[$ivCharIndex]);
|
102 |
+
|
103 |
+
if (++$ivByte === 256) {
|
104 |
+
// overflow, set this one to 0, increment next
|
105 |
+
$this->iv[$ivCharIndex] = "\0";
|
106 |
+
} else {
|
107 |
+
// no overflow, just write incremented number back and abort
|
108 |
+
$this->iv[$ivCharIndex] = \chr($ivByte);
|
109 |
+
|
110 |
+
break;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* @param string $data
|
117 |
+
*
|
118 |
+
* @return string
|
119 |
+
*/
|
120 |
+
public function decryption($data)
|
121 |
+
{
|
122 |
+
hash_update($this->hmacContext, $data);
|
123 |
+
|
124 |
+
return CryptoUtil::decryptAesCtr($data, $this->key, $this->iv);
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* @param string $data
|
129 |
+
*
|
130 |
+
* @return string
|
131 |
+
*/
|
132 |
+
public function encrypt($data)
|
133 |
+
{
|
134 |
+
$encryptionData = CryptoUtil::encryptAesCtr($data, $this->key, $this->iv);
|
135 |
+
hash_update($this->hmacContext, $encryptionData);
|
136 |
+
|
137 |
+
return $encryptionData;
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* @param string $authCode
|
142 |
+
*
|
143 |
+
* @throws ZipAuthenticationException
|
144 |
+
*/
|
145 |
+
public function checkAuthCode($authCode)
|
146 |
+
{
|
147 |
+
$hmac = $this->getHmac();
|
148 |
+
|
149 |
+
// check authenticationCode
|
150 |
+
if (strcmp($hmac, $authCode) !== 0) {
|
151 |
+
throw new ZipAuthenticationException('Authenticated WinZip AES entry content has been tampered with.');
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* @return string
|
157 |
+
*/
|
158 |
+
public function getHmac()
|
159 |
+
{
|
160 |
+
return substr(
|
161 |
+
hash_final($this->hmacContext, true),
|
162 |
+
0,
|
163 |
+
self::FOOTER_SIZE
|
164 |
+
);
|
165 |
+
}
|
166 |
+
}
|
library/vendor/nelexa/zip/src/IO/Filter/Cipher/WinZipAes/WinZipAesDecryptionStreamFilter.php
ADDED
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\IO\Filter\Cipher\WinZipAes;
|
4 |
+
|
5 |
+
use PhpZip\Exception\RuntimeException;
|
6 |
+
use PhpZip\Exception\ZipAuthenticationException;
|
7 |
+
use PhpZip\Model\Extra\Fields\WinZipAesExtraField;
|
8 |
+
use PhpZip\Model\ZipEntry;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Decrypt WinZip AES stream.
|
12 |
+
*/
|
13 |
+
class WinZipAesDecryptionStreamFilter extends \php_user_filter
|
14 |
+
{
|
15 |
+
const FILTER_NAME = 'phpzip.decryption.winzipaes';
|
16 |
+
|
17 |
+
/** @var string */
|
18 |
+
private $buffer;
|
19 |
+
|
20 |
+
/** @var string */
|
21 |
+
private $authenticationCode;
|
22 |
+
|
23 |
+
/** @var int */
|
24 |
+
private $encBlockPosition = 0;
|
25 |
+
|
26 |
+
/** @var int */
|
27 |
+
private $encBlockLength = 0;
|
28 |
+
|
29 |
+
/** @var int */
|
30 |
+
private $readLength = 0;
|
31 |
+
|
32 |
+
/** @var ZipEntry */
|
33 |
+
private $entry;
|
34 |
+
|
35 |
+
/** @var WinZipAesContext|null */
|
36 |
+
private $context;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @return bool
|
40 |
+
*/
|
41 |
+
public static function register()
|
42 |
+
{
|
43 |
+
return stream_filter_register(self::FILTER_NAME, __CLASS__);
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @return bool
|
48 |
+
*
|
49 |
+
* @noinspection DuplicatedCode
|
50 |
+
*/
|
51 |
+
public function onCreate()
|
52 |
+
{
|
53 |
+
if (!isset($this->params['entry'])) {
|
54 |
+
return false;
|
55 |
+
}
|
56 |
+
|
57 |
+
if (!($this->params['entry'] instanceof ZipEntry)) {
|
58 |
+
throw new \RuntimeException('ZipEntry expected');
|
59 |
+
}
|
60 |
+
$this->entry = $this->params['entry'];
|
61 |
+
|
62 |
+
if (
|
63 |
+
$this->entry->getPassword() === null ||
|
64 |
+
!$this->entry->isEncrypted() ||
|
65 |
+
!$this->entry->hasExtraField(WinZipAesExtraField::HEADER_ID)
|
66 |
+
) {
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
|
70 |
+
$this->buffer = '';
|
71 |
+
|
72 |
+
return true;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* @param resource $in
|
77 |
+
* @param resource $out
|
78 |
+
* @param int $consumed
|
79 |
+
* @param bool $closing
|
80 |
+
*
|
81 |
+
* @throws ZipAuthenticationException
|
82 |
+
*
|
83 |
+
* @return int
|
84 |
+
*/
|
85 |
+
public function filter($in, $out, &$consumed, $closing)
|
86 |
+
{
|
87 |
+
while ($bucket = stream_bucket_make_writeable($in)) {
|
88 |
+
$this->buffer .= $bucket->data;
|
89 |
+
$this->readLength += $bucket->datalen;
|
90 |
+
|
91 |
+
if ($this->readLength > $this->entry->getCompressedSize()) {
|
92 |
+
$this->buffer = substr($this->buffer, 0, $this->entry->getCompressedSize() - $this->readLength);
|
93 |
+
}
|
94 |
+
|
95 |
+
// read header
|
96 |
+
if ($this->context === null) {
|
97 |
+
/**
|
98 |
+
* @var WinZipAesExtraField|null $winZipExtra
|
99 |
+
*/
|
100 |
+
$winZipExtra = $this->entry->getExtraField(WinZipAesExtraField::HEADER_ID);
|
101 |
+
|
102 |
+
if ($winZipExtra === null) {
|
103 |
+
throw new RuntimeException('$winZipExtra is null');
|
104 |
+
}
|
105 |
+
$saltSize = $winZipExtra->getSaltSize();
|
106 |
+
$headerSize = $saltSize + WinZipAesContext::PASSWORD_VERIFIER_SIZE;
|
107 |
+
|
108 |
+
if (\strlen($this->buffer) < $headerSize) {
|
109 |
+
return \PSFS_FEED_ME;
|
110 |
+
}
|
111 |
+
|
112 |
+
$salt = substr($this->buffer, 0, $saltSize);
|
113 |
+
$passwordVerifier = substr($this->buffer, $saltSize, WinZipAesContext::PASSWORD_VERIFIER_SIZE);
|
114 |
+
$password = $this->entry->getPassword();
|
115 |
+
|
116 |
+
if ($password === null) {
|
117 |
+
throw new RuntimeException('$password is null');
|
118 |
+
}
|
119 |
+
$this->context = new WinZipAesContext($winZipExtra->getEncryptionStrength(), $password, $salt);
|
120 |
+
unset($password);
|
121 |
+
|
122 |
+
// Verify password.
|
123 |
+
if ($passwordVerifier !== $this->context->getPasswordVerifier()) {
|
124 |
+
throw new ZipAuthenticationException('Invalid password');
|
125 |
+
}
|
126 |
+
|
127 |
+
$this->encBlockPosition = 0;
|
128 |
+
$this->encBlockLength = $this->entry->getCompressedSize() - $headerSize - WinZipAesContext::FOOTER_SIZE;
|
129 |
+
|
130 |
+
$this->buffer = substr($this->buffer, $headerSize);
|
131 |
+
}
|
132 |
+
|
133 |
+
// encrypt data
|
134 |
+
$plainText = '';
|
135 |
+
$offset = 0;
|
136 |
+
$len = \strlen($this->buffer);
|
137 |
+
$remaining = $this->encBlockLength - $this->encBlockPosition;
|
138 |
+
|
139 |
+
if ($remaining >= WinZipAesContext::BLOCK_SIZE && $len < WinZipAesContext::BLOCK_SIZE) {
|
140 |
+
return \PSFS_FEED_ME;
|
141 |
+
}
|
142 |
+
$limit = min($len, $remaining);
|
143 |
+
|
144 |
+
if ($remaining > $limit && ($limit % WinZipAesContext::BLOCK_SIZE) !== 0) {
|
145 |
+
$limit -= ($limit % WinZipAesContext::BLOCK_SIZE);
|
146 |
+
}
|
147 |
+
|
148 |
+
while ($offset < $limit) {
|
149 |
+
$this->context->updateIv();
|
150 |
+
$length = min(WinZipAesContext::BLOCK_SIZE, $limit - $offset);
|
151 |
+
$data = substr($this->buffer, 0, $length);
|
152 |
+
$plainText .= $this->context->decryption($data);
|
153 |
+
$offset += $length;
|
154 |
+
$this->buffer = substr($this->buffer, $length);
|
155 |
+
}
|
156 |
+
$this->encBlockPosition += $offset;
|
157 |
+
|
158 |
+
if (
|
159 |
+
$this->encBlockPosition === $this->encBlockLength &&
|
160 |
+
\strlen($this->buffer) === WinZipAesContext::FOOTER_SIZE
|
161 |
+
) {
|
162 |
+
$this->authenticationCode = $this->buffer;
|
163 |
+
$this->buffer = '';
|
164 |
+
}
|
165 |
+
|
166 |
+
$bucket->data = $plainText;
|
167 |
+
$consumed += $bucket->datalen;
|
168 |
+
stream_bucket_append($out, $bucket);
|
169 |
+
}
|
170 |
+
|
171 |
+
return \PSFS_PASS_ON;
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* @see http://php.net/manual/en/php-user-filter.onclose.php
|
176 |
+
*
|
177 |
+
* @throws ZipAuthenticationException
|
178 |
+
*/
|
179 |
+
public function onClose()
|
180 |
+
{
|
181 |
+
$this->buffer = '';
|
182 |
+
|
183 |
+
if ($this->context !== null) {
|
184 |
+
$this->context->checkAuthCode($this->authenticationCode);
|
185 |
+
}
|
186 |
+
}
|
187 |
+
}
|
library/vendor/nelexa/zip/src/IO/Filter/Cipher/WinZipAes/WinZipAesEncryptionStreamFilter.php
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\IO\Filter\Cipher\WinZipAes;
|
4 |
+
|
5 |
+
use PhpZip\Exception\RuntimeException;
|
6 |
+
use PhpZip\Model\Extra\Fields\WinZipAesExtraField;
|
7 |
+
use PhpZip\Model\ZipEntry;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Encrypt WinZip AES stream.
|
11 |
+
*/
|
12 |
+
class WinZipAesEncryptionStreamFilter extends \php_user_filter
|
13 |
+
{
|
14 |
+
const FILTER_NAME = 'phpzip.encryption.winzipaes';
|
15 |
+
|
16 |
+
/** @var string */
|
17 |
+
private $buffer;
|
18 |
+
|
19 |
+
/** @var int */
|
20 |
+
private $remaining = 0;
|
21 |
+
|
22 |
+
/** @var ZipEntry */
|
23 |
+
private $entry;
|
24 |
+
|
25 |
+
/** @var int */
|
26 |
+
private $size;
|
27 |
+
|
28 |
+
/** @var WinZipAesContext|null */
|
29 |
+
private $context;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @return bool
|
33 |
+
*/
|
34 |
+
public static function register()
|
35 |
+
{
|
36 |
+
return stream_filter_register(self::FILTER_NAME, __CLASS__);
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @return bool
|
41 |
+
*
|
42 |
+
* @noinspection DuplicatedCode
|
43 |
+
*/
|
44 |
+
public function onCreate()
|
45 |
+
{
|
46 |
+
if (!isset($this->params['entry'])) {
|
47 |
+
return false;
|
48 |
+
}
|
49 |
+
|
50 |
+
if (!($this->params['entry'] instanceof ZipEntry)) {
|
51 |
+
throw new \RuntimeException('ZipEntry expected');
|
52 |
+
}
|
53 |
+
$this->entry = $this->params['entry'];
|
54 |
+
|
55 |
+
if (
|
56 |
+
$this->entry->getPassword() === null ||
|
57 |
+
!$this->entry->isEncrypted() ||
|
58 |
+
!$this->entry->hasExtraField(WinZipAesExtraField::HEADER_ID)
|
59 |
+
) {
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
|
63 |
+
$this->size = (int) $this->params['size'];
|
64 |
+
$this->context = null;
|
65 |
+
$this->buffer = '';
|
66 |
+
|
67 |
+
return true;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* @param resource $in
|
72 |
+
* @param resource $out
|
73 |
+
* @param int $consumed
|
74 |
+
* @param bool $closing
|
75 |
+
*
|
76 |
+
* @return int
|
77 |
+
*/
|
78 |
+
public function filter($in, $out, &$consumed, $closing)
|
79 |
+
{
|
80 |
+
while ($bucket = stream_bucket_make_writeable($in)) {
|
81 |
+
$this->buffer .= $bucket->data;
|
82 |
+
$this->remaining += $bucket->datalen;
|
83 |
+
|
84 |
+
if ($this->remaining > $this->size) {
|
85 |
+
$this->buffer = substr($this->buffer, 0, $this->size - $this->remaining);
|
86 |
+
$this->remaining = $this->size;
|
87 |
+
}
|
88 |
+
|
89 |
+
$encryptionText = '';
|
90 |
+
|
91 |
+
// write header
|
92 |
+
if ($this->context === null) {
|
93 |
+
/**
|
94 |
+
* @var WinZipAesExtraField|null $winZipExtra
|
95 |
+
*/
|
96 |
+
$winZipExtra = $this->entry->getExtraField(WinZipAesExtraField::HEADER_ID);
|
97 |
+
|
98 |
+
if ($winZipExtra === null) {
|
99 |
+
throw new RuntimeException('$winZipExtra is null');
|
100 |
+
}
|
101 |
+
$saltSize = $winZipExtra->getSaltSize();
|
102 |
+
|
103 |
+
try {
|
104 |
+
$salt = random_bytes($saltSize);
|
105 |
+
} catch (\Exception $e) {
|
106 |
+
throw new \RuntimeException('Oops, our server is bust and cannot generate any random data.', 1, $e);
|
107 |
+
}
|
108 |
+
$password = $this->entry->getPassword();
|
109 |
+
|
110 |
+
if ($password === null) {
|
111 |
+
throw new RuntimeException('$password is null');
|
112 |
+
}
|
113 |
+
$this->context = new WinZipAesContext(
|
114 |
+
$winZipExtra->getEncryptionStrength(),
|
115 |
+
$password,
|
116 |
+
$salt
|
117 |
+
);
|
118 |
+
|
119 |
+
$encryptionText .= $salt . $this->context->getPasswordVerifier();
|
120 |
+
}
|
121 |
+
|
122 |
+
// encrypt data
|
123 |
+
$offset = 0;
|
124 |
+
$len = \strlen($this->buffer);
|
125 |
+
$remaining = $this->remaining - $this->size;
|
126 |
+
|
127 |
+
if ($remaining >= WinZipAesContext::BLOCK_SIZE && $len < WinZipAesContext::BLOCK_SIZE) {
|
128 |
+
return \PSFS_FEED_ME;
|
129 |
+
}
|
130 |
+
$limit = max($len, $remaining);
|
131 |
+
|
132 |
+
if ($remaining > $limit && ($limit % WinZipAesContext::BLOCK_SIZE) !== 0) {
|
133 |
+
$limit -= ($limit % WinZipAesContext::BLOCK_SIZE);
|
134 |
+
}
|
135 |
+
|
136 |
+
while ($offset < $limit) {
|
137 |
+
$this->context->updateIv();
|
138 |
+
$length = min(WinZipAesContext::BLOCK_SIZE, $limit - $offset);
|
139 |
+
$encryptionText .= $this->context->encrypt(
|
140 |
+
substr($this->buffer, 0, $length)
|
141 |
+
);
|
142 |
+
$offset += $length;
|
143 |
+
$this->buffer = substr($this->buffer, $length);
|
144 |
+
}
|
145 |
+
|
146 |
+
if ($remaining === 0) {
|
147 |
+
$encryptionText .= $this->context->getHmac();
|
148 |
+
}
|
149 |
+
|
150 |
+
$bucket->data = $encryptionText;
|
151 |
+
$consumed += $bucket->datalen;
|
152 |
+
|
153 |
+
stream_bucket_append($out, $bucket);
|
154 |
+
}
|
155 |
+
|
156 |
+
return \PSFS_PASS_ON;
|
157 |
+
}
|
158 |
+
}
|
library/vendor/nelexa/zip/src/IO/Stream/ResponseStream.php
ADDED
@@ -0,0 +1,338 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\IO\Stream;
|
4 |
+
|
5 |
+
use Psr\Http\Message\StreamInterface;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Implement PSR Message Stream.
|
9 |
+
*/
|
10 |
+
class ResponseStream implements StreamInterface
|
11 |
+
{
|
12 |
+
/** @var array */
|
13 |
+
private static $readWriteHash = [
|
14 |
+
'read' => [
|
15 |
+
'r' => true,
|
16 |
+
'w+' => true,
|
17 |
+
'r+' => true,
|
18 |
+
'x+' => true,
|
19 |
+
'c+' => true,
|
20 |
+
'rb' => true,
|
21 |
+
'w+b' => true,
|
22 |
+
'r+b' => true,
|
23 |
+
'x+b' => true,
|
24 |
+
'c+b' => true,
|
25 |
+
'rt' => true,
|
26 |
+
'w+t' => true,
|
27 |
+
'r+t' => true,
|
28 |
+
'x+t' => true,
|
29 |
+
'c+t' => true,
|
30 |
+
'a+' => true,
|
31 |
+
],
|
32 |
+
'write' => [
|
33 |
+
'w' => true,
|
34 |
+
'w+' => true,
|
35 |
+
'rw' => true,
|
36 |
+
'r+' => true,
|
37 |
+
'x+' => true,
|
38 |
+
'c+' => true,
|
39 |
+
'wb' => true,
|
40 |
+
'w+b' => true,
|
41 |
+
'r+b' => true,
|
42 |
+
'x+b' => true,
|
43 |
+
'c+b' => true,
|
44 |
+
'w+t' => true,
|
45 |
+
'r+t' => true,
|
46 |
+
'x+t' => true,
|
47 |
+
'c+t' => true,
|
48 |
+
'a' => true,
|
49 |
+
'a+' => true,
|
50 |
+
],
|
51 |
+
];
|
52 |
+
|
53 |
+
/** @var resource */
|
54 |
+
private $stream;
|
55 |
+
|
56 |
+
/** @var int|null */
|
57 |
+
private $size;
|
58 |
+
|
59 |
+
/** @var bool */
|
60 |
+
private $seekable;
|
61 |
+
|
62 |
+
/** @var bool */
|
63 |
+
private $readable;
|
64 |
+
|
65 |
+
/** @var bool */
|
66 |
+
private $writable;
|
67 |
+
|
68 |
+
/** @var string|null */
|
69 |
+
private $uri;
|
70 |
+
|
71 |
+
/**
|
72 |
+
* @param resource $stream stream resource to wrap
|
73 |
+
*
|
74 |
+
* @throws \InvalidArgumentException if the stream is not a stream resource
|
75 |
+
*/
|
76 |
+
public function __construct($stream)
|
77 |
+
{
|
78 |
+
if (!\is_resource($stream)) {
|
79 |
+
throw new \InvalidArgumentException('Stream must be a resource');
|
80 |
+
}
|
81 |
+
$this->stream = $stream;
|
82 |
+
$meta = stream_get_meta_data($this->stream);
|
83 |
+
$this->seekable = $meta['seekable'];
|
84 |
+
$this->readable = isset(self::$readWriteHash['read'][$meta['mode']]);
|
85 |
+
$this->writable = isset(self::$readWriteHash['write'][$meta['mode']]);
|
86 |
+
$this->uri = $this->getMetadata('uri');
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Get stream metadata as an associative array or retrieve a specific key.
|
91 |
+
*
|
92 |
+
* The keys returned are identical to the keys returned from PHP's
|
93 |
+
* stream_get_meta_data() function.
|
94 |
+
*
|
95 |
+
* @see http://php.net/manual/en/function.stream-get-meta-data.php
|
96 |
+
*
|
97 |
+
* @param string $key specific metadata to retrieve
|
98 |
+
*
|
99 |
+
* @return array|mixed|null Returns an associative array if no key is
|
100 |
+
* provided. Returns a specific key value if a key is provided and the
|
101 |
+
* value is found, or null if the key is not found.
|
102 |
+
*/
|
103 |
+
public function getMetadata($key = null)
|
104 |
+
{
|
105 |
+
if (!$this->stream) {
|
106 |
+
return $key ? null : [];
|
107 |
+
}
|
108 |
+
$meta = stream_get_meta_data($this->stream);
|
109 |
+
|
110 |
+
return isset($meta[$key]) ? $meta[$key] : null;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Reads all data from the stream into a string, from the beginning to end.
|
115 |
+
*
|
116 |
+
* This method MUST attempt to seek to the beginning of the stream before
|
117 |
+
* reading data and read the stream until the end is reached.
|
118 |
+
*
|
119 |
+
* Warning: This could attempt to load a large amount of data into memory.
|
120 |
+
*
|
121 |
+
* This method MUST NOT raise an exception in order to conform with PHP's
|
122 |
+
* string casting operations.
|
123 |
+
*
|
124 |
+
* @see http://php.net/manual/en/language.oop5.magic.php#object.tostring
|
125 |
+
*
|
126 |
+
* @return string
|
127 |
+
*/
|
128 |
+
public function __toString()
|
129 |
+
{
|
130 |
+
if (!$this->stream) {
|
131 |
+
return '';
|
132 |
+
}
|
133 |
+
$this->rewind();
|
134 |
+
|
135 |
+
return (string) stream_get_contents($this->stream);
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Seek to the beginning of the stream.
|
140 |
+
*
|
141 |
+
* If the stream is not seekable, this method will raise an exception;
|
142 |
+
* otherwise, it will perform a seek(0).
|
143 |
+
*
|
144 |
+
* @throws \RuntimeException on failure
|
145 |
+
*
|
146 |
+
* @see http://www.php.net/manual/en/function.fseek.php
|
147 |
+
* @see seek()
|
148 |
+
*/
|
149 |
+
public function rewind()
|
150 |
+
{
|
151 |
+
$this->seekable && rewind($this->stream);
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Get the size of the stream if known.
|
156 |
+
*
|
157 |
+
* @return int|null returns the size in bytes if known, or null if unknown
|
158 |
+
*/
|
159 |
+
public function getSize()
|
160 |
+
{
|
161 |
+
if ($this->size !== null) {
|
162 |
+
return $this->size;
|
163 |
+
}
|
164 |
+
|
165 |
+
if (!$this->stream) {
|
166 |
+
return null;
|
167 |
+
}
|
168 |
+
// Clear the stat cache if the stream has a URI
|
169 |
+
if ($this->uri !== null) {
|
170 |
+
clearstatcache(true, $this->uri);
|
171 |
+
}
|
172 |
+
$stats = fstat($this->stream);
|
173 |
+
|
174 |
+
if (isset($stats['size'])) {
|
175 |
+
$this->size = $stats['size'];
|
176 |
+
|
177 |
+
return $this->size;
|
178 |
+
}
|
179 |
+
|
180 |
+
return null;
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Returns the current position of the file read/write pointer.
|
185 |
+
*
|
186 |
+
* @throws \RuntimeException on error
|
187 |
+
*
|
188 |
+
* @return int Position of the file pointer
|
189 |
+
*/
|
190 |
+
public function tell()
|
191 |
+
{
|
192 |
+
return $this->stream ? ftell($this->stream) : false;
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Returns true if the stream is at the end of the stream.
|
197 |
+
*
|
198 |
+
* @return bool
|
199 |
+
*/
|
200 |
+
public function eof()
|
201 |
+
{
|
202 |
+
return !$this->stream || feof($this->stream);
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Returns whether or not the stream is seekable.
|
207 |
+
*
|
208 |
+
* @return bool
|
209 |
+
*/
|
210 |
+
public function isSeekable()
|
211 |
+
{
|
212 |
+
return $this->seekable;
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Seek to a position in the stream.
|
217 |
+
*
|
218 |
+
* @see http://www.php.net/manual/en/function.fseek.php
|
219 |
+
*
|
220 |
+
* @param int $offset Stream offset
|
221 |
+
* @param int $whence Specifies how the cursor position will be calculated
|
222 |
+
* based on the seek offset. Valid values are identical to the built-in
|
223 |
+
* PHP $whence values for `fseek()`. SEEK_SET: Set position equal to
|
224 |
+
* offset bytes SEEK_CUR: Set position to current location plus offset
|
225 |
+
* SEEK_END: Set position to end-of-stream plus offset.
|
226 |
+
*
|
227 |
+
* @throws \RuntimeException on failure
|
228 |
+
*/
|
229 |
+
public function seek($offset, $whence = \SEEK_SET)
|
230 |
+
{
|
231 |
+
$this->seekable && fseek($this->stream, $offset, $whence);
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Returns whether or not the stream is writable.
|
236 |
+
*
|
237 |
+
* @return bool
|
238 |
+
*/
|
239 |
+
public function isWritable()
|
240 |
+
{
|
241 |
+
return $this->writable;
|
242 |
+
}
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Write data to the stream.
|
246 |
+
*
|
247 |
+
* @param string $string the string that is to be written
|
248 |
+
*
|
249 |
+
* @throws \RuntimeException on failure
|
250 |
+
*
|
251 |
+
* @return int returns the number of bytes written to the stream
|
252 |
+
*/
|
253 |
+
public function write($string)
|
254 |
+
{
|
255 |
+
$this->size = null;
|
256 |
+
|
257 |
+
return $this->writable ? fwrite($this->stream, $string) : false;
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Returns whether or not the stream is readable.
|
262 |
+
*
|
263 |
+
* @return bool
|
264 |
+
*/
|
265 |
+
public function isReadable()
|
266 |
+
{
|
267 |
+
return $this->readable;
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Read data from the stream.
|
272 |
+
*
|
273 |
+
* @param int $length Read up to $length bytes from the object and return
|
274 |
+
* them. Fewer than $length bytes may be returned if underlying stream
|
275 |
+
* call returns fewer bytes.
|
276 |
+
*
|
277 |
+
* @throws \RuntimeException if an error occurs
|
278 |
+
*
|
279 |
+
* @return string returns the data read from the stream, or an empty string
|
280 |
+
* if no bytes are available
|
281 |
+
*/
|
282 |
+
public function read($length)
|
283 |
+
{
|
284 |
+
return $this->readable ? fread($this->stream, $length) : '';
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Returns the remaining contents in a string.
|
289 |
+
*
|
290 |
+
* @throws \RuntimeException if unable to read or an error occurs while
|
291 |
+
* reading
|
292 |
+
*
|
293 |
+
* @return string
|
294 |
+
*/
|
295 |
+
public function getContents()
|
296 |
+
{
|
297 |
+
return $this->stream ? stream_get_contents($this->stream) : '';
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Closes the stream when the destructed.
|
302 |
+
*/
|
303 |
+
public function __destruct()
|
304 |
+
{
|
305 |
+
$this->close();
|
306 |
+
}
|
307 |
+
|
308 |
+
/**
|
309 |
+
* Closes the stream and any underlying resources.
|
310 |
+
*/
|
311 |
+
public function close()
|
312 |
+
{
|
313 |
+
if (\is_resource($this->stream)) {
|
314 |
+
fclose($this->stream);
|
315 |
+
}
|
316 |
+
$this->detach();
|
317 |
+
}
|
318 |
+
|
319 |
+
/**
|
320 |
+
* Separates any underlying resources from the stream.
|
321 |
+
*
|
322 |
+
* After the stream has been detached, the stream is in an unusable state.
|
323 |
+
*
|
324 |
+
* @return resource|null Underlying PHP stream, if any
|
325 |
+
*/
|
326 |
+
public function detach()
|
327 |
+
{
|
328 |
+
$result = $this->stream;
|
329 |
+
$this->stream = null;
|
330 |
+
$this->size = null;
|
331 |
+
$this->uri = null;
|
332 |
+
$this->readable = false;
|
333 |
+
$this->writable = false;
|
334 |
+
$this->seekable = false;
|
335 |
+
|
336 |
+
return $result;
|
337 |
+
}
|
338 |
+
}
|
library/vendor/nelexa/zip/src/IO/Stream/ZipEntryStreamWrapper.php
ADDED
@@ -0,0 +1,309 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\IO\Stream;
|
4 |
+
|
5 |
+
use PhpZip\Exception\ZipException;
|
6 |
+
use PhpZip\Model\ZipEntry;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* The class provides stream reuse functionality.
|
10 |
+
*
|
11 |
+
* Stream will not be closed at {@see fclose}.
|
12 |
+
*
|
13 |
+
* @see https://www.php.net/streamwrapper
|
14 |
+
*/
|
15 |
+
final class ZipEntryStreamWrapper
|
16 |
+
{
|
17 |
+
/** @var string the registered protocol */
|
18 |
+
const PROTOCOL = 'zipentry';
|
19 |
+
|
20 |
+
/** @var resource */
|
21 |
+
public $context;
|
22 |
+
|
23 |
+
/** @var resource */
|
24 |
+
private $fp;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @return bool
|
28 |
+
*/
|
29 |
+
public static function register()
|
30 |
+
{
|
31 |
+
$protocol = self::PROTOCOL;
|
32 |
+
|
33 |
+
if (!\in_array($protocol, stream_get_wrappers(), true)) {
|
34 |
+
if (!stream_wrapper_register($protocol, self::class)) {
|
35 |
+
throw new \RuntimeException("Failed to register '{$protocol}://' protocol");
|
36 |
+
}
|
37 |
+
|
38 |
+
return true;
|
39 |
+
}
|
40 |
+
|
41 |
+
return false;
|
42 |
+
}
|
43 |
+
|
44 |
+
public static function unregister()
|
45 |
+
{
|
46 |
+
stream_wrapper_unregister(self::PROTOCOL);
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @param ZipEntry $entry
|
51 |
+
*
|
52 |
+
* @return resource
|
53 |
+
*/
|
54 |
+
public static function wrap(ZipEntry $entry)
|
55 |
+
{
|
56 |
+
self::register();
|
57 |
+
|
58 |
+
$context = stream_context_create(
|
59 |
+
[
|
60 |
+
self::PROTOCOL => [
|
61 |
+
'entry' => $entry,
|
62 |
+
],
|
63 |
+
]
|
64 |
+
);
|
65 |
+
|
66 |
+
$uri = self::PROTOCOL . '://' . $entry->getName();
|
67 |
+
$fp = fopen($uri, 'r+b', false, $context);
|
68 |
+
|
69 |
+
if ($fp === false) {
|
70 |
+
throw new \RuntimeException('Error open ' . $uri);
|
71 |
+
}
|
72 |
+
|
73 |
+
return $fp;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Opens file or URL.
|
78 |
+
*
|
79 |
+
* This method is called immediately after the wrapper is
|
80 |
+
* initialized (f.e. by {@see fopen()} and {@see file_get_contents()}).
|
81 |
+
*
|
82 |
+
* @param string $path specifies the URL that was passed to
|
83 |
+
* the original function
|
84 |
+
* @param string $mode the mode used to open the file, as detailed
|
85 |
+
* for {@see fopen()}
|
86 |
+
* @param int $options Holds additional flags set by the streams
|
87 |
+
* API. It can hold one or more of the
|
88 |
+
* following values OR'd together.
|
89 |
+
* @param string $opened_path if the path is opened successfully, and
|
90 |
+
* STREAM_USE_PATH is set in options,
|
91 |
+
* opened_path should be set to the
|
92 |
+
* full path of the file/resource that
|
93 |
+
* was actually opened
|
94 |
+
*
|
95 |
+
* @throws ZipException
|
96 |
+
*
|
97 |
+
* @return bool
|
98 |
+
*
|
99 |
+
* @see https://www.php.net/streamwrapper.stream-open
|
100 |
+
*/
|
101 |
+
public function stream_open($path, $mode, $options, &$opened_path)
|
102 |
+
{
|
103 |
+
if ($this->context === null) {
|
104 |
+
throw new \RuntimeException('stream context is null');
|
105 |
+
}
|
106 |
+
$streamOptions = stream_context_get_options($this->context);
|
107 |
+
|
108 |
+
if (!isset($streamOptions[self::PROTOCOL]['entry'])) {
|
109 |
+
throw new \RuntimeException('no stream option ["' . self::PROTOCOL . '"]["entry"]');
|
110 |
+
}
|
111 |
+
$zipEntry = $streamOptions[self::PROTOCOL]['entry'];
|
112 |
+
|
113 |
+
if (!$zipEntry instanceof ZipEntry) {
|
114 |
+
throw new \RuntimeException('invalid stream context');
|
115 |
+
}
|
116 |
+
|
117 |
+
$zipData = $zipEntry->getData();
|
118 |
+
|
119 |
+
if ($zipData === null) {
|
120 |
+
throw new ZipException(sprintf('No data for zip entry "%s"', $zipEntry->getName()));
|
121 |
+
}
|
122 |
+
$this->fp = $zipData->getDataAsStream();
|
123 |
+
|
124 |
+
return $this->fp !== false;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Read from stream.
|
129 |
+
*
|
130 |
+
* This method is called in response to {@see fread()} and {@see fgets()}.
|
131 |
+
*
|
132 |
+
* Note: Remember to update the read/write position of the stream
|
133 |
+
* (by the number of bytes that were successfully read).
|
134 |
+
*
|
135 |
+
* @param int $count how many bytes of data from the current
|
136 |
+
* position should be returned
|
137 |
+
*
|
138 |
+
* @return false|string If there are less than count bytes available,
|
139 |
+
* return as many as are available. If no more data
|
140 |
+
* is available, return either FALSE or
|
141 |
+
* an empty string.
|
142 |
+
*
|
143 |
+
* @see https://www.php.net/streamwrapper.stream-read
|
144 |
+
*/
|
145 |
+
public function stream_read($count)
|
146 |
+
{
|
147 |
+
return fread($this->fp, $count);
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Seeks to specific location in a stream.
|
152 |
+
*
|
153 |
+
* This method is called in response to {@see fseek()}.
|
154 |
+
* The read/write position of the stream should be updated according
|
155 |
+
* to the offset and whence.
|
156 |
+
*
|
157 |
+
* @param int $offset the stream offset to seek to
|
158 |
+
* @param int $whence Possible values:
|
159 |
+
* {@see \SEEK_SET} - Set position equal to offset bytes.
|
160 |
+
* {@see \SEEK_CUR} - Set position to current location plus offset.
|
161 |
+
* {@see \SEEK_END} - Set position to end-of-file plus offset.
|
162 |
+
*
|
163 |
+
* @return bool return TRUE if the position was updated, FALSE otherwise
|
164 |
+
*
|
165 |
+
* @see https://www.php.net/streamwrapper.stream-seek
|
166 |
+
*/
|
167 |
+
public function stream_seek($offset, $whence = \SEEK_SET)
|
168 |
+
{
|
169 |
+
return fseek($this->fp, $offset, $whence) === 0;
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Retrieve the current position of a stream.
|
174 |
+
*
|
175 |
+
* This method is called in response to {@see fseek()} to determine
|
176 |
+
* the current position.
|
177 |
+
*
|
178 |
+
* @return int should return the current position of the stream
|
179 |
+
*
|
180 |
+
* @see https://www.php.net/streamwrapper.stream-tell
|
181 |
+
*/
|
182 |
+
public function stream_tell()
|
183 |
+
{
|
184 |
+
$pos = ftell($this->fp);
|
185 |
+
|
186 |
+
if ($pos === false) {
|
187 |
+
throw new \RuntimeException('Cannot get stream position.');
|
188 |
+
}
|
189 |
+
|
190 |
+
return $pos;
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Tests for end-of-file on a file pointer.
|
195 |
+
*
|
196 |
+
* This method is called in response to {@see feof()}.
|
197 |
+
*
|
198 |
+
* @return bool should return TRUE if the read/write position is at
|
199 |
+
* the end of the stream and if no more data is available
|
200 |
+
* to be read, or FALSE otherwise
|
201 |
+
*
|
202 |
+
* @see https://www.php.net/streamwrapper.stream-eof
|
203 |
+
*/
|
204 |
+
public function stream_eof()
|
205 |
+
{
|
206 |
+
return feof($this->fp);
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Retrieve information about a file resource.
|
211 |
+
*
|
212 |
+
* This method is called in response to {@see fstat()}.
|
213 |
+
*
|
214 |
+
* @return array
|
215 |
+
*
|
216 |
+
* @see https://www.php.net/streamwrapper.stream-stat
|
217 |
+
* @see https://www.php.net/stat
|
218 |
+
* @see https://www.php.net/fstat
|
219 |
+
*/
|
220 |
+
public function stream_stat()
|
221 |
+
{
|
222 |
+
return fstat($this->fp);
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Flushes the output.
|
227 |
+
*
|
228 |
+
* This method is called in response to {@see fflush()} and when the
|
229 |
+
* stream is being closed while any unflushed data has been written to
|
230 |
+
* it before.
|
231 |
+
* If you have cached data in your stream but not yet stored it into
|
232 |
+
* the underlying storage, you should do so now.
|
233 |
+
*
|
234 |
+
* @return bool should return TRUE if the cached data was successfully
|
235 |
+
* stored (or if there was no data to store), or FALSE
|
236 |
+
* if the data could not be stored
|
237 |
+
*
|
238 |
+
* @see https://www.php.net/streamwrapper.stream-flush
|
239 |
+
*/
|
240 |
+
public function stream_flush()
|
241 |
+
{
|
242 |
+
return fflush($this->fp);
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Truncate stream.
|
247 |
+
*
|
248 |
+
* Will respond to truncation, e.g., through {@see ftruncate()}.
|
249 |
+
*
|
250 |
+
* @param int $new_size the new size
|
251 |
+
*
|
252 |
+
* @return bool returns TRUE on success or FALSE on failure
|
253 |
+
*
|
254 |
+
* @see https://www.php.net/streamwrapper.stream-truncate
|
255 |
+
*/
|
256 |
+
public function stream_truncate($new_size)
|
257 |
+
{
|
258 |
+
return ftruncate($this->fp, (int) $new_size);
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Write to stream.
|
263 |
+
*
|
264 |
+
* This method is called in response to {@see fwrite().}
|
265 |
+
*
|
266 |
+
* Note: Remember to update the current position of the stream by
|
267 |
+
* number of bytes that were successfully written.
|
268 |
+
*
|
269 |
+
* @param string $data should be stored into the underlying stream
|
270 |
+
*
|
271 |
+
* @return int should return the number of bytes that were successfully stored, or 0 if none could be stored
|
272 |
+
*
|
273 |
+
* @see https://www.php.net/streamwrapper.stream-write
|
274 |
+
*/
|
275 |
+
public function stream_write($data)
|
276 |
+
{
|
277 |
+
$bytes = fwrite($this->fp, $data);
|
278 |
+
|
279 |
+
return $bytes === false ? 0 : $bytes;
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Retrieve the underlaying resource.
|
284 |
+
*
|
285 |
+
* This method is called in response to {@see stream_select()}.
|
286 |
+
*
|
287 |
+
* @param int $cast_as can be {@see STREAM_CAST_FOR_SELECT} when {@see stream_select()}
|
288 |
+
* is callingstream_cast() or {@see STREAM_CAST_AS_STREAM} when
|
289 |
+
* stream_cast() is called for other uses
|
290 |
+
*
|
291 |
+
* @return resource
|
292 |
+
*/
|
293 |
+
public function stream_cast($cast_as)
|
294 |
+
{
|
295 |
+
return $this->fp;
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Close a resource.
|
300 |
+
*
|
301 |
+
* This method is called in response to {@see fclose()}.
|
302 |
+
* All resources that were locked, or allocated, by the wrapper should be released.
|
303 |
+
*
|
304 |
+
* @see https://www.php.net/streamwrapper.stream-close
|
305 |
+
*/
|
306 |
+
public function stream_close()
|
307 |
+
{
|
308 |
+
}
|
309 |
+
}
|
library/vendor/nelexa/zip/src/IO/ZipReader.php
ADDED
@@ -0,0 +1,898 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\IO;
|
4 |
+
|
5 |
+
use PhpZip\Constants\DosCodePage;
|
6 |
+
use PhpZip\Constants\GeneralPurposeBitFlag;
|
7 |
+
use PhpZip\Constants\ZipCompressionMethod;
|
8 |
+
use PhpZip\Constants\ZipConstants;
|
9 |
+
use PhpZip\Constants\ZipEncryptionMethod;
|
10 |
+
use PhpZip\Constants\ZipOptions;
|
11 |
+
use PhpZip\Exception\Crc32Exception;
|
12 |
+
use PhpZip\Exception\InvalidArgumentException;
|
13 |
+
use PhpZip\Exception\ZipException;
|
14 |
+
use PhpZip\IO\Filter\Cipher\Pkware\PKDecryptionStreamFilter;
|
15 |
+
use PhpZip\IO\Filter\Cipher\WinZipAes\WinZipAesDecryptionStreamFilter;
|
16 |
+
use PhpZip\Model\Data\ZipSourceFileData;
|
17 |
+
use PhpZip\Model\EndOfCentralDirectory;
|
18 |
+
use PhpZip\Model\Extra\ExtraFieldsCollection;
|
19 |
+
use PhpZip\Model\Extra\Fields\UnicodePathExtraField;
|
20 |
+
use PhpZip\Model\Extra\Fields\UnrecognizedExtraField;
|
21 |
+
use PhpZip\Model\Extra\Fields\WinZipAesExtraField;
|
22 |
+
use PhpZip\Model\Extra\Fields\Zip64ExtraField;
|
23 |
+
use PhpZip\Model\Extra\ZipExtraDriver;
|
24 |
+
use PhpZip\Model\Extra\ZipExtraField;
|
25 |
+
use PhpZip\Model\ImmutableZipContainer;
|
26 |
+
use PhpZip\Model\ZipEntry;
|
27 |
+
use PhpZip\Util\PackUtil;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Zip reader.
|
31 |
+
*
|
32 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
33 |
+
* @license MIT
|
34 |
+
*/
|
35 |
+
class ZipReader
|
36 |
+
{
|
37 |
+
/** @var int file size */
|
38 |
+
protected $size;
|
39 |
+
|
40 |
+
/** @var resource */
|
41 |
+
protected $inStream;
|
42 |
+
|
43 |
+
/** @var array */
|
44 |
+
protected $options;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @param resource $inStream
|
48 |
+
* @param array $options
|
49 |
+
*/
|
50 |
+
public function __construct($inStream, array $options = [])
|
51 |
+
{
|
52 |
+
if (!\is_resource($inStream)) {
|
53 |
+
throw new InvalidArgumentException('Stream must be a resource');
|
54 |
+
}
|
55 |
+
$type = get_resource_type($inStream);
|
56 |
+
|
57 |
+
if ($type !== 'stream') {
|
58 |
+
throw new InvalidArgumentException("Invalid resource type {$type}.");
|
59 |
+
}
|
60 |
+
$meta = stream_get_meta_data($inStream);
|
61 |
+
|
62 |
+
$wrapperType = isset($meta['wrapper_type']) ? $meta['wrapper_type'] : 'Unknown';
|
63 |
+
$supportStreamWrapperTypes = ['plainfile', 'PHP', 'user-space'];
|
64 |
+
|
65 |
+
if (!\in_array($wrapperType, $supportStreamWrapperTypes, true)) {
|
66 |
+
throw new InvalidArgumentException(
|
67 |
+
'The stream wrapper type "' . $wrapperType . '" is not supported. Support: ' . implode(
|
68 |
+
', ',
|
69 |
+
$supportStreamWrapperTypes
|
70 |
+
)
|
71 |
+
);
|
72 |
+
}
|
73 |
+
|
74 |
+
if (
|
75 |
+
$wrapperType === 'plainfile' &&
|
76 |
+
(
|
77 |
+
$meta['stream_type'] === 'dir' ||
|
78 |
+
(isset($meta['uri']) && is_dir($meta['uri']))
|
79 |
+
)
|
80 |
+
) {
|
81 |
+
throw new InvalidArgumentException('Directory stream not supported');
|
82 |
+
}
|
83 |
+
|
84 |
+
$seekable = $meta['seekable'];
|
85 |
+
|
86 |
+
if (!$seekable) {
|
87 |
+
throw new InvalidArgumentException('Resource does not support seekable.');
|
88 |
+
}
|
89 |
+
$this->size = fstat($inStream)['size'];
|
90 |
+
$this->inStream = $inStream;
|
91 |
+
|
92 |
+
/** @noinspection AdditionOperationOnArraysInspection */
|
93 |
+
$options += $this->getDefaultOptions();
|
94 |
+
$this->options = $options;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* @return array
|
99 |
+
*/
|
100 |
+
protected function getDefaultOptions()
|
101 |
+
{
|
102 |
+
return [
|
103 |
+
ZipOptions::CHARSET => null,
|
104 |
+
];
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* @throws ZipException
|
109 |
+
*
|
110 |
+
* @return ImmutableZipContainer
|
111 |
+
*/
|
112 |
+
public function read()
|
113 |
+
{
|
114 |
+
if ($this->size < ZipConstants::END_CD_MIN_LEN) {
|
115 |
+
throw new ZipException('Corrupt zip file');
|
116 |
+
}
|
117 |
+
|
118 |
+
$endOfCentralDirectory = $this->readEndOfCentralDirectory();
|
119 |
+
$entries = $this->readCentralDirectory($endOfCentralDirectory);
|
120 |
+
|
121 |
+
return new ImmutableZipContainer($entries, $endOfCentralDirectory->getComment());
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* @return array
|
126 |
+
*/
|
127 |
+
public function getStreamMetaData()
|
128 |
+
{
|
129 |
+
return stream_get_meta_data($this->inStream);
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Read End of central directory record.
|
134 |
+
*
|
135 |
+
* end of central dir signature 4 bytes (0x06054b50)
|
136 |
+
* number of this disk 2 bytes
|
137 |
+
* number of the disk with the
|
138 |
+
* start of the central directory 2 bytes
|
139 |
+
* total number of entries in the
|
140 |
+
* central directory on this disk 2 bytes
|
141 |
+
* total number of entries in
|
142 |
+
* the central directory 2 bytes
|
143 |
+
* size of the central directory 4 bytes
|
144 |
+
* offset of start of central
|
145 |
+
* directory with respect to
|
146 |
+
* the starting disk number 4 bytes
|
147 |
+
* .ZIP file comment length 2 bytes
|
148 |
+
* .ZIP file comment (variable size)
|
149 |
+
*
|
150 |
+
* @throws ZipException
|
151 |
+
*
|
152 |
+
* @return EndOfCentralDirectory
|
153 |
+
*/
|
154 |
+
protected function readEndOfCentralDirectory()
|
155 |
+
{
|
156 |
+
if (!$this->findEndOfCentralDirectory()) {
|
157 |
+
throw new ZipException('Invalid zip file. The end of the central directory could not be found.');
|
158 |
+
}
|
159 |
+
|
160 |
+
$positionECD = ftell($this->inStream) - 4;
|
161 |
+
$sizeECD = $this->size - ftell($this->inStream);
|
162 |
+
$buffer = fread($this->inStream, $sizeECD);
|
163 |
+
|
164 |
+
$unpack = unpack(
|
165 |
+
'vdiskNo/vcdDiskNo/vcdEntriesDisk/' .
|
166 |
+
'vcdEntries/VcdSize/VcdPos/vcommentLength',
|
167 |
+
substr($buffer, 0, 18)
|
168 |
+
);
|
169 |
+
|
170 |
+
if (
|
171 |
+
$unpack['diskNo'] !== 0 ||
|
172 |
+
$unpack['cdDiskNo'] !== 0 ||
|
173 |
+
$unpack['cdEntriesDisk'] !== $unpack['cdEntries']
|
174 |
+
) {
|
175 |
+
throw new ZipException(
|
176 |
+
'ZIP file spanning/splitting is not supported!'
|
177 |
+
);
|
178 |
+
}
|
179 |
+
// .ZIP file comment (variable sizeECD)
|
180 |
+
$comment = null;
|
181 |
+
|
182 |
+
if ($unpack['commentLength'] > 0) {
|
183 |
+
$comment = substr($buffer, 18, $unpack['commentLength']);
|
184 |
+
}
|
185 |
+
|
186 |
+
// Check for ZIP64 End Of Central Directory Locator exists.
|
187 |
+
$zip64ECDLocatorPosition = $positionECD - ZipConstants::ZIP64_END_CD_LOC_LEN;
|
188 |
+
fseek($this->inStream, $zip64ECDLocatorPosition);
|
189 |
+
// zip64 end of central dir locator
|
190 |
+
// signature 4 bytes (0x07064b50)
|
191 |
+
if ($zip64ECDLocatorPosition > 0 && unpack(
|
192 |
+
'V',
|
193 |
+
fread($this->inStream, 4)
|
194 |
+
)[1] === ZipConstants::ZIP64_END_CD_LOC) {
|
195 |
+
if (!$this->isZip64Support()) {
|
196 |
+
throw new ZipException('ZIP64 not supported this archive.');
|
197 |
+
}
|
198 |
+
|
199 |
+
$positionECD = $this->findZip64ECDPosition();
|
200 |
+
$endCentralDirectory = $this->readZip64EndOfCentralDirectory($positionECD);
|
201 |
+
$endCentralDirectory->setComment($comment);
|
202 |
+
} else {
|
203 |
+
$endCentralDirectory = new EndOfCentralDirectory(
|
204 |
+
$unpack['cdEntries'],
|
205 |
+
$unpack['cdPos'],
|
206 |
+
$unpack['cdSize'],
|
207 |
+
false,
|
208 |
+
$comment
|
209 |
+
);
|
210 |
+
}
|
211 |
+
|
212 |
+
return $endCentralDirectory;
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* @return bool
|
217 |
+
*/
|
218 |
+
protected function findEndOfCentralDirectory()
|
219 |
+
{
|
220 |
+
$max = $this->size - ZipConstants::END_CD_MIN_LEN;
|
221 |
+
$min = $max >= 0xffff ? $max - 0xffff : 0;
|
222 |
+
// Search for End of central directory record.
|
223 |
+
for ($position = $max; $position >= $min; $position--) {
|
224 |
+
fseek($this->inStream, $position);
|
225 |
+
// end of central dir signature 4 bytes (0x06054b50)
|
226 |
+
if (unpack('V', fread($this->inStream, 4))[1] !== ZipConstants::END_CD) {
|
227 |
+
continue;
|
228 |
+
}
|
229 |
+
|
230 |
+
return true;
|
231 |
+
}
|
232 |
+
|
233 |
+
return false;
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Read Zip64 end of central directory locator and returns
|
238 |
+
* Zip64 end of central directory position.
|
239 |
+
*
|
240 |
+
* number of the disk with the
|
241 |
+
* start of the zip64 end of
|
242 |
+
* central directory 4 bytes
|
243 |
+
* relative offset of the zip64
|
244 |
+
* end of central directory record 8 bytes
|
245 |
+
* total number of disks 4 bytes
|
246 |
+
*
|
247 |
+
* @throws ZipException
|
248 |
+
*
|
249 |
+
* @return int Zip64 End Of Central Directory position
|
250 |
+
*/
|
251 |
+
protected function findZip64ECDPosition()
|
252 |
+
{
|
253 |
+
$diskNo = unpack('V', fread($this->inStream, 4))[1];
|
254 |
+
$zip64ECDPos = PackUtil::unpackLongLE(fread($this->inStream, 8));
|
255 |
+
$totalDisks = unpack('V', fread($this->inStream, 4))[1];
|
256 |
+
|
257 |
+
if ($diskNo !== 0 || $totalDisks > 1) {
|
258 |
+
throw new ZipException('ZIP file spanning/splitting is not supported!');
|
259 |
+
}
|
260 |
+
|
261 |
+
return $zip64ECDPos;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Read zip64 end of central directory locator and zip64 end
|
266 |
+
* of central directory record.
|
267 |
+
*
|
268 |
+
* zip64 end of central dir
|
269 |
+
* signature 4 bytes (0x06064b50)
|
270 |
+
* size of zip64 end of central
|
271 |
+
* directory record 8 bytes
|
272 |
+
* version made by 2 bytes
|
273 |
+
* version needed to extract 2 bytes
|
274 |
+
* number of this disk 4 bytes
|
275 |
+
* number of the disk with the
|
276 |
+
* start of the central directory 4 bytes
|
277 |
+
* total number of entries in the
|
278 |
+
* central directory on this disk 8 bytes
|
279 |
+
* total number of entries in the
|
280 |
+
* central directory 8 bytes
|
281 |
+
* size of the central directory 8 bytes
|
282 |
+
* offset of start of central
|
283 |
+
* directory with respect to
|
284 |
+
* the starting disk number 8 bytes
|
285 |
+
* zip64 extensible data sector (variable size)
|
286 |
+
*
|
287 |
+
* @param int $zip64ECDPosition
|
288 |
+
*
|
289 |
+
* @throws ZipException
|
290 |
+
*
|
291 |
+
* @return EndOfCentralDirectory
|
292 |
+
*/
|
293 |
+
protected function readZip64EndOfCentralDirectory($zip64ECDPosition)
|
294 |
+
{
|
295 |
+
fseek($this->inStream, $zip64ECDPosition);
|
296 |
+
|
297 |
+
$buffer = fread($this->inStream, ZipConstants::ZIP64_END_OF_CD_LEN);
|
298 |
+
|
299 |
+
if (unpack('V', $buffer)[1] !== ZipConstants::ZIP64_END_CD) {
|
300 |
+
throw new ZipException('Expected ZIP64 End Of Central Directory Record!');
|
301 |
+
}
|
302 |
+
|
303 |
+
$data = unpack(
|
304 |
+
// 'Psize/vversionMadeBy/vextractVersion/' .
|
305 |
+
'VdiskNo/VcdDiskNo',
|
306 |
+
substr($buffer, 16, 8)
|
307 |
+
);
|
308 |
+
|
309 |
+
$cdEntriesDisk = PackUtil::unpackLongLE(substr($buffer, 24, 8));
|
310 |
+
$entryCount = PackUtil::unpackLongLE(substr($buffer, 32, 8));
|
311 |
+
$cdSize = PackUtil::unpackLongLE(substr($buffer, 40, 8));
|
312 |
+
$cdPos = PackUtil::unpackLongLE(substr($buffer, 48, 8));
|
313 |
+
|
314 |
+
// $platform = ZipPlatform::fromValue(($data['versionMadeBy'] & 0xFF00) >> 8);
|
315 |
+
// $softwareVersion = $data['versionMadeBy'] & 0x00FF;
|
316 |
+
|
317 |
+
if ($data['diskNo'] !== 0 || $data['cdDiskNo'] !== 0 || $entryCount !== $cdEntriesDisk) {
|
318 |
+
throw new ZipException('ZIP file spanning/splitting is not supported!');
|
319 |
+
}
|
320 |
+
|
321 |
+
if ($entryCount < 0 || $entryCount > 0x7fffffff) {
|
322 |
+
throw new ZipException('Total Number Of Entries In The Central Directory out of range!');
|
323 |
+
}
|
324 |
+
|
325 |
+
// skip zip64 extensible data sector (variable sizeEndCD)
|
326 |
+
|
327 |
+
return new EndOfCentralDirectory(
|
328 |
+
$entryCount,
|
329 |
+
$cdPos,
|
330 |
+
$cdSize,
|
331 |
+
true
|
332 |
+
);
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* Reads the central directory from the given seekable byte channel
|
337 |
+
* and populates the internal tables with ZipEntry instances.
|
338 |
+
*
|
339 |
+
* The ZipEntry's will know all data that can be obtained from the
|
340 |
+
* central directory alone, but not the data that requires the local
|
341 |
+
* file header or additional data to be read.
|
342 |
+
*
|
343 |
+
* @param EndOfCentralDirectory $endCD
|
344 |
+
*
|
345 |
+
* @throws ZipException
|
346 |
+
*
|
347 |
+
* @return ZipEntry[]
|
348 |
+
*/
|
349 |
+
protected function readCentralDirectory(EndOfCentralDirectory $endCD)
|
350 |
+
{
|
351 |
+
$entries = [];
|
352 |
+
|
353 |
+
$cdOffset = $endCD->getCdOffset();
|
354 |
+
fseek($this->inStream, $cdOffset);
|
355 |
+
|
356 |
+
if (!($cdStream = fopen('php://temp', 'w+b'))) {
|
357 |
+
// @codeCoverageIgnoreStart
|
358 |
+
throw new ZipException('A temporary resource cannot be opened for writing.');
|
359 |
+
// @codeCoverageIgnoreEnd
|
360 |
+
}
|
361 |
+
stream_copy_to_stream($this->inStream, $cdStream, $endCD->getCdSize());
|
362 |
+
rewind($cdStream);
|
363 |
+
for ($numEntries = $endCD->getEntryCount(); $numEntries > 0; $numEntries--) {
|
364 |
+
$zipEntry = $this->readZipEntry($cdStream);
|
365 |
+
|
366 |
+
$entryName = $zipEntry->getName();
|
367 |
+
|
368 |
+
/** @var UnicodePathExtraField|null $unicodePathExtraField */
|
369 |
+
$unicodePathExtraField = $zipEntry->getExtraField(UnicodePathExtraField::HEADER_ID);
|
370 |
+
|
371 |
+
if ($unicodePathExtraField !== null && $unicodePathExtraField->getCrc32() === crc32($entryName)) {
|
372 |
+
$unicodePath = $unicodePathExtraField->getUnicodeValue();
|
373 |
+
|
374 |
+
if ($unicodePath !== null) {
|
375 |
+
$unicodePath = str_replace('\\', '/', $unicodePath);
|
376 |
+
|
377 |
+
if (
|
378 |
+
$unicodePath !== '' &&
|
379 |
+
substr_count($entryName, '/') === substr_count($unicodePath, '/')
|
380 |
+
) {
|
381 |
+
$entryName = $unicodePath;
|
382 |
+
}
|
383 |
+
}
|
384 |
+
}
|
385 |
+
|
386 |
+
$entries[$entryName] = $zipEntry;
|
387 |
+
}
|
388 |
+
|
389 |
+
return $entries;
|
390 |
+
}
|
391 |
+
|
392 |
+
/**
|
393 |
+
* Read central directory entry.
|
394 |
+
*
|
395 |
+
* central file header signature 4 bytes (0x02014b50)
|
396 |
+
* version made by 2 bytes
|
397 |
+
* version needed to extract 2 bytes
|
398 |
+
* general purpose bit flag 2 bytes
|
399 |
+
* compression method 2 bytes
|
400 |
+
* last mod file time 2 bytes
|
401 |
+
* last mod file date 2 bytes
|
402 |
+
* crc-32 4 bytes
|
403 |
+
* compressed size 4 bytes
|
404 |
+
* uncompressed size 4 bytes
|
405 |
+
* file name length 2 bytes
|
406 |
+
* extra field length 2 bytes
|
407 |
+
* file comment length 2 bytes
|
408 |
+
* disk number start 2 bytes
|
409 |
+
* internal file attributes 2 bytes
|
410 |
+
* external file attributes 4 bytes
|
411 |
+
* relative offset of local header 4 bytes
|
412 |
+
*
|
413 |
+
* file name (variable size)
|
414 |
+
* extra field (variable size)
|
415 |
+
* file comment (variable size)
|
416 |
+
*
|
417 |
+
* @param resource $stream
|
418 |
+
*
|
419 |
+
* @throws ZipException
|
420 |
+
*
|
421 |
+
* @return ZipEntry
|
422 |
+
*/
|
423 |
+
protected function readZipEntry($stream)
|
424 |
+
{
|
425 |
+
if (unpack('V', fread($stream, 4))[1] !== ZipConstants::CENTRAL_FILE_HEADER) {
|
426 |
+
throw new ZipException('Corrupt zip file. Cannot read zip entry.');
|
427 |
+
}
|
428 |
+
|
429 |
+
$unpack = unpack(
|
430 |
+
'vversionMadeBy/vversionNeededToExtract/' .
|
431 |
+
'vgeneralPurposeBitFlag/vcompressionMethod/' .
|
432 |
+
'VlastModFile/Vcrc/VcompressedSize/' .
|
433 |
+
'VuncompressedSize/vfileNameLength/vextraFieldLength/' .
|
434 |
+
'vfileCommentLength/vdiskNumberStart/vinternalFileAttributes/' .
|
435 |
+
'VexternalFileAttributes/VoffsetLocalHeader',
|
436 |
+
fread($stream, 42)
|
437 |
+
);
|
438 |
+
|
439 |
+
if ($unpack['diskNumberStart'] !== 0) {
|
440 |
+
throw new ZipException('ZIP file spanning/splitting is not supported!');
|
441 |
+
}
|
442 |
+
|
443 |
+
$generalPurposeBitFlags = $unpack['generalPurposeBitFlag'];
|
444 |
+
$isUtf8 = ($generalPurposeBitFlags & GeneralPurposeBitFlag::UTF8) !== 0;
|
445 |
+
|
446 |
+
$name = fread($stream, $unpack['fileNameLength']);
|
447 |
+
|
448 |
+
$createdOS = ($unpack['versionMadeBy'] & 0xFF00) >> 8;
|
449 |
+
$softwareVersion = $unpack['versionMadeBy'] & 0x00FF;
|
450 |
+
|
451 |
+
$extractedOS = ($unpack['versionNeededToExtract'] & 0xFF00) >> 8;
|
452 |
+
$extractVersion = $unpack['versionNeededToExtract'] & 0x00FF;
|
453 |
+
|
454 |
+
$dosTime = $unpack['lastModFile'];
|
455 |
+
|
456 |
+
$comment = null;
|
457 |
+
|
458 |
+
if ($unpack['fileCommentLength'] > 0) {
|
459 |
+
$comment = fread($stream, $unpack['fileCommentLength']);
|
460 |
+
}
|
461 |
+
|
462 |
+
// decode code page names
|
463 |
+
$fallbackCharset = null;
|
464 |
+
|
465 |
+
if (!$isUtf8 && isset($this->options[ZipOptions::CHARSET])) {
|
466 |
+
$charset = $this->options[ZipOptions::CHARSET];
|
467 |
+
|
468 |
+
$fallbackCharset = $charset;
|
469 |
+
$name = DosCodePage::toUTF8($name, $charset);
|
470 |
+
|
471 |
+
if ($comment !== null) {
|
472 |
+
$comment = DosCodePage::toUTF8($comment, $charset);
|
473 |
+
}
|
474 |
+
}
|
475 |
+
|
476 |
+
$zipEntry = ZipEntry::create(
|
477 |
+
$name,
|
478 |
+
$createdOS,
|
479 |
+
$extractedOS,
|
480 |
+
$softwareVersion,
|
481 |
+
$extractVersion,
|
482 |
+
$unpack['compressionMethod'],
|
483 |
+
$generalPurposeBitFlags,
|
484 |
+
$dosTime,
|
485 |
+
$unpack['crc'],
|
486 |
+
$unpack['compressedSize'],
|
487 |
+
$unpack['uncompressedSize'],
|
488 |
+
$unpack['internalFileAttributes'],
|
489 |
+
$unpack['externalFileAttributes'],
|
490 |
+
$unpack['offsetLocalHeader'],
|
491 |
+
$comment,
|
492 |
+
$fallbackCharset
|
493 |
+
);
|
494 |
+
|
495 |
+
if ($unpack['extraFieldLength'] > 0) {
|
496 |
+
$this->parseExtraFields(
|
497 |
+
fread($stream, $unpack['extraFieldLength']),
|
498 |
+
$zipEntry,
|
499 |
+
false
|
500 |
+
);
|
501 |
+
|
502 |
+
/** @var Zip64ExtraField|null $extraZip64 */
|
503 |
+
$extraZip64 = $zipEntry->getCdExtraField(Zip64ExtraField::HEADER_ID);
|
504 |
+
|
505 |
+
if ($extraZip64 !== null) {
|
506 |
+
$this->handleZip64Extra($extraZip64, $zipEntry);
|
507 |
+
}
|
508 |
+
}
|
509 |
+
|
510 |
+
$this->loadLocalExtraFields($zipEntry);
|
511 |
+
$this->handleExtraEncryptionFields($zipEntry);
|
512 |
+
$this->handleExtraFields($zipEntry);
|
513 |
+
|
514 |
+
return $zipEntry;
|
515 |
+
}
|
516 |
+
|
517 |
+
/**
|
518 |
+
* @param string $buffer
|
519 |
+
* @param ZipEntry $zipEntry
|
520 |
+
* @param bool $local
|
521 |
+
*
|
522 |
+
* @return ExtraFieldsCollection
|
523 |
+
*/
|
524 |
+
protected function parseExtraFields($buffer, ZipEntry $zipEntry, $local = false)
|
525 |
+
{
|
526 |
+
$collection = $local ?
|
527 |
+
$zipEntry->getLocalExtraFields() :
|
528 |
+
$zipEntry->getCdExtraFields();
|
529 |
+
|
530 |
+
if (!empty($buffer)) {
|
531 |
+
$pos = 0;
|
532 |
+
$endPos = \strlen($buffer);
|
533 |
+
|
534 |
+
while ($endPos - $pos >= 4) {
|
535 |
+
/** @var int[] $data */
|
536 |
+
$data = unpack('vheaderId/vdataSize', substr($buffer, $pos, 4));
|
537 |
+
$pos += 4;
|
538 |
+
|
539 |
+
if ($endPos - $pos - $data['dataSize'] < 0) {
|
540 |
+
break;
|
541 |
+
}
|
542 |
+
$bufferData = substr($buffer, $pos, $data['dataSize']);
|
543 |
+
$headerId = $data['headerId'];
|
544 |
+
|
545 |
+
/** @var string|ZipExtraField|null $className */
|
546 |
+
$className = ZipExtraDriver::getClassNameOrNull($headerId);
|
547 |
+
|
548 |
+
try {
|
549 |
+
if ($className !== null) {
|
550 |
+
try {
|
551 |
+
$extraField = $local ?
|
552 |
+
\call_user_func([$className, 'unpackLocalFileData'], $bufferData, $zipEntry) :
|
553 |
+
\call_user_func([$className, 'unpackCentralDirData'], $bufferData, $zipEntry);
|
554 |
+
} catch (\Throwable $e) {
|
555 |
+
// skip errors while parsing invalid data
|
556 |
+
continue;
|
557 |
+
}
|
558 |
+
} else {
|
559 |
+
$extraField = new UnrecognizedExtraField($headerId, $bufferData);
|
560 |
+
}
|
561 |
+
$collection->add($extraField);
|
562 |
+
} finally {
|
563 |
+
$pos += $data['dataSize'];
|
564 |
+
}
|
565 |
+
}
|
566 |
+
}
|
567 |
+
|
568 |
+
return $collection;
|
569 |
+
}
|
570 |
+
|
571 |
+
/**
|
572 |
+
* @param Zip64ExtraField $extraZip64
|
573 |
+
* @param ZipEntry $zipEntry
|
574 |
+
*/
|
575 |
+
protected function handleZip64Extra(Zip64ExtraField $extraZip64, ZipEntry $zipEntry)
|
576 |
+
{
|
577 |
+
$uncompressedSize = $extraZip64->getUncompressedSize();
|
578 |
+
$compressedSize = $extraZip64->getCompressedSize();
|
579 |
+
$localHeaderOffset = $extraZip64->getLocalHeaderOffset();
|
580 |
+
|
581 |
+
if ($uncompressedSize !== null) {
|
582 |
+
$zipEntry->setUncompressedSize($uncompressedSize);
|
583 |
+
}
|
584 |
+
|
585 |
+
if ($compressedSize !== null) {
|
586 |
+
$zipEntry->setCompressedSize($compressedSize);
|
587 |
+
}
|
588 |
+
|
589 |
+
if ($localHeaderOffset !== null) {
|
590 |
+
$zipEntry->setLocalHeaderOffset($localHeaderOffset);
|
591 |
+
}
|
592 |
+
}
|
593 |
+
|
594 |
+
/**
|
595 |
+
* Read Local File Header.
|
596 |
+
*
|
597 |
+
* local file header signature 4 bytes (0x04034b50)
|
598 |
+
* version needed to extract 2 bytes
|
599 |
+
* general purpose bit flag 2 bytes
|
600 |
+
* compression method 2 bytes
|
601 |
+
* last mod file time 2 bytes
|
602 |
+
* last mod file date 2 bytes
|
603 |
+
* crc-32 4 bytes
|
604 |
+
* compressed size 4 bytes
|
605 |
+
* uncompressed size 4 bytes
|
606 |
+
* file name length 2 bytes
|
607 |
+
* extra field length 2 bytes
|
608 |
+
* file name (variable size)
|
609 |
+
* extra field (variable size)
|
610 |
+
*
|
611 |
+
* @param ZipEntry $entry
|
612 |
+
*
|
613 |
+
* @throws ZipException
|
614 |
+
*/
|
615 |
+
protected function loadLocalExtraFields(ZipEntry $entry)
|
616 |
+
{
|
617 |
+
$offsetLocalHeader = $entry->getLocalHeaderOffset();
|
618 |
+
|
619 |
+
fseek($this->inStream, $offsetLocalHeader);
|
620 |
+
|
621 |
+
if (unpack('V', fread($this->inStream, 4))[1] !== ZipConstants::LOCAL_FILE_HEADER) {
|
622 |
+
throw new ZipException(sprintf('%s (expected Local File Header)', $entry->getName()));
|
623 |
+
}
|
624 |
+
|
625 |
+
fseek($this->inStream, $offsetLocalHeader + ZipConstants::LFH_FILENAME_LENGTH_POS);
|
626 |
+
$unpack = unpack('vfileNameLength/vextraFieldLength', fread($this->inStream, 4));
|
627 |
+
$offsetData = ftell($this->inStream)
|
628 |
+
+ $unpack['fileNameLength']
|
629 |
+
+ $unpack['extraFieldLength'];
|
630 |
+
|
631 |
+
fseek($this->inStream, $unpack['fileNameLength'], \SEEK_CUR);
|
632 |
+
|
633 |
+
if ($unpack['extraFieldLength'] > 0) {
|
634 |
+
$this->parseExtraFields(
|
635 |
+
fread($this->inStream, $unpack['extraFieldLength']),
|
636 |
+
$entry,
|
637 |
+
true
|
638 |
+
);
|
639 |
+
}
|
640 |
+
|
641 |
+
$zipData = new ZipSourceFileData($this, $entry, $offsetData);
|
642 |
+
$entry->setData($zipData);
|
643 |
+
}
|
644 |
+
|
645 |
+
/**
|
646 |
+
* @param ZipEntry $zipEntry
|
647 |
+
*
|
648 |
+
* @throws ZipException
|
649 |
+
*/
|
650 |
+
private function handleExtraEncryptionFields(ZipEntry $zipEntry)
|
651 |
+
{
|
652 |
+
if ($zipEntry->isEncrypted()) {
|
653 |
+
if ($zipEntry->getCompressionMethod() === ZipCompressionMethod::WINZIP_AES) {
|
654 |
+
/** @var WinZipAesExtraField|null $extraField */
|
655 |
+
$extraField = $zipEntry->getExtraField(WinZipAesExtraField::HEADER_ID);
|
656 |
+
|
657 |
+
if ($extraField === null) {
|
658 |
+
throw new ZipException(
|
659 |
+
sprintf(
|
660 |
+
'Extra field 0x%04x (WinZip-AES Encryption) expected for compression method %d',
|
661 |
+
WinZipAesExtraField::HEADER_ID,
|
662 |
+
$zipEntry->getCompressionMethod()
|
663 |
+
)
|
664 |
+
);
|
665 |
+
}
|
666 |
+
$zipEntry->setCompressionMethod($extraField->getCompressionMethod());
|
667 |
+
$zipEntry->setEncryptionMethod($extraField->getEncryptionMethod());
|
668 |
+
} else {
|
669 |
+
$zipEntry->setEncryptionMethod(ZipEncryptionMethod::PKWARE);
|
670 |
+
}
|
671 |
+
}
|
672 |
+
}
|
673 |
+
|
674 |
+
/**
|
675 |
+
* Handle extra data in zip records.
|
676 |
+
*
|
677 |
+
* This is a special method in which you can process ExtraField
|
678 |
+
* and make changes to ZipEntry.
|
679 |
+
*
|
680 |
+
* @param ZipEntry $zipEntry
|
681 |
+
*/
|
682 |
+
protected function handleExtraFields(ZipEntry $zipEntry)
|
683 |
+
{
|
684 |
+
}
|
685 |
+
|
686 |
+
/**
|
687 |
+
* @param ZipSourceFileData $zipFileData
|
688 |
+
*
|
689 |
+
* @throws ZipException
|
690 |
+
* @throws Crc32Exception
|
691 |
+
*
|
692 |
+
* @return resource
|
693 |
+
*/
|
694 |
+
public function getEntryStream(ZipSourceFileData $zipFileData)
|
695 |
+
{
|
696 |
+
$outStream = fopen('php://temp', 'w+b');
|
697 |
+
$this->copyUncompressedDataToStream($zipFileData, $outStream);
|
698 |
+
rewind($outStream);
|
699 |
+
|
700 |
+
return $outStream;
|
701 |
+
}
|
702 |
+
|
703 |
+
/**
|
704 |
+
* @param ZipSourceFileData $zipFileData
|
705 |
+
* @param resource $outStream
|
706 |
+
*
|
707 |
+
* @throws Crc32Exception
|
708 |
+
* @throws ZipException
|
709 |
+
*/
|
710 |
+
public function copyUncompressedDataToStream(ZipSourceFileData $zipFileData, $outStream)
|
711 |
+
{
|
712 |
+
if (!\is_resource($outStream)) {
|
713 |
+
throw new InvalidArgumentException('outStream is not resource');
|
714 |
+
}
|
715 |
+
|
716 |
+
$entry = $zipFileData->getSourceEntry();
|
717 |
+
|
718 |
+
// if ($entry->isDirectory()) {
|
719 |
+
// throw new InvalidArgumentException('Streams not supported for directories');
|
720 |
+
// }
|
721 |
+
|
722 |
+
if ($entry->isStrongEncryption()) {
|
723 |
+
throw new ZipException('Not support encryption zip.');
|
724 |
+
}
|
725 |
+
|
726 |
+
$compressionMethod = $entry->getCompressionMethod();
|
727 |
+
|
728 |
+
fseek($this->inStream, $zipFileData->getOffset());
|
729 |
+
|
730 |
+
$filters = [];
|
731 |
+
|
732 |
+
$skipCheckCrc = false;
|
733 |
+
$isEncrypted = $entry->isEncrypted();
|
734 |
+
|
735 |
+
if ($isEncrypted) {
|
736 |
+
if ($entry->getPassword() === null) {
|
737 |
+
throw new ZipException('Can not password from entry ' . $entry->getName());
|
738 |
+
}
|
739 |
+
|
740 |
+
if (ZipEncryptionMethod::isWinZipAesMethod($entry->getEncryptionMethod())) {
|
741 |
+
/** @var WinZipAesExtraField|null $winZipAesExtra */
|
742 |
+
$winZipAesExtra = $entry->getExtraField(WinZipAesExtraField::HEADER_ID);
|
743 |
+
|
744 |
+
if ($winZipAesExtra === null) {
|
745 |
+
throw new ZipException(
|
746 |
+
sprintf('WinZip AES must contain the extra field %s', WinZipAesExtraField::HEADER_ID)
|
747 |
+
);
|
748 |
+
}
|
749 |
+
$compressionMethod = $winZipAesExtra->getCompressionMethod();
|
750 |
+
|
751 |
+
WinZipAesDecryptionStreamFilter::register();
|
752 |
+
$cipherFilterName = WinZipAesDecryptionStreamFilter::FILTER_NAME;
|
753 |
+
|
754 |
+
if ($winZipAesExtra->isV2()) {
|
755 |
+
$skipCheckCrc = true;
|
756 |
+
}
|
757 |
+
} else {
|
758 |
+
PKDecryptionStreamFilter::register();
|
759 |
+
$cipherFilterName = PKDecryptionStreamFilter::FILTER_NAME;
|
760 |
+
}
|
761 |
+
$encContextFilter = stream_filter_append(
|
762 |
+
$this->inStream,
|
763 |
+
$cipherFilterName,
|
764 |
+
\STREAM_FILTER_READ,
|
765 |
+
[
|
766 |
+
'entry' => $entry,
|
767 |
+
]
|
768 |
+
);
|
769 |
+
|
770 |
+
if (!$encContextFilter) {
|
771 |
+
throw new \RuntimeException('Not apply filter ' . $cipherFilterName);
|
772 |
+
}
|
773 |
+
$filters[] = $encContextFilter;
|
774 |
+
}
|
775 |
+
|
776 |
+
// hack, see https://groups.google.com/forum/#!topic/alt.comp.lang.php/37_JZeW63uc
|
777 |
+
$pos = ftell($this->inStream);
|
778 |
+
rewind($this->inStream);
|
779 |
+
fseek($this->inStream, $pos);
|
780 |
+
|
781 |
+
$contextDecompress = null;
|
782 |
+
switch ($compressionMethod) {
|
783 |
+
case ZipCompressionMethod::STORED:
|
784 |
+
// file without compression, do nothing
|
785 |
+
break;
|
786 |
+
|
787 |
+
case ZipCompressionMethod::DEFLATED:
|
788 |
+
if (!($contextDecompress = stream_filter_append(
|
789 |
+
$this->inStream,
|
790 |
+
'zlib.inflate',
|
791 |
+
\STREAM_FILTER_READ
|
792 |
+
))) {
|
793 |
+
throw new \RuntimeException('Could not append filter "zlib.inflate" to stream');
|
794 |
+
}
|
795 |
+
$filters[] = $contextDecompress;
|
796 |
+
|
797 |
+
break;
|
798 |
+
|
799 |
+
case ZipCompressionMethod::BZIP2:
|
800 |
+
if (!($contextDecompress = stream_filter_append(
|
801 |
+
$this->inStream,
|
802 |
+
'bzip2.decompress',
|
803 |
+
\STREAM_FILTER_READ
|
804 |
+
))) {
|
805 |
+
throw new \RuntimeException('Could not append filter "bzip2.decompress" to stream');
|
806 |
+
}
|
807 |
+
$filters[] = $contextDecompress;
|
808 |
+
|
809 |
+
break;
|
810 |
+
|
811 |
+
default:
|
812 |
+
throw new ZipException(
|
813 |
+
sprintf(
|
814 |
+
'%s (compression method %d (%s) is not supported)',
|
815 |
+
$entry->getName(),
|
816 |
+
$compressionMethod,
|
817 |
+
ZipCompressionMethod::getCompressionMethodName($compressionMethod)
|
818 |
+
)
|
819 |
+
);
|
820 |
+
}
|
821 |
+
|
822 |
+
$limit = $zipFileData->getUncompressedSize();
|
823 |
+
|
824 |
+
$offset = 0;
|
825 |
+
$chunkSize = 8192;
|
826 |
+
|
827 |
+
try {
|
828 |
+
if ($skipCheckCrc) {
|
829 |
+
while ($offset < $limit) {
|
830 |
+
$length = min($chunkSize, $limit - $offset);
|
831 |
+
$buffer = fread($this->inStream, $length);
|
832 |
+
|
833 |
+
if ($buffer === false) {
|
834 |
+
throw new ZipException(sprintf('Error reading the contents of entry "%s".', $entry->getName()));
|
835 |
+
}
|
836 |
+
fwrite($outStream, $buffer);
|
837 |
+
$offset += $length;
|
838 |
+
}
|
839 |
+
} else {
|
840 |
+
$contextHash = hash_init('crc32b');
|
841 |
+
|
842 |
+
while ($offset < $limit) {
|
843 |
+
$length = min($chunkSize, $limit - $offset);
|
844 |
+
$buffer = fread($this->inStream, $length);
|
845 |
+
|
846 |
+
if ($buffer === false) {
|
847 |
+
throw new ZipException(sprintf('Error reading the contents of entry "%s".', $entry->getName()));
|
848 |
+
}
|
849 |
+
fwrite($outStream, $buffer);
|
850 |
+
hash_update($contextHash, $buffer);
|
851 |
+
$offset += $length;
|
852 |
+
}
|
853 |
+
|
854 |
+
$expectedCrc = (int) hexdec(hash_final($contextHash));
|
855 |
+
|
856 |
+
if ($expectedCrc !== $entry->getCrc()) {
|
857 |
+
throw new Crc32Exception($entry->getName(), $expectedCrc, $entry->getCrc());
|
858 |
+
}
|
859 |
+
}
|
860 |
+
} finally {
|
861 |
+
for ($i = \count($filters); $i > 0; $i--) {
|
862 |
+
stream_filter_remove($filters[$i - 1]);
|
863 |
+
}
|
864 |
+
}
|
865 |
+
}
|
866 |
+
|
867 |
+
/**
|
868 |
+
* @param ZipSourceFileData $zipData
|
869 |
+
* @param resource $outStream
|
870 |
+
*/
|
871 |
+
public function copyCompressedDataToStream(ZipSourceFileData $zipData, $outStream)
|
872 |
+
{
|
873 |
+
if ($zipData->getCompressedSize() > 0) {
|
874 |
+
fseek($this->inStream, $zipData->getOffset());
|
875 |
+
stream_copy_to_stream($this->inStream, $outStream, $zipData->getCompressedSize());
|
876 |
+
}
|
877 |
+
}
|
878 |
+
|
879 |
+
/**
|
880 |
+
* @return bool
|
881 |
+
*/
|
882 |
+
protected function isZip64Support()
|
883 |
+
{
|
884 |
+
return \PHP_INT_SIZE === 8; // true for 64bit system
|
885 |
+
}
|
886 |
+
|
887 |
+
public function close()
|
888 |
+
{
|
889 |
+
if (\is_resource($this->inStream)) {
|
890 |
+
fclose($this->inStream);
|
891 |
+
}
|
892 |
+
}
|
893 |
+
|
894 |
+
public function __destruct()
|
895 |
+
{
|
896 |
+
$this->close();
|
897 |
+
}
|
898 |
+
}
|
library/vendor/nelexa/zip/src/IO/ZipWriter.php
ADDED
@@ -0,0 +1,886 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\IO;
|
4 |
+
|
5 |
+
use PhpZip\Constants\DosCodePage;
|
6 |
+
use PhpZip\Constants\ZipCompressionMethod;
|
7 |
+
use PhpZip\Constants\ZipConstants;
|
8 |
+
use PhpZip\Constants\ZipEncryptionMethod;
|
9 |
+
use PhpZip\Constants\ZipPlatform;
|
10 |
+
use PhpZip\Constants\ZipVersion;
|
11 |
+
use PhpZip\Exception\ZipException;
|
12 |
+
use PhpZip\Exception\ZipUnsupportMethodException;
|
13 |
+
use PhpZip\IO\Filter\Cipher\Pkware\PKEncryptionStreamFilter;
|
14 |
+
use PhpZip\IO\Filter\Cipher\WinZipAes\WinZipAesEncryptionStreamFilter;
|
15 |
+
use PhpZip\Model\Data\ZipSourceFileData;
|
16 |
+
use PhpZip\Model\Extra\Fields\ApkAlignmentExtraField;
|
17 |
+
use PhpZip\Model\Extra\Fields\WinZipAesExtraField;
|
18 |
+
use PhpZip\Model\Extra\Fields\Zip64ExtraField;
|
19 |
+
use PhpZip\Model\ZipContainer;
|
20 |
+
use PhpZip\Model\ZipEntry;
|
21 |
+
use PhpZip\Util\PackUtil;
|
22 |
+
use PhpZip\Util\StringUtil;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Class ZipWriter.
|
26 |
+
*/
|
27 |
+
class ZipWriter
|
28 |
+
{
|
29 |
+
/** @var int Chunk read size */
|
30 |
+
const CHUNK_SIZE = 8192;
|
31 |
+
|
32 |
+
/** @var ZipContainer */
|
33 |
+
protected $zipContainer;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* ZipWriter constructor.
|
37 |
+
*
|
38 |
+
* @param ZipContainer $container
|
39 |
+
*/
|
40 |
+
public function __construct(ZipContainer $container)
|
41 |
+
{
|
42 |
+
// we clone the container so that the changes made to
|
43 |
+
// it do not affect the data in the ZipFile class
|
44 |
+
$this->zipContainer = clone $container;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @param resource $outStream
|
49 |
+
*
|
50 |
+
* @throws ZipException
|
51 |
+
*/
|
52 |
+
public function write($outStream)
|
53 |
+
{
|
54 |
+
if (!\is_resource($outStream)) {
|
55 |
+
throw new \InvalidArgumentException('$outStream must be resource');
|
56 |
+
}
|
57 |
+
$this->beforeWrite();
|
58 |
+
$this->writeLocalBlock($outStream);
|
59 |
+
$cdOffset = ftell($outStream);
|
60 |
+
$this->writeCentralDirectoryBlock($outStream);
|
61 |
+
$cdSize = ftell($outStream) - $cdOffset;
|
62 |
+
$this->writeEndOfCentralDirectoryBlock($outStream, $cdOffset, $cdSize);
|
63 |
+
}
|
64 |
+
|
65 |
+
protected function beforeWrite()
|
66 |
+
{
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* @param resource $outStream
|
71 |
+
*
|
72 |
+
* @throws ZipException
|
73 |
+
*/
|
74 |
+
protected function writeLocalBlock($outStream)
|
75 |
+
{
|
76 |
+
$zipEntries = $this->zipContainer->getEntries();
|
77 |
+
|
78 |
+
foreach ($zipEntries as $zipEntry) {
|
79 |
+
$this->writeLocalHeader($outStream, $zipEntry);
|
80 |
+
$this->writeData($outStream, $zipEntry);
|
81 |
+
|
82 |
+
if ($zipEntry->isDataDescriptorEnabled()) {
|
83 |
+
$this->writeDataDescriptor($outStream, $zipEntry);
|
84 |
+
}
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @param resource $outStream
|
90 |
+
* @param ZipEntry $entry
|
91 |
+
*
|
92 |
+
* @throws ZipException
|
93 |
+
*/
|
94 |
+
protected function writeLocalHeader($outStream, ZipEntry $entry)
|
95 |
+
{
|
96 |
+
// todo in 4.0 version move zipalign functional to ApkWriter class
|
97 |
+
if ($this->zipContainer->isZipAlign()) {
|
98 |
+
$this->zipAlign($outStream, $entry);
|
99 |
+
}
|
100 |
+
|
101 |
+
$relativeOffset = ftell($outStream);
|
102 |
+
$entry->setLocalHeaderOffset($relativeOffset);
|
103 |
+
|
104 |
+
if ($entry->isEncrypted() && $entry->getEncryptionMethod() === ZipEncryptionMethod::PKWARE) {
|
105 |
+
$entry->enableDataDescriptor(true);
|
106 |
+
}
|
107 |
+
|
108 |
+
$dd = $entry->isDataDescriptorRequired() ||
|
109 |
+
$entry->isDataDescriptorEnabled();
|
110 |
+
|
111 |
+
$compressedSize = $entry->getCompressedSize();
|
112 |
+
$uncompressedSize = $entry->getUncompressedSize();
|
113 |
+
|
114 |
+
$entry->getLocalExtraFields()->remove(Zip64ExtraField::HEADER_ID);
|
115 |
+
|
116 |
+
if ($compressedSize > ZipConstants::ZIP64_MAGIC || $uncompressedSize > ZipConstants::ZIP64_MAGIC) {
|
117 |
+
$entry->getLocalExtraFields()->add(
|
118 |
+
new Zip64ExtraField($uncompressedSize, $compressedSize)
|
119 |
+
);
|
120 |
+
|
121 |
+
$compressedSize = ZipConstants::ZIP64_MAGIC;
|
122 |
+
$uncompressedSize = ZipConstants::ZIP64_MAGIC;
|
123 |
+
}
|
124 |
+
|
125 |
+
$compressionMethod = $entry->getCompressionMethod();
|
126 |
+
$crc = $entry->getCrc();
|
127 |
+
|
128 |
+
if ($entry->isEncrypted() && ZipEncryptionMethod::isWinZipAesMethod($entry->getEncryptionMethod())) {
|
129 |
+
/** @var WinZipAesExtraField|null $winZipAesExtra */
|
130 |
+
$winZipAesExtra = $entry->getLocalExtraField(WinZipAesExtraField::HEADER_ID);
|
131 |
+
|
132 |
+
if ($winZipAesExtra === null) {
|
133 |
+
$winZipAesExtra = WinZipAesExtraField::create($entry);
|
134 |
+
}
|
135 |
+
|
136 |
+
if ($winZipAesExtra->isV2()) {
|
137 |
+
$crc = 0;
|
138 |
+
}
|
139 |
+
$compressionMethod = ZipCompressionMethod::WINZIP_AES;
|
140 |
+
}
|
141 |
+
|
142 |
+
$extra = $this->getExtraFieldsContents($entry, true);
|
143 |
+
$name = $entry->getName();
|
144 |
+
$dosCharset = $entry->getCharset();
|
145 |
+
|
146 |
+
if ($dosCharset !== null && !$entry->isUtf8Flag()) {
|
147 |
+
$name = DosCodePage::fromUTF8($name, $dosCharset);
|
148 |
+
}
|
149 |
+
|
150 |
+
$nameLength = \strlen($name);
|
151 |
+
$extraLength = \strlen($extra);
|
152 |
+
|
153 |
+
$size = $nameLength + $extraLength;
|
154 |
+
|
155 |
+
if ($size > 0xffff) {
|
156 |
+
throw new ZipException(
|
157 |
+
sprintf(
|
158 |
+
'%s (the total size of %s bytes for the name, extra fields and comment exceeds the maximum size of %d bytes)',
|
159 |
+
$entry->getName(),
|
160 |
+
$size,
|
161 |
+
0xffff
|
162 |
+
)
|
163 |
+
);
|
164 |
+
}
|
165 |
+
|
166 |
+
$extractedBy = ($entry->getExtractedOS() << 8) | $entry->getExtractVersion();
|
167 |
+
|
168 |
+
fwrite(
|
169 |
+
$outStream,
|
170 |
+
pack(
|
171 |
+
'VvvvVVVVvv',
|
172 |
+
// local file header signature 4 bytes (0x04034b50)
|
173 |
+
ZipConstants::LOCAL_FILE_HEADER,
|
174 |
+
// version needed to extract 2 bytes
|
175 |
+
$extractedBy,
|
176 |
+
// general purpose bit flag 2 bytes
|
177 |
+
$entry->getGeneralPurposeBitFlags(),
|
178 |
+
// compression method 2 bytes
|
179 |
+
$compressionMethod,
|
180 |
+
// last mod file time 2 bytes
|
181 |
+
// last mod file date 2 bytes
|
182 |
+
$entry->getDosTime(),
|
183 |
+
// crc-32 4 bytes
|
184 |
+
$dd ? 0 : $crc,
|
185 |
+
// compressed size 4 bytes
|
186 |
+
$dd ? 0 : $compressedSize,
|
187 |
+
// uncompressed size 4 bytes
|
188 |
+
$dd ? 0 : $uncompressedSize,
|
189 |
+
// file name length 2 bytes
|
190 |
+
$nameLength,
|
191 |
+
// extra field length 2 bytes
|
192 |
+
$extraLength
|
193 |
+
)
|
194 |
+
);
|
195 |
+
|
196 |
+
if ($nameLength > 0) {
|
197 |
+
fwrite($outStream, $name);
|
198 |
+
}
|
199 |
+
|
200 |
+
if ($extraLength > 0) {
|
201 |
+
fwrite($outStream, $extra);
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* @param resource $outStream
|
207 |
+
* @param ZipEntry $entry
|
208 |
+
*
|
209 |
+
* @throws ZipException
|
210 |
+
*/
|
211 |
+
private function zipAlign($outStream, ZipEntry $entry)
|
212 |
+
{
|
213 |
+
if (!$entry->isDirectory() && $entry->getCompressionMethod() === ZipCompressionMethod::STORED) {
|
214 |
+
$entry->removeExtraField(ApkAlignmentExtraField::HEADER_ID);
|
215 |
+
|
216 |
+
$extra = $this->getExtraFieldsContents($entry, true);
|
217 |
+
$extraLength = \strlen($extra);
|
218 |
+
$name = $entry->getName();
|
219 |
+
|
220 |
+
$dosCharset = $entry->getCharset();
|
221 |
+
|
222 |
+
if ($dosCharset !== null && !$entry->isUtf8Flag()) {
|
223 |
+
$name = DosCodePage::fromUTF8($name, $dosCharset);
|
224 |
+
}
|
225 |
+
$nameLength = \strlen($name);
|
226 |
+
|
227 |
+
$multiple = ApkAlignmentExtraField::ALIGNMENT_BYTES;
|
228 |
+
|
229 |
+
if (StringUtil::endsWith($name, '.so')) {
|
230 |
+
$multiple = ApkAlignmentExtraField::COMMON_PAGE_ALIGNMENT_BYTES;
|
231 |
+
}
|
232 |
+
|
233 |
+
$offset = ftell($outStream);
|
234 |
+
|
235 |
+
$dataMinStartOffset =
|
236 |
+
$offset +
|
237 |
+
ZipConstants::LFH_FILENAME_POS +
|
238 |
+
$extraLength +
|
239 |
+
$nameLength;
|
240 |
+
|
241 |
+
$padding =
|
242 |
+
($multiple - ($dataMinStartOffset % $multiple))
|
243 |
+
% $multiple;
|
244 |
+
|
245 |
+
if ($padding > 0) {
|
246 |
+
$dataMinStartOffset += ApkAlignmentExtraField::MIN_SIZE;
|
247 |
+
$padding =
|
248 |
+
($multiple - ($dataMinStartOffset % $multiple))
|
249 |
+
% $multiple;
|
250 |
+
|
251 |
+
$entry->getLocalExtraFields()->add(
|
252 |
+
new ApkAlignmentExtraField($multiple, $padding)
|
253 |
+
);
|
254 |
+
}
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Merges the local file data fields of the given ZipExtraFields.
|
260 |
+
*
|
261 |
+
* @param ZipEntry $entry
|
262 |
+
* @param bool $local
|
263 |
+
*
|
264 |
+
* @throws ZipException
|
265 |
+
*
|
266 |
+
* @return string
|
267 |
+
*/
|
268 |
+
protected function getExtraFieldsContents(ZipEntry $entry, $local)
|
269 |
+
{
|
270 |
+
$local = (bool) $local;
|
271 |
+
$collection = $local ?
|
272 |
+
$entry->getLocalExtraFields() :
|
273 |
+
$entry->getCdExtraFields();
|
274 |
+
$extraData = '';
|
275 |
+
|
276 |
+
foreach ($collection as $extraField) {
|
277 |
+
if ($local) {
|
278 |
+
$data = $extraField->packLocalFileData();
|
279 |
+
} else {
|
280 |
+
$data = $extraField->packCentralDirData();
|
281 |
+
}
|
282 |
+
$extraData .= pack(
|
283 |
+
'vv',
|
284 |
+
$extraField->getHeaderId(),
|
285 |
+
\strlen($data)
|
286 |
+
);
|
287 |
+
$extraData .= $data;
|
288 |
+
}
|
289 |
+
|
290 |
+
$size = \strlen($extraData);
|
291 |
+
|
292 |
+
if ($size > 0xffff) {
|
293 |
+
throw new ZipException(
|
294 |
+
sprintf(
|
295 |
+
'Size extra out of range: %d. Extra data: %s',
|
296 |
+
$size,
|
297 |
+
$extraData
|
298 |
+
)
|
299 |
+
);
|
300 |
+
}
|
301 |
+
|
302 |
+
return $extraData;
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* @param resource $outStream
|
307 |
+
* @param ZipEntry $entry
|
308 |
+
*
|
309 |
+
* @throws ZipException
|
310 |
+
*/
|
311 |
+
protected function writeData($outStream, ZipEntry $entry)
|
312 |
+
{
|
313 |
+
$zipData = $entry->getData();
|
314 |
+
|
315 |
+
if ($zipData === null) {
|
316 |
+
if ($entry->isDirectory()) {
|
317 |
+
return;
|
318 |
+
}
|
319 |
+
|
320 |
+
throw new ZipException(sprintf('No zip data for entry "%s"', $entry->getName()));
|
321 |
+
}
|
322 |
+
|
323 |
+
// data write variants:
|
324 |
+
// --------------------
|
325 |
+
// * data of source zip file -> copy compressed data
|
326 |
+
// * store - simple write
|
327 |
+
// * store and encryption - apply encryption filter and simple write
|
328 |
+
// * deflate or bzip2 - apply compression filter and simple write
|
329 |
+
// * (deflate or bzip2) and encryption - create temp stream and apply
|
330 |
+
// compression filter to it, then apply encryption filter to root
|
331 |
+
// stream and write temp stream data.
|
332 |
+
// (PHP cannot apply the filter for encryption after the compression
|
333 |
+
// filter, so a temporary stream is created for the compressed data)
|
334 |
+
|
335 |
+
if ($zipData instanceof ZipSourceFileData && !$zipData->hasRecompressData($entry)) {
|
336 |
+
// data of source zip file -> copy compressed data
|
337 |
+
$zipData->copyCompressedDataToStream($outStream);
|
338 |
+
|
339 |
+
return;
|
340 |
+
}
|
341 |
+
|
342 |
+
$entryStream = $zipData->getDataAsStream();
|
343 |
+
|
344 |
+
if (stream_get_meta_data($entryStream)['seekable']) {
|
345 |
+
rewind($entryStream);
|
346 |
+
}
|
347 |
+
|
348 |
+
$uncompressedSize = $entry->getUncompressedSize();
|
349 |
+
|
350 |
+
$posBeforeWrite = ftell($outStream);
|
351 |
+
$compressionMethod = $entry->getCompressionMethod();
|
352 |
+
|
353 |
+
if ($entry->isEncrypted()) {
|
354 |
+
if ($compressionMethod === ZipCompressionMethod::STORED) {
|
355 |
+
$contextFilter = $this->appendEncryptionFilter($outStream, $entry, $uncompressedSize);
|
356 |
+
$checksum = $this->writeAndCountChecksum($entryStream, $outStream, $uncompressedSize);
|
357 |
+
} else {
|
358 |
+
$compressStream = fopen('php://temp', 'w+b');
|
359 |
+
$contextFilter = $this->appendCompressionFilter($compressStream, $entry);
|
360 |
+
$checksum = $this->writeAndCountChecksum($entryStream, $compressStream, $uncompressedSize);
|
361 |
+
|
362 |
+
if ($contextFilter !== null) {
|
363 |
+
stream_filter_remove($contextFilter);
|
364 |
+
$contextFilter = null;
|
365 |
+
}
|
366 |
+
|
367 |
+
rewind($compressStream);
|
368 |
+
|
369 |
+
$compressedSize = fstat($compressStream)['size'];
|
370 |
+
$contextFilter = $this->appendEncryptionFilter($outStream, $entry, $compressedSize);
|
371 |
+
|
372 |
+
stream_copy_to_stream($compressStream, $outStream);
|
373 |
+
}
|
374 |
+
} else {
|
375 |
+
$contextFilter = $this->appendCompressionFilter($outStream, $entry);
|
376 |
+
$checksum = $this->writeAndCountChecksum($entryStream, $outStream, $uncompressedSize);
|
377 |
+
}
|
378 |
+
|
379 |
+
if ($contextFilter !== null) {
|
380 |
+
stream_filter_remove($contextFilter);
|
381 |
+
$contextFilter = null;
|
382 |
+
}
|
383 |
+
|
384 |
+
// my hack {@see https://bugs.php.net/bug.php?id=49874}
|
385 |
+
fseek($outStream, 0, \SEEK_END);
|
386 |
+
$compressedSize = ftell($outStream) - $posBeforeWrite;
|
387 |
+
|
388 |
+
$entry->setCompressedSize($compressedSize);
|
389 |
+
$entry->setCrc($checksum);
|
390 |
+
|
391 |
+
if (!$entry->isDataDescriptorEnabled()) {
|
392 |
+
if ($uncompressedSize > ZipConstants::ZIP64_MAGIC || $compressedSize > ZipConstants::ZIP64_MAGIC) {
|
393 |
+
/** @var Zip64ExtraField|null $zip64ExtraLocal */
|
394 |
+
$zip64ExtraLocal = $entry->getLocalExtraField(Zip64ExtraField::HEADER_ID);
|
395 |
+
|
396 |
+
// if there is a zip64 extra record, then update it;
|
397 |
+
// if not, write data to data descriptor
|
398 |
+
if ($zip64ExtraLocal !== null) {
|
399 |
+
$zip64ExtraLocal->setCompressedSize($compressedSize);
|
400 |
+
$zip64ExtraLocal->setUncompressedSize($uncompressedSize);
|
401 |
+
|
402 |
+
$posExtra = $entry->getLocalHeaderOffset() + ZipConstants::LFH_FILENAME_POS + \strlen($entry->getName());
|
403 |
+
fseek($outStream, $posExtra);
|
404 |
+
fwrite($outStream, $this->getExtraFieldsContents($entry, true));
|
405 |
+
} else {
|
406 |
+
$posGPBF = $entry->getLocalHeaderOffset() + 6;
|
407 |
+
$entry->enableDataDescriptor(true);
|
408 |
+
fseek($outStream, $posGPBF);
|
409 |
+
fwrite(
|
410 |
+
$outStream,
|
411 |
+
pack(
|
412 |
+
'v',
|
413 |
+
// general purpose bit flag 2 bytes
|
414 |
+
$entry->getGeneralPurposeBitFlags()
|
415 |
+
)
|
416 |
+
);
|
417 |
+
}
|
418 |
+
|
419 |
+
$compressedSize = ZipConstants::ZIP64_MAGIC;
|
420 |
+
$uncompressedSize = ZipConstants::ZIP64_MAGIC;
|
421 |
+
}
|
422 |
+
|
423 |
+
$posChecksum = $entry->getLocalHeaderOffset() + 14;
|
424 |
+
|
425 |
+
/** @var WinZipAesExtraField|null $winZipAesExtra */
|
426 |
+
$winZipAesExtra = $entry->getLocalExtraField(WinZipAesExtraField::HEADER_ID);
|
427 |
+
|
428 |
+
if ($winZipAesExtra !== null && $winZipAesExtra->isV2()) {
|
429 |
+
$checksum = 0;
|
430 |
+
}
|
431 |
+
|
432 |
+
fseek($outStream, $posChecksum);
|
433 |
+
fwrite(
|
434 |
+
$outStream,
|
435 |
+
pack(
|
436 |
+
'VVV',
|
437 |
+
// crc-32 4 bytes
|
438 |
+
$checksum,
|
439 |
+
// compressed size 4 bytes
|
440 |
+
$compressedSize,
|
441 |
+
// uncompressed size 4 bytes
|
442 |
+
$uncompressedSize
|
443 |
+
)
|
444 |
+
);
|
445 |
+
fseek($outStream, 0, \SEEK_END);
|
446 |
+
}
|
447 |
+
}
|
448 |
+
|
449 |
+
/**
|
450 |
+
* @param resource $inStream
|
451 |
+
* @param resource $outStream
|
452 |
+
* @param int $size
|
453 |
+
*
|
454 |
+
* @return int
|
455 |
+
*/
|
456 |
+
private function writeAndCountChecksum($inStream, $outStream, $size)
|
457 |
+
{
|
458 |
+
$contextHash = hash_init('crc32b');
|
459 |
+
$offset = 0;
|
460 |
+
|
461 |
+
while ($offset < $size) {
|
462 |
+
$read = min(self::CHUNK_SIZE, $size - $offset);
|
463 |
+
$buffer = fread($inStream, $read);
|
464 |
+
fwrite($outStream, $buffer);
|
465 |
+
hash_update($contextHash, $buffer);
|
466 |
+
$offset += $read;
|
467 |
+
}
|
468 |
+
|
469 |
+
return (int) hexdec(hash_final($contextHash));
|
470 |
+
}
|
471 |
+
|
472 |
+
/**
|
473 |
+
* @param resource $outStream
|
474 |
+
* @param ZipEntry $entry
|
475 |
+
*
|
476 |
+
* @throws ZipUnsupportMethodException
|
477 |
+
*
|
478 |
+
* @return resource|null
|
479 |
+
*/
|
480 |
+
protected function appendCompressionFilter($outStream, ZipEntry $entry)
|
481 |
+
{
|
482 |
+
$contextCompress = null;
|
483 |
+
switch ($entry->getCompressionMethod()) {
|
484 |
+
case ZipCompressionMethod::DEFLATED:
|
485 |
+
if (!($contextCompress = stream_filter_append(
|
486 |
+
$outStream,
|
487 |
+
'zlib.deflate',
|
488 |
+
\STREAM_FILTER_WRITE,
|
489 |
+
['level' => $entry->getCompressionLevel()]
|
490 |
+
))) {
|
491 |
+
throw new \RuntimeException('Could not append filter "zlib.deflate" to out stream');
|
492 |
+
}
|
493 |
+
break;
|
494 |
+
|
495 |
+
case ZipCompressionMethod::BZIP2:
|
496 |
+
if (!($contextCompress = stream_filter_append(
|
497 |
+
$outStream,
|
498 |
+
'bzip2.compress',
|
499 |
+
\STREAM_FILTER_WRITE,
|
500 |
+
['blocks' => $entry->getCompressionLevel(), 'work' => 0]
|
501 |
+
))) {
|
502 |
+
throw new \RuntimeException('Could not append filter "bzip2.compress" to out stream');
|
503 |
+
}
|
504 |
+
break;
|
505 |
+
|
506 |
+
case ZipCompressionMethod::STORED:
|
507 |
+
// file without compression, do nothing
|
508 |
+
break;
|
509 |
+
|
510 |
+
default:
|
511 |
+
throw new ZipUnsupportMethodException(
|
512 |
+
sprintf(
|
513 |
+
'%s (compression method %d (%s) is not supported)',
|
514 |
+
$entry->getName(),
|
515 |
+
$entry->getCompressionMethod(),
|
516 |
+
ZipCompressionMethod::getCompressionMethodName($entry->getCompressionMethod())
|
517 |
+
)
|
518 |
+
);
|
519 |
+
}
|
520 |
+
|
521 |
+
return $contextCompress;
|
522 |
+
}
|
523 |
+
|
524 |
+
/**
|
525 |
+
* @param resource $outStream
|
526 |
+
* @param ZipEntry $entry
|
527 |
+
* @param int $size
|
528 |
+
*
|
529 |
+
* @return resource|null
|
530 |
+
*/
|
531 |
+
protected function appendEncryptionFilter($outStream, ZipEntry $entry, $size)
|
532 |
+
{
|
533 |
+
$encContextFilter = null;
|
534 |
+
|
535 |
+
if ($entry->isEncrypted()) {
|
536 |
+
if ($entry->getEncryptionMethod() === ZipEncryptionMethod::PKWARE) {
|
537 |
+
PKEncryptionStreamFilter::register();
|
538 |
+
$cipherFilterName = PKEncryptionStreamFilter::FILTER_NAME;
|
539 |
+
} else {
|
540 |
+
WinZipAesEncryptionStreamFilter::register();
|
541 |
+
$cipherFilterName = WinZipAesEncryptionStreamFilter::FILTER_NAME;
|
542 |
+
}
|
543 |
+
$encContextFilter = stream_filter_append(
|
544 |
+
$outStream,
|
545 |
+
$cipherFilterName,
|
546 |
+
\STREAM_FILTER_WRITE,
|
547 |
+
[
|
548 |
+
'entry' => $entry,
|
549 |
+
'size' => $size,
|
550 |
+
]
|
551 |
+
);
|
552 |
+
|
553 |
+
if (!$encContextFilter) {
|
554 |
+
throw new \RuntimeException('Not apply filter ' . $cipherFilterName);
|
555 |
+
}
|
556 |
+
}
|
557 |
+
|
558 |
+
return $encContextFilter;
|
559 |
+
}
|
560 |
+
|
561 |
+
/**
|
562 |
+
* @param resource $outStream
|
563 |
+
* @param ZipEntry $entry
|
564 |
+
*/
|
565 |
+
protected function writeDataDescriptor($outStream, ZipEntry $entry)
|
566 |
+
{
|
567 |
+
$crc = $entry->getCrc();
|
568 |
+
|
569 |
+
/** @var WinZipAesExtraField|null $winZipAesExtra */
|
570 |
+
$winZipAesExtra = $entry->getLocalExtraField(WinZipAesExtraField::HEADER_ID);
|
571 |
+
|
572 |
+
if ($winZipAesExtra !== null && $winZipAesExtra->isV2()) {
|
573 |
+
$crc = 0;
|
574 |
+
}
|
575 |
+
|
576 |
+
fwrite(
|
577 |
+
$outStream,
|
578 |
+
pack(
|
579 |
+
'VV',
|
580 |
+
// data descriptor signature 4 bytes (0x08074b50)
|
581 |
+
ZipConstants::DATA_DESCRIPTOR,
|
582 |
+
// crc-32 4 bytes
|
583 |
+
$crc
|
584 |
+
)
|
585 |
+
);
|
586 |
+
|
587 |
+
if (
|
588 |
+
$entry->isZip64ExtensionsRequired() ||
|
589 |
+
$entry->getLocalExtraFields()->has(Zip64ExtraField::HEADER_ID)
|
590 |
+
) {
|
591 |
+
$dd =
|
592 |
+
// compressed size 8 bytes
|
593 |
+
PackUtil::packLongLE($entry->getCompressedSize()) .
|
594 |
+
// uncompressed size 8 bytes
|
595 |
+
PackUtil::packLongLE($entry->getUncompressedSize());
|
596 |
+
} else {
|
597 |
+
$dd = pack(
|
598 |
+
'VV',
|
599 |
+
// compressed size 4 bytes
|
600 |
+
$entry->getCompressedSize(),
|
601 |
+
// uncompressed size 4 bytes
|
602 |
+
$entry->getUncompressedSize()
|
603 |
+
);
|
604 |
+
}
|
605 |
+
|
606 |
+
fwrite($outStream, $dd);
|
607 |
+
}
|
608 |
+
|
609 |
+
/**
|
610 |
+
* @param resource $outStream
|
611 |
+
*
|
612 |
+
* @throws ZipException
|
613 |
+
*/
|
614 |
+
protected function writeCentralDirectoryBlock($outStream)
|
615 |
+
{
|
616 |
+
foreach ($this->zipContainer->getEntries() as $outputEntry) {
|
617 |
+
$this->writeCentralDirectoryHeader($outStream, $outputEntry);
|
618 |
+
}
|
619 |
+
}
|
620 |
+
|
621 |
+
/**
|
622 |
+
* Writes a Central File Header record.
|
623 |
+
*
|
624 |
+
* @param resource $outStream
|
625 |
+
* @param ZipEntry $entry
|
626 |
+
*
|
627 |
+
* @throws ZipException
|
628 |
+
*/
|
629 |
+
protected function writeCentralDirectoryHeader($outStream, ZipEntry $entry)
|
630 |
+
{
|
631 |
+
$compressedSize = $entry->getCompressedSize();
|
632 |
+
$uncompressedSize = $entry->getUncompressedSize();
|
633 |
+
$localHeaderOffset = $entry->getLocalHeaderOffset();
|
634 |
+
|
635 |
+
$entry->getCdExtraFields()->remove(Zip64ExtraField::HEADER_ID);
|
636 |
+
|
637 |
+
if (
|
638 |
+
$localHeaderOffset > ZipConstants::ZIP64_MAGIC ||
|
639 |
+
$compressedSize > ZipConstants::ZIP64_MAGIC ||
|
640 |
+
$uncompressedSize > ZipConstants::ZIP64_MAGIC
|
641 |
+
) {
|
642 |
+
$zip64ExtraField = new Zip64ExtraField();
|
643 |
+
|
644 |
+
if ($uncompressedSize >= ZipConstants::ZIP64_MAGIC) {
|
645 |
+
$zip64ExtraField->setUncompressedSize($uncompressedSize);
|
646 |
+
$uncompressedSize = ZipConstants::ZIP64_MAGIC;
|
647 |
+
}
|
648 |
+
|
649 |
+
if ($compressedSize >= ZipConstants::ZIP64_MAGIC) {
|
650 |
+
$zip64ExtraField->setCompressedSize($compressedSize);
|
651 |
+
$compressedSize = ZipConstants::ZIP64_MAGIC;
|
652 |
+
}
|
653 |
+
|
654 |
+
if ($localHeaderOffset >= ZipConstants::ZIP64_MAGIC) {
|
655 |
+
$zip64ExtraField->setLocalHeaderOffset($localHeaderOffset);
|
656 |
+
$localHeaderOffset = ZipConstants::ZIP64_MAGIC;
|
657 |
+
}
|
658 |
+
|
659 |
+
$entry->getCdExtraFields()->add($zip64ExtraField);
|
660 |
+
}
|
661 |
+
|
662 |
+
$extra = $this->getExtraFieldsContents($entry, false);
|
663 |
+
$extraLength = \strlen($extra);
|
664 |
+
|
665 |
+
$name = $entry->getName();
|
666 |
+
$comment = $entry->getComment();
|
667 |
+
|
668 |
+
$dosCharset = $entry->getCharset();
|
669 |
+
|
670 |
+
if ($dosCharset !== null && !$entry->isUtf8Flag()) {
|
671 |
+
$name = DosCodePage::fromUTF8($name, $dosCharset);
|
672 |
+
|
673 |
+
if ($comment) {
|
674 |
+
$comment = DosCodePage::fromUTF8($comment, $dosCharset);
|
675 |
+
}
|
676 |
+
}
|
677 |
+
|
678 |
+
$commentLength = \strlen($comment);
|
679 |
+
|
680 |
+
$compressionMethod = $entry->getCompressionMethod();
|
681 |
+
$crc = $entry->getCrc();
|
682 |
+
|
683 |
+
/** @var WinZipAesExtraField|null $winZipAesExtra */
|
684 |
+
$winZipAesExtra = $entry->getLocalExtraField(WinZipAesExtraField::HEADER_ID);
|
685 |
+
|
686 |
+
if ($winZipAesExtra !== null) {
|
687 |
+
if ($winZipAesExtra->isV2()) {
|
688 |
+
$crc = 0;
|
689 |
+
}
|
690 |
+
$compressionMethod = ZipCompressionMethod::WINZIP_AES;
|
691 |
+
}
|
692 |
+
|
693 |
+
fwrite(
|
694 |
+
$outStream,
|
695 |
+
pack(
|
696 |
+
'VvvvvVVVVvvvvvVV',
|
697 |
+
// central file header signature 4 bytes (0x02014b50)
|
698 |
+
ZipConstants::CENTRAL_FILE_HEADER,
|
699 |
+
// version made by 2 bytes
|
700 |
+
($entry->getCreatedOS() << 8) | $entry->getSoftwareVersion(),
|
701 |
+
// version needed to extract 2 bytes
|
702 |
+
($entry->getExtractedOS() << 8) | $entry->getExtractVersion(),
|
703 |
+
// general purpose bit flag 2 bytes
|
704 |
+
$entry->getGeneralPurposeBitFlags(),
|
705 |
+
// compression method 2 bytes
|
706 |
+
$compressionMethod,
|
707 |
+
// last mod file datetime 4 bytes
|
708 |
+
$entry->getDosTime(),
|
709 |
+
// crc-32 4 bytes
|
710 |
+
$crc,
|
711 |
+
// compressed size 4 bytes
|
712 |
+
$compressedSize,
|
713 |
+
// uncompressed size 4 bytes
|
714 |
+
$uncompressedSize,
|
715 |
+
// file name length 2 bytes
|
716 |
+
\strlen($name),
|
717 |
+
// extra field length 2 bytes
|
718 |
+
$extraLength,
|
719 |
+
// file comment length 2 bytes
|
720 |
+
$commentLength,
|
721 |
+
// disk number start 2 bytes
|
722 |
+
0,
|
723 |
+
// internal file attributes 2 bytes
|
724 |
+
$entry->getInternalAttributes(),
|
725 |
+
// external file attributes 4 bytes
|
726 |
+
$entry->getExternalAttributes(),
|
727 |
+
// relative offset of local header 4 bytes
|
728 |
+
$localHeaderOffset
|
729 |
+
)
|
730 |
+
);
|
731 |
+
|
732 |
+
// file name (variable size)
|
733 |
+
fwrite($outStream, $name);
|
734 |
+
|
735 |
+
if ($extraLength > 0) {
|
736 |
+
// extra field (variable size)
|
737 |
+
fwrite($outStream, $extra);
|
738 |
+
}
|
739 |
+
|
740 |
+
if ($commentLength > 0) {
|
741 |
+
// file comment (variable size)
|
742 |
+
fwrite($outStream, $comment);
|
743 |
+
}
|
744 |
+
}
|
745 |
+
|
746 |
+
/**
|
747 |
+
* @param resource $outStream
|
748 |
+
* @param int $centralDirectoryOffset
|
749 |
+
* @param int $centralDirectorySize
|
750 |
+
*/
|
751 |
+
protected function writeEndOfCentralDirectoryBlock(
|
752 |
+
$outStream,
|
753 |
+
$centralDirectoryOffset,
|
754 |
+
$centralDirectorySize
|
755 |
+
) {
|
756 |
+
$cdEntriesCount = \count($this->zipContainer);
|
757 |
+
|
758 |
+
$cdEntriesZip64 = $cdEntriesCount > 0xffff;
|
759 |
+
$cdSizeZip64 = $centralDirectorySize > ZipConstants::ZIP64_MAGIC;
|
760 |
+
$cdOffsetZip64 = $centralDirectoryOffset > ZipConstants::ZIP64_MAGIC;
|
761 |
+
|
762 |
+
$zip64Required = $cdEntriesZip64
|
763 |
+
|| $cdSizeZip64
|
764 |
+
|| $cdOffsetZip64;
|
765 |
+
|
766 |
+
if ($zip64Required) {
|
767 |
+
$zip64EndOfCentralDirectoryOffset = ftell($outStream);
|
768 |
+
|
769 |
+
// find max software version, version needed to extract and most common platform
|
770 |
+
list($softwareVersion, $versionNeededToExtract) = array_reduce(
|
771 |
+
$this->zipContainer->getEntries(),
|
772 |
+
static function (array $carry, ZipEntry $entry) {
|
773 |
+
$carry[0] = max($carry[0], $entry->getSoftwareVersion() & 0xFF);
|
774 |
+
$carry[1] = max($carry[1], $entry->getExtractVersion() & 0xFF);
|
775 |
+
|
776 |
+
return $carry;
|
777 |
+
},
|
778 |
+
[ZipVersion::v10_DEFAULT_MIN, ZipVersion::v45_ZIP64_EXT]
|
779 |
+
);
|
780 |
+
|
781 |
+
$createdOS = $extractedOS = ZipPlatform::OS_DOS;
|
782 |
+
$versionMadeBy = ($createdOS << 8) | max($softwareVersion, ZipVersion::v45_ZIP64_EXT);
|
783 |
+
$versionExtractedBy = ($extractedOS << 8) | max($versionNeededToExtract, ZipVersion::v45_ZIP64_EXT);
|
784 |
+
|
785 |
+
// write zip64 end of central directory signature
|
786 |
+
fwrite(
|
787 |
+
$outStream,
|
788 |
+
pack(
|
789 |
+
'V',
|
790 |
+
// signature 4 bytes (0x06064b50)
|
791 |
+
ZipConstants::ZIP64_END_CD
|
792 |
+
)
|
793 |
+
);
|
794 |
+
// size of zip64 end of central
|
795 |
+
// directory record 8 bytes
|
796 |
+
fwrite($outStream, PackUtil::packLongLE(ZipConstants::ZIP64_END_OF_CD_LEN - 12));
|
797 |
+
fwrite(
|
798 |
+
$outStream,
|
799 |
+
pack(
|
800 |
+
'vvVV',
|
801 |
+
// version made by 2 bytes
|
802 |
+
$versionMadeBy & 0xFFFF,
|
803 |
+
// version needed to extract 2 bytes
|
804 |
+
$versionExtractedBy & 0xFFFF,
|
805 |
+
// number of this disk 4 bytes
|
806 |
+
0,
|
807 |
+
// number of the disk with the
|
808 |
+
// start of the central directory 4 bytes
|
809 |
+
0
|
810 |
+
)
|
811 |
+
);
|
812 |
+
|
813 |
+
fwrite(
|
814 |
+
$outStream,
|
815 |
+
// total number of entries in the
|
816 |
+
// central directory on this disk 8 bytes
|
817 |
+
PackUtil::packLongLE($cdEntriesCount) .
|
818 |
+
// total number of entries in the
|
819 |
+
// central directory 8 bytes
|
820 |
+
PackUtil::packLongLE($cdEntriesCount) .
|
821 |
+
// size of the central directory 8 bytes
|
822 |
+
PackUtil::packLongLE($centralDirectorySize) .
|
823 |
+
// offset of start of central
|
824 |
+
// directory with respect to
|
825 |
+
// the starting disk number 8 bytes
|
826 |
+
PackUtil::packLongLE($centralDirectoryOffset)
|
827 |
+
);
|
828 |
+
|
829 |
+
// write zip64 end of central directory locator
|
830 |
+
fwrite(
|
831 |
+
$outStream,
|
832 |
+
pack(
|
833 |
+
'VV',
|
834 |
+
// zip64 end of central dir locator
|
835 |
+
// signature 4 bytes (0x07064b50)
|
836 |
+
ZipConstants::ZIP64_END_CD_LOC,
|
837 |
+
// number of the disk with the
|
838 |
+
// start of the zip64 end of
|
839 |
+
// central directory 4 bytes
|
840 |
+
0
|
841 |
+
) .
|
842 |
+
// relative offset of the zip64
|
843 |
+
// end of central directory record 8 bytes
|
844 |
+
PackUtil::packLongLE($zip64EndOfCentralDirectoryOffset) .
|
845 |
+
// total number of disks 4 bytes
|
846 |
+
pack('V', 1)
|
847 |
+
);
|
848 |
+
}
|
849 |
+
|
850 |
+
$comment = $this->zipContainer->getArchiveComment();
|
851 |
+
$commentLength = $comment !== null ? \strlen($comment) : 0;
|
852 |
+
|
853 |
+
fwrite(
|
854 |
+
$outStream,
|
855 |
+
pack(
|
856 |
+
'VvvvvVVv',
|
857 |
+
// end of central dir signature 4 bytes (0x06054b50)
|
858 |
+
ZipConstants::END_CD,
|
859 |
+
// number of this disk 2 bytes
|
860 |
+
0,
|
861 |
+
// number of the disk with the
|
862 |
+
// start of the central directory 2 bytes
|
863 |
+
0,
|
864 |
+
// total number of entries in the
|
865 |
+
// central directory on this disk 2 bytes
|
866 |
+
$cdEntriesZip64 ? 0xffff : $cdEntriesCount,
|
867 |
+
// total number of entries in
|
868 |
+
// the central directory 2 bytes
|
869 |
+
$cdEntriesZip64 ? 0xffff : $cdEntriesCount,
|
870 |
+
// size of the central directory 4 bytes
|
871 |
+
$cdSizeZip64 ? ZipConstants::ZIP64_MAGIC : $centralDirectorySize,
|
872 |
+
// offset of start of central
|
873 |
+
// directory with respect to
|
874 |
+
// the starting disk number 4 bytes
|
875 |
+
$cdOffsetZip64 ? ZipConstants::ZIP64_MAGIC : $centralDirectoryOffset,
|
876 |
+
// .ZIP file comment length 2 bytes
|
877 |
+
$commentLength
|
878 |
+
)
|
879 |
+
);
|
880 |
+
|
881 |
+
if ($comment !== null && $commentLength > 0) {
|
882 |
+
// .ZIP file comment (variable size)
|
883 |
+
fwrite($outStream, $comment);
|
884 |
+
}
|
885 |
+
}
|
886 |
+
}
|
library/vendor/nelexa/zip/src/Model/Data/ZipFileData.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Data;
|
4 |
+
|
5 |
+
use PhpZip\Exception\ZipException;
|
6 |
+
use PhpZip\Model\ZipData;
|
7 |
+
use PhpZip\Model\ZipEntry;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Class ZipFileData.
|
11 |
+
*/
|
12 |
+
class ZipFileData implements ZipData
|
13 |
+
{
|
14 |
+
/** @var \SplFileInfo */
|
15 |
+
private $file;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* ZipStringData constructor.
|
19 |
+
*
|
20 |
+
* @param ZipEntry $zipEntry
|
21 |
+
* @param \SplFileInfo $fileInfo
|
22 |
+
*
|
23 |
+
* @throws ZipException
|
24 |
+
*/
|
25 |
+
public function __construct(ZipEntry $zipEntry, \SplFileInfo $fileInfo)
|
26 |
+
{
|
27 |
+
if (!$fileInfo->isFile()) {
|
28 |
+
throw new ZipException('$fileInfo is not a file.');
|
29 |
+
}
|
30 |
+
|
31 |
+
if (!$fileInfo->isReadable()) {
|
32 |
+
throw new ZipException('$fileInfo is not readable.');
|
33 |
+
}
|
34 |
+
|
35 |
+
$this->file = $fileInfo;
|
36 |
+
$zipEntry->setUncompressedSize($fileInfo->getSize());
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @throws ZipException
|
41 |
+
*
|
42 |
+
* @return resource returns stream data
|
43 |
+
*/
|
44 |
+
public function getDataAsStream()
|
45 |
+
{
|
46 |
+
if (!$this->file->isReadable()) {
|
47 |
+
throw new ZipException(sprintf('The %s file is no longer readable.', $this->file->getPathname()));
|
48 |
+
}
|
49 |
+
|
50 |
+
return fopen($this->file->getPathname(), 'rb');
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @throws ZipException
|
55 |
+
*
|
56 |
+
* @return string returns data as string
|
57 |
+
*/
|
58 |
+
public function getDataAsString()
|
59 |
+
{
|
60 |
+
if (!$this->file->isReadable()) {
|
61 |
+
throw new ZipException(sprintf('The %s file is no longer readable.', $this->file->getPathname()));
|
62 |
+
}
|
63 |
+
|
64 |
+
return file_get_contents($this->file->getPathname());
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @param resource $outStream
|
69 |
+
*
|
70 |
+
* @throws ZipException
|
71 |
+
*/
|
72 |
+
public function copyDataToStream($outStream)
|
73 |
+
{
|
74 |
+
try {
|
75 |
+
$stream = $this->getDataAsStream();
|
76 |
+
stream_copy_to_stream($stream, $outStream);
|
77 |
+
} finally {
|
78 |
+
fclose($stream);
|
79 |
+
}
|
80 |
+
}
|
81 |
+
}
|
library/vendor/nelexa/zip/src/Model/Data/ZipNewData.php
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Data;
|
4 |
+
|
5 |
+
use PhpZip\Model\ZipData;
|
6 |
+
use PhpZip\Model\ZipEntry;
|
7 |
+
use PhpZip\ZipFile;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* The class contains a streaming resource with new content added to the ZIP archive.
|
11 |
+
*/
|
12 |
+
class ZipNewData implements ZipData
|
13 |
+
{
|
14 |
+
/**
|
15 |
+
* A static variable allows closing the stream in the destructor
|
16 |
+
* only if it is its sole holder.
|
17 |
+
*
|
18 |
+
* @var array<int, int> array of resource ids and the number of class clones
|
19 |
+
*/
|
20 |
+
private static $guardClonedStream = [];
|
21 |
+
|
22 |
+
/** @var ZipEntry */
|
23 |
+
private $zipEntry;
|
24 |
+
|
25 |
+
/** @var resource */
|
26 |
+
private $stream;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* ZipStringData constructor.
|
30 |
+
*
|
31 |
+
* @param ZipEntry $zipEntry
|
32 |
+
* @param string|resource $data
|
33 |
+
*/
|
34 |
+
public function __construct(ZipEntry $zipEntry, $data)
|
35 |
+
{
|
36 |
+
$this->zipEntry = $zipEntry;
|
37 |
+
|
38 |
+
if (\is_string($data)) {
|
39 |
+
$zipEntry->setUncompressedSize(\strlen($data));
|
40 |
+
|
41 |
+
if (!($handle = fopen('php://temp', 'w+b'))) {
|
42 |
+
// @codeCoverageIgnoreStart
|
43 |
+
throw new \RuntimeException('A temporary resource cannot be opened for writing.');
|
44 |
+
// @codeCoverageIgnoreEnd
|
45 |
+
}
|
46 |
+
fwrite($handle, $data);
|
47 |
+
rewind($handle);
|
48 |
+
$this->stream = $handle;
|
49 |
+
} elseif (\is_resource($data)) {
|
50 |
+
$this->stream = $data;
|
51 |
+
}
|
52 |
+
|
53 |
+
$resourceId = (int) $this->stream;
|
54 |
+
self::$guardClonedStream[$resourceId] =
|
55 |
+
isset(self::$guardClonedStream[$resourceId]) ?
|
56 |
+
self::$guardClonedStream[$resourceId] + 1 :
|
57 |
+
0;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* @return resource returns stream data
|
62 |
+
*/
|
63 |
+
public function getDataAsStream()
|
64 |
+
{
|
65 |
+
if (!\is_resource($this->stream)) {
|
66 |
+
throw new \LogicException(sprintf('Resource has been closed (entry=%s).', $this->zipEntry->getName()));
|
67 |
+
}
|
68 |
+
|
69 |
+
return $this->stream;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* @return string returns data as string
|
74 |
+
*/
|
75 |
+
public function getDataAsString()
|
76 |
+
{
|
77 |
+
$stream = $this->getDataAsStream();
|
78 |
+
$pos = ftell($stream);
|
79 |
+
|
80 |
+
try {
|
81 |
+
rewind($stream);
|
82 |
+
|
83 |
+
return stream_get_contents($stream);
|
84 |
+
} finally {
|
85 |
+
fseek($stream, $pos);
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @param resource $outStream
|
91 |
+
*/
|
92 |
+
public function copyDataToStream($outStream)
|
93 |
+
{
|
94 |
+
$stream = $this->getDataAsStream();
|
95 |
+
rewind($stream);
|
96 |
+
stream_copy_to_stream($stream, $outStream);
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @see https://php.net/manual/en/language.oop5.cloning.php
|
101 |
+
*/
|
102 |
+
public function __clone()
|
103 |
+
{
|
104 |
+
$resourceId = (int) $this->stream;
|
105 |
+
self::$guardClonedStream[$resourceId] =
|
106 |
+
isset(self::$guardClonedStream[$resourceId]) ?
|
107 |
+
self::$guardClonedStream[$resourceId] + 1 :
|
108 |
+
1;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* The stream will be closed when closing the zip archive.
|
113 |
+
*
|
114 |
+
* The method implements protection against closing the stream of the cloned object.
|
115 |
+
*
|
116 |
+
* @see ZipFile::close()
|
117 |
+
*/
|
118 |
+
public function __destruct()
|
119 |
+
{
|
120 |
+
$resourceId = (int) $this->stream;
|
121 |
+
|
122 |
+
if (isset(self::$guardClonedStream[$resourceId]) && self::$guardClonedStream[$resourceId] > 0) {
|
123 |
+
self::$guardClonedStream[$resourceId]--;
|
124 |
+
|
125 |
+
return;
|
126 |
+
}
|
127 |
+
|
128 |
+
if (\is_resource($this->stream)) {
|
129 |
+
fclose($this->stream);
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
library/vendor/nelexa/zip/src/Model/Data/ZipSourceFileData.php
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Data;
|
4 |
+
|
5 |
+
use PhpZip\Exception\Crc32Exception;
|
6 |
+
use PhpZip\Exception\ZipException;
|
7 |
+
use PhpZip\IO\ZipReader;
|
8 |
+
use PhpZip\Model\ZipData;
|
9 |
+
use PhpZip\Model\ZipEntry;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class ZipFileData.
|
13 |
+
*/
|
14 |
+
class ZipSourceFileData implements ZipData
|
15 |
+
{
|
16 |
+
/** @var ZipReader */
|
17 |
+
private $zipReader;
|
18 |
+
|
19 |
+
/** @var resource|null */
|
20 |
+
private $stream;
|
21 |
+
|
22 |
+
/** @var ZipEntry */
|
23 |
+
private $sourceEntry;
|
24 |
+
|
25 |
+
/** @var int */
|
26 |
+
private $offset;
|
27 |
+
|
28 |
+
/** @var int */
|
29 |
+
private $uncompressedSize;
|
30 |
+
|
31 |
+
/** @var int */
|
32 |
+
private $compressedSize;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* ZipFileData constructor.
|
36 |
+
*
|
37 |
+
* @param ZipReader $zipReader
|
38 |
+
* @param ZipEntry $zipEntry
|
39 |
+
* @param int $offsetData
|
40 |
+
*/
|
41 |
+
public function __construct(ZipReader $zipReader, ZipEntry $zipEntry, $offsetData)
|
42 |
+
{
|
43 |
+
$this->zipReader = $zipReader;
|
44 |
+
$this->offset = $offsetData;
|
45 |
+
$this->sourceEntry = $zipEntry;
|
46 |
+
$this->compressedSize = $zipEntry->getCompressedSize();
|
47 |
+
$this->uncompressedSize = $zipEntry->getUncompressedSize();
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @param ZipEntry $entry
|
52 |
+
*
|
53 |
+
* @return bool
|
54 |
+
*/
|
55 |
+
public function hasRecompressData(ZipEntry $entry)
|
56 |
+
{
|
57 |
+
return $this->sourceEntry->getCompressionLevel() !== $entry->getCompressionLevel() ||
|
58 |
+
$this->sourceEntry->getCompressionMethod() !== $entry->getCompressionMethod() ||
|
59 |
+
$this->sourceEntry->isEncrypted() !== $entry->isEncrypted() ||
|
60 |
+
$this->sourceEntry->getEncryptionMethod() !== $entry->getEncryptionMethod() ||
|
61 |
+
$this->sourceEntry->getPassword() !== $entry->getPassword() ||
|
62 |
+
$this->sourceEntry->getCompressedSize() !== $entry->getCompressedSize() ||
|
63 |
+
$this->sourceEntry->getUncompressedSize() !== $entry->getUncompressedSize() ||
|
64 |
+
$this->sourceEntry->getCrc() !== $entry->getCrc();
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @throws ZipException
|
69 |
+
*
|
70 |
+
* @return resource returns stream data
|
71 |
+
*/
|
72 |
+
public function getDataAsStream()
|
73 |
+
{
|
74 |
+
if (!\is_resource($this->stream)) {
|
75 |
+
$this->stream = $this->zipReader->getEntryStream($this);
|
76 |
+
}
|
77 |
+
|
78 |
+
return $this->stream;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* @throws ZipException
|
83 |
+
*
|
84 |
+
* @return string returns data as string
|
85 |
+
*/
|
86 |
+
public function getDataAsString()
|
87 |
+
{
|
88 |
+
$autoClosable = $this->stream === null;
|
89 |
+
|
90 |
+
$stream = $this->getDataAsStream();
|
91 |
+
$pos = ftell($stream);
|
92 |
+
|
93 |
+
try {
|
94 |
+
rewind($stream);
|
95 |
+
|
96 |
+
return stream_get_contents($stream);
|
97 |
+
} finally {
|
98 |
+
if ($autoClosable) {
|
99 |
+
fclose($stream);
|
100 |
+
$this->stream = null;
|
101 |
+
} else {
|
102 |
+
fseek($stream, $pos);
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* @param resource $outputStream Output stream
|
109 |
+
*
|
110 |
+
* @throws ZipException
|
111 |
+
* @throws Crc32Exception
|
112 |
+
*/
|
113 |
+
public function copyDataToStream($outputStream)
|
114 |
+
{
|
115 |
+
if (\is_resource($this->stream)) {
|
116 |
+
rewind($this->stream);
|
117 |
+
stream_copy_to_stream($this->stream, $outputStream);
|
118 |
+
} else {
|
119 |
+
$this->zipReader->copyUncompressedDataToStream($this, $outputStream);
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* @param resource $outputStream Output stream
|
125 |
+
*/
|
126 |
+
public function copyCompressedDataToStream($outputStream)
|
127 |
+
{
|
128 |
+
$this->zipReader->copyCompressedDataToStream($this, $outputStream);
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* @return ZipEntry
|
133 |
+
*/
|
134 |
+
public function getSourceEntry()
|
135 |
+
{
|
136 |
+
return $this->sourceEntry;
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* @return int
|
141 |
+
*/
|
142 |
+
public function getCompressedSize()
|
143 |
+
{
|
144 |
+
return $this->compressedSize;
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* @return int
|
149 |
+
*/
|
150 |
+
public function getUncompressedSize()
|
151 |
+
{
|
152 |
+
return $this->uncompressedSize;
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* @return int
|
157 |
+
*/
|
158 |
+
public function getOffset()
|
159 |
+
{
|
160 |
+
return $this->offset;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* {@inheritdoc}
|
165 |
+
*/
|
166 |
+
public function __destruct()
|
167 |
+
{
|
168 |
+
if (\is_resource($this->stream)) {
|
169 |
+
fclose($this->stream);
|
170 |
+
}
|
171 |
+
}
|
172 |
+
}
|
library/vendor/nelexa/zip/src/Model/EndOfCentralDirectory.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* End of Central Directory.
|
7 |
+
*
|
8 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
9 |
+
* @license MIT
|
10 |
+
*/
|
11 |
+
class EndOfCentralDirectory
|
12 |
+
{
|
13 |
+
/** @var int Count files. */
|
14 |
+
private $entryCount;
|
15 |
+
|
16 |
+
/** @var int Central Directory Offset. */
|
17 |
+
private $cdOffset;
|
18 |
+
|
19 |
+
/** @var int */
|
20 |
+
private $cdSize;
|
21 |
+
|
22 |
+
/** @var string|null The archive comment. */
|
23 |
+
private $comment;
|
24 |
+
|
25 |
+
/** @var bool Zip64 extension */
|
26 |
+
private $zip64;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* EndOfCentralDirectory constructor.
|
30 |
+
*
|
31 |
+
* @param int $entryCount
|
32 |
+
* @param int $cdOffset
|
33 |
+
* @param int $cdSize
|
34 |
+
* @param bool $zip64
|
35 |
+
* @param string|null $comment
|
36 |
+
*/
|
37 |
+
public function __construct($entryCount, $cdOffset, $cdSize, $zip64, $comment = null)
|
38 |
+
{
|
39 |
+
$this->entryCount = $entryCount;
|
40 |
+
$this->cdOffset = $cdOffset;
|
41 |
+
$this->cdSize = $cdSize;
|
42 |
+
$this->zip64 = $zip64;
|
43 |
+
$this->comment = $comment;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @param string|null $comment
|
48 |
+
*/
|
49 |
+
public function setComment($comment)
|
50 |
+
{
|
51 |
+
$this->comment = $comment;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* @return int
|
56 |
+
*/
|
57 |
+
public function getEntryCount()
|
58 |
+
{
|
59 |
+
return $this->entryCount;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @return int
|
64 |
+
*/
|
65 |
+
public function getCdOffset()
|
66 |
+
{
|
67 |
+
return $this->cdOffset;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* @return int
|
72 |
+
*/
|
73 |
+
public function getCdSize()
|
74 |
+
{
|
75 |
+
return $this->cdSize;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* @return string|null
|
80 |
+
*/
|
81 |
+
public function getComment()
|
82 |
+
{
|
83 |
+
return $this->comment;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* @return bool
|
88 |
+
*/
|
89 |
+
public function isZip64()
|
90 |
+
{
|
91 |
+
return $this->zip64;
|
92 |
+
}
|
93 |
+
}
|
library/vendor/nelexa/zip/src/Model/Extra/ExtraFieldsCollection.php
ADDED
@@ -0,0 +1,276 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Extra;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Represents a collection of Extra Fields as they may
|
7 |
+
* be present at several locations in ZIP files.
|
8 |
+
*/
|
9 |
+
class ExtraFieldsCollection implements \ArrayAccess, \Countable, \Iterator
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* The map of Extra Fields.
|
13 |
+
* Maps from Header ID to Extra Field.
|
14 |
+
* Must not be null, but may be empty if no Extra Fields are used.
|
15 |
+
* The map is sorted by Header IDs in ascending order.
|
16 |
+
*
|
17 |
+
* @var ZipExtraField[]
|
18 |
+
*/
|
19 |
+
protected $collection = [];
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Returns the number of Extra Fields in this collection.
|
23 |
+
*
|
24 |
+
* @return int
|
25 |
+
*/
|
26 |
+
public function count()
|
27 |
+
{
|
28 |
+
return \count($this->collection);
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Returns the Extra Field with the given Header ID or null
|
33 |
+
* if no such Extra Field exists.
|
34 |
+
*
|
35 |
+
* @param int $headerId the requested Header ID
|
36 |
+
*
|
37 |
+
* @return ZipExtraField|null the Extra Field with the given Header ID or
|
38 |
+
* if no such Extra Field exists
|
39 |
+
*/
|
40 |
+
public function get($headerId)
|
41 |
+
{
|
42 |
+
$this->validateHeaderId($headerId);
|
43 |
+
|
44 |
+
return isset($this->collection[$headerId]) ? $this->collection[$headerId] : null;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @param int $headerId
|
49 |
+
*/
|
50 |
+
private function validateHeaderId($headerId)
|
51 |
+
{
|
52 |
+
if ($headerId < 0 || $headerId > 0xffff) {
|
53 |
+
throw new \InvalidArgumentException('$headerId out of range');
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Stores the given Extra Field in this collection.
|
59 |
+
*
|
60 |
+
* @param ZipExtraField $extraField the Extra Field to store in this collection
|
61 |
+
*
|
62 |
+
* @return ZipExtraField the Extra Field previously associated with the Header ID of
|
63 |
+
* of the given Extra Field or null if no such Extra Field existed
|
64 |
+
*/
|
65 |
+
public function add(ZipExtraField $extraField)
|
66 |
+
{
|
67 |
+
$headerId = $extraField->getHeaderId();
|
68 |
+
|
69 |
+
$this->validateHeaderId($headerId);
|
70 |
+
$this->collection[$headerId] = $extraField;
|
71 |
+
|
72 |
+
return $extraField;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* @param ZipExtraField[] $extraFields
|
77 |
+
*/
|
78 |
+
public function addAll(array $extraFields)
|
79 |
+
{
|
80 |
+
foreach ($extraFields as $extraField) {
|
81 |
+
$this->add($extraField);
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* @param ExtraFieldsCollection $collection
|
87 |
+
*/
|
88 |
+
public function addCollection(self $collection)
|
89 |
+
{
|
90 |
+
$this->addAll($collection->collection);
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* @return ZipExtraField[]
|
95 |
+
*/
|
96 |
+
public function getAll()
|
97 |
+
{
|
98 |
+
return $this->collection;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Returns Extra Field exists.
|
103 |
+
*
|
104 |
+
* @param int $headerId the requested Header ID
|
105 |
+
*
|
106 |
+
* @return bool
|
107 |
+
*/
|
108 |
+
public function has($headerId)
|
109 |
+
{
|
110 |
+
return isset($this->collection[$headerId]);
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Removes the Extra Field with the given Header ID.
|
115 |
+
*
|
116 |
+
* @param int $headerId the requested Header ID
|
117 |
+
*
|
118 |
+
* @return ZipExtraField|null the Extra Field with the given Header ID or null
|
119 |
+
* if no such Extra Field exists
|
120 |
+
*/
|
121 |
+
public function remove($headerId)
|
122 |
+
{
|
123 |
+
$this->validateHeaderId($headerId);
|
124 |
+
|
125 |
+
if (isset($this->collection[$headerId])) {
|
126 |
+
$ef = $this->collection[$headerId];
|
127 |
+
unset($this->collection[$headerId]);
|
128 |
+
|
129 |
+
return $ef;
|
130 |
+
}
|
131 |
+
|
132 |
+
return null;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Whether a offset exists.
|
137 |
+
*
|
138 |
+
* @see http://php.net/manual/en/arrayaccess.offsetexists.php
|
139 |
+
*
|
140 |
+
* @param int $offset an offset to check for
|
141 |
+
*
|
142 |
+
* @return bool true on success or false on failure
|
143 |
+
*/
|
144 |
+
public function offsetExists($offset)
|
145 |
+
{
|
146 |
+
return isset($this->collection[(int) $offset]);
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Offset to retrieve.
|
151 |
+
*
|
152 |
+
* @see http://php.net/manual/en/arrayaccess.offsetget.php
|
153 |
+
*
|
154 |
+
* @param int $offset the offset to retrieve
|
155 |
+
*
|
156 |
+
* @return ZipExtraField|null
|
157 |
+
*/
|
158 |
+
public function offsetGet($offset)
|
159 |
+
{
|
160 |
+
return isset($this->collection[$offset]) ? $this->collection[$offset] : null;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Offset to set.
|
165 |
+
*
|
166 |
+
* @see http://php.net/manual/en/arrayaccess.offsetset.php
|
167 |
+
*
|
168 |
+
* @param mixed $offset the offset to assign the value to
|
169 |
+
* @param ZipExtraField $value the value to set
|
170 |
+
*/
|
171 |
+
public function offsetSet($offset, $value)
|
172 |
+
{
|
173 |
+
if (!$value instanceof ZipExtraField) {
|
174 |
+
throw new \InvalidArgumentException('value is not instanceof ' . ZipExtraField::class);
|
175 |
+
}
|
176 |
+
$this->add($value);
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Offset to unset.
|
181 |
+
*
|
182 |
+
* @see http://php.net/manual/en/arrayaccess.offsetunset.php
|
183 |
+
*
|
184 |
+
* @param mixed $offset the offset to unset
|
185 |
+
*/
|
186 |
+
public function offsetUnset($offset)
|
187 |
+
{
|
188 |
+
$this->remove($offset);
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Return the current element.
|
193 |
+
*
|
194 |
+
* @see http://php.net/manual/en/iterator.current.php
|
195 |
+
*
|
196 |
+
* @return ZipExtraField
|
197 |
+
*/
|
198 |
+
public function current()
|
199 |
+
{
|
200 |
+
return current($this->collection);
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Move forward to next element.
|
205 |
+
*
|
206 |
+
* @see http://php.net/manual/en/iterator.next.php
|
207 |
+
*/
|
208 |
+
public function next()
|
209 |
+
{
|
210 |
+
next($this->collection);
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Return the key of the current element.
|
215 |
+
*
|
216 |
+
* @see http://php.net/manual/en/iterator.key.php
|
217 |
+
*
|
218 |
+
* @return int scalar on success, or null on failure
|
219 |
+
*/
|
220 |
+
public function key()
|
221 |
+
{
|
222 |
+
return key($this->collection);
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Checks if current position is valid.
|
227 |
+
*
|
228 |
+
* @see http://php.net/manual/en/iterator.valid.php
|
229 |
+
*
|
230 |
+
* @return bool The return value will be casted to boolean and then evaluated.
|
231 |
+
* Returns true on success or false on failure.
|
232 |
+
*/
|
233 |
+
public function valid()
|
234 |
+
{
|
235 |
+
return key($this->collection) !== null;
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Rewind the Iterator to the first element.
|
240 |
+
*
|
241 |
+
* @see http://php.net/manual/en/iterator.rewind.php
|
242 |
+
*/
|
243 |
+
public function rewind()
|
244 |
+
{
|
245 |
+
reset($this->collection);
|
246 |
+
}
|
247 |
+
|
248 |
+
public function clear()
|
249 |
+
{
|
250 |
+
$this->collection = [];
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* @return string
|
255 |
+
*/
|
256 |
+
public function __toString()
|
257 |
+
{
|
258 |
+
$formats = [];
|
259 |
+
|
260 |
+
foreach ($this->collection as $key => $value) {
|
261 |
+
$formats[] = (string) $value;
|
262 |
+
}
|
263 |
+
|
264 |
+
return implode("\n", $formats);
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* If clone extra fields.
|
269 |
+
*/
|
270 |
+
public function __clone()
|
271 |
+
{
|
272 |
+
foreach ($this->collection as $k => $v) {
|
273 |
+
$this->collection[$k] = clone $v;
|
274 |
+
}
|
275 |
+
}
|
276 |
+
}
|
library/vendor/nelexa/zip/src/Model/Extra/Fields/AbstractUnicodeExtraField.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Extra\Fields;
|
4 |
+
|
5 |
+
use PhpZip\Exception\ZipException;
|
6 |
+
use PhpZip\Model\Extra\ZipExtraField;
|
7 |
+
use PhpZip\Model\ZipEntry;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* A common base class for Unicode extra information extra fields.
|
11 |
+
*/
|
12 |
+
abstract class AbstractUnicodeExtraField implements ZipExtraField
|
13 |
+
{
|
14 |
+
const DEFAULT_VERSION = 0x01;
|
15 |
+
|
16 |
+
/** @var int */
|
17 |
+
private $crc32;
|
18 |
+
|
19 |
+
/** @var string */
|
20 |
+
private $unicodeValue;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @param int $crc32
|
24 |
+
* @param string $unicodeValue
|
25 |
+
*/
|
26 |
+
public function __construct($crc32, $unicodeValue)
|
27 |
+
{
|
28 |
+
$this->crc32 = (int) $crc32;
|
29 |
+
$this->unicodeValue = (string) $unicodeValue;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @return int the CRC32 checksum of the filename or comment as
|
34 |
+
* encoded in the central directory of the zip file
|
35 |
+
*/
|
36 |
+
public function getCrc32()
|
37 |
+
{
|
38 |
+
return $this->crc32;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @param int $crc32
|
43 |
+
*/
|
44 |
+
public function setCrc32($crc32)
|
45 |
+
{
|
46 |
+
$this->crc32 = (int) $crc32;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @return string
|
51 |
+
*/
|
52 |
+
public function getUnicodeValue()
|
53 |
+
{
|
54 |
+
return $this->unicodeValue;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @param string $unicodeValue the UTF-8 encoded name to set
|
59 |
+
*/
|
60 |
+
public function setUnicodeValue($unicodeValue)
|
61 |
+
{
|
62 |
+
$this->unicodeValue = $unicodeValue;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Populate data from this array as if it was in local file data.
|
67 |
+
*
|
68 |
+
* @param string $buffer the buffer to read data from
|
69 |
+
* @param ZipEntry|null $entry
|
70 |
+
*
|
71 |
+
* @throws ZipException on error
|
72 |
+
*
|
73 |
+
* @return static
|
74 |
+
*/
|
75 |
+
public static function unpackLocalFileData($buffer, ZipEntry $entry = null)
|
76 |
+
{
|
77 |
+
if (\strlen($buffer) < 5) {
|
78 |
+
throw new ZipException('Unicode path extra data must have at least 5 bytes.');
|
79 |
+
}
|
80 |
+
|
81 |
+
$data = unpack('Cversion/Vcrc32', $buffer);
|
82 |
+
|
83 |
+
if ($data['version'] !== self::DEFAULT_VERSION) {
|
84 |
+
throw new ZipException(sprintf('Unsupported version [%d] for Unicode path extra data.', $data['version']));
|
85 |
+
}
|
86 |
+
|
87 |
+
$unicodeValue = substr($buffer, 5);
|
88 |
+
|
89 |
+
return new static($data['crc32'], $unicodeValue);
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Populate data from this array as if it was in central directory data.
|
94 |
+
*
|
95 |
+
* @param string $buffer the buffer to read data from
|
96 |
+
* @param ZipEntry|null $entry
|
97 |
+
*
|
98 |
+
* @throws ZipException on error
|
99 |
+
*
|
100 |
+
* @return static
|
101 |
+
*/
|
102 |
+
public static function unpackCentralDirData($buffer, ZipEntry $entry = null)
|
103 |
+
{
|
104 |
+
return self::unpackLocalFileData($buffer, $entry);
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* The actual data to put into local file data - without Header-ID
|
109 |
+
* or length specifier.
|
110 |
+
*
|
111 |
+
* @return string the data
|
112 |
+
*/
|
113 |
+
public function packLocalFileData()
|
114 |
+
{
|
115 |
+
return pack(
|
116 |
+
'CV',
|
117 |
+
self::DEFAULT_VERSION,
|
118 |
+
$this->crc32
|
119 |
+
) .
|
120 |
+
$this->unicodeValue;
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* The actual data to put into central directory - without Header-ID or
|
125 |
+
* length specifier.
|
126 |
+
*
|
127 |
+
* @return string the data
|
128 |
+
*/
|
129 |
+
public function packCentralDirData()
|
130 |
+
{
|
131 |
+
return $this->packLocalFileData();
|
132 |
+
}
|
133 |
+
}
|
library/vendor/nelexa/zip/src/Model/Extra/Fields/ApkAlignmentExtraField.php
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Extra\Fields;
|
4 |
+
|
5 |
+
use PhpZip\Exception\ZipException;
|
6 |
+
use PhpZip\Model\Extra\ZipExtraField;
|
7 |
+
use PhpZip\Model\ZipEntry;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Apk Alignment Extra Field.
|
11 |
+
*
|
12 |
+
* @see https://android.googlesource.com/platform/tools/apksig/+/master/src/main/java/com/android/apksig/ApkSigner.java
|
13 |
+
* @see https://developer.android.com/studio/command-line/zipalign
|
14 |
+
*/
|
15 |
+
class ApkAlignmentExtraField implements ZipExtraField
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* @var int Extensible data block/field header ID used for storing
|
19 |
+
* information about alignment of uncompressed entries as
|
20 |
+
* well as for aligning the entries's data. See ZIP
|
21 |
+
* appnote.txt section 4.5 Extensible data fields.
|
22 |
+
*/
|
23 |
+
const HEADER_ID = 0xd935;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @var int minimum size (in bytes) of the extensible data block/field used
|
27 |
+
* for alignment of uncompressed entries
|
28 |
+
*/
|
29 |
+
const MIN_SIZE = 6;
|
30 |
+
|
31 |
+
/** @var int */
|
32 |
+
const ALIGNMENT_BYTES = 4;
|
33 |
+
|
34 |
+
/** @var int */
|
35 |
+
const COMMON_PAGE_ALIGNMENT_BYTES = 4096;
|
36 |
+
|
37 |
+
/** @var int */
|
38 |
+
private $multiple;
|
39 |
+
|
40 |
+
/** @var int */
|
41 |
+
private $padding;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @param int $multiple
|
45 |
+
* @param int $padding
|
46 |
+
*/
|
47 |
+
public function __construct($multiple, $padding)
|
48 |
+
{
|
49 |
+
$this->multiple = $multiple;
|
50 |
+
$this->padding = $padding;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Returns the Header ID (type) of this Extra Field.
|
55 |
+
* The Header ID is an unsigned short integer (two bytes)
|
56 |
+
* which must be constant during the life cycle of this object.
|
57 |
+
*
|
58 |
+
* @return int
|
59 |
+
*/
|
60 |
+
public function getHeaderId()
|
61 |
+
{
|
62 |
+
return self::HEADER_ID;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* @return int
|
67 |
+
*/
|
68 |
+
public function getMultiple()
|
69 |
+
{
|
70 |
+
return $this->multiple;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* @return int
|
75 |
+
*/
|
76 |
+
public function getPadding()
|
77 |
+
{
|
78 |
+
return $this->padding;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* @param int $multiple
|
83 |
+
*/
|
84 |
+
public function setMultiple($multiple)
|
85 |
+
{
|
86 |
+
$this->multiple = (int) $multiple;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @param int $padding
|
91 |
+
*/
|
92 |
+
public function setPadding($padding)
|
93 |
+
{
|
94 |
+
$this->padding = (int) $padding;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Populate data from this array as if it was in local file data.
|
99 |
+
*
|
100 |
+
* @param string $buffer the buffer to read data from
|
101 |
+
* @param ZipEntry|null $entry
|
102 |
+
*
|
103 |
+
* @throws ZipException
|
104 |
+
*
|
105 |
+
* @return ApkAlignmentExtraField
|
106 |
+
*/
|
107 |
+
public static function unpackLocalFileData($buffer, ZipEntry $entry = null)
|
108 |
+
{
|
109 |
+
$length = \strlen($buffer);
|
110 |
+
|
111 |
+
if ($length < 2) {
|
112 |
+
// This is APK alignment field.
|
113 |
+
// FORMAT:
|
114 |
+
// * uint16 alignment multiple (in bytes)
|
115 |
+
// * remaining bytes -- padding to achieve alignment of data which starts after
|
116 |
+
// the extra field
|
117 |
+
throw new ZipException(
|
118 |
+
'Minimum 6 bytes of the extensible data block/field used for alignment of uncompressed entries.'
|
119 |
+
);
|
120 |
+
}
|
121 |
+
$multiple = unpack('v', $buffer)[1];
|
122 |
+
$padding = $length - 2;
|
123 |
+
|
124 |
+
return new self($multiple, $padding);
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Populate data from this array as if it was in central directory data.
|
129 |
+
*
|
130 |
+
* @param string $buffer the buffer to read data from
|
131 |
+
* @param ZipEntry|null $entry
|
132 |
+
*
|
133 |
+
* @throws ZipException on error
|
134 |
+
*
|
135 |
+
* @return ApkAlignmentExtraField
|
136 |
+
*/
|
137 |
+
public static function unpackCentralDirData($buffer, ZipEntry $entry = null)
|
138 |
+
{
|
139 |
+
return self::unpackLocalFileData($buffer, $entry);
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* The actual data to put into local file data - without Header-ID
|
144 |
+
* or length specifier.
|
145 |
+
*
|
146 |
+
* @return string the data
|
147 |
+
*/
|
148 |
+
public function packLocalFileData()
|
149 |
+
{
|
150 |
+
return pack('vx' . $this->padding, $this->multiple);
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* The actual data to put into central directory - without Header-ID or
|
155 |
+
* length specifier.
|
156 |
+
*
|
157 |
+
* @return string the data
|
158 |
+
*/
|
159 |
+
public function packCentralDirData()
|
160 |
+
{
|
161 |
+
return $this->packLocalFileData();
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* @return string
|
166 |
+
*/
|
167 |
+
public function __toString()
|
168 |
+
{
|
169 |
+
return sprintf(
|
170 |
+
'0x%04x APK Alignment: Multiple=%d Padding=%d',
|
171 |
+
self::HEADER_ID,
|
172 |
+
$this->multiple,
|
173 |
+
$this->padding
|
174 |
+
);
|
175 |
+
}
|
176 |
+
}
|
library/vendor/nelexa/zip/src/Model/Extra/Fields/AsiExtraField.php
ADDED
@@ -0,0 +1,302 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Extra\Fields;
|
4 |
+
|
5 |
+
use PhpZip\Constants\UnixStat;
|
6 |
+
use PhpZip\Exception\Crc32Exception;
|
7 |
+
use PhpZip\Model\Extra\ZipExtraField;
|
8 |
+
use PhpZip\Model\ZipEntry;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* ASi Unix Extra Field:
|
12 |
+
* ====================.
|
13 |
+
*
|
14 |
+
* The following is the layout of the ASi extra block for Unix. The
|
15 |
+
* local-header and central-header versions are identical.
|
16 |
+
* (Last Revision 19960916)
|
17 |
+
*
|
18 |
+
* Value Size Description
|
19 |
+
* ----- ---- -----------
|
20 |
+
* (Unix3) 0x756e Short tag for this extra block type ("nu")
|
21 |
+
* TSize Short total data size for this block
|
22 |
+
* CRC Long CRC-32 of the remaining data
|
23 |
+
* Mode Short file permissions
|
24 |
+
* SizDev Long symlink'd size OR major/minor dev num
|
25 |
+
* UID Short user ID
|
26 |
+
* GID Short group ID
|
27 |
+
* (var.) variable symbolic link filename
|
28 |
+
*
|
29 |
+
* Mode is the standard Unix st_mode field from struct stat, containing
|
30 |
+
* user/group/other permissions, setuid/setgid and symlink info, etc.
|
31 |
+
*
|
32 |
+
* If Mode indicates that this file is a symbolic link, SizDev is the
|
33 |
+
* size of the file to which the link points. Otherwise, if the file
|
34 |
+
* is a device, SizDev contains the standard Unix st_rdev field from
|
35 |
+
* struct stat (includes the major and minor numbers of the device).
|
36 |
+
* SizDev is undefined in other cases.
|
37 |
+
*
|
38 |
+
* If Mode indicates that the file is a symbolic link, the final field
|
39 |
+
* will be the name of the file to which the link points. The file-
|
40 |
+
* name length can be inferred from TSize.
|
41 |
+
*
|
42 |
+
* [Note that TSize may incorrectly refer to the data size not counting
|
43 |
+
* the CRC; i.e., it may be four bytes too small.]
|
44 |
+
*
|
45 |
+
* @see ftp://ftp.info-zip.org/pub/infozip/doc/appnote-iz-latest.zip Info-ZIP version Specification
|
46 |
+
*/
|
47 |
+
class AsiExtraField implements ZipExtraField
|
48 |
+
{
|
49 |
+
/** @var int Header id */
|
50 |
+
const HEADER_ID = 0x756e;
|
51 |
+
|
52 |
+
const USER_GID_PID = 1000;
|
53 |
+
|
54 |
+
/** Bits used for permissions (and sticky bit). */
|
55 |
+
const PERM_MASK = 07777;
|
56 |
+
|
57 |
+
/** @var int Standard Unix stat(2) file mode. */
|
58 |
+
private $mode;
|
59 |
+
|
60 |
+
/** @var int User ID. */
|
61 |
+
private $uid;
|
62 |
+
|
63 |
+
/** @var int Group ID. */
|
64 |
+
private $gid;
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @var string File this entry points to, if it is a symbolic link.
|
68 |
+
* Empty string - if entry is not a symbolic link.
|
69 |
+
*/
|
70 |
+
private $link;
|
71 |
+
|
72 |
+
/**
|
73 |
+
* AsiExtraField constructor.
|
74 |
+
*
|
75 |
+
* @param int $mode
|
76 |
+
* @param int $uid
|
77 |
+
* @param int $gid
|
78 |
+
* @param string $link
|
79 |
+
*/
|
80 |
+
public function __construct($mode, $uid = self::USER_GID_PID, $gid = self::USER_GID_PID, $link = '')
|
81 |
+
{
|
82 |
+
$this->mode = $mode;
|
83 |
+
$this->uid = $uid;
|
84 |
+
$this->gid = $gid;
|
85 |
+
$this->link = $link;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Returns the Header ID (type) of this Extra Field.
|
90 |
+
* The Header ID is an unsigned short integer (two bytes)
|
91 |
+
* which must be constant during the life cycle of this object.
|
92 |
+
*
|
93 |
+
* @return int
|
94 |
+
*/
|
95 |
+
public function getHeaderId()
|
96 |
+
{
|
97 |
+
return self::HEADER_ID;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Populate data from this array as if it was in local file data.
|
102 |
+
*
|
103 |
+
* @param string $buffer the buffer to read data from
|
104 |
+
* @param ZipEntry|null $entry
|
105 |
+
*
|
106 |
+
* @throws Crc32Exception
|
107 |
+
*
|
108 |
+
* @return static
|
109 |
+
*/
|
110 |
+
public static function unpackLocalFileData($buffer, ZipEntry $entry = null)
|
111 |
+
{
|
112 |
+
$givenChecksum = unpack('V', $buffer)[1];
|
113 |
+
$buffer = substr($buffer, 4);
|
114 |
+
$realChecksum = crc32($buffer);
|
115 |
+
|
116 |
+
if ($givenChecksum !== $realChecksum) {
|
117 |
+
throw new Crc32Exception('Asi Unix Extra Filed Data', $givenChecksum, $realChecksum);
|
118 |
+
}
|
119 |
+
|
120 |
+
$data = unpack('vmode/VlinkSize/vuid/vgid', $buffer);
|
121 |
+
$link = '';
|
122 |
+
|
123 |
+
if ($data['linkSize'] > 0) {
|
124 |
+
$link = substr($buffer, 10);
|
125 |
+
}
|
126 |
+
|
127 |
+
return new self($data['mode'], $data['uid'], $data['gid'], $link);
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Populate data from this array as if it was in central directory data.
|
132 |
+
*
|
133 |
+
* @param string $buffer the buffer to read data from
|
134 |
+
* @param ZipEntry|null $entry
|
135 |
+
*
|
136 |
+
* @throws Crc32Exception
|
137 |
+
*
|
138 |
+
* @return AsiExtraField
|
139 |
+
*/
|
140 |
+
public static function unpackCentralDirData($buffer, ZipEntry $entry = null)
|
141 |
+
{
|
142 |
+
return self::unpackLocalFileData($buffer, $entry);
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* The actual data to put into local file data - without Header-ID
|
147 |
+
* or length specifier.
|
148 |
+
*
|
149 |
+
* @return string the data
|
150 |
+
*/
|
151 |
+
public function packLocalFileData()
|
152 |
+
{
|
153 |
+
$data = pack(
|
154 |
+
'vVvv',
|
155 |
+
$this->mode,
|
156 |
+
\strlen($this->link),
|
157 |
+
$this->uid,
|
158 |
+
$this->gid
|
159 |
+
) . $this->link;
|
160 |
+
|
161 |
+
return pack('V', crc32($data)) . $data;
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* The actual data to put into central directory - without Header-ID or
|
166 |
+
* length specifier.
|
167 |
+
*
|
168 |
+
* @return string the data
|
169 |
+
*/
|
170 |
+
public function packCentralDirData()
|
171 |
+
{
|
172 |
+
return $this->packLocalFileData();
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Name of linked file.
|
177 |
+
*
|
178 |
+
* @return string name of the file this entry links to if it is a
|
179 |
+
* symbolic link, the empty string otherwise
|
180 |
+
*/
|
181 |
+
public function getLink()
|
182 |
+
{
|
183 |
+
return $this->link;
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Indicate that this entry is a symbolic link to the given filename.
|
188 |
+
*
|
189 |
+
* @param string $link name of the file this entry links to, empty
|
190 |
+
* string if it is not a symbolic link
|
191 |
+
*/
|
192 |
+
public function setLink($link)
|
193 |
+
{
|
194 |
+
$this->link = (string) $link;
|
195 |
+
$this->mode = $this->getPermissionsMode($this->mode);
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Is this entry a symbolic link?
|
200 |
+
*
|
201 |
+
* @return bool true if this is a symbolic link
|
202 |
+
*/
|
203 |
+
public function isLink()
|
204 |
+
{
|
205 |
+
return !empty($this->link);
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Get the file mode for given permissions with the correct file type.
|
210 |
+
*
|
211 |
+
* @param int $mode the mode
|
212 |
+
*
|
213 |
+
* @return int the type with the mode
|
214 |
+
*/
|
215 |
+
protected function getPermissionsMode($mode)
|
216 |
+
{
|
217 |
+
$type = 0;
|
218 |
+
|
219 |
+
if ($this->isLink()) {
|
220 |
+
$type = UnixStat::UNX_IFLNK;
|
221 |
+
} elseif (($mode & UnixStat::UNX_IFREG) !== 0) {
|
222 |
+
$type = UnixStat::UNX_IFREG;
|
223 |
+
} elseif (($mode & UnixStat::UNX_IFDIR) !== 0) {
|
224 |
+
$type = UnixStat::UNX_IFDIR;
|
225 |
+
}
|
226 |
+
|
227 |
+
return $type | ($mode & self::PERM_MASK);
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Is this entry a directory?
|
232 |
+
*
|
233 |
+
* @return bool true if this entry is a directory
|
234 |
+
*/
|
235 |
+
public function isDirectory()
|
236 |
+
{
|
237 |
+
return ($this->mode & UnixStat::UNX_IFDIR) !== 0 && !$this->isLink();
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* @return int
|
242 |
+
*/
|
243 |
+
public function getMode()
|
244 |
+
{
|
245 |
+
return $this->mode;
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* @param int $mode
|
250 |
+
*/
|
251 |
+
public function setMode($mode)
|
252 |
+
{
|
253 |
+
$this->mode = $this->getPermissionsMode($mode);
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* @return int
|
258 |
+
*/
|
259 |
+
public function getUserId()
|
260 |
+
{
|
261 |
+
return $this->uid;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* @param int $uid
|
266 |
+
*/
|
267 |
+
public function setUserId($uid)
|
268 |
+
{
|
269 |
+
$this->uid = (int) $uid;
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* @return int
|
274 |
+
*/
|
275 |
+
public function getGroupId()
|
276 |
+
{
|
277 |
+
return $this->gid;
|
278 |
+
}
|
279 |
+
|
280 |
+
/**
|
281 |
+
* @param int $gid
|
282 |
+
*/
|
283 |
+
public function setGroupId($gid)
|
284 |
+
{
|
285 |
+
$this->gid = (int) $gid;
|
286 |
+
}
|
287 |
+
|
288 |
+
/**
|
289 |
+
* @return string
|
290 |
+
*/
|
291 |
+
public function __toString()
|
292 |
+
{
|
293 |
+
return sprintf(
|
294 |
+
'0x%04x ASI: Mode=%o UID=%d GID=%d Link="%s',
|
295 |
+
self::HEADER_ID,
|
296 |
+
$this->mode,
|
297 |
+
$this->uid,
|
298 |
+
$this->gid,
|
299 |
+
$this->link
|
300 |
+
);
|
301 |
+
}
|
302 |
+
}
|
library/vendor/nelexa/zip/src/Model/Extra/Fields/ExtendedTimestampExtraField.php
ADDED
@@ -0,0 +1,446 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Extra\Fields;
|
4 |
+
|
5 |
+
use PhpZip\Model\Extra\ZipExtraField;
|
6 |
+
use PhpZip\Model\ZipEntry;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Extended Timestamp Extra Field:
|
10 |
+
* ==============================.
|
11 |
+
*
|
12 |
+
* The following is the layout of the extended-timestamp extra block.
|
13 |
+
* (Last Revision 19970118)
|
14 |
+
*
|
15 |
+
* Local-header version:
|
16 |
+
*
|
17 |
+
* Value Size Description
|
18 |
+
* ----- ---- -----------
|
19 |
+
* (time) 0x5455 Short tag for this extra block type ("UT")
|
20 |
+
* TSize Short total data size for this block
|
21 |
+
* Flags Byte info bits
|
22 |
+
* (ModTime) Long time of last modification (UTC/GMT)
|
23 |
+
* (AcTime) Long time of last access (UTC/GMT)
|
24 |
+
* (CrTime) Long time of original creation (UTC/GMT)
|
25 |
+
*
|
26 |
+
* Central-header version:
|
27 |
+
*
|
28 |
+
* Value Size Description
|
29 |
+
* ----- ---- -----------
|
30 |
+
* (time) 0x5455 Short tag for this extra block type ("UT")
|
31 |
+
* TSize Short total data size for this block
|
32 |
+
* Flags Byte info bits (refers to local header!)
|
33 |
+
* (ModTime) Long time of last modification (UTC/GMT)
|
34 |
+
*
|
35 |
+
* The central-header extra field contains the modification time only,
|
36 |
+
* or no timestamp at all. TSize is used to flag its presence or
|
37 |
+
* absence. But note:
|
38 |
+
*
|
39 |
+
* If "Flags" indicates that Modtime is present in the local header
|
40 |
+
* field, it MUST be present in the central header field, too!
|
41 |
+
* This correspondence is required because the modification time
|
42 |
+
* value may be used to support trans-timezone freshening and
|
43 |
+
* updating operations with zip archives.
|
44 |
+
*
|
45 |
+
* The time values are in standard Unix signed-long format, indicating
|
46 |
+
* the number of seconds since 1 January 1970 00:00:00. The times
|
47 |
+
* are relative to Coordinated Universal Time (UTC), also sometimes
|
48 |
+
* referred to as Greenwich Mean Time (GMT). To convert to local time,
|
49 |
+
* the software must know the local timezone offset from UTC/GMT.
|
50 |
+
*
|
51 |
+
* The lower three bits of Flags in both headers indicate which time-
|
52 |
+
* stamps are present in the LOCAL extra field:
|
53 |
+
*
|
54 |
+
* bit 0 if set, modification time is present
|
55 |
+
* bit 1 if set, access time is present
|
56 |
+
* bit 2 if set, creation time is present
|
57 |
+
* bits 3-7 reserved for additional timestamps; not set
|
58 |
+
*
|
59 |
+
* Those times that are present will appear in the order indicated, but
|
60 |
+
* any combination of times may be omitted. (Creation time may be
|
61 |
+
* present without access time, for example.) TSize should equal
|
62 |
+
* (1 + 4*(number of set bits in Flags)), as the block is currently
|
63 |
+
* defined. Other timestamps may be added in the future.
|
64 |
+
*
|
65 |
+
* @see ftp://ftp.info-zip.org/pub/infozip/doc/appnote-iz-latest.zip Info-ZIP version Specification
|
66 |
+
*/
|
67 |
+
class ExtendedTimestampExtraField implements ZipExtraField
|
68 |
+
{
|
69 |
+
/** @var int Header id */
|
70 |
+
const HEADER_ID = 0x5455;
|
71 |
+
|
72 |
+
/**
|
73 |
+
* @var int the bit set inside the flags by when the last modification time
|
74 |
+
* is present in this extra field
|
75 |
+
*/
|
76 |
+
const MODIFY_TIME_BIT = 1;
|
77 |
+
|
78 |
+
/**
|
79 |
+
* @var int the bit set inside the flags by when the last access time is
|
80 |
+
* present in this extra field
|
81 |
+
*/
|
82 |
+
const ACCESS_TIME_BIT = 2;
|
83 |
+
|
84 |
+
/**
|
85 |
+
* @var int the bit set inside the flags by when the original creation time
|
86 |
+
* is present in this extra field
|
87 |
+
*/
|
88 |
+
const CREATE_TIME_BIT = 4;
|
89 |
+
|
90 |
+
/**
|
91 |
+
* @var int The 3 boolean fields (below) come from this flags byte. The remaining 5 bits
|
92 |
+
* are ignored according to the current version of the spec (December 2012).
|
93 |
+
*/
|
94 |
+
private $flags;
|
95 |
+
|
96 |
+
/** @var int|null Modify time */
|
97 |
+
private $modifyTime;
|
98 |
+
|
99 |
+
/** @var int|null Access time */
|
100 |
+
private $accessTime;
|
101 |
+
|
102 |
+
/** @var int|null Create time */
|
103 |
+
private $createTime;
|
104 |
+
|
105 |
+
/**
|
106 |
+
* @param int $flags
|
107 |
+
* @param int|null $modifyTime
|
108 |
+
* @param int|null $accessTime
|
109 |
+
* @param int|null $createTime
|
110 |
+
*/
|
111 |
+
public function __construct($flags, $modifyTime, $accessTime, $createTime)
|
112 |
+
{
|
113 |
+
$this->flags = (int) $flags;
|
114 |
+
$this->modifyTime = $modifyTime;
|
115 |
+
$this->accessTime = $accessTime;
|
116 |
+
$this->createTime = $createTime;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* @param int|null $modifyTime
|
121 |
+
* @param int|null $accessTime
|
122 |
+
* @param int|null $createTime
|
123 |
+
*
|
124 |
+
* @return ExtendedTimestampExtraField
|
125 |
+
*/
|
126 |
+
public static function create($modifyTime, $accessTime, $createTime)
|
127 |
+
{
|
128 |
+
$flags = 0;
|
129 |
+
|
130 |
+
if ($modifyTime !== null) {
|
131 |
+
$modifyTime = (int) $modifyTime;
|
132 |
+
$flags |= self::MODIFY_TIME_BIT;
|
133 |
+
}
|
134 |
+
|
135 |
+
if ($accessTime !== null) {
|
136 |
+
$accessTime = (int) $accessTime;
|
137 |
+
$flags |= self::ACCESS_TIME_BIT;
|
138 |
+
}
|
139 |
+
|
140 |
+
if ($createTime !== null) {
|
141 |
+
$createTime = (int) $createTime;
|
142 |
+
$flags |= self::CREATE_TIME_BIT;
|
143 |
+
}
|
144 |
+
|
145 |
+
return new self($flags, $modifyTime, $accessTime, $createTime);
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Returns the Header ID (type) of this Extra Field.
|
150 |
+
* The Header ID is an unsigned short integer (two bytes)
|
151 |
+
* which must be constant during the life cycle of this object.
|
152 |
+
*
|
153 |
+
* @return int
|
154 |
+
*/
|
155 |
+
public function getHeaderId()
|
156 |
+
{
|
157 |
+
return self::HEADER_ID;
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Populate data from this array as if it was in local file data.
|
162 |
+
*
|
163 |
+
* @param string $buffer the buffer to read data from
|
164 |
+
* @param ZipEntry|null $entry
|
165 |
+
*
|
166 |
+
* @return ExtendedTimestampExtraField
|
167 |
+
*/
|
168 |
+
public static function unpackLocalFileData($buffer, ZipEntry $entry = null)
|
169 |
+
{
|
170 |
+
$length = \strlen($buffer);
|
171 |
+
$flags = unpack('C', $buffer)[1];
|
172 |
+
$offset = 1;
|
173 |
+
|
174 |
+
$modifyTime = null;
|
175 |
+
$accessTime = null;
|
176 |
+
$createTime = null;
|
177 |
+
|
178 |
+
if (($flags & self::MODIFY_TIME_BIT) === self::MODIFY_TIME_BIT) {
|
179 |
+
$modifyTime = unpack('V', substr($buffer, $offset, 4))[1];
|
180 |
+
$offset += 4;
|
181 |
+
}
|
182 |
+
|
183 |
+
// Notice the extra length check in case we are parsing the shorter
|
184 |
+
// central data field (for both access and create timestamps).
|
185 |
+
if ((($flags & self::ACCESS_TIME_BIT) === self::ACCESS_TIME_BIT) && $offset + 4 <= $length) {
|
186 |
+
$accessTime = unpack('V', substr($buffer, $offset, 4))[1];
|
187 |
+
$offset += 4;
|
188 |
+
}
|
189 |
+
|
190 |
+
if ((($flags & self::CREATE_TIME_BIT) === self::CREATE_TIME_BIT) && $offset + 4 <= $length) {
|
191 |
+
$createTime = unpack('V', substr($buffer, $offset, 4))[1];
|
192 |
+
}
|
193 |
+
|
194 |
+
return new self($flags, $modifyTime, $accessTime, $createTime);
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Populate data from this array as if it was in central directory data.
|
199 |
+
*
|
200 |
+
* @param string $buffer the buffer to read data from
|
201 |
+
* @param ZipEntry|null $entry
|
202 |
+
*
|
203 |
+
* @return ExtendedTimestampExtraField
|
204 |
+
*/
|
205 |
+
public static function unpackCentralDirData($buffer, ZipEntry $entry = null)
|
206 |
+
{
|
207 |
+
return self::unpackLocalFileData($buffer, $entry);
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* The actual data to put into local file data - without Header-ID
|
212 |
+
* or length specifier.
|
213 |
+
*
|
214 |
+
* @return string the data
|
215 |
+
*/
|
216 |
+
public function packLocalFileData()
|
217 |
+
{
|
218 |
+
$data = '';
|
219 |
+
|
220 |
+
if (($this->flags & self::MODIFY_TIME_BIT) === self::MODIFY_TIME_BIT && $this->modifyTime !== null) {
|
221 |
+
$data .= pack('V', $this->modifyTime);
|
222 |
+
}
|
223 |
+
|
224 |
+
if (($this->flags & self::ACCESS_TIME_BIT) === self::ACCESS_TIME_BIT && $this->accessTime !== null) {
|
225 |
+
$data .= pack('V', $this->accessTime);
|
226 |
+
}
|
227 |
+
|
228 |
+
if (($this->flags & self::CREATE_TIME_BIT) === self::CREATE_TIME_BIT && $this->createTime !== null) {
|
229 |
+
$data .= pack('V', $this->createTime);
|
230 |
+
}
|
231 |
+
|
232 |
+
return pack('C', $this->flags) . $data;
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* The actual data to put into central directory - without Header-ID or
|
237 |
+
* length specifier.
|
238 |
+
*
|
239 |
+
* Note: even if bit1 and bit2 are set, the Central data will still
|
240 |
+
* not contain access/create fields: only local data ever holds those!
|
241 |
+
*
|
242 |
+
* @return string the data
|
243 |
+
*/
|
244 |
+
public function packCentralDirData()
|
245 |
+
{
|
246 |
+
$cdLength = 1 + ($this->modifyTime !== null ? 4 : 0);
|
247 |
+
|
248 |
+
return substr($this->packLocalFileData(), 0, $cdLength);
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Gets flags byte.
|
253 |
+
*
|
254 |
+
* The flags byte tells us which of the three datestamp fields are
|
255 |
+
* present in the data:
|
256 |
+
* bit0 - modify time
|
257 |
+
* bit1 - access time
|
258 |
+
* bit2 - create time
|
259 |
+
*
|
260 |
+
* Only first 3 bits of flags are used according to the
|
261 |
+
* latest version of the spec (December 2012).
|
262 |
+
*
|
263 |
+
* @return int flags byte indicating which of the
|
264 |
+
* three datestamp fields are present
|
265 |
+
*/
|
266 |
+
public function getFlags()
|
267 |
+
{
|
268 |
+
return $this->flags;
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Returns the modify time (seconds since epoch) of this zip entry,
|
273 |
+
* or null if no such timestamp exists in the zip entry.
|
274 |
+
*
|
275 |
+
* @return int|null modify time (seconds since epoch) or null
|
276 |
+
*/
|
277 |
+
public function getModifyTime()
|
278 |
+
{
|
279 |
+
return $this->modifyTime;
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Returns the access time (seconds since epoch) of this zip entry,
|
284 |
+
* or null if no such timestamp exists in the zip entry.
|
285 |
+
*
|
286 |
+
* @return int|null access time (seconds since epoch) or null
|
287 |
+
*/
|
288 |
+
public function getAccessTime()
|
289 |
+
{
|
290 |
+
return $this->accessTime;
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Returns the create time (seconds since epoch) of this zip entry,
|
295 |
+
* or null if no such timestamp exists in the zip entry.
|
296 |
+
*
|
297 |
+
* Note: modern linux file systems (e.g., ext2)
|
298 |
+
* do not appear to store a "create time" value, and so
|
299 |
+
* it's usually omitted altogether in the zip extra
|
300 |
+
* field. Perhaps other unix systems track this.
|
301 |
+
*
|
302 |
+
* @return int|null create time (seconds since epoch) or null
|
303 |
+
*/
|
304 |
+
public function getCreateTime()
|
305 |
+
{
|
306 |
+
return $this->createTime;
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Returns the modify time as a \DateTimeInterface
|
311 |
+
* of this zip entry, or null if no such timestamp exists in the zip entry.
|
312 |
+
* The milliseconds are always zeroed out, since the underlying data
|
313 |
+
* offers only per-second precision.
|
314 |
+
*
|
315 |
+
* @return \DateTimeInterface|null modify time as \DateTimeInterface or null
|
316 |
+
*/
|
317 |
+
public function getModifyDateTime()
|
318 |
+
{
|
319 |
+
return self::timestampToDateTime($this->modifyTime);
|
320 |
+
}
|
321 |
+
|
322 |
+
/**
|
323 |
+
* Returns the access time as a \DateTimeInterface
|
324 |
+
* of this zip entry, or null if no such timestamp exists in the zip entry.
|
325 |
+
* The milliseconds are always zeroed out, since the underlying data
|
326 |
+
* offers only per-second precision.
|
327 |
+
*
|
328 |
+
* @return \DateTimeInterface|null access time as \DateTimeInterface or null
|
329 |
+
*/
|
330 |
+
public function getAccessDateTime()
|
331 |
+
{
|
332 |
+
return self::timestampToDateTime($this->accessTime);
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* Returns the create time as a a \DateTimeInterface
|
337 |
+
* of this zip entry, or null if no such timestamp exists in the zip entry.
|
338 |
+
* The milliseconds are always zeroed out, since the underlying data
|
339 |
+
* offers only per-second precision.
|
340 |
+
*
|
341 |
+
* Note: modern linux file systems (e.g., ext2)
|
342 |
+
* do not appear to store a "create time" value, and so
|
343 |
+
* it's usually omitted altogether in the zip extra
|
344 |
+
* field. Perhaps other unix systems track $this->.
|
345 |
+
*
|
346 |
+
* @return \DateTimeInterface|null create time as \DateTimeInterface or null
|
347 |
+
*/
|
348 |
+
public function getCreateDateTime()
|
349 |
+
{
|
350 |
+
return self::timestampToDateTime($this->createTime);
|
351 |
+
}
|
352 |
+
|
353 |
+
/**
|
354 |
+
* Sets the modify time (seconds since epoch) of this zip entry
|
355 |
+
* using a integer.
|
356 |
+
*
|
357 |
+
* @param int|null $unixTime unix time of the modify time (seconds per epoch) or null
|
358 |
+
*/
|
359 |
+
public function setModifyTime($unixTime)
|
360 |
+
{
|
361 |
+
$this->modifyTime = $unixTime;
|
362 |
+
$this->updateFlags();
|
363 |
+
}
|
364 |
+
|
365 |
+
private function updateFlags()
|
366 |
+
{
|
367 |
+
$flags = 0;
|
368 |
+
|
369 |
+
if ($this->modifyTime !== null) {
|
370 |
+
$flags |= self::MODIFY_TIME_BIT;
|
371 |
+
}
|
372 |
+
|
373 |
+
if ($this->accessTime !== null) {
|
374 |
+
$flags |= self::ACCESS_TIME_BIT;
|
375 |
+
}
|
376 |
+
|
377 |
+
if ($this->createTime !== null) {
|
378 |
+
$flags |= self::CREATE_TIME_BIT;
|
379 |
+
}
|
380 |
+
$this->flags = $flags;
|
381 |
+
}
|
382 |
+
|
383 |
+
/**
|
384 |
+
* Sets the access time (seconds since epoch) of this zip entry
|
385 |
+
* using a integer.
|
386 |
+
*
|
387 |
+
* @param int|null $unixTime Unix time of the access time (seconds per epoch) or null
|
388 |
+
*/
|
389 |
+
public function setAccessTime($unixTime)
|
390 |
+
{
|
391 |
+
$this->accessTime = $unixTime;
|
392 |
+
$this->updateFlags();
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Sets the create time (seconds since epoch) of this zip entry
|
397 |
+
* using a integer.
|
398 |
+
*
|
399 |
+
* @param int|null $unixTime Unix time of the create time (seconds per epoch) or null
|
400 |
+
*/
|
401 |
+
public function setCreateTime($unixTime)
|
402 |
+
{
|
403 |
+
$this->createTime = $unixTime;
|
404 |
+
$this->updateFlags();
|
405 |
+
}
|
406 |
+
|
407 |
+
/**
|
408 |
+
* @param int|null $timestamp
|
409 |
+
*
|
410 |
+
* @return \DateTimeInterface|null
|
411 |
+
*/
|
412 |
+
private static function timestampToDateTime($timestamp)
|
413 |
+
{
|
414 |
+
try {
|
415 |
+
return $timestamp !== null ? new \DateTimeImmutable('@' . $timestamp) : null;
|
416 |
+
} catch (\Exception $e) {
|
417 |
+
return null;
|
418 |
+
}
|
419 |
+
}
|
420 |
+
|
421 |
+
/**
|
422 |
+
* @return string
|
423 |
+
*/
|
424 |
+
public function __toString()
|
425 |
+
{
|
426 |
+
$args = [self::HEADER_ID];
|
427 |
+
$format = '0x%04x ExtendedTimestamp:';
|
428 |
+
|
429 |
+
if ($this->modifyTime !== null) {
|
430 |
+
$format .= ' Modify:[%s]';
|
431 |
+
$args[] = date(\DATE_W3C, $this->modifyTime);
|
432 |
+
}
|
433 |
+
|
434 |
+
if ($this->accessTime !== null) {
|
435 |
+
$format .= ' Access:[%s]';
|
436 |
+
$args[] = date(\DATE_W3C, $this->accessTime);
|
437 |
+
}
|
438 |
+
|
439 |
+
if ($this->createTime !== null) {
|
440 |
+
$format .= ' Create:[%s]';
|
441 |
+
$args[] = date(\DATE_W3C, $this->createTime);
|
442 |
+
}
|
443 |
+
|
444 |
+
return vsprintf($format, $args);
|
445 |
+
}
|
446 |
+
}
|
library/vendor/nelexa/zip/src/Model/Extra/Fields/JarMarkerExtraField.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Extra\Fields;
|
4 |
+
|
5 |
+
use PhpZip\Exception\ZipException;
|
6 |
+
use PhpZip\Model\Extra\ZipExtraField;
|
7 |
+
use PhpZip\Model\ZipContainer;
|
8 |
+
use PhpZip\Model\ZipEntry;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Jar Marker Extra Field.
|
12 |
+
* An executable Java program can be packaged in a JAR file with all the libraries it uses.
|
13 |
+
* Executable JAR files can easily be distinguished from the files packed in the JAR file
|
14 |
+
* by the extra field in the first file, which is hexadecimal in the 0xCAFE bytes series.
|
15 |
+
* If this extra field is added as the very first extra field of
|
16 |
+
* the archive, Solaris will consider it an executable jar file.
|
17 |
+
*
|
18 |
+
* @license MIT
|
19 |
+
*/
|
20 |
+
class JarMarkerExtraField implements ZipExtraField
|
21 |
+
{
|
22 |
+
/** @var int Header id. */
|
23 |
+
const HEADER_ID = 0xCAFE;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @param ZipContainer $container
|
27 |
+
*/
|
28 |
+
public static function setJarMarker(ZipContainer $container)
|
29 |
+
{
|
30 |
+
$zipEntries = $container->getEntries();
|
31 |
+
|
32 |
+
if (!empty($zipEntries)) {
|
33 |
+
foreach ($zipEntries as $zipEntry) {
|
34 |
+
$zipEntry->removeExtraField(self::HEADER_ID);
|
35 |
+
}
|
36 |
+
// set jar execute bit
|
37 |
+
reset($zipEntries);
|
38 |
+
$zipEntry = current($zipEntries);
|
39 |
+
$zipEntry->getCdExtraFields()[] = new self();
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns the Header ID (type) of this Extra Field.
|
45 |
+
* The Header ID is an unsigned short integer (two bytes)
|
46 |
+
* which must be constant during the life cycle of this object.
|
47 |
+
*
|
48 |
+
* @return int
|
49 |
+
*/
|
50 |
+
public function getHeaderId()
|
51 |
+
{
|
52 |
+
return self::HEADER_ID;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* The actual data to put into local file data - without Header-ID
|
57 |
+
* or length specifier.
|
58 |
+
*
|
59 |
+
* @return string the data
|
60 |
+
*/
|
61 |
+
public function packLocalFileData()
|
62 |
+
{
|
63 |
+
return '';
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* The actual data to put into central directory - without Header-ID or
|
68 |
+
* length specifier.
|
69 |
+
*
|
70 |
+
* @return string the data
|
71 |
+
*/
|
72 |
+
public function packCentralDirData()
|
73 |
+
{
|
74 |
+
return '';
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Populate data from this array as if it was in local file data.
|
79 |
+
*
|
80 |
+
* @param string $buffer the buffer to read data from
|
81 |
+
* @param ZipEntry|null $entry
|
82 |
+
*
|
83 |
+
* @throws ZipException on error
|
84 |
+
*
|
85 |
+
* @return JarMarkerExtraField
|
86 |
+
*/
|
87 |
+
public static function unpackLocalFileData($buffer, ZipEntry $entry = null)
|
88 |
+
{
|
89 |
+
if (!empty($buffer)) {
|
90 |
+
throw new ZipException("JarMarker doesn't expect any data");
|
91 |
+
}
|
92 |
+
|
93 |
+
return new self();
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Populate data from this array as if it was in central directory data.
|
98 |
+
*
|
99 |
+
* @param string $buffer the buffer to read data from
|
100 |
+
* @param ZipEntry|null $entry
|
101 |
+
*
|
102 |
+
* @throws ZipException on error
|
103 |
+
*
|
104 |
+
* @return JarMarkerExtraField
|
105 |
+
*/
|
106 |
+
public static function unpackCentralDirData($buffer, ZipEntry $entry = null)
|
107 |
+
{
|
108 |
+
return self::unpackLocalFileData($buffer, $entry);
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* @return string
|
113 |
+
*/
|
114 |
+
public function __toString()
|
115 |
+
{
|
116 |
+
return sprintf('0x%04x Jar Marker', self::HEADER_ID);
|
117 |
+
}
|
118 |
+
}
|
library/vendor/nelexa/zip/src/Model/Extra/Fields/NewUnixExtraField.php
ADDED
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Extra\Fields;
|
4 |
+
|
5 |
+
use PhpZip\Exception\ZipException;
|
6 |
+
use PhpZip\Model\Extra\ZipExtraField;
|
7 |
+
use PhpZip\Model\ZipEntry;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Info-ZIP New Unix Extra Field:
|
11 |
+
* ====================================.
|
12 |
+
*
|
13 |
+
* Currently stores Unix UIDs/GIDs up to 32 bits.
|
14 |
+
* (Last Revision 20080509)
|
15 |
+
*
|
16 |
+
* Value Size Description
|
17 |
+
* ----- ---- -----------
|
18 |
+
* (UnixN) 0x7875 Short tag for this extra block type ("ux")
|
19 |
+
* TSize Short total data size for this block
|
20 |
+
* Version 1 byte version of this extra field, currently 1
|
21 |
+
* UIDSize 1 byte Size of UID field
|
22 |
+
* UID Variable UID for this entry
|
23 |
+
* GIDSize 1 byte Size of GID field
|
24 |
+
* GID Variable GID for this entry
|
25 |
+
*
|
26 |
+
* Currently Version is set to the number 1. If there is a need
|
27 |
+
* to change this field, the version will be incremented. Changes
|
28 |
+
* may not be backward compatible so this extra field should not be
|
29 |
+
* used if the version is not recognized.
|
30 |
+
*
|
31 |
+
* UIDSize is the size of the UID field in bytes. This size should
|
32 |
+
* match the size of the UID field on the target OS.
|
33 |
+
*
|
34 |
+
* UID is the UID for this entry in standard little endian format.
|
35 |
+
*
|
36 |
+
* GIDSize is the size of the GID field in bytes. This size should
|
37 |
+
* match the size of the GID field on the target OS.
|
38 |
+
*
|
39 |
+
* GID is the GID for this entry in standard little endian format.
|
40 |
+
*
|
41 |
+
* If both the old 16-bit Unix extra field (tag 0x7855, Info-ZIP Unix)
|
42 |
+
* and this extra field are present, the values in this extra field
|
43 |
+
* supercede the values in that extra field.
|
44 |
+
*/
|
45 |
+
class NewUnixExtraField implements ZipExtraField
|
46 |
+
{
|
47 |
+
/** @var int header id */
|
48 |
+
const HEADER_ID = 0x7875;
|
49 |
+
|
50 |
+
/** ID of the first non-root user created on a unix system. */
|
51 |
+
const USER_GID_PID = 1000;
|
52 |
+
|
53 |
+
/** @var int version of this extra field, currently 1 */
|
54 |
+
private $version = 1;
|
55 |
+
|
56 |
+
/** @var int User id */
|
57 |
+
private $uid;
|
58 |
+
|
59 |
+
/** @var int Group id */
|
60 |
+
private $gid;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* NewUnixExtraField constructor.
|
64 |
+
*
|
65 |
+
* @param int $version
|
66 |
+
* @param int $uid
|
67 |
+
* @param int $gid
|
68 |
+
*/
|
69 |
+
public function __construct($version = 1, $uid = self::USER_GID_PID, $gid = self::USER_GID_PID)
|
70 |
+
{
|
71 |
+
$this->version = (int) $version;
|
72 |
+
$this->uid = (int) $uid;
|
73 |
+
$this->gid = (int) $gid;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Returns the Header ID (type) of this Extra Field.
|
78 |
+
* The Header ID is an unsigned short integer (two bytes)
|
79 |
+
* which must be constant during the life cycle of this object.
|
80 |
+
*
|
81 |
+
* @return int
|
82 |
+
*/
|
83 |
+
public function getHeaderId()
|
84 |
+
{
|
85 |
+
return self::HEADER_ID;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Populate data from this array as if it was in local file data.
|
90 |
+
*
|
91 |
+
* @param string $buffer the buffer to read data from
|
92 |
+
* @param ZipEntry|null $entry
|
93 |
+
*
|
94 |
+
* @throws ZipException
|
95 |
+
*
|
96 |
+
* @return NewUnixExtraField
|
97 |
+
*/
|
98 |
+
public static function unpackLocalFileData($buffer, ZipEntry $entry = null)
|
99 |
+
{
|
100 |
+
$length = \strlen($buffer);
|
101 |
+
|
102 |
+
if ($length < 3) {
|
103 |
+
throw new ZipException(sprintf('X7875_NewUnix length is too short, only %s bytes', $length));
|
104 |
+
}
|
105 |
+
$offset = 0;
|
106 |
+
$data = unpack('Cversion/CuidSize', $buffer);
|
107 |
+
$offset += 2;
|
108 |
+
$uidSize = $data['uidSize'];
|
109 |
+
$gid = self::readSizeIntegerLE(substr($buffer, $offset, $uidSize), $uidSize);
|
110 |
+
$offset += $uidSize;
|
111 |
+
$gidSize = unpack('C', $buffer[$offset])[1];
|
112 |
+
$offset++;
|
113 |
+
$uid = self::readSizeIntegerLE(substr($buffer, $offset, $gidSize), $gidSize);
|
114 |
+
|
115 |
+
return new self($data['version'], $gid, $uid);
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Populate data from this array as if it was in central directory data.
|
120 |
+
*
|
121 |
+
* @param string $buffer the buffer to read data from
|
122 |
+
* @param ZipEntry|null $entry
|
123 |
+
*
|
124 |
+
* @throws ZipException
|
125 |
+
*
|
126 |
+
* @return NewUnixExtraField
|
127 |
+
*/
|
128 |
+
public static function unpackCentralDirData($buffer, ZipEntry $entry = null)
|
129 |
+
{
|
130 |
+
return self::unpackLocalFileData($buffer, $entry);
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* The actual data to put into local file data - without Header-ID
|
135 |
+
* or length specifier.
|
136 |
+
*
|
137 |
+
* @return string the data
|
138 |
+
*/
|
139 |
+
public function packLocalFileData()
|
140 |
+
{
|
141 |
+
return pack(
|
142 |
+
'CCVCV',
|
143 |
+
$this->version,
|
144 |
+
4, // UIDSize
|
145 |
+
$this->uid,
|
146 |
+
4, // GIDSize
|
147 |
+
$this->gid
|
148 |
+
);
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* The actual data to put into central directory - without Header-ID or
|
153 |
+
* length specifier.
|
154 |
+
*
|
155 |
+
* @return string the data
|
156 |
+
*/
|
157 |
+
public function packCentralDirData()
|
158 |
+
{
|
159 |
+
return $this->packLocalFileData();
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* @param string $data
|
164 |
+
* @param int $size
|
165 |
+
*
|
166 |
+
* @throws ZipException
|
167 |
+
*
|
168 |
+
* @return int
|
169 |
+
*/
|
170 |
+
private static function readSizeIntegerLE($data, $size)
|
171 |
+
{
|
172 |
+
$format = [
|
173 |
+
1 => 'C', // unsigned byte
|
174 |
+
2 => 'v', // unsigned short LE
|
175 |
+
4 => 'V', // unsigned int LE
|
176 |
+
];
|
177 |
+
|
178 |
+
if (!isset($format[$size])) {
|
179 |
+
throw new ZipException(sprintf('Invalid size bytes: %d', $size));
|
180 |
+
}
|
181 |
+
|
182 |
+
return unpack($format[$size], $data)[1];
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* @return int
|
187 |
+
*/
|
188 |
+
public function getUid()
|
189 |
+
{
|
190 |
+
return $this->uid;
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* @param int $uid
|
195 |
+
*/
|
196 |
+
public function setUid($uid)
|
197 |
+
{
|
198 |
+
$this->uid = $uid & 0xffffffff;
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* @return int
|
203 |
+
*/
|
204 |
+
public function getGid()
|
205 |
+
{
|
206 |
+
return $this->gid;
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* @param int $gid
|
211 |
+
*/
|
212 |
+
public function setGid($gid)
|
213 |
+
{
|
214 |
+
$this->gid = $gid & 0xffffffff;
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* @return int
|
219 |
+
*/
|
220 |
+
public function getVersion()
|
221 |
+
{
|
222 |
+
return $this->version;
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* @return string
|
227 |
+
*/
|
228 |
+
public function __toString()
|
229 |
+
{
|
230 |
+
return sprintf(
|
231 |
+
'0x%04x NewUnix: UID=%d GID=%d',
|
232 |
+
self::HEADER_ID,
|
233 |
+
$this->uid,
|
234 |
+
$this->gid
|
235 |
+
);
|
236 |
+
}
|
237 |
+
}
|
library/vendor/nelexa/zip/src/Model/Extra/Fields/NtfsExtraField.php
ADDED
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Extra\Fields;
|
4 |
+
|
5 |
+
use PhpZip\Exception\InvalidArgumentException;
|
6 |
+
use PhpZip\Exception\ZipException;
|
7 |
+
use PhpZip\Model\Extra\ZipExtraField;
|
8 |
+
use PhpZip\Model\ZipEntry;
|
9 |
+
use PhpZip\Util\PackUtil;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* NTFS Extra Field.
|
13 |
+
*
|
14 |
+
* @see https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT .ZIP File Format Specification
|
15 |
+
*
|
16 |
+
* @license MIT
|
17 |
+
*/
|
18 |
+
class NtfsExtraField implements ZipExtraField
|
19 |
+
{
|
20 |
+
/** @var int Header id */
|
21 |
+
const HEADER_ID = 0x000a;
|
22 |
+
|
23 |
+
/** @var int Tag ID */
|
24 |
+
const TIME_ATTR_TAG = 0x0001;
|
25 |
+
|
26 |
+
/** @var int Attribute size */
|
27 |
+
const TIME_ATTR_SIZE = 24; // 3 * 8
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var int A file time is a 64-bit value that represents the number of
|
31 |
+
* 100-nanosecond intervals that have elapsed since 12:00
|
32 |
+
* A.M. January 1, 1601 Coordinated Universal Time (UTC).
|
33 |
+
* this is the offset of Windows time 0 to Unix epoch in 100-nanosecond intervals.
|
34 |
+
*/
|
35 |
+
const EPOCH_OFFSET = -116444736000000000;
|
36 |
+
|
37 |
+
/** @var int Modify ntfs time */
|
38 |
+
private $modifyNtfsTime;
|
39 |
+
|
40 |
+
/** @var int Access ntfs time */
|
41 |
+
private $accessNtfsTime;
|
42 |
+
|
43 |
+
/** @var int Create ntfs time */
|
44 |
+
private $createNtfsTime;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @param int $modifyNtfsTime
|
48 |
+
* @param int $accessNtfsTime
|
49 |
+
* @param int $createNtfsTime
|
50 |
+
*/
|
51 |
+
public function __construct($modifyNtfsTime, $accessNtfsTime, $createNtfsTime)
|
52 |
+
{
|
53 |
+
$this->modifyNtfsTime = (int) $modifyNtfsTime;
|
54 |
+
$this->accessNtfsTime = (int) $accessNtfsTime;
|
55 |
+
$this->createNtfsTime = (int) $createNtfsTime;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @param \DateTimeInterface $modifyDateTime
|
60 |
+
* @param \DateTimeInterface $accessDateTime
|
61 |
+
* @param \DateTimeInterface $createNtfsTime
|
62 |
+
*
|
63 |
+
* @return NtfsExtraField
|
64 |
+
*/
|
65 |
+
public static function create(
|
66 |
+
\DateTimeInterface $modifyDateTime,
|
67 |
+
\DateTimeInterface $accessDateTime,
|
68 |
+
\DateTimeInterface $createNtfsTime
|
69 |
+
) {
|
70 |
+
return new self(
|
71 |
+
self::dateTimeToNtfsTime($modifyDateTime),
|
72 |
+
self::dateTimeToNtfsTime($accessDateTime),
|
73 |
+
self::dateTimeToNtfsTime($createNtfsTime)
|
74 |
+
);
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Returns the Header ID (type) of this Extra Field.
|
79 |
+
* The Header ID is an unsigned short integer (two bytes)
|
80 |
+
* which must be constant during the life cycle of this object.
|
81 |
+
*
|
82 |
+
* @return int
|
83 |
+
*/
|
84 |
+
public function getHeaderId()
|
85 |
+
{
|
86 |
+
return self::HEADER_ID;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Populate data from this array as if it was in local file data.
|
91 |
+
*
|
92 |
+
* @param string $buffer the buffer to read data from
|
93 |
+
* @param ZipEntry|null $entry
|
94 |
+
*
|
95 |
+
* @throws ZipException
|
96 |
+
*
|
97 |
+
* @return NtfsExtraField
|
98 |
+
*/
|
99 |
+
public static function unpackLocalFileData($buffer, ZipEntry $entry = null)
|
100 |
+
{
|
101 |
+
if (\PHP_INT_SIZE === 4) {
|
102 |
+
throw new ZipException('not supported for php-32bit');
|
103 |
+
}
|
104 |
+
|
105 |
+
$buffer = substr($buffer, 4);
|
106 |
+
|
107 |
+
$modifyTime = 0;
|
108 |
+
$accessTime = 0;
|
109 |
+
$createTime = 0;
|
110 |
+
|
111 |
+
while ($buffer || $buffer !== '') {
|
112 |
+
$unpack = unpack('vtag/vsizeAttr', $buffer);
|
113 |
+
|
114 |
+
if ($unpack['tag'] === self::TIME_ATTR_TAG && $unpack['sizeAttr'] === self::TIME_ATTR_SIZE) {
|
115 |
+
// refactoring will be needed when php 5.5 support ends
|
116 |
+
$modifyTime = PackUtil::unpackLongLE(substr($buffer, 4, 8));
|
117 |
+
$accessTime = PackUtil::unpackLongLE(substr($buffer, 12, 8));
|
118 |
+
$createTime = PackUtil::unpackLongLE(substr($buffer, 20, 8));
|
119 |
+
|
120 |
+
break;
|
121 |
+
}
|
122 |
+
$buffer = substr($buffer, 4 + $unpack['sizeAttr']);
|
123 |
+
}
|
124 |
+
|
125 |
+
return new self($modifyTime, $accessTime, $createTime);
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Populate data from this array as if it was in central directory data.
|
130 |
+
*
|
131 |
+
* @param string $buffer the buffer to read data from
|
132 |
+
* @param ZipEntry|null $entry
|
133 |
+
*
|
134 |
+
* @throws ZipException
|
135 |
+
*
|
136 |
+
* @return NtfsExtraField
|
137 |
+
*/
|
138 |
+
public static function unpackCentralDirData($buffer, ZipEntry $entry = null)
|
139 |
+
{
|
140 |
+
return self::unpackLocalFileData($buffer, $entry);
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* The actual data to put into local file data - without Header-ID
|
145 |
+
* or length specifier.
|
146 |
+
*
|
147 |
+
* @return string the data
|
148 |
+
*/
|
149 |
+
public function packLocalFileData()
|
150 |
+
{
|
151 |
+
$data = pack('Vvv', 0, self::TIME_ATTR_TAG, self::TIME_ATTR_SIZE);
|
152 |
+
// refactoring will be needed when php 5.5 support ends
|
153 |
+
$data .= PackUtil::packLongLE($this->modifyNtfsTime);
|
154 |
+
$data .= PackUtil::packLongLE($this->accessNtfsTime);
|
155 |
+
$data .= PackUtil::packLongLE($this->createNtfsTime);
|
156 |
+
|
157 |
+
return $data;
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* @return int
|
162 |
+
*/
|
163 |
+
public function getModifyNtfsTime()
|
164 |
+
{
|
165 |
+
return $this->modifyNtfsTime;
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* @param int $modifyNtfsTime
|
170 |
+
*/
|
171 |
+
public function setModifyNtfsTime($modifyNtfsTime)
|
172 |
+
{
|
173 |
+
$this->modifyNtfsTime = (int) $modifyNtfsTime;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* @return int
|
178 |
+
*/
|
179 |
+
public function getAccessNtfsTime()
|
180 |
+
{
|
181 |
+
return $this->accessNtfsTime;
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* @param int $accessNtfsTime
|
186 |
+
*/
|
187 |
+
public function setAccessNtfsTime($accessNtfsTime)
|
188 |
+
{
|
189 |
+
$this->accessNtfsTime = (int) $accessNtfsTime;
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* @return int
|
194 |
+
*/
|
195 |
+
public function getCreateNtfsTime()
|
196 |
+
{
|
197 |
+
return $this->createNtfsTime;
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* @param int $createNtfsTime
|
202 |
+
*/
|
203 |
+
public function setCreateNtfsTime($createNtfsTime)
|
204 |
+
{
|
205 |
+
$this->createNtfsTime = (int) $createNtfsTime;
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* The actual data to put into central directory - without Header-ID or
|
210 |
+
* length specifier.
|
211 |
+
*
|
212 |
+
* @return string the data
|
213 |
+
*/
|
214 |
+
public function packCentralDirData()
|
215 |
+
{
|
216 |
+
return $this->packLocalFileData();
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* @return \DateTimeInterface
|
221 |
+
*/
|
222 |
+
public function getModifyDateTime()
|
223 |
+
{
|
224 |
+
return self::ntfsTimeToDateTime($this->modifyNtfsTime);
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* @param \DateTimeInterface $modifyTime
|
229 |
+
*/
|
230 |
+
public function setModifyDateTime(\DateTimeInterface $modifyTime)
|
231 |
+
{
|
232 |
+
$this->modifyNtfsTime = self::dateTimeToNtfsTime($modifyTime);
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* @return \DateTimeInterface
|
237 |
+
*/
|
238 |
+
public function getAccessDateTime()
|
239 |
+
{
|
240 |
+
return self::ntfsTimeToDateTime($this->accessNtfsTime);
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* @param \DateTimeInterface $accessTime
|
245 |
+
*/
|
246 |
+
public function setAccessDateTime(\DateTimeInterface $accessTime)
|
247 |
+
{
|
248 |
+
$this->accessNtfsTime = self::dateTimeToNtfsTime($accessTime);
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* @return \DateTimeInterface
|
253 |
+
*/
|
254 |
+
public function getCreateDateTime()
|
255 |
+
{
|
256 |
+
return self::ntfsTimeToDateTime($this->createNtfsTime);
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* @param \DateTimeInterface $createTime
|
261 |
+
*/
|
262 |
+
public function setCreateDateTime(\DateTimeInterface $createTime)
|
263 |
+
{
|
264 |
+
$this->createNtfsTime = self::dateTimeToNtfsTime($createTime);
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* @param float $timestamp Float timestamp
|
269 |
+
*
|
270 |
+
* @return int
|
271 |
+
*/
|
272 |
+
public static function timestampToNtfsTime($timestamp)
|
273 |
+
{
|
274 |
+
return (int) (((float) $timestamp * 10000000) - self::EPOCH_OFFSET);
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* @param \DateTimeInterface $dateTime
|
279 |
+
*
|
280 |
+
* @return int
|
281 |
+
*/
|
282 |
+
public static function dateTimeToNtfsTime(\DateTimeInterface $dateTime)
|
283 |
+
{
|
284 |
+
return self::timestampToNtfsTime((float) $dateTime->format('U.u'));
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* @param int $ntfsTime
|
289 |
+
*
|
290 |
+
* @return float Float unix timestamp
|
291 |
+
*/
|
292 |
+
public static function ntfsTimeToTimestamp($ntfsTime)
|
293 |
+
{
|
294 |
+
return (float) (($ntfsTime + self::EPOCH_OFFSET) / 10000000);
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* @param int $ntfsTime
|
299 |
+
*
|
300 |
+
* @return \DateTimeInterface
|
301 |
+
*/
|
302 |
+
public static function ntfsTimeToDateTime($ntfsTime)
|
303 |
+
{
|
304 |
+
$timestamp = self::ntfsTimeToTimestamp($ntfsTime);
|
305 |
+
$dateTime = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6f', $timestamp));
|
306 |
+
|
307 |
+
if ($dateTime === false) {
|
308 |
+
throw new InvalidArgumentException('Cannot create date/time object for timestamp ' . $timestamp);
|
309 |
+
}
|
310 |
+
|
311 |
+
return $dateTime;
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* @return string
|
316 |
+
*/
|
317 |
+
public function __toString()
|
318 |
+
{
|
319 |
+
$args = [self::HEADER_ID];
|
320 |
+
$format = '0x%04x NtfsExtra:';
|
321 |
+
|
322 |
+
if ($this->modifyNtfsTime !== 0) {
|
323 |
+
$format .= ' Modify:[%s]';
|
324 |
+
$args[] = $this->getModifyDateTime()->format(\DATE_ATOM);
|
325 |
+
}
|
326 |
+
|
327 |
+
if ($this->accessNtfsTime !== 0) {
|
328 |
+
$format .= ' Access:[%s]';
|
329 |
+
$args[] = $this->getAccessDateTime()->format(\DATE_ATOM);
|
330 |
+
}
|
331 |
+
|
332 |
+
if ($this->createNtfsTime !== 0) {
|
333 |
+
$format .= ' Create:[%s]';
|
334 |
+
$args[] = $this->getCreateDateTime()->format(\DATE_ATOM);
|
335 |
+
}
|
336 |
+
|
337 |
+
return vsprintf($format, $args);
|
338 |
+
}
|
339 |
+
}
|
library/vendor/nelexa/zip/src/Model/Extra/Fields/OldUnixExtraField.php
ADDED
@@ -0,0 +1,327 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Extra\Fields;
|
4 |
+
|
5 |
+
use PhpZip\Model\Extra\ZipExtraField;
|
6 |
+
use PhpZip\Model\ZipEntry;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Info-ZIP Unix Extra Field (type 1):
|
10 |
+
* ==================================.
|
11 |
+
*
|
12 |
+
* The following is the layout of the old Info-ZIP extra block for
|
13 |
+
* Unix. It has been replaced by the extended-timestamp extra block
|
14 |
+
* (0x5455) and the Unix type 2 extra block (0x7855).
|
15 |
+
* (Last Revision 19970118)
|
16 |
+
*
|
17 |
+
* Local-header version:
|
18 |
+
*
|
19 |
+
* Value Size Description
|
20 |
+
* ----- ---- -----------
|
21 |
+
* (Unix1) 0x5855 Short tag for this extra block type ("UX")
|
22 |
+
* TSize Short total data size for this block
|
23 |
+
* AcTime Long time of last access (UTC/GMT)
|
24 |
+
* ModTime Long time of last modification (UTC/GMT)
|
25 |
+
* UID Short Unix user ID (optional)
|
26 |
+
* GID Short Unix group ID (optional)
|
27 |
+
*
|
28 |
+
* Central-header version:
|
29 |
+
*
|
30 |
+
* Value Size Description
|
31 |
+
* ----- ---- -----------
|
32 |
+
* (Unix1) 0x5855 Short tag for this extra block type ("UX")
|
33 |
+
* TSize Short total data size for this block
|
34 |
+
* AcTime Long time of last access (GMT/UTC)
|
35 |
+
* ModTime Long time of last modification (GMT/UTC)
|
36 |
+
*
|
37 |
+
* The file access and modification times are in standard Unix signed-
|
38 |
+
* long format, indicating the number of seconds since 1 January 1970
|
39 |
+
* 00:00:00. The times are relative to Coordinated Universal Time
|
40 |
+
* (UTC), also sometimes referred to as Greenwich Mean Time (GMT). To
|
41 |
+
* convert to local time, the software must know the local timezone
|
42 |
+
* offset from UTC/GMT. The modification time may be used by non-Unix
|
43 |
+
* systems to support inter-timezone freshening and updating of zip
|
44 |
+
* archives.
|
45 |
+
*
|
46 |
+
* The local-header extra block may optionally contain UID and GID
|
47 |
+
* info for the file. The local-header TSize value is the only
|
48 |
+
* indication of this. Note that Unix UIDs and GIDs are usually
|
49 |
+
* specific to a particular machine, and they generally require root
|
50 |
+
* access to restore.
|
51 |
+
*
|
52 |
+
* This extra field type is obsolete, but it has been in use since
|
53 |
+
* mid-1994. Therefore future archiving software should continue to
|
54 |
+
* support it.
|
55 |
+
*/
|
56 |
+
class OldUnixExtraField implements ZipExtraField
|
57 |
+
{
|
58 |
+
/** @var int Header id */
|
59 |
+
const HEADER_ID = 0x5855;
|
60 |
+
|
61 |
+
/** @var int|null Access timestamp */
|
62 |
+
private $accessTime;
|
63 |
+
|
64 |
+
/** @var int|null Modify timestamp */
|
65 |
+
private $modifyTime;
|
66 |
+
|
67 |
+
/** @var int|null User id */
|
68 |
+
private $uid;
|
69 |
+
|
70 |
+
/** @var int|null Group id */
|
71 |
+
private $gid;
|
72 |
+
|
73 |
+
/**
|
74 |
+
* @param int|null $accessTime
|
75 |
+
* @param int|null $modifyTime
|
76 |
+
* @param int|null $uid
|
77 |
+
* @param int|null $gid
|
78 |
+
*/
|
79 |
+
public function __construct($accessTime, $modifyTime, $uid, $gid)
|
80 |
+
{
|
81 |
+
$this->accessTime = $accessTime;
|
82 |
+
$this->modifyTime = $modifyTime;
|
83 |
+
$this->uid = $uid;
|
84 |
+
$this->gid = $gid;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Returns the Header ID (type) of this Extra Field.
|
89 |
+
* The Header ID is an unsigned short integer (two bytes)
|
90 |
+
* which must be constant during the life cycle of this object.
|
91 |
+
*
|
92 |
+
* @return int
|
93 |
+
*/
|
94 |
+
public function getHeaderId()
|
95 |
+
{
|
96 |
+
return self::HEADER_ID;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Populate data from this array as if it was in local file data.
|
101 |
+
*
|
102 |
+
* @param string $buffer the buffer to read data from
|
103 |
+
* @param ZipEntry|null $entry
|
104 |
+
*
|
105 |
+
* @return OldUnixExtraField
|
106 |
+
*/
|
107 |
+
public static function unpackLocalFileData($buffer, ZipEntry $entry = null)
|
108 |
+
{
|
109 |
+
$length = \strlen($buffer);
|
110 |
+
|
111 |
+
$accessTime = $modifyTime = $uid = $gid = null;
|
112 |
+
|
113 |
+
if ($length >= 4) {
|
114 |
+
$accessTime = unpack('V', $buffer)[1];
|
115 |
+
}
|
116 |
+
|
117 |
+
if ($length >= 8) {
|
118 |
+
$modifyTime = unpack('V', substr($buffer, 4, 4))[1];
|
119 |
+
}
|
120 |
+
|
121 |
+
if ($length >= 10) {
|
122 |
+
$uid = unpack('v', substr($buffer, 8, 2))[1];
|
123 |
+
}
|
124 |
+
|
125 |
+
if ($length >= 12) {
|
126 |
+
$gid = unpack('v', substr($buffer, 10, 2))[1];
|
127 |
+
}
|
128 |
+
|
129 |
+
return new self($accessTime, $modifyTime, $uid, $gid);
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Populate data from this array as if it was in central directory data.
|
134 |
+
*
|
135 |
+
* @param string $buffer the buffer to read data from
|
136 |
+
* @param ZipEntry|null $entry
|
137 |
+
*
|
138 |
+
* @return OldUnixExtraField
|
139 |
+
*/
|
140 |
+
public static function unpackCentralDirData($buffer, ZipEntry $entry = null)
|
141 |
+
{
|
142 |
+
$length = \strlen($buffer);
|
143 |
+
|
144 |
+
$accessTime = $modifyTime = null;
|
145 |
+
|
146 |
+
if ($length >= 4) {
|
147 |
+
$accessTime = unpack('V', $buffer)[1];
|
148 |
+
}
|
149 |
+
|
150 |
+
if ($length >= 8) {
|
151 |
+
$modifyTime = unpack('V', substr($buffer, 4, 4))[1];
|
152 |
+
}
|
153 |
+
|
154 |
+
return new self($accessTime, $modifyTime, null, null);
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* The actual data to put into local file data - without Header-ID
|
159 |
+
* or length specifier.
|
160 |
+
*
|
161 |
+
* @return string the data
|
162 |
+
*/
|
163 |
+
public function packLocalFileData()
|
164 |
+
{
|
165 |
+
$data = '';
|
166 |
+
|
167 |
+
if ($this->accessTime !== null) {
|
168 |
+
$data .= pack('V', $this->accessTime);
|
169 |
+
|
170 |
+
if ($this->modifyTime !== null) {
|
171 |
+
$data .= pack('V', $this->modifyTime);
|
172 |
+
|
173 |
+
if ($this->uid !== null) {
|
174 |
+
$data .= pack('v', $this->uid);
|
175 |
+
|
176 |
+
if ($this->gid !== null) {
|
177 |
+
$data .= pack('v', $this->gid);
|
178 |
+
}
|
179 |
+
}
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
+
return $data;
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* The actual data to put into central directory - without Header-ID or
|
188 |
+
* length specifier.
|
189 |
+
*
|
190 |
+
* @return string the data
|
191 |
+
*/
|
192 |
+
public function packCentralDirData()
|
193 |
+
{
|
194 |
+
$data = '';
|
195 |
+
|
196 |
+
if ($this->accessTime !== null) {
|
197 |
+
$data .= pack('V', $this->accessTime);
|
198 |
+
|
199 |
+
if ($this->modifyTime !== null) {
|
200 |
+
$data .= pack('V', $this->modifyTime);
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
return $data;
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* @return int|null
|
209 |
+
*/
|
210 |
+
public function getAccessTime()
|
211 |
+
{
|
212 |
+
return $this->accessTime;
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* @param int|null $accessTime
|
217 |
+
*/
|
218 |
+
public function setAccessTime($accessTime)
|
219 |
+
{
|
220 |
+
$this->accessTime = $accessTime;
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* @return \DateTimeInterface|null
|
225 |
+
*/
|
226 |
+
public function getAccessDateTime()
|
227 |
+
{
|
228 |
+
try {
|
229 |
+
return $this->accessTime === null ? null :
|
230 |
+
new \DateTimeImmutable('@' . $this->accessTime);
|
231 |
+
} catch (\Exception $e) {
|
232 |
+
return null;
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* @return int|null
|
238 |
+
*/
|
239 |
+
public function getModifyTime()
|
240 |
+
{
|
241 |
+
return $this->modifyTime;
|
242 |
+
}
|
243 |
+
|
244 |
+
/**
|
245 |
+
* @param int|null $modifyTime
|
246 |
+
*/
|
247 |
+
public function setModifyTime($modifyTime)
|
248 |
+
{
|
249 |
+
$this->modifyTime = $modifyTime;
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* @return \DateTimeInterface|null
|
254 |
+
*/
|
255 |
+
public function getModifyDateTime()
|
256 |
+
{
|
257 |
+
try {
|
258 |
+
return $this->modifyTime === null ? null :
|
259 |
+
new \DateTimeImmutable('@' . $this->modifyTime);
|
260 |
+
} catch (\Exception $e) {
|
261 |
+
return null;
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* @return int|null
|
267 |
+
*/
|
268 |
+
public function getUid()
|
269 |
+
{
|
270 |
+
return $this->uid;
|
271 |
+
}
|
272 |
+
|
273 |
+
/**
|
274 |
+
* @param int|null $uid
|
275 |
+
*/
|
276 |
+
public function setUid($uid)
|
277 |
+
{
|
278 |
+
$this->uid = $uid;
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* @return int|null
|
283 |
+
*/
|
284 |
+
public function getGid()
|
285 |
+
{
|
286 |
+
return $this->gid;
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* @param int|null $gid
|
291 |
+
*/
|
292 |
+
public function setGid($gid)
|
293 |
+
{
|
294 |
+
$this->gid = $gid;
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* @return string
|
299 |
+
*/
|
300 |
+
public function __toString()
|
301 |
+
{
|
302 |
+
$args = [self::HEADER_ID];
|
303 |
+
$format = '0x%04x OldUnix:';
|
304 |
+
|
305 |
+
if (($modifyTime = $this->getModifyDateTime()) !== null) {
|
306 |
+
$format .= ' Modify:[%s]';
|
307 |
+
$args[] = $modifyTime->format(\DATE_ATOM);
|
308 |
+
}
|
309 |
+
|
310 |
+
if (($accessTime = $this->getAccessDateTime()) !== null) {
|
311 |
+
$format .= ' Access:[%s]';
|
312 |
+
$args[] = $accessTime->format(\DATE_ATOM);
|
313 |
+
}
|
314 |
+
|
315 |
+
if ($this->uid !== null) {
|
316 |
+
$format .= ' UID=%d';
|
317 |
+
$args[] = $this->uid;
|
318 |
+
}
|
319 |
+
|
320 |
+
if ($this->gid !== null) {
|
321 |
+
$format .= ' GID=%d';
|
322 |
+
$args[] = $this->gid;
|
323 |
+
}
|
324 |
+
|
325 |
+
return vsprintf($format, $args);
|
326 |
+
}
|
327 |
+
}
|
library/vendor/nelexa/zip/src/Model/Extra/Fields/UnicodeCommentExtraField.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Extra\Fields;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Info-ZIP Unicode Comment Extra Field (0x6375):.
|
7 |
+
*
|
8 |
+
* Stores the UTF-8 version of the file comment as stored in the
|
9 |
+
* central directory header. (Last Revision 20070912)
|
10 |
+
*
|
11 |
+
* Value Size Description
|
12 |
+
* ----- ---- -----------
|
13 |
+
* (UCom) 0x6375 Short tag for this extra block type ("uc")
|
14 |
+
* TSize Short total data size for this block
|
15 |
+
* Version 1 byte version of this extra field, currently 1
|
16 |
+
* ComCRC32 4 bytes Comment Field CRC32 Checksum
|
17 |
+
* UnicodeCom Variable UTF-8 version of the entry comment
|
18 |
+
*
|
19 |
+
* Currently Version is set to the number 1. If there is a need
|
20 |
+
* to change this field, the version will be incremented. Changes
|
21 |
+
* may not be backward compatible so this extra field should not be
|
22 |
+
* used if the version is not recognized.
|
23 |
+
*
|
24 |
+
* The ComCRC32 is the standard zip CRC32 checksum of the File Comment
|
25 |
+
* field in the central directory header. This is used to verify that
|
26 |
+
* the comment field has not changed since the Unicode Comment extra field
|
27 |
+
* was created. This can happen if a utility changes the File Comment
|
28 |
+
* field but does not update the UTF-8 Comment extra field. If the CRC
|
29 |
+
* check fails, this Unicode Comment extra field should be ignored and
|
30 |
+
* the File Comment field in the header should be used instead.
|
31 |
+
*
|
32 |
+
* The UnicodeCom field is the UTF-8 version of the File Comment field
|
33 |
+
* in the header. As UnicodeCom is defined to be UTF-8, no UTF-8 byte
|
34 |
+
* order mark (BOM) is used. The length of this field is determined by
|
35 |
+
* subtracting the size of the previous fields from TSize. If both the
|
36 |
+
* File Name and Comment fields are UTF-8, the new General Purpose Bit
|
37 |
+
* Flag, bit 11 (Language encoding flag (EFS)), can be used to indicate
|
38 |
+
* both the header File Name and Comment fields are UTF-8 and, in this
|
39 |
+
* case, the Unicode Path and Unicode Comment extra fields are not
|
40 |
+
* needed and should not be created. Note that, for backward
|
41 |
+
* compatibility, bit 11 should only be used if the native character set
|
42 |
+
* of the paths and comments being zipped up are already in UTF-8. It is
|
43 |
+
* expected that the same file comment storage method, either general
|
44 |
+
* purpose bit 11 or extra fields, be used in both the Local and Central
|
45 |
+
* Directory Header for a file.
|
46 |
+
*
|
47 |
+
* @see https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT section 4.6.8
|
48 |
+
*/
|
49 |
+
class UnicodeCommentExtraField extends AbstractUnicodeExtraField
|
50 |
+
{
|
51 |
+
const HEADER_ID = 0x6375;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Returns the Header ID (type) of this Extra Field.
|
55 |
+
* The Header ID is an unsigned short integer (two bytes)
|
56 |
+
* which must be constant during the life cycle of this object.
|
57 |
+
*
|
58 |
+
* @return int
|
59 |
+
*/
|
60 |
+
public function getHeaderId()
|
61 |
+
{
|
62 |
+
return self::HEADER_ID;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* @return string
|
67 |
+
*/
|
68 |
+
public function __toString()
|
69 |
+
{
|
70 |
+
return sprintf(
|
71 |
+
'0x%04x UnicodeComment: "%s"',
|
72 |
+
self::HEADER_ID,
|
73 |
+
$this->getUnicodeValue()
|
74 |
+
);
|
75 |
+
}
|
76 |
+
}
|
library/vendor/nelexa/zip/src/Model/Extra/Fields/UnicodePathExtraField.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Extra\Fields;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Info-ZIP Unicode Path Extra Field (0x7075):
|
7 |
+
* ==========================================.
|
8 |
+
*
|
9 |
+
* Stores the UTF-8 version of the file name field as stored in the
|
10 |
+
* local header and central directory header. (Last Revision 20070912)
|
11 |
+
*
|
12 |
+
* Value Size Description
|
13 |
+
* ----- ---- -----------
|
14 |
+
* (UPath) 0x7075 Short tag for this extra block type ("up")
|
15 |
+
* TSize Short total data size for this block
|
16 |
+
* Version 1 byte version of this extra field, currently 1
|
17 |
+
* NameCRC32 4 bytes File Name Field CRC32 Checksum
|
18 |
+
* UnicodeName Variable UTF-8 version of the entry File Name
|
19 |
+
*
|
20 |
+
* Currently Version is set to the number 1. If there is a need
|
21 |
+
* to change this field, the version will be incremented. Changes
|
22 |
+
* may not be backward compatible so this extra field should not be
|
23 |
+
* used if the version is not recognized.
|
24 |
+
*
|
25 |
+
* The NameCRC32 is the standard zip CRC32 checksum of the File Name
|
26 |
+
* field in the header. This is used to verify that the header
|
27 |
+
* File Name field has not changed since the Unicode Path extra field
|
28 |
+
* was created. This can happen if a utility renames the File Name but
|
29 |
+
* does not update the UTF-8 path extra field. If the CRC check fails,
|
30 |
+
* this UTF-8 Path Extra Field should be ignored and the File Name field
|
31 |
+
* in the header should be used instead.
|
32 |
+
*
|
33 |
+
* The UnicodeName is the UTF-8 version of the contents of the File Name
|
34 |
+
* field in the header. As UnicodeName is defined to be UTF-8, no UTF-8
|
35 |
+
* byte order mark (BOM) is used. The length of this field is determined
|
36 |
+
* by subtracting the size of the previous fields from TSize. If both
|
37 |
+
* the File Name and Comment fields are UTF-8, the new General Purpose
|
38 |
+
* Bit Flag, bit 11 (Language encoding flag (EFS)), can be used to
|
39 |
+
* indicate that both the header File Name and Comment fields are UTF-8
|
40 |
+
* and, in this case, the Unicode Path and Unicode Comment extra fields
|
41 |
+
* are not needed and should not be created. Note that, for backward
|
42 |
+
* compatibility, bit 11 should only be used if the native character set
|
43 |
+
* of the paths and comments being zipped up are already in UTF-8. It is
|
44 |
+
* expected that the same file name storage method, either general
|
45 |
+
* purpose bit 11 or extra fields, be used in both the Local and Central
|
46 |
+
* Directory Header for a file.
|
47 |
+
*
|
48 |
+
* @see https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT section 4.6.9
|
49 |
+
*/
|
50 |
+
class UnicodePathExtraField extends AbstractUnicodeExtraField
|
51 |
+
{
|
52 |
+
const HEADER_ID = 0x7075;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Returns the Header ID (type) of this Extra Field.
|
56 |
+
* The Header ID is an unsigned short integer (two bytes)
|
57 |
+
* which must be constant during the life cycle of this object.
|
58 |
+
*
|
59 |
+
* @return int
|
60 |
+
*/
|
61 |
+
public function getHeaderId()
|
62 |
+
{
|
63 |
+
return self::HEADER_ID;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
public function __toString()
|
70 |
+
{
|
71 |
+
return sprintf(
|
72 |
+
'0x%04x UnicodePath: "%s"',
|
73 |
+
self::HEADER_ID,
|
74 |
+
$this->getUnicodeValue()
|
75 |
+
);
|
76 |
+
}
|
77 |
+
}
|
library/vendor/nelexa/zip/src/Model/Extra/Fields/UnrecognizedExtraField.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Extra\Fields;
|
4 |
+
|
5 |
+
use PhpZip\Exception\RuntimeException;
|
6 |
+
use PhpZip\Model\Extra\ZipExtraField;
|
7 |
+
use PhpZip\Model\ZipEntry;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Simple placeholder for all those extra fields we don't want to deal with.
|
11 |
+
*/
|
12 |
+
class UnrecognizedExtraField implements ZipExtraField
|
13 |
+
{
|
14 |
+
/** @var int */
|
15 |
+
private $headerId;
|
16 |
+
|
17 |
+
/** @var string extra field data without Header-ID or length specifier */
|
18 |
+
private $data;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* UnrecognizedExtraField constructor.
|
22 |
+
*
|
23 |
+
* @param int $headerId
|
24 |
+
* @param string $data
|
25 |
+
*/
|
26 |
+
public function __construct($headerId, $data)
|
27 |
+
{
|
28 |
+
$this->headerId = (int) $headerId;
|
29 |
+
$this->data = (string) $data;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @param int $headerId
|
34 |
+
*/
|
35 |
+
public function setHeaderId($headerId)
|
36 |
+
{
|
37 |
+
$this->headerId = $headerId;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Returns the Header ID (type) of this Extra Field.
|
42 |
+
* The Header ID is an unsigned short integer (two bytes)
|
43 |
+
* which must be constant during the life cycle of this object.
|
44 |
+
*
|
45 |
+
* @return int
|
46 |
+
*/
|
47 |
+
public function getHeaderId()
|
48 |
+
{
|
49 |
+
return $this->headerId;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Populate data from this array as if it was in local file data.
|
54 |
+
*
|
55 |
+
* @param string $buffer the buffer to read data from
|
56 |
+
* @param ZipEntry|null $entry
|
57 |
+
*/
|
58 |
+
public static function unpackLocalFileData($buffer, ZipEntry $entry = null)
|
59 |
+
{
|
60 |
+
throw new RuntimeException('Unsupport parse');
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Populate data from this array as if it was in central directory data.
|
65 |
+
*
|
66 |
+
* @param string $buffer the buffer to read data from
|
67 |
+
* @param ZipEntry|null $entry
|
68 |
+
*/
|
69 |
+
public static function unpackCentralDirData($buffer, ZipEntry $entry = null)
|
70 |
+
{
|
71 |
+
throw new RuntimeException('Unsupport parse');
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* {@inheritdoc}
|
76 |
+
*/
|
77 |
+
public function packLocalFileData()
|
78 |
+
{
|
79 |
+
return $this->data;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* {@inheritdoc}
|
84 |
+
*/
|
85 |
+
public function packCentralDirData()
|
86 |
+
{
|
87 |
+
return $this->data;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* @return string
|
92 |
+
*/
|
93 |
+
public function getData()
|
94 |
+
{
|
95 |
+
return $this->data;
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* @param string $data
|
100 |
+
*/
|
101 |
+
public function setData($data)
|
102 |
+
{
|
103 |
+
$this->data = (string) $data;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* @return string
|
108 |
+
*/
|
109 |
+
public function __toString()
|
110 |
+
{
|
111 |
+
$args = [$this->headerId, $this->data];
|
112 |
+
$format = '0x%04x Unrecognized Extra Field: "%s"';
|
113 |
+
|
114 |
+
return vsprintf($format, $args);
|
115 |
+
}
|
116 |
+
}
|
library/vendor/nelexa/zip/src/Model/Extra/Fields/WinZipAesExtraField.php
ADDED
@@ -0,0 +1,387 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Extra\Fields;
|
4 |
+
|
5 |
+
use PhpZip\Constants\ZipCompressionMethod;
|
6 |
+
use PhpZip\Constants\ZipEncryptionMethod;
|
7 |
+
use PhpZip\Exception\InvalidArgumentException;
|
8 |
+
use PhpZip\Exception\ZipException;
|
9 |
+
use PhpZip\Exception\ZipUnsupportMethodException;
|
10 |
+
use PhpZip\Model\Extra\ZipExtraField;
|
11 |
+
use PhpZip\Model\ZipEntry;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* WinZip AES Extra Field.
|
15 |
+
*
|
16 |
+
* @see http://www.winzip.com/win/en/aes_tips.htm AES Coding Tips for Developers
|
17 |
+
*/
|
18 |
+
class WinZipAesExtraField implements ZipExtraField
|
19 |
+
{
|
20 |
+
/** @var int Header id */
|
21 |
+
const HEADER_ID = 0x9901;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var int Data size (currently 7, but subject to possible increase
|
25 |
+
* in the future)
|
26 |
+
*/
|
27 |
+
const DATA_SIZE = 7;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var int The vendor ID field should always be set to the two ASCII
|
31 |
+
* characters "AE"
|
32 |
+
*/
|
33 |
+
const VENDOR_ID = 0x4541; // 'A' | ('E' << 8)
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @var int Entries of this type do include the standard ZIP CRC-32 value.
|
37 |
+
* For use with {@see WinZipAesExtraField::setVendorVersion()}.
|
38 |
+
*/
|
39 |
+
const VERSION_AE1 = 1;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @var int Entries of this type do not include the standard ZIP CRC-32 value.
|
43 |
+
* For use with {@see WinZipAesExtraField::setVendorVersion().
|
44 |
+
*/
|
45 |
+
const VERSION_AE2 = 2;
|
46 |
+
|
47 |
+
/** @var int integer mode value indicating AES encryption 128-bit strength */
|
48 |
+
const KEY_STRENGTH_128BIT = 0x01;
|
49 |
+
|
50 |
+
/** @var int integer mode value indicating AES encryption 192-bit strength */
|
51 |
+
const KEY_STRENGTH_192BIT = 0x02;
|
52 |
+
|
53 |
+
/** @var int integer mode value indicating AES encryption 256-bit strength */
|
54 |
+
const KEY_STRENGTH_256BIT = 0x03;
|
55 |
+
|
56 |
+
/** @var int[] */
|
57 |
+
private static $allowVendorVersions = [
|
58 |
+
self::VERSION_AE1,
|
59 |
+
self::VERSION_AE2,
|
60 |
+
];
|
61 |
+
|
62 |
+
/** @var array<int, int> */
|
63 |
+
private static $encryptionStrengths = [
|
64 |
+
self::KEY_STRENGTH_128BIT => 128,
|
65 |
+
self::KEY_STRENGTH_192BIT => 192,
|
66 |
+
self::KEY_STRENGTH_256BIT => 256,
|
67 |
+
];
|
68 |
+
|
69 |
+
/** @var array<int, int> */
|
70 |
+
private static $MAP_KEY_STRENGTH_METHODS = [
|
71 |
+
self::KEY_STRENGTH_128BIT => ZipEncryptionMethod::WINZIP_AES_128,
|
72 |
+
self::KEY_STRENGTH_192BIT => ZipEncryptionMethod::WINZIP_AES_192,
|
73 |
+
self::KEY_STRENGTH_256BIT => ZipEncryptionMethod::WINZIP_AES_256,
|
74 |
+
];
|
75 |
+
|
76 |
+
/** @var int Integer version number specific to the zip vendor */
|
77 |
+
private $vendorVersion = self::VERSION_AE1;
|
78 |
+
|
79 |
+
/** @var int Integer mode value indicating AES encryption strength */
|
80 |
+
private $keyStrength = self::KEY_STRENGTH_256BIT;
|
81 |
+
|
82 |
+
/** @var int The actual compression method used to compress the file */
|
83 |
+
private $compressionMethod;
|
84 |
+
|
85 |
+
/**
|
86 |
+
* @param int $vendorVersion Integer version number specific to the zip vendor
|
87 |
+
* @param int $keyStrength Integer mode value indicating AES encryption strength
|
88 |
+
* @param int $compressionMethod The actual compression method used to compress the file
|
89 |
+
*
|
90 |
+
* @throws ZipUnsupportMethodException
|
91 |
+
*/
|
92 |
+
public function __construct($vendorVersion, $keyStrength, $compressionMethod)
|
93 |
+
{
|
94 |
+
$this->setVendorVersion($vendorVersion);
|
95 |
+
$this->setKeyStrength($keyStrength);
|
96 |
+
$this->setCompressionMethod($compressionMethod);
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @param ZipEntry $entry
|
101 |
+
*
|
102 |
+
* @throws ZipUnsupportMethodException
|
103 |
+
*
|
104 |
+
* @return WinZipAesExtraField
|
105 |
+
*/
|
106 |
+
public static function create(ZipEntry $entry)
|
107 |
+
{
|
108 |
+
$keyStrength = array_search($entry->getEncryptionMethod(), self::$MAP_KEY_STRENGTH_METHODS, true);
|
109 |
+
|
110 |
+
if ($keyStrength === false) {
|
111 |
+
throw new InvalidArgumentException('Not support encryption method ' . $entry->getEncryptionMethod());
|
112 |
+
}
|
113 |
+
|
114 |
+
// WinZip 11 will continue to use AE-2, with no CRC, for very small files
|
115 |
+
// of less than 20 bytes. It will also use AE-2 for files compressed in
|
116 |
+
// BZIP2 format, because this format has internal integrity checks
|
117 |
+
// equivalent to a CRC check built in.
|
118 |
+
//
|
119 |
+
// https://www.winzip.com/win/en/aes_info.html
|
120 |
+
$vendorVersion = (
|
121 |
+
$entry->getUncompressedSize() < 20 ||
|
122 |
+
$entry->getCompressionMethod() === ZipCompressionMethod::BZIP2
|
123 |
+
) ?
|
124 |
+
self::VERSION_AE2 :
|
125 |
+
self::VERSION_AE1;
|
126 |
+
|
127 |
+
$field = new self($vendorVersion, $keyStrength, $entry->getCompressionMethod());
|
128 |
+
|
129 |
+
$entry->getLocalExtraFields()->add($field);
|
130 |
+
$entry->getCdExtraFields()->add($field);
|
131 |
+
|
132 |
+
return $field;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Returns the Header ID (type) of this Extra Field.
|
137 |
+
* The Header ID is an unsigned short integer (two bytes)
|
138 |
+
* which must be constant during the life cycle of this object.
|
139 |
+
*
|
140 |
+
* @return int
|
141 |
+
*/
|
142 |
+
public function getHeaderId()
|
143 |
+
{
|
144 |
+
return self::HEADER_ID;
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Populate data from this array as if it was in local file data.
|
149 |
+
*
|
150 |
+
* @param string $buffer the buffer to read data from
|
151 |
+
* @param ZipEntry|null $entry
|
152 |
+
*
|
153 |
+
* @throws ZipException on error
|
154 |
+
*
|
155 |
+
* @return WinZipAesExtraField
|
156 |
+
*/
|
157 |
+
public static function unpackLocalFileData($buffer, ZipEntry $entry = null)
|
158 |
+
{
|
159 |
+
$size = \strlen($buffer);
|
160 |
+
|
161 |
+
if ($size !== self::DATA_SIZE) {
|
162 |
+
throw new ZipException(
|
163 |
+
sprintf(
|
164 |
+
'WinZip AES Extra data invalid size: %d. Must be %d',
|
165 |
+
$size,
|
166 |
+
self::DATA_SIZE
|
167 |
+
)
|
168 |
+
);
|
169 |
+
}
|
170 |
+
|
171 |
+
$data = unpack('vvendorVersion/vvendorId/ckeyStrength/vcompressionMethod', $buffer);
|
172 |
+
|
173 |
+
if ($data['vendorId'] !== self::VENDOR_ID) {
|
174 |
+
throw new ZipException(
|
175 |
+
sprintf(
|
176 |
+
'Vendor id invalid: %d. Must be %d',
|
177 |
+
$data['vendorId'],
|
178 |
+
self::VENDOR_ID
|
179 |
+
)
|
180 |
+
);
|
181 |
+
}
|
182 |
+
|
183 |
+
return new self(
|
184 |
+
$data['vendorVersion'],
|
185 |
+
$data['keyStrength'],
|
186 |
+
$data['compressionMethod']
|
187 |
+
);
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Populate data from this array as if it was in central directory data.
|
192 |
+
*
|
193 |
+
* @param string $buffer the buffer to read data from
|
194 |
+
* @param ZipEntry|null $entry
|
195 |
+
*
|
196 |
+
* @throws ZipException
|
197 |
+
*
|
198 |
+
* @return WinZipAesExtraField
|
199 |
+
*/
|
200 |
+
public static function unpackCentralDirData($buffer, ZipEntry $entry = null)
|
201 |
+
{
|
202 |
+
return self::unpackLocalFileData($buffer, $entry);
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* The actual data to put into local file data - without Header-ID
|
207 |
+
* or length specifier.
|
208 |
+
*
|
209 |
+
* @return string the data
|
210 |
+
*/
|
211 |
+
public function packLocalFileData()
|
212 |
+
{
|
213 |
+
return pack(
|
214 |
+
'vvcv',
|
215 |
+
$this->vendorVersion,
|
216 |
+
self::VENDOR_ID,
|
217 |
+
$this->keyStrength,
|
218 |
+
$this->compressionMethod
|
219 |
+
);
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* The actual data to put into central directory - without Header-ID or
|
224 |
+
* length specifier.
|
225 |
+
*
|
226 |
+
* @return string the data
|
227 |
+
*/
|
228 |
+
public function packCentralDirData()
|
229 |
+
{
|
230 |
+
return $this->packLocalFileData();
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Returns the vendor version.
|
235 |
+
*
|
236 |
+
* @return int
|
237 |
+
*
|
238 |
+
* @see WinZipAesExtraField::VERSION_AE2
|
239 |
+
* @see WinZipAesExtraField::VERSION_AE1
|
240 |
+
*/
|
241 |
+
public function getVendorVersion()
|
242 |
+
{
|
243 |
+
return $this->vendorVersion;
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Sets the vendor version.
|
248 |
+
*
|
249 |
+
* @param int $vendorVersion the vendor version
|
250 |
+
*
|
251 |
+
* @see WinZipAesExtraField::VERSION_AE2
|
252 |
+
* @see WinZipAesExtraField::VERSION_AE1
|
253 |
+
*/
|
254 |
+
public function setVendorVersion($vendorVersion)
|
255 |
+
{
|
256 |
+
$vendorVersion = (int) $vendorVersion;
|
257 |
+
|
258 |
+
if (!\in_array($vendorVersion, self::$allowVendorVersions, true)) {
|
259 |
+
throw new InvalidArgumentException(
|
260 |
+
sprintf(
|
261 |
+
'Unsupport WinZip AES vendor version: %d',
|
262 |
+
$vendorVersion
|
263 |
+
)
|
264 |
+
);
|
265 |
+
}
|
266 |
+
$this->vendorVersion = $vendorVersion;
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Returns vendor id.
|
271 |
+
*
|
272 |
+
* @return int
|
273 |
+
*/
|
274 |
+
public function getVendorId()
|
275 |
+
{
|
276 |
+
return self::VENDOR_ID;
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* @return int
|
281 |
+
*/
|
282 |
+
public function getKeyStrength()
|
283 |
+
{
|
284 |
+
return $this->keyStrength;
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Set key strength.
|
289 |
+
*
|
290 |
+
* @param int $keyStrength
|
291 |
+
*/
|
292 |
+
public function setKeyStrength($keyStrength)
|
293 |
+
{
|
294 |
+
$keyStrength = (int) $keyStrength;
|
295 |
+
|
296 |
+
if (!isset(self::$encryptionStrengths[$keyStrength])) {
|
297 |
+
throw new InvalidArgumentException(
|
298 |
+
sprintf(
|
299 |
+
'Key strength %d not support value. Allow values: %s',
|
300 |
+
$keyStrength,
|
301 |
+
implode(', ', array_keys(self::$encryptionStrengths))
|
302 |
+
)
|
303 |
+
);
|
304 |
+
}
|
305 |
+
$this->keyStrength = $keyStrength;
|
306 |
+
}
|
307 |
+
|
308 |
+
/**
|
309 |
+
* @return int
|
310 |
+
*/
|
311 |
+
public function getCompressionMethod()
|
312 |
+
{
|
313 |
+
return $this->compressionMethod;
|
314 |
+
}
|
315 |
+
|
316 |
+
/**
|
317 |
+
* @param int $compressionMethod
|
318 |
+
*
|
319 |
+
* @throws ZipUnsupportMethodException
|
320 |
+
*/
|
321 |
+
public function setCompressionMethod($compressionMethod)
|
322 |
+
{
|
323 |
+
$compressionMethod = (int) $compressionMethod;
|
324 |
+
ZipCompressionMethod::checkSupport($compressionMethod);
|
325 |
+
$this->compressionMethod = $compressionMethod;
|
326 |
+
}
|
327 |
+
|
328 |
+
/**
|
329 |
+
* @return int
|
330 |
+
*/
|
331 |
+
public function getEncryptionStrength()
|
332 |
+
{
|
333 |
+
return self::$encryptionStrengths[$this->keyStrength];
|
334 |
+
}
|
335 |
+
|
336 |
+
/**
|
337 |
+
* @return int
|
338 |
+
*/
|
339 |
+
public function getEncryptionMethod()
|
340 |
+
{
|
341 |
+
$keyStrength = $this->getKeyStrength();
|
342 |
+
|
343 |
+
if (!isset(self::$MAP_KEY_STRENGTH_METHODS[$keyStrength])) {
|
344 |
+
throw new InvalidArgumentException('Invalid encryption method');
|
345 |
+
}
|
346 |
+
|
347 |
+
return self::$MAP_KEY_STRENGTH_METHODS[$keyStrength];
|
348 |
+
}
|
349 |
+
|
350 |
+
/**
|
351 |
+
* @return bool
|
352 |
+
*/
|
353 |
+
public function isV1()
|
354 |
+
{
|
355 |
+
return $this->vendorVersion === self::VERSION_AE1;
|
356 |
+
}
|
357 |
+
|
358 |
+
/**
|
359 |
+
* @return bool
|
360 |
+
*/
|
361 |
+
public function isV2()
|
362 |
+
{
|
363 |
+
return $this->vendorVersion === self::VERSION_AE2;
|
364 |
+
}
|
365 |
+
|
366 |
+
/**
|
367 |
+
* @return int
|
368 |
+
*/
|
369 |
+
public function getSaltSize()
|
370 |
+
{
|
371 |
+
return (int) ($this->getEncryptionStrength() / 8 / 2);
|
372 |
+
}
|
373 |
+
|
374 |
+
/**
|
375 |
+
* @return string
|
376 |
+
*/
|
377 |
+
public function __toString()
|
378 |
+
{
|
379 |
+
return sprintf(
|
380 |
+
'0x%04x WINZIP AES: VendorVersion=%d KeyStrength=0x%02x CompressionMethod=%s',
|
381 |
+
__CLASS__,
|
382 |
+
$this->vendorVersion,
|
383 |
+
$this->keyStrength,
|
384 |
+
$this->compressionMethod
|
385 |
+
);
|
386 |
+
}
|
387 |
+
}
|
library/vendor/nelexa/zip/src/Model/Extra/Fields/Zip64ExtraField.php
ADDED
@@ -0,0 +1,311 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Extra\Fields;
|
4 |
+
|
5 |
+
use PhpZip\Constants\ZipConstants;
|
6 |
+
use PhpZip\Exception\RuntimeException;
|
7 |
+
use PhpZip\Exception\ZipException;
|
8 |
+
use PhpZip\Model\Extra\ZipExtraField;
|
9 |
+
use PhpZip\Model\ZipEntry;
|
10 |
+
use PhpZip\Util\PackUtil;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* ZIP64 Extra Field.
|
14 |
+
*
|
15 |
+
* @see https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT .ZIP File Format Specification
|
16 |
+
*/
|
17 |
+
class Zip64ExtraField implements ZipExtraField
|
18 |
+
{
|
19 |
+
/** @var int The Header ID for a ZIP64 Extended Information Extra Field. */
|
20 |
+
const HEADER_ID = 0x0001;
|
21 |
+
|
22 |
+
/** @var int|null */
|
23 |
+
private $uncompressedSize;
|
24 |
+
|
25 |
+
/** @var int|null */
|
26 |
+
private $compressedSize;
|
27 |
+
|
28 |
+
/** @var int|null */
|
29 |
+
private $localHeaderOffset;
|
30 |
+
|
31 |
+
/** @var int|null */
|
32 |
+
private $diskStart;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Zip64ExtraField constructor.
|
36 |
+
*
|
37 |
+
* @param int|null $uncompressedSize
|
38 |
+
* @param int|null $compressedSize
|
39 |
+
* @param int|null $localHeaderOffset
|
40 |
+
* @param int|null $diskStart
|
41 |
+
*/
|
42 |
+
public function __construct(
|
43 |
+
$uncompressedSize = null,
|
44 |
+
$compressedSize = null,
|
45 |
+
$localHeaderOffset = null,
|
46 |
+
$diskStart = null
|
47 |
+
) {
|
48 |
+
$this->uncompressedSize = $uncompressedSize;
|
49 |
+
$this->compressedSize = $compressedSize;
|
50 |
+
$this->localHeaderOffset = $localHeaderOffset;
|
51 |
+
$this->diskStart = $diskStart;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Returns the Header ID (type) of this Extra Field.
|
56 |
+
* The Header ID is an unsigned short integer (two bytes)
|
57 |
+
* which must be constant during the life cycle of this object.
|
58 |
+
*
|
59 |
+
* @return int
|
60 |
+
*/
|
61 |
+
public function getHeaderId()
|
62 |
+
{
|
63 |
+
return self::HEADER_ID;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Populate data from this array as if it was in local file data.
|
68 |
+
*
|
69 |
+
* @param string $buffer the buffer to read data from
|
70 |
+
* @param ZipEntry|null $entry
|
71 |
+
*
|
72 |
+
* @throws ZipException on error
|
73 |
+
*
|
74 |
+
* @return Zip64ExtraField
|
75 |
+
*/
|
76 |
+
public static function unpackLocalFileData($buffer, ZipEntry $entry = null)
|
77 |
+
{
|
78 |
+
$length = \strlen($buffer);
|
79 |
+
|
80 |
+
if ($length === 0) {
|
81 |
+
// no local file data at all, may happen if an archive
|
82 |
+
// only holds a ZIP64 extended information extra field
|
83 |
+
// inside the central directory but not inside the local
|
84 |
+
// file header
|
85 |
+
return new self();
|
86 |
+
}
|
87 |
+
|
88 |
+
if ($length < 16) {
|
89 |
+
throw new ZipException(
|
90 |
+
'Zip64 extended information must contain both size values in the local file header.'
|
91 |
+
);
|
92 |
+
}
|
93 |
+
|
94 |
+
$uncompressedSize = PackUtil::unpackLongLE(substr($buffer, 0, 8));
|
95 |
+
$compressedSize = PackUtil::unpackLongLE(substr($buffer, 8, 8));
|
96 |
+
|
97 |
+
return new self($uncompressedSize, $compressedSize);
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Populate data from this array as if it was in central directory data.
|
102 |
+
*
|
103 |
+
* @param string $buffer the buffer to read data from
|
104 |
+
* @param ZipEntry|null $entry
|
105 |
+
*
|
106 |
+
* @throws ZipException
|
107 |
+
*
|
108 |
+
* @return Zip64ExtraField
|
109 |
+
*/
|
110 |
+
public static function unpackCentralDirData($buffer, ZipEntry $entry = null)
|
111 |
+
{
|
112 |
+
if ($entry === null) {
|
113 |
+
throw new RuntimeException('zipEntry is null');
|
114 |
+
}
|
115 |
+
|
116 |
+
$length = \strlen($buffer);
|
117 |
+
$remaining = $length;
|
118 |
+
|
119 |
+
$uncompressedSize = null;
|
120 |
+
$compressedSize = null;
|
121 |
+
$localHeaderOffset = null;
|
122 |
+
$diskStart = null;
|
123 |
+
|
124 |
+
if ($entry->getUncompressedSize() === ZipConstants::ZIP64_MAGIC) {
|
125 |
+
if ($remaining < 8) {
|
126 |
+
throw new ZipException('ZIP64 extension corrupt (no uncompressed size).');
|
127 |
+
}
|
128 |
+
$uncompressedSize = PackUtil::unpackLongLE(substr($buffer, $length - $remaining, 8));
|
129 |
+
$remaining -= 8;
|
130 |
+
}
|
131 |
+
|
132 |
+
if ($entry->getCompressedSize() === ZipConstants::ZIP64_MAGIC) {
|
133 |
+
if ($remaining < 8) {
|
134 |
+
throw new ZipException('ZIP64 extension corrupt (no compressed size).');
|
135 |
+
}
|
136 |
+
$compressedSize = PackUtil::unpackLongLE(substr($buffer, $length - $remaining, 8));
|
137 |
+
$remaining -= 8;
|
138 |
+
}
|
139 |
+
|
140 |
+
if ($entry->getLocalHeaderOffset() === ZipConstants::ZIP64_MAGIC) {
|
141 |
+
if ($remaining < 8) {
|
142 |
+
throw new ZipException('ZIP64 extension corrupt (no relative local header offset).');
|
143 |
+
}
|
144 |
+
$localHeaderOffset = PackUtil::unpackLongLE(substr($buffer, $length - $remaining, 8));
|
145 |
+
$remaining -= 8;
|
146 |
+
}
|
147 |
+
|
148 |
+
if ($remaining === 4) {
|
149 |
+
$diskStart = unpack('V', substr($buffer, $length - $remaining, 4))[1];
|
150 |
+
}
|
151 |
+
|
152 |
+
return new self($uncompressedSize, $compressedSize, $localHeaderOffset, $diskStart);
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* The actual data to put into local file data - without Header-ID
|
157 |
+
* or length specifier.
|
158 |
+
*
|
159 |
+
* @return string the data
|
160 |
+
*/
|
161 |
+
public function packLocalFileData()
|
162 |
+
{
|
163 |
+
if ($this->uncompressedSize !== null || $this->compressedSize !== null) {
|
164 |
+
if ($this->uncompressedSize === null || $this->compressedSize === null) {
|
165 |
+
throw new \InvalidArgumentException(
|
166 |
+
'Zip64 extended information must contain both size values in the local file header.'
|
167 |
+
);
|
168 |
+
}
|
169 |
+
|
170 |
+
return $this->packSizes();
|
171 |
+
}
|
172 |
+
|
173 |
+
return '';
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* @return string
|
178 |
+
*/
|
179 |
+
private function packSizes()
|
180 |
+
{
|
181 |
+
$data = '';
|
182 |
+
|
183 |
+
if ($this->uncompressedSize !== null) {
|
184 |
+
$data .= PackUtil::packLongLE($this->uncompressedSize);
|
185 |
+
}
|
186 |
+
|
187 |
+
if ($this->compressedSize !== null) {
|
188 |
+
$data .= PackUtil::packLongLE($this->compressedSize);
|
189 |
+
}
|
190 |
+
|
191 |
+
return $data;
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* The actual data to put into central directory - without Header-ID or
|
196 |
+
* length specifier.
|
197 |
+
*
|
198 |
+
* @return string the data
|
199 |
+
*/
|
200 |
+
public function packCentralDirData()
|
201 |
+
{
|
202 |
+
$data = $this->packSizes();
|
203 |
+
|
204 |
+
if ($this->localHeaderOffset !== null) {
|
205 |
+
$data .= PackUtil::packLongLE($this->localHeaderOffset);
|
206 |
+
}
|
207 |
+
|
208 |
+
if ($this->diskStart !== null) {
|
209 |
+
$data .= pack('V', $this->diskStart);
|
210 |
+
}
|
211 |
+
|
212 |
+
return $data;
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* @return int|null
|
217 |
+
*/
|
218 |
+
public function getUncompressedSize()
|
219 |
+
{
|
220 |
+
return $this->uncompressedSize;
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* @param int|null $uncompressedSize
|
225 |
+
*/
|
226 |
+
public function setUncompressedSize($uncompressedSize)
|
227 |
+
{
|
228 |
+
$this->uncompressedSize = $uncompressedSize;
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* @return int|null
|
233 |
+
*/
|
234 |
+
public function getCompressedSize()
|
235 |
+
{
|
236 |
+
return $this->compressedSize;
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* @param int|null $compressedSize
|
241 |
+
*/
|
242 |
+
public function setCompressedSize($compressedSize)
|
243 |
+
{
|
244 |
+
$this->compressedSize = $compressedSize;
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* @return int|null
|
249 |
+
*/
|
250 |
+
public function getLocalHeaderOffset()
|
251 |
+
{
|
252 |
+
return $this->localHeaderOffset;
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* @param int|null $localHeaderOffset
|
257 |
+
*/
|
258 |
+
public function setLocalHeaderOffset($localHeaderOffset)
|
259 |
+
{
|
260 |
+
$this->localHeaderOffset = $localHeaderOffset;
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* @return int|null
|
265 |
+
*/
|
266 |
+
public function getDiskStart()
|
267 |
+
{
|
268 |
+
return $this->diskStart;
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* @param int|null $diskStart
|
273 |
+
*/
|
274 |
+
public function setDiskStart($diskStart)
|
275 |
+
{
|
276 |
+
$this->diskStart = $diskStart;
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* @return string
|
281 |
+
*/
|
282 |
+
public function __toString()
|
283 |
+
{
|
284 |
+
$args = [self::HEADER_ID];
|
285 |
+
$format = '0x%04x ZIP64: ';
|
286 |
+
$formats = [];
|
287 |
+
|
288 |
+
if ($this->uncompressedSize !== null) {
|
289 |
+
$formats[] = 'SIZE=%d';
|
290 |
+
$args[] = $this->uncompressedSize;
|
291 |
+
}
|
292 |
+
|
293 |
+
if ($this->compressedSize !== null) {
|
294 |
+
$formats[] = 'COMP_SIZE=%d';
|
295 |
+
$args[] = $this->compressedSize;
|
296 |
+
}
|
297 |
+
|
298 |
+
if ($this->localHeaderOffset !== null) {
|
299 |
+
$formats[] = 'OFFSET=%d';
|
300 |
+
$args[] = $this->localHeaderOffset;
|
301 |
+
}
|
302 |
+
|
303 |
+
if ($this->diskStart !== null) {
|
304 |
+
$formats[] = 'DISK_START=%d';
|
305 |
+
$args[] = $this->diskStart;
|
306 |
+
}
|
307 |
+
$format .= implode(' ', $formats);
|
308 |
+
|
309 |
+
return vsprintf($format, $args);
|
310 |
+
}
|
311 |
+
}
|
library/vendor/nelexa/zip/src/Model/Extra/ZipExtraDriver.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Extra;
|
4 |
+
|
5 |
+
use PhpZip\Exception\InvalidArgumentException;
|
6 |
+
use PhpZip\Model\Extra\Fields\ApkAlignmentExtraField;
|
7 |
+
use PhpZip\Model\Extra\Fields\AsiExtraField;
|
8 |
+
use PhpZip\Model\Extra\Fields\ExtendedTimestampExtraField;
|
9 |
+
use PhpZip\Model\Extra\Fields\JarMarkerExtraField;
|
10 |
+
use PhpZip\Model\Extra\Fields\NewUnixExtraField;
|
11 |
+
use PhpZip\Model\Extra\Fields\NtfsExtraField;
|
12 |
+
use PhpZip\Model\Extra\Fields\OldUnixExtraField;
|
13 |
+
use PhpZip\Model\Extra\Fields\UnicodeCommentExtraField;
|
14 |
+
use PhpZip\Model\Extra\Fields\UnicodePathExtraField;
|
15 |
+
use PhpZip\Model\Extra\Fields\WinZipAesExtraField;
|
16 |
+
use PhpZip\Model\Extra\Fields\Zip64ExtraField;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Class ZipExtraManager.
|
20 |
+
*/
|
21 |
+
final class ZipExtraDriver
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* @var array<int, string>
|
25 |
+
* @psalm-var array<int, class-string<\PhpZip\Model\Extra\ZipExtraField>>
|
26 |
+
*/
|
27 |
+
private static $implementations = [
|
28 |
+
ApkAlignmentExtraField::HEADER_ID => ApkAlignmentExtraField::class,
|
29 |
+
AsiExtraField::HEADER_ID => AsiExtraField::class,
|
30 |
+
ExtendedTimestampExtraField::HEADER_ID => ExtendedTimestampExtraField::class,
|
31 |
+
JarMarkerExtraField::HEADER_ID => JarMarkerExtraField::class,
|
32 |
+
NewUnixExtraField::HEADER_ID => NewUnixExtraField::class,
|
33 |
+
NtfsExtraField::HEADER_ID => NtfsExtraField::class,
|
34 |
+
OldUnixExtraField::HEADER_ID => OldUnixExtraField::class,
|
35 |
+
UnicodeCommentExtraField::HEADER_ID => UnicodeCommentExtraField::class,
|
36 |
+
UnicodePathExtraField::HEADER_ID => UnicodePathExtraField::class,
|
37 |
+
WinZipAesExtraField::HEADER_ID => WinZipAesExtraField::class,
|
38 |
+
Zip64ExtraField::HEADER_ID => Zip64ExtraField::class,
|
39 |
+
];
|
40 |
+
|
41 |
+
private function __construct()
|
42 |
+
{
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @param string|ZipExtraField $extraField ZipExtraField object or class name
|
47 |
+
*/
|
48 |
+
public static function register($extraField)
|
49 |
+
{
|
50 |
+
if (!is_a($extraField, ZipExtraField::class, true)) {
|
51 |
+
throw new InvalidArgumentException(
|
52 |
+
sprintf(
|
53 |
+
'$extraField "%s" is not implements interface %s',
|
54 |
+
(string) $extraField,
|
55 |
+
ZipExtraField::class
|
56 |
+
)
|
57 |
+
);
|
58 |
+
}
|
59 |
+
self::$implementations[\call_user_func([$extraField, 'getHeaderId'])] = $extraField;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @param int|string|ZipExtraField $extraType ZipExtraField object or class name or extra header id
|
64 |
+
*
|
65 |
+
* @return bool
|
66 |
+
*/
|
67 |
+
public static function unregister($extraType)
|
68 |
+
{
|
69 |
+
$headerId = null;
|
70 |
+
|
71 |
+
if (\is_int($extraType)) {
|
72 |
+
$headerId = $extraType;
|
73 |
+
} elseif (is_a($extraType, ZipExtraField::class, true)) {
|
74 |
+
$headerId = \call_user_func([$extraType, 'getHeaderId']);
|
75 |
+
} else {
|
76 |
+
return false;
|
77 |
+
}
|
78 |
+
|
79 |
+
if (isset(self::$implementations[$headerId])) {
|
80 |
+
unset(self::$implementations[$headerId]);
|
81 |
+
|
82 |
+
return true;
|
83 |
+
}
|
84 |
+
|
85 |
+
return false;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @param int $headerId
|
90 |
+
*
|
91 |
+
* @return string|null
|
92 |
+
*/
|
93 |
+
public static function getClassNameOrNull($headerId)
|
94 |
+
{
|
95 |
+
$headerId = (int) $headerId;
|
96 |
+
|
97 |
+
if ($headerId < 0 || $headerId > 0xffff) {
|
98 |
+
throw new \InvalidArgumentException('$headerId out of range: ' . $headerId);
|
99 |
+
}
|
100 |
+
|
101 |
+
if (isset(self::$implementations[$headerId])) {
|
102 |
+
return self::$implementations[$headerId];
|
103 |
+
}
|
104 |
+
|
105 |
+
return null;
|
106 |
+
}
|
107 |
+
}
|
library/vendor/nelexa/zip/src/Model/Extra/ZipExtraField.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model\Extra;
|
4 |
+
|
5 |
+
use PhpZip\Model\ZipEntry;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Extra Field in a Local or Central Header of a ZIP archive.
|
9 |
+
* It defines the common properties of all Extra Fields and how to
|
10 |
+
* serialize/unserialize them to/from byte arrays.
|
11 |
+
*/
|
12 |
+
interface ZipExtraField
|
13 |
+
{
|
14 |
+
/**
|
15 |
+
* Returns the Header ID (type) of this Extra Field.
|
16 |
+
* The Header ID is an unsigned short integer (two bytes)
|
17 |
+
* which must be constant during the life cycle of this object.
|
18 |
+
*
|
19 |
+
* @return int
|
20 |
+
*/
|
21 |
+
public function getHeaderId();
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Populate data from this array as if it was in local file data.
|
25 |
+
*
|
26 |
+
* @param string $buffer the buffer to read data from
|
27 |
+
* @param ZipEntry|null $entry
|
28 |
+
*
|
29 |
+
* @return static
|
30 |
+
*/
|
31 |
+
public static function unpackLocalFileData($buffer, ZipEntry $entry = null);
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Populate data from this array as if it was in central directory data.
|
35 |
+
*
|
36 |
+
* @param string $buffer the buffer to read data from
|
37 |
+
* @param ZipEntry|null $entry
|
38 |
+
*
|
39 |
+
* @return static
|
40 |
+
*/
|
41 |
+
public static function unpackCentralDirData($buffer, ZipEntry $entry = null);
|
42 |
+
|
43 |
+
/**
|
44 |
+
* The actual data to put into local file data - without Header-ID
|
45 |
+
* or length specifier.
|
46 |
+
*
|
47 |
+
* @return string the data
|
48 |
+
*/
|
49 |
+
public function packLocalFileData();
|
50 |
+
|
51 |
+
/**
|
52 |
+
* The actual data to put into central directory - without Header-ID or
|
53 |
+
* length specifier.
|
54 |
+
*
|
55 |
+
* @return string the data
|
56 |
+
*/
|
57 |
+
public function packCentralDirData();
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @return string
|
61 |
+
*/
|
62 |
+
public function __toString();
|
63 |
+
}
|
library/vendor/nelexa/zip/src/Model/ImmutableZipContainer.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class ImmutableZipContainer.
|
7 |
+
*/
|
8 |
+
class ImmutableZipContainer implements \Countable
|
9 |
+
{
|
10 |
+
/** @var ZipEntry[] */
|
11 |
+
protected $entries;
|
12 |
+
|
13 |
+
/** @var string|null Archive comment */
|
14 |
+
protected $archiveComment;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* ZipContainer constructor.
|
18 |
+
*
|
19 |
+
* @param ZipEntry[] $entries
|
20 |
+
* @param string|null $archiveComment
|
21 |
+
*/
|
22 |
+
public function __construct(array $entries, $archiveComment)
|
23 |
+
{
|
24 |
+
$this->entries = $entries;
|
25 |
+
$this->archiveComment = $archiveComment;
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @return ZipEntry[]
|
30 |
+
*/
|
31 |
+
public function &getEntries()
|
32 |
+
{
|
33 |
+
return $this->entries;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @return string|null
|
38 |
+
*/
|
39 |
+
public function getArchiveComment()
|
40 |
+
{
|
41 |
+
return $this->archiveComment;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Count elements of an object.
|
46 |
+
*
|
47 |
+
* @see https://php.net/manual/en/countable.count.php
|
48 |
+
*
|
49 |
+
* @return int The custom count as an integer.
|
50 |
+
* The return value is cast to an integer.
|
51 |
+
*/
|
52 |
+
public function count()
|
53 |
+
{
|
54 |
+
return \count($this->entries);
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* When an object is cloned, PHP 5 will perform a shallow copy of all of the object's properties.
|
59 |
+
* Any properties that are references to other variables, will remain references.
|
60 |
+
* Once the cloning is complete, if a __clone() method is defined,
|
61 |
+
* then the newly created object's __clone() method will be called, to allow any necessary properties that need to
|
62 |
+
* be changed. NOT CALLABLE DIRECTLY.
|
63 |
+
*
|
64 |
+
* @see https://php.net/manual/en/language.oop5.cloning.php
|
65 |
+
*/
|
66 |
+
public function __clone()
|
67 |
+
{
|
68 |
+
foreach ($this->entries as $key => $value) {
|
69 |
+
$this->entries[$key] = clone $value;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}
|
library/vendor/nelexa/zip/src/Model/ZipContainer.php
ADDED
@@ -0,0 +1,386 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model;
|
4 |
+
|
5 |
+
use PhpZip\Constants\ZipEncryptionMethod;
|
6 |
+
use PhpZip\Exception\InvalidArgumentException;
|
7 |
+
use PhpZip\Exception\ZipEntryNotFoundException;
|
8 |
+
use PhpZip\Exception\ZipException;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Class ZipContainer.
|
12 |
+
*/
|
13 |
+
class ZipContainer extends ImmutableZipContainer
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* @var ImmutableZipContainer|null The source container contains zip entries from
|
17 |
+
* an open zip archive. The source container makes
|
18 |
+
* it possible to undo changes in the archive.
|
19 |
+
* When cloning, this container is not cloned.
|
20 |
+
*/
|
21 |
+
private $sourceContainer;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var int|null Apk zipalign value
|
25 |
+
*
|
26 |
+
* @todo remove and use in ApkFileWriter
|
27 |
+
*/
|
28 |
+
private $zipAlign;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* MutableZipContainer constructor.
|
32 |
+
*
|
33 |
+
* @param ImmutableZipContainer|null $sourceContainer
|
34 |
+
*/
|
35 |
+
public function __construct(ImmutableZipContainer $sourceContainer = null)
|
36 |
+
{
|
37 |
+
$entries = [];
|
38 |
+
$archiveComment = null;
|
39 |
+
|
40 |
+
if ($sourceContainer !== null) {
|
41 |
+
foreach ($sourceContainer->getEntries() as $entryName => $entry) {
|
42 |
+
$entries[$entryName] = clone $entry;
|
43 |
+
}
|
44 |
+
$archiveComment = $sourceContainer->getArchiveComment();
|
45 |
+
}
|
46 |
+
parent::__construct($entries, $archiveComment);
|
47 |
+
$this->sourceContainer = $sourceContainer;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @return ImmutableZipContainer|null
|
52 |
+
*/
|
53 |
+
public function getSourceContainer()
|
54 |
+
{
|
55 |
+
return $this->sourceContainer;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @param ZipEntry $entry
|
60 |
+
*/
|
61 |
+
public function addEntry(ZipEntry $entry)
|
62 |
+
{
|
63 |
+
$this->entries[$entry->getName()] = $entry;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @param string|ZipEntry $entry
|
68 |
+
*
|
69 |
+
* @return bool
|
70 |
+
*/
|
71 |
+
public function deleteEntry($entry)
|
72 |
+
{
|
73 |
+
$entry = $entry instanceof ZipEntry ? $entry->getName() : (string) $entry;
|
74 |
+
|
75 |
+
if (isset($this->entries[$entry])) {
|
76 |
+
unset($this->entries[$entry]);
|
77 |
+
|
78 |
+
return true;
|
79 |
+
}
|
80 |
+
|
81 |
+
return false;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* @param string|ZipEntry $old
|
86 |
+
* @param string|ZipEntry $new
|
87 |
+
*
|
88 |
+
* @throws ZipException
|
89 |
+
*
|
90 |
+
* @return ZipEntry New zip entry
|
91 |
+
*/
|
92 |
+
public function renameEntry($old, $new)
|
93 |
+
{
|
94 |
+
$old = $old instanceof ZipEntry ? $old->getName() : (string) $old;
|
95 |
+
$new = $new instanceof ZipEntry ? $new->getName() : (string) $new;
|
96 |
+
|
97 |
+
if (isset($this->entries[$new])) {
|
98 |
+
throw new InvalidArgumentException('New entry name ' . $new . ' is exists.');
|
99 |
+
}
|
100 |
+
|
101 |
+
$entry = $this->getEntry($old);
|
102 |
+
$newEntry = $entry->rename($new);
|
103 |
+
|
104 |
+
$this->deleteEntry($entry);
|
105 |
+
$this->addEntry($newEntry);
|
106 |
+
|
107 |
+
return $newEntry;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* @param string|ZipEntry $entryName
|
112 |
+
*
|
113 |
+
* @throws ZipEntryNotFoundException
|
114 |
+
*
|
115 |
+
* @return ZipEntry
|
116 |
+
*/
|
117 |
+
public function getEntry($entryName)
|
118 |
+
{
|
119 |
+
$entry = $this->getEntryOrNull($entryName);
|
120 |
+
|
121 |
+
if ($entry !== null) {
|
122 |
+
return $entry;
|
123 |
+
}
|
124 |
+
|
125 |
+
throw new ZipEntryNotFoundException($entryName);
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* @param string|ZipEntry $entryName
|
130 |
+
*
|
131 |
+
* @return ZipEntry|null
|
132 |
+
*/
|
133 |
+
public function getEntryOrNull($entryName)
|
134 |
+
{
|
135 |
+
$entryName = $entryName instanceof ZipEntry ? $entryName->getName() : (string) $entryName;
|
136 |
+
|
137 |
+
return isset($this->entries[$entryName]) ? $this->entries[$entryName] : null;
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* @param string|ZipEntry $entryName
|
142 |
+
*
|
143 |
+
* @return bool
|
144 |
+
*/
|
145 |
+
public function hasEntry($entryName)
|
146 |
+
{
|
147 |
+
$entryName = $entryName instanceof ZipEntry ? $entryName->getName() : (string) $entryName;
|
148 |
+
|
149 |
+
return isset($this->entries[$entryName]);
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Delete all entries.
|
154 |
+
*/
|
155 |
+
public function deleteAll()
|
156 |
+
{
|
157 |
+
$this->entries = [];
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Delete entries by regex pattern.
|
162 |
+
*
|
163 |
+
* @param string $regexPattern Regex pattern
|
164 |
+
*
|
165 |
+
* @return ZipEntry[] Deleted entries
|
166 |
+
*/
|
167 |
+
public function deleteByRegex($regexPattern)
|
168 |
+
{
|
169 |
+
if (empty($regexPattern)) {
|
170 |
+
throw new InvalidArgumentException('The regex pattern is not specified');
|
171 |
+
}
|
172 |
+
|
173 |
+
/** @var ZipEntry[] $found */
|
174 |
+
$found = [];
|
175 |
+
|
176 |
+
foreach ($this->entries as $entryName => $entry) {
|
177 |
+
if (preg_match($regexPattern, $entryName)) {
|
178 |
+
$found[] = $entry;
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
foreach ($found as $entry) {
|
183 |
+
$this->deleteEntry($entry);
|
184 |
+
}
|
185 |
+
|
186 |
+
return $found;
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Undo all changes done in the archive.
|
191 |
+
*/
|
192 |
+
public function unchangeAll()
|
193 |
+
{
|
194 |
+
$this->entries = [];
|
195 |
+
|
196 |
+
if ($this->sourceContainer !== null) {
|
197 |
+
foreach ($this->sourceContainer->getEntries() as $entry) {
|
198 |
+
$this->entries[$entry->getName()] = clone $entry;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
$this->unchangeArchiveComment();
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Undo change archive comment.
|
206 |
+
*/
|
207 |
+
public function unchangeArchiveComment()
|
208 |
+
{
|
209 |
+
$this->archiveComment = null;
|
210 |
+
|
211 |
+
if ($this->sourceContainer !== null) {
|
212 |
+
$this->archiveComment = $this->sourceContainer->archiveComment;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Revert all changes done to an entry with the given name.
|
218 |
+
*
|
219 |
+
* @param string|ZipEntry $entry Entry name or ZipEntry
|
220 |
+
*
|
221 |
+
* @return bool
|
222 |
+
*/
|
223 |
+
public function unchangeEntry($entry)
|
224 |
+
{
|
225 |
+
$entry = $entry instanceof ZipEntry ? $entry->getName() : (string) $entry;
|
226 |
+
|
227 |
+
if (
|
228 |
+
$this->sourceContainer !== null &&
|
229 |
+
isset($this->entries[$entry], $this->sourceContainer->entries[$entry])
|
230 |
+
) {
|
231 |
+
$this->entries[$entry] = clone $this->sourceContainer->entries[$entry];
|
232 |
+
|
233 |
+
return true;
|
234 |
+
}
|
235 |
+
|
236 |
+
return false;
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Entries sort by name.
|
241 |
+
*
|
242 |
+
* Example:
|
243 |
+
* ```php
|
244 |
+
* $zipContainer->sortByName(static function (string $nameA, string $nameB): int {
|
245 |
+
* return strcmp($nameA, $nameB);
|
246 |
+
* });
|
247 |
+
* ```
|
248 |
+
*
|
249 |
+
* @param callable $cmp
|
250 |
+
*/
|
251 |
+
public function sortByName(callable $cmp)
|
252 |
+
{
|
253 |
+
uksort($this->entries, $cmp);
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Entries sort by entry.
|
258 |
+
*
|
259 |
+
* Example:
|
260 |
+
* ```php
|
261 |
+
* $zipContainer->sortByEntry(static function (ZipEntry $a, ZipEntry $b): int {
|
262 |
+
* return strcmp($a->getName(), $b->getName());
|
263 |
+
* });
|
264 |
+
* ```
|
265 |
+
*
|
266 |
+
* @param callable $cmp
|
267 |
+
*/
|
268 |
+
public function sortByEntry(callable $cmp)
|
269 |
+
{
|
270 |
+
uasort($this->entries, $cmp);
|
271 |
+
}
|
272 |
+
|
273 |
+
/**
|
274 |
+
* @param string|null $archiveComment
|
275 |
+
*/
|
276 |
+
public function setArchiveComment($archiveComment)
|
277 |
+
{
|
278 |
+
if ($archiveComment !== null && $archiveComment !== '') {
|
279 |
+
$archiveComment = (string) $archiveComment;
|
280 |
+
$length = \strlen($archiveComment);
|
281 |
+
|
282 |
+
if ($length > 0xffff) {
|
283 |
+
throw new InvalidArgumentException('Length comment out of range');
|
284 |
+
}
|
285 |
+
}
|
286 |
+
$this->archiveComment = $archiveComment;
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* @return ZipEntryMatcher
|
291 |
+
*/
|
292 |
+
public function matcher()
|
293 |
+
{
|
294 |
+
return new ZipEntryMatcher($this);
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* Specify a password for extracting files.
|
299 |
+
*
|
300 |
+
* @param string|null $password
|
301 |
+
*/
|
302 |
+
public function setReadPassword($password)
|
303 |
+
{
|
304 |
+
if ($this->sourceContainer !== null) {
|
305 |
+
foreach ($this->sourceContainer->entries as $entry) {
|
306 |
+
if ($entry->isEncrypted()) {
|
307 |
+
$entry->setPassword($password);
|
308 |
+
}
|
309 |
+
}
|
310 |
+
}
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* @param string $entryName
|
315 |
+
* @param string $password
|
316 |
+
*
|
317 |
+
* @throws ZipEntryNotFoundException
|
318 |
+
* @throws ZipException
|
319 |
+
*/
|
320 |
+
public function setReadPasswordEntry($entryName, $password)
|
321 |
+
{
|
322 |
+
if (!isset($this->sourceContainer->entries[$entryName])) {
|
323 |
+
throw new ZipEntryNotFoundException($entryName);
|
324 |
+
}
|
325 |
+
|
326 |
+
if ($this->sourceContainer->entries[$entryName]->isEncrypted()) {
|
327 |
+
$this->sourceContainer->entries[$entryName]->setPassword($password);
|
328 |
+
}
|
329 |
+
}
|
330 |
+
|
331 |
+
/**
|
332 |
+
* @return int|null
|
333 |
+
*/
|
334 |
+
public function getZipAlign()
|
335 |
+
{
|
336 |
+
return $this->zipAlign;
|
337 |
+
}
|
338 |
+
|
339 |
+
/**
|
340 |
+
* @param int|null $zipAlign
|
341 |
+
*/
|
342 |
+
public function setZipAlign($zipAlign)
|
343 |
+
{
|
344 |
+
$this->zipAlign = $zipAlign === null ? null : (int) $zipAlign;
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* @return bool
|
349 |
+
*/
|
350 |
+
public function isZipAlign()
|
351 |
+
{
|
352 |
+
return $this->zipAlign !== null;
|
353 |
+
}
|
354 |
+
|
355 |
+
/**
|
356 |
+
* @param string|null $writePassword
|
357 |
+
*/
|
358 |
+
public function setWritePassword($writePassword)
|
359 |
+
{
|
360 |
+
$this->matcher()->all()->setPassword($writePassword);
|
361 |
+
}
|
362 |
+
|
363 |
+
/**
|
364 |
+
* Remove password.
|
365 |
+
*/
|
366 |
+
public function removePassword()
|
367 |
+
{
|
368 |
+
$this->matcher()->all()->setPassword(null);
|
369 |
+
}
|
370 |
+
|
371 |
+
/**
|
372 |
+
* @param string|ZipEntry $entryName
|
373 |
+
*/
|
374 |
+
public function removePasswordEntry($entryName)
|
375 |
+
{
|
376 |
+
$this->matcher()->add($entryName)->setPassword(null);
|
377 |
+
}
|
378 |
+
|
379 |
+
/**
|
380 |
+
* @param int $encryptionMethod
|
381 |
+
*/
|
382 |
+
public function setEncryptionMethod($encryptionMethod = ZipEncryptionMethod::WINZIP_AES_256)
|
383 |
+
{
|
384 |
+
$this->matcher()->all()->setEncryptionMethod($encryptionMethod);
|
385 |
+
}
|
386 |
+
}
|
library/vendor/nelexa/zip/src/Model/ZipData.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model;
|
4 |
+
|
5 |
+
use PhpZip\Exception\ZipException;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Interface ZipData.
|
9 |
+
*/
|
10 |
+
interface ZipData
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* @return string returns data as string
|
14 |
+
*/
|
15 |
+
public function getDataAsString();
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @return resource returns stream data
|
19 |
+
*/
|
20 |
+
public function getDataAsStream();
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @param resource $outStream
|
24 |
+
*
|
25 |
+
* @throws ZipException
|
26 |
+
*/
|
27 |
+
public function copyDataToStream($outStream);
|
28 |
+
}
|
library/vendor/nelexa/zip/src/Model/ZipEntry.php
ADDED
@@ -0,0 +1,1573 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @noinspection PhpUsageOfSilenceOperatorInspection */
|
4 |
+
|
5 |
+
namespace PhpZip\Model;
|
6 |
+
|
7 |
+
use PhpZip\Constants\DosAttrs;
|
8 |
+
use PhpZip\Constants\DosCodePage;
|
9 |
+
use PhpZip\Constants\GeneralPurposeBitFlag;
|
10 |
+
use PhpZip\Constants\UnixStat;
|
11 |
+
use PhpZip\Constants\ZipCompressionLevel;
|
12 |
+
use PhpZip\Constants\ZipCompressionMethod;
|
13 |
+
use PhpZip\Constants\ZipConstants;
|
14 |
+
use PhpZip\Constants\ZipEncryptionMethod;
|
15 |
+
use PhpZip\Constants\ZipPlatform;
|
16 |
+
use PhpZip\Constants\ZipVersion;
|
17 |
+
use PhpZip\Exception\InvalidArgumentException;
|
18 |
+
use PhpZip\Exception\RuntimeException;
|
19 |
+
use PhpZip\Exception\ZipUnsupportMethodException;
|
20 |
+
use PhpZip\Model\Extra\ExtraFieldsCollection;
|
21 |
+
use PhpZip\Model\Extra\Fields\AsiExtraField;
|
22 |
+
use PhpZip\Model\Extra\Fields\ExtendedTimestampExtraField;
|
23 |
+
use PhpZip\Model\Extra\Fields\NtfsExtraField;
|
24 |
+
use PhpZip\Model\Extra\Fields\OldUnixExtraField;
|
25 |
+
use PhpZip\Model\Extra\Fields\UnicodePathExtraField;
|
26 |
+
use PhpZip\Model\Extra\Fields\WinZipAesExtraField;
|
27 |
+
use PhpZip\Model\Extra\ZipExtraField;
|
28 |
+
use PhpZip\Util\DateTimeConverter;
|
29 |
+
use PhpZip\Util\StringUtil;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* ZIP file entry.
|
33 |
+
*
|
34 |
+
* @see https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT .ZIP File Format Specification
|
35 |
+
*
|
36 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
37 |
+
* @license MIT
|
38 |
+
*/
|
39 |
+
class ZipEntry
|
40 |
+
{
|
41 |
+
/** @var int the unknown value for numeric properties */
|
42 |
+
const UNKNOWN = -1;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @var int DOS platform
|
46 |
+
*
|
47 |
+
* @deprecated Use {@see ZipPlatform::OS_DOS}
|
48 |
+
*/
|
49 |
+
const PLATFORM_FAT = ZipPlatform::OS_DOS;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @var int Unix platform
|
53 |
+
*
|
54 |
+
* @deprecated Use {@see ZipPlatform::OS_UNIX}
|
55 |
+
*/
|
56 |
+
const PLATFORM_UNIX = ZipPlatform::OS_UNIX;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @var int MacOS platform
|
60 |
+
*
|
61 |
+
* @deprecated Use {@see ZipPlatform::OS_MAC_OSX}
|
62 |
+
*/
|
63 |
+
const PLATFORM_OS_X = ZipPlatform::OS_MAC_OSX;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Pseudo compression method for WinZip AES encrypted entries.
|
67 |
+
* Require php extension openssl or mcrypt.
|
68 |
+
*
|
69 |
+
* @deprecated Use {@see ZipCompressionMethod::WINZIP_AES}
|
70 |
+
*/
|
71 |
+
const METHOD_WINZIP_AES = ZipCompressionMethod::WINZIP_AES;
|
72 |
+
|
73 |
+
/** @var string Entry name (filename in archive) */
|
74 |
+
private $name;
|
75 |
+
|
76 |
+
/** @var bool Is directory */
|
77 |
+
private $isDirectory;
|
78 |
+
|
79 |
+
/** @var ZipData|null Zip entry contents */
|
80 |
+
private $data;
|
81 |
+
|
82 |
+
/** @var int Made by platform */
|
83 |
+
private $createdOS = self::UNKNOWN;
|
84 |
+
|
85 |
+
/** @var int Extracted by platform */
|
86 |
+
private $extractedOS = self::UNKNOWN;
|
87 |
+
|
88 |
+
/** @var int Software version */
|
89 |
+
private $softwareVersion = self::UNKNOWN;
|
90 |
+
|
91 |
+
/** @var int Version needed to extract */
|
92 |
+
private $extractVersion = self::UNKNOWN;
|
93 |
+
|
94 |
+
/** @var int Compression method */
|
95 |
+
private $compressionMethod = self::UNKNOWN;
|
96 |
+
|
97 |
+
/** @var int General purpose bit flags */
|
98 |
+
private $generalPurposeBitFlags = 0;
|
99 |
+
|
100 |
+
/** @var int Dos time */
|
101 |
+
private $dosTime = self::UNKNOWN;
|
102 |
+
|
103 |
+
/** @var int Crc32 */
|
104 |
+
private $crc = self::UNKNOWN;
|
105 |
+
|
106 |
+
/** @var int Compressed size */
|
107 |
+
private $compressedSize = self::UNKNOWN;
|
108 |
+
|
109 |
+
/** @var int Uncompressed size */
|
110 |
+
private $uncompressedSize = self::UNKNOWN;
|
111 |
+
|
112 |
+
/** @var int Internal attributes */
|
113 |
+
private $internalAttributes = 0;
|
114 |
+
|
115 |
+
/** @var int External attributes */
|
116 |
+
private $externalAttributes = 0;
|
117 |
+
|
118 |
+
/** @var int relative Offset Of Local File Header */
|
119 |
+
private $localHeaderOffset = 0;
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Collections of Extra Fields in Central Directory.
|
123 |
+
* Keys from Header ID [int] and value Extra Field [ExtraField].
|
124 |
+
*
|
125 |
+
* @var ExtraFieldsCollection
|
126 |
+
*/
|
127 |
+
protected $cdExtraFields;
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Collections of Extra Fields int local header.
|
131 |
+
* Keys from Header ID [int] and value Extra Field [ExtraField].
|
132 |
+
*
|
133 |
+
* @var ExtraFieldsCollection
|
134 |
+
*/
|
135 |
+
protected $localExtraFields;
|
136 |
+
|
137 |
+
/** @var string|null comment field */
|
138 |
+
private $comment;
|
139 |
+
|
140 |
+
/** @var string|null entry password for read or write encryption data */
|
141 |
+
private $password;
|
142 |
+
|
143 |
+
/** @var int encryption method */
|
144 |
+
private $encryptionMethod = ZipEncryptionMethod::NONE;
|
145 |
+
|
146 |
+
/** @var int */
|
147 |
+
private $compressionLevel = ZipCompressionLevel::NORMAL;
|
148 |
+
|
149 |
+
/** @var string|null */
|
150 |
+
private $charset;
|
151 |
+
|
152 |
+
/**
|
153 |
+
* ZipEntry constructor.
|
154 |
+
*
|
155 |
+
* @param string $name Entry name
|
156 |
+
* @param string|null $charset DOS charset
|
157 |
+
*/
|
158 |
+
public function __construct($name, $charset = null)
|
159 |
+
{
|
160 |
+
$this->setName($name, $charset);
|
161 |
+
|
162 |
+
$this->cdExtraFields = new ExtraFieldsCollection();
|
163 |
+
$this->localExtraFields = new ExtraFieldsCollection();
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* This method only internal use.
|
168 |
+
*
|
169 |
+
* @param string $name
|
170 |
+
* @param int $createdOS
|
171 |
+
* @param int $extractedOS
|
172 |
+
* @param int $softwareVersion
|
173 |
+
* @param int $extractVersion
|
174 |
+
* @param int $compressionMethod
|
175 |
+
* @param int $gpbf
|
176 |
+
* @param int $dosTime
|
177 |
+
* @param int $crc
|
178 |
+
* @param int $compressedSize
|
179 |
+
* @param int $uncompressedSize
|
180 |
+
* @param int $internalAttributes
|
181 |
+
* @param int $externalAttributes
|
182 |
+
* @param int $offsetLocalHeader
|
183 |
+
* @param string|null $comment
|
184 |
+
* @param string|null $charset
|
185 |
+
*
|
186 |
+
* @return ZipEntry
|
187 |
+
*
|
188 |
+
* @internal
|
189 |
+
*
|
190 |
+
* @noinspection PhpTooManyParametersInspection
|
191 |
+
*/
|
192 |
+
public static function create(
|
193 |
+
$name,
|
194 |
+
$createdOS,
|
195 |
+
$extractedOS,
|
196 |
+
$softwareVersion,
|
197 |
+
$extractVersion,
|
198 |
+
$compressionMethod,
|
199 |
+
$gpbf,
|
200 |
+
$dosTime,
|
201 |
+
$crc,
|
202 |
+
$compressedSize,
|
203 |
+
$uncompressedSize,
|
204 |
+
$internalAttributes,
|
205 |
+
$externalAttributes,
|
206 |
+
$offsetLocalHeader,
|
207 |
+
$comment,
|
208 |
+
$charset
|
209 |
+
) {
|
210 |
+
$entry = new self($name);
|
211 |
+
$entry->createdOS = (int) $createdOS;
|
212 |
+
$entry->extractedOS = (int) $extractedOS;
|
213 |
+
$entry->softwareVersion = (int) $softwareVersion;
|
214 |
+
$entry->extractVersion = (int) $extractVersion;
|
215 |
+
$entry->compressionMethod = (int) $compressionMethod;
|
216 |
+
$entry->generalPurposeBitFlags = (int) $gpbf;
|
217 |
+
$entry->dosTime = (int) $dosTime;
|
218 |
+
$entry->crc = (int) $crc;
|
219 |
+
$entry->compressedSize = (int) $compressedSize;
|
220 |
+
$entry->uncompressedSize = (int) $uncompressedSize;
|
221 |
+
$entry->internalAttributes = (int) $internalAttributes;
|
222 |
+
$entry->externalAttributes = (int) $externalAttributes;
|
223 |
+
$entry->localHeaderOffset = (int) $offsetLocalHeader;
|
224 |
+
$entry->setComment($comment);
|
225 |
+
$entry->setCharset($charset);
|
226 |
+
$entry->updateCompressionLevel();
|
227 |
+
|
228 |
+
return $entry;
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Set entry name.
|
233 |
+
*
|
234 |
+
* @param string $name New entry name
|
235 |
+
* @param string|null $charset
|
236 |
+
*
|
237 |
+
* @return ZipEntry
|
238 |
+
*/
|
239 |
+
private function setName($name, $charset = null)
|
240 |
+
{
|
241 |
+
if ($name === null) {
|
242 |
+
throw new InvalidArgumentException('zip entry name is null');
|
243 |
+
}
|
244 |
+
|
245 |
+
$name = ltrim((string) $name, '\\/');
|
246 |
+
|
247 |
+
if ($name === '') {
|
248 |
+
throw new InvalidArgumentException('Empty zip entry name');
|
249 |
+
}
|
250 |
+
|
251 |
+
$name = (string) $name;
|
252 |
+
$length = \strlen($name);
|
253 |
+
|
254 |
+
if ($length > 0xffff) {
|
255 |
+
throw new InvalidArgumentException('Illegal zip entry name parameter');
|
256 |
+
}
|
257 |
+
|
258 |
+
$this->setCharset($charset);
|
259 |
+
|
260 |
+
if ($this->charset === null && !StringUtil::isASCII($name)) {
|
261 |
+
$this->enableUtf8Name(true);
|
262 |
+
}
|
263 |
+
$this->name = $name;
|
264 |
+
$this->isDirectory = ($length = \strlen($name)) >= 1 && $name[$length - 1] === '/';
|
265 |
+
$this->externalAttributes = $this->isDirectory ? DosAttrs::DOS_DIRECTORY : DosAttrs::DOS_ARCHIVE;
|
266 |
+
|
267 |
+
if ($this->extractVersion !== self::UNKNOWN) {
|
268 |
+
$this->extractVersion = max(
|
269 |
+
$this->extractVersion,
|
270 |
+
$this->isDirectory ?
|
271 |
+
ZipVersion::v20_DEFLATED_FOLDER_ZIPCRYPTO :
|
272 |
+
ZipVersion::v10_DEFAULT_MIN
|
273 |
+
);
|
274 |
+
}
|
275 |
+
|
276 |
+
return $this;
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* @param string|null $charset
|
281 |
+
*
|
282 |
+
* @return ZipEntry
|
283 |
+
*
|
284 |
+
* @see DosCodePage::getCodePages()
|
285 |
+
*/
|
286 |
+
public function setCharset($charset = null)
|
287 |
+
{
|
288 |
+
if ($charset !== null && $charset === '') {
|
289 |
+
throw new InvalidArgumentException('Empty charset');
|
290 |
+
}
|
291 |
+
$this->charset = $charset;
|
292 |
+
|
293 |
+
return $this;
|
294 |
+
}
|
295 |
+
|
296 |
+
/**
|
297 |
+
* @return string|null
|
298 |
+
*/
|
299 |
+
public function getCharset()
|
300 |
+
{
|
301 |
+
return $this->charset;
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* @param string $newName New entry name
|
306 |
+
*
|
307 |
+
* @return ZipEntry new {@see ZipEntry} object with new name
|
308 |
+
*
|
309 |
+
* @internal
|
310 |
+
*/
|
311 |
+
public function rename($newName)
|
312 |
+
{
|
313 |
+
$newEntry = clone $this;
|
314 |
+
$newEntry->setName($newName);
|
315 |
+
|
316 |
+
$newEntry->removeExtraField(UnicodePathExtraField::HEADER_ID);
|
317 |
+
|
318 |
+
return $newEntry;
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Returns the ZIP entry name.
|
323 |
+
*
|
324 |
+
* @return string
|
325 |
+
*/
|
326 |
+
public function getName()
|
327 |
+
{
|
328 |
+
return $this->name;
|
329 |
+
}
|
330 |
+
|
331 |
+
/**
|
332 |
+
* @return ZipData|null
|
333 |
+
*
|
334 |
+
* @internal
|
335 |
+
*/
|
336 |
+
public function getData()
|
337 |
+
{
|
338 |
+
return $this->data;
|
339 |
+
}
|
340 |
+
|
341 |
+
/**
|
342 |
+
* @param ZipData|null $data
|
343 |
+
*
|
344 |
+
* @internal
|
345 |
+
*/
|
346 |
+
public function setData($data)
|
347 |
+
{
|
348 |
+
$this->data = $data;
|
349 |
+
}
|
350 |
+
|
351 |
+
/**
|
352 |
+
* @return int Get platform
|
353 |
+
*
|
354 |
+
* @deprecated Use {@see ZipEntry::getCreatedOS()}
|
355 |
+
*/
|
356 |
+
public function getPlatform()
|
357 |
+
{
|
358 |
+
@trigger_error(__METHOD__ . ' is deprecated. Use ' . __CLASS__ . '::getCreatedOS()', \E_USER_DEPRECATED);
|
359 |
+
|
360 |
+
return $this->getCreatedOS();
|
361 |
+
}
|
362 |
+
|
363 |
+
/**
|
364 |
+
* @param int $platform
|
365 |
+
*
|
366 |
+
* @return ZipEntry
|
367 |
+
*
|
368 |
+
* @deprecated Use {@see ZipEntry::setCreatedOS()}
|
369 |
+
*/
|
370 |
+
public function setPlatform($platform)
|
371 |
+
{
|
372 |
+
@trigger_error(__METHOD__ . ' is deprecated. Use ' . __CLASS__ . '::setCreatedOS()', \E_USER_DEPRECATED);
|
373 |
+
|
374 |
+
return $this->setCreatedOS($platform);
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* @return int platform
|
379 |
+
*/
|
380 |
+
public function getCreatedOS()
|
381 |
+
{
|
382 |
+
return $this->createdOS;
|
383 |
+
}
|
384 |
+
|
385 |
+
/**
|
386 |
+
* Set platform.
|
387 |
+
*
|
388 |
+
* @param int $platform
|
389 |
+
*
|
390 |
+
* @return ZipEntry
|
391 |
+
*/
|
392 |
+
public function setCreatedOS($platform)
|
393 |
+
{
|
394 |
+
$platform = (int) $platform;
|
395 |
+
|
396 |
+
if ($platform < 0x00 || $platform > 0xff) {
|
397 |
+
throw new InvalidArgumentException('Platform out of range');
|
398 |
+
}
|
399 |
+
$this->createdOS = $platform;
|
400 |
+
|
401 |
+
return $this;
|
402 |
+
}
|
403 |
+
|
404 |
+
/**
|
405 |
+
* @return int
|
406 |
+
*/
|
407 |
+
public function getExtractedOS()
|
408 |
+
{
|
409 |
+
return $this->extractedOS;
|
410 |
+
}
|
411 |
+
|
412 |
+
/**
|
413 |
+
* Set extracted OS.
|
414 |
+
*
|
415 |
+
* @param int $platform
|
416 |
+
*
|
417 |
+
* @return ZipEntry
|
418 |
+
*/
|
419 |
+
public function setExtractedOS($platform)
|
420 |
+
{
|
421 |
+
$platform = (int) $platform;
|
422 |
+
|
423 |
+
if ($platform < 0x00 || $platform > 0xff) {
|
424 |
+
throw new InvalidArgumentException('Platform out of range');
|
425 |
+
}
|
426 |
+
$this->extractedOS = $platform;
|
427 |
+
|
428 |
+
return $this;
|
429 |
+
}
|
430 |
+
|
431 |
+
/**
|
432 |
+
* @return int
|
433 |
+
*/
|
434 |
+
public function getSoftwareVersion()
|
435 |
+
{
|
436 |
+
if ($this->softwareVersion === self::UNKNOWN) {
|
437 |
+
return $this->getExtractVersion();
|
438 |
+
}
|
439 |
+
|
440 |
+
return $this->softwareVersion;
|
441 |
+
}
|
442 |
+
|
443 |
+
/**
|
444 |
+
* @param int $softwareVersion
|
445 |
+
*
|
446 |
+
* @return ZipEntry
|
447 |
+
*/
|
448 |
+
public function setSoftwareVersion($softwareVersion)
|
449 |
+
{
|
450 |
+
$this->softwareVersion = (int) $softwareVersion;
|
451 |
+
|
452 |
+
return $this;
|
453 |
+
}
|
454 |
+
|
455 |
+
/**
|
456 |
+
* Version needed to extract.
|
457 |
+
*
|
458 |
+
* @return int
|
459 |
+
*
|
460 |
+
* @deprecated Use {@see ZipEntry::getExtractVersion()}
|
461 |
+
*/
|
462 |
+
public function getVersionNeededToExtract()
|
463 |
+
{
|
464 |
+
@trigger_error(__METHOD__ . ' is deprecated. Use ' . __CLASS__ . '::getExtractVersion()', \E_USER_DEPRECATED);
|
465 |
+
|
466 |
+
return $this->getExtractVersion();
|
467 |
+
}
|
468 |
+
|
469 |
+
/**
|
470 |
+
* Version needed to extract.
|
471 |
+
*
|
472 |
+
* @return int
|
473 |
+
*/
|
474 |
+
public function getExtractVersion()
|
475 |
+
{
|
476 |
+
if ($this->extractVersion === self::UNKNOWN) {
|
477 |
+
if (ZipEncryptionMethod::isWinZipAesMethod($this->encryptionMethod)) {
|
478 |
+
return ZipVersion::v51_ENCR_AES_RC2_CORRECT;
|
479 |
+
}
|
480 |
+
|
481 |
+
if ($this->compressionMethod === ZipCompressionMethod::BZIP2) {
|
482 |
+
return ZipVersion::v46_BZIP2;
|
483 |
+
}
|
484 |
+
|
485 |
+
if ($this->isZip64ExtensionsRequired()) {
|
486 |
+
return ZipVersion::v45_ZIP64_EXT;
|
487 |
+
}
|
488 |
+
|
489 |
+
if (
|
490 |
+
$this->compressionMethod === ZipCompressionMethod::DEFLATED ||
|
491 |
+
$this->isDirectory ||
|
492 |
+
$this->encryptionMethod === ZipEncryptionMethod::PKWARE
|
493 |
+
) {
|
494 |
+
return ZipVersion::v20_DEFLATED_FOLDER_ZIPCRYPTO;
|
495 |
+
}
|
496 |
+
|
497 |
+
return ZipVersion::v10_DEFAULT_MIN;
|
498 |
+
}
|
499 |
+
|
500 |
+
return $this->extractVersion;
|
501 |
+
}
|
502 |
+
|
503 |
+
/**
|
504 |
+
* Set version needed to extract.
|
505 |
+
*
|
506 |
+
* @param int $version
|
507 |
+
*
|
508 |
+
* @return ZipEntry
|
509 |
+
*
|
510 |
+
* @deprecated Use {@see ZipEntry::setExtractVersion()}
|
511 |
+
*/
|
512 |
+
public function setVersionNeededToExtract($version)
|
513 |
+
{
|
514 |
+
@trigger_error(__METHOD__ . ' is deprecated. Use ' . __CLASS__ . '::setExtractVersion()', \E_USER_DEPRECATED);
|
515 |
+
|
516 |
+
return $this->setExtractVersion($version);
|
517 |
+
}
|
518 |
+
|
519 |
+
/**
|
520 |
+
* Set version needed to extract.
|
521 |
+
*
|
522 |
+
* @param int $version
|
523 |
+
*
|
524 |
+
* @return ZipEntry
|
525 |
+
*/
|
526 |
+
public function setExtractVersion($version)
|
527 |
+
{
|
528 |
+
$this->extractVersion = max(ZipVersion::v10_DEFAULT_MIN, (int) $version);
|
529 |
+
|
530 |
+
return $this;
|
531 |
+
}
|
532 |
+
|
533 |
+
/**
|
534 |
+
* Returns the compressed size of this entry.
|
535 |
+
*
|
536 |
+
* @return int
|
537 |
+
*/
|
538 |
+
public function getCompressedSize()
|
539 |
+
{
|
540 |
+
return $this->compressedSize;
|
541 |
+
}
|
542 |
+
|
543 |
+
/**
|
544 |
+
* Sets the compressed size of this entry.
|
545 |
+
*
|
546 |
+
* @param int $compressedSize the Compressed Size
|
547 |
+
*
|
548 |
+
* @return ZipEntry
|
549 |
+
*
|
550 |
+
* @internal
|
551 |
+
*/
|
552 |
+
public function setCompressedSize($compressedSize)
|
553 |
+
{
|
554 |
+
$compressedSize = (int) $compressedSize;
|
555 |
+
|
556 |
+
if ($compressedSize < self::UNKNOWN) {
|
557 |
+
throw new InvalidArgumentException('Compressed size < ' . self::UNKNOWN);
|
558 |
+
}
|
559 |
+
$this->compressedSize = $compressedSize;
|
560 |
+
|
561 |
+
return $this;
|
562 |
+
}
|
563 |
+
|
564 |
+
/**
|
565 |
+
* Returns the uncompressed size of this entry.
|
566 |
+
*
|
567 |
+
* @return int
|
568 |
+
*
|
569 |
+
* @deprecated Use {@see ZipEntry::getUncompressedSize()}
|
570 |
+
*/
|
571 |
+
public function getSize()
|
572 |
+
{
|
573 |
+
@trigger_error(__METHOD__ . ' is deprecated. Use ' . __CLASS__ . '::getUncompressedSize()', \E_USER_DEPRECATED);
|
574 |
+
|
575 |
+
return $this->getUncompressedSize();
|
576 |
+
}
|
577 |
+
|
578 |
+
/**
|
579 |
+
* Sets the uncompressed size of this entry.
|
580 |
+
*
|
581 |
+
* @param int $size the (Uncompressed) Size
|
582 |
+
*
|
583 |
+
* @return ZipEntry
|
584 |
+
*
|
585 |
+
* @deprecated Use {@see ZipEntry::setUncompressedSize()}
|
586 |
+
*
|
587 |
+
* @internal
|
588 |
+
*/
|
589 |
+
public function setSize($size)
|
590 |
+
{
|
591 |
+
@trigger_error(__METHOD__ . ' is deprecated. Use ' . __CLASS__ . '::setUncompressedSize()', \E_USER_DEPRECATED);
|
592 |
+
|
593 |
+
return $this->setUncompressedSize($size);
|
594 |
+
}
|
595 |
+
|
596 |
+
/**
|
597 |
+
* Returns the uncompressed size of this entry.
|
598 |
+
*
|
599 |
+
* @return int
|
600 |
+
*/
|
601 |
+
public function getUncompressedSize()
|
602 |
+
{
|
603 |
+
return $this->uncompressedSize;
|
604 |
+
}
|
605 |
+
|
606 |
+
/**
|
607 |
+
* Sets the uncompressed size of this entry.
|
608 |
+
*
|
609 |
+
* @param int $uncompressedSize the (Uncompressed) Size
|
610 |
+
*
|
611 |
+
* @return ZipEntry
|
612 |
+
*
|
613 |
+
* @internal
|
614 |
+
*/
|
615 |
+
public function setUncompressedSize($uncompressedSize)
|
616 |
+
{
|
617 |
+
$uncompressedSize = (int) $uncompressedSize;
|
618 |
+
|
619 |
+
if ($uncompressedSize < self::UNKNOWN) {
|
620 |
+
throw new InvalidArgumentException('Uncompressed size < ' . self::UNKNOWN);
|
621 |
+
}
|
622 |
+
$this->uncompressedSize = $uncompressedSize;
|
623 |
+
|
624 |
+
return $this;
|
625 |
+
}
|
626 |
+
|
627 |
+
/**
|
628 |
+
* Return relative Offset Of Local File Header.
|
629 |
+
*
|
630 |
+
* @return int
|
631 |
+
*/
|
632 |
+
public function getLocalHeaderOffset()
|
633 |
+
{
|
634 |
+
return $this->localHeaderOffset;
|
635 |
+
}
|
636 |
+
|
637 |
+
/**
|
638 |
+
* @param int $localHeaderOffset
|
639 |
+
*
|
640 |
+
* @return ZipEntry
|
641 |
+
*
|
642 |
+
* @internal
|
643 |
+
*/
|
644 |
+
public function setLocalHeaderOffset($localHeaderOffset)
|
645 |
+
{
|
646 |
+
$localHeaderOffset = (int) $localHeaderOffset;
|
647 |
+
|
648 |
+
if ($localHeaderOffset < 0) {
|
649 |
+
throw new InvalidArgumentException('Negative $localHeaderOffset');
|
650 |
+
}
|
651 |
+
$this->localHeaderOffset = $localHeaderOffset;
|
652 |
+
|
653 |
+
return $this;
|
654 |
+
}
|
655 |
+
|
656 |
+
/**
|
657 |
+
* Return relative Offset Of Local File Header.
|
658 |
+
*
|
659 |
+
* @return int
|
660 |
+
*
|
661 |
+
* @deprecated Use {@see ZipEntry::getLocalHeaderOffset()}
|
662 |
+
*/
|
663 |
+
public function getOffset()
|
664 |
+
{
|
665 |
+
@trigger_error(
|
666 |
+
__METHOD__ . ' is deprecated. Use ' . __CLASS__ . '::getLocalHeaderOffset()',
|
667 |
+
\E_USER_DEPRECATED
|
668 |
+
);
|
669 |
+
|
670 |
+
return $this->getLocalHeaderOffset();
|
671 |
+
}
|
672 |
+
|
673 |
+
/**
|
674 |
+
* @param int $offset
|
675 |
+
*
|
676 |
+
* @return ZipEntry
|
677 |
+
*
|
678 |
+
* @deprecated Use {@see ZipEntry::setLocalHeaderOffset()}
|
679 |
+
*
|
680 |
+
* @internal
|
681 |
+
*/
|
682 |
+
public function setOffset($offset)
|
683 |
+
{
|
684 |
+
@trigger_error(
|
685 |
+
__METHOD__ . ' is deprecated. Use ' . __CLASS__ . '::setLocalHeaderOffset()',
|
686 |
+
\E_USER_DEPRECATED
|
687 |
+
);
|
688 |
+
|
689 |
+
return $this->setLocalHeaderOffset($offset);
|
690 |
+
}
|
691 |
+
|
692 |
+
/**
|
693 |
+
* Returns the General Purpose Bit Flags.
|
694 |
+
*
|
695 |
+
* @return int
|
696 |
+
*/
|
697 |
+
public function getGeneralPurposeBitFlags()
|
698 |
+
{
|
699 |
+
return $this->generalPurposeBitFlags;
|
700 |
+
}
|
701 |
+
|
702 |
+
/**
|
703 |
+
* Sets the General Purpose Bit Flags.
|
704 |
+
*
|
705 |
+
* @param int $gpbf general purpose bit flags
|
706 |
+
*
|
707 |
+
* @return ZipEntry
|
708 |
+
*
|
709 |
+
* @internal
|
710 |
+
*/
|
711 |
+
public function setGeneralPurposeBitFlags($gpbf)
|
712 |
+
{
|
713 |
+
$gpbf = (int) $gpbf;
|
714 |
+
|
715 |
+
if ($gpbf < 0x0000 || $gpbf > 0xffff) {
|
716 |
+
throw new InvalidArgumentException('general purpose bit flags out of range');
|
717 |
+
}
|
718 |
+
$this->generalPurposeBitFlags = $gpbf;
|
719 |
+
$this->updateCompressionLevel();
|
720 |
+
|
721 |
+
return $this;
|
722 |
+
}
|
723 |
+
|
724 |
+
private function updateCompressionLevel()
|
725 |
+
{
|
726 |
+
if ($this->compressionMethod === ZipCompressionMethod::DEFLATED) {
|
727 |
+
$bit1 = $this->isSetGeneralBitFlag(GeneralPurposeBitFlag::COMPRESSION_FLAG1);
|
728 |
+
$bit2 = $this->isSetGeneralBitFlag(GeneralPurposeBitFlag::COMPRESSION_FLAG2);
|
729 |
+
|
730 |
+
if ($bit1 && !$bit2) {
|
731 |
+
$this->compressionLevel = ZipCompressionLevel::MAXIMUM;
|
732 |
+
} elseif (!$bit1 && $bit2) {
|
733 |
+
$this->compressionLevel = ZipCompressionLevel::FAST;
|
734 |
+
} elseif ($bit1 && $bit2) {
|
735 |
+
$this->compressionLevel = ZipCompressionLevel::SUPER_FAST;
|
736 |
+
} else {
|
737 |
+
$this->compressionLevel = ZipCompressionLevel::NORMAL;
|
738 |
+
}
|
739 |
+
}
|
740 |
+
}
|
741 |
+
|
742 |
+
/**
|
743 |
+
* @param int $mask
|
744 |
+
* @param bool $enable
|
745 |
+
*
|
746 |
+
* @return ZipEntry
|
747 |
+
*/
|
748 |
+
private function setGeneralBitFlag($mask, $enable)
|
749 |
+
{
|
750 |
+
if ($enable) {
|
751 |
+
$this->generalPurposeBitFlags |= $mask;
|
752 |
+
} else {
|
753 |
+
$this->generalPurposeBitFlags &= ~$mask;
|
754 |
+
}
|
755 |
+
|
756 |
+
return $this;
|
757 |
+
}
|
758 |
+
|
759 |
+
/**
|
760 |
+
* @param int $mask
|
761 |
+
*
|
762 |
+
* @return bool
|
763 |
+
*/
|
764 |
+
private function isSetGeneralBitFlag($mask)
|
765 |
+
{
|
766 |
+
return ($this->generalPurposeBitFlags & $mask) === $mask;
|
767 |
+
}
|
768 |
+
|
769 |
+
/**
|
770 |
+
* @return bool
|
771 |
+
*/
|
772 |
+
public function isDataDescriptorEnabled()
|
773 |
+
{
|
774 |
+
return $this->isSetGeneralBitFlag(GeneralPurposeBitFlag::DATA_DESCRIPTOR);
|
775 |
+
}
|
776 |
+
|
777 |
+
/**
|
778 |
+
* Enabling or disabling the use of the Data Descriptor block.
|
779 |
+
*
|
780 |
+
* @param bool $enabled
|
781 |
+
*/
|
782 |
+
public function enableDataDescriptor($enabled = true)
|
783 |
+
{
|
784 |
+
$this->setGeneralBitFlag(GeneralPurposeBitFlag::DATA_DESCRIPTOR, (bool) $enabled);
|
785 |
+
}
|
786 |
+
|
787 |
+
/**
|
788 |
+
* @param bool $enabled
|
789 |
+
*/
|
790 |
+
public function enableUtf8Name($enabled)
|
791 |
+
{
|
792 |
+
$this->setGeneralBitFlag(GeneralPurposeBitFlag::UTF8, (bool) $enabled);
|
793 |
+
}
|
794 |
+
|
795 |
+
/**
|
796 |
+
* @return bool
|
797 |
+
*/
|
798 |
+
public function isUtf8Flag()
|
799 |
+
{
|
800 |
+
return $this->isSetGeneralBitFlag(GeneralPurposeBitFlag::UTF8);
|
801 |
+
}
|
802 |
+
|
803 |
+
/**
|
804 |
+
* Returns true if and only if this ZIP entry is encrypted.
|
805 |
+
*
|
806 |
+
* @return bool
|
807 |
+
*/
|
808 |
+
public function isEncrypted()
|
809 |
+
{
|
810 |
+
return $this->isSetGeneralBitFlag(GeneralPurposeBitFlag::ENCRYPTION);
|
811 |
+
}
|
812 |
+
|
813 |
+
/**
|
814 |
+
* @return bool
|
815 |
+
*/
|
816 |
+
public function isStrongEncryption()
|
817 |
+
{
|
818 |
+
return $this->isSetGeneralBitFlag(GeneralPurposeBitFlag::STRONG_ENCRYPTION);
|
819 |
+
}
|
820 |
+
|
821 |
+
/**
|
822 |
+
* Sets the encryption property to false and removes any other
|
823 |
+
* encryption artifacts.
|
824 |
+
*
|
825 |
+
* @return ZipEntry
|
826 |
+
*/
|
827 |
+
public function disableEncryption()
|
828 |
+
{
|
829 |
+
$this->setEncrypted(false);
|
830 |
+
$this->removeExtraField(WinZipAesExtraField::HEADER_ID);
|
831 |
+
$this->encryptionMethod = ZipEncryptionMethod::NONE;
|
832 |
+
$this->password = null;
|
833 |
+
$this->extractVersion = self::UNKNOWN;
|
834 |
+
|
835 |
+
return $this;
|
836 |
+
}
|
837 |
+
|
838 |
+
/**
|
839 |
+
* Sets the encryption flag for this ZIP entry.
|
840 |
+
*
|
841 |
+
* @param bool $encrypted
|
842 |
+
*
|
843 |
+
* @return ZipEntry
|
844 |
+
*/
|
845 |
+
private function setEncrypted($encrypted)
|
846 |
+
{
|
847 |
+
$encrypted = (bool) $encrypted;
|
848 |
+
$this->setGeneralBitFlag(GeneralPurposeBitFlag::ENCRYPTION, $encrypted);
|
849 |
+
|
850 |
+
return $this;
|
851 |
+
}
|
852 |
+
|
853 |
+
/**
|
854 |
+
* Returns the compression method for this entry.
|
855 |
+
*
|
856 |
+
* @return int
|
857 |
+
*
|
858 |
+
* @deprecated Use {@see ZipEntry::getCompressionMethod()}
|
859 |
+
*/
|
860 |
+
public function getMethod()
|
861 |
+
{
|
862 |
+
@trigger_error(
|
863 |
+
__METHOD__ . ' is deprecated. Use ' . __CLASS__ . '::getCompressionMethod()',
|
864 |
+
\E_USER_DEPRECATED
|
865 |
+
);
|
866 |
+
|
867 |
+
return $this->getCompressionMethod();
|
868 |
+
}
|
869 |
+
|
870 |
+
/**
|
871 |
+
* Returns the compression method for this entry.
|
872 |
+
*
|
873 |
+
* @return int
|
874 |
+
*/
|
875 |
+
public function getCompressionMethod()
|
876 |
+
{
|
877 |
+
return $this->compressionMethod;
|
878 |
+
}
|
879 |
+
|
880 |
+
/**
|
881 |
+
* Sets the compression method for this entry.
|
882 |
+
*
|
883 |
+
* @param int $method
|
884 |
+
*
|
885 |
+
* @throws ZipUnsupportMethodException
|
886 |
+
*
|
887 |
+
* @return ZipEntry
|
888 |
+
*
|
889 |
+
* @deprecated Use {@see ZipEntry::setCompressionMethod()}
|
890 |
+
*/
|
891 |
+
public function setMethod($method)
|
892 |
+
{
|
893 |
+
@trigger_error(
|
894 |
+
__METHOD__ . ' is deprecated. Use ' . __CLASS__ . '::setCompressionMethod()',
|
895 |
+
\E_USER_DEPRECATED
|
896 |
+
);
|
897 |
+
|
898 |
+
return $this->setCompressionMethod($method);
|
899 |
+
}
|
900 |
+
|
901 |
+
/**
|
902 |
+
* Sets the compression method for this entry.
|
903 |
+
*
|
904 |
+
* @param int $compressionMethod
|
905 |
+
*
|
906 |
+
* @throws ZipUnsupportMethodException
|
907 |
+
*
|
908 |
+
* @return ZipEntry
|
909 |
+
*
|
910 |
+
* @see ZipCompressionMethod::STORED
|
911 |
+
* @see ZipCompressionMethod::DEFLATED
|
912 |
+
* @see ZipCompressionMethod::BZIP2
|
913 |
+
*/
|
914 |
+
public function setCompressionMethod($compressionMethod)
|
915 |
+
{
|
916 |
+
$compressionMethod = (int) $compressionMethod;
|
917 |
+
|
918 |
+
if ($compressionMethod < 0x0000 || $compressionMethod > 0xffff) {
|
919 |
+
throw new InvalidArgumentException('method out of range: ' . $compressionMethod);
|
920 |
+
}
|
921 |
+
|
922 |
+
ZipCompressionMethod::checkSupport($compressionMethod);
|
923 |
+
|
924 |
+
$this->compressionMethod = $compressionMethod;
|
925 |
+
$this->updateCompressionLevel();
|
926 |
+
$this->extractVersion = self::UNKNOWN;
|
927 |
+
|
928 |
+
return $this;
|
929 |
+
}
|
930 |
+
|
931 |
+
/**
|
932 |
+
* Get Unix Timestamp.
|
933 |
+
*
|
934 |
+
* @return int
|
935 |
+
*/
|
936 |
+
public function getTime()
|
937 |
+
{
|
938 |
+
if ($this->getDosTime() === self::UNKNOWN) {
|
939 |
+
return self::UNKNOWN;
|
940 |
+
}
|
941 |
+
|
942 |
+
return DateTimeConverter::msDosToUnix($this->getDosTime());
|
943 |
+
}
|
944 |
+
|
945 |
+
/**
|
946 |
+
* Get Dos Time.
|
947 |
+
*
|
948 |
+
* @return int
|
949 |
+
*/
|
950 |
+
public function getDosTime()
|
951 |
+
{
|
952 |
+
return $this->dosTime;
|
953 |
+
}
|
954 |
+
|
955 |
+
/**
|
956 |
+
* Set Dos Time.
|
957 |
+
*
|
958 |
+
* @param int $dosTime
|
959 |
+
*
|
960 |
+
* @return ZipEntry
|
961 |
+
*/
|
962 |
+
public function setDosTime($dosTime)
|
963 |
+
{
|
964 |
+
$dosTime = (int) $dosTime;
|
965 |
+
|
966 |
+
if (\PHP_INT_SIZE === 8) {
|
967 |
+
if ($dosTime < 0x00000000 || $dosTime > 0xffffffff) {
|
968 |
+
throw new InvalidArgumentException('DosTime out of range');
|
969 |
+
}
|
970 |
+
}
|
971 |
+
|
972 |
+
$this->dosTime = $dosTime;
|
973 |
+
|
974 |
+
return $this;
|
975 |
+
}
|
976 |
+
|
977 |
+
/**
|
978 |
+
* Set time from unix timestamp.
|
979 |
+
*
|
980 |
+
* @param int $unixTimestamp
|
981 |
+
*
|
982 |
+
* @return ZipEntry
|
983 |
+
*/
|
984 |
+
public function setTime($unixTimestamp)
|
985 |
+
{
|
986 |
+
if ($unixTimestamp !== self::UNKNOWN) {
|
987 |
+
$this->setDosTime(DateTimeConverter::unixToMsDos($unixTimestamp));
|
988 |
+
} else {
|
989 |
+
$this->dosTime = 0;
|
990 |
+
}
|
991 |
+
|
992 |
+
return $this;
|
993 |
+
}
|
994 |
+
|
995 |
+
/**
|
996 |
+
* Returns the external file attributes.
|
997 |
+
*
|
998 |
+
* @return int the external file attributes
|
999 |
+
*/
|
1000 |
+
public function getExternalAttributes()
|
1001 |
+
{
|
1002 |
+
return $this->externalAttributes;
|
1003 |
+
}
|
1004 |
+
|
1005 |
+
/**
|
1006 |
+
* Sets the external file attributes.
|
1007 |
+
*
|
1008 |
+
* @param int $externalAttributes the external file attributes
|
1009 |
+
*
|
1010 |
+
* @return ZipEntry
|
1011 |
+
*/
|
1012 |
+
public function setExternalAttributes($externalAttributes)
|
1013 |
+
{
|
1014 |
+
$this->externalAttributes = (int) $externalAttributes;
|
1015 |
+
|
1016 |
+
if (\PHP_INT_SIZE === 8) {
|
1017 |
+
if ($externalAttributes < 0x00000000 || $externalAttributes > 0xffffffff) {
|
1018 |
+
throw new InvalidArgumentException('external attributes out of range: ' . $externalAttributes);
|
1019 |
+
}
|
1020 |
+
}
|
1021 |
+
|
1022 |
+
$this->externalAttributes = $externalAttributes;
|
1023 |
+
|
1024 |
+
return $this;
|
1025 |
+
}
|
1026 |
+
|
1027 |
+
/**
|
1028 |
+
* Returns the internal file attributes.
|
1029 |
+
*
|
1030 |
+
* @return int the internal file attributes
|
1031 |
+
*/
|
1032 |
+
public function getInternalAttributes()
|
1033 |
+
{
|
1034 |
+
return $this->internalAttributes;
|
1035 |
+
}
|
1036 |
+
|
1037 |
+
/**
|
1038 |
+
* Sets the internal file attributes.
|
1039 |
+
*
|
1040 |
+
* @param int $internalAttributes the internal file attributes
|
1041 |
+
*
|
1042 |
+
* @return ZipEntry
|
1043 |
+
*/
|
1044 |
+
public function setInternalAttributes($internalAttributes)
|
1045 |
+
{
|
1046 |
+
$internalAttributes = (int) $internalAttributes;
|
1047 |
+
|
1048 |
+
if ($internalAttributes < 0x0000 || $internalAttributes > 0xffff) {
|
1049 |
+
throw new InvalidArgumentException('internal attributes out of range');
|
1050 |
+
}
|
1051 |
+
$this->internalAttributes = $internalAttributes;
|
1052 |
+
|
1053 |
+
return $this;
|
1054 |
+
}
|
1055 |
+
|
1056 |
+
/**
|
1057 |
+
* Returns true if and only if this ZIP entry represents a directory entry
|
1058 |
+
* (i.e. end with '/').
|
1059 |
+
*
|
1060 |
+
* @return bool
|
1061 |
+
*/
|
1062 |
+
final public function isDirectory()
|
1063 |
+
{
|
1064 |
+
return $this->isDirectory;
|
1065 |
+
}
|
1066 |
+
|
1067 |
+
/**
|
1068 |
+
* @return ExtraFieldsCollection
|
1069 |
+
*/
|
1070 |
+
public function getCdExtraFields()
|
1071 |
+
{
|
1072 |
+
return $this->cdExtraFields;
|
1073 |
+
}
|
1074 |
+
|
1075 |
+
/**
|
1076 |
+
* @param int $headerId
|
1077 |
+
*
|
1078 |
+
* @return ZipExtraField|null
|
1079 |
+
*/
|
1080 |
+
public function getCdExtraField($headerId)
|
1081 |
+
{
|
1082 |
+
return $this->cdExtraFields->get((int) $headerId);
|
1083 |
+
}
|
1084 |
+
|
1085 |
+
/**
|
1086 |
+
* @param ExtraFieldsCollection $cdExtraFields
|
1087 |
+
*
|
1088 |
+
* @return ZipEntry
|
1089 |
+
*/
|
1090 |
+
public function setCdExtraFields(ExtraFieldsCollection $cdExtraFields)
|
1091 |
+
{
|
1092 |
+
$this->cdExtraFields = $cdExtraFields;
|
1093 |
+
|
1094 |
+
return $this;
|
1095 |
+
}
|
1096 |
+
|
1097 |
+
/**
|
1098 |
+
* @return ExtraFieldsCollection
|
1099 |
+
*/
|
1100 |
+
public function getLocalExtraFields()
|
1101 |
+
{
|
1102 |
+
return $this->localExtraFields;
|
1103 |
+
}
|
1104 |
+
|
1105 |
+
/**
|
1106 |
+
* @param int $headerId
|
1107 |
+
*
|
1108 |
+
* @return ZipExtraField|null
|
1109 |
+
*/
|
1110 |
+
public function getLocalExtraField($headerId)
|
1111 |
+
{
|
1112 |
+
return $this->localExtraFields[(int) $headerId];
|
1113 |
+
}
|
1114 |
+
|
1115 |
+
/**
|
1116 |
+
* @param ExtraFieldsCollection $localExtraFields
|
1117 |
+
*
|
1118 |
+
* @return ZipEntry
|
1119 |
+
*/
|
1120 |
+
public function setLocalExtraFields(ExtraFieldsCollection $localExtraFields)
|
1121 |
+
{
|
1122 |
+
$this->localExtraFields = $localExtraFields;
|
1123 |
+
|
1124 |
+
return $this;
|
1125 |
+
}
|
1126 |
+
|
1127 |
+
/**
|
1128 |
+
* @param int $headerId
|
1129 |
+
*
|
1130 |
+
* @return ZipExtraField|null
|
1131 |
+
*/
|
1132 |
+
public function getExtraField($headerId)
|
1133 |
+
{
|
1134 |
+
$headerId = (int) $headerId;
|
1135 |
+
$local = $this->getLocalExtraField($headerId);
|
1136 |
+
|
1137 |
+
if ($local === null) {
|
1138 |
+
return $this->getCdExtraField($headerId);
|
1139 |
+
}
|
1140 |
+
|
1141 |
+
return $local;
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
/**
|
1145 |
+
* @param int $headerId
|
1146 |
+
*
|
1147 |
+
* @return bool
|
1148 |
+
*/
|
1149 |
+
public function hasExtraField($headerId)
|
1150 |
+
{
|
1151 |
+
$headerId = (int) $headerId;
|
1152 |
+
|
1153 |
+
return
|
1154 |
+
isset($this->localExtraFields[$headerId]) ||
|
1155 |
+
isset($this->cdExtraFields[$headerId]);
|
1156 |
+
}
|
1157 |
+
|
1158 |
+
/**
|
1159 |
+
* @param int $headerId
|
1160 |
+
*/
|
1161 |
+
public function removeExtraField($headerId)
|
1162 |
+
{
|
1163 |
+
$headerId = (int) $headerId;
|
1164 |
+
|
1165 |
+
$this->cdExtraFields->remove($headerId);
|
1166 |
+
$this->localExtraFields->remove($headerId);
|
1167 |
+
}
|
1168 |
+
|
1169 |
+
/**
|
1170 |
+
* @param ZipExtraField $zipExtraField
|
1171 |
+
*/
|
1172 |
+
public function addExtraField(ZipExtraField $zipExtraField)
|
1173 |
+
{
|
1174 |
+
$this->addLocalExtraField($zipExtraField);
|
1175 |
+
$this->addCdExtraField($zipExtraField);
|
1176 |
+
}
|
1177 |
+
|
1178 |
+
/**
|
1179 |
+
* @param ZipExtraField $zipExtraField
|
1180 |
+
*/
|
1181 |
+
public function addLocalExtraField(ZipExtraField $zipExtraField)
|
1182 |
+
{
|
1183 |
+
$this->localExtraFields->add($zipExtraField);
|
1184 |
+
}
|
1185 |
+
|
1186 |
+
/**
|
1187 |
+
* @param ZipExtraField $zipExtraField
|
1188 |
+
*/
|
1189 |
+
public function addCdExtraField(ZipExtraField $zipExtraField)
|
1190 |
+
{
|
1191 |
+
$this->cdExtraFields->add($zipExtraField);
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
/**
|
1195 |
+
* Returns comment entry.
|
1196 |
+
*
|
1197 |
+
* @return string
|
1198 |
+
*/
|
1199 |
+
public function getComment()
|
1200 |
+
{
|
1201 |
+
return $this->comment !== null ? $this->comment : '';
|
1202 |
+
}
|
1203 |
+
|
1204 |
+
/**
|
1205 |
+
* Set entry comment.
|
1206 |
+
*
|
1207 |
+
* @param string|null $comment
|
1208 |
+
*
|
1209 |
+
* @return ZipEntry
|
1210 |
+
*/
|
1211 |
+
public function setComment($comment)
|
1212 |
+
{
|
1213 |
+
if ($comment !== null) {
|
1214 |
+
$commentLength = \strlen($comment);
|
1215 |
+
|
1216 |
+
if ($commentLength > 0xffff) {
|
1217 |
+
throw new InvalidArgumentException('Comment too long');
|
1218 |
+
}
|
1219 |
+
|
1220 |
+
if ($this->charset === null && !StringUtil::isASCII($comment)) {
|
1221 |
+
$this->enableUtf8Name(true);
|
1222 |
+
}
|
1223 |
+
}
|
1224 |
+
$this->comment = $comment;
|
1225 |
+
|
1226 |
+
return $this;
|
1227 |
+
}
|
1228 |
+
|
1229 |
+
/**
|
1230 |
+
* @return bool
|
1231 |
+
*/
|
1232 |
+
public function isDataDescriptorRequired()
|
1233 |
+
{
|
1234 |
+
return ($this->getCrc() | $this->getCompressedSize() | $this->getUncompressedSize()) === self::UNKNOWN;
|
1235 |
+
}
|
1236 |
+
|
1237 |
+
/**
|
1238 |
+
* Return crc32 content or 0 for WinZip AES v2.
|
1239 |
+
*
|
1240 |
+
* @return int
|
1241 |
+
*/
|
1242 |
+
public function getCrc()
|
1243 |
+
{
|
1244 |
+
return $this->crc;
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
/**
|
1248 |
+
* Set crc32 content.
|
1249 |
+
*
|
1250 |
+
* @param int $crc
|
1251 |
+
*
|
1252 |
+
* @return ZipEntry
|
1253 |
+
*
|
1254 |
+
* @internal
|
1255 |
+
*/
|
1256 |
+
public function setCrc($crc)
|
1257 |
+
{
|
1258 |
+
$this->crc = (int) $crc;
|
1259 |
+
|
1260 |
+
return $this;
|
1261 |
+
}
|
1262 |
+
|
1263 |
+
/**
|
1264 |
+
* @return string|null
|
1265 |
+
*/
|
1266 |
+
public function getPassword()
|
1267 |
+
{
|
1268 |
+
return $this->password;
|
1269 |
+
}
|
1270 |
+
|
1271 |
+
/**
|
1272 |
+
* Set password and encryption method from entry.
|
1273 |
+
*
|
1274 |
+
* @param string|null $password
|
1275 |
+
* @param int|null $encryptionMethod
|
1276 |
+
*
|
1277 |
+
* @return ZipEntry
|
1278 |
+
*/
|
1279 |
+
public function setPassword($password, $encryptionMethod = null)
|
1280 |
+
{
|
1281 |
+
if (!$this->isDirectory) {
|
1282 |
+
if ($password === null || $password === '') {
|
1283 |
+
$this->password = null;
|
1284 |
+
$this->disableEncryption();
|
1285 |
+
} else {
|
1286 |
+
$this->password = (string) $password;
|
1287 |
+
|
1288 |
+
if ($encryptionMethod === null && $this->encryptionMethod === ZipEncryptionMethod::NONE) {
|
1289 |
+
$encryptionMethod = ZipEncryptionMethod::WINZIP_AES_256;
|
1290 |
+
}
|
1291 |
+
|
1292 |
+
if ($encryptionMethod !== null) {
|
1293 |
+
$this->setEncryptionMethod($encryptionMethod);
|
1294 |
+
}
|
1295 |
+
$this->setEncrypted(true);
|
1296 |
+
}
|
1297 |
+
}
|
1298 |
+
|
1299 |
+
return $this;
|
1300 |
+
}
|
1301 |
+
|
1302 |
+
/**
|
1303 |
+
* @return int
|
1304 |
+
*/
|
1305 |
+
public function getEncryptionMethod()
|
1306 |
+
{
|
1307 |
+
return $this->encryptionMethod;
|
1308 |
+
}
|
1309 |
+
|
1310 |
+
/**
|
1311 |
+
* Set encryption method.
|
1312 |
+
*
|
1313 |
+
* @param int|null $encryptionMethod
|
1314 |
+
*
|
1315 |
+
* @return ZipEntry
|
1316 |
+
*
|
1317 |
+
* @see ZipEncryptionMethod::NONE
|
1318 |
+
* @see ZipEncryptionMethod::PKWARE
|
1319 |
+
* @see ZipEncryptionMethod::WINZIP_AES_256
|
1320 |
+
* @see ZipEncryptionMethod::WINZIP_AES_192
|
1321 |
+
* @see ZipEncryptionMethod::WINZIP_AES_128
|
1322 |
+
*/
|
1323 |
+
public function setEncryptionMethod($encryptionMethod)
|
1324 |
+
{
|
1325 |
+
if ($encryptionMethod === null) {
|
1326 |
+
$encryptionMethod = ZipEncryptionMethod::NONE;
|
1327 |
+
}
|
1328 |
+
|
1329 |
+
$encryptionMethod = (int) $encryptionMethod;
|
1330 |
+
ZipEncryptionMethod::checkSupport($encryptionMethod);
|
1331 |
+
$this->encryptionMethod = $encryptionMethod;
|
1332 |
+
|
1333 |
+
$this->setEncrypted($this->encryptionMethod !== ZipEncryptionMethod::NONE);
|
1334 |
+
$this->extractVersion = self::UNKNOWN;
|
1335 |
+
|
1336 |
+
return $this;
|
1337 |
+
}
|
1338 |
+
|
1339 |
+
/**
|
1340 |
+
* @return int
|
1341 |
+
*/
|
1342 |
+
public function getCompressionLevel()
|
1343 |
+
{
|
1344 |
+
return $this->compressionLevel;
|
1345 |
+
}
|
1346 |
+
|
1347 |
+
/**
|
1348 |
+
* @param int $compressionLevel
|
1349 |
+
*
|
1350 |
+
* @return ZipEntry
|
1351 |
+
*/
|
1352 |
+
public function setCompressionLevel($compressionLevel)
|
1353 |
+
{
|
1354 |
+
$compressionLevel = (int) $compressionLevel;
|
1355 |
+
|
1356 |
+
if ($compressionLevel === self::UNKNOWN) {
|
1357 |
+
$compressionLevel = ZipCompressionLevel::NORMAL;
|
1358 |
+
}
|
1359 |
+
|
1360 |
+
if (
|
1361 |
+
$compressionLevel < ZipCompressionLevel::LEVEL_MIN ||
|
1362 |
+
$compressionLevel > ZipCompressionLevel::LEVEL_MAX
|
1363 |
+
) {
|
1364 |
+
throw new InvalidArgumentException(
|
1365 |
+
'Invalid compression level. Minimum level ' .
|
1366 |
+
ZipCompressionLevel::LEVEL_MIN . '. Maximum level ' . ZipCompressionLevel::LEVEL_MAX
|
1367 |
+
);
|
1368 |
+
}
|
1369 |
+
$this->compressionLevel = $compressionLevel;
|
1370 |
+
|
1371 |
+
$this->updateGbpfCompLevel();
|
1372 |
+
|
1373 |
+
return $this;
|
1374 |
+
}
|
1375 |
+
|
1376 |
+
/**
|
1377 |
+
* Update general purpose bit flogs.
|
1378 |
+
*/
|
1379 |
+
private function updateGbpfCompLevel()
|
1380 |
+
{
|
1381 |
+
if ($this->compressionMethod === ZipCompressionMethod::DEFLATED) {
|
1382 |
+
$bit1 = false;
|
1383 |
+
$bit2 = false;
|
1384 |
+
|
1385 |
+
switch ($this->compressionLevel) {
|
1386 |
+
case ZipCompressionLevel::MAXIMUM:
|
1387 |
+
$bit1 = true;
|
1388 |
+
break;
|
1389 |
+
|
1390 |
+
case ZipCompressionLevel::FAST:
|
1391 |
+
$bit2 = true;
|
1392 |
+
break;
|
1393 |
+
|
1394 |
+
case ZipCompressionLevel::SUPER_FAST:
|
1395 |
+
$bit1 = true;
|
1396 |
+
$bit2 = true;
|
1397 |
+
break;
|
1398 |
+
// default is ZipCompressionLevel::NORMAL
|
1399 |
+
}
|
1400 |
+
|
1401 |
+
$this->generalPurposeBitFlags |= ($bit1 ? GeneralPurposeBitFlag::COMPRESSION_FLAG1 : 0);
|
1402 |
+
$this->generalPurposeBitFlags |= ($bit2 ? GeneralPurposeBitFlag::COMPRESSION_FLAG2 : 0);
|
1403 |
+
}
|
1404 |
+
}
|
1405 |
+
|
1406 |
+
/**
|
1407 |
+
* Sets Unix permissions in a way that is understood by Info-Zip's
|
1408 |
+
* unzip command.
|
1409 |
+
*
|
1410 |
+
* @param int $mode mode an int value
|
1411 |
+
*
|
1412 |
+
* @return ZipEntry
|
1413 |
+
*/
|
1414 |
+
public function setUnixMode($mode)
|
1415 |
+
{
|
1416 |
+
$mode = (int) $mode;
|
1417 |
+
$this->setExternalAttributes(
|
1418 |
+
($mode << 16)
|
1419 |
+
// MS-DOS read-only attribute
|
1420 |
+
| (($mode & UnixStat::UNX_IWUSR) === 0 ? DosAttrs::DOS_HIDDEN : 0)
|
1421 |
+
// MS-DOS directory flag
|
1422 |
+
| ($this->isDirectory() ? DosAttrs::DOS_DIRECTORY : DosAttrs::DOS_ARCHIVE)
|
1423 |
+
);
|
1424 |
+
$this->createdOS = ZipPlatform::OS_UNIX;
|
1425 |
+
|
1426 |
+
return $this;
|
1427 |
+
}
|
1428 |
+
|
1429 |
+
/**
|
1430 |
+
* Unix permission.
|
1431 |
+
*
|
1432 |
+
* @return int the unix permissions
|
1433 |
+
*/
|
1434 |
+
public function getUnixMode()
|
1435 |
+
{
|
1436 |
+
$mode = 0;
|
1437 |
+
|
1438 |
+
if ($this->createdOS === ZipPlatform::OS_UNIX) {
|
1439 |
+
$mode = ($this->externalAttributes >> 16) & 0xFFFF;
|
1440 |
+
} elseif ($this->hasExtraField(AsiExtraField::HEADER_ID)) {
|
1441 |
+
/** @var AsiExtraField $asiExtraField */
|
1442 |
+
$asiExtraField = $this->getExtraField(AsiExtraField::HEADER_ID);
|
1443 |
+
$mode = $asiExtraField->getMode();
|
1444 |
+
}
|
1445 |
+
|
1446 |
+
if ($mode > 0) {
|
1447 |
+
return $mode;
|
1448 |
+
}
|
1449 |
+
|
1450 |
+
return $this->isDirectory ? 040755 : 0100644;
|
1451 |
+
}
|
1452 |
+
|
1453 |
+
/**
|
1454 |
+
* Offset MUST be considered in decision about ZIP64 format - see
|
1455 |
+
* description of Data Descriptor in ZIP File Format Specification.
|
1456 |
+
*
|
1457 |
+
* @return bool
|
1458 |
+
*/
|
1459 |
+
public function isZip64ExtensionsRequired()
|
1460 |
+
{
|
1461 |
+
return $this->compressedSize > ZipConstants::ZIP64_MAGIC
|
1462 |
+
|| $this->uncompressedSize > ZipConstants::ZIP64_MAGIC;
|
1463 |
+
}
|
1464 |
+
|
1465 |
+
/**
|
1466 |
+
* Returns true if this entry represents a unix symlink,
|
1467 |
+
* in which case the entry's content contains the target path
|
1468 |
+
* for the symlink.
|
1469 |
+
*
|
1470 |
+
* @return bool true if the entry represents a unix symlink,
|
1471 |
+
* false otherwise
|
1472 |
+
*/
|
1473 |
+
public function isUnixSymlink()
|
1474 |
+
{
|
1475 |
+
return ($this->getUnixMode() & UnixStat::UNX_IFMT) === UnixStat::UNX_IFLNK;
|
1476 |
+
}
|
1477 |
+
|
1478 |
+
/**
|
1479 |
+
* @return \DateTimeInterface
|
1480 |
+
*/
|
1481 |
+
public function getMTime()
|
1482 |
+
{
|
1483 |
+
/** @var NtfsExtraField|null $ntfsExtra */
|
1484 |
+
$ntfsExtra = $this->getExtraField(NtfsExtraField::HEADER_ID);
|
1485 |
+
|
1486 |
+
if ($ntfsExtra !== null) {
|
1487 |
+
return $ntfsExtra->getModifyDateTime();
|
1488 |
+
}
|
1489 |
+
|
1490 |
+
/** @var ExtendedTimestampExtraField|null $extendedExtra */
|
1491 |
+
$extendedExtra = $this->getExtraField(ExtendedTimestampExtraField::HEADER_ID);
|
1492 |
+
|
1493 |
+
if ($extendedExtra !== null && ($mtime = $extendedExtra->getModifyDateTime()) !== null) {
|
1494 |
+
return $mtime;
|
1495 |
+
}
|
1496 |
+
|
1497 |
+
/** @var OldUnixExtraField|null $oldUnixExtra */
|
1498 |
+
$oldUnixExtra = $this->getExtraField(OldUnixExtraField::HEADER_ID);
|
1499 |
+
|
1500 |
+
if ($oldUnixExtra !== null && ($mtime = $oldUnixExtra->getModifyDateTime()) !== null) {
|
1501 |
+
return $mtime;
|
1502 |
+
}
|
1503 |
+
|
1504 |
+
$timestamp = $this->getTime();
|
1505 |
+
|
1506 |
+
try {
|
1507 |
+
return new \DateTimeImmutable('@' . $timestamp);
|
1508 |
+
} catch (\Exception $e) {
|
1509 |
+
throw new RuntimeException('Error create DateTime object with timestamp ' . $timestamp, 1, $e);
|
1510 |
+
}
|
1511 |
+
}
|
1512 |
+
|
1513 |
+
/**
|
1514 |
+
* @return \DateTimeInterface|null
|
1515 |
+
*/
|
1516 |
+
public function getATime()
|
1517 |
+
{
|
1518 |
+
/** @var NtfsExtraField|null $ntfsExtra */
|
1519 |
+
$ntfsExtra = $this->getExtraField(NtfsExtraField::HEADER_ID);
|
1520 |
+
|
1521 |
+
if ($ntfsExtra !== null) {
|
1522 |
+
return $ntfsExtra->getAccessDateTime();
|
1523 |
+
}
|
1524 |
+
|
1525 |
+
/** @var ExtendedTimestampExtraField|null $extendedExtra */
|
1526 |
+
$extendedExtra = $this->getExtraField(ExtendedTimestampExtraField::HEADER_ID);
|
1527 |
+
|
1528 |
+
if ($extendedExtra !== null && ($atime = $extendedExtra->getAccessDateTime()) !== null) {
|
1529 |
+
return $atime;
|
1530 |
+
}
|
1531 |
+
|
1532 |
+
/** @var OldUnixExtraField|null $oldUnixExtra */
|
1533 |
+
$oldUnixExtra = $this->getExtraField(OldUnixExtraField::HEADER_ID);
|
1534 |
+
|
1535 |
+
if ($oldUnixExtra !== null) {
|
1536 |
+
return $oldUnixExtra->getAccessDateTime();
|
1537 |
+
}
|
1538 |
+
|
1539 |
+
return null;
|
1540 |
+
}
|
1541 |
+
|
1542 |
+
/**
|
1543 |
+
* @return \DateTimeInterface|null
|
1544 |
+
*/
|
1545 |
+
public function getCTime()
|
1546 |
+
{
|
1547 |
+
/** @var NtfsExtraField|null $ntfsExtra */
|
1548 |
+
$ntfsExtra = $this->getExtraField(NtfsExtraField::HEADER_ID);
|
1549 |
+
|
1550 |
+
if ($ntfsExtra !== null) {
|
1551 |
+
return $ntfsExtra->getCreateDateTime();
|
1552 |
+
}
|
1553 |
+
|
1554 |
+
/** @var ExtendedTimestampExtraField|null $extendedExtra */
|
1555 |
+
$extendedExtra = $this->getExtraField(ExtendedTimestampExtraField::HEADER_ID);
|
1556 |
+
|
1557 |
+
if ($extendedExtra !== null) {
|
1558 |
+
return $extendedExtra->getCreateDateTime();
|
1559 |
+
}
|
1560 |
+
|
1561 |
+
return null;
|
1562 |
+
}
|
1563 |
+
|
1564 |
+
public function __clone()
|
1565 |
+
{
|
1566 |
+
$this->cdExtraFields = clone $this->cdExtraFields;
|
1567 |
+
$this->localExtraFields = clone $this->localExtraFields;
|
1568 |
+
|
1569 |
+
if ($this->data !== null) {
|
1570 |
+
$this->data = clone $this->data;
|
1571 |
+
}
|
1572 |
+
}
|
1573 |
+
}
|
library/vendor/nelexa/zip/src/Model/ZipEntryMatcher.php
ADDED
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
7 |
+
* @license MIT
|
8 |
+
*/
|
9 |
+
class ZipEntryMatcher implements \Countable
|
10 |
+
{
|
11 |
+
/** @var ZipContainer */
|
12 |
+
protected $zipContainer;
|
13 |
+
|
14 |
+
/** @var array */
|
15 |
+
protected $matches = [];
|
16 |
+
|
17 |
+
/**
|
18 |
+
* ZipEntryMatcher constructor.
|
19 |
+
*
|
20 |
+
* @param ZipContainer $zipContainer
|
21 |
+
*/
|
22 |
+
public function __construct(ZipContainer $zipContainer)
|
23 |
+
{
|
24 |
+
$this->zipContainer = $zipContainer;
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @param string|ZipEntry|string[]|ZipEntry[] $entries
|
29 |
+
*
|
30 |
+
* @return ZipEntryMatcher
|
31 |
+
*/
|
32 |
+
public function add($entries)
|
33 |
+
{
|
34 |
+
$entries = (array) $entries;
|
35 |
+
$entries = array_map(
|
36 |
+
static function ($entry) {
|
37 |
+
return $entry instanceof ZipEntry ? $entry->getName() : (string) $entry;
|
38 |
+
},
|
39 |
+
$entries
|
40 |
+
);
|
41 |
+
$this->matches = array_values(
|
42 |
+
array_map(
|
43 |
+
'strval',
|
44 |
+
array_unique(
|
45 |
+
array_merge(
|
46 |
+
$this->matches,
|
47 |
+
array_keys(
|
48 |
+
array_intersect_key(
|
49 |
+
$this->zipContainer->getEntries(),
|
50 |
+
array_flip($entries)
|
51 |
+
)
|
52 |
+
)
|
53 |
+
)
|
54 |
+
)
|
55 |
+
)
|
56 |
+
);
|
57 |
+
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* @param string $regexp
|
63 |
+
*
|
64 |
+
* @return ZipEntryMatcher
|
65 |
+
*
|
66 |
+
* @noinspection PhpUnusedParameterInspection
|
67 |
+
*/
|
68 |
+
public function match($regexp)
|
69 |
+
{
|
70 |
+
array_walk(
|
71 |
+
$this->zipContainer->getEntries(),
|
72 |
+
/**
|
73 |
+
* @param ZipEntry $entry
|
74 |
+
* @param string $entryName
|
75 |
+
*/
|
76 |
+
function (ZipEntry $entry, $entryName) use ($regexp) {
|
77 |
+
if (preg_match($regexp, $entryName)) {
|
78 |
+
$this->matches[] = (string) $entryName;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
);
|
82 |
+
$this->matches = array_unique($this->matches);
|
83 |
+
|
84 |
+
return $this;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* @return ZipEntryMatcher
|
89 |
+
*/
|
90 |
+
public function all()
|
91 |
+
{
|
92 |
+
$this->matches = array_map(
|
93 |
+
'strval',
|
94 |
+
array_keys($this->zipContainer->getEntries())
|
95 |
+
);
|
96 |
+
|
97 |
+
return $this;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Callable function for all select entries.
|
102 |
+
*
|
103 |
+
* Callable function signature:
|
104 |
+
* function(string $entryName){}
|
105 |
+
*
|
106 |
+
* @param callable $callable
|
107 |
+
*/
|
108 |
+
public function invoke(callable $callable)
|
109 |
+
{
|
110 |
+
if (!empty($this->matches)) {
|
111 |
+
array_walk(
|
112 |
+
$this->matches,
|
113 |
+
/** @param string $entryName */
|
114 |
+
static function ($entryName) use ($callable) {
|
115 |
+
$callable($entryName);
|
116 |
+
}
|
117 |
+
);
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* @return array
|
123 |
+
*/
|
124 |
+
public function getMatches()
|
125 |
+
{
|
126 |
+
return $this->matches;
|
127 |
+
}
|
128 |
+
|
129 |
+
public function delete()
|
130 |
+
{
|
131 |
+
array_walk(
|
132 |
+
$this->matches,
|
133 |
+
/** @param string $entryName */
|
134 |
+
function ($entryName) {
|
135 |
+
$this->zipContainer->deleteEntry($entryName);
|
136 |
+
}
|
137 |
+
);
|
138 |
+
$this->matches = [];
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* @param string|null $password
|
143 |
+
* @param int|null $encryptionMethod
|
144 |
+
*/
|
145 |
+
public function setPassword($password, $encryptionMethod = null)
|
146 |
+
{
|
147 |
+
array_walk(
|
148 |
+
$this->matches,
|
149 |
+
/** @param string $entryName */
|
150 |
+
function ($entryName) use ($password, $encryptionMethod) {
|
151 |
+
$entry = $this->zipContainer->getEntry($entryName);
|
152 |
+
|
153 |
+
if (!$entry->isDirectory()) {
|
154 |
+
$entry->setPassword($password, $encryptionMethod);
|
155 |
+
}
|
156 |
+
}
|
157 |
+
);
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* @param int $encryptionMethod
|
162 |
+
*/
|
163 |
+
public function setEncryptionMethod($encryptionMethod)
|
164 |
+
{
|
165 |
+
array_walk(
|
166 |
+
$this->matches,
|
167 |
+
/** @param string $entryName */
|
168 |
+
function ($entryName) use ($encryptionMethod) {
|
169 |
+
$entry = $this->zipContainer->getEntry($entryName);
|
170 |
+
|
171 |
+
if (!$entry->isDirectory()) {
|
172 |
+
$entry->setEncryptionMethod($encryptionMethod);
|
173 |
+
}
|
174 |
+
}
|
175 |
+
);
|
176 |
+
}
|
177 |
+
|
178 |
+
public function disableEncryption()
|
179 |
+
{
|
180 |
+
array_walk(
|
181 |
+
$this->matches,
|
182 |
+
/** @param string $entryName */
|
183 |
+
function ($entryName) {
|
184 |
+
$entry = $this->zipContainer->getEntry($entryName);
|
185 |
+
|
186 |
+
if (!$entry->isDirectory()) {
|
187 |
+
$entry->disableEncryption();
|
188 |
+
}
|
189 |
+
}
|
190 |
+
);
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Count elements of an object.
|
195 |
+
*
|
196 |
+
* @see http://php.net/manual/en/countable.count.php
|
197 |
+
*
|
198 |
+
* @return int the custom count as an integer
|
199 |
+
*
|
200 |
+
* @since 5.1.0
|
201 |
+
*/
|
202 |
+
public function count()
|
203 |
+
{
|
204 |
+
return \count($this->matches);
|
205 |
+
}
|
206 |
+
}
|
library/vendor/nelexa/zip/src/Model/ZipInfo.php
ADDED
@@ -0,0 +1,266 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Model;
|
4 |
+
|
5 |
+
use PhpZip\Constants\ZipCompressionMethod;
|
6 |
+
use PhpZip\Constants\ZipEncryptionMethod;
|
7 |
+
use PhpZip\Constants\ZipPlatform;
|
8 |
+
use PhpZip\Util\FileAttribUtil;
|
9 |
+
use PhpZip\Util\FilesUtil;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Zip info.
|
13 |
+
*
|
14 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
15 |
+
* @license MIT
|
16 |
+
*
|
17 |
+
* @deprecated Use ZipEntry
|
18 |
+
*/
|
19 |
+
class ZipInfo
|
20 |
+
{
|
21 |
+
/** @var ZipEntry */
|
22 |
+
private $entry;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* ZipInfo constructor.
|
26 |
+
*
|
27 |
+
* @param ZipEntry $entry
|
28 |
+
*/
|
29 |
+
public function __construct(ZipEntry $entry)
|
30 |
+
{
|
31 |
+
$this->entry = $entry;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @param ZipEntry $entry
|
36 |
+
*
|
37 |
+
* @return string
|
38 |
+
*
|
39 |
+
* @deprecated Use {@see ZipPlatform::getPlatformName()}
|
40 |
+
*/
|
41 |
+
public static function getPlatformName(ZipEntry $entry)
|
42 |
+
{
|
43 |
+
return ZipPlatform::getPlatformName($entry->getExtractedOS());
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @return string
|
48 |
+
*/
|
49 |
+
public function getName()
|
50 |
+
{
|
51 |
+
return $this->entry->getName();
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* @return bool
|
56 |
+
*/
|
57 |
+
public function isFolder()
|
58 |
+
{
|
59 |
+
return $this->entry->isDirectory();
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @return int
|
64 |
+
*/
|
65 |
+
public function getSize()
|
66 |
+
{
|
67 |
+
return $this->entry->getUncompressedSize();
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* @return int
|
72 |
+
*/
|
73 |
+
public function getCompressedSize()
|
74 |
+
{
|
75 |
+
return $this->entry->getCompressedSize();
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* @return int
|
80 |
+
*/
|
81 |
+
public function getMtime()
|
82 |
+
{
|
83 |
+
return $this->entry->getMTime()->getTimestamp();
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* @return int|null
|
88 |
+
*/
|
89 |
+
public function getCtime()
|
90 |
+
{
|
91 |
+
$ctime = $this->entry->getCTime();
|
92 |
+
|
93 |
+
return $ctime === null ? null : $ctime->getTimestamp();
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* @return int|null
|
98 |
+
*/
|
99 |
+
public function getAtime()
|
100 |
+
{
|
101 |
+
$atime = $this->entry->getATime();
|
102 |
+
|
103 |
+
return $atime === null ? null : $atime->getTimestamp();
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* @return string
|
108 |
+
*/
|
109 |
+
public function getAttributes()
|
110 |
+
{
|
111 |
+
$externalAttributes = $this->entry->getExternalAttributes();
|
112 |
+
|
113 |
+
if ($this->entry->getCreatedOS() === ZipPlatform::OS_UNIX) {
|
114 |
+
$permission = (($externalAttributes >> 16) & 0xFFFF);
|
115 |
+
|
116 |
+
return FileAttribUtil::getUnixMode($permission);
|
117 |
+
}
|
118 |
+
|
119 |
+
return FileAttribUtil::getDosMode($externalAttributes);
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* @return bool
|
124 |
+
*/
|
125 |
+
public function isEncrypted()
|
126 |
+
{
|
127 |
+
return $this->entry->isEncrypted();
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @return string|null
|
132 |
+
*/
|
133 |
+
public function getComment()
|
134 |
+
{
|
135 |
+
return $this->entry->getComment();
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* @return int
|
140 |
+
*/
|
141 |
+
public function getCrc()
|
142 |
+
{
|
143 |
+
return $this->entry->getCrc();
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* @return string
|
148 |
+
*
|
149 |
+
* @deprecated use \PhpZip\Model\ZipInfo::getMethodName()
|
150 |
+
*/
|
151 |
+
public function getMethod()
|
152 |
+
{
|
153 |
+
return $this->getMethodName();
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* @return string
|
158 |
+
*/
|
159 |
+
public function getMethodName()
|
160 |
+
{
|
161 |
+
return ZipCompressionMethod::getCompressionMethodName($this->entry->getCompressionMethod());
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* @return string
|
166 |
+
*/
|
167 |
+
public function getEncryptionMethodName()
|
168 |
+
{
|
169 |
+
return ZipEncryptionMethod::getEncryptionMethodName($this->entry->getEncryptionMethod());
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* @return string
|
174 |
+
*/
|
175 |
+
public function getPlatform()
|
176 |
+
{
|
177 |
+
return ZipPlatform::getPlatformName($this->entry->getExtractedOS());
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* @return int
|
182 |
+
*/
|
183 |
+
public function getVersion()
|
184 |
+
{
|
185 |
+
return $this->entry->getExtractVersion();
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* @return int|null
|
190 |
+
*/
|
191 |
+
public function getEncryptionMethod()
|
192 |
+
{
|
193 |
+
$encryptionMethod = $this->entry->getEncryptionMethod();
|
194 |
+
|
195 |
+
return $encryptionMethod === ZipEncryptionMethod::NONE ? null : $encryptionMethod;
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* @return int|null
|
200 |
+
*/
|
201 |
+
public function getCompressionLevel()
|
202 |
+
{
|
203 |
+
return $this->entry->getCompressionLevel();
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* @return int
|
208 |
+
*/
|
209 |
+
public function getCompressionMethod()
|
210 |
+
{
|
211 |
+
return $this->entry->getCompressionMethod();
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* @return array
|
216 |
+
*/
|
217 |
+
public function toArray()
|
218 |
+
{
|
219 |
+
return [
|
220 |
+
'name' => $this->getName(),
|
221 |
+
'folder' => $this->isFolder(),
|
222 |
+
'size' => $this->getSize(),
|
223 |
+
'compressed_size' => $this->getCompressedSize(),
|
224 |
+
'modified' => $this->getMtime(),
|
225 |
+
'created' => $this->getCtime(),
|
226 |
+
'accessed' => $this->getAtime(),
|
227 |
+
'attributes' => $this->getAttributes(),
|
228 |
+
'encrypted' => $this->isEncrypted(),
|
229 |
+
'encryption_method' => $this->getEncryptionMethod(),
|
230 |
+
'encryption_method_name' => $this->getEncryptionMethodName(),
|
231 |
+
'comment' => $this->getComment(),
|
232 |
+
'crc' => $this->getCrc(),
|
233 |
+
'method_name' => $this->getMethodName(),
|
234 |
+
'compression_method' => $this->getCompressionMethod(),
|
235 |
+
'platform' => $this->getPlatform(),
|
236 |
+
'version' => $this->getVersion(),
|
237 |
+
];
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* @return string
|
242 |
+
*/
|
243 |
+
public function __toString()
|
244 |
+
{
|
245 |
+
$ctime = $this->entry->getCTime();
|
246 |
+
$atime = $this->entry->getATime();
|
247 |
+
$comment = $this->getComment();
|
248 |
+
|
249 |
+
return __CLASS__ . ' {'
|
250 |
+
. 'Name="' . $this->getName() . '", '
|
251 |
+
. ($this->isFolder() ? 'Folder, ' : '')
|
252 |
+
. 'Size="' . FilesUtil::humanSize($this->getSize()) . '"'
|
253 |
+
. ', Compressed size="' . FilesUtil::humanSize($this->getCompressedSize()) . '"'
|
254 |
+
. ', Modified time="' . $this->entry->getMTime()->format(\DATE_W3C) . '", '
|
255 |
+
. ($ctime !== null ? 'Created time="' . $ctime->format(\DATE_W3C) . '", ' : '')
|
256 |
+
. ($atime !== null ? 'Accessed time="' . $atime->format(\DATE_W3C) . '", ' : '')
|
257 |
+
. ($this->isEncrypted() ? 'Encrypted, ' : '')
|
258 |
+
. ($comment !== null ? 'Comment="' . $comment . '", ' : '')
|
259 |
+
. (!empty($this->crc) ? 'Crc=0x' . dechex($this->crc) . ', ' : '')
|
260 |
+
. 'Method name="' . $this->getMethodName() . '", '
|
261 |
+
. 'Attributes="' . $this->getAttributes() . '", '
|
262 |
+
. 'Platform="' . $this->getPlatform() . '", '
|
263 |
+
. 'Version=' . $this->getVersion()
|
264 |
+
. '}';
|
265 |
+
}
|
266 |
+
}
|
library/vendor/nelexa/zip/src/Util/CryptoUtil.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Util;
|
4 |
+
|
5 |
+
use PhpZip\Exception\RuntimeException;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Crypto Utils.
|
9 |
+
*
|
10 |
+
* @internal
|
11 |
+
*/
|
12 |
+
class CryptoUtil
|
13 |
+
{
|
14 |
+
/**
|
15 |
+
* Returns random bytes.
|
16 |
+
*
|
17 |
+
* @param int $length
|
18 |
+
*
|
19 |
+
* @throws \Exception
|
20 |
+
*
|
21 |
+
* @return string
|
22 |
+
*
|
23 |
+
* @deprecated Use random_bytes()
|
24 |
+
*/
|
25 |
+
final public static function randomBytes($length)
|
26 |
+
{
|
27 |
+
return random_bytes($length);
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Decrypt AES-CTR.
|
32 |
+
*
|
33 |
+
* @param string $data Encrypted data
|
34 |
+
* @param string $key Aes key
|
35 |
+
* @param string $iv Aes IV
|
36 |
+
*
|
37 |
+
* @return string Raw data
|
38 |
+
*/
|
39 |
+
public static function decryptAesCtr($data, $key, $iv)
|
40 |
+
{
|
41 |
+
if (\extension_loaded('openssl')) {
|
42 |
+
$numBits = \strlen($key) * 8;
|
43 |
+
/** @noinspection PhpComposerExtensionStubsInspection */
|
44 |
+
return openssl_decrypt($data, 'AES-' . $numBits . '-CTR', $key, \OPENSSL_RAW_DATA, $iv);
|
45 |
+
}
|
46 |
+
|
47 |
+
if (\extension_loaded('mcrypt')) {
|
48 |
+
return mcrypt_decrypt(\MCRYPT_RIJNDAEL_128, $key, $data, 'ctr', $iv);
|
49 |
+
}
|
50 |
+
|
51 |
+
throw new RuntimeException('Extension openssl or mcrypt not loaded');
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Encrypt AES-CTR.
|
56 |
+
*
|
57 |
+
* @param string $data Raw data
|
58 |
+
* @param string $key Aes key
|
59 |
+
* @param string $iv Aes IV
|
60 |
+
*
|
61 |
+
* @return string Encrypted data
|
62 |
+
*/
|
63 |
+
public static function encryptAesCtr($data, $key, $iv)
|
64 |
+
{
|
65 |
+
if (\extension_loaded('openssl')) {
|
66 |
+
$numBits = \strlen($key) * 8;
|
67 |
+
/** @noinspection PhpComposerExtensionStubsInspection */
|
68 |
+
return openssl_encrypt($data, 'AES-' . $numBits . '-CTR', $key, \OPENSSL_RAW_DATA, $iv);
|
69 |
+
}
|
70 |
+
|
71 |
+
if (\extension_loaded('mcrypt')) {
|
72 |
+
return mcrypt_encrypt(\MCRYPT_RIJNDAEL_128, $key, $data, 'ctr', $iv);
|
73 |
+
}
|
74 |
+
|
75 |
+
throw new RuntimeException('Extension openssl or mcrypt not loaded');
|
76 |
+
}
|
77 |
+
}
|
library/vendor/nelexa/zip/src/Util/DateTimeConverter.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Util;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Convert unix timestamp values to DOS date/time values and vice versa.
|
7 |
+
*
|
8 |
+
* The DOS date/time format is a bitmask:
|
9 |
+
*
|
10 |
+
* 24 16 8 0
|
11 |
+
* +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
|
12 |
+
* |Y|Y|Y|Y|Y|Y|Y|M| |M|M|M|D|D|D|D|D| |h|h|h|h|h|m|m|m| |m|m|m|s|s|s|s|s|
|
13 |
+
* +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
|
14 |
+
* \___________/\________/\_________/ \________/\____________/\_________/
|
15 |
+
* year month day hour minute second
|
16 |
+
*
|
17 |
+
* The year is stored as an offset from 1980.
|
18 |
+
* Seconds are stored in two-second increments.
|
19 |
+
* (So if the "second" value is 15, it actually represents 30 seconds.)
|
20 |
+
*
|
21 |
+
* @see https://docs.microsoft.com/ru-ru/windows/win32/api/winbase/nf-winbase-filetimetodosdatetime?redirectedfrom=MSDN
|
22 |
+
*
|
23 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
24 |
+
* @license MIT
|
25 |
+
*
|
26 |
+
* @internal
|
27 |
+
*/
|
28 |
+
class DateTimeConverter
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* Smallest supported DOS date/time value in a ZIP file,
|
32 |
+
* which is January 1st, 1980 AD 00:00:00 local time.
|
33 |
+
*/
|
34 |
+
const MIN_DOS_TIME = 0x210000; // (1 << 21) | (1 << 16)
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Largest supported DOS date/time value in a ZIP file,
|
38 |
+
* which is December 31st, 2107 AD 23:59:58 local time.
|
39 |
+
*/
|
40 |
+
const MAX_DOS_TIME = 0xff9fbf7d; // ((2107 - 1980) << 25) | (12 << 21) | (31 << 16) | (23 << 11) | (59 << 5) | (58 >> 1);
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Convert a 32 bit integer DOS date/time value to a UNIX timestamp value.
|
44 |
+
*
|
45 |
+
* @param int $dosTime Dos date/time
|
46 |
+
*
|
47 |
+
* @return int Unix timestamp
|
48 |
+
*/
|
49 |
+
public static function msDosToUnix($dosTime)
|
50 |
+
{
|
51 |
+
if ($dosTime <= self::MIN_DOS_TIME) {
|
52 |
+
$dosTime = 0;
|
53 |
+
} elseif ($dosTime > self::MAX_DOS_TIME) {
|
54 |
+
$dosTime = self::MAX_DOS_TIME;
|
55 |
+
}
|
56 |
+
// date_default_timezone_set('UTC');
|
57 |
+
return mktime(
|
58 |
+
(($dosTime >> 11) & 0x1f), // hours
|
59 |
+
(($dosTime >> 5) & 0x3f), // minutes
|
60 |
+
(($dosTime << 1) & 0x3e), // seconds
|
61 |
+
(($dosTime >> 21) & 0x0f), // month
|
62 |
+
(($dosTime >> 16) & 0x1f), // day
|
63 |
+
((($dosTime >> 25) & 0x7f) + 1980) // year
|
64 |
+
);
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Converts a UNIX timestamp value to a DOS date/time value.
|
69 |
+
*
|
70 |
+
* @param int $unixTimestamp the number of seconds since midnight, January 1st,
|
71 |
+
* 1970 AD UTC
|
72 |
+
*
|
73 |
+
* @return int a DOS date/time value reflecting the local time zone and
|
74 |
+
* rounded down to even seconds
|
75 |
+
* and is in between DateTimeConverter::MIN_DOS_TIME and DateTimeConverter::MAX_DOS_TIME
|
76 |
+
*/
|
77 |
+
public static function unixToMsDos($unixTimestamp)
|
78 |
+
{
|
79 |
+
if ($unixTimestamp < 0) {
|
80 |
+
throw new \InvalidArgumentException('Negative unix timestamp: ' . $unixTimestamp);
|
81 |
+
}
|
82 |
+
|
83 |
+
$date = getdate($unixTimestamp);
|
84 |
+
$dosTime = (
|
85 |
+
(($date['year'] - 1980) << 25) |
|
86 |
+
($date['mon'] << 21) |
|
87 |
+
($date['mday'] << 16) |
|
88 |
+
($date['hours'] << 11) |
|
89 |
+
($date['minutes'] << 5) |
|
90 |
+
($date['seconds'] >> 1)
|
91 |
+
);
|
92 |
+
|
93 |
+
if ($dosTime <= self::MIN_DOS_TIME) {
|
94 |
+
$dosTime = 0;
|
95 |
+
}
|
96 |
+
|
97 |
+
return $dosTime;
|
98 |
+
}
|
99 |
+
}
|
library/vendor/nelexa/zip/src/Util/FileAttribUtil.php
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Util;
|
4 |
+
|
5 |
+
use PhpZip\Constants\DosAttrs;
|
6 |
+
use PhpZip\Constants\UnixStat;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class FileAttribUtil.
|
10 |
+
*
|
11 |
+
* @internal
|
12 |
+
*/
|
13 |
+
class FileAttribUtil implements DosAttrs, UnixStat
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* Get DOS mode,.
|
17 |
+
*
|
18 |
+
* @param int $xattr
|
19 |
+
*
|
20 |
+
* @return string
|
21 |
+
*/
|
22 |
+
public static function getDosMode($xattr)
|
23 |
+
{
|
24 |
+
$xattr = (int) $xattr;
|
25 |
+
|
26 |
+
$mode = (($xattr & self::DOS_DIRECTORY) === self::DOS_DIRECTORY) ? 'd' : '-';
|
27 |
+
$mode .= (($xattr & self::DOS_ARCHIVE) === self::DOS_ARCHIVE) ? 'a' : '-';
|
28 |
+
$mode .= (($xattr & self::DOS_READ_ONLY) === self::DOS_READ_ONLY) ? 'r' : '-';
|
29 |
+
$mode .= (($xattr & self::DOS_HIDDEN) === self::DOS_HIDDEN) ? 'h' : '-';
|
30 |
+
$mode .= (($xattr & self::DOS_SYSTEM) === self::DOS_SYSTEM) ? 's' : '-';
|
31 |
+
$mode .= (($xattr & self::DOS_LABEL) === self::DOS_LABEL) ? 'l' : '-';
|
32 |
+
|
33 |
+
return $mode;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @param int $permission
|
38 |
+
*
|
39 |
+
* @return string
|
40 |
+
*/
|
41 |
+
public static function getUnixMode($permission)
|
42 |
+
{
|
43 |
+
$mode = '';
|
44 |
+
$permission = (int) $permission;
|
45 |
+
switch ($permission & self::UNX_IFMT) {
|
46 |
+
case self::UNX_IFDIR:
|
47 |
+
$mode .= 'd';
|
48 |
+
break;
|
49 |
+
|
50 |
+
case self::UNX_IFREG:
|
51 |
+
$mode .= '-';
|
52 |
+
break;
|
53 |
+
|
54 |
+
case self::UNX_IFLNK:
|
55 |
+
$mode .= 'l';
|
56 |
+
break;
|
57 |
+
|
58 |
+
case self::UNX_IFBLK:
|
59 |
+
$mode .= 'b';
|
60 |
+
break;
|
61 |
+
|
62 |
+
case self::UNX_IFCHR:
|
63 |
+
$mode .= 'c';
|
64 |
+
break;
|
65 |
+
|
66 |
+
case self::UNX_IFIFO:
|
67 |
+
$mode .= 'p';
|
68 |
+
break;
|
69 |
+
|
70 |
+
case self::UNX_IFSOCK:
|
71 |
+
$mode .= 's';
|
72 |
+
break;
|
73 |
+
|
74 |
+
default:
|
75 |
+
$mode .= '?';
|
76 |
+
break;
|
77 |
+
}
|
78 |
+
$mode .= ($permission & self::UNX_IRUSR) ? 'r' : '-';
|
79 |
+
$mode .= ($permission & self::UNX_IWUSR) ? 'w' : '-';
|
80 |
+
|
81 |
+
if ($permission & self::UNX_IXUSR) {
|
82 |
+
$mode .= ($permission & self::UNX_ISUID) ? 's' : 'x';
|
83 |
+
} else {
|
84 |
+
$mode .= ($permission & self::UNX_ISUID) ? 'S' : '-'; // S==undefined
|
85 |
+
}
|
86 |
+
$mode .= ($permission & self::UNX_IRGRP) ? 'r' : '-';
|
87 |
+
$mode .= ($permission & self::UNX_IWGRP) ? 'w' : '-';
|
88 |
+
|
89 |
+
if ($permission & self::UNX_IXGRP) {
|
90 |
+
$mode .= ($permission & self::UNX_ISGID) ? 's' : 'x';
|
91 |
+
} // == self::UNX_ENFMT
|
92 |
+
else {
|
93 |
+
$mode .= ($permission & self::UNX_ISGID) ? 'S' : '-';
|
94 |
+
} // SunOS 4.1.x
|
95 |
+
|
96 |
+
$mode .= ($permission & self::UNX_IROTH) ? 'r' : '-';
|
97 |
+
$mode .= ($permission & self::UNX_IWOTH) ? 'w' : '-';
|
98 |
+
|
99 |
+
if ($permission & self::UNX_IXOTH) {
|
100 |
+
$mode .= ($permission & self::UNX_ISVTX) ? 't' : 'x';
|
101 |
+
} // "sticky bit"
|
102 |
+
else {
|
103 |
+
$mode .= ($permission & self::UNX_ISVTX) ? 'T' : '-';
|
104 |
+
} // T==undefined
|
105 |
+
|
106 |
+
return $mode;
|
107 |
+
}
|
108 |
+
}
|
library/vendor/nelexa/zip/src/Util/FilesUtil.php
ADDED
@@ -0,0 +1,450 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PhpZip\Util;
|
4 |
+
|
5 |
+
use PhpZip\Util\Iterator\IgnoreFilesFilterIterator;
|
6 |
+
use PhpZip\Util\Iterator\IgnoreFilesRecursiveFilterIterator;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Files util.
|
10 |
+
*
|
11 |
+
* @author Ne-Lexa alexey@nelexa.ru
|
12 |
+
* @license MIT
|
13 |
+
*
|
14 |
+
* @internal
|
15 |
+
*/
|
16 |
+
final class FilesUtil
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* Is empty directory.
|
20 |
+
*
|
21 |
+
* @param string $dir Directory
|
22 |
+
*
|
23 |
+
* @return bool
|
24 |
+
*/
|
25 |
+
public static function isEmptyDir($dir)
|
26 |
+
{
|
27 |
+
if (!is_readable($dir)) {
|
28 |
+
return false;
|
29 |
+
}
|
30 |
+
|
31 |
+
return \count(scandir($dir)) === 2;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Remove recursive directory.
|
36 |
+
*
|
37 |
+
* @param string $dir directory path
|
38 |
+
*/
|
39 |
+
public static function removeDir($dir)
|
40 |
+
{
|
41 |
+
$files = new \RecursiveIteratorIterator(
|
42 |
+
new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS),
|
43 |
+
\RecursiveIteratorIterator::CHILD_FIRST
|
44 |
+
);
|
45 |
+
|
46 |
+
/** @var \SplFileInfo $fileInfo */
|
47 |
+
foreach ($files as $fileInfo) {
|
48 |
+
$function = ($fileInfo->isDir() ? 'rmdir' : 'unlink');
|
49 |
+
$function($fileInfo->getPathname());
|
50 |
+
}
|
51 |
+
@rmdir($dir);
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Convert glob pattern to regex pattern.
|
56 |
+
*
|
57 |
+
* @param string $globPattern
|
58 |
+
*
|
59 |
+
* @return string
|
60 |
+
*/
|
61 |
+
public static function convertGlobToRegEx($globPattern)
|
62 |
+
{
|
63 |
+
// Remove beginning and ending * globs because they're useless
|
64 |
+
$globPattern = trim($globPattern, '*');
|
65 |
+
$escaping = false;
|
66 |
+
$inCurrent = 0;
|
67 |
+
$chars = str_split($globPattern);
|
68 |
+
$regexPattern = '';
|
69 |
+
|
70 |
+
foreach ($chars as $currentChar) {
|
71 |
+
switch ($currentChar) {
|
72 |
+
case '*':
|
73 |
+
$regexPattern .= ($escaping ? '\\*' : '.*');
|
74 |
+
$escaping = false;
|
75 |
+
break;
|
76 |
+
|
77 |
+
case '?':
|
78 |
+
$regexPattern .= ($escaping ? '\\?' : '.');
|
79 |
+
$escaping = false;
|
80 |
+
break;
|
81 |
+
|
82 |
+
case '.':
|
83 |
+
case '(':
|
84 |
+
case ')':
|
85 |
+
case '+':
|
86 |
+
case '|':
|
87 |
+
case '^':
|
88 |
+
case '$':
|
89 |
+
case '@':
|
90 |
+
case '%':
|
91 |
+
$regexPattern .= '\\' . $currentChar;
|
92 |
+
$escaping = false;
|
93 |
+
break;
|
94 |
+
|
95 |
+
case '\\':
|
96 |
+
if ($escaping) {
|
97 |
+
$regexPattern .= '\\\\';
|
98 |
+
$escaping = false;
|
99 |
+
} else {
|
100 |
+
$escaping = true;
|
101 |
+
}
|
102 |
+
break;
|
103 |
+
|
104 |
+
case '{':
|
105 |
+
if ($escaping) {
|
106 |
+
$regexPattern .= '\\{';
|
107 |
+
} else {
|
108 |
+
$regexPattern = '(';
|
109 |
+
$inCurrent++;
|
110 |
+
}
|
111 |
+
$escaping = false;
|
112 |
+
break;
|
113 |
+
|
114 |
+
case '}':
|
115 |
+
if ($inCurrent > 0 && !$escaping) {
|
116 |
+
$regexPattern .= ')';
|
117 |
+
$inCurrent--;
|
118 |
+
} elseif ($escaping) {
|
119 |
+
$regexPattern = '\\}';
|
120 |
+
} else {
|
121 |
+
$regexPattern = '}';
|
122 |
+
}
|
123 |
+
$escaping = false;
|
124 |
+
break;
|
125 |
+
|
126 |
+
case ',':
|
127 |
+
if ($inCurrent > 0 && !$escaping) {
|
128 |
+
$regexPattern .= '|';
|
129 |
+
} elseif ($escaping) {
|
130 |
+
$regexPattern .= '\\,';
|
131 |
+
} else {
|
132 |
+
$regexPattern = ',';
|
133 |
+
}
|
134 |
+
break;
|
135 |
+
default:
|
136 |
+
$escaping = false;
|
137 |
+
$regexPattern .= $currentChar;
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
return $regexPattern;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Search files.
|
146 |
+
*
|
147 |
+
* @param string $inputDir
|