Gallery – Photo Gallery and Images Gallery - Version 2.8.2

Version Description

  • Added new image gallery widget to the add-ons section
Download this release

Release Info

Developer robosoft
Plugin Icon 128x128 Gallery – Photo Gallery and Images Gallery
Version 2.8.2
Comparing to
See all releases

Code changes from version 2.8.1 to 2.8.2

app/app.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /*
4
  * Robo Gallery
5
- * Version: 2.8.2 - 21480
6
  * By Robosoft
7
  *
8
  * Contact: https://robosoft.co/robogallery/
2
 
3
  /*
4
  * Robo Gallery
5
+ * Version: 2.8.2 - 62297
6
  * By Robosoft
7
  *
8
  * Contact: https://robosoft.co/robogallery/
app/class.brand.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /*
4
  * Robo Gallery
5
- * Version: 2.8.2 - 21480
6
  * By Robosoft
7
  *
8
  * Contact: https://robosoft.co/robogallery/
2
 
3
  /*
4
  * Robo Gallery
5
+ * Version: 2.8.2 - 62297
6
  * By Robosoft
7
  *
8
  * Contact: https://robosoft.co/robogallery/
app/class.view.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /*
4
  * Robo Gallery
5
- * Version: 2.8.2 - 21480
6
  * By Robosoft
7
  *
8
  * Contact: https://robosoft.co/robogallery/
2
 
3
  /*
4
  * Robo Gallery
5
+ * Version: 2.8.2 - 62297
6
  * By Robosoft
7
  *
8
  * Contact: https://robosoft.co/robogallery/
app/extensions/manager/class.addons.action.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  * Robo Gallery
4
- * Version: 2.8.2 - 21480
5
  * By Robosoft
6
  *
7
  * Contact: https://robosoft.co/robogallery/
1
  <?php
2
  /*
3
  * Robo Gallery
4
+ * Version: 2.8.2 - 62297
5
  * By Robosoft
6
  *
7
  * Contact: https://robosoft.co/robogallery/
app/extensions/manager/class.addons.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  * Robo Gallery
4
- * Version: 2.8.2 - 21480
5
  * By Robosoft
6
  *
7
  * Contact: https://robosoft.co/robogallery/
@@ -54,7 +54,12 @@ class rbsGalleryAddons{
54
  $this->addons = $this->getAddons();
55
 
56
  $this->addAjaxHooks();
57
- /* check_status */
 
 
 
 
 
58
  add_action('wp_ajax_rb_check_status', array($this, 'getPluginStatus'));
59
 
60
  /* activate included plugin */
@@ -62,12 +67,6 @@ class rbsGalleryAddons{
62
 
63
  /* deactivate included plugin */
64
  add_action('wp_ajax_rb_deactivate_included_plugin', array($this, 'deactivateIncludedPlugin') );
65
-
66
- add_action( 'init', array($this, 'init') );
67
- }
68
-
69
- private function addAjaxHooks(){
70
-
71
  }
72
 
73
  private function checkDepends(){
@@ -96,7 +95,7 @@ class rbsGalleryAddons{
96
  if ($this->postType !== $screen->post_type) return;
97
 
98
  wp_enqueue_style(
99
- $this->tag.'-style',
100
  $this->assetsUri . 'css/style.css',
101
  array()
102
  );
@@ -115,7 +114,11 @@ class rbsGalleryAddons{
115
  true
116
  );
117
 
118
- echo " <style>html body div#wpcontent div.fs-notice, .ngg_admin_notice{display: none !important; }</style> ";
 
 
 
 
119
 
120
  wp_localize_script(
121
  $this->tag.'-js',
@@ -325,16 +328,16 @@ class rbsGalleryAddons{
325
  );*/
326
 
327
 
328
- /*$addons['breadcrumbs'] = $this->putAddon(
329
  array(
330
- 'title' => 'BreadCrumbs',
331
- 'price' => 19,
332
- 'category' => 'navigation',
333
- 'slug' => 'akismet',
334
- 'file' => 'akismet/akismet.php',
335
  'public'=> 1,
336
  )
337
- );*/
338
 
339
  $addons['backup'] = $this->putAddon(
340
  array(
1
  <?php
2
  /*
3
  * Robo Gallery
4
+ * Version: 2.8.2 - 62297
5
  * By Robosoft
6
  *
7
  * Contact: https://robosoft.co/robogallery/
54
  $this->addons = $this->getAddons();
55
 
56
  $this->addAjaxHooks();
57
+
58
+ add_action( 'init', array($this, 'init') );
59
+ }
60
+
61
+ private function addAjaxHooks(){
62
+ /* check_status */
63
  add_action('wp_ajax_rb_check_status', array($this, 'getPluginStatus'));
64
 
65
  /* activate included plugin */
67
 
68
  /* deactivate included plugin */
69
  add_action('wp_ajax_rb_deactivate_included_plugin', array($this, 'deactivateIncludedPlugin') );
 
 
 
 
 
 
70
  }
71
 
72
  private function checkDepends(){
95
  if ($this->postType !== $screen->post_type) return;
96
 
97
  wp_enqueue_style(
98
+ $this->tag,
99
  $this->assetsUri . 'css/style.css',
100
  array()
101
  );
114
  true
115
  );
116
 
117
+
118
+
119
+ $custom_css = " <style>html body div#wpcontent div.fs-notice, .ngg_admin_notice{display: none !important; }</style> ";
120
+
121
+ wp_add_inline_style( $this->tag, $custom_css );
122
 
123
  wp_localize_script(
124
  $this->tag.'-js',
328
  );*/
329
 
330
 
331
+ $addons['widget'] = $this->putAddon(
332
  array(
333
+ 'title' => 'Gallery Widget',
334
+ 'category' => 'interface',
335
+ 'slug' => 'image-widget-rb',
336
+ 'file' => 'image-widget-rb/image-widget-rb.php',
337
+ 'desc' => 'Here you can configure gallery widget for the sidebars. Simple settings make you able to configure your widget gallery in few simple steps.',
338
  'public'=> 1,
339
  )
340
+ );
341
 
342
  $addons['backup'] = $this->putAddon(
343
  array(
app/extensions/manager/init.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  * Robo Gallery
4
- * Version: 2.8.2 - 21480
5
  * By Robosoft
6
  *
7
  * Contact: https://robosoft.co/robogallery/
1
  <?php
2
  /*
3
  * Robo Gallery
4
+ * Version: 2.8.2 - 62297
5
  * By Robosoft
6
  *
7
  * Contact: https://robosoft.co/robogallery/
app/extensions/manager/js/script.js CHANGED
@@ -1,20 +1,28 @@
1
  (function(RBPLUGINMANAGER, $, undefined) {
2
 
 
 
 
 
3
  RBPLUGINMANAGER.showSpinner = function($btn) {
 
4
  var $container = $btn.find('.icon-loading.dashicons-update');
5
  $container.removeClass('icon-loading-hide').addClass('spin');
6
  };
7
 
8
  RBPLUGINMANAGER.hideSpinner = function($btn) {
 
9
  var $container = $btn.find('.icon-loading.dashicons-update');
10
  $container.removeClass('spin').addClass('icon-loading-hide');
11
  };
12
 
13
  RBPLUGINMANAGER.showError = function($btn) {
 
14
  $btn.parent().next('.download-error').css('display', 'block');
15
  };
16
 
17
  RBPLUGINMANAGER.updateButtonLabel = function($btn, label) {
 
18
  $btn.find('span.text').text(label);
19
  };
20
 
@@ -67,9 +75,6 @@
67
  };
68
 
69
 
70
-
71
- rbsGalleryAddonAttributes
72
-
73
  RBPLUGINMANAGER.bindActionButtons = function() {
74
  $('a.addon-button').on('click', function(e) {
75
 
@@ -77,21 +82,21 @@ rbsGalleryAddonAttributes
77
 
78
 
79
  if ($btn.attr('target') == '_blank' || $btn.hasClass('addon-link') ) {
80
- console.log('open link');
81
  return true;
82
  }
83
 
84
  e.preventDefault();
85
 
86
  if ($btn.is('.disabled')) {
87
- console.log('disabled');
88
  return false;
89
  }
90
 
91
  /*var confirmMsg = $(this).data('confirm');
92
 
93
  if (confirmMsg) {
94
- console.log('with confirmation');
95
  if (confirm(confirmMsg)) {
96
  RBPLUGINMANAGER.showSpinner($btn);
97
  $btn.addClass('disabled');
@@ -103,7 +108,7 @@ rbsGalleryAddonAttributes
103
  $btn.addClass('disabled');
104
  RBPLUGINMANAGER.showSpinner($btn);
105
 
106
- console.log('without confirmation');
107
 
108
  if( $btn.hasClass('addon-activate') ){
109
 
@@ -135,15 +140,15 @@ rbsGalleryAddonAttributes
135
 
136
  RBPLUGINMANAGER.updateButtonLabel( $btn, rbsGalleryAddonAttributes.labels.downloading );
137
 
138
- console.log('download slug:'+slug+' code:'+code);
139
- console.log('Download ' + url);
140
 
141
  jQuery.ajax({
142
  method: "POST",
143
  url: url,
144
  }).done(function() {
145
 
146
- console.log('Done download');
147
 
148
  jQuery.ajax({ // Check if plugin installed
149
  type: 'POST',
@@ -155,14 +160,14 @@ rbsGalleryAddonAttributes
155
  },
156
 
157
  error: function(){
158
- console.log('Error: check unsuccessful');
159
  RBPLUGINMANAGER.hideSpinner( $btn );
160
  RBPLUGINMANAGER.showError( $btn );
161
  },
162
  success: function(response){
163
  var pluginStatus = JSON.parse( response );
164
 
165
- console.log(pluginStatus);
166
 
167
  if( pluginStatus.download == 1) {
168
  /* plugin downloaded */
@@ -175,7 +180,7 @@ rbsGalleryAddonAttributes
175
  }
176
 
177
  } else {
178
- console.log('Error: download unsuccessful');
179
  RBPLUGINMANAGER.hideSpinner( $btn );
180
  RBPLUGINMANAGER.showError( $btn );
181
  }
@@ -183,7 +188,7 @@ rbsGalleryAddonAttributes
183
  });
184
  })
185
  .fail(function() {
186
- console.log('Error: send request unsuccessful');
187
  RBPLUGINMANAGER.hideSpinner( $btn );
188
  RBPLUGINMANAGER.showError( $btn );
189
  });
@@ -197,8 +202,8 @@ rbsGalleryAddonAttributes
197
  slug = $btn.data('slug'),
198
  code = $btn.data('code');
199
 
200
- console.log('Activate Included slug:'+slug+' code:'+code);
201
- console.log('Activate ' + url);
202
 
203
  RBPLUGINMANAGER.updateButtonLabel( $btn, rbsGalleryAddonAttributes.labels.activating )
204
 
@@ -211,7 +216,7 @@ rbsGalleryAddonAttributes
211
  'plugin': code
212
  },
213
  }).done(function() {
214
- console.log('Activated');
215
 
216
  jQuery.ajax({ // Check if plugin installed
217
  type: 'POST',
@@ -227,7 +232,7 @@ rbsGalleryAddonAttributes
227
  success: function(response){
228
  var pluginStatus = JSON.parse(response);
229
 
230
- console.log(pluginStatus);
231
 
232
  if( pluginStatus.download == 1 && pluginStatus.active==1 ) {
233
  /* plugin active */
@@ -252,7 +257,7 @@ rbsGalleryAddonAttributes
252
  var slug = $btn.data('slug'),
253
  code = $btn.data('code');
254
 
255
- console.log('Deactivate Included slug:'+slug+' code:'+code);
256
 
257
  RBPLUGINMANAGER.updateButtonLabel( $btn, rbsGalleryAddonAttributes.labels.deactivating )
258
 
@@ -265,7 +270,8 @@ rbsGalleryAddonAttributes
265
  'plugin': code
266
  },
267
  }).done(function() {
268
- console.log('Deactivated');
 
269
 
270
  jQuery.ajax({ // Check if plugin installed
271
  type: 'POST',
@@ -281,7 +287,7 @@ rbsGalleryAddonAttributes
281
  success: function(response){
282
  var pluginStatus = JSON.parse(response);
283
 
284
- console.log(pluginStatus);
285
 
286
  if( pluginStatus.active==0 ) {
287
  /* plugin active */
@@ -307,8 +313,8 @@ rbsGalleryAddonAttributes
307
  slug = $btn.data('slug'),
308
  code = $btn.data('code');
309
 
310
- console.log('Activate slug:'+slug+' code:'+code);
311
- console.log('Activate ' + url);
312
 
313
  RBPLUGINMANAGER.updateButtonLabel( $btn, rbsGalleryAddonAttributes.labels.activating )
314
 
@@ -316,7 +322,7 @@ rbsGalleryAddonAttributes
316
  method: "POST",
317
  url: url,
318
  }).done(function() {
319
- console.log('Activated');
320
 
321
  jQuery.ajax({ // Check if plugin installed
322
  type: 'POST',
@@ -332,7 +338,7 @@ rbsGalleryAddonAttributes
332
  success: function(response){
333
  var pluginStatus = JSON.parse(response);
334
 
335
- console.log(pluginStatus);
336
 
337
  if( pluginStatus.download == 1 && pluginStatus.active==1 ) {
338
  /* plugin active */
1
  (function(RBPLUGINMANAGER, $, undefined) {
2
 
3
+ RBPLUGINMANAGER.toConsole = function (message){
4
+ console.log(message);
5
+ }
6
+
7
  RBPLUGINMANAGER.showSpinner = function($btn) {
8
+ /**/RBPLUGINMANAGER.toConsole('function: showSpinner');
9
  var $container = $btn.find('.icon-loading.dashicons-update');
10
  $container.removeClass('icon-loading-hide').addClass('spin');
11
  };
12
 
13
  RBPLUGINMANAGER.hideSpinner = function($btn) {
14
+ /**/RBPLUGINMANAGER.toConsole('function: hideSpinner');
15
  var $container = $btn.find('.icon-loading.dashicons-update');
16
  $container.removeClass('spin').addClass('icon-loading-hide');
17
  };
18
 
19
  RBPLUGINMANAGER.showError = function($btn) {
20
+ /**/RBPLUGINMANAGER.toConsole('function: showError');
21
  $btn.parent().next('.download-error').css('display', 'block');
22
  };
23
 
24
  RBPLUGINMANAGER.updateButtonLabel = function($btn, label) {
25
+ /**/RBPLUGINMANAGER.toConsole('function: updateButtonLabel');
26
  $btn.find('span.text').text(label);
27
  };
28
 
75
  };
76
 
77
 
 
 
 
78
  RBPLUGINMANAGER.bindActionButtons = function() {
79
  $('a.addon-button').on('click', function(e) {
80
 
82
 
83
 
84
  if ($btn.attr('target') == '_blank' || $btn.hasClass('addon-link') ) {
85
+ /**/RBPLUGINMANAGER.toConsole('open link');
86
  return true;
87
  }
88
 
89
  e.preventDefault();
90
 
91
  if ($btn.is('.disabled')) {
92
+ /**/RBPLUGINMANAGER.toConsole('disabled');
93
  return false;
94
  }
95
 
96
  /*var confirmMsg = $(this).data('confirm');
97
 
98
  if (confirmMsg) {
99
+ RBPLUGINMANAGER.toConsole('with confirmation');
100
  if (confirm(confirmMsg)) {
101
  RBPLUGINMANAGER.showSpinner($btn);
102
  $btn.addClass('disabled');
108
  $btn.addClass('disabled');
109
  RBPLUGINMANAGER.showSpinner($btn);
110
 
111
+ /**/RBPLUGINMANAGER.toConsole('without');
112
 
113
  if( $btn.hasClass('addon-activate') ){
114
 
140
 
141
  RBPLUGINMANAGER.updateButtonLabel( $btn, rbsGalleryAddonAttributes.labels.downloading );
142
 
143
+ /**/RBPLUGINMANAGER.toConsole('download slug:'+slug+' code:'+code);
144
+ /**/RBPLUGINMANAGER.toConsole('Download ' + url);
145
 
146
  jQuery.ajax({
147
  method: "POST",
148
  url: url,
149
  }).done(function() {
150
 
151
+ /**/RBPLUGINMANAGER.toConsole('Done download');
152
 
153
  jQuery.ajax({ // Check if plugin installed
154
  type: 'POST',
160
  },
161
 
162
  error: function(){
163
+ /**/RBPLUGINMANAGER.toConsole('Error: check unsuccessful');
164
  RBPLUGINMANAGER.hideSpinner( $btn );
165
  RBPLUGINMANAGER.showError( $btn );
166
  },
167
  success: function(response){
168
  var pluginStatus = JSON.parse( response );
169
 
170
+ /**/RBPLUGINMANAGER.toConsole(pluginStatus);
171
 
172
  if( pluginStatus.download == 1) {
173
  /* plugin downloaded */
180
  }
181
 
182
  } else {
183
+ /**/RBPLUGINMANAGER.toConsole('Error: download unsuccessful');
184
  RBPLUGINMANAGER.hideSpinner( $btn );
185
  RBPLUGINMANAGER.showError( $btn );
186
  }
188
  });
189
  })
190
  .fail(function() {
191
+ /**/RBPLUGINMANAGER.toConsole('Error: send request unsuccessful');
192
  RBPLUGINMANAGER.hideSpinner( $btn );
193
  RBPLUGINMANAGER.showError( $btn );
194
  });
202
  slug = $btn.data('slug'),
203
  code = $btn.data('code');
204
 
205
+ /**/RBPLUGINMANAGER.toConsole('Activate Included slug:'+slug+' code:'+code);
206
+ /**/RBPLUGINMANAGER.toConsole('Activate ' + url);
207
 
208
  RBPLUGINMANAGER.updateButtonLabel( $btn, rbsGalleryAddonAttributes.labels.activating )
209
 
216
  'plugin': code
217
  },
218
  }).done(function() {
219
+ /**/RBPLUGINMANAGER.toConsole('Activated');
220
 
221
  jQuery.ajax({ // Check if plugin installed
222
  type: 'POST',
232
  success: function(response){
233
  var pluginStatus = JSON.parse(response);
234
 
235
+ /**/RBPLUGINMANAGER.toConsole(pluginStatus);
236
 
237
  if( pluginStatus.download == 1 && pluginStatus.active==1 ) {
238
  /* plugin active */
257
  var slug = $btn.data('slug'),
258
  code = $btn.data('code');
259
 
260
+ /**/RBPLUGINMANAGER.toConsole('Deactivate Included slug:'+slug+' code:'+code);
261
 
262
  RBPLUGINMANAGER.updateButtonLabel( $btn, rbsGalleryAddonAttributes.labels.deactivating )
263
 
270
  'plugin': code
271
  },
272
  }).done(function() {
273
+
274
+ /**/RBPLUGINMANAGER.toConsole('Deactivated');
275
 
276
  jQuery.ajax({ // Check if plugin installed
277
  type: 'POST',
287
  success: function(response){
288
  var pluginStatus = JSON.parse(response);
289
 
290
+ /**/RBPLUGINMANAGER.toConsole(pluginStatus);
291
 
292
  if( pluginStatus.active==0 ) {
293
  /* plugin active */
313
  slug = $btn.data('slug'),
314
  code = $btn.data('code');
315
 
316
+ /**/RBPLUGINMANAGER.toConsole('Activate slug:'+slug+' code:'+code);
317
+ /**/RBPLUGINMANAGER.toConsole('Activate ' + url);
318
 
319
  RBPLUGINMANAGER.updateButtonLabel( $btn, rbsGalleryAddonAttributes.labels.activating )
320
 
322
  method: "POST",
323
  url: url,
324
  }).done(function() {
325
+ /**/RBPLUGINMANAGER.toConsole('Activated');
326
 
327
  jQuery.ajax({ // Check if plugin installed
328
  type: 'POST',
338
  success: function(response){
339
  var pluginStatus = JSON.parse(response);
340
 
341
+ /**/RBPLUGINMANAGER.toConsole(pluginStatus);
342
 
343
  if( pluginStatus.download == 1 && pluginStatus.active==1 ) {
344
  /* plugin active */
includes/extensions/zipdd/Core/AbstractException.php DELETED
@@ -1,14 +0,0 @@
1
- <?php
2
- /**
3
- *
4
- * @author Greg Kappatos
5
- *
6
- * This class serves as a proxy for all \PHPZip\Zip\Exception classes.
7
- * It is empty for now, but properties can be added in the future without
8
- * breaking any code.
9
- *
10
- */
11
-
12
- namespace PHPZip\Zip\Core;
13
-
14
- abstract class AbstractException extends \Exception {}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/extensions/zipdd/Core/AbstractZipArchive.php DELETED
@@ -1,1046 +0,0 @@
1
- <?php
2
- /**
3
- *
4
- * @author A. Grandt <php@grandt.com>
5
- * @author Greg Kappatos
6
- *
7
- * This class serves as an abstract superclass for zip archives.
8
- *
9
- */
10
-
11
- namespace PHPZip\Zip\Core;
12
-
13
- use com\grandt\BinStringStatic;
14
- use PHPZip\Zip\Listener\ZipArchiveListener as ZipArchiveListener;
15
- use PHPZip\Zip\Exception\IncompatiblePhpVersion as IncompatiblePhpVersionException;
16
- use PHPZip\Zip\Exception\InvalidPhpConfiguration as InvalidPhpConfigurationException;
17
- use PHPZip\Zip\Exception\HeadersSent as HeadersSentException;
18
- use PHPZip\Zip\Exception\BufferNotEmpty as BufferNotEmptyException;
19
- use PHPZip\Zip\Exception\LengthMismatch as LengthMismatchException;
20
- use ZipMerge\Zip\Core\AbstractZipWriter;
21
- use ZipMerge\Zip\Core\Header\ZipFileEntry;
22
- use ZipMerge\Zip\Stream\ZipMerge;
23
-
24
-
25
- abstract class AbstractZipArchive extends AbstractZipWriter {
26
- const APP_NAME = 'PHPZip';
27
- const VERSION = "2.0.8";
28
- const MIN_PHP_VERSION = 5.3; // for namespaces
29
-
30
- const CONTENT_TYPE = 'application/zip';
31
-
32
- const NULL_BYTE = "\x00";
33
- const NULL_WORD = "\x00\x00"; // Two nul bytes, used often enough.
34
- const NULL_DWORD = "\x00\x00\x00\x00";
35
-
36
- const ZIP_CENTRAL_FILE_HEADER = "PK\x01\x02"; // Central file header signature
37
- const ZIP_LOCAL_FILE_HEADER = "PK\x03\x04"; // Local file header signature
38
- const ZIP_LOCAL_DATA_DESCRIPTOR = "PK\x07\x08"; // Local Header, data descriptor
39
- const ZIP_END_OF_CENTRAL_DIRECTORY = "PK\x05\x06"; // End of Central directory record
40
-
41
- const HEADER_UNIX_TYPE_1 = 'UX'; // \x55\x58 or 0x5855 It has been replaced by the extended-timestamp extra block 'UT' (0x5455) and the Unix type 2 extra block 'Ux' (0x7855).
42
- const HEADER_UNIX_TYPE_2 = 'Ux'; // \x55\x78 or 0x7855
43
- const HEADER_UNIX_TYPE_3 = 'ux'; // \x75\x78 or 0x7875
44
- const HEADER_EXTENDED_TIMESTAMP = 'UT'; // \x55\x54 or 0x5455
45
- const HEADER_UNICODE_PATH = 'up'; // \x75\x70 or 0x7075
46
- const HEADER_UNICODE_COMMENT = 'uc'; // \x75\x63 or 0x6375
47
-
48
- const EXT_FILE_ATTR_DIR = 010173200020; // Permission 755 drwxr-xr-x = (((S_IFDIR | 0755) << 16) | S_DOS_D);
49
- const EXT_FILE_ATTR_FILE = 020151000040; // Permission 644 -rw-r--r-- = (((S_IFREG | 0644) << 16) | S_DOS_A);
50
-
51
- const ATTR_VERSION_TO_EXTRACT = "\x14\x00"; // Version needed to extract = 20 (File is compressed using Deflate compression)
52
- const ATTR_MADE_BY_VERSION = "\x1E\x03"; // Made By Version
53
-
54
- const DEFAULT_GZ_TYPE = "\x08\x00"; // Compression type 8 = deflate
55
- const DEFAULT_GP_FLAGS = self::NULL_WORD; // General Purpose bit flags for compression type 8 it is: 0=Normal, 1=Maximum, 2=Fast, 3=super fast compression.
56
-
57
- const DEFAULT_GZ_TYPE_STORED = self::NULL_WORD; // Compression type 0 = stored
58
- const DEFAULT_GP_FLAGS_STORED = self::NULL_WORD; // Compression type 0 = stored
59
-
60
- // UID 1000, GID 0
61
- const EXTRA_FIELD_NEW_UNIX_GUID = "ux\x0B\x00\x01\x04\xE8\x03\x00\x00\x04\x00\x00\x00\x00"; // \x75\x78 3rd gen Unis GUID
62
- const EXTRA_FIELD_NEW_UNIX_GUID_CD = "ux\x00\x00"; // \x75\x78 3rd gen Unis GUID CD record version must have length 0.
63
-
64
- protected $zipComment = null;
65
- protected $cdRec = array(); // central directory
66
- protected $offset = 0;
67
- protected $isFinalized = false;
68
- protected $addExtraField = true;
69
-
70
- protected $streamChunkSize = 0;
71
- protected $streamFilePath = null;
72
- protected $streamTimestamp = null;
73
- protected $streamFileComment = null;
74
- protected $streamFile = null;
75
- protected $streamData = null;
76
- protected $streamFileLength = 0;
77
- protected $streamExtFileAttr = null;
78
-
79
- /**
80
- * A custom temporary folder, or a callable that returns a custom temporary file.
81
- * @var string|callable
82
- */
83
- public static $temp = null;
84
-
85
- private $_listeners = array();
86
- private $_phpConfigurationWatch = array(
87
- // 'mbstring.func_overload' => '0' // throw an exception if setting in php.ini is not '0'
88
- );
89
-
90
- /**
91
- * Constructor.
92
- *
93
- * @author A. Grandt <php@grandt.com>
94
- * @author Greg Kappatos
95
- *
96
- * @param boolean $streamChunkSize Size of each chunk
97
- *
98
- * @throws \PHPZip\Zip\Exception\InvalidPhpConfiguration In case of errors
99
- */
100
- protected function __construct($streamChunkSize) {
101
- $this->streamChunkSize = $streamChunkSize;
102
-
103
- if (count($this->_phpConfigurationWatch) > 0) {
104
- foreach ($this->_phpConfigurationWatch as $k => $v) {
105
- $s = (string)$v;
106
- if (@ini_get($k) !== $s) {
107
- $this->_throwException(new InvalidPhpConfigurationException(array(
108
- 'setting' => $k,
109
- 'expected' => $s,
110
- )));
111
- break; // technically not needed.
112
- }
113
- }
114
- }
115
- }
116
-
117
- /**
118
- * Extra fields on the Zip directory records are Unix time codes needed for compatibility on the default Mac zip archive tool.
119
- * These are enabled as default, as they do no harm elsewhere and only add 26 bytes per file added.
120
- *
121
- * @author A. Grandt <php@grandt.com>
122
- *
123
- * @param bool $setExtraField true (default) will enable adding of extra fields, anything else will disable it.
124
- */
125
- public function setExtraField($setExtraField = true) {
126
- $this->addExtraField = ($setExtraField === true);
127
- }
128
-
129
- /**
130
- * Set Zip archive comment.
131
- *
132
- * @author A. Grandt <php@grandt.com>
133
- *
134
- * @param string $newComment New comment. null to clear.
135
- *
136
- * @return bool $success
137
- */
138
- public function setComment($newComment = null) {
139
- if ($this->isFinalized) {
140
- return false;
141
- }
142
-
143
- $this->zipComment = $newComment;
144
-
145
- return true;
146
- }
147
-
148
- /**
149
- * Add an empty directory entry to the zip archive.
150
- * Basically this is only used if an empty directory is added.
151
- *
152
- * @author A. Grandt <php@grandt.com>
153
- * @author Greg Kappatos
154
- *
155
- * @param string $directoryPath Directory Path and name to be added to the archive.
156
- * @param int $timestamp (Optional) Timestamp for the added directory, if omitted or set to 0, the current time will be used.
157
- * @param string $fileComment (Optional) Comment to be added to the archive for this directory. To use $fileComment, $timestamp must be given.
158
- * @param int $extFileAttr (Optional) The external file reference, use generateExtAttr to generate this.
159
- *
160
- * @return bool $success
161
- */
162
- public function addDirectory($directoryPath, $timestamp = 0, $fileComment = null, $extFileAttr = self::EXT_FILE_ATTR_DIR) {
163
- // TODO: get rid of magic numbers.
164
- $result = false;
165
-
166
- if (!$this->isFinalized) {
167
- $directoryPath = str_replace("\\", '/', $directoryPath);
168
- $directoryPath = rtrim($directoryPath, '/');
169
-
170
- if (BinStringStatic::_strlen($directoryPath) > 0) {
171
- $this->buildZipEntry($directoryPath.'/',
172
- $fileComment,
173
- self::DEFAULT_GZ_TYPE_STORED,
174
- self::DEFAULT_GP_FLAGS_STORED,
175
- $timestamp,
176
- "\x00\x00\x00\x00",
177
- 0, 0, $extFileAttr);
178
- $result = true;
179
- }
180
- }
181
- return $result;
182
- }
183
-
184
- /**
185
- * Add a file to the archive at the specified location and file name.
186
- *
187
- * @author A. Grandt <php@grandt.com>
188
- * @author Greg Kappatos
189
- *
190
- * @param string $data File data.
191
- * @param string $filePath File path and name to be used in the archive.
192
- * @param int $timestamp (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used.
193
- * @param string $fileComment (Optional) Comment to be added to the archive for this file. To use $fileComment, $timestamp must be given.
194
- * @param bool $compress (Optional) Compress file, if set to false the file will only be stored. Default true.
195
- * @param int $extFileAttr (Optional) The external file reference, use generateExtAttr to generate this.
196
- *
197
- * @return bool $success
198
- */
199
- public function addFile($data, $filePath, $timestamp = 0, $fileComment = null, $compress = null, $extFileAttr = self::EXT_FILE_ATTR_FILE) {
200
- if ($this->isFinalized) {
201
- return false;
202
- }
203
-
204
- if (is_resource($data) && get_resource_type($data) === 'stream') {
205
- $this->addLargeFile($data, $filePath, $timestamp, $fileComment, $extFileAttr);
206
- return false;
207
- }
208
-
209
- $gzData = '';
210
- $gzType = self::DEFAULT_GZ_TYPE;
211
- $gpFlags = self::DEFAULT_GP_FLAGS;
212
- $dataLength = BinStringStatic::_strlen($data);
213
- $fileCRC32 = pack("V", crc32($data));
214
- $gzLength = $dataLength;
215
-
216
- if ($compress) {
217
- $gzTmp = gzcompress($data);
218
- // gzcompress adds a 2 byte header and 4 byte Adler-32 CRC at the end, which we can't use.
219
- $gzData = substr($gzTmp, 2, -4);
220
- // The 2 byte header does contain useful data,
221
- // though in this case the 2 parameters we'd be interested in will
222
- // always be 8 for compression type, and 2 for General purpose flag.
223
- $gzLength = BinStringStatic::_strlen($gzData);
224
- }
225
-
226
- if ($gzLength >= $dataLength) {
227
- $gzLength = $dataLength;
228
- $gzData = $data;
229
-
230
- $gzType = self::DEFAULT_GZ_TYPE_STORED;
231
- $gpFlags = self::DEFAULT_GP_FLAGS_STORED;
232
- }
233
-
234
- $this->onBeginAddFile(array(
235
- 'gzLength' => $gzLength,
236
- ));
237
-
238
- $this->buildZipEntry($filePath, $fileComment, $gpFlags, $gzType, $timestamp, $fileCRC32, $gzLength, $dataLength, $extFileAttr);
239
-
240
- $this->onEndAddFile(array(
241
- 'gzData' => $gzData,
242
- ));
243
-
244
- $this->_notifyListeners(null, array(
245
- 'data' => $data,
246
- ));
247
-
248
- return true;
249
- }
250
-
251
- /**
252
- * Add the content to a directory.
253
- *
254
- * @author Adam Schmalhofer <Adam.Schmalhofer@gmx.de>
255
- * @author A. Grandt <php@grandt.com>
256
- *
257
- * @param string $realPath Path on the file system.
258
- * @param string $zipPath File path and name to be used in the archive.
259
- * @param bool $recursive Add content recursively, default is true.
260
- * @param bool $followSymlinks Follow and add symbolic links, if they are accessible, default is true.
261
- * @param array &$addedFiles Reference to the added files, this is used to prevent duplicates, default is an empty array.
262
- * If you start the function by parsing an array, the array will be populated with the $realPath
263
- * and $zipPath kay/value pairs added to the archive by the function.
264
- * @param bool $overrideFilePermissions Force the use of the file/dir permissions set in the $extDirAttr
265
- * and $extFileAttr parameters.
266
- * @param int $extDirAttr Permissions for directories.
267
- * @param int $extFileAttr Permissions for files.
268
- */
269
- public function addDirectoryContent($realPath, $zipPath, $recursive = true, $followSymlinks = true, &$addedFiles = array(),
270
- $overrideFilePermissions = false, $extDirAttr = self::EXT_FILE_ATTR_DIR, $extFileAttr = self::EXT_FILE_ATTR_FILE) {
271
- if (file_exists($realPath) && !isset($addedFiles[realpath($realPath)])) {
272
- if (is_dir($realPath)) {
273
- $this->addDirectory(
274
- $zipPath,
275
- 0,
276
- null,
277
- $overrideFilePermissions ? $extDirAttr : ZipUtils::getFileExtAttr($realPath)
278
- );
279
- }
280
-
281
- $addedFiles[realpath($realPath)] = $zipPath;
282
-
283
- $iter = new \DirectoryIterator($realPath);
284
-
285
- foreach ($iter as $file) {
286
- /* @var $file \DirectoryIterator */
287
- if ($file->isDot()) {
288
- continue;
289
- }
290
-
291
- $newRealPath = $file->getPathname();
292
- $newZipPath = \RelativePath::pathJoin($zipPath, $file->getFilename());
293
-
294
- if (file_exists($newRealPath) && ($followSymlinks || !is_link($newRealPath))) {
295
- if ($file->isFile()) {
296
- $addedFiles[realpath($newRealPath)] = $newZipPath;
297
- $this->addLargeFile(
298
- $newRealPath,
299
- $newZipPath,
300
- 0,
301
- null,
302
- $overrideFilePermissions ? $extFileAttr : ZipUtils::getFileExtAttr($newRealPath)
303
- );
304
- } else if ($recursive) {
305
- $this->addDirectoryContent(
306
- $newRealPath,
307
- $newZipPath,
308
- $recursive,
309
- $followSymlinks,
310
- $addedFiles,
311
- $overrideFilePermissions,
312
- $extDirAttr,
313
- $extFileAttr
314
- );
315
- } else {
316
- $this->addDirectory(
317
- $zipPath,
318
- 0,
319
- null,
320
- $overrideFilePermissions ? $extDirAttr : ZipUtils::getFileExtAttr($newRealPath)
321
- );
322
- }
323
- }
324
- }
325
- }
326
- }
327
-
328
- /**
329
- * Append the contents of an existing zip file to the current, WITHOUT re-compressing the data within it.
330
- *
331
- * @param string $file the path to the zip file to be added.
332
- * @param string $subPath place the contents in the $subPath sub-folder, default is '', and places the
333
- * content in the root of the new zip file.
334
- */
335
- public function appendZip($file, $subPath = '') {
336
- $zipMerge = new ZipMerge(null);
337
- $zipMerge->appendZip($file, $subPath, $this);
338
- $files = $zipMerge->finalize();
339
-
340
- /* @var $files array */
341
- foreach ($files as $fileEntry) {
342
- /* @var $fileEntry ZipFileEntry */
343
- $fileEntry->offset = $this->offset;
344
- $this->cdRec[] = $fileEntry->getCentralDirectoryHeader();
345
- $this->offset += BinStringStatic::_strlen( $fileEntry->getLocalHeader()) + $fileEntry->gzLength;
346
- }
347
- }
348
-
349
- /**
350
- * Add a file to the archive at the specified location and file name.
351
- *
352
- * @author A. Grandt <php@grandt.com>
353
- * @author Greg Kappatos
354
- *
355
- * @param string $dataFile File name/path.
356
- * @param string $filePath File path and name to be used in the archive.
357
- * @param int $timestamp (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used.
358
- * @param string $fileComment (Optional) Comment to be added to the archive for this file. To use $fileComment, $timestamp must be given.
359
- * @param int $extFileAttr (Optional) The external file reference, use generateExtAttr to generate this.
360
- *
361
- * @return bool $success
362
- */
363
- public function addLargeFile($dataFile, $filePath, $timestamp = 0, $fileComment = null, $extFileAttr = self::EXT_FILE_ATTR_FILE) {
364
- $result = false;
365
-
366
- if (!$this->isFinalized) {
367
-
368
- if (is_string($dataFile) && is_file($dataFile)) {
369
- $this->processFile($dataFile, $filePath, $timestamp, $fileComment, $extFileAttr);
370
- } else if (is_resource($dataFile) && get_resource_type($dataFile) == "stream") {
371
- $fh = $dataFile;
372
- $this->openStream($filePath, $timestamp, $fileComment, $extFileAttr);
373
-
374
- while (!feof($fh)) {
375
- $this->addStreamData(fread($fh, $this->streamChunkSize));
376
- }
377
- $this->closeStream();
378
- }
379
- $result = true;
380
- }
381
-
382
- $this->_notifyListeners(null, array(
383
- 'file' => $dataFile,
384
- 'result' => $result,
385
- ));
386
-
387
- return $result;
388
- }
389
-
390
- /**
391
- * Create a stream to be used for large entries.
392
- *
393
- * @author A. Grandt <php@grandt.com>
394
- * @author Greg Kappatos
395
- *
396
- * @param string $filePath File path and name to be used in the archive.
397
- * @param int $timestamp (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used.
398
- * @param string $fileComment (Optional) Comment to be added to the archive for this file. To use $fileComment, $timestamp must be given.
399
- * @param int $extFileAttr (Optional) The external file reference, use generateExtAttr to generate this.
400
- *
401
- * @throws \PHPZip\Zip\Exception\IncompatiblePhpVersion Throws an exception in case of errors
402
- *
403
- * @return bool $success
404
- */
405
- public function openStream($filePath, $timestamp = 0, $fileComment = null, $extFileAttr = self::EXT_FILE_ATTR_FILE) {
406
-
407
- $result = false;
408
-
409
- if (!function_exists('sys_get_temp_dir')) {
410
- $this->_throwException(new IncompatiblePhpVersionException(array(
411
- 'appName' => self::APP_NAME,
412
- 'appVersion' => self::VERSION,
413
- 'minVersion' => self::MIN_PHP_VERSION,
414
- )));
415
- }
416
-
417
- if (!$this->isFinalized) {
418
- $this->onOpenStream();
419
-
420
- if (BinStringStatic::_strlen($this->streamFilePath) > 0) {
421
- $this->closeStream();
422
- }
423
-
424
- $this->streamFile = self::getTemporaryFile();
425
- $this->streamData = fopen($this->streamFile, "wb");
426
- $this->streamFilePath = $filePath;
427
- $this->streamTimestamp = $timestamp;
428
- $this->streamFileComment = $fileComment;
429
- $this->streamFileLength = 0;
430
- $this->streamExtFileAttr = $extFileAttr;
431
-
432
- $result = true;
433
- }
434
-
435
- $this->_notifyListeners(null, array(
436
- 'file' => $this->streamFile,
437
- 'result' => $result,
438
- ));
439
-
440
- return $result;
441
- }
442
-
443
- /**
444
- * Add data to the open stream.
445
- *
446
- * @author A. Grandt <php@grandt.com>
447
- * @author Greg Kappatos
448
- *
449
- * @param string $data
450
- *
451
- * @throws LengthMismatchException Throws an exception in case of errors
452
- *
453
- * @return mixed length in bytes added or false if the archive is finalized or there are no open stream.
454
- */
455
- public function addStreamData($data) {
456
- if ($this->isFinalized || BinStringStatic::_strlen($this->streamFilePath) == 0) {
457
- return false;
458
- }
459
-
460
- $dataLength = BinStringStatic::_strlen($data);
461
- $length = fwrite($this->streamData, $data, $dataLength);
462
-
463
- if ($length != $dataLength) {
464
- $this->_throwException(new LengthMismatchException(array(
465
- 'expected' => BinStringStatic::_strlen($data),
466
- 'written' => (!$length ? 'NONE!' : $length),
467
- )));
468
- }
469
-
470
- $this->streamFileLength += $length;
471
-
472
- return $length;
473
- }
474
-
475
- /**
476
- * Close the current stream.
477
- *
478
- * @author A. Grandt <php@grandt.com>
479
- *
480
- * @return bool $success
481
- */
482
- public function closeStream() {
483
- if ($this->isFinalized || BinStringStatic::_strlen($this->streamFilePath) == 0) {
484
- return false;
485
- }
486
-
487
- fflush($this->streamData);
488
- fclose($this->streamData);
489
-
490
- $this->processFile(
491
- $this->streamFile,
492
- $this->streamFilePath,
493
- $this->streamTimestamp,
494
- $this->streamFileComment,
495
- $this->streamExtFileAttr
496
- );
497
-
498
- $this->streamData = null;
499
- $this->streamFilePath = null;
500
- $this->streamTimestamp = null;
501
- $this->streamFileComment = null;
502
- $this->streamFileLength = 0;
503
- $this->streamExtFileAttr = null;
504
-
505
- // Windows is a little slow at times, so a millisecond later, we can unlink this.
506
- unlink($this->streamFile);
507
- $this->streamFile = null;
508
-
509
- return true;
510
- }
511
-
512
- /**
513
- * Process the current file.
514
- *
515
- * @author A. Grandt <php@grandt.com>
516
- * @author Greg Kappatos
517
- *
518
- * @param string $dataFile
519
- * @param string $filePath
520
- * @param int $timestamp
521
- * @param string $fileComment
522
- * @param int $extFileAttr
523
- *
524
- * @return bool $success
525
- */
526
- protected function processFile($dataFile, $filePath, $timestamp = 0, $fileComment = null, $extFileAttr = self::EXT_FILE_ATTR_FILE) {
527
-
528
- // TODO: change the magic numbers below to constants.
529
-
530
- if ($this->isFinalized) {
531
- return false;
532
- }
533
-
534
- $tempZip = self::getTemporaryFile();
535
-
536
- $zip = new \ZipArchive;
537
- $rv = $zip->open($tempZip, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
538
-
539
- if ($rv === true) { // open returns true if successful, however one of the error values is 1, which will also read as true.
540
- $zip->addFile($dataFile, 'file');
541
- $zip->close();
542
- } else {
543
- // TODO: An error occurred reading the ZipArchive temp file (Seen on Windows installations)
544
- }
545
-
546
- $handle = fopen($tempZip, "rb");
547
- $stats = fstat($handle);
548
- $eof = $stats['size']-72; // set EOF to the position of the end of the zip data, before the CD record.
549
- // Should probably use 34+gzLength instead.
550
-
551
- fseek($handle, 6); // Skip Zip local file header and version
552
-
553
- $gpFlags = fread($handle, 2);
554
- $gzType = fread($handle, 2);
555
- fread($handle, 4); // Skip DOS Time and Date
556
- $fileCRC32 = fread($handle, 4);
557
-
558
- $v = unpack("Vval", fread($handle, 4));
559
- $gzLength = $v['val'];
560
-
561
- $v = unpack("Vval", fread($handle, 4));
562
- $dataLength = $v['val'];
563
-
564
- $this->buildZipEntry($filePath, $fileComment, $gpFlags, $gzType, $timestamp, $fileCRC32, $gzLength, $dataLength, $extFileAttr);
565
-
566
- $pos = 34;
567
- fseek($handle, $pos); // Position pointer at the start of the actual zip data.
568
-
569
- while (!feof($handle) && $pos < $eof) {
570
- $len = $this->streamChunkSize;
571
-
572
- if ($pos + $this->streamChunkSize > $eof) {
573
- $len = $eof - $pos;
574
- }
575
- $data = fread($handle, $len);
576
- $pos += $len;
577
-
578
- $this->onProcessFile(array(
579
- 'data' => $data,
580
- ));
581
- }
582
-
583
- fclose($handle);
584
- unlink($tempZip);
585
-
586
- $this->_notifyListeners(null, array(
587
- 'file' => $dataFile,
588
- ));
589
-
590
- return true;
591
- }
592
-
593
- /**
594
- * Build the Zip file structures
595
- *
596
- * @author A. Grandt <php@grandt.com>
597
- * @author Greg Kappatos
598
- *
599
- * @param string $filePath
600
- * @param string $fileComment
601
- * @param string $gpFlags
602
- * @param string $gzType
603
- * @param int $timestamp
604
- * @param string $fileCRC32
605
- * @param int $gzLength
606
- * @param int $dataLength
607
- * @param int $extFileAttr Use self::EXT_FILE_ATTR_FILE for files, self::EXT_FILE_ATTR_DIR for Directories.
608
- */
609
- protected function buildZipEntry($filePath, $fileComment, $gpFlags, $gzType, $timestamp, $fileCRC32, $gzLength, $dataLength, $extFileAttr) {
610
- $filePath = str_replace("\\", "/", $filePath);
611
- $fileCommentLength = (empty($fileComment) ? 0 : BinStringStatic::_strlen($fileComment));
612
- $timestamp = (int)$timestamp;
613
- $timestamp = ($timestamp == 0 ? time() : $timestamp);
614
-
615
- $dosTime = ZipUtils::getDosTime($timestamp);
616
- $tsPack = pack("V", $timestamp);
617
-
618
- if (!isset($gpFlags) || BinStringStatic::_strlen($gpFlags) != 2) {
619
- $gpFlags = self::DEFAULT_GP_FLAGS;
620
- }
621
-
622
- $isFileUTF8 = mb_check_encoding($filePath, "UTF-8") && !mb_check_encoding($filePath, "ASCII");
623
- $isCommentUTF8 = !empty($fileComment) && mb_check_encoding($fileComment, "UTF-8") && !mb_check_encoding($fileComment, "ASCII");
624
-
625
- $locExField = "";
626
- $cenExField = "";
627
-
628
- if ($this->addExtraField) {
629
- $locExField .= self::HEADER_EXTENDED_TIMESTAMP . "\x09\x00\x03"
630
- . $tsPack . $tsPack
631
- . self::EXTRA_FIELD_NEW_UNIX_GUID;
632
- $cenExField .= self::HEADER_EXTENDED_TIMESTAMP . "\x05\x00\x03"
633
- . $tsPack
634
- . self::EXTRA_FIELD_NEW_UNIX_GUID_CD;
635
- }
636
-
637
- if ($isFileUTF8 || $isCommentUTF8) {
638
- $flag = 0;
639
- $gpFlagsV = unpack("vflags", $gpFlags);
640
- if (isset($gpFlagsV['flags'])) {
641
- $flag = $gpFlagsV['flags'];
642
- }
643
- $gpFlags = pack("v", $flag | (1 << 11));
644
-
645
- if ($isFileUTF8) {
646
- $utfExField = self::HEADER_UNICODE_PATH // utf8 encoded File path extra field
647
- . pack ("v", (5 + BinStringStatic::_strlen($filePath)))
648
- . "\x01"
649
- . pack("V", crc32($filePath))
650
- . $filePath;
651
-
652
- $locExField .= $utfExField;
653
- $cenExField .= $utfExField;
654
- }
655
- if ($isCommentUTF8) {
656
- $cenExField .= self::HEADER_UNICODE_COMMENT // utf8 encoded file comment extra field
657
- . pack ("v", (5 + BinStringStatic::_strlen($fileComment)))
658
- . "\x01"
659
- . pack("V", crc32($fileComment))
660
- . $fileComment;
661
- }
662
- }
663
-
664
- $header = $gpFlags . $gzType . $dosTime. $fileCRC32
665
- . pack("VVv", $gzLength, $dataLength, BinStringStatic::_strlen($filePath)); // File name length
666
-
667
- $zipEntry = self::ZIP_LOCAL_FILE_HEADER
668
- . self::ATTR_VERSION_TO_EXTRACT
669
- . $header
670
- . pack("v", BinStringStatic::_strlen($locExField)) // Extra field length
671
- . $filePath // FileName
672
- . $locExField; // Extra fields
673
-
674
- $this->onBuildZipEntry(array(
675
- 'zipEntry' => $zipEntry,
676
- ));
677
-
678
- $cdEntry = self::ZIP_CENTRAL_FILE_HEADER
679
- . self::ATTR_MADE_BY_VERSION
680
- . ($dataLength === 0 ? "\x0A\x00" : self::ATTR_VERSION_TO_EXTRACT)
681
- . $header
682
- . pack("v", BinStringStatic::_strlen($cenExField)) // Extra field length
683
- . pack("v", $fileCommentLength) // File comment length
684
- . self::NULL_WORD // Disk number start
685
- . self::NULL_WORD // internal file attributes
686
- . pack("V", $extFileAttr) // External file attributes
687
- . pack("V", $this->offset) // Relative offset of local header
688
- . $filePath // FileName
689
- . $cenExField; // Extra fields
690
-
691
- if (!empty($fileComment)) {
692
- $cdEntry .= $fileComment; // Comment
693
- }
694
-
695
- $this->cdRec[] = $cdEntry;
696
- $this->offset += BinStringStatic::_strlen($zipEntry) + $gzLength;
697
-
698
- $this->_notifyListeners(null, array(
699
- 'file' => $zipEntry,
700
- ));
701
- }
702
-
703
- /**
704
- * Build the base standard response headers, and ensure the content can be streamed.
705
- *
706
- * @author A. Grandt <php@grandt.com>
707
- * @author Greg Kappatos
708
- *
709
- * @param String $fileName The name of the Zip archive, in ISO-8859-1 (or ASCII) encoding, ie. "archive.zip". Optional, defaults to null, which means that no ISO-8859-1 encoded file name will be specified.
710
- * @param String $contentType Content mime type. Optional, defaults to "application/zip".
711
- * @param String $utf8FileName The name of the Zip archive, in UTF-8 encoding. Optional, defaults to null, which means that no UTF-8 encoded file name will be specified.
712
- * @param bool $inline Use Content-Disposition with "inline" instead of "attached". Optional, defaults to false.
713
- *
714
- * @throws \PHPZip\Zip\Exception\IncompatiblePhpVersion, BufferNotEmpty, HeadersSent In case of errors
715
- *
716
- * @return bool Always returns true (for backward compatibility).
717
- */
718
- public function buildResponseHeader($fileName = null, $contentType = self::CONTENT_TYPE, $utf8FileName = null, $inline = false) {
719
- $ob = null;
720
- $headerFile = null;
721
- $headerLine = null;
722
- $zlibConfig = 'zlib.output_compression';
723
-
724
- $this->onBeginBuildResponseHeader();
725
-
726
- if (!function_exists('sys_get_temp_dir')) {
727
- $this->_throwException(new IncompatiblePhpVersionException(array(
728
- 'appName' => self::APP_NAME,
729
- 'appVersion' => self::VERSION,
730
- 'minVersion' => self::MIN_PHP_VERSION,
731
- )));
732
- }
733
-
734
- $ob = ob_get_contents();
735
- if ($ob !== false && BinStringStatic::_strlen($ob)) {
736
- $this->_throwException(new BufferNotEmptyException(array(
737
- 'outputBuffer' => $ob,
738
- 'fileName' => $fileName,
739
- )));
740
- }
741
-
742
- if (headers_sent($headerFile, $headerLine)) {
743
- $this->_throwException(new HeadersSentException(array(
744
- 'headerFile' => $headerFile,
745
- 'headerLine' => $headerLine,
746
- 'fileName' => $fileName,
747
- )));
748
- }
749
-
750
- if (@ini_get($zlibConfig)) {
751
- @ini_set($zlibConfig, 'Off');
752
- }
753
-
754
- $cd = 'Content-Disposition: ' . ($inline ? 'inline' : 'attachment');
755
-
756
- if ($fileName) {
757
- $cd .= '; filename="' . $fileName . '"';
758
- }
759
-
760
- if ($utf8FileName) {
761
- $cd .= "; filename*=UTF-8''" . rawurlencode($utf8FileName);
762
- }
763
-
764
- header('Pragma: public');
765
- header('Last-Modified: ' . gmdate('D, d M Y H:i:s T'));
766
- header('Expires: 0');
767
- header('Accept-Ranges: bytes');
768
- header('Content-Type: ' . $contentType);
769
- header($cd);
770
-
771
- $this->onEndBuildResponseHeader();
772
-
773
- $this->_notifyListeners(null, array(
774
- 'file' => $fileName,
775
- 'utf8FileName' => $utf8FileName,
776
- 'contentType' => $contentType,
777
- ));
778
-
779
- return true;
780
- }
781
-
782
- /**
783
- * Close the archive.
784
- * A closed archive can no longer have new files added to it.
785
- *
786
- * @author A. Grandt <php@grandt.com>
787
- *
788
- * @return bool Success
789
- */
790
- public function finalize() {
791
- if (!$this->isFinalized) {
792
- if (BinStringStatic::_strlen($this->streamFilePath) > 0) {
793
- $this->closeStream();
794
- }
795
-
796
- $cd = implode("", $this->cdRec);
797
-
798
- $cdRecSize = pack("v", sizeof($this->cdRec));
799
- $cdRec = $cd . self::ZIP_END_OF_CENTRAL_DIRECTORY
800
- . self::NULL_DWORD // really two words, used for split archives: #ofThisDisk . #ofDiskWithCD. Both 0.
801
- . $cdRecSize . $cdRecSize
802
- . pack("VV", BinStringStatic::_strlen($cd), $this->offset);
803
-
804
- if (!empty($this->zipComment)) {
805
- $cdRec .= pack("v", BinStringStatic::_strlen($this->zipComment))
806
- . $this->zipComment;
807
- } else {
808
- $cdRec .= self::NULL_WORD;
809
- }
810
-
811
- $this->zipWrite($cdRec);
812
- $this->zipFlushBuffer();
813
-
814
- $this->isFinalized = true;
815
- $this->cdRec = null;
816
-
817
- return true;
818
- }
819
-
820
- return false;
821
- }
822
-
823
- /**
824
- * Check PHP version.
825
- *
826
- * @author A. Grandt <php@grandt.com>
827
- */
828
- public function checkVersion() {
829
- if (version_compare(PHP_VERSION, self::MIN_PHP_VERSION, '<') || !function_exists('sys_get_temp_dir') ) {
830
- die ("ERROR: " . self::APP_NAME . " " . self::VERSION . " requires PHP version " . self::MIN_PHP_VERSION . " or above.");
831
- }
832
- }
833
-
834
- /*
835
- * ************************************************************************
836
- * Abstract methods.
837
- * ************************************************************************
838
- */
839
-
840
- /**
841
- * Called when specialised action is needed
842
- * while building a zip entry.
843
- *
844
- * @author A. Grandt <php@grandt.com>
845
- * @author Greg Kappatos
846
- *
847
- * @param array $params Array that contains zipEntry.
848
- */
849
- abstract protected function onBuildZipEntry(array $params);
850
-
851
- /**
852
- * Called when specialised action is needed
853
- * at the start of adding a file to the archive.
854
- *
855
- * @author A. Grandt <php@grandt.com>
856
- * @author Greg Kappatos
857
- *
858
- * @param array $params Array that contains gzLength.
859
- */
860
- abstract protected function onBeginAddFile(array $params);
861
-
862
- /**
863
- * Called when specialised action is needed
864
- * at the end of adding a file to the archive.
865
- *
866
- * @author A. Grandt <php@grandt.com>
867
- * @author Greg Kappatos
868
- *
869
- * @param array $params Array that contains gzData.
870
- */
871
- abstract protected function onEndAddFile(array $params);
872
-
873
- /**
874
- * Called when specialised action is needed
875
- * at the start of sending the zip file|stream
876
- * response headers.
877
- *
878
- * @author A. Grandt <php@grandt.com>
879
- * @author Greg Kappatos
880
- */
881
- abstract protected function onBeginBuildResponseHeader();
882
-
883
- /**
884
- * Called when specialised action is needed
885
- * at the end of sending the zip file|stream
886
- * response headers.
887
- *
888
- * @author A. Grandt <php@grandt.com>
889
- * @author Greg Kappatos
890
- */
891
- abstract protected function onEndBuildResponseHeader();
892
-
893
- /**
894
- * Called when specialised action is needed
895
- * while opening a file|stream.
896
- *
897
- * @author A. Grandt <php@grandt.com>
898
- * @author Greg Kappatos
899
- */
900
- abstract protected function onOpenStream();
901
-
902
- /**
903
- * Called when specialised action is needed
904
- * while processing a file.
905
- *
906
- * @author A. Grandt <php@grandt.com>
907
- * @author Greg Kappatos
908
- *
909
- * @param array $params Array that contains data.
910
- */
911
- abstract protected function onProcessFile(array $params);
912
-
913
- /**
914
- * Verify if the memory buffer is about to be exceeded.
915
- *
916
- * @author A. Grandt <php@grandt.com>
917
- *
918
- * @param int $gzLength length of the pending data.
919
- */
920
- abstract public function zipVerifyMemBuffer($gzLength);
921
-
922
- /**
923
- *
924
- * @author A. Grandt <php@grandt.com>
925
- *
926
- * @param string $data
927
- */
928
- //abstract public function zipWrite($data);
929
-
930
- /**
931
- * Flush Zip Data stored in memory, to a temp file.
932
- *
933
- * @author A. Grandt <php@grandt.com>
934
- *
935
- */
936
- abstract public function zipFlush();
937
-
938
- /**
939
- *
940
- * @author A. Grandt <php@grandt.com>
941
- *
942
- */
943
- abstract public function zipFlushBuffer();
944
-
945
- /*
946
- * ************************************************************************
947
- * Listener methods.
948
- * ************************************************************************
949
- */
950
-
951
- /**
952
- * Listen to events fired by this class.
953
- *
954
- * @author Greg Kappatos
955
- *
956
- * @param ZipArchiveListener $listener Class that implements the ZipArchiveListener interface.
957
- */
958
- public function addListener(ZipArchiveListener $listener) {
959
- $this->_listeners[] = $listener;
960
- }
961
-
962
- /**
963
- * Stop listening to events fired by this class.
964
- *
965
- * @author Greg Kappatos
966
- *
967
- * @param ZipArchiveListener $listener Class that implements the ZipArchiveListener interface.
968
- */
969
- public function removeListener(ZipArchiveListener $listener) {
970
- $key = array_search($listener, $this->_listeners);
971
-
972
- if ($key !== false) {
973
- unset($this->_listeners[$key]);
974
- }
975
- }
976
-
977
- /**
978
- * Helper method to fire appropriate event.
979
- *
980
- * @author Greg Kappatos
981
- *
982
- * @param string|null $method (Optional) The name of the event to fire. If this is null, then the calling method is used.
983
- * @param array $data Method parameters passed as an array.
984
- */
985
- private function _notifyListeners($method = null, array $data = array()) {
986
- if (is_null($method)) {
987
- $backtrace = debug_backtrace();
988
- if (sizeof($backtrace) > 0) {
989
- $trace = $backtrace[1];
990
- $method = 'on' . ucwords($trace['function']);
991
- }
992
- }
993
-
994
- foreach ($this->_listeners as $listener) {
995
- if (count($data) > 0) {
996
- $listener->$method($data);
997
- } else {
998
- $listener->$method();
999
- }
1000
- }
1001
- }
1002
-
1003
- /**
1004
- * Helper method to fire OnException event for listeners and then throw the appropriate exception.
1005
- *
1006
- * @author Greg Kappatos
1007
- *
1008
- * @param AbstractException $exception Whatever exception needs to be thrown.
1009
- *
1010
- * @throws AbstractException $exception
1011
- */
1012
- private function _throwException(AbstractException $exception) {
1013
- $this->_notifyListeners('onException', array(
1014
- 'exception' => $exception,
1015
- ));
1016
-
1017
- throw $exception;
1018
- }
1019
-
1020
- /*
1021
- * ************************************************************************
1022
- * Static methods/
1023
- * ************************************************************************
1024
- */
1025
-
1026
- /**
1027
- *
1028
- * @author A. Grandt <php@grandt.com>
1029
- * @author Greg Kappatos
1030
- *
1031
- * @return string The full path to a temporary file.
1032
- */
1033
- public static function getTemporaryFile() {
1034
- if (is_callable(self::$temp)) {
1035
- $file = @call_user_func(self::$temp);
1036
-
1037
- if (is_string($file) && BinStringStatic::_strlen($file) && is_writable($file)) {
1038
- return $file;
1039
- }
1040
- }
1041
-
1042
- $dir = (is_string(self::$temp) && BinStringStatic::_strlen(self::$temp)) ? self::$temp : sys_get_temp_dir();
1043
-
1044
- return tempnam($dir, __NAMESPACE__);
1045
- }
1046
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/extensions/zipdd/Core/ZipUtils.php DELETED
@@ -1,125 +0,0 @@
1
- <?php
2
- namespace PHPZip\Zip\Core;
3
-
4
- use com\grandt\BinStringStatic;
5
-
6
- class ZipUtils {
7
- // Unix file types
8
- const S_IFIFO = 0010000; // named pipe (fifo)
9
- const S_IFCHR = 0020000; // character special
10
- const S_IFDIR = 0040000; // directory
11
- const S_IFBLK = 0060000; // block special
12
- const S_IFREG = 0100000; // regular
13
- const S_IFLNK = 0120000; // symbolic link
14
- const S_IFSOCK = 0140000; // socket
15
-
16
- // setuid/setgid/sticky bits, the same as for chmod:
17
- const S_ISUID = 0004000; // set user id on execution
18
- const S_ISGID = 0002000; // set group id on execution
19
- const S_ISTXT = 0001000; // sticky bit
20
-
21
- // And of course, the other 12 bits are for the permissions, the same as for chmod:
22
- // When adding these up, you can also just write the permissions as a single octal number
23
- // ie. 0755. The leading 0 specifies octal notation.
24
- const S_IRWXU = 0000700; // RWX mask for owner
25
- const S_IRUSR = 0000400; // R for owner
26
- const S_IWUSR = 0000200; // W for owner
27
- const S_IXUSR = 0000100; // X for owner
28
- const S_IRWXG = 0000070; // RWX mask for group
29
- const S_IRGRP = 0000040; // R for group
30
- const S_IWGRP = 0000020; // W for group
31
- const S_IXGRP = 0000010; // X for group
32
- const S_IRWXO = 0000007; // RWX mask for other
33
- const S_IROTH = 0000004; // R for other
34
- const S_IWOTH = 0000002; // W for other
35
- const S_IXOTH = 0000001; // X for other
36
- const S_ISVTX = 0001000; // save swapped text even after use
37
-
38
- // File type, sticky and permissions are added up, and shifted 16 bits left BEFORE adding the DOS flags.
39
- // DOS file type flags, we really only use the S_DOS_D flag.
40
- const S_DOS_A = 0000040; // DOS flag for Archive
41
- const S_DOS_D = 0000020; // DOS flag for Directory
42
- const S_DOS_V = 0000010; // DOS flag for Volume
43
- const S_DOS_S = 0000004; // DOS flag for System
44
- const S_DOS_H = 0000002; // DOS flag for Hidden
45
- const S_DOS_R = 0000001; // DOS flag for Read Only
46
-
47
- /**
48
- * Calculate the 2 byte dos time used in the zip entries.
49
- *
50
- * @author A. Grandt <php@grandt.com>
51
- *
52
- * @param int $timestamp
53
- *
54
- * @return string 2-byte encoded DOS Date
55
- */
56
- public static function getDosTime($timestamp = 0) {
57
- $timestamp = (int)$timestamp;
58
- $oldTZ = @date_default_timezone_get();
59
- date_default_timezone_set('UTC');
60
-
61
- $date = ($timestamp == 0 ? getdate() : getdate($timestamp));
62
- date_default_timezone_set($oldTZ);
63
-
64
- if ($date["year"] >= 1980) { // Dos dates start on 1 Jan 1980
65
- return pack("V", (($date["mday"] + ($date["mon"] << 5) + (($date["year"] - 1980) << 9)) << 16) |
66
- (($date["seconds"] >> 1) + ($date["minutes"] << 5) + ($date["hours"] << 11)));
67
- }
68
- return "\x00\x00\x00\x00";
69
- }
70
-
71
- /**
72
- * Create the file permissions for a file or directory, for use in the extFileAttr parameters.
73
- *
74
- * @author A. Grandt <php@grandt.com>
75
- *
76
- * @param int $owner Unix permissions for owner (octal from 00 to 07)
77
- * @param int $group Unix permissions for group (octal from 00 to 07)
78
- * @param int $other Unix permissions for others (octal from 00 to 07)
79
- * @param bool $isFile
80
- *
81
- * @return string EXTERNAL_REF field.
82
- */
83
- public static function generateExtAttr($owner = 07, $group = 05, $other = 05, $isFile = true) {
84
- $fp = $isFile ? self::S_IFREG : self::S_IFDIR;
85
- $fp |= (($owner & 07) << 6) | (($group & 07) << 3) | ($other & 07);
86
-
87
- return ($fp << 16) | ($isFile ? self::S_DOS_A : self::S_DOS_D);
88
- }
89
-
90
- /**
91
- * Get the file permissions for a file or directory, for use in the extFileAttr parameters.
92
- *
93
- * @author A. Grandt <php@grandt.com>
94
- *
95
- * @param string $filename
96
- *
97
- * @return string|bool external ref field, or false if the file is not found.
98
- */
99
- public static function getFileExtAttr($filename) {
100
- if (file_exists($filename)) {
101
- $fp = fileperms($filename) << 16;
102
- return $fp | (is_dir($filename) ? self::S_DOS_D : self::S_DOS_A);
103
- }
104
-
105
- return false;
106
- }
107
-
108
- public static function testBit($data, $bit) {
109
- $bv = 1 << $bit;
110
- return ($data & $bv) == $bv;
111
- }
112
-
113
- public static function setBit(&$data, $bit, $value = true) {
114
- if ($value) {
115
- $data |= (1 << $bit);
116
- } else {
117
- self::clrBit($data, $bit);
118
- }
119
-
120
- }
121
-
122
- public static function clrBit(&$data, $bit) {
123
- $data &= ~(1 << $bit);
124
- }
125
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/extensions/zipdd/Core/index.html DELETED
File without changes
includes/extensions/zipdd/Exception/BufferNotEmpty.php DELETED
@@ -1,46 +0,0 @@
1
- <?php
2
- /**
3
- *
4
- * @author Greg Kappatos
5
- *
6
- * This class serves as a concrete exception.
7
- * It will be thrown if the output buffer contains data while
8
- * trying to perform any operations with this library.
9
- *
10
- */
11
-
12
- namespace PHPZip\Zip\Exception;
13
-
14
- use PHPZip\Zip\Core\AbstractException;
15
-
16
- class BufferNotEmpty extends AbstractException {
17
-
18
- private $_outputBuffer = null;
19
- private $_fileName = null;
20
-
21
- /**
22
- * Constructor
23
- *
24
- * @author A. Grandt <php@grandt.com>
25
- * @author Greg Kappatos
26
- *
27
- * @param array $config Configuration array containing outputBuffer and fileName
28
- */
29
- public function __construct(array $config){
30
- $this->_outputBuffer = $config['outputBuffer'];
31
- $this->_fileName = isset($config['fileName']) ? $config['fileName'] : null;
32
-
33
- $message = is_null($this->_fileName) ? '' : "Unable to send '{$this->_fileName}'. ";
34
- $message .= "Output buffer contains the following text (typically warning or errors):\n{$this->_outputBuffer}";
35
-
36
- parent::__construct($message);
37
- }
38
-
39
- public function getOutputBuffer(){
40
- return $this->_outputBuffer;
41
- }
42
-
43
- public function getFileName(){
44
- return $this->_fileName;
45
- }
46
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/extensions/zipdd/Exception/HeaderPositionError.php DELETED
@@ -1,52 +0,0 @@
1
- <?php
2
- /**
3
- *
4
- * @author Greg Kappatos
5
- *
6
- * This class serves as a concrete exception.
7
- * It will be thrown if the output length of fwrite() does not match
8
- * the input length. So far, this only occurs in Core\AbstractZipArchive::addStreamData()
9
- *
10
- */
11
-
12
- namespace PHPZip\Zip\Exception;
13
-
14
- use PHPZip\Zip\Core\AbstractException;
15
-
16
- class HeaderPositionError extends AbstractException {
17
-
18
- private $_expected = null;
19
- private $_actual = null;
20
-
21
- /**
22
- * Constructor
23
- *
24
- * @author A. Grandt <php@grandt.com>
25
- * @author Greg Kappatos
26
- *
27
- * @param array $config Configuration array containing expected and written
28
- */
29
- public function __construct(array $config){
30
- $this->_expected = (string)$config['expected'];
31
- $this->_actual = (string)$config['actual'];
32
-
33
- $message = sprintf(
34
- '%s %s %s %s %s',
35
- (string)($this->_actual - $this->_expected),
36
- ' extra bytes before header. Expected pos ',
37
- $this->_expected,
38
- ' but found the header at ',
39
- $this->_actual
40
- );
41
-
42
- parent::__construct($message);
43
- }
44
-
45
- public function getExpected(){
46
- return $this->_expected;
47
- }
48
-
49
- public function getActual(){
50
- return $this->_actual;
51
- }
52
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/extensions/zipdd/Exception/HeadersSent.php DELETED
@@ -1,52 +0,0 @@
1
- <?php
2
- /**
3
- *
4
- * @author Greg Kappatos
5
- *
6
- * This class serves as a concrete exception.
7
- * It will be thrown if any headers have been sent, or if any
8
- * output has been printed or echoed.
9
- *
10
- */
11
-
12
- namespace PHPZip\Zip\Exception;
13
-
14
- use PHPZip\Zip\Core\AbstractException;
15
-
16
- class HeadersSent extends AbstractException {
17
-
18
- private $_headerFile = null;
19
- private $_headerLine = null;
20
- private $_fileName = null;
21
-
22
- /**
23
- * Constructor
24
- *
25
- * @author A. Grandt <php@grandt.com>
26
- * @author Greg Kappatos
27
- *
28
- * @param array $config Configuration array containing headerFile, headerLine and fileName
29
- */
30
- public function __construct(array $config){
31
- $this->_headerFile = $config['headerFile'];
32
- $this->_headerLine = $config['headerLine'];
33
- $this->_fileName = isset($config['fileName']) ? $config['fileName'] : null;
34
-
35
- $message = is_null($this->_fileName) ? '' : "Unable to send '{$this->_fileName}'. ";
36
- $message .= "Headers have already been sent from '{$this->_headerFile}' in line {$this->_headerLine}";
37
-
38
- parent::__construct($message);
39
- }
40
-
41
- public function getHeaderFile(){
42
- return $this->_headerFile;
43
- }
44
-
45
- public function getHeaderLine(){
46
- return $this->_headerLine;
47
- }
48
-
49
- public function getFileName(){
50
- return $this->_fileName;
51
- }
52
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/extensions/zipdd/Exception/IncompatiblePhpVersion.php DELETED
@@ -1,54 +0,0 @@
1
- <?php
2
- /**
3
- *
4
- * @author Greg Kappatos
5
- *
6
- * This class serves as a concrete exception.
7
- * It will be thrown if the current PHP version is below the minimum
8
- * required version.
9
- *
10
- */
11
-
12
- namespace PHPZip\Zip\Exception;
13
-
14
- use PHPZip\Zip\Core\AbstractException;
15
-
16
- class IncompatiblePhpVersion extends AbstractException {
17
-
18
- private $_minVersion = null;
19
- private $_currentVersion = null;
20
-
21
- /**
22
- * Constructor
23
- *
24
- * @author A. Grandt <php@grandt.com>
25
- * @author Greg Kappatos
26
- *
27
- * @param array $config Configuration array containing appName, appVersion and minVersion (PHP)
28
- */
29
- public function __construct(array $config){
30
- $this->_minVersion = (string)$config['minVersion'];
31
- $this->_currentVersion = (string)phpversion();
32
-
33
- $message = sprintf(
34
- '%s %s %s %s %s (%s %s).',
35
- $config['appName'],
36
- (string)$config['appVersion'],
37
- 'requires PHP version',
38
- $this->_minVersion,
39
- 'or above',
40
- $this->_currentVersion,
41
- 'detected'
42
- );
43
-
44
- parent::__construct($message);
45
- }
46
-
47
- public function getMinVersion(){
48
- return $this->_minVersion;
49
- }
50
-
51
- public function getCurrentVersion(){
52
- return $this->_currentVersion;
53
- }
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/extensions/zipdd/Exception/InvalidPhpConfiguration.php DELETED
@@ -1,58 +0,0 @@
1
- <?php
2
- /**
3
- *
4
- * @author Greg Kappatos
5
- *
6
- * This class serves as a concrete exception.
7
- * It will be thrown if an invalid setting is detected in php.ini
8
- * that will prevent this library from operating properly.
9
- *
10
- */
11
-
12
- namespace PHPZip\Zip\Exception;
13
-
14
- use PHPZip\Zip\Core\AbstractException;
15
-
16
- class InvalidPhpConfiguration extends AbstractException {
17
-
18
- private $_setting = null;
19
- private $_expected = null;
20
- private $_actual = null;
21
-
22
- /**
23
- * Constructor
24
- *
25
- * @author Greg Kappatos
26
- *
27
- * @param array $config Configuration array containing php.ini settings: setting and expected (value)
28
- */
29
- public function __construct(array $config){
30
- $this->_setting = $config['setting'];
31
- $this->_expected = $config['expected'];
32
- $this->_actual = (string)@ini_get($this->_setting);
33
-
34
- $message = sprintf(
35
- '%s %s "%s" %s %s %s',
36
- 'Invalid PHP Configuration: ',
37
- $this->_setting,
38
- $this->_actual,
39
- 'Please change this setting to',
40
- $this->_expected,
41
- 'to continue.'
42
- );
43
-
44
- parent::__construct($message);
45
- }
46
-
47
- public function getSetting(){
48
- return $this->_setting;
49
- }
50
-
51
- public function getExpected(){
52
- return $this->_expected;
53
- }
54
-
55
- public function getActual(){
56
- return $this->_actual;
57
- }
58
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/extensions/zipdd/Exception/LengthMismatch.php DELETED
@@ -1,51 +0,0 @@
1
- <?php
2
- /**
3
- *
4
- * @author Greg Kappatos
5
- *
6
- * This class serves as a concrete exception.
7
- * It will be thrown if the output length of fwrite() does not match
8
- * the input length. So far, this only occurs in Core\AbstractZipArchive::addStreamData()
9
- *
10
- */
11
-
12
- namespace PHPZip\Zip\Exception;
13
-
14
- use PHPZip\Zip\Core\AbstractException;
15
-
16
- class LengthMismatch extends AbstractException {
17
-
18
- private $_expected = null;
19
- private $_written = null;
20
-
21
- /**
22
- * Constructor
23
- *
24
- * @author A. Grandt <php@grandt.com>
25
- * @author Greg Kappatos
26
- *
27
- * @param array $config Configuration array containing expected and written
28
- */
29
- public function __construct(array $config){
30
- $this->_expected = (string)$config['expected'];
31
- $this->_written = (string)$config['written'];
32
-
33
- $message = sprintf(
34
- '%s %s %s %s',
35
- 'Length Mismatch Error: Expected',
36
- $this->_expected,
37
- 'bytes, wrote',
38
- $this->_written
39
- );
40
-
41
- parent::__construct($message);
42
- }
43
-
44
- public function getExpected(){
45
- return $this->_expected;
46
- }
47
-
48
- public function getWritten(){
49
- return $this->_written;
50
- }
51
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/extensions/zipdd/Exception/index.html DELETED
File without changes
includes/extensions/zipdd/File/Zip.php DELETED
@@ -1,187 +0,0 @@
1
- <?php
2
- /**
3
- *
4
- * @author A. Grandt <php@grandt.com>
5
- * @author Greg Kappatos
6
- *
7
- * This class serves as a concrete zip file archive.
8
- *
9
- */
10
-
11
- namespace PHPZip\Zip\File;
12
-
13
- use com\grandt\BinStringStatic;
14
- use PHPZip\Zip\Core\AbstractZipArchive;
15
-
16
- class Zip extends AbstractZipArchive {
17
-
18
- const MEMORY_THRESHOLD = 1048576; // 1 MB - Auto create temp file if the zip data exceeds this
19
- const STREAM_CHUNK_SIZE = 65536; // 64 KB
20
-
21
- private $_zipData = null;
22
- private $_zipFile = null;
23
-
24
- public function __construct($useZipFile = false) {
25
- parent::__construct(self::STREAM_CHUNK_SIZE);
26
-
27
- if ($useZipFile) {
28
- $this->_zipFile = tmpfile();
29
- } else {
30
- $this->_zipData = '';
31
- }
32
- }
33
-
34
- public function __destruct() {
35
- if (is_resource($this->_zipFile)) {
36
- fclose($this->_zipFile);
37
- }
38
-
39
- $this->_zipData = null;
40
- }
41
-
42
- public function setZipFile($fileName) {
43
- if (is_file($fileName)) {
44
- unlink($fileName);
45
- }
46
-
47
- $fd = fopen($fileName, "x+b");
48
-
49
- if (is_resource($this->_zipFile)) {
50
- rewind($this->_zipFile);
51
-
52
- while (!feof($this->_zipFile)) {
53
- fwrite($fd, fread($this->_zipFile, $this->streamChunkSize));
54
- }
55
-
56
- fclose($this->_zipFile);
57
- } else {
58
- fwrite($fd, $this->_zipData);
59
- $this->_zipData = null;
60
- }
61
-
62
- $this->_zipFile = $fd;
63
- return true;
64
- }
65
-
66
- public function saveZipFile($fileName) {
67
- return $this->setZipFile($fileName);
68
- }
69
-
70
- public function getZipFile() {
71
- if (!$this->isFinalized) {
72
- $this->finalize();
73
- }
74
-
75
- $this->zipFlush();
76
- rewind($this->_zipFile);
77
- return $this->_zipFile;
78
- }
79
-
80
- public function sendZip($fileName = null, $contentType = self::CONTENT_TYPE, $utf8FileName = null, $inline = false) {
81
- if (!$this->isFinalized) {
82
- $this->finalize();
83
- }
84
-
85
- if ($this->buildResponseHeader($fileName, $contentType, $utf8FileName, $inline)) {
86
- return true;
87
- }
88
- return false;
89
- }
90
-
91
- public function getZipData() {
92
- $result = null;
93
-
94
- if (!$this->isFinalized) {
95
- $this->finalize();
96
- }
97
-
98
- if (!is_resource($this->_zipFile)) {
99
- $result = $this->_zipData;
100
- } else {
101
- rewind($this->_zipFile);
102
- $stat = fstat($this->_zipFile);
103
- $result = fread($this->_zipFile, $stat['size']);
104
- }
105
-
106
- return $result;
107
- }
108
-
109
- public function getArchiveSize() {
110
- if (!is_resource($this->_zipFile)) {
111
- return BinStringStatic::_strlen($this->_zipData);
112
- }
113
-
114
- $stat = fstat($this->_zipFile);
115
- return $stat['size'];
116
- }
117
-
118
- public function onBuildZipEntry(array $params) {
119
- $this->zipWrite($params['zipEntry']);
120
- }
121
-
122
- public function onBeginAddFile(array $params) {
123
- if (!is_resource($this->_zipFile) && ($this->offset + $params['gzLength']) > self::MEMORY_THRESHOLD) {
124
- $this->zipFlush();
125
- }
126
- }
127
-
128
- public function onEndAddFile(array $params) {
129
- $this->zipWrite($params['gzData']);
130
- }
131
-
132
- public function onBeginBuildResponseHeader() {
133
- if (!$this->isFinalized) {
134
- $this->finalize();
135
- }
136
- }
137
-
138
- public function onEndBuildResponseHeader() {
139
- header('Connection: close');
140
- header('Content-Length: ' . $this->getArchiveSize());
141
-
142
- if (!is_resource($this->_zipFile)) {
143
- echo $this->_zipData;
144
- } else {
145
- rewind($this->_zipFile);
146
-
147
- while (!feof($this->_zipFile)) {
148
- echo fread($this->_zipFile, $this->streamChunkSize);
149
- }
150
- }
151
- }
152
-
153
- public function onOpenStream() {
154
- $this->zipFlush();
155
- }
156
-
157
- public function onProcessFile(array $params) {
158
- $this->zipWrite($params['data']);
159
- }
160
-
161
- public function zipVerifyMemBuffer($gzLength) {
162
- if (!is_resource($this->_zipFile) && ($this->offset + $gzLength) > self::MEMORY_THRESHOLD) {
163
- $this->zipFlush();
164
- }
165
- }
166
-
167
- public function zipWrite($data) {
168
- if (!is_resource($this->_zipFile)) {
169
- $this->_zipData .= $data;
170
- } else {
171
- fwrite($this->_zipFile, $data);
172
- fflush($this->_zipFile);
173
- }
174
- }
175
-
176
- public function zipFlush() {
177
- if (!is_resource($this->_zipFile)) {
178
- $this->_zipFile = tmpfile();
179
- fwrite($this->_zipFile, $this->_zipData);
180
- $this->_zipData = null;
181
- }
182
- }
183
-
184
- public function zipFlushBuffer() {
185
- // Does nothing.
186
- }
187
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/extensions/zipdd/File/index.html DELETED
File without changes
includes/extensions/zipdd/Listener/ZipArchiveListener.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
- /**
3
- *
4
- * @author Greg Kappatos
5
- *
6
- * This class serves as an observer/listener which can be implemented
7
- * by any other class who is interested in the PHPZip events.
8
- * Simply implement the methods and call Stream\ZipStream or
9
- * File\Zip::addListener($this) from inside your class.
10
- *
11
- */
12
-
13
- namespace PHPZip\Zip\Listener;
14
-
15
- interface ZipArchiveListener {
16
-
17
- public function onBuildZipEntry(array $params);
18
-
19
- public function onOpenStream(array $params);
20
-
21
- public function onAddFile(array $params);
22
-
23
- public function onAddLargeFile(array $params);
24
-
25
- public function onSendZip(array $params);
26
-
27
- public function onException(array $params);
28
-
29
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/extensions/zipdd/Listener/index.html DELETED
File without changes
includes/extensions/zipdd/Stream/ZipStream.php DELETED
@@ -1,204 +0,0 @@
1
- <?php
2
- /**
3
- *
4
- * @author A. Grandt <php@grandt.com>
5
- * @author Greg Kappatos
6
- *
7
- * This class serves as a concrete zip stream archive.
8
- *
9
- */
10
-
11
- namespace PHPZip\Zip\Stream;
12
-
13
- use PHPZip\Zip\Core\AbstractZipArchive;
14
-
15
- class ZipStream extends AbstractZipArchive {
16
-
17
- const STREAM_CHUNK_SIZE = 16384; // 16 KB
18
- private $maxStreamBufferLength = 1048576;
19
-
20
- /**
21
- * Constructor.
22
- *
23
- * @author A. Grandt <php@grandt.com>
24
- * @author Greg Kappatos
25
- *
26
- * @param String $fileName The name of the Zip archive, in ISO-8859-1 (or ASCII) encoding, ie. "archive.zip". Optional, defaults to NULL, which means that no ISO-8859-1 encoded file name will be specified.
27
- * @param String $contentType Content mime type. Optional, defaults to "application/zip".
28
- * @param String $utf8FileName The name of the Zip archive, in UTF-8 encoding. Optional, defaults to NULL, which means that no UTF-8 encoded file name will be specified.
29
- * @param bool $inline Use Content-Disposition with "inline" instead of "attached". Optional, defaults to FALSE.
30
- *
31
- * @throws \PHPZip\Zip\Exception\BufferNotEmpty, HeadersSent, IncompatiblePhpVersion, InvalidPhpConfiguration In case of errors
32
- */
33
- public function __construct($fileName = '', $contentType = self::CONTENT_TYPE, $utf8FileName = null, $inline = false) {
34
- parent::__construct(self::STREAM_CHUNK_SIZE);
35
- $this->buildResponseHeader($fileName, $contentType, $utf8FileName, $inline);
36
- }
37
-
38
- /**
39
- * Destructor.
40
- * Perform clean up actions.
41
- * Please note that frameworks are absolutely prohibited from sending ANYTHING to the output after the Zip is sent.
42
- *
43
- * @author A. Grandt <php@grandt.com>
44
- */
45
- public function __destruct(){
46
- $this->isFinalized = true;
47
- $this->cdRec = null;
48
- }
49
-
50
- /*
51
- * ************************************************************************
52
- * Superclass callbacks.
53
- * ************************************************************************
54
- */
55
-
56
- /**
57
- * Called by superclass when specialised action is needed
58
- * while building a zip entry.
59
- *
60
- * @author A. Grandt <php@grandt.com>
61
- * @author Greg Kappatos
62
- *
63
- * @param array $params Array that contains zipEntry.
64
- */
65
- public function onBuildZipEntry(array $params){
66
- print($params['zipEntry']);
67
- }
68
-
69
- /**
70
- * Called by superclass when specialised action is needed
71
- * at the start of adding a file to the archive.
72
- *
73
- * @author A. Grandt <php@grandt.com>
74
- * @author Greg Kappatos
75
- *
76
- * @param array $params Array that contains gzLength.
77
- */
78
- public function onBeginAddFile(array $params){
79
- // Do nothing.
80
- }
81
-
82
- /**
83
- * Called by superclass when specialised action is needed
84
- * at the end of adding a file to the archive.
85
- *
86
- * @author A. Grandt <php@grandt.com>
87
- * @author Greg Kappatos
88
- *
89
- * @param array $params Array that contains gzData.
90
- */
91
- public function onEndAddFile(array $params){
92
- print($params['gzData']);
93
- }
94
-
95
- /**
96
- * Called by superclass when specialised action is needed
97
- * at the start of sending the zip stream response header.
98
- *
99
- * @author A. Grandt <php@grandt.com>
100
- * @author Greg Kappatos
101
- */
102
- public function onBeginBuildResponseHeader(){
103
- // Do nothing.
104
- }
105
-
106
- /**
107
- * Called by superclass when specialised action is needed
108
- * at the end of sending the zip stream response header.
109
- *
110
- * @author A. Grandt <php@grandt.com>
111
- * @author Greg Kappatos
112
- */
113
- public function onEndBuildResponseHeader(){
114
- //header("Connection: Keep-Alive");
115
- $this->zipFlushBuffer();
116
- }
117
-
118
- /**
119
- * Called by superclass when specialised action is needed
120
- * while opening a stream.
121
- *
122
- * @author A. Grandt <php@grandt.com>
123
- * @author Greg Kappatos
124
- */
125
- public function onOpenStream(){
126
- // Do nothing.
127
- }
128
-
129
- /**
130
- * Called by superclass when specialised action is needed
131
- * while processing a file.
132
- *
133
- * @author A. Grandt <php@grandt.com>
134
- * @author Greg Kappatos
135
- *
136
- * @param array $params Array that contains data.
137
- */
138
- public function onProcessFile(array $params){
139
- print($params['data']);
140
- $this->zipFlushBuffer();
141
- }
142
-
143
- /**
144
- * Verify if the memory buffer is about to be exceeded.
145
- *
146
- * @author A. Grandt <php@grandt.com>
147
- *
148
- * @param int $gzLength length of the pending data.
149
- */
150
- public function zipVerifyMemBuffer($gzLength) {
151
- if (ob_get_length() !== FALSE && ob_get_length() > $this->maxStreamBufferLength) {
152
-
153
- ob_flush();
154
-
155
- while (ob_get_length() > $this->maxStreamBufferLength) {
156
- usleep(500000);
157
- }
158
- }
159
- }
160
-
161
- /**
162
- *
163
- * @author A. Grandt <php@grandt.com>
164
- *
165
- * @param string $data
166
- */
167
- public function zipWrite($data) {
168
- print($data);
169
- }
170
-
171
- /**
172
- * Flush Zip Data stored in memory, to a temp file.
173
- *
174
- * @author A. Grandt <php@grandt.com>
175
- *
176
- */
177
- public function zipFlush() {
178
- // Does nothing.
179
- }
180
-
181
- /**
182
- *
183
- * @author A. Grandt <php@grandt.com>
184
- *
185
- */
186
- public function zipFlushBuffer() {
187
- flush();
188
- $this->zipVerifyMemBuffer(0);
189
- }
190
-
191
- /**
192
- * @return int
193
- */
194
- public function getMaxStreamBufferLength() {
195
- return $this->maxStreamBufferLength;
196
- }
197
-
198
- /**
199
- * @param int $maxStreamBufferLength
200
- */
201
- public function setMaxStreamBufferLength($maxStreamBufferLength) {
202
- $this->maxStreamBufferLength = $maxStreamBufferLength;
203
- }
204
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/extensions/zipdd/Stream/index.html DELETED
File without changes
includes/extensions/zipdd/index.html DELETED
File without changes
includes/rbs_gallery_widget.php CHANGED
@@ -119,5 +119,7 @@ class rbs_widget extends WP_Widget {
119
  }
120
 
121
  function rbs_load_widget(){ register_widget( 'rbs_widget' ); }
 
 
122
 
123
  add_action( 'widgets_init', 'rbs_load_widget' );
119
  }
120
 
121
  function rbs_load_widget(){ register_widget( 'rbs_widget' ); }
122
+ /*
123
+ add_action( 'robo_gallery_widgets_init', 'rbs_load_widget' );*/
124
 
125
  add_action( 'widgets_init', 'rbs_load_widget' );
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === Gallery by Robo - Responsive Photo Image Gallery ===
2
  Contributors: gallerysupport, robosoft
3
  Donate link: https://robosoft.co/robogallery
4
  Tags: gallery, photo gallery, image gallery, wordpress gallery plugin, responsive gallery
5
  Requires at least: 3.3
6
  Tested up to: 4.9
7
- Stable tag: 2.8.1
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -192,6 +192,9 @@ If any problem occurs, please contact us.
192
 
193
  == Changelog ==
194
 
 
 
 
195
  = 2.8.1 =
196
  * Fix of the path problem in new version, including Wordpress.com users
197
 
@@ -408,6 +411,9 @@ If any problem occurs, please contact us.
408
 
409
  == Upgrade Notice ==
410
 
 
 
 
411
  = 2.8.1 =
412
  Fix of the path problem in new version, including Wordpress.com users
413
 
1
+ === Gallery by Robo - Responsive Image Photo Gallery ===
2
  Contributors: gallerysupport, robosoft
3
  Donate link: https://robosoft.co/robogallery
4
  Tags: gallery, photo gallery, image gallery, wordpress gallery plugin, responsive gallery
5
  Requires at least: 3.3
6
  Tested up to: 4.9
7
+ Stable tag: 2.8.2
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
192
 
193
  == Changelog ==
194
 
195
+ = 2.8.2 =
196
+ * Added new image gallery widget to the add-ons section
197
+
198
  = 2.8.1 =
199
  * Fix of the path problem in new version, including Wordpress.com users
200
 
411
 
412
  == Upgrade Notice ==
413
 
414
+ = 2.8.2 =
415
+ Added new image gallery widget to the add-ons section
416
+
417
  = 2.8.1 =
418
  Fix of the path problem in new version, including Wordpress.com users
419
 
robogallery.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Robo Gallery
4
  Plugin URI: https://robosoft.co/wordpress-gallery-plugin
5
  Description: Gallery modes photo gallery, images gallery, video gallery, Polaroid gallery, gallery lighbox, portfolio gallery, responsive gallery
6
- Version: 2.8.1
7
  Author: RoboSoft
8
  Author URI: https://robosoft.co/wordpress-gallery-plugin
9
  License: GPLv3 or later
@@ -15,7 +15,7 @@ if(!defined('WPINC'))die;
15
  if(!defined("ABSPATH"))exit;
16
 
17
  define("ROBO_GALLERY", 1);
18
- define("ROBO_GALLERY_VERSION", '2.8.1');
19
 
20
  define("ROBO_GALLERY_OPTIONS", 'rbs_opt_');
21
 
3
  Plugin Name: Robo Gallery
4
  Plugin URI: https://robosoft.co/wordpress-gallery-plugin
5
  Description: Gallery modes photo gallery, images gallery, video gallery, Polaroid gallery, gallery lighbox, portfolio gallery, responsive gallery
6
+ Version: 2.8.2
7
  Author: RoboSoft
8
  Author URI: https://robosoft.co/wordpress-gallery-plugin
9
  License: GPLv3 or later
15
  if(!defined("ABSPATH"))exit;
16
 
17
  define("ROBO_GALLERY", 1);
18
+ define("ROBO_GALLERY_VERSION", '2.8.2');
19
 
20
  define("ROBO_GALLERY_OPTIONS", 'rbs_opt_');
21