Photo Gallery by WD – Responsive Photo Gallery - Version 1.0.5

Version Description

Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 Photo Gallery by WD – Responsive Photo Gallery
Version 1.0.5
Comparing to
See all releases

Code changes from version 1.0.4 to 1.0.5

admin/controllers/BWGControllerOptions_bwg.php CHANGED
@@ -88,7 +88,10 @@ class BWGControllerOptions_bwg {
88
  $images_per_page = (isset($_POST['images_per_page']) ? esc_html(stripslashes($_POST['images_per_page'])) : 30);
89
  $thumb_width = (isset($_POST['thumb_width']) ? esc_html(stripslashes($_POST['thumb_width'])) : 120);
90
  $thumb_height = (isset($_POST['thumb_height']) ? esc_html(stripslashes($_POST['thumb_height'])) : 90);
 
 
91
  $image_enable_page = (isset($_POST['image_enable_page']) ? esc_html(stripslashes($_POST['image_enable_page'])) : 1);
 
92
  $album_column_number = (isset($_POST['album_column_number']) ? esc_html(stripslashes($_POST['album_column_number'])) : 5);
93
  $albums_per_page = (isset($_POST['albums_per_page']) ? esc_html(stripslashes($_POST['albums_per_page'])) : 30);
94
  $album_title_show_hover = (isset($_POST['album_title_show_hover']) ? esc_html(stripslashes($_POST['album_title_show_hover'])) : 'hover');
@@ -166,7 +169,10 @@ class BWGControllerOptions_bwg {
166
  'images_per_page' => $images_per_page,
167
  'thumb_width' => $thumb_width,
168
  'thumb_height' => $thumb_height,
 
 
169
  'image_enable_page' => $image_enable_page,
 
170
  'album_column_number' => $album_column_number,
171
  'albums_per_page' => $albums_per_page,
172
  'album_title_show_hover' => $album_title_show_hover,
88
  $images_per_page = (isset($_POST['images_per_page']) ? esc_html(stripslashes($_POST['images_per_page'])) : 30);
89
  $thumb_width = (isset($_POST['thumb_width']) ? esc_html(stripslashes($_POST['thumb_width'])) : 120);
90
  $thumb_height = (isset($_POST['thumb_height']) ? esc_html(stripslashes($_POST['thumb_height'])) : 90);
91
+ $upload_thumb_width = (isset($_POST['upload_thumb_width']) ? esc_html(stripslashes($_POST['upload_thumb_width'])) : 300);
92
+ $upload_thumb_height = (isset($_POST['upload_thumb_height']) ? esc_html(stripslashes($_POST['upload_thumb_height'])) : 300);
93
  $image_enable_page = (isset($_POST['image_enable_page']) ? esc_html(stripslashes($_POST['image_enable_page'])) : 1);
94
+ $image_title_show_hover = (isset($_POST['image_title_show_hover']) ? esc_html(stripslashes($_POST['image_title_show_hover'])) : 'none');
95
  $album_column_number = (isset($_POST['album_column_number']) ? esc_html(stripslashes($_POST['album_column_number'])) : 5);
96
  $albums_per_page = (isset($_POST['albums_per_page']) ? esc_html(stripslashes($_POST['albums_per_page'])) : 30);
97
  $album_title_show_hover = (isset($_POST['album_title_show_hover']) ? esc_html(stripslashes($_POST['album_title_show_hover'])) : 'hover');
169
  'images_per_page' => $images_per_page,
170
  'thumb_width' => $thumb_width,
171
  'thumb_height' => $thumb_height,
172
+ 'upload_thumb_width' => $upload_thumb_width,
173
+ 'upload_thumb_height' => $upload_thumb_height,
174
  'image_enable_page' => $image_enable_page,
175
+ 'image_title_show_hover' => $image_title_show_hover,
176
  'album_column_number' => $album_column_number,
177
  'albums_per_page' => $albums_per_page,
178
  'album_title_show_hover' => $album_title_show_hover,
admin/controllers/BWGControllerThemes_bwg.php CHANGED
@@ -101,6 +101,13 @@ class BWGControllerThemes_bwg {
101
  $thumb_hover_effect = (isset($_POST['thumb_hover_effect']) ? esc_html(stripslashes( $_POST['thumb_hover_effect'])) : '');
102
  $thumb_hover_effect_value = (isset($_POST['thumb_hover_effect_value']) ? esc_html(stripslashes( $_POST['thumb_hover_effect_value'])) : '');
103
  $thumb_transition = (isset($_POST['thumb_transition']) ? (int) esc_html(stripslashes( $_POST['thumb_transition'])) : 0);
 
 
 
 
 
 
 
104
  $page_nav_position = (isset($_POST['page_nav_position']) ? esc_html(stripslashes( $_POST['page_nav_position'])) : 'top');
105
  $page_nav_align = (isset($_POST['page_nav_align']) ? esc_html(stripslashes( $_POST['page_nav_align'])) : 'center');
106
  $page_nav_number = (isset($_POST['page_nav_number']) ? (int) esc_html(stripslashes( $_POST['page_nav_number'])) : 1);
@@ -253,15 +260,17 @@ class BWGControllerThemes_bwg {
253
  $image_browser_full_transparent = (isset($_POST['image_browser_full_transparent']) ? (int) esc_html(stripslashes( $_POST['image_browser_full_transparent'])) : 0);
254
 
255
  $album_compact_title_margin = (isset($_POST['album_compact_title_margin']) ? esc_html(stripslashes( $_POST['album_compact_title_margin'])) : '');
 
 
 
 
 
256
  $album_compact_thumb_margin = (isset($_POST['album_compact_thumb_margin']) ? (int) esc_html(stripslashes( $_POST['album_compact_thumb_margin'])) : 0);
257
  $album_compact_back_padding = (isset($_POST['album_compact_back_padding']) ? esc_html(stripslashes( $_POST['album_compact_back_padding'])) : '');
258
  $album_compact_thumb_padding = (isset($_POST['album_compact_thumb_padding']) ? (int) esc_html(stripslashes( $_POST['album_compact_thumb_padding'])) : 0);
259
  $album_compact_thumb_border_radius = (isset($_POST['album_compact_thumb_border_radius']) ? esc_html(stripslashes( $_POST['album_compact_thumb_border_radius'])) :'');
260
  $album_compact_thumb_border_width = (isset($_POST['album_compact_thumb_border_width']) ? (int) esc_html(stripslashes( $_POST['album_compact_thumb_border_width'])) : 1);
261
- $album_compact_title_font_style = (isset($_POST['album_compact_title_font_style']) ? esc_html(stripslashes( $_POST['album_compact_title_font_style'])) : 'inherit');
262
  $album_compact_back_font_color = (isset($_POST['album_compact_back_font_color']) ? esc_html(stripslashes( $_POST['album_compact_back_font_color'])) : '000000');
263
- $album_compact_title_font_color = (isset($_POST['album_compact_title_font_color']) ? esc_html(stripslashes( $_POST['album_compact_title_font_color'])) : 'FFFFFF');
264
- $album_compact_title_shadow = (isset($_POST['album_compact_title_shadow']) ? esc_html(stripslashes( $_POST['album_compact_title_shadow'])) : '');
265
  $album_compact_thumb_bg_transparent = (isset($_POST['album_compact_thumb_bg_transparent']) ? (int) esc_html(stripslashes( $_POST['album_compact_thumb_bg_transparent'])) : 0);
266
  $album_compact_thumb_box_shadow = (isset($_POST['album_compact_thumb_box_shadow']) ? esc_html(stripslashes( $_POST['album_compact_thumb_box_shadow'])) : '');
267
  $album_compact_thumb_transition = (isset($_POST['album_compact_thumb_transition']) ? (int) esc_html(stripslashes( $_POST['album_compact_thumb_transition'])) : 1);
@@ -272,8 +281,6 @@ class BWGControllerThemes_bwg {
272
  $album_compact_back_font_size = (isset($_POST['album_compact_back_font_size']) ? (int) esc_html(stripslashes( $_POST['album_compact_back_font_size'])) : 12);
273
  $album_compact_back_font_style = (isset($_POST['album_compact_back_font_style']) ? esc_html(stripslashes( $_POST['album_compact_back_font_style'])) : 'inherit');
274
  $album_compact_thumbs_bg_color = (isset($_POST['album_compact_thumbs_bg_color']) ? esc_html(stripslashes( $_POST['album_compact_thumbs_bg_color'])) : 'FFFFFF');
275
- $album_compact_title_font_size = (isset($_POST['album_compact_title_font_size']) ? (int) esc_html(stripslashes( $_POST['album_compact_title_font_size'])) : 12);
276
- $album_compact_title_font_weight = (isset($_POST['album_compact_title_font_weight']) ? esc_html(stripslashes( $_POST['album_compact_title_font_weight'])) : 'normal');
277
  $album_compact_thumb_align = (isset($_POST['album_compact_thumb_align']) ? esc_html(stripslashes( $_POST['album_compact_thumb_align'])) : 'center');
278
  $album_compact_thumb_hover_effect = (isset($_POST['album_compact_thumb_hover_effect']) ? esc_html(stripslashes( $_POST['album_compact_thumb_hover_effect'])) :'skew');
279
  $album_compact_thumb_transparent = (isset($_POST['album_compact_thumb_transparent']) ? (int) esc_html(stripslashes( $_POST['album_compact_thumb_transparent'])) : 80);
@@ -419,7 +426,14 @@ class BWGControllerThemes_bwg {
419
  'thumb_align' => $thumb_align,
420
  'thumb_hover_effect' => $thumb_hover_effect,
421
  'thumb_hover_effect_value' => $thumb_hover_effect_value,
422
- 'thumb_transition' => $thumb_transition,
 
 
 
 
 
 
 
423
  'page_nav_position' => $page_nav_position,
424
  'page_nav_align' => $page_nav_align,
425
  'page_nav_number' => $page_nav_number,
@@ -740,7 +754,14 @@ class BWGControllerThemes_bwg {
740
  'thumb_align' => $thumb_align,
741
  'thumb_hover_effect' => $thumb_hover_effect,
742
  'thumb_hover_effect_value' => $thumb_hover_effect_value,
743
- 'thumb_transition' => $thumb_transition,
 
 
 
 
 
 
 
744
  'page_nav_position' => $page_nav_position,
745
  'page_nav_align' => $page_nav_align,
746
  'page_nav_number' => $page_nav_number,
@@ -1058,6 +1079,13 @@ class BWGControllerThemes_bwg {
1058
  '%s',
1059
  '%s',
1060
  '%d',
 
 
 
 
 
 
 
1061
  '%s',
1062
  '%s',
1063
  '%d',
101
  $thumb_hover_effect = (isset($_POST['thumb_hover_effect']) ? esc_html(stripslashes( $_POST['thumb_hover_effect'])) : '');
102
  $thumb_hover_effect_value = (isset($_POST['thumb_hover_effect_value']) ? esc_html(stripslashes( $_POST['thumb_hover_effect_value'])) : '');
103
  $thumb_transition = (isset($_POST['thumb_transition']) ? (int) esc_html(stripslashes( $_POST['thumb_transition'])) : 0);
104
+ $thumb_title_margin = (isset($_POST['thumb_title_margin']) ? esc_html(stripslashes( $_POST['thumb_title_margin'])) : '');
105
+ $thumb_title_font_style = (isset($_POST['thumb_title_font_style']) ? esc_html(stripslashes( $_POST['thumb_title_font_style'])) : 'inherit');
106
+ $thumb_title_font_color = (isset($_POST['thumb_title_font_color']) ? esc_html(stripslashes( $_POST['thumb_title_font_color'])) : 'CCCCCC');
107
+ $thumb_title_shadow = (isset($_POST['thumb_title_shadow']) ? esc_html(stripslashes( $_POST['thumb_title_shadow'])) : '');
108
+ $thumb_title_font_size = (isset($_POST['thumb_title_font_size']) ? (int) esc_html(stripslashes( $_POST['thumb_title_font_size'])) : 12);
109
+ $thumb_title_font_weight = (isset($_POST['thumb_title_font_weight']) ? esc_html(stripslashes( $_POST['thumb_title_font_weight'])) : 'normal');
110
+
111
  $page_nav_position = (isset($_POST['page_nav_position']) ? esc_html(stripslashes( $_POST['page_nav_position'])) : 'top');
112
  $page_nav_align = (isset($_POST['page_nav_align']) ? esc_html(stripslashes( $_POST['page_nav_align'])) : 'center');
113
  $page_nav_number = (isset($_POST['page_nav_number']) ? (int) esc_html(stripslashes( $_POST['page_nav_number'])) : 1);
260
  $image_browser_full_transparent = (isset($_POST['image_browser_full_transparent']) ? (int) esc_html(stripslashes( $_POST['image_browser_full_transparent'])) : 0);
261
 
262
  $album_compact_title_margin = (isset($_POST['album_compact_title_margin']) ? esc_html(stripslashes( $_POST['album_compact_title_margin'])) : '');
263
+ $album_compact_title_font_style = (isset($_POST['album_compact_title_font_style']) ? esc_html(stripslashes( $_POST['album_compact_title_font_style'])) : 'inherit');
264
+ $album_compact_title_font_color = (isset($_POST['album_compact_title_font_color']) ? esc_html(stripslashes( $_POST['album_compact_title_font_color'])) : 'CCCCCC');
265
+ $album_compact_title_shadow = (isset($_POST['album_compact_title_shadow']) ? esc_html(stripslashes( $_POST['album_compact_title_shadow'])) : '');
266
+ $album_compact_title_font_size = (isset($_POST['album_compact_title_font_size']) ? (int) esc_html(stripslashes( $_POST['album_compact_title_font_size'])) : 12);
267
+ $album_compact_title_font_weight = (isset($_POST['album_compact_title_font_weight']) ? esc_html(stripslashes( $_POST['album_compact_title_font_weight'])) : 'normal');
268
  $album_compact_thumb_margin = (isset($_POST['album_compact_thumb_margin']) ? (int) esc_html(stripslashes( $_POST['album_compact_thumb_margin'])) : 0);
269
  $album_compact_back_padding = (isset($_POST['album_compact_back_padding']) ? esc_html(stripslashes( $_POST['album_compact_back_padding'])) : '');
270
  $album_compact_thumb_padding = (isset($_POST['album_compact_thumb_padding']) ? (int) esc_html(stripslashes( $_POST['album_compact_thumb_padding'])) : 0);
271
  $album_compact_thumb_border_radius = (isset($_POST['album_compact_thumb_border_radius']) ? esc_html(stripslashes( $_POST['album_compact_thumb_border_radius'])) :'');
272
  $album_compact_thumb_border_width = (isset($_POST['album_compact_thumb_border_width']) ? (int) esc_html(stripslashes( $_POST['album_compact_thumb_border_width'])) : 1);
 
273
  $album_compact_back_font_color = (isset($_POST['album_compact_back_font_color']) ? esc_html(stripslashes( $_POST['album_compact_back_font_color'])) : '000000');
 
 
274
  $album_compact_thumb_bg_transparent = (isset($_POST['album_compact_thumb_bg_transparent']) ? (int) esc_html(stripslashes( $_POST['album_compact_thumb_bg_transparent'])) : 0);
275
  $album_compact_thumb_box_shadow = (isset($_POST['album_compact_thumb_box_shadow']) ? esc_html(stripslashes( $_POST['album_compact_thumb_box_shadow'])) : '');
276
  $album_compact_thumb_transition = (isset($_POST['album_compact_thumb_transition']) ? (int) esc_html(stripslashes( $_POST['album_compact_thumb_transition'])) : 1);
281
  $album_compact_back_font_size = (isset($_POST['album_compact_back_font_size']) ? (int) esc_html(stripslashes( $_POST['album_compact_back_font_size'])) : 12);
282
  $album_compact_back_font_style = (isset($_POST['album_compact_back_font_style']) ? esc_html(stripslashes( $_POST['album_compact_back_font_style'])) : 'inherit');
283
  $album_compact_thumbs_bg_color = (isset($_POST['album_compact_thumbs_bg_color']) ? esc_html(stripslashes( $_POST['album_compact_thumbs_bg_color'])) : 'FFFFFF');
 
 
284
  $album_compact_thumb_align = (isset($_POST['album_compact_thumb_align']) ? esc_html(stripslashes( $_POST['album_compact_thumb_align'])) : 'center');
285
  $album_compact_thumb_hover_effect = (isset($_POST['album_compact_thumb_hover_effect']) ? esc_html(stripslashes( $_POST['album_compact_thumb_hover_effect'])) :'skew');
286
  $album_compact_thumb_transparent = (isset($_POST['album_compact_thumb_transparent']) ? (int) esc_html(stripslashes( $_POST['album_compact_thumb_transparent'])) : 80);
426
  'thumb_align' => $thumb_align,
427
  'thumb_hover_effect' => $thumb_hover_effect,
428
  'thumb_hover_effect_value' => $thumb_hover_effect_value,
429
+ 'thumb_transition' => $thumb_transition,
430
+ 'thumb_title_margin' => $thumb_title_margin,
431
+ 'thumb_title_font_style' => $thumb_title_font_style,
432
+ 'thumb_title_font_color' => $thumb_title_font_color,
433
+ 'thumb_title_shadow' => $thumb_title_shadow,
434
+ 'thumb_title_font_size' => $thumb_title_font_size,
435
+ 'thumb_title_font_weight' => $thumb_title_font_weight,
436
+
437
  'page_nav_position' => $page_nav_position,
438
  'page_nav_align' => $page_nav_align,
439
  'page_nav_number' => $page_nav_number,
754
  'thumb_align' => $thumb_align,
755
  'thumb_hover_effect' => $thumb_hover_effect,
756
  'thumb_hover_effect_value' => $thumb_hover_effect_value,
757
+ 'thumb_transition' => $thumb_transition,
758
+ 'thumb_title_margin' => $thumb_title_margin,
759
+ 'thumb_title_font_style' => $thumb_title_font_style,
760
+ 'thumb_title_font_color' => $thumb_title_font_color,
761
+ 'thumb_title_shadow' => $thumb_title_shadow,
762
+ 'thumb_title_font_size' => $thumb_title_font_size,
763
+ 'thumb_title_font_weight' => $thumb_title_font_weight,
764
+
765
  'page_nav_position' => $page_nav_position,
766
  'page_nav_align' => $page_nav_align,
767
  'page_nav_number' => $page_nav_number,
1079
  '%s',
1080
  '%s',
1081
  '%d',
1082
+ '%s',
1083
+ '%s',
1084
+ '%s',
1085
+ '%s',
1086
+ '%d',
1087
+ '%s',
1088
+
1089
  '%s',
1090
  '%s',
1091
  '%d',
admin/models/BWGModelOptions_bwg.php CHANGED
@@ -34,7 +34,10 @@ class BWGModelOptions_bwg {
34
  $row->images_per_page = 30;
35
  $row->thumb_width = 180;
36
  $row->thumb_height = 90;
 
 
37
  $row->image_enable_page = 1;
 
38
 
39
  $row->album_column_number = 5;
40
  $row->albums_per_page = 30;
34
  $row->images_per_page = 30;
35
  $row->thumb_width = 180;
36
  $row->thumb_height = 90;
37
+ $row->upload_thumb_width = 300;
38
+ $row->upload_thumb_height = 300;
39
  $row->image_enable_page = 1;
40
+ $row->image_title_show_hover = 'none';
41
 
42
  $row->album_column_number = 5;
43
  $row->albums_per_page = 30;
admin/models/BWGModelThemes_bwg.php CHANGED
@@ -63,6 +63,12 @@ class BWGModelThemes_bwg {
63
  $row->thumb_hover_effect = 'scale';
64
  $row->thumb_hover_effect_value = '1.1';
65
  $row->thumb_transition = 1;
 
 
 
 
 
 
66
 
67
  $row->page_nav_position = 'bottom';
68
  $row->page_nav_align = 'center';
@@ -168,7 +174,7 @@ class BWGModelThemes_bwg {
168
  $row->album_compact_back_font_size = 16;
169
  $row->album_compact_back_font_weight = 'bold';
170
  $row->album_compact_back_padding = '0';
171
- $row->album_compact_title_font_color = 'FFFFFF';
172
  $row->album_compact_title_font_style = 'segoe ui';
173
  $row->album_compact_title_font_size = 16;
174
  $row->album_compact_title_font_weight = 'bold';
63
  $row->thumb_hover_effect = 'scale';
64
  $row->thumb_hover_effect_value = '1.1';
65
  $row->thumb_transition = 1;
66
+ $row->thumb_title_font_color = 'CCCCCC';
67
+ $row->thumb_title_font_style = 'segoe ui';
68
+ $row->thumb_title_font_size = 16;
69
+ $row->thumb_title_font_weight = 'bold';
70
+ $row->thumb_title_margin = '2px';
71
+ $row->thumb_title_shadow = '0px 0px 0px #888888';
72
 
73
  $row->page_nav_position = 'bottom';
74
  $row->page_nav_align = 'center';
174
  $row->album_compact_back_font_size = 16;
175
  $row->album_compact_back_font_weight = 'bold';
176
  $row->album_compact_back_padding = '0';
177
+ $row->album_compact_title_font_color = 'CCCCCC';
178
  $row->album_compact_title_font_style = 'segoe ui';
179
  $row->album_compact_title_font_size = 16;
180
  $row->album_compact_title_font_weight = 'bold';
admin/views/BWGViewBWGShortcode.php CHANGED
@@ -27,6 +27,7 @@ class BWGViewBWGShortcode {
27
  $album_rows = $this->model->get_album_rows_data();
28
  $option_row = $this->model->get_option_row_data();
29
  $theme_rows = $this->model->get_theme_rows_data();
 
30
  $effects = array(
31
  'none' => 'None',
32
  'cubeH' => 'Cube Horizontal',
@@ -47,6 +48,7 @@ class BWGViewBWGShortcode {
47
  'monospace' => 'Monospace',
48
  'serif' => 'Serif',
49
  );
 
50
  ?>
51
  <html xmlns="http://www.w3.org/1999/xhtml">
52
  <head>
@@ -56,7 +58,9 @@ class BWGViewBWGShortcode {
56
  <link rel="stylesheet" href="<?php echo get_option("siteurl"); ?>/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css?ver=342-20110630100">
57
  <script language="javascript" type="text/javascript" src="<?php echo get_option("siteurl"); ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
58
  <script language="javascript" type="text/javascript" src="<?php echo get_option("siteurl"); ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
59
-
 
 
60
  <link rel="stylesheet" href="<?php echo WD_BWG_URL . '/css/bwg_shortcode.css'; ?>">
61
  <link rel="stylesheet" href="<?php echo WD_BWG_URL . '/css/jquery-ui-1.10.3.custom.css'; ?>">
62
  <script language="javascript" type="text/javascript" src="<?php echo get_option("siteurl"); ?>/wp-includes/js/jquery/jquery.js"></script>
@@ -65,8 +69,11 @@ class BWGViewBWGShortcode {
65
  <script language="javascript" type="text/javascript" src="<?php echo get_option("siteurl"); ?>/wp-includes/js/jquery/ui/jquery.ui.position.min.js"></script>
66
  <script language="javascript" type="text/javascript" src="<?php echo get_option("siteurl"); ?>/wp-includes/js/jquery/ui/jquery.ui.tooltip.min.js"></script>
67
 
68
- <script language="javascript" type="text/javascript" src="<?php echo WD_BWG_URL . '/js/bwg_shortcode.js'; ?>"></script>
69
  <script language="javascript" type="text/javascript" src="<?php echo WD_BWG_URL . '/js/jscolor/jscolor.js'; ?>"></script>
 
 
 
70
  <base target="_self">
71
  </head>
72
  <body id="link" onLoad="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" dir="ltr" class="forceColors">
@@ -82,6 +89,14 @@ class BWGViewBWGShortcode {
82
  </div>
83
  <div class="panel_wrapper">
84
  <div id="display_panel" class="panel current">
 
 
 
 
 
 
 
 
85
  <div style="text-align:center; height:100px;">
86
  <span class="gallery_type" onClick="bwg_gallery_type('thumbnails')">
87
  <div style="text-align: center;"><input type="radio" id="thumbnails" name="gallery_type" value="thumbnails" /><label for="thumbnails">Thumbnails</label></div>
@@ -199,6 +214,14 @@ class BWGViewBWGShortcode {
199
  <td title="If you want to display all images you should leave it blank or insert 0." class="spider_label"><label for="images_per_page">Images per page: </label></td>
200
  <td><input type="text" name="images_per_page" id="images_per_page" value="<?php echo $option_row->images_per_page; ?>" class="spider_int_input" /></td>
201
  </tr>
 
 
 
 
 
 
 
 
202
  <tr id="tr_image_enable_page">
203
  <td class="spider_label"><label>Enable pagination: </label></td>
204
  <td>
@@ -227,7 +250,8 @@ class BWGViewBWGShortcode {
227
  <td class="spider_label"><label>Album title: </label></td>
228
  <td>
229
  <input type="radio" name="compuct_album_title" id="compuct_album_title_hover" value="hover" <?php echo ($option_row->album_title_show_hover == 'hover') ? 'checked' : ''; ?> /><label for="compuct_album_title_hover">Show on hover</label><br />
230
- <input type="radio" name="compuct_album_title" id="compuct_album_title_show" value="show" <?php echo ($option_row->album_title_show_hover == 'show') ? 'checked' : ''; ?> /><label for="compuct_album_title_show">Always show</label>
 
231
  </td>
232
  </tr>
233
  <tr id="tr_compuct_album_thumb_width_height">
@@ -245,6 +269,14 @@ class BWGViewBWGShortcode {
245
  <td title="If you want to display all images you should leave it blank or insert 0." class="spider_label"><label for="compuct_album_images_per_page">Images per page: </label></td>
246
  <td><input type="text" name="compuct_album_images_per_page" id="compuct_album_images_per_page" value="<?php echo $option_row->images_per_page; ?>" class="spider_int_input" /></td>
247
  </tr>
 
 
 
 
 
 
 
 
248
  <tr id="tr_compuct_album_image_thumb_width_height">
249
  <td title="Maximum values for thumb width and height." class="spider_label"><label for="compuct_album_image_thumb_width">Image thumbnail dimensions: </label></td>
250
  <td>
@@ -291,6 +323,14 @@ class BWGViewBWGShortcode {
291
  <td title="If you want to display all images you should leave it blank or insert 0." class="spider_label"><label for="extended_album_images_per_page">Images per page: </label></td>
292
  <td><input type="text" name="extended_album_images_per_page" id="extended_album_images_per_page" value="<?php echo $option_row->images_per_page; ?>" class="spider_int_input" /></td>
293
  </tr>
 
 
 
 
 
 
 
 
294
  <tr id="tr_extended_album_image_thumb_width_height">
295
  <td title="Maximum values for thumb width and height." class="spider_label"><label for="extended_album_image_thumb_width">Image Thumbnail dimensions: </label></td>
296
  <td>
@@ -682,257 +722,290 @@ class BWGViewBWGShortcode {
682
  </tbody>
683
  </table>
684
  </div>
 
 
 
685
  </div>
686
  </div>
687
  <div class="mceActionPanel">
688
  <div style="float:left;">
689
- <input type="button" id="cancel" name="cancel" value="Cancel" onClick="tinyMCEPopup.close();"/>
690
  </div>
691
  <div style="float:right;">
692
- <input type="submit" id="insert" name="insert" value="Insert" onClick="bwg_insert_shortcode();"/>
693
  </div>
694
  </div>
695
  </form>
 
 
 
 
 
 
 
 
 
 
 
 
696
  <script>window.onload = bwg_shortcode_load;</script>
697
  <script type="text/javascript">
 
 
698
  var content = tinyMCE.activeEditor.selection.getContent();
699
- var short_code = get_params("Best_Wordpress_Gallery");
700
- if (!short_code) { // Insert.
701
- jQuery('#insert').val('Insert');
702
- bwg_gallery_type('thumbnails');
703
- }
704
- else { // Update.
705
- jQuery('#insert').val('Update');
706
- jQuery('#insert').attr('onclick', "bwg_insert_shortcode(content)");
707
- jQuery("select[id=theme] option[value='" + short_code['theme_id'] + "']").attr('selected', 'selected');
708
- switch (short_code['gallery_type']) {
709
- case 'thumbnails': {
710
- jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
711
- jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
712
- jQuery("#image_column_number").val(short_code['image_column_number']);
713
- jQuery("#images_per_page").val(short_code['images_per_page']);
714
- if (short_code['image_enable_page'] == 1) {
715
- jQuery("#image_page_yes").attr('checked', 'checked');
716
- }
717
- else {
718
- jQuery("#image_page_no").attr('checked', 'checked');
719
- }
720
- jQuery("#thumb_width").val(short_code['thumb_width']);
721
- jQuery("#thumb_height").val(short_code['thumb_height']);
722
- break;
 
 
 
 
 
 
 
 
 
723
 
724
- }
725
- case 'slideshow': {
726
- jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
727
- jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
728
- jQuery("select[id=slideshow_effect] option[value='" + short_code['slideshow_effect'] + "']").attr('selected', 'selected');
729
- jQuery("#slideshow_interval").val(short_code['slideshow_interval']);
730
- jQuery("#slideshow_width").val(short_code['slideshow_width']);
731
- jQuery("#slideshow_height").val(short_code['slideshow_height']);
732
- if (short_code['enable_slideshow_autoplay'] == 1) {
733
- jQuery("#slideshow_autoplay_yes").attr('checked', 'checked');
734
- }
735
- else {
736
- jQuery("#slideshow_autoplay_no").attr('checked', 'checked');
737
- }
738
- if (short_code['enable_slideshow_shuffle'] == 1) {
739
- jQuery("#slideshow_shuffle_yes").attr('checked', 'checked');
740
- }
741
- else {
742
- jQuery("#slideshow_shuffle_no").attr('checked', 'checked');
743
- }
744
- if (short_code['enable_slideshow_ctrl'] == 1) {
745
- jQuery("#slideshow_ctrl_yes").attr('checked', 'checked');
746
- }
747
- else {
748
- jQuery("#slideshow_ctrl_no").attr('checked', 'checked');
749
- }
750
- if (short_code['enable_slideshow_filmstrip'] == 1) {
751
- jQuery("#slideshow_filmstrip_yes").attr('checked', 'checked');
752
- jQuery("#slideshow_filmstrip_height").val(short_code['slideshow_filmstrip_height']);
753
- bwg_enable_disable('', 'tr_slideshow_filmstrip_height', 'slideshow_filmstrip_yes');
754
- }
755
- else {
756
- jQuery("#slideshow_filmstrip_no").attr('checked', 'checked');
757
- }
758
- if (short_code['slideshow_enable_title'] == 1) {
759
- jQuery("#slideshow_title_yes").attr('checked', 'checked');
760
- jQuery("#slideshow_title_" + short_code['slideshow_title_position']).attr('checked', 'checked');
761
- bwg_enable_disable('', 'tr_slideshow_title_position', 'slideshow_title_yes');
762
- }
763
- else {
764
- jQuery("#slideshow_title_no").attr('checked', 'checked');
765
- }
766
- if (short_code['slideshow_enable_description'] == 1) {
767
- jQuery("#slideshow_description_yes").attr('checked', 'checked');
768
- jQuery("#slideshow_description_" + short_code['slideshow_description_position']).attr('checked', 'checked');
769
- bwg_enable_disable('', 'tr_slideshow_description_position', 'slideshow_description_yes');
770
- }
771
- else {
772
- jQuery("#slideshow_description_no").attr('checked', 'checked');
773
- }
774
- if (short_code['enable_slideshow_music'] == 1) {
775
- jQuery("#slideshow_music_yes").attr('checked', 'checked');
776
- jQuery("#slideshow_music_url").val(short_code['slideshow_music_url']);
777
- bwg_enable_disable('', 'tr_slideshow_music_url', 'slideshow_music_yes');
778
  }
779
- else {
780
- jQuery("#slideshow_music_no").attr('checked', 'checked');
781
- }
782
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
783
 
784
- }
785
- case 'image_browser': {
786
- jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
787
- jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
788
- jQuery("#image_browser_width").val(short_code['image_browser_width']);
789
- if (short_code['image_browser_title_enable'] == 1) {
790
- jQuery("#image_browser_title_yes").attr('checked', 'checked');
791
  }
792
- else {
793
- jQuery("#image_browser_title_no").attr('checked', 'checked');
794
- }
795
- if (short_code['image_browser_description_enable'] == 1) {
796
- jQuery("#image_browser_description_yes").attr('checked', 'checked');
797
- }
798
- else {
799
- jQuery("#image_browser_description_no").attr('checked', 'checked');
800
- }
801
- break;
 
 
 
 
 
 
 
802
 
803
- }
804
- case 'album_compact_preview': {
805
- jQuery("select[id=album] option[value='" + short_code['album_id'] + "']").attr('selected', 'selected');
806
- jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
807
- jQuery("#compuct_album_column_number").val(short_code['compuct_album_column_number']);
808
- jQuery("#compuct_albums_per_page").val(short_code['compuct_albums_per_page']);
809
- jQuery("#compuct_album_title_" + short_code['compuct_album_title']).attr('checked', 'checked');
810
- jQuery("#compuct_album_thumb_width").val(short_code['compuct_album_thumb_width']);
811
- jQuery("#compuct_album_thumb_height").val(short_code['compuct_album_thumb_height']);
812
- jQuery("#compuct_album_image_column_number").val(short_code['compuct_album_image_column_number']);
813
- jQuery("#compuct_album_images_per_page").val(short_code['compuct_album_images_per_page']);
814
- jQuery("#compuct_album_image_thumb_width").val(short_code['compuct_album_image_thumb_width']);
815
- jQuery("#compuct_album_image_thumb_height").val(short_code['compuct_album_image_thumb_height']);
816
- if (short_code['compuct_album_enable_page'] == 1) {
817
- jQuery("#compuct_album_page_yes").attr('checked', 'checked');
818
  }
819
- else {
820
- jQuery("#compuct_album_page_no").attr('checked', 'checked');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
821
  }
822
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
823
 
 
824
  }
825
- case 'album_extended_preview': {
826
- jQuery("select[id=album] option[value='" + short_code['album_id'] + "']").attr('selected', 'selected');
827
- jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
828
- jQuery("#extended_albums_per_page").val(short_code['extended_albums_per_page']);
829
- jQuery("#extended_album_height").val(short_code['extended_album_height']);
830
- if (short_code['extended_album_description_enable'] == 1) {
831
- jQuery("#extended_album_description_yes").attr('checked', 'checked');
 
 
 
832
  }
833
  else {
834
- jQuery("#extended_album_description_no").attr('checked', 'checked');
835
  }
836
- jQuery("#extended_album_thumb_width").val(short_code['extended_album_thumb_width']);
837
- jQuery("#extended_album_thumb_height").val(short_code['extended_album_thumb_height']);
838
- jQuery("#extended_album_image_column_number").val(short_code['extended_album_image_column_number']);
839
- jQuery("#extended_album_images_per_page").val(short_code['extended_album_images_per_page']);
840
- jQuery("#extended_album_image_thumb_width").val(short_code['extended_album_image_thumb_width']);
841
- jQuery("#extended_album_image_thumb_height").val(short_code['extended_album_image_thumb_height']);
842
- if (short_code['extended_album_enable_page'] == 1) {
843
- jQuery("#extended_album_page_yes").attr('checked', 'checked');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
844
  }
845
  else {
846
- jQuery("#extended_album_page_no").attr('checked', 'checked');
847
  }
848
- break;
849
-
850
- }
851
- }
852
- // Lightbox.
853
- if (short_code['gallery_type'] != 'slideshow') {
854
- jQuery("#popup_width").val(short_code['popup_width']);
855
- jQuery("#popup_height").val(short_code['popup_height']);
856
- jQuery("select[id=popup_effect] option[value='" + short_code['popup_effect'] + "']").attr('selected', 'selected');
857
- jQuery("#popup_interval").val(short_code['popup_interval']);
858
- if (short_code['popup_enable_filmstrip'] == 1) {
859
- jQuery("#popup_filmstrip_yes").attr('checked', 'checked');
860
- jQuery("#popup_filmstrip_height").val(short_code['popup_filmstrip_height']);
861
- bwg_enable_disable('', 'tr_popup_filmstrip_height', 'popup_filmstrip_yes');
862
  }
863
- else {
864
- jQuery("#popup_filmstrip_no").attr('checked', 'checked');
 
 
 
 
 
 
 
 
 
865
  }
866
- if (short_code['popup_enable_ctrl_btn'] == 1) {
867
- jQuery("#popup_ctrl_btn_yes").attr('checked', 'checked');
868
- bwg_enable_disable('', 'tbody_popup_ctrl_btn', 'popup_ctrl_btn_yes');
869
- if (short_code['popup_enable_fullscreen'] == 1) {
870
- jQuery("#popup_fullscreen_yes").attr('checked', 'checked');
871
- }
872
- else {
873
- jQuery("#popup_fullscreen_no").attr('checked', 'checked');
874
- }
875
- if (short_code['popup_enable_comment'] == 1) {
876
- jQuery("#popup_comment_yes").attr('checked', 'checked');
877
- }
878
- else {
879
- jQuery("#popup_comment_no").attr('checked', 'checked');
880
- }
881
- if (short_code['popup_enable_facebook'] == 1) {
882
- jQuery("#popup_facebook_yes").attr('checked', 'checked');
883
- }
884
- else {
885
- jQuery("#popup_facebook_no").attr('checked', 'checked');
886
- }
887
- if (short_code['popup_enable_twitter'] == 1) {
888
- jQuery("#popup_twitter_yes").attr('checked', 'checked');
889
- }
890
- else {
891
- jQuery("#popup_twitter_no").attr('checked', 'checked');
892
- }
893
- if (short_code['popup_enable_google'] == 1) {
894
- jQuery("#popup_google_yes").attr('checked', 'checked');
895
- }
896
- else {
897
- jQuery("#popup_google_no").attr('checked', 'checked');
898
- }
899
  }
900
  else {
901
- jQuery("#popup_ctrl_btn_no").attr('checked', 'checked');
 
902
  }
 
 
903
  }
904
- // Watermark.
905
- if (short_code['watermark_type'] == 'text') {
906
- jQuery("#watermark_type_text").attr('checked', 'checked');
907
- jQuery("#watermark_link").val(short_code['watermark_link']);
908
- jQuery("#watermark_text").val(short_code['watermark_text']);
909
- jQuery("#watermark_font_size").val(short_code['watermark_font_size']);
910
- jQuery("select[id=watermark_font] option[value='" + short_code['watermark_font'] + "']").attr('selected', 'selected');
911
- jQuery("#watermark_color").val(short_code['watermark_color']);
912
- jQuery("#watermark_opacity").val(short_code['watermark_opacity']);
913
- jQuery("#watermark_type_text").attr('checked', 'checked');
914
- jQuery("#watermark_" + short_code['watermark_position']).attr('checked', 'checked');
915
- }
916
- else if (short_code['watermark_type'] == 'image') {
917
- jQuery("#watermark_type_image").attr('checked', 'checked');
918
- jQuery("#watermark_link").val(short_code['watermark_link']);
919
- jQuery("#watermark_url").val(short_code['watermark_url']);
920
- jQuery("#watermark_width").val(short_code['watermark_width']);
921
- jQuery("#watermark_height").val(short_code['watermark_height']);
922
- jQuery("#watermark_opacity").val(short_code['watermark_opacity']);
923
- jQuery("#watermark_type_image").attr('checked', 'checked');
924
- jQuery("#watermark_" + short_code['watermark_position']).attr('checked', 'checked');
925
- }
926
- else {
927
- jQuery("#watermark_type_none").attr('checked', 'checked');
928
-
929
- }
930
- bwg_watermark('watermark_type_' + short_code['watermark_type']);
931
- bwg_gallery_type(short_code['gallery_type']);
932
  }
933
  // Get shortcodes attributes.
934
  function get_params(module_name) {
 
935
  var selected_text = tinyMCE.activeEditor.selection.getContent();
 
 
 
936
  var module_start_index = selected_text.indexOf("[" + module_name);
937
  var module_end_index = selected_text.indexOf("]", module_start_index);
938
  var module_str = "";
@@ -964,6 +1037,7 @@ class BWGViewBWGShortcode {
964
  tagtext += ' sort_by="' + jQuery("#sort_by").val() + '"';
965
  tagtext += ' image_column_number="' + jQuery("#image_column_number").val() + '"';
966
  tagtext += ' images_per_page="' + jQuery("#images_per_page").val() + '"';
 
967
  tagtext += ' image_enable_page="' + jQuery("input[name=image_enable_page]:checked").val() + '"';
968
  tagtext += ' thumb_width="' + jQuery("#thumb_width").val() + '"';
969
  tagtext += ' thumb_height="' + jQuery("#thumb_height").val() + '"';
@@ -1010,6 +1084,7 @@ class BWGViewBWGShortcode {
1010
  tagtext += ' compuct_album_thumb_height="' + jQuery("#compuct_album_thumb_height").val() + '"';
1011
  tagtext += ' compuct_album_image_column_number="' + jQuery("#compuct_album_image_column_number").val() + '"';
1012
  tagtext += ' compuct_album_images_per_page="' + jQuery("#compuct_album_images_per_page").val() + '"';
 
1013
  tagtext += ' compuct_album_image_thumb_width="' + jQuery("#compuct_album_image_thumb_width").val() + '"';
1014
  tagtext += ' compuct_album_image_thumb_height="' + jQuery("#compuct_album_image_thumb_height").val() + '"';
1015
  tagtext += ' compuct_album_enable_page="' + jQuery("input[name=compuct_album_enable_page]:checked").val() + '"';
@@ -1026,6 +1101,7 @@ class BWGViewBWGShortcode {
1026
  tagtext += ' extended_album_thumb_height="' + jQuery("#extended_album_thumb_height").val() + '"';
1027
  tagtext += ' extended_album_image_column_number="' + jQuery("#extended_album_image_column_number").val() + '"';
1028
  tagtext += ' extended_album_images_per_page="' + jQuery("#extended_album_images_per_page").val() + '"';
 
1029
  tagtext += ' extended_album_image_thumb_width="' + jQuery("#extended_album_image_thumb_width").val() + '"';
1030
  tagtext += ' extended_album_image_thumb_height="' + jQuery("#extended_album_image_thumb_height").val() + '"';
1031
  tagtext += ' extended_album_enable_page="' + jQuery("input[name=extended_album_enable_page]:checked").val() + '"';
@@ -1071,6 +1147,7 @@ class BWGViewBWGShortcode {
1071
  return "<img src='<?php echo WD_BWG_URL; ?>/images/bwg_shortcode.png' class='bwg_shortcode mceItem' title='Best_Wordpress_Gallery" + tagtext + "' />";
1072
  });
1073
 
 
1074
  if (window.tinymce.isIE && content) {
1075
  // IE and Update.
1076
  var all_content = tinyMCE.activeEditor.getContent();
@@ -1084,6 +1161,9 @@ class BWGViewBWGShortcode {
1084
  }
1085
  tinyMCEPopup.editor.execCommand('mceRepaint');
1086
  tinyMCEPopup.close();
 
 
 
1087
  }
1088
  </script>
1089
  </body>
27
  $album_rows = $this->model->get_album_rows_data();
28
  $option_row = $this->model->get_option_row_data();
29
  $theme_rows = $this->model->get_theme_rows_data();
30
+ $from_menu = ((isset($_GET['page']) && (esc_html($_GET['page']) == 'BWGShortcode')) ? TRUE : FALSE);
31
  $effects = array(
32
  'none' => 'None',
33
  'cubeH' => 'Cube Horizontal',
48
  'monospace' => 'Monospace',
49
  'serif' => 'Serif',
50
  );
51
+ if (!$from_menu) {
52
  ?>
53
  <html xmlns="http://www.w3.org/1999/xhtml">
54
  <head>
58
  <link rel="stylesheet" href="<?php echo get_option("siteurl"); ?>/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css?ver=342-20110630100">
59
  <script language="javascript" type="text/javascript" src="<?php echo get_option("siteurl"); ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
60
  <script language="javascript" type="text/javascript" src="<?php echo get_option("siteurl"); ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
61
+ <?php
62
+ }
63
+ ?>
64
  <link rel="stylesheet" href="<?php echo WD_BWG_URL . '/css/bwg_shortcode.css'; ?>">
65
  <link rel="stylesheet" href="<?php echo WD_BWG_URL . '/css/jquery-ui-1.10.3.custom.css'; ?>">
66
  <script language="javascript" type="text/javascript" src="<?php echo get_option("siteurl"); ?>/wp-includes/js/jquery/jquery.js"></script>
69
  <script language="javascript" type="text/javascript" src="<?php echo get_option("siteurl"); ?>/wp-includes/js/jquery/ui/jquery.ui.position.min.js"></script>
70
  <script language="javascript" type="text/javascript" src="<?php echo get_option("siteurl"); ?>/wp-includes/js/jquery/ui/jquery.ui.tooltip.min.js"></script>
71
 
72
+ <script language="javascript" type="text/javascript" src="<?php echo WD_BWG_URL . '/js/bwg_shortcode.js?ver=1.0.1'; ?>"></script>
73
  <script language="javascript" type="text/javascript" src="<?php echo WD_BWG_URL . '/js/jscolor/jscolor.js'; ?>"></script>
74
+ <?php
75
+ if (!$from_menu) {
76
+ ?>
77
  <base target="_self">
78
  </head>
79
  <body id="link" onLoad="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" dir="ltr" class="forceColors">
89
  </div>
90
  <div class="panel_wrapper">
91
  <div id="display_panel" class="panel current">
92
+ <?php
93
+ }
94
+ else {
95
+ ?>
96
+ <div id="display_panel" style="width: 99%; margin-top: 10px;">
97
+ <?php
98
+ }
99
+ ?>
100
  <div style="text-align:center; height:100px;">
101
  <span class="gallery_type" onClick="bwg_gallery_type('thumbnails')">
102
  <div style="text-align: center;"><input type="radio" id="thumbnails" name="gallery_type" value="thumbnails" /><label for="thumbnails">Thumbnails</label></div>
214
  <td title="If you want to display all images you should leave it blank or insert 0." class="spider_label"><label for="images_per_page">Images per page: </label></td>
215
  <td><input type="text" name="images_per_page" id="images_per_page" value="<?php echo $option_row->images_per_page; ?>" class="spider_int_input" /></td>
216
  </tr>
217
+ <tr id="tr_image_title_hover">
218
+ <td class="spider_label"><label>Image title: </label></td>
219
+ <td>
220
+ <input type="radio" name="image_title" id="image_title_hover" value="hover" <?php echo ($option_row->image_title_show_hover == 'hover') ? 'checked' : ''; ?> /><label for="image_title_hover">Show on hover</label><br />
221
+ <input type="radio" name="image_title" id="image_title_show" value="show" <?php echo ($option_row->image_title_show_hover == 'show') ? 'checked' : ''; ?> /><label for="image_title_show">Always show</label><br />
222
+ <input type="radio" name="image_title" id="image_title_none" value="none" <?php echo ($option_row->image_title_show_hover == 'none') ? 'checked' : ''; ?> /><label for="image_title_none">Don't show</label>
223
+ </td>
224
+ </tr>
225
  <tr id="tr_image_enable_page">
226
  <td class="spider_label"><label>Enable pagination: </label></td>
227
  <td>
250
  <td class="spider_label"><label>Album title: </label></td>
251
  <td>
252
  <input type="radio" name="compuct_album_title" id="compuct_album_title_hover" value="hover" <?php echo ($option_row->album_title_show_hover == 'hover') ? 'checked' : ''; ?> /><label for="compuct_album_title_hover">Show on hover</label><br />
253
+ <input type="radio" name="compuct_album_title" id="compuct_album_title_show" value="show" <?php echo ($option_row->album_title_show_hover == 'show') ? 'checked' : ''; ?> /><label for="compuct_album_title_show">Always show</label><br />
254
+ <input type="radio" name="compuct_album_title" id="compuct_album_title_none" value="none" <?php echo ($option_row->album_title_show_hover == 'none') ? 'checked' : ''; ?> /><label for="compuct_album_title_none">Don't show</label>
255
  </td>
256
  </tr>
257
  <tr id="tr_compuct_album_thumb_width_height">
269
  <td title="If you want to display all images you should leave it blank or insert 0." class="spider_label"><label for="compuct_album_images_per_page">Images per page: </label></td>
270
  <td><input type="text" name="compuct_album_images_per_page" id="compuct_album_images_per_page" value="<?php echo $option_row->images_per_page; ?>" class="spider_int_input" /></td>
271
  </tr>
272
+ <tr id="tr_compuct_album_image_title">
273
+ <td class="spider_label"><label>Image title: </label></td>
274
+ <td>
275
+ <input type="radio" name="compuct_album_image_title" id="compuct_album_image_title_hover" value="hover" <?php echo ($option_row->image_title_show_hover == 'hover') ? 'checked' : ''; ?> /><label for="compuct_album_image_title_hover">Show on hover</label><br />
276
+ <input type="radio" name="compuct_album_image_title" id="compuct_album_image_title_show" value="show" <?php echo ($option_row->image_title_show_hover == 'show') ? 'checked' : ''; ?> /><label for="compuct_album_image_title_show">Always show</label><br />
277
+ <input type="radio" name="compuct_album_image_title" id="compuct_album_image_title_none" value="none" <?php echo ($option_row->image_title_show_hover == 'none') ? 'checked' : ''; ?> /><label for="compuct_album_image_title_none">Don't show</label>
278
+ </td>
279
+ </tr>
280
  <tr id="tr_compuct_album_image_thumb_width_height">
281
  <td title="Maximum values for thumb width and height." class="spider_label"><label for="compuct_album_image_thumb_width">Image thumbnail dimensions: </label></td>
282
  <td>
323
  <td title="If you want to display all images you should leave it blank or insert 0." class="spider_label"><label for="extended_album_images_per_page">Images per page: </label></td>
324
  <td><input type="text" name="extended_album_images_per_page" id="extended_album_images_per_page" value="<?php echo $option_row->images_per_page; ?>" class="spider_int_input" /></td>
325
  </tr>
326
+ <tr id="tr_extended_album_image_title">
327
+ <td class="spider_label"><label>Image title: </label></td>
328
+ <td>
329
+ <input type="radio" name="extended_album_image_title" id="extended_album_image_title_hover" value="hover" <?php echo ($option_row->image_title_show_hover == 'hover') ? 'checked' : ''; ?> /><label for="extended_album_image_title_hover">Show on hover</label><br />
330
+ <input type="radio" name="extended_album_image_title" id="extended_album_image_title_show" value="show" <?php echo ($option_row->image_title_show_hover == 'show') ? 'checked' : ''; ?> /><label for="extended_album_image_title_show">Always show</label><br />
331
+ <input type="radio" name="extended_album_image_title" id="extended_album_image_title_none" value="none" <?php echo ($option_row->image_title_show_hover == 'none') ? 'checked' : ''; ?> /><label for="extended_album_image_title_none">Don't show</label>
332
+ </td>
333
+ </tr>
334
  <tr id="tr_extended_album_image_thumb_width_height">
335
  <td title="Maximum values for thumb width and height." class="spider_label"><label for="extended_album_image_thumb_width">Image Thumbnail dimensions: </label></td>
336
  <td>
722
  </tbody>
723
  </table>
724
  </div>
725
+ <?php
726
+ if (!$from_menu) {
727
+ ?>
728
  </div>
729
  </div>
730
  <div class="mceActionPanel">
731
  <div style="float:left;">
732
+ <input type="button" id="cancel" name="cancel" value="Cancel" onClick="tinyMCEPopup.close();" />
733
  </div>
734
  <div style="float:right;">
735
+ <input type="submit" id="insert" name="insert" value="Insert" onClick="bwg_insert_shortcode('');" />
736
  </div>
737
  </div>
738
  </form>
739
+ <?php
740
+ }
741
+ else {
742
+ ?>
743
+ <hr style="float: left; width: 100%;" />
744
+ <input type="button" class="button-primary" id="insert" name="insert" value="Generate" onclick="bwg_insert_shortcode('');" />
745
+ <input type="button" class="button" id="import" name="import" value="Import" onclick="bwg_update_shortcode()" />
746
+ <textarea style="width: 100%; resize: vertical" id="bwg_shortcode" rows="4" onkeydown="bwg_onKeyDown(event)"></textarea>
747
+ </div>
748
+ <?php
749
+ }
750
+ ?>
751
  <script>window.onload = bwg_shortcode_load;</script>
752
  <script type="text/javascript">
753
+ bwg_update_shortcode();
754
+ <?php if (!$from_menu) { ?>
755
  var content = tinyMCE.activeEditor.selection.getContent();
756
+ <?php } else { ?>
757
+ var content = jQuery("#bwg_shortcode").val();
758
+ <?php } ?>
759
+ function bwg_update_shortcode() {
760
+ var short_code = get_params("Best_Wordpress_Gallery");
761
+ if (!short_code) { // Insert.
762
+ <?php if (!$from_menu) { ?>
763
+ jQuery('#insert').val('Insert');
764
+ <?php } ?>
765
+ bwg_gallery_type('thumbnails');
766
+ }
767
+ else { // Update.
768
+ <?php if (!$from_menu) { ?>
769
+ jQuery('#insert').val('Update');
770
+ <?php } ?>
771
+ jQuery('#insert').attr('onclick', "bwg_insert_shortcode(content)");
772
+ jQuery("select[id=theme] option[value='" + short_code['theme_id'] + "']").attr('selected', 'selected');
773
+ switch (short_code['gallery_type']) {
774
+ case 'thumbnails': {
775
+ jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
776
+ jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
777
+ jQuery("#image_column_number").val(short_code['image_column_number']);
778
+ jQuery("#images_per_page").val(short_code['images_per_page']);
779
+ jQuery("#image_title_" + short_code['image_title']).attr('checked', 'checked');
780
+ if (short_code['image_enable_page'] == 1) {
781
+ jQuery("#image_page_yes").attr('checked', 'checked');
782
+ }
783
+ else {
784
+ jQuery("#image_page_no").attr('checked', 'checked');
785
+ }
786
+ jQuery("#thumb_width").val(short_code['thumb_width']);
787
+ jQuery("#thumb_height").val(short_code['thumb_height']);
788
+ break;
789
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
790
  }
791
+ case 'slideshow': {
792
+ jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
793
+ jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
794
+ jQuery("select[id=slideshow_effect] option[value='" + short_code['slideshow_effect'] + "']").attr('selected', 'selected');
795
+ jQuery("#slideshow_interval").val(short_code['slideshow_interval']);
796
+ jQuery("#slideshow_width").val(short_code['slideshow_width']);
797
+ jQuery("#slideshow_height").val(short_code['slideshow_height']);
798
+ if (short_code['enable_slideshow_autoplay'] == 1) {
799
+ jQuery("#slideshow_autoplay_yes").attr('checked', 'checked');
800
+ }
801
+ else {
802
+ jQuery("#slideshow_autoplay_no").attr('checked', 'checked');
803
+ }
804
+ if (short_code['enable_slideshow_shuffle'] == 1) {
805
+ jQuery("#slideshow_shuffle_yes").attr('checked', 'checked');
806
+ }
807
+ else {
808
+ jQuery("#slideshow_shuffle_no").attr('checked', 'checked');
809
+ }
810
+ if (short_code['enable_slideshow_ctrl'] == 1) {
811
+ jQuery("#slideshow_ctrl_yes").attr('checked', 'checked');
812
+ }
813
+ else {
814
+ jQuery("#slideshow_ctrl_no").attr('checked', 'checked');
815
+ }
816
+ if (short_code['enable_slideshow_filmstrip'] == 1) {
817
+ jQuery("#slideshow_filmstrip_yes").attr('checked', 'checked');
818
+ jQuery("#slideshow_filmstrip_height").val(short_code['slideshow_filmstrip_height']);
819
+ bwg_enable_disable('', 'tr_slideshow_filmstrip_height', 'slideshow_filmstrip_yes');
820
+ }
821
+ else {
822
+ jQuery("#slideshow_filmstrip_no").attr('checked', 'checked');
823
+ }
824
+ if (short_code['slideshow_enable_title'] == 1) {
825
+ jQuery("#slideshow_title_yes").attr('checked', 'checked');
826
+ jQuery("#slideshow_title_" + short_code['slideshow_title_position']).attr('checked', 'checked');
827
+ bwg_enable_disable('', 'tr_slideshow_title_position', 'slideshow_title_yes');
828
+ }
829
+ else {
830
+ jQuery("#slideshow_title_no").attr('checked', 'checked');
831
+ }
832
+ if (short_code['slideshow_enable_description'] == 1) {
833
+ jQuery("#slideshow_description_yes").attr('checked', 'checked');
834
+ jQuery("#slideshow_description_" + short_code['slideshow_description_position']).attr('checked', 'checked');
835
+ bwg_enable_disable('', 'tr_slideshow_description_position', 'slideshow_description_yes');
836
+ }
837
+ else {
838
+ jQuery("#slideshow_description_no").attr('checked', 'checked');
839
+ }
840
+ if (short_code['enable_slideshow_music'] == 1) {
841
+ jQuery("#slideshow_music_yes").attr('checked', 'checked');
842
+ jQuery("#slideshow_music_url").val(short_code['slideshow_music_url']);
843
+ bwg_enable_disable('', 'tr_slideshow_music_url', 'slideshow_music_yes');
844
+ }
845
+ else {
846
+ jQuery("#slideshow_music_no").attr('checked', 'checked');
847
+ }
848
+ break;
849
 
 
 
 
 
 
 
 
850
  }
851
+ case 'image_browser': {
852
+ jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
853
+ jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
854
+ jQuery("#image_browser_width").val(short_code['image_browser_width']);
855
+ if (short_code['image_browser_title_enable'] == 1) {
856
+ jQuery("#image_browser_title_yes").attr('checked', 'checked');
857
+ }
858
+ else {
859
+ jQuery("#image_browser_title_no").attr('checked', 'checked');
860
+ }
861
+ if (short_code['image_browser_description_enable'] == 1) {
862
+ jQuery("#image_browser_description_yes").attr('checked', 'checked');
863
+ }
864
+ else {
865
+ jQuery("#image_browser_description_no").attr('checked', 'checked');
866
+ }
867
+ break;
868
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
869
  }
870
+ case 'album_compact_preview': {
871
+ jQuery("select[id=album] option[value='" + short_code['album_id'] + "']").attr('selected', 'selected');
872
+ jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
873
+ jQuery("#compuct_album_column_number").val(short_code['compuct_album_column_number']);
874
+ jQuery("#compuct_albums_per_page").val(short_code['compuct_albums_per_page']);
875
+ jQuery("#compuct_album_title_" + short_code['compuct_album_title']).attr('checked', 'checked');
876
+ jQuery("#compuct_album_thumb_width").val(short_code['compuct_album_thumb_width']);
877
+ jQuery("#compuct_album_thumb_height").val(short_code['compuct_album_thumb_height']);
878
+ jQuery("#compuct_album_image_column_number").val(short_code['compuct_album_image_column_number']);
879
+ jQuery("#compuct_album_images_per_page").val(short_code['compuct_album_images_per_page']);
880
+ jQuery("#compuct_album_image_title_" + short_code['compuct_album_image_title']).attr('checked', 'checked');
881
+ jQuery("#compuct_album_image_thumb_width").val(short_code['compuct_album_image_thumb_width']);
882
+ jQuery("#compuct_album_image_thumb_height").val(short_code['compuct_album_image_thumb_height']);
883
+ if (short_code['compuct_album_enable_page'] == 1) {
884
+ jQuery("#compuct_album_page_yes").attr('checked', 'checked');
885
+ }
886
+ else {
887
+ jQuery("#compuct_album_page_no").attr('checked', 'checked');
888
+ }
889
+ break;
890
+
891
  }
892
+ case 'album_extended_preview': {
893
+ jQuery("select[id=album] option[value='" + short_code['album_id'] + "']").attr('selected', 'selected');
894
+ jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
895
+ jQuery("#extended_albums_per_page").val(short_code['extended_albums_per_page']);
896
+ jQuery("#extended_album_height").val(short_code['extended_album_height']);
897
+ if (short_code['extended_album_description_enable'] == 1) {
898
+ jQuery("#extended_album_description_yes").attr('checked', 'checked');
899
+ }
900
+ else {
901
+ jQuery("#extended_album_description_no").attr('checked', 'checked');
902
+ }
903
+ jQuery("#extended_album_thumb_width").val(short_code['extended_album_thumb_width']);
904
+ jQuery("#extended_album_thumb_height").val(short_code['extended_album_thumb_height']);
905
+ jQuery("#extended_album_image_column_number").val(short_code['extended_album_image_column_number']);
906
+ jQuery("#extended_album_images_per_page").val(short_code['extended_album_images_per_page']);
907
+ jQuery("#extended_album_image_title_" + short_code['extended_album_image_title']).attr('checked', 'checked');
908
+ jQuery("#extended_album_image_thumb_width").val(short_code['extended_album_image_thumb_width']);
909
+ jQuery("#extended_album_image_thumb_height").val(short_code['extended_album_image_thumb_height']);
910
+ if (short_code['extended_album_enable_page'] == 1) {
911
+ jQuery("#extended_album_page_yes").attr('checked', 'checked');
912
+ }
913
+ else {
914
+ jQuery("#extended_album_page_no").attr('checked', 'checked');
915
+ }
916
+ break;
917
 
918
+ }
919
  }
920
+ // Lightbox.
921
+ if (short_code['gallery_type'] != 'slideshow') {
922
+ jQuery("#popup_width").val(short_code['popup_width']);
923
+ jQuery("#popup_height").val(short_code['popup_height']);
924
+ jQuery("select[id=popup_effect] option[value='" + short_code['popup_effect'] + "']").attr('selected', 'selected');
925
+ jQuery("#popup_interval").val(short_code['popup_interval']);
926
+ if (short_code['popup_enable_filmstrip'] == 1) {
927
+ jQuery("#popup_filmstrip_yes").attr('checked', 'checked');
928
+ jQuery("#popup_filmstrip_height").val(short_code['popup_filmstrip_height']);
929
+ bwg_enable_disable('', 'tr_popup_filmstrip_height', 'popup_filmstrip_yes');
930
  }
931
  else {
932
+ jQuery("#popup_filmstrip_no").attr('checked', 'checked');
933
  }
934
+ if (short_code['popup_enable_ctrl_btn'] == 1) {
935
+ jQuery("#popup_ctrl_btn_yes").attr('checked', 'checked');
936
+ bwg_enable_disable('', 'tbody_popup_ctrl_btn', 'popup_ctrl_btn_yes');
937
+ if (short_code['popup_enable_fullscreen'] == 1) {
938
+ jQuery("#popup_fullscreen_yes").attr('checked', 'checked');
939
+ }
940
+ else {
941
+ jQuery("#popup_fullscreen_no").attr('checked', 'checked');
942
+ }
943
+ if (short_code['popup_enable_comment'] == 1) {
944
+ jQuery("#popup_comment_yes").attr('checked', 'checked');
945
+ }
946
+ else {
947
+ jQuery("#popup_comment_no").attr('checked', 'checked');
948
+ }
949
+ if (short_code['popup_enable_facebook'] == 1) {
950
+ jQuery("#popup_facebook_yes").attr('checked', 'checked');
951
+ }
952
+ else {
953
+ jQuery("#popup_facebook_no").attr('checked', 'checked');
954
+ }
955
+ if (short_code['popup_enable_twitter'] == 1) {
956
+ jQuery("#popup_twitter_yes").attr('checked', 'checked');
957
+ }
958
+ else {
959
+ jQuery("#popup_twitter_no").attr('checked', 'checked');
960
+ }
961
+ if (short_code['popup_enable_google'] == 1) {
962
+ jQuery("#popup_google_yes").attr('checked', 'checked');
963
+ }
964
+ else {
965
+ jQuery("#popup_google_no").attr('checked', 'checked');
966
+ }
967
  }
968
  else {
969
+ jQuery("#popup_ctrl_btn_no").attr('checked', 'checked');
970
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
971
  }
972
+ // Watermark.
973
+ if (short_code['watermark_type'] == 'text') {
974
+ jQuery("#watermark_type_text").attr('checked', 'checked');
975
+ jQuery("#watermark_link").val(short_code['watermark_link']);
976
+ jQuery("#watermark_text").val(short_code['watermark_text']);
977
+ jQuery("#watermark_font_size").val(short_code['watermark_font_size']);
978
+ jQuery("select[id=watermark_font] option[value='" + short_code['watermark_font'] + "']").attr('selected', 'selected');
979
+ jQuery("#watermark_color").val(short_code['watermark_color']);
980
+ jQuery("#watermark_opacity").val(short_code['watermark_opacity']);
981
+ jQuery("#watermark_type_text").attr('checked', 'checked');
982
+ jQuery("#watermark_" + short_code['watermark_position']).attr('checked', 'checked');
983
  }
984
+ else if (short_code['watermark_type'] == 'image') {
985
+ jQuery("#watermark_type_image").attr('checked', 'checked');
986
+ jQuery("#watermark_link").val(short_code['watermark_link']);
987
+ jQuery("#watermark_url").val(short_code['watermark_url']);
988
+ jQuery("#watermark_width").val(short_code['watermark_width']);
989
+ jQuery("#watermark_height").val(short_code['watermark_height']);
990
+ jQuery("#watermark_opacity").val(short_code['watermark_opacity']);
991
+ jQuery("#watermark_type_image").attr('checked', 'checked');
992
+ jQuery("#watermark_" + short_code['watermark_position']).attr('checked', 'checked');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
993
  }
994
  else {
995
+ jQuery("#watermark_type_none").attr('checked', 'checked');
996
+
997
  }
998
+ bwg_watermark('watermark_type_' + short_code['watermark_type']);
999
+ bwg_gallery_type(short_code['gallery_type']);
1000
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1001
  }
1002
  // Get shortcodes attributes.
1003
  function get_params(module_name) {
1004
+ <?php if (!$from_menu) { ?>
1005
  var selected_text = tinyMCE.activeEditor.selection.getContent();
1006
+ <?php } else { ?>
1007
+ var selected_text = jQuery("#bwg_shortcode").val();
1008
+ <?php } ?>
1009
  var module_start_index = selected_text.indexOf("[" + module_name);
1010
  var module_end_index = selected_text.indexOf("]", module_start_index);
1011
  var module_str = "";
1037
  tagtext += ' sort_by="' + jQuery("#sort_by").val() + '"';
1038
  tagtext += ' image_column_number="' + jQuery("#image_column_number").val() + '"';
1039
  tagtext += ' images_per_page="' + jQuery("#images_per_page").val() + '"';
1040
+ tagtext += ' image_title="' + jQuery("input[name=image_title]:checked").val() + '"';
1041
  tagtext += ' image_enable_page="' + jQuery("input[name=image_enable_page]:checked").val() + '"';
1042
  tagtext += ' thumb_width="' + jQuery("#thumb_width").val() + '"';
1043
  tagtext += ' thumb_height="' + jQuery("#thumb_height").val() + '"';
1084
  tagtext += ' compuct_album_thumb_height="' + jQuery("#compuct_album_thumb_height").val() + '"';
1085
  tagtext += ' compuct_album_image_column_number="' + jQuery("#compuct_album_image_column_number").val() + '"';
1086
  tagtext += ' compuct_album_images_per_page="' + jQuery("#compuct_album_images_per_page").val() + '"';
1087
+ tagtext += ' compuct_album_image_title="' + jQuery("input[name=compuct_album_image_title]:checked").val() + '"';
1088
  tagtext += ' compuct_album_image_thumb_width="' + jQuery("#compuct_album_image_thumb_width").val() + '"';
1089
  tagtext += ' compuct_album_image_thumb_height="' + jQuery("#compuct_album_image_thumb_height").val() + '"';
1090
  tagtext += ' compuct_album_enable_page="' + jQuery("input[name=compuct_album_enable_page]:checked").val() + '"';
1101
  tagtext += ' extended_album_thumb_height="' + jQuery("#extended_album_thumb_height").val() + '"';
1102
  tagtext += ' extended_album_image_column_number="' + jQuery("#extended_album_image_column_number").val() + '"';
1103
  tagtext += ' extended_album_images_per_page="' + jQuery("#extended_album_images_per_page").val() + '"';
1104
+ tagtext += ' extended_album_image_title="' + jQuery("input[name=extended_album_image_title]:checked").val() + '"';
1105
  tagtext += ' extended_album_image_thumb_width="' + jQuery("#extended_album_image_thumb_width").val() + '"';
1106
  tagtext += ' extended_album_image_thumb_height="' + jQuery("#extended_album_image_thumb_height").val() + '"';
1107
  tagtext += ' extended_album_enable_page="' + jQuery("input[name=extended_album_enable_page]:checked").val() + '"';
1147
  return "<img src='<?php echo WD_BWG_URL; ?>/images/bwg_shortcode.png' class='bwg_shortcode mceItem' title='Best_Wordpress_Gallery" + tagtext + "' />";
1148
  });
1149
 
1150
+ <?php if (!$from_menu) { ?>
1151
  if (window.tinymce.isIE && content) {
1152
  // IE and Update.
1153
  var all_content = tinyMCE.activeEditor.getContent();
1161
  }
1162
  tinyMCEPopup.editor.execCommand('mceRepaint');
1163
  tinyMCEPopup.close();
1164
+ <?php } else { ?>
1165
+ jQuery("#bwg_shortcode").val("[Best_Wordpress_Gallery" + tagtext + "]");
1166
+ <?php } ?>
1167
  }
1168
  </script>
1169
  </body>
admin/views/BWGViewEditThumb.php CHANGED
@@ -67,8 +67,8 @@ class BWGViewEditThumb {
67
  public function crop() {
68
  global $WD_BWG_UPLOAD_DIR;
69
  $options = $this->model->get_option_data();
70
- $thumb_width = $options->thumb_width;
71
- $thumb_height = $options->thumb_height;
72
  $popup_width = ((int) (isset($_GET['width']) ? esc_html($_GET['width']) : '800')) - 50;
73
  $image_width = $popup_width - $thumb_width - 70;
74
  $popup_height = ((int) (isset($_GET['height']) ? esc_html($_GET['height']) : '500')) - 75;
@@ -237,8 +237,8 @@ class BWGViewEditThumb {
237
  // jQuery('#image_view').Jcrop();
238
  jQuery(window).load(function() {
239
  var ratio = parseInt('<?php echo $width_orig; ?>') / jQuery('#image_view').width();
240
- var thumb_width = parseInt('<?php echo $options->thumb_width; ?>');
241
- var thumb_height = parseInt('<?php echo $options->thumb_height; ?>');
242
  if (<?php echo $w; ?> == 0) {
243
  jQuery('#image_view').Jcrop({
244
  onChange: spider_update_thumb,
@@ -274,8 +274,8 @@ class BWGViewEditThumb {
274
  function spider_update_thumb(c) {
275
  jQuery('#crop_button').hide();
276
  jQuery('#croped_message').show();
277
- var thumb_width = parseInt('<?php echo $options->thumb_width; ?>');
278
- var thumb_height = parseInt('<?php echo $options->thumb_height; ?>');
279
  jQuery('#thumb_image_preview').css("margin-left", -c.x * (thumb_width / c.w) + "px");
280
  jQuery('#thumb_image_preview').css("margin-top", -c.y * (thumb_height / c.h) + "px");
281
  jQuery('#thumb_image_preview').css("width", ((thumb_width / c.w) * jQuery('#image_view').width()) + "px");
67
  public function crop() {
68
  global $WD_BWG_UPLOAD_DIR;
69
  $options = $this->model->get_option_data();
70
+ $thumb_width = $options->upload_thumb_width;
71
+ $thumb_height = $options->upload_thumb_height;
72
  $popup_width = ((int) (isset($_GET['width']) ? esc_html($_GET['width']) : '800')) - 50;
73
  $image_width = $popup_width - $thumb_width - 70;
74
  $popup_height = ((int) (isset($_GET['height']) ? esc_html($_GET['height']) : '500')) - 75;
237
  // jQuery('#image_view').Jcrop();
238
  jQuery(window).load(function() {
239
  var ratio = parseInt('<?php echo $width_orig; ?>') / jQuery('#image_view').width();
240
+ var thumb_width = parseInt('<?php echo $options->upload_thumb_width; ?>');
241
+ var thumb_height = parseInt('<?php echo $options->upload_thumb_height; ?>');
242
  if (<?php echo $w; ?> == 0) {
243
  jQuery('#image_view').Jcrop({
244
  onChange: spider_update_thumb,
274
  function spider_update_thumb(c) {
275
  jQuery('#crop_button').hide();
276
  jQuery('#croped_message').show();
277
+ var thumb_width = parseInt('<?php echo $options->upload_thumb_width; ?>');
278
+ var thumb_height = parseInt('<?php echo $options->upload_thumb_height; ?>');
279
  jQuery('#thumb_image_preview').css("margin-left", -c.x * (thumb_width / c.w) + "px");
280
  jQuery('#thumb_image_preview').css("margin-top", -c.y * (thumb_height / c.h) + "px");
281
  jQuery('#thumb_image_preview').css("width", ((thumb_width / c.w) * jQuery('#image_view').width()) + "px");
admin/views/BWGViewOptions_bwg.php CHANGED
@@ -659,11 +659,12 @@ class BWGViewOptions_bwg {
659
  </tr>
660
  <tr>
661
  <td class="spider_label_options">
662
- <label>Show album title:</label>
663
  </td>
664
  <td>
665
- <input type="radio" name="album_title_show_hover" id="album_title_show_hover_1" value="hover" <?php if ($row->album_title_show_hover == "hover") echo 'checked="checked"'; ?> /><label for="album_title_show_hover_1">Show on hover</label>
666
- <input type="radio" name="album_title_show_hover" id="album_title_show_hover_0" value="show" <?php if ($row->album_title_show_hover == "show") echo 'checked="checked"'; ?> /><label for="album_title_show_hover_0">Always show</label>
 
667
  <div class="spider_description"></div>
668
  </td>
669
  </tr>
@@ -926,11 +927,32 @@ class BWGViewOptions_bwg {
926
  </tr>
927
  <tr>
928
  <td class="spider_label_options">
929
- <label for="thumb_width">Thumbnail dimensions: </label>
 
 
 
 
 
 
 
 
 
 
930
  </td>
931
  <td>
932
  <input type="text" name="thumb_width" id="thumb_width" value="<?php echo $row->thumb_width; ?>" class="spider_int_input" /> x
933
  <input type="text" name="thumb_height" id="thumb_height" value="<?php echo $row->thumb_height; ?>" class="spider_int_input" /> px
 
 
 
 
 
 
 
 
 
 
 
934
  <div class="spider_description"></div>
935
  </td>
936
  </tr>
659
  </tr>
660
  <tr>
661
  <td class="spider_label_options">
662
+ <label>Show title:</label>
663
  </td>
664
  <td>
665
+ <input type="radio" name="album_title_show_hover" id="album_title_show_hover_1" value="hover" <?php if ($row->album_title_show_hover == "hover") echo 'checked="checked"'; ?> /><label for="album_title_show_hover_1">Show on hover</label><br />
666
+ <input type="radio" name="album_title_show_hover" id="album_title_show_hover_0" value="show" <?php if ($row->album_title_show_hover == "show") echo 'checked="checked"'; ?> /><label for="album_title_show_hover_0">Always show</label><br />
667
+ <input type="radio" name="album_title_show_hover" id="album_title_show_hover_2" value="none" <?php if ($row->album_title_show_hover == "none") echo 'checked="checked"'; ?> /><label for="album_title_show_hover_2">Don't show</label>
668
  <div class="spider_description"></div>
669
  </td>
670
  </tr>
927
  </tr>
928
  <tr>
929
  <td class="spider_label_options">
930
+ <label for="upload_thumb_width">Generated thumbnail dimensions: </label>
931
+ </td>
932
+ <td>
933
+ <input type="text" name="upload_thumb_width" id="upload_thumb_width" value="<?php echo $row->upload_thumb_width; ?>" class="spider_int_input" /> x
934
+ <input type="text" name="upload_thumb_height" id="upload_thumb_height" value="<?php echo $row->upload_thumb_height; ?>" class="spider_int_input" /> px
935
+ <div class="spider_description">The maximum size of the generated thumbnail. Its dimensions should be larger than the ones of the frontend thumbnail.</div>
936
+ </td>
937
+ </tr>
938
+ <tr>
939
+ <td class="spider_label_options">
940
+ <label for="thumb_width">Frontend thumbnail dimensions: </label>
941
  </td>
942
  <td>
943
  <input type="text" name="thumb_width" id="thumb_width" value="<?php echo $row->thumb_width; ?>" class="spider_int_input" /> x
944
  <input type="text" name="thumb_height" id="thumb_height" value="<?php echo $row->thumb_height; ?>" class="spider_int_input" /> px
945
+ <div class="spider_description">The default size of the thumbnail which will be displayed in the website.</div>
946
+ </td>
947
+ </tr>
948
+ <tr>
949
+ <td class="spider_label_options">
950
+ <label>Show image title:</label>
951
+ </td>
952
+ <td>
953
+ <input type="radio" name="image_title_show_hover" id="image_title_show_hover_1" value="hover" <?php if ($row->image_title_show_hover == "hover") echo 'checked="checked"'; ?> /><label for="image_title_show_hover_1">Show on hover</label><br />
954
+ <input type="radio" name="image_title_show_hover" id="image_title_show_hover_0" value="show" <?php if ($row->image_title_show_hover == "show") echo 'checked="checked"'; ?> /><label for="image_title_show_hover_0">Always show</label><br />
955
+ <input type="radio" name="image_title_show_hover" id="image_title_show_hover_2" value="none" <?php if ($row->image_title_show_hover == "none") echo 'checked="checked"'; ?> /><label for="image_title_show_hover_2">Don't show</label>
956
  <div class="spider_description"></div>
957
  </td>
958
  </tr>
admin/views/BWGViewThemes_bwg.php CHANGED
@@ -231,12 +231,12 @@ class BWGViewThemes_bwg {
231
  </div>
232
  <div style="float: left; margin: 10px 0 0; display: none;" id="type_menu">
233
  <div id="type_Thumbnail" class="theme_type" onclick="bwg_change_theme_type('Thumbnail')">Thumbnails</div>
234
- <div id="type_Masonry" class="theme_type" onclick="bwg_change_theme_type('Masonry')">Masonry</div>
235
  <div id="type_Slideshow" class="theme_type" onclick="bwg_change_theme_type('Slideshow')">Slideshow</div>
236
  <div id="type_Image_browser" class="theme_type" onclick="bwg_change_theme_type('Image_browser')">Image Browser</div>
237
  <div id="type_Compact_album" class="theme_type" onclick="bwg_change_theme_type('Compact_album')">Compact Album</div>
238
  <div id="type_Extended_album" class="theme_type" onclick="bwg_change_theme_type('Extended_album')">Extended Album</div>
239
- <div id="type_Blog_style" class="theme_type" onclick="bwg_change_theme_type('Blog_style')">Blog Style</div>
240
  <div id="type_Lightbox" class="theme_type" onclick="bwg_change_theme_type('Lightbox')">Lightbox</div>
241
  <div id="type_Navigation" class="theme_type" onclick="bwg_change_theme_type('Navigation')">Page Navigation</div>
242
  <input type="hidden" id="current_type" name="current_type" value="<?php echo $current_type; ?>" />
@@ -308,6 +308,36 @@ class BWGViewThemes_bwg {
308
  <div class="spider_description">Use CSS type values.</div>
309
  </td>
310
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  </tbody>
312
  </table>
313
  </fieldset>
@@ -363,13 +393,25 @@ class BWGViewThemes_bwg {
363
  <table style="clear:both;">
364
  <tbody>
365
  <tr>
366
- <td class="spider_label"><label for="thumb_hover_effect">Hover effect: </label></td>
367
  <td>
368
- <select name="thumb_hover_effect" id="thumb_hover_effect" class="spider_int_input">
 
 
 
 
 
 
 
 
 
 
 
 
369
  <?php
370
- foreach ($hover_effects as $key => $hover_effect) {
371
  ?>
372
- <option value="<?php echo $key; ?>" <?php echo (($row->thumb_hover_effect == $key) ? 'selected="selected"' : ''); ?>><?php echo $hover_effect; ?></option>
373
  <?php
374
  }
375
  ?>
@@ -377,19 +419,31 @@ class BWGViewThemes_bwg {
377
  </td>
378
  </tr>
379
  <tr>
380
- <td class="spider_label"><label for="thumb_hover_effect_value">Hover effect value: </label></td>
381
  <td>
382
- <input type="text" name="thumb_hover_effect_value" id="thumb_hover_effect_value" value="<?php echo $row->thumb_hover_effect_value; ?>" class="spider_char_input"/>
383
- <div class="spider_description">E.g. Rotate: 10deg, Scale: 1.5, Skew: 10deg.</div>
 
 
 
 
 
 
 
384
  </td>
385
  </tr>
386
  <tr>
387
- <td class="spider_label"><label for="thumb_transition1">Transition: </label></td>
388
- <td id="thumb_transition">
389
- <input type="radio" name="thumb_transition" id="thumb_transition1" value="1"<?php if ($row->thumb_transition == 1) echo 'checked="checked"'; ?> />
390
- <label for="thumb_transition1" id="thumb_transition1_lbl">Yes</label>
391
- <input type="radio" name="thumb_transition" id="thumb_transition0" value="0"<?php if ($row->thumb_transition == 0) echo 'checked="checked"'; ?> />
392
- <label for="thumb_transition0" id="thumb_transition0_lbl">No</label>
 
 
 
 
 
393
  </td>
394
  </tr>
395
  </tbody>
231
  </div>
232
  <div style="float: left; margin: 10px 0 0; display: none;" id="type_menu">
233
  <div id="type_Thumbnail" class="theme_type" onclick="bwg_change_theme_type('Thumbnail')">Thumbnails</div>
234
+ <div id="type_Masonry" class="theme_type" style="opacity: 0.4; filter: Alpha(opacity=40);" title="This tab is disabled in free version">Masonry</div>
235
  <div id="type_Slideshow" class="theme_type" onclick="bwg_change_theme_type('Slideshow')">Slideshow</div>
236
  <div id="type_Image_browser" class="theme_type" onclick="bwg_change_theme_type('Image_browser')">Image Browser</div>
237
  <div id="type_Compact_album" class="theme_type" onclick="bwg_change_theme_type('Compact_album')">Compact Album</div>
238
  <div id="type_Extended_album" class="theme_type" onclick="bwg_change_theme_type('Extended_album')">Extended Album</div>
239
+ <div id="type_Blog_style" class="theme_type" style="opacity: 0.4; filter: Alpha(opacity=40);" title="This tab is disabled in free version">Blog Style</div>
240
  <div id="type_Lightbox" class="theme_type" onclick="bwg_change_theme_type('Lightbox')">Lightbox</div>
241
  <div id="type_Navigation" class="theme_type" onclick="bwg_change_theme_type('Navigation')">Page Navigation</div>
242
  <input type="hidden" id="current_type" name="current_type" value="<?php echo $current_type; ?>" />
308
  <div class="spider_description">Use CSS type values.</div>
309
  </td>
310
  </tr>
311
+ <tr>
312
+ <td class="spider_label"><label for="thumb_hover_effect">Hover effect: </label></td>
313
+ <td>
314
+ <select name="thumb_hover_effect" id="thumb_hover_effect" class="spider_int_input">
315
+ <?php
316
+ foreach ($hover_effects as $key => $hover_effect) {
317
+ ?>
318
+ <option value="<?php echo $key; ?>" <?php echo (($row->thumb_hover_effect == $key) ? 'selected="selected"' : ''); ?>><?php echo $hover_effect; ?></option>
319
+ <?php
320
+ }
321
+ ?>
322
+ </select>
323
+ </td>
324
+ </tr>
325
+ <tr>
326
+ <td class="spider_label"><label for="thumb_hover_effect_value">Hover effect value: </label></td>
327
+ <td>
328
+ <input type="text" name="thumb_hover_effect_value" id="thumb_hover_effect_value" value="<?php echo $row->thumb_hover_effect_value; ?>" class="spider_char_input"/>
329
+ <div class="spider_description">E.g. Rotate: 10deg, Scale: 1.5, Skew: 10deg.</div>
330
+ </td>
331
+ </tr>
332
+ <tr>
333
+ <td class="spider_label"><label for="thumb_transition1">Transition: </label></td>
334
+ <td id="thumb_transition">
335
+ <input type="radio" name="thumb_transition" id="thumb_transition1" value="1"<?php if ($row->thumb_transition == 1) echo 'checked="checked"'; ?> />
336
+ <label for="thumb_transition1" id="thumb_transition1_lbl">Yes</label>
337
+ <input type="radio" name="thumb_transition" id="thumb_transition0" value="0"<?php if ($row->thumb_transition == 0) echo 'checked="checked"'; ?> />
338
+ <label for="thumb_transition0" id="thumb_transition0_lbl">No</label>
339
+ </td>
340
+ </tr>
341
  </tbody>
342
  </table>
343
  </fieldset>
393
  <table style="clear:both;">
394
  <tbody>
395
  <tr>
396
+ <td class="spider_label"><label for="thumb_title_font_size">Title font size: </label></td>
397
  <td>
398
+ <input type="text" name="thumb_title_font_size" id="thumb_title_font_size" value="<?php echo $row->thumb_title_font_size; ?>" class="spider_int_input" onkeypress="return spider_check_isnum(event)"/> px
399
+ </td>
400
+ </tr>
401
+ <tr>
402
+ <td class="spider_label"><label for="thumb_title_font_color">Title font color: </label></td>
403
+ <td>
404
+ <input type="text" name="thumb_title_font_color" id="thumb_title_font_color" value="<?php echo $row->thumb_title_font_color; ?>" class="color" />
405
+ </td>
406
+ </tr>
407
+ <tr>
408
+ <td class="spider_label"><label for="thumb_title_font_style">Title font family: </label></td>
409
+ <td>
410
+ <select name="thumb_title_font_style" id="thumb_title_font_style">
411
  <?php
412
+ foreach ($font_families as $key => $font_family) {
413
  ?>
414
+ <option value="<?php echo $key; ?>" <?php echo (($row->thumb_title_font_style == $key) ? 'selected="selected"' : ''); ?>><?php echo $font_family; ?></option>
415
  <?php
416
  }
417
  ?>
419
  </td>
420
  </tr>
421
  <tr>
422
+ <td class="spider_label"><label for="thumb_title_font_weight">Title font weight: </label></td>
423
  <td>
424
+ <select name="thumb_title_font_weight" id="thumb_title_font_weight">
425
+ <?php
426
+ foreach ($font_weights as $key => $font_weight) {
427
+ ?>
428
+ <option value="<?php echo $key; ?>" <?php echo (($row->thumb_title_font_weight == $key) ? 'selected="selected"' : ''); ?>><?php echo $font_weight; ?></option>
429
+ <?php
430
+ }
431
+ ?>
432
+ </select>
433
  </td>
434
  </tr>
435
  <tr>
436
+ <td class="spider_label"><label for="thumb_title_shadow">Title box shadow: </label></td>
437
+ <td>
438
+ <input type="text" name="thumb_title_shadow" id="thumb_title_shadow" value="<?php echo $row->thumb_title_shadow; ?>" class="spider_box_input" />
439
+ <div class="spider_description">Use CSS type values.</div>
440
+ </td>
441
+ </tr>
442
+ <tr>
443
+ <td class="spider_label"><label for="thumb_title_margin">Title margin: </label></td>
444
+ <td>
445
+ <input type="text" name="thumb_title_margin" id="thumb_title_margin" value="<?php echo $row->thumb_title_margin; ?>" class="spider_char_input" />
446
+ <div class="spider_description">Use CSS type values.</div>
447
  </td>
448
  </tr>
449
  </tbody>
css/bwg_shortcode.css CHANGED
@@ -5,7 +5,7 @@
5
  }
6
 
7
  .panel_wrapper,
8
- #display_panel {
9
  height: 450px !important;
10
  overflow: auto;
11
  font-size: 11px;
@@ -37,13 +37,20 @@
37
  line-height: 10px;
38
  }
39
 
40
- .bwg_short_div {
41
  float: left;
42
  height: 300px;
43
  padding: 15px;
44
  width: 30%;
45
  }
46
 
 
 
 
 
 
 
 
47
  .bws_position_table td,
48
  .bws_position_table input{
49
  border: 1px solid #CCCCCC;
5
  }
6
 
7
  .panel_wrapper,
8
+ .panel_wrapper #display_panel {
9
  height: 450px !important;
10
  overflow: auto;
11
  font-size: 11px;
37
  line-height: 10px;
38
  }
39
 
40
+ .panel_wrapper .bwg_short_div {
41
  float: left;
42
  height: 300px;
43
  padding: 15px;
44
  width: 30%;
45
  }
46
 
47
+ .bwg_short_div {
48
+ float: left;
49
+ height: 400px;
50
+ padding: 15px;
51
+ width: 30%;
52
+ }
53
+
54
  .bws_position_table td,
55
  .bws_position_table input{
56
  border: 1px solid #CCCCCC;
filemanager/UploadHandler.php CHANGED
@@ -15,824 +15,823 @@ $upload_handler = new UploadHandler(array(
15
  'accept_file_types' => '/\.(gif|jpe?g|png|bmp|mp4|flv|webm|ogg|mp3|wav|pdf)$/i'
16
  ));
17
 
18
- class UploadHandler
19
- {
20
  protected $options;
21
  // PHP File Upload error message codes:
22
  // http://php.net/manual/en/features.file-upload.errors.php
23
  protected $error_messages = array(
24
- 1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
25
- 2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
26
- 3 => 'The uploaded file was only partially uploaded',
27
- 4 => 'No file was uploaded',
28
- 6 => 'Missing a temporary folder',
29
- 7 => 'Failed to write file to disk',
30
- 8 => 'A PHP extension stopped the file upload',
31
- 'post_max_size' => 'The uploaded file exceeds the post_max_size directive in php.ini',
32
- 'max_file_size' => 'File is too big',
33
- 'min_file_size' => 'File is too small',
34
- 'accept_file_types' => 'Filetype not allowed',
35
- 'max_number_of_files' => 'Maximum number of files exceeded',
36
- 'max_width' => 'Image exceeds maximum width',
37
- 'min_width' => 'Image requires a minimum width',
38
- 'max_height' => 'Image exceeds maximum height',
39
- 'min_height' => 'Image requires a minimum height'
40
  );
41
 
42
  function __construct($options = null, $initialize = true, $error_messages = null) {
43
- $this->options = array(
44
- 'script_url' => $this->get_full_url().'/',
45
- 'upload_dir' => dirname($_SERVER['SCRIPT_FILENAME']).'/files/',
46
- 'upload_url' => $this->get_full_url().'/files/',
47
- 'user_dirs' => false,
48
- 'mkdir_mode' => 0755,
49
- 'param_name' => 'files',
50
- // Set the following option to 'POST', if your server does not support
51
- // DELETE requests. This is a parameter sent to the client:
52
- 'delete_type' => 'DELETE',
53
- 'access_control_allow_origin' => '*',
54
- 'access_control_allow_credentials' => false,
55
- 'access_control_allow_methods' => array(
56
- 'OPTIONS',
57
- 'HEAD',
58
- 'GET',
59
- 'POST',
60
- 'PUT',
61
- 'PATCH',
62
- 'DELETE'
63
- ),
64
- 'access_control_allow_headers' => array(
65
- 'Content-Type',
66
- 'Content-Range',
67
- 'Content-Disposition'
68
- ),
69
- // Enable to provide file downloads via GET requests to the PHP script:
70
- 'download_via_php' => false,
71
- // Defines which files can be displayed inline when downloaded:
72
- 'inline_file_types' => '/\.(gif|jpe?g|png)$/i',
73
- // Defines which files (based on their names) are accepted for upload:
74
- 'accept_file_types' => '/.+$/i',
75
- // The php.ini settings upload_max_filesize and post_max_size
76
- // take precedence over the following max_file_size setting:
77
- 'max_file_size' => null,
78
- 'min_file_size' => 1,
79
- // The maximum number of files for the upload directory:
80
- 'max_number_of_files' => null,
81
- // Image resolution restrictions:
82
- 'max_width' => null,
83
- 'max_height' => null,
84
- 'min_width' => 1,
85
- 'min_height' => 1,
86
- // Set the following option to false to enable resumable uploads:
87
- 'discard_aborted_uploads' => true,
88
- // Set to true to rotate images based on EXIF meta data, if available:
89
- 'orient_image' => false,
90
- 'image_versions' => array(
91
- // Uncomment the following version to restrict the size of
92
- // uploaded images:
93
- /*
94
- '' => array(
95
- 'max_width' => 1920,
96
- 'max_height' => 1200,
97
- 'jpeg_quality' => 95
98
- ),
99
- */
100
- // Uncomment the following to create medium sized images:
101
- /*
102
- 'medium' => array(
103
- 'max_width' => 800,
104
- 'max_height' => 600,
105
- 'jpeg_quality' => 80
106
- ),
107
- */
108
- '.original' => array(
109
- 'max_width' => NULL,
110
- 'max_height' => NULL,
111
- 'jpeg_quality' => 100
112
- ),
113
- 'thumb' => array(
114
- 'max_width' => ((isset($_GET['thumb_width']) && $_GET['thumb_width']) ? $_GET['thumb_width'] : 120),
115
- 'max_height' => ((isset($_GET['thumb_height']) && $_GET['thumb_height']) ? $_GET['thumb_height'] : 90),
116
- 'jpeg_quality' => 100
117
- ),
118
- )
119
- );
120
- if ($options) {
121
- $this->options = array_merge($this->options, $options);
122
- }
123
- if ($error_messages) {
124
- $this->error_messages = array_merge($this->error_messages, $error_messages);
125
- }
126
- if ($initialize) {
127
- $this->initialize();
128
- }
129
  }
130
 
131
  protected function initialize() {
132
- switch ($_SERVER['REQUEST_METHOD']) {
133
- case 'OPTIONS':
134
- case 'HEAD':
135
- $this->head();
136
- break;
137
- case 'GET':
138
- $this->get();
139
- break;
140
- case 'PATCH':
141
- case 'PUT':
142
- case 'POST':
143
- $this->post();
144
- break;
145
- case 'DELETE':
146
- $this->delete();
147
- break;
148
- default:
149
- $this->header('HTTP/1.1 405 Method Not Allowed');
150
- }
151
  }
152
 
153
  protected function get_full_url() {
154
- $https = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
155
- return
156
- ($https ? 'https://' : 'http://').
157
- (!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '').
158
- (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].
159
- ($https && $_SERVER['SERVER_PORT'] === 443 ||
160
- $_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
161
- substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
162
  }
163
 
164
  protected function get_user_id() {
165
- @session_start();
166
- return session_id();
167
  }
168
 
169
  protected function get_user_path() {
170
- if ($this->options['user_dirs']) {
171
- return $this->get_user_id().'/';
172
- }
173
- return '';
174
  }
175
 
176
  protected function get_upload_path($file_name = null, $version = null) {
177
- $file_name = $file_name ? $file_name : '';
178
- $version_path = empty($version) ? '' : $version.'/';
179
- return $this->options['upload_dir'].$this->get_user_path()
180
  .$version_path.$file_name;
181
  }
182
 
183
  protected function get_query_separator($url) {
184
- return strpos($url, '?') === false ? '?' : '&';
185
  }
186
 
187
  protected function get_download_url($file_name, $version = null) {
188
- if ($this->options['download_via_php']) {
189
- $url = $this->options['script_url']
190
- .$this->get_query_separator($this->options['script_url'])
191
- .'file='.rawurlencode($file_name);
192
- if ($version) {
193
- $url .= '&version='.rawurlencode($version);
194
- }
195
- return $url.'&download=1';
196
  }
197
- $version_path = empty($version) ? '' : rawurlencode($version).'/';
198
- return $this->options['upload_url'].$this->get_user_path()
199
- .$version_path.rawurlencode($file_name);
 
 
200
  }
201
 
202
  protected function set_file_delete_properties($file) {
203
- $file->delete_url = $this->options['script_url']
204
- .$this->get_query_separator($this->options['script_url'])
205
- .'file='.rawurlencode($file->name);
206
- $file->delete_type = $this->options['delete_type'];
207
- if ($file->delete_type !== 'DELETE') {
208
- $file->delete_url .= '&_method=DELETE';
209
- }
210
- if ($this->options['access_control_allow_credentials']) {
211
- $file->delete_with_credentials = true;
212
- }
213
  }
214
 
215
  // Fix for overflowing signed 32 bit integers,
216
  // works for sizes up to 2^32-1 bytes (4 GiB - 1):
217
  protected function fix_integer_overflow($size) {
218
- if ($size < 0) {
219
- $size += 2.0 * (PHP_INT_MAX + 1);
220
- }
221
- return $size;
222
  }
223
 
224
  protected function get_file_size($file_path, $clear_stat_cache = false) {
225
- if ($clear_stat_cache) {
226
- clearstatcache(true, $file_path);
227
- }
228
- return $this->fix_integer_overflow(filesize($file_path));
229
 
230
  }
231
 
232
  protected function is_valid_file_object($file_name) {
233
- $file_path = $this->get_upload_path($file_name);
234
- if (is_file($file_path) && $file_name[0] !== '.') {
235
- return true;
236
- }
237
- return false;
238
  }
239
 
240
  protected function get_file_object($file_name) {
241
- if ($this->is_valid_file_object($file_name)) {
242
- $file = new stdClass();
243
- $file->name = $file_name;
244
- $file->size = $this->get_file_size(
245
- $this->get_upload_path($file_name)
246
- );
247
- $file->url = $this->get_download_url($file->name);
248
- foreach($this->options['image_versions'] as $version => $options) {
249
- if (!empty($version)) {
250
- if (is_file($this->get_upload_path($file_name, $version))) {
251
- $file->{$version.'_url'} = $this->get_download_url(
252
- $file->name,
253
- $version
254
- );
255
- }
256
- }
257
  }
258
- $this->set_file_delete_properties($file);
259
- return $file;
260
  }
261
- return null;
 
 
 
262
  }
263
 
264
  protected function get_file_objects($iteration_method = 'get_file_object') {
265
- $upload_dir = $this->get_upload_path();
266
- if (!is_dir($upload_dir)) {
267
- return array();
268
- }
269
- return array_values(array_filter(array_map(
270
- array($this, $iteration_method),
271
- scandir($upload_dir)
272
- )));
273
  }
274
 
275
  protected function count_file_objects() {
276
- return count($this->get_file_objects('is_valid_file_object'));
277
  }
278
 
279
  protected function create_scaled_image($file_name, $version, $options) {
280
- $file_path = $this->get_upload_path($file_name);
281
- if (!empty($version)) {
282
- $version_dir = $this->get_upload_path(null, $version);
283
- if (!is_dir($version_dir)) {
284
- mkdir($version_dir, $this->options['mkdir_mode'], true);
285
- }
286
- $new_file_path = $version_dir.'/'.$file_name;
287
- } else {
288
- $new_file_path = $file_path;
289
- }
290
- if (!function_exists('getimagesize')) {
291
- error_log('Function not found: getimagesize');
292
- return false;
293
- }
294
- list($img_width, $img_height) = @getimagesize($file_path);
295
- if (!$img_width || !$img_height) {
296
- return false;
297
- }
298
- $max_width = $options['max_width'];
299
- $max_height = $options['max_height'];
300
- $scale = min(
301
- $max_width / $img_width,
302
- $max_height / $img_height
303
- );
304
- if (($scale >= 1) || (($max_width === NULL) && ($max_height === NULL))) {
305
- if ($file_path !== $new_file_path) {
306
- return copy($file_path, $new_file_path);
307
- }
308
- return true;
309
- }
310
- if (!function_exists('imagecreatetruecolor')) {
311
- error_log('Function not found: imagecreatetruecolor');
312
- return false;
313
  }
314
- if (empty($options['crop'])) {
315
- $new_width = $img_width * $scale;
316
- $new_height = $img_height * $scale;
317
- $dst_x = 0;
318
- $dst_y = 0;
319
- $new_img = @imagecreatetruecolor($new_width, $new_height);
 
 
 
 
 
 
 
 
 
 
320
  } else {
321
- if (($img_width / $img_height) >= ($max_width / $max_height)) {
322
- $new_width = $img_width / ($img_height / $max_height);
323
- $new_height = $max_height;
324
- } else {
325
- $new_width = $max_width;
326
- $new_height = $img_height / ($img_width / $max_width);
327
- }
328
- $dst_x = 0 - ($new_width - $max_width) / 2;
329
- $dst_y = 0 - ($new_height - $max_height) / 2;
330
- $new_img = @imagecreatetruecolor($max_width, $max_height);
331
- }
332
- list($width, $height, $type) = getimagesize($file_path);
333
- // switch (strtolower(substr(strrchr($file_name, '.'), 1))) {
334
- switch ($type) {
335
- case 2:
336
- $src_img = @imagecreatefromjpeg($file_path);
337
- $write_image = 'imagejpeg';
338
- $image_quality = isset($options['jpeg_quality']) ?
339
- $options['jpeg_quality'] : 75;
340
- break;
341
- case 1:
342
- @imagecolortransparent($new_img, @imagecolorallocate($new_img, 0, 0, 0));
343
- $src_img = @imagecreatefromgif($file_path);
344
- $write_image = 'imagegif';
345
- $image_quality = null;
346
- break;
347
- case 3:
348
- @imagecolortransparent($new_img, @imagecolorallocate($new_img, 0, 0, 0));
349
- @imagealphablending($new_img, false);
350
- @imagesavealpha($new_img, true);
351
- $src_img = @imagecreatefrompng($file_path);
352
- $write_image = 'imagepng';
353
- $image_quality = isset($options['png_quality']) ?
354
- $options['png_quality'] : 9;
355
- break;
356
- default:
357
- $src_img = null;
358
- }
359
- $success = $src_img && @imagecopyresampled(
360
- $new_img,
361
- $src_img,
362
- $dst_x,
363
- $dst_y,
364
- 0,
365
- 0,
366
- $new_width,
367
- $new_height,
368
- $img_width,
369
- $img_height
370
- ) && $write_image($new_img, $new_file_path, $image_quality);
371
- // Free up memory (imagedestroy does not delete files):
372
- @imagedestroy($src_img);
373
- @imagedestroy($new_img);
374
- return $success;
375
  }
376
 
377
  protected function get_error_message($error) {
378
- return array_key_exists($error, $this->error_messages) ?
379
- $this->error_messages[$error] : $error;
380
  }
381
 
382
  function get_config_bytes($val) {
383
- $val = trim($val);
384
- $last = strtolower($val[strlen($val)-1]);
385
- switch($last) {
386
- case 'g':
387
- $val *= 1024;
388
- case 'm':
389
- $val *= 1024;
390
- case 'k':
391
- $val *= 1024;
392
- }
393
- return $this->fix_integer_overflow($val);
394
  }
395
 
396
  protected function validate($uploaded_file, $file, $error, $index) {
397
- if ($error) {
398
- $file->error = $this->get_error_message($error);
399
- return false;
400
- }
401
- $content_length = $this->fix_integer_overflow(intval($_SERVER['CONTENT_LENGTH']));
402
- $post_max_size = $this->get_config_bytes(ini_get('post_max_size'));
403
- if ($post_max_size && ($content_length > $post_max_size)) {
404
- $file->error = $this->get_error_message('post_max_size');
405
- return false;
406
- }
407
- if (!preg_match($this->options['accept_file_types'], $file->name)) {
408
- $file->error = $this->get_error_message('accept_file_types');
409
- return false;
410
- }
411
- if ($uploaded_file && is_uploaded_file($uploaded_file)) {
412
- $file_size = $this->get_file_size($uploaded_file);
413
- } else {
414
- $file_size = $content_length;
415
- }
416
- if ($this->options['max_file_size'] && (
417
- $file_size > $this->options['max_file_size'] ||
418
- $file->size > $this->options['max_file_size'])
419
- ) {
420
- $file->error = $this->get_error_message('max_file_size');
421
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
422
  }
423
- if ($this->options['min_file_size'] &&
424
- $file_size < $this->options['min_file_size']) {
425
- $file->error = $this->get_error_message('min_file_size');
426
- return false;
427
  }
428
- if (is_int($this->options['max_number_of_files']) && (
429
- $this->count_file_objects() >= $this->options['max_number_of_files'])
430
- ) {
431
- $file->error = $this->get_error_message('max_number_of_files');
432
- return false;
433
  }
434
- list($img_width, $img_height) = @getimagesize($uploaded_file);
435
- if (is_int($img_width)) {
436
- if ($this->options['max_width'] && $img_width > $this->options['max_width']) {
437
- $file->error = $this->get_error_message('max_width');
438
- return false;
439
- }
440
- if ($this->options['max_height'] && $img_height > $this->options['max_height']) {
441
- $file->error = $this->get_error_message('max_height');
442
- return false;
443
- }
444
- if ($this->options['min_width'] && $img_width < $this->options['min_width']) {
445
- $file->error = $this->get_error_message('min_width');
446
- return false;
447
- }
448
- if ($this->options['min_height'] && $img_height < $this->options['min_height']) {
449
- $file->error = $this->get_error_message('min_height');
450
- return false;
451
- }
452
  }
453
- return true;
 
454
  }
455
 
456
  protected function upcount_name_callback($matches) {
457
- $index = isset($matches[1]) ? intval($matches[1]) + 1 : 1;
458
- $ext = isset($matches[2]) ? $matches[2] : '';
459
- return ' ('.$index.')'.$ext;
460
  }
461
 
462
  protected function upcount_name($name) {
463
- return preg_replace_callback(
464
- '/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/',
465
- array($this, 'upcount_name_callback'),
466
- $name,
467
- 1
468
- );
469
  }
470
 
471
  protected function get_unique_filename($name, $type, $index, $content_range) {
472
- while(is_dir($this->get_upload_path($name))) {
473
- $name = $this->upcount_name($name);
474
- }
475
- // Keep an existing filename if this is part of a chunked upload:
476
- $uploaded_bytes = $this->fix_integer_overflow(intval($content_range[1]));
477
- while(is_file($this->get_upload_path($name))) {
478
- if ($uploaded_bytes === $this->get_file_size(
479
- $this->get_upload_path($name))) {
480
- break;
481
- }
482
- $name = $this->upcount_name($name);
483
  }
484
- return $name;
 
 
485
  }
486
 
487
  protected function trim_file_name($name, $type, $index, $content_range) {
488
- // Remove path information and dots around the filename, to prevent uploading
489
- // into different directories or replacing hidden system files.
490
- // Also remove control characters and spaces (\x00..\x20) around the filename:
491
- $name = trim(basename(stripslashes($name)), ".\x00..\x20");
492
- // Use a timestamp for empty filenames:
493
- if (!$name) {
494
- $name = str_replace('.', '-', microtime(true));
495
- }
496
- // Add missing file extension for known image types:
497
- if (strpos($name, '.') === false &&
498
- preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) {
499
- $name .= '.'.$matches[1];
500
- }
501
- return $name;
502
  }
503
 
504
  protected function get_file_name($name, $type, $index, $content_range) {
505
- return $this->get_unique_filename(
506
- $this->trim_file_name($name, $type, $index, $content_range),
507
- $type,
508
- $index,
509
- $content_range
510
- );
511
  }
512
 
513
  protected function handle_form_data($file, $index) {
514
- // Handle form data, e.g. $_REQUEST['description'][$index]
515
  }
516
 
517
  protected function orient_image($file_path) {
518
- if (!function_exists('exif_read_data')) {
519
- return false;
520
- }
521
- $exif = @exif_read_data($file_path);
522
- if ($exif === false) {
523
- return false;
524
- }
525
- $orientation = intval(@$exif['Orientation']);
526
- if (!in_array($orientation, array(3, 6, 8))) {
527
- return false;
528
- }
529
- $image = @imagecreatefromjpeg($file_path);
530
- switch ($orientation) {
531
- case 3:
532
- $image = @imagerotate($image, 180, 0);
533
- break;
534
- case 6:
535
- $image = @imagerotate($image, 270, 0);
536
- break;
537
- case 8:
538
- $image = @imagerotate($image, 90, 0);
539
- break;
540
- default:
541
- return false;
542
- }
543
- $success = imagejpeg($image, $file_path);
544
- // Free up memory (imagedestroy does not delete files):
545
- @imagedestroy($image);
546
- return $success;
547
  }
548
 
549
  protected function handle_image_file($file_path, $file) {
550
- if ($this->options['orient_image']) {
551
- $this->orient_image($file_path);
552
- }
553
- $failed_versions = array();
554
- foreach($this->options['image_versions'] as $version => $options) {
555
- if ($this->create_scaled_image($file->name, $version, $options)) {
556
- if (!empty($version)) {
557
- $file->{$version.'_url'} = $this->get_download_url(
558
- $file->name,
559
- $version
560
- );
561
- } else {
562
- $file->size = $this->get_file_size($file_path, true);
563
- }
564
- } else {
565
- $failed_versions[] = $version;
566
- }
567
- }
568
- switch (count($failed_versions)) {
569
- case 0:
570
- break;
571
- case 1:
572
- $file->error = 'Failed to create scaled version: '
573
- .$failed_versions[0];
574
- break;
575
- default:
576
- $file->error = 'Failed to create scaled versions: '
577
- .implode($failed_versions,', ');
578
- }
579
- }
580
-
581
- protected function handle_file_upload($uploaded_file, $name, $size, $type, $error,
582
- $index = null, $content_range = null) {
583
- $file = new stdClass();
584
- $file->name = $this->get_file_name($name, $type, $index, $content_range);
585
- $file->size = $this->fix_integer_overflow(intval($size));
586
- $file->type = $type;
587
- if ($this->validate($uploaded_file, $file, $error, $index)) {
588
- $this->handle_form_data($file, $index);
589
- $upload_dir = $this->get_upload_path();
590
- if (!is_dir($upload_dir)) {
591
- mkdir($upload_dir, $this->options['mkdir_mode'], true);
592
- }
593
- $file_path = $this->get_upload_path($file->name);
594
- $append_file = $content_range && is_file($file_path) &&
595
- $file->size > $this->get_file_size($file_path);
596
- if ($uploaded_file && is_uploaded_file($uploaded_file)) {
597
- // multipart/formdata uploads (POST method uploads)
598
- if ($append_file) {
599
- file_put_contents(
600
- $file_path,
601
- fopen($uploaded_file, 'r'),
602
- FILE_APPEND
603
- );
604
- } else {
605
- move_uploaded_file($uploaded_file, $file_path);
606
- }
607
- } else {
608
- // Non-multipart uploads (PUT method support)
609
- file_put_contents(
610
- $file_path,
611
- fopen('php://input', 'r'),
612
- $append_file ? FILE_APPEND : 0
613
- );
614
- }
615
- $file_size = $this->get_file_size($file_path, $append_file);
616
- if ($file_size === $file->size) {
617
- $file->url = $this->get_download_url($file->name);
618
- list($img_width, $img_height) = @getimagesize($file_path);
619
- if (is_int($img_width)) {
620
- $this->handle_image_file($file_path, $file);
621
- }
622
- } else {
623
- $file->size = $file_size;
624
- if (!$content_range && $this->options['discard_aborted_uploads']) {
625
- unlink($file_path);
626
- $file->error = 'abort';
627
- }
628
- }
629
- $this->set_file_delete_properties($file);
630
  }
631
- return $file;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
632
  }
633
 
634
  protected function readfile($file_path) {
635
- return readfile($file_path);
636
  }
637
 
638
  protected function body($str) {
639
- echo $str;
640
  }
641
 
642
  protected function header($str) {
643
- header($str);
644
  }
645
 
646
  protected function generate_response($content, $print_response = true) {
647
- if ($print_response) {
648
- $json = json_encode($content);
649
- $redirect = isset($_REQUEST['redirect']) ?
650
- stripslashes($_REQUEST['redirect']) : null;
651
- if ($redirect) {
652
- $this->header('Location: '.sprintf($redirect, rawurlencode($json)));
653
- return;
654
- }
655
- $this->head();
656
- if (isset($_SERVER['HTTP_CONTENT_RANGE'])) {
657
- $files = isset($content[$this->options['param_name']]) ?
658
- $content[$this->options['param_name']] : null;
659
- if ($files && is_array($files) && is_object($files[0]) && $files[0]->size) {
660
- $this->header('Range: 0-'.($this->fix_integer_overflow(intval($files[0]->size)) - 1));
661
- }
662
- }
663
- $this->body($json);
664
  }
665
- return $content;
 
 
666
  }
667
 
668
  protected function get_version_param() {
669
- return isset($_GET['version']) ? basename(stripslashes($_GET['version'])) : null;
670
  }
671
 
672
  protected function get_file_name_param() {
673
- return isset($_GET['file']) ? basename(stripslashes($_GET['file'])) : null;
674
  }
675
 
676
  protected function get_file_type($file_path) {
677
- switch (strtolower(pathinfo($file_path, PATHINFO_EXTENSION))) {
678
- case 'jpeg':
679
- case 'jpg':
680
- return 'image/jpeg';
681
- case 'png':
682
- return 'image/png';
683
- case 'gif':
684
- return 'image/gif';
685
- default:
686
- return '';
687
- }
688
  }
689
 
690
  protected function download() {
691
- if (!$this->options['download_via_php']) {
692
- $this->header('HTTP/1.1 403 Forbidden');
693
- return;
694
- }
695
- $file_name = $this->get_file_name_param();
696
- if ($this->is_valid_file_object($file_name)) {
697
- $file_path = $this->get_upload_path($file_name, $this->get_version_param());
698
- if (is_file($file_path)) {
699
- if (!preg_match($this->options['inline_file_types'], $file_name)) {
700
- $this->header('Content-Description: File Transfer');
701
- $this->header('Content-Type: application/octet-stream');
702
- $this->header('Content-Disposition: attachment; filename="'.$file_name.'"');
703
- $this->header('Content-Transfer-Encoding: binary');
704
- } else {
705
- // Prevent Internet Explorer from MIME-sniffing the content-type:
706
- $this->header('X-Content-Type-Options: nosniff');
707
- $this->header('Content-Type: '.$this->get_file_type($file_path));
708
- $this->header('Content-Disposition: inline; filename="'.$file_name.'"');
709
- }
710
- $this->header('Content-Length: '.$this->get_file_size($file_path));
711
- $this->header('Last-Modified: '.gmdate('D, d M Y H:i:s T', filemtime($file_path)));
712
- $this->readfile($file_path);
713
- }
714
- }
 
715
  }
716
 
717
  protected function send_content_type_header() {
718
- $this->header('Vary: Accept');
719
- if (isset($_SERVER['HTTP_ACCEPT']) &&
720
- (strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false)) {
721
- $this->header('Content-type: application/json');
722
- } else {
723
- $this->header('Content-type: text/plain');
724
- }
 
725
  }
726
 
727
  protected function send_access_control_headers() {
728
- $this->header('Access-Control-Allow-Origin: '.$this->options['access_control_allow_origin']);
729
- $this->header('Access-Control-Allow-Credentials: '
730
- .($this->options['access_control_allow_credentials'] ? 'true' : 'false'));
731
- $this->header('Access-Control-Allow-Methods: '
732
- .implode(', ', $this->options['access_control_allow_methods']));
733
- $this->header('Access-Control-Allow-Headers: '
734
- .implode(', ', $this->options['access_control_allow_headers']));
735
  }
736
 
737
  public function head() {
738
- $this->header('Pragma: no-cache');
739
- $this->header('Cache-Control: no-store, no-cache, must-revalidate');
740
- $this->header('Content-Disposition: inline; filename="files.json"');
741
- // Prevent Internet Explorer from MIME-sniffing the content-type:
742
- $this->header('X-Content-Type-Options: nosniff');
743
- if ($this->options['access_control_allow_origin']) {
744
- $this->send_access_control_headers();
745
- }
746
- $this->send_content_type_header();
747
  }
748
 
749
  public function get($print_response = true) {
750
- if ($print_response && isset($_GET['download'])) {
751
- return $this->download();
752
- }
753
- $file_name = $this->get_file_name_param();
754
- if ($file_name) {
755
- $response = array(
756
- substr($this->options['param_name'], 0, -1) => $this->get_file_object($file_name)
757
- );
758
- } else {
759
- $response = array(
760
- $this->options['param_name'] => $this->get_file_objects()
761
- );
762
- }
763
- return $this->generate_response($response, $print_response);
 
764
  }
765
 
766
  public function post($print_response = true) {
767
- if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
768
- return $this->delete($print_response);
769
- }
770
- $upload = isset($_FILES[$this->options['param_name']]) ?
771
- $_FILES[$this->options['param_name']] : null;
772
- // Parse the Content-Disposition header, if available:
773
- $file_name = isset($_SERVER['HTTP_CONTENT_DISPOSITION']) ?
774
- rawurldecode(preg_replace(
775
- '/(^[^"]+")|("$)/',
776
- '',
777
- $_SERVER['HTTP_CONTENT_DISPOSITION']
778
- )) : null;
779
- // Parse the Content-Range header, which has the following form:
780
- // Content-Range: bytes 0-524287/2000000
781
- $content_range = isset($_SERVER['HTTP_CONTENT_RANGE']) ?
782
- preg_split('/[^0-9]+/', $_SERVER['HTTP_CONTENT_RANGE']) : null;
783
- $size = $content_range ? $content_range[3] : null;
784
- $files = array();
785
- if ($upload && is_array($upload['tmp_name'])) {
786
- // param_name is an array identifier like "files[]",
787
- // $_FILES is a multi-dimensional array:
788
- foreach ($upload['tmp_name'] as $index => $value) {
789
- $files[] = $this->handle_file_upload(
790
- $upload['tmp_name'][$index],
791
- $file_name ? $file_name : $upload['name'][$index],
792
- $size ? $size : $upload['size'][$index],
793
- $upload['type'][$index],
794
- $upload['error'][$index],
795
- $index,
796
- $content_range
797
- );
798
- }
799
- } else {
800
- // param_name is a single object identifier like "file",
801
- // $_FILES is a one-dimensional array:
802
  $files[] = $this->handle_file_upload(
803
- isset($upload['tmp_name']) ? $upload['tmp_name'] : null,
804
- $file_name ? $file_name : (isset($upload['name']) ?
805
- $upload['name'] : null),
806
- $size ? $size : (isset($upload['size']) ?
807
- $upload['size'] : $_SERVER['CONTENT_LENGTH']),
808
- isset($upload['type']) ?
809
- $upload['type'] : $_SERVER['CONTENT_TYPE'],
810
- isset($upload['error']) ? $upload['error'] : null,
811
- null,
812
  $content_range
813
  );
814
  }
815
- return $this->generate_response(
816
- array($this->options['param_name'] => $files),
817
- $print_response
 
 
 
 
 
 
 
 
 
 
 
 
818
  );
 
 
 
 
 
819
  }
820
 
821
  public function delete($print_response = true) {
822
- $file_name = $this->get_file_name_param();
823
- $file_path = $this->get_upload_path($file_name);
824
- $success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path);
825
- if ($success) {
826
- foreach($this->options['image_versions'] as $version => $options) {
827
- if (!empty($version)) {
828
- $file = $this->get_upload_path($file_name, $version);
829
- if (is_file($file)) {
830
- unlink($file);
831
- }
832
- }
833
  }
 
834
  }
835
- return $this->generate_response(array('success' => $success), $print_response);
 
836
  }
837
 
838
  }
15
  'accept_file_types' => '/\.(gif|jpe?g|png|bmp|mp4|flv|webm|ogg|mp3|wav|pdf)$/i'
16
  ));
17
 
18
+ class UploadHandler {
 
19
  protected $options;
20
  // PHP File Upload error message codes:
21
  // http://php.net/manual/en/features.file-upload.errors.php
22
  protected $error_messages = array(
23
+ 1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
24
+ 2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
25
+ 3 => 'The uploaded file was only partially uploaded',
26
+ 4 => 'No file was uploaded',
27
+ 6 => 'Missing a temporary folder',
28
+ 7 => 'Failed to write file to disk',
29
+ 8 => 'A PHP extension stopped the file upload',
30
+ 'post_max_size' => 'The uploaded file exceeds the post_max_size directive in php.ini',
31
+ 'max_file_size' => 'File is too big',
32
+ 'min_file_size' => 'File is too small',
33
+ 'accept_file_types' => 'Filetype not allowed',
34
+ 'max_number_of_files' => 'Maximum number of files exceeded',
35
+ 'max_width' => 'Image exceeds maximum width',
36
+ 'min_width' => 'Image requires a minimum width',
37
+ 'max_height' => 'Image exceeds maximum height',
38
+ 'min_height' => 'Image requires a minimum height'
39
  );
40
 
41
  function __construct($options = null, $initialize = true, $error_messages = null) {
42
+ $this->options = array(
43
+ 'script_url' => $this->get_full_url().'/',
44
+ 'upload_dir' => dirname($_SERVER['SCRIPT_FILENAME']).'/files/',
45
+ 'upload_url' => $this->get_full_url().'/files/',
46
+ 'user_dirs' => false,
47
+ 'mkdir_mode' => 0755,
48
+ 'param_name' => 'files',
49
+ // Set the following option to 'POST', if your server does not support
50
+ // DELETE requests. This is a parameter sent to the client:
51
+ 'delete_type' => 'DELETE',
52
+ 'access_control_allow_origin' => '*',
53
+ 'access_control_allow_credentials' => false,
54
+ 'access_control_allow_methods' => array(
55
+ 'OPTIONS',
56
+ 'HEAD',
57
+ 'GET',
58
+ 'POST',
59
+ 'PUT',
60
+ 'PATCH',
61
+ 'DELETE'
62
+ ),
63
+ 'access_control_allow_headers' => array(
64
+ 'Content-Type',
65
+ 'Content-Range',
66
+ 'Content-Disposition'
67
+ ),
68
+ // Enable to provide file downloads via GET requests to the PHP script:
69
+ 'download_via_php' => false,
70
+ // Defines which files can be displayed inline when downloaded:
71
+ 'inline_file_types' => '/\.(gif|jpe?g|png)$/i',
72
+ // Defines which files (based on their names) are accepted for upload:
73
+ 'accept_file_types' => '/.+$/i',
74
+ // The php.ini settings upload_max_filesize and post_max_size
75
+ // take precedence over the following max_file_size setting:
76
+ 'max_file_size' => null,
77
+ 'min_file_size' => 1,
78
+ // The maximum number of files for the upload directory:
79
+ 'max_number_of_files' => null,
80
+ // Image resolution restrictions:
81
+ 'max_width' => null,
82
+ 'max_height' => null,
83
+ 'min_width' => 1,
84
+ 'min_height' => 1,
85
+ // Set the following option to false to enable resumable uploads:
86
+ 'discard_aborted_uploads' => true,
87
+ // Set to true to rotate images based on EXIF meta data, if available:
88
+ 'orient_image' => false,
89
+ 'image_versions' => array(
90
+ // Uncomment the following version to restrict the size of
91
+ // uploaded images:
92
+ /*
93
+ '' => array(
94
+ 'max_width' => 1920,
95
+ 'max_height' => 1200,
96
+ 'jpeg_quality' => 95
97
+ ),
98
+ */
99
+ // Uncomment the following to create medium sized images:
100
+ /*
101
+ 'medium' => array(
102
+ 'max_width' => 800,
103
+ 'max_height' => 600,
104
+ 'jpeg_quality' => 80
105
+ ),
106
+ */
107
+ '.original' => array(
108
+ 'max_width' => NULL,
109
+ 'max_height' => NULL,
110
+ 'jpeg_quality' => 100
111
+ ),
112
+ 'thumb' => array(
113
+ 'max_width' => ((isset($_POST['upload_thumb_width']) && (int) $_POST['upload_thumb_width']) ? (int) $_POST['upload_thumb_width'] : 300),
114
+ 'max_height' => ((isset($_POST['upload_thumb_height']) && (int) $_POST['upload_thumb_height']) ? (int) $_POST['upload_thumb_height'] : 300),
115
+ 'jpeg_quality' => 100
116
+ ),
117
+ )
118
+ );
119
+ if ($options) {
120
+ $this->options = array_merge($this->options, $options);
121
+ }
122
+ if ($error_messages) {
123
+ $this->error_messages = array_merge($this->error_messages, $error_messages);
124
+ }
125
+ if ($initialize) {
126
+ $this->initialize();
127
+ }
128
  }
129
 
130
  protected function initialize() {
131
+ switch ($_SERVER['REQUEST_METHOD']) {
132
+ case 'OPTIONS':
133
+ case 'HEAD':
134
+ $this->head();
135
+ break;
136
+ case 'GET':
137
+ $this->get();
138
+ break;
139
+ case 'PATCH':
140
+ case 'PUT':
141
+ case 'POST':
142
+ $this->post();
143
+ break;
144
+ case 'DELETE':
145
+ $this->delete();
146
+ break;
147
+ default:
148
+ $this->header('HTTP/1.1 405 Method Not Allowed');
149
+ }
150
  }
151
 
152
  protected function get_full_url() {
153
+ $https = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
154
+ return
155
+ ($https ? 'https://' : 'http://').
156
+ (!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '').
157
+ (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].
158
+ ($https && $_SERVER['SERVER_PORT'] === 443 ||
159
+ $_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
160
+ substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
161
  }
162
 
163
  protected function get_user_id() {
164
+ @session_start();
165
+ return session_id();
166
  }
167
 
168
  protected function get_user_path() {
169
+ if ($this->options['user_dirs']) {
170
+ return $this->get_user_id().'/';
171
+ }
172
+ return '';
173
  }
174
 
175
  protected function get_upload_path($file_name = null, $version = null) {
176
+ $file_name = $file_name ? $file_name : '';
177
+ $version_path = empty($version) ? '' : $version.'/';
178
+ return $this->options['upload_dir'].$this->get_user_path()
179
  .$version_path.$file_name;
180
  }
181
 
182
  protected function get_query_separator($url) {
183
+ return strpos($url, '?') === false ? '?' : '&';
184
  }
185
 
186
  protected function get_download_url($file_name, $version = null) {
187
+ if ($this->options['download_via_php']) {
188
+ $url = $this->options['script_url']
189
+ .$this->get_query_separator($this->options['script_url'])
190
+ .'file='.rawurlencode($file_name);
191
+ if ($version) {
192
+ $url .= '&version='.rawurlencode($version);
 
 
193
  }
194
+ return $url.'&download=1';
195
+ }
196
+ $version_path = empty($version) ? '' : rawurlencode($version).'/';
197
+ return $this->options['upload_url'].$this->get_user_path()
198
+ .$version_path.rawurlencode($file_name);
199
  }
200
 
201
  protected function set_file_delete_properties($file) {
202
+ $file->delete_url = $this->options['script_url']
203
+ .$this->get_query_separator($this->options['script_url'])
204
+ .'file='.rawurlencode($file->name);
205
+ $file->delete_type = $this->options['delete_type'];
206
+ if ($file->delete_type !== 'DELETE') {
207
+ $file->delete_url .= '&_method=DELETE';
208
+ }
209
+ if ($this->options['access_control_allow_credentials']) {
210
+ $file->delete_with_credentials = true;
211
+ }
212
  }
213
 
214
  // Fix for overflowing signed 32 bit integers,
215
  // works for sizes up to 2^32-1 bytes (4 GiB - 1):
216
  protected function fix_integer_overflow($size) {
217
+ if ($size < 0) {
218
+ $size += 2.0 * (PHP_INT_MAX + 1);
219
+ }
220
+ return $size;
221
  }
222
 
223
  protected function get_file_size($file_path, $clear_stat_cache = false) {
224
+ if ($clear_stat_cache) {
225
+ clearstatcache(true, $file_path);
226
+ }
227
+ return $this->fix_integer_overflow(filesize($file_path));
228
 
229
  }
230
 
231
  protected function is_valid_file_object($file_name) {
232
+ $file_path = $this->get_upload_path($file_name);
233
+ if (is_file($file_path) && $file_name[0] !== '.') {
234
+ return true;
235
+ }
236
+ return false;
237
  }
238
 
239
  protected function get_file_object($file_name) {
240
+ if ($this->is_valid_file_object($file_name)) {
241
+ $file = new stdClass();
242
+ $file->name = $file_name;
243
+ $file->size = $this->get_file_size(
244
+ $this->get_upload_path($file_name)
245
+ );
246
+ $file->url = $this->get_download_url($file->name);
247
+ foreach($this->options['image_versions'] as $version => $options) {
248
+ if (!empty($version)) {
249
+ if (is_file($this->get_upload_path($file_name, $version))) {
250
+ $file->{$version.'_url'} = $this->get_download_url(
251
+ $file->name,
252
+ $version
253
+ );
 
 
254
  }
255
+ }
 
256
  }
257
+ $this->set_file_delete_properties($file);
258
+ return $file;
259
+ }
260
+ return null;
261
  }
262
 
263
  protected function get_file_objects($iteration_method = 'get_file_object') {
264
+ $upload_dir = $this->get_upload_path();
265
+ if (!is_dir($upload_dir)) {
266
+ return array();
267
+ }
268
+ return array_values(array_filter(array_map(
269
+ array($this, $iteration_method),
270
+ scandir($upload_dir)
271
+ )));
272
  }
273
 
274
  protected function count_file_objects() {
275
+ return count($this->get_file_objects('is_valid_file_object'));
276
  }
277
 
278
  protected function create_scaled_image($file_name, $version, $options) {
279
+ $file_path = $this->get_upload_path($file_name);
280
+ if (!empty($version)) {
281
+ $version_dir = $this->get_upload_path(null, $version);
282
+ if (!is_dir($version_dir)) {
283
+ mkdir($version_dir, $this->options['mkdir_mode'], true);
284
+ }
285
+ $new_file_path = $version_dir.'/'.$file_name;
286
+ } else {
287
+ $new_file_path = $file_path;
288
+ }
289
+ if (!function_exists('getimagesize')) {
290
+ error_log('Function not found: getimagesize');
291
+ return false;
292
+ }
293
+ list($img_width, $img_height) = @getimagesize($file_path);
294
+ if (!$img_width || !$img_height) {
295
+ return false;
296
+ }
297
+ $max_width = $options['max_width'];
298
+ $max_height = $options['max_height'];
299
+ $scale = min(
300
+ $max_width / $img_width,
301
+ $max_height / $img_height
302
+ );
303
+ if (($scale >= 1) || (($max_width === NULL) && ($max_height === NULL))) {
304
+ if ($file_path !== $new_file_path) {
305
+ return copy($file_path, $new_file_path);
 
 
 
 
 
 
306
  }
307
+ return true;
308
+ }
309
+ if (!function_exists('imagecreatetruecolor')) {
310
+ error_log('Function not found: imagecreatetruecolor');
311
+ return false;
312
+ }
313
+ if (empty($options['crop'])) {
314
+ $new_width = $img_width * $scale;
315
+ $new_height = $img_height * $scale;
316
+ $dst_x = 0;
317
+ $dst_y = 0;
318
+ $new_img = @imagecreatetruecolor($new_width, $new_height);
319
+ } else {
320
+ if (($img_width / $img_height) >= ($max_width / $max_height)) {
321
+ $new_width = $img_width / ($img_height / $max_height);
322
+ $new_height = $max_height;
323
  } else {
324
+ $new_width = $max_width;
325
+ $new_height = $img_height / ($img_width / $max_width);
326
+ }
327
+ $dst_x = 0 - ($new_width - $max_width) / 2;
328
+ $dst_y = 0 - ($new_height - $max_height) / 2;
329
+ $new_img = @imagecreatetruecolor($max_width, $max_height);
330
+ }
331
+ list($width, $height, $type) = getimagesize($file_path);
332
+ // switch (strtolower(substr(strrchr($file_name, '.'), 1))) {
333
+ switch ($type) {
334
+ case 2:
335
+ $src_img = @imagecreatefromjpeg($file_path);
336
+ $write_image = 'imagejpeg';
337
+ $image_quality = isset($options['jpeg_quality']) ? $options['jpeg_quality'] : 75;
338
+ break;
339
+ case 1:
340
+ @imagecolortransparent($new_img, @imagecolorallocate($new_img, 0, 0, 0));
341
+ $src_img = @imagecreatefromgif($file_path);
342
+ $write_image = 'imagegif';
343
+ $image_quality = null;
344
+ break;
345
+ case 3:
346
+ @imagecolortransparent($new_img, @imagecolorallocate($new_img, 0, 0, 0));
347
+ @imagealphablending($new_img, false);
348
+ @imagesavealpha($new_img, true);
349
+ $src_img = @imagecreatefrompng($file_path);
350
+ $write_image = 'imagepng';
351
+ $image_quality = isset($options['png_quality']) ? $options['png_quality'] : 9;
352
+ break;
353
+ default:
354
+ $src_img = null;
355
+ }
356
+ $success = $src_img && @imagecopyresampled(
357
+ $new_img,
358
+ $src_img,
359
+ $dst_x,
360
+ $dst_y,
361
+ 0,
362
+ 0,
363
+ $new_width,
364
+ $new_height,
365
+ $img_width,
366
+ $img_height
367
+ ) && $write_image($new_img, $new_file_path, $image_quality);
368
+ // Free up memory (imagedestroy does not delete files):
369
+ @imagedestroy($src_img);
370
+ @imagedestroy($new_img);
371
+ return $success;
 
 
 
 
 
 
372
  }
373
 
374
  protected function get_error_message($error) {
375
+ return array_key_exists($error, $this->error_messages) ? $this->error_messages[$error] : $error;
 
376
  }
377
 
378
  function get_config_bytes($val) {
379
+ $val = trim($val);
380
+ $last = strtolower($val[strlen($val)-1]);
381
+ switch($last) {
382
+ case 'g':
383
+ $val *= 1024;
384
+ case 'm':
385
+ $val *= 1024;
386
+ case 'k':
387
+ $val *= 1024;
388
+ }
389
+ return $this->fix_integer_overflow($val);
390
  }
391
 
392
  protected function validate($uploaded_file, $file, $error, $index) {
393
+ if ($error) {
394
+ $file->error = $this->get_error_message($error);
395
+ return false;
396
+ }
397
+ $content_length = $this->fix_integer_overflow(intval($_SERVER['CONTENT_LENGTH']));
398
+ $post_max_size = $this->get_config_bytes(ini_get('post_max_size'));
399
+ if ($post_max_size && ($content_length > $post_max_size)) {
400
+ $file->error = $this->get_error_message('post_max_size');
401
+ return false;
402
+ }
403
+ if (!preg_match($this->options['accept_file_types'], $file->name)) {
404
+ $file->error = $this->get_error_message('accept_file_types');
405
+ return false;
406
+ }
407
+ if ($uploaded_file && is_uploaded_file($uploaded_file)) {
408
+ $file_size = $this->get_file_size($uploaded_file);
409
+ }
410
+ else {
411
+ $file_size = $content_length;
412
+ }
413
+ if ($this->options['max_file_size'] && (
414
+ $file_size > $this->options['max_file_size'] ||
415
+ $file->size > $this->options['max_file_size'])
416
+ ) {
417
+ $file->error = $this->get_error_message('max_file_size');
418
+ return false;
419
+ }
420
+ if ($this->options['min_file_size'] &&
421
+ $file_size < $this->options['min_file_size']) {
422
+ $file->error = $this->get_error_message('min_file_size');
423
+ return false;
424
+ }
425
+ if (is_int($this->options['max_number_of_files']) && (
426
+ $this->count_file_objects() >= $this->options['max_number_of_files'])
427
+ ) {
428
+ $file->error = $this->get_error_message('max_number_of_files');
429
+ return false;
430
+ }
431
+ list($img_width, $img_height) = @getimagesize($uploaded_file);
432
+ if (is_int($img_width)) {
433
+ if ($this->options['max_width'] && $img_width > $this->options['max_width']) {
434
+ $file->error = $this->get_error_message('max_width');
435
+ return false;
436
  }
437
+ if ($this->options['max_height'] && $img_height > $this->options['max_height']) {
438
+ $file->error = $this->get_error_message('max_height');
439
+ return false;
 
440
  }
441
+ if ($this->options['min_width'] && $img_width < $this->options['min_width']) {
442
+ $file->error = $this->get_error_message('min_width');
443
+ return false;
 
 
444
  }
445
+ if ($this->options['min_height'] && $img_height < $this->options['min_height']) {
446
+ $file->error = $this->get_error_message('min_height');
447
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
448
  }
449
+ }
450
+ return true;
451
  }
452
 
453
  protected function upcount_name_callback($matches) {
454
+ $index = isset($matches[1]) ? intval($matches[1]) + 1 : 1;
455
+ $ext = isset($matches[2]) ? $matches[2] : '';
456
+ return ' ('.$index.')'.$ext;
457
  }
458
 
459
  protected function upcount_name($name) {
460
+ return preg_replace_callback(
461
+ '/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/',
462
+ array($this, 'upcount_name_callback'),
463
+ $name,
464
+ 1
465
+ );
466
  }
467
 
468
  protected function get_unique_filename($name, $type, $index, $content_range) {
469
+ while(is_dir($this->get_upload_path($name))) {
470
+ $name = $this->upcount_name($name);
471
+ }
472
+ // Keep an existing filename if this is part of a chunked upload:
473
+ $uploaded_bytes = $this->fix_integer_overflow(intval($content_range[1]));
474
+ while(is_file($this->get_upload_path($name))) {
475
+ if ($uploaded_bytes === $this->get_file_size(
476
+ $this->get_upload_path($name))) {
477
+ break;
 
 
478
  }
479
+ $name = $this->upcount_name($name);
480
+ }
481
+ return $name;
482
  }
483
 
484
  protected function trim_file_name($name, $type, $index, $content_range) {
485
+ // Remove path information and dots around the filename, to prevent uploading
486
+ // into different directories or replacing hidden system files.
487
+ // Also remove control characters and spaces (\x00..\x20) around the filename:
488
+ $name = trim(basename(stripslashes($name)), ".\x00..\x20");
489
+ // Use a timestamp for empty filenames:
490
+ if (!$name) {
491
+ $name = str_replace('.', '-', microtime(true));
492
+ }
493
+ // Add missing file extension for known image types:
494
+ if (strpos($name, '.') === false &&
495
+ preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) {
496
+ $name .= '.'.$matches[1];
497
+ }
498
+ return $name;
499
  }
500
 
501
  protected function get_file_name($name, $type, $index, $content_range) {
502
+ return $this->get_unique_filename(
503
+ $this->trim_file_name($name, $type, $index, $content_range),
504
+ $type,
505
+ $index,
506
+ $content_range
507
+ );
508
  }
509
 
510
  protected function handle_form_data($file, $index) {
511
+ // Handle form data, e.g. $_REQUEST['description'][$index]
512
  }
513
 
514
  protected function orient_image($file_path) {
515
+ if (!function_exists('exif_read_data')) {
516
+ return false;
517
+ }
518
+ $exif = @exif_read_data($file_path);
519
+ if ($exif === false) {
520
+ return false;
521
+ }
522
+ $orientation = intval(@$exif['Orientation']);
523
+ if (!in_array($orientation, array(3, 6, 8))) {
524
+ return false;
525
+ }
526
+ $image = @imagecreatefromjpeg($file_path);
527
+ switch ($orientation) {
528
+ case 3:
529
+ $image = @imagerotate($image, 180, 0);
530
+ break;
531
+ case 6:
532
+ $image = @imagerotate($image, 270, 0);
533
+ break;
534
+ case 8:
535
+ $image = @imagerotate($image, 90, 0);
536
+ break;
537
+ default:
538
+ return false;
539
+ }
540
+ $success = imagejpeg($image, $file_path);
541
+ // Free up memory (imagedestroy does not delete files):
542
+ @imagedestroy($image);
543
+ return $success;
544
  }
545
 
546
  protected function handle_image_file($file_path, $file) {
547
+ if ($this->options['orient_image']) {
548
+ $this->orient_image($file_path);
549
+ }
550
+ $failed_versions = array();
551
+ foreach($this->options['image_versions'] as $version => $options) {
552
+ if ($this->create_scaled_image($file->name, $version, $options)) {
553
+ if (!empty($version)) {
554
+ $file->{$version.'_url'} = $this->get_download_url(
555
+ $file->name,
556
+ $version
557
+ );
558
+ }
559
+ else {
560
+ $file->size = $this->get_file_size($file_path, true);
561
+ }
562
+ }
563
+ else {
564
+ $failed_versions[] = $version;
565
+ }
566
+ }
567
+ switch (count($failed_versions)) {
568
+ case 0:
569
+ break;
570
+ case 1:
571
+ $file->error = 'Failed to create scaled version: '
572
+ .$failed_versions[0];
573
+ break;
574
+ default:
575
+ $file->error = 'Failed to create scaled versions: '
576
+ .implode($failed_versions,', ');
577
+ }
578
+ }
579
+
580
+ protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null, $content_range = null) {
581
+ $file = new stdClass();
582
+ $file->name = $this->get_file_name($name, $type, $index, $content_range);
583
+ $file->size = $this->fix_integer_overflow(intval($size));
584
+ $file->type = $type;
585
+ if ($this->validate($uploaded_file, $file, $error, $index)) {
586
+ $this->handle_form_data($file, $index);
587
+ $upload_dir = $this->get_upload_path();
588
+ if (!is_dir($upload_dir)) {
589
+ mkdir($upload_dir, $this->options['mkdir_mode'], true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
590
  }
591
+ $file_path = $this->get_upload_path($file->name);
592
+ $append_file = $content_range && is_file($file_path) &&
593
+ $file->size > $this->get_file_size($file_path);
594
+ if ($uploaded_file && is_uploaded_file($uploaded_file)) {
595
+ // multipart/formdata uploads (POST method uploads)
596
+ if ($append_file) {
597
+ file_put_contents(
598
+ $file_path,
599
+ fopen($uploaded_file, 'r'),
600
+ FILE_APPEND
601
+ );
602
+ } else {
603
+ move_uploaded_file($uploaded_file, $file_path);
604
+ }
605
+ }
606
+ else {
607
+ // Non-multipart uploads (PUT method support)
608
+ file_put_contents(
609
+ $file_path,
610
+ fopen('php://input', 'r'),
611
+ $append_file ? FILE_APPEND : 0
612
+ );
613
+ }
614
+ $file_size = $this->get_file_size($file_path, $append_file);
615
+ if ($file_size === $file->size) {
616
+ $file->url = $this->get_download_url($file->name);
617
+ list($img_width, $img_height) = @getimagesize($file_path);
618
+ if (is_int($img_width)) {
619
+ $this->handle_image_file($file_path, $file);
620
+ }
621
+ }
622
+ else {
623
+ $file->size = $file_size;
624
+ if (!$content_range && $this->options['discard_aborted_uploads']) {
625
+ unlink($file_path);
626
+ $file->error = 'abort';
627
+ }
628
+ }
629
+ $this->set_file_delete_properties($file);
630
+ }
631
+ return $file;
632
  }
633
 
634
  protected function readfile($file_path) {
635
+ return readfile($file_path);
636
  }
637
 
638
  protected function body($str) {
639
+ echo $str;
640
  }
641
 
642
  protected function header($str) {
643
+ header($str);
644
  }
645
 
646
  protected function generate_response($content, $print_response = true) {
647
+ if ($print_response) {
648
+ $json = json_encode($content);
649
+ $redirect = isset($_REQUEST['redirect']) ? stripslashes($_REQUEST['redirect']) : null;
650
+ if ($redirect) {
651
+ $this->header('Location: '.sprintf($redirect, rawurlencode($json)));
652
+ return;
653
+ }
654
+ $this->head();
655
+ if (isset($_SERVER['HTTP_CONTENT_RANGE'])) {
656
+ $files = isset($content[$this->options['param_name']]) ? $content[$this->options['param_name']] : null;
657
+ if ($files && is_array($files) && is_object($files[0]) && $files[0]->size) {
658
+ $this->header('Range: 0-'.($this->fix_integer_overflow(intval($files[0]->size)) - 1));
659
+ }
 
 
 
 
660
  }
661
+ $this->body($json);
662
+ }
663
+ return $content;
664
  }
665
 
666
  protected function get_version_param() {
667
+ return isset($_GET['version']) ? basename(stripslashes($_GET['version'])) : null;
668
  }
669
 
670
  protected function get_file_name_param() {
671
+ return isset($_GET['file']) ? basename(stripslashes($_GET['file'])) : null;
672
  }
673
 
674
  protected function get_file_type($file_path) {
675
+ switch (strtolower(pathinfo($file_path, PATHINFO_EXTENSION))) {
676
+ case 'jpeg':
677
+ case 'jpg':
678
+ return 'image/jpeg';
679
+ case 'png':
680
+ return 'image/png';
681
+ case 'gif':
682
+ return 'image/gif';
683
+ default:
684
+ return '';
685
+ }
686
  }
687
 
688
  protected function download() {
689
+ if (!$this->options['download_via_php']) {
690
+ $this->header('HTTP/1.1 403 Forbidden');
691
+ return;
692
+ }
693
+ $file_name = $this->get_file_name_param();
694
+ if ($this->is_valid_file_object($file_name)) {
695
+ $file_path = $this->get_upload_path($file_name, $this->get_version_param());
696
+ if (is_file($file_path)) {
697
+ if (!preg_match($this->options['inline_file_types'], $file_name)) {
698
+ $this->header('Content-Description: File Transfer');
699
+ $this->header('Content-Type: application/octet-stream');
700
+ $this->header('Content-Disposition: attachment; filename="'.$file_name.'"');
701
+ $this->header('Content-Transfer-Encoding: binary');
702
+ }
703
+ else {
704
+ // Prevent Internet Explorer from MIME-sniffing the content-type:
705
+ $this->header('X-Content-Type-Options: nosniff');
706
+ $this->header('Content-Type: '.$this->get_file_type($file_path));
707
+ $this->header('Content-Disposition: inline; filename="'.$file_name.'"');
708
+ }
709
+ $this->header('Content-Length: '.$this->get_file_size($file_path));
710
+ $this->header('Last-Modified: '.gmdate('D, d M Y H:i:s T', filemtime($file_path)));
711
+ $this->readfile($file_path);
712
+ }
713
+ }
714
  }
715
 
716
  protected function send_content_type_header() {
717
+ $this->header('Vary: Accept');
718
+ if (isset($_SERVER['HTTP_ACCEPT']) &&
719
+ (strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false)) {
720
+ $this->header('Content-type: application/json');
721
+ }
722
+ else {
723
+ $this->header('Content-type: text/plain');
724
+ }
725
  }
726
 
727
  protected function send_access_control_headers() {
728
+ $this->header('Access-Control-Allow-Origin: '.$this->options['access_control_allow_origin']);
729
+ $this->header('Access-Control-Allow-Credentials: '
730
+ .($this->options['access_control_allow_credentials'] ? 'true' : 'false'));
731
+ $this->header('Access-Control-Allow-Methods: '
732
+ .implode(', ', $this->options['access_control_allow_methods']));
733
+ $this->header('Access-Control-Allow-Headers: '
734
+ .implode(', ', $this->options['access_control_allow_headers']));
735
  }
736
 
737
  public function head() {
738
+ $this->header('Pragma: no-cache');
739
+ $this->header('Cache-Control: no-store, no-cache, must-revalidate');
740
+ $this->header('Content-Disposition: inline; filename="files.json"');
741
+ // Prevent Internet Explorer from MIME-sniffing the content-type:
742
+ $this->header('X-Content-Type-Options: nosniff');
743
+ if ($this->options['access_control_allow_origin']) {
744
+ $this->send_access_control_headers();
745
+ }
746
+ $this->send_content_type_header();
747
  }
748
 
749
  public function get($print_response = true) {
750
+ if ($print_response && isset($_GET['download'])) {
751
+ return $this->download();
752
+ }
753
+ $file_name = $this->get_file_name_param();
754
+ if ($file_name) {
755
+ $response = array(
756
+ substr($this->options['param_name'], 0, -1) => $this->get_file_object($file_name)
757
+ );
758
+ }
759
+ else {
760
+ $response = array(
761
+ $this->options['param_name'] => $this->get_file_objects()
762
+ );
763
+ }
764
+ return $this->generate_response($response, $print_response);
765
  }
766
 
767
  public function post($print_response = true) {
768
+ if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
769
+ return $this->delete($print_response);
770
+ }
771
+ $upload = isset($_FILES[$this->options['param_name']]) ? $_FILES[$this->options['param_name']] : null;
772
+ // Parse the Content-Disposition header, if available:
773
+ $file_name = isset($_SERVER['HTTP_CONTENT_DISPOSITION']) ? rawurldecode(preg_replace(
774
+ '/(^[^"]+")|("$)/',
775
+ '',
776
+ $_SERVER['HTTP_CONTENT_DISPOSITION']
777
+ )) : null;
778
+ // Parse the Content-Range header, which has the following form:
779
+ // Content-Range: bytes 0-524287/2000000
780
+ $content_range = isset($_SERVER['HTTP_CONTENT_RANGE']) ? preg_split('/[^0-9]+/', $_SERVER['HTTP_CONTENT_RANGE']) : null;
781
+ $size = $content_range ? $content_range[3] : null;
782
+ $files = array();
783
+ if ($upload && is_array($upload['tmp_name'])) {
784
+ // param_name is an array identifier like "files[]",
785
+ // $_FILES is a multi-dimensional array:
786
+ foreach ($upload['tmp_name'] as $index => $value) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
787
  $files[] = $this->handle_file_upload(
788
+ $upload['tmp_name'][$index],
789
+ $file_name ? $file_name : $upload['name'][$index],
790
+ $size ? $size : $upload['size'][$index],
791
+ $upload['type'][$index],
792
+ $upload['error'][$index],
793
+ $index,
 
 
 
794
  $content_range
795
  );
796
  }
797
+ }
798
+ else {
799
+ // param_name is a single object identifier like "file",
800
+ // $_FILES is a one-dimensional array:
801
+ $files[] = $this->handle_file_upload(
802
+ isset($upload['tmp_name']) ? $upload['tmp_name'] : null,
803
+ $file_name ? $file_name : (isset($upload['name']) ?
804
+ $upload['name'] : null),
805
+ $size ? $size : (isset($upload['size']) ?
806
+ $upload['size'] : $_SERVER['CONTENT_LENGTH']),
807
+ isset($upload['type']) ?
808
+ $upload['type'] : $_SERVER['CONTENT_TYPE'],
809
+ isset($upload['error']) ? $upload['error'] : null,
810
+ null,
811
+ $content_range
812
  );
813
+ }
814
+ return $this->generate_response(
815
+ array($this->options['param_name'] => $files),
816
+ $print_response
817
+ );
818
  }
819
 
820
  public function delete($print_response = true) {
821
+ $file_name = $this->get_file_name_param();
822
+ $file_path = $this->get_upload_path($file_name);
823
+ $success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path);
824
+ if ($success) {
825
+ foreach($this->options['image_versions'] as $version => $options) {
826
+ if (!empty($version)) {
827
+ $file = $this->get_upload_path($file_name, $version);
828
+ if (is_file($file)) {
829
+ unlink($file);
 
 
830
  }
831
+ }
832
  }
833
+ }
834
+ return $this->generate_response(array('success' => $success), $print_response);
835
  }
836
 
837
  }
filemanager/controller.php CHANGED
@@ -43,195 +43,201 @@ class FilemanagerController {
43
  }
44
 
45
  public function execute() {
46
- $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : 'display';
47
- if (method_exists($this, $task)) {
48
- $this->$task();
49
- } else {
50
- $this->display();
51
- }
 
52
  }
53
 
54
  public function get_uploads_dir() {
55
- return $this->uploads_dir;
56
  }
57
 
58
  public function get_uploads_url() {
59
- return $this->uploads_url;
60
  }
61
 
62
  public function display() {
63
- require_once WD_BWG_DIR . '/filemanager/model.php';
64
- $model = new FilemanagerModel($this);
65
 
66
- require_once WD_BWG_DIR . '/filemanager/view.php';
67
- $view = new FilemanagerView($this, $model);
68
- $view->display();
69
  }
70
 
71
  public function make_dir() {
72
- $input_dir = (isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '');
73
- $cur_dir_path = $input_dir == '' ? $this->uploads_dir : $this->uploads_dir . '/' . $input_dir;
74
 
75
- $new_dir_path = $cur_dir_path . '/' . (isset($_REQUEST['new_dir_name']) ? $_REQUEST['new_dir_name'] : '');
76
 
77
- $msg = '';
78
- if (file_exists($new_dir_path) == true) {
79
- $msg = 'Directory already exists';
80
- } else {
81
- mkdir($new_dir_path);
82
- }
83
- // $_SESSION['filemanager_msg'] = $msg;
84
- header('Location: ' . add_query_arg(array('action' => 'addImages', 'filemanager_msg' => $msg, 'width' => '650', 'height' => '500', 'task' => 'display', 'extensions' => $_REQUEST['extensions'], 'callback' => $_REQUEST['callback'], 'dir' => $_REQUEST['dir'], 'TB_iframe' => '1'), admin_url('admin-ajax.php')));
85
- exit;
 
86
  }
87
 
88
  public function rename_item() {
89
- $input_dir = (isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '');
90
- $cur_dir_path = $input_dir == '' ? $this->uploads_dir : $this->uploads_dir . '/' . $input_dir;
91
 
92
- $file_names = explode(',', (isset($_REQUEST['file_names']) ? $_REQUEST['file_names'] : ''));
93
- $file_name = $file_names[0];
94
 
95
- $file_new_name = (isset($_REQUEST['file_new_name']) ? $_REQUEST['file_new_name'] : '');
96
 
97
- $file_path = $cur_dir_path . '/' . $file_name;
98
- $thumb_file_path = $cur_dir_path . '/thumb/' . $file_name;
99
- $original_file_path = $cur_dir_path . '/.original/' . $file_name;
100
 
101
- $msg = '';
102
- if (file_exists($file_path) == false) {
103
- $msg = 'File doesn\'t exists';
104
- } else if (is_dir($file_path) == true) {
105
- if (rename($file_path, $cur_dir_path . '/' . $file_new_name) == false) {
106
- $msg = 'Can\'t rename the file';
107
- }
108
- } else if ((strrpos($file_name, '.') !== false)) {
109
- $file_extension = substr($file_name, strrpos($file_name, '.') + 1);
110
- if (rename($file_path, $cur_dir_path . '/' . $file_new_name . '.' . $file_extension) == false) {
111
- $msg = 'Can\'t rename the file';
112
- }
113
- rename($thumb_file_path, $cur_dir_path . '/thumb/' . $file_new_name . '.' . $file_extension);
114
- rename($original_file_path, $cur_dir_path . '/.original/' . $file_new_name . '.' . $file_extension);
115
- } else {
116
  $msg = 'Can\'t rename the file';
117
  }
118
- $_REQUEST['file_names'] = '';
119
- // $_SESSION['filemanager_msg'] = $msg;
120
- header('Location: ' . add_query_arg(array('action' => 'addImages', 'filemanager_msg' => $msg, 'width' => '650', 'height' => '500', 'task' => 'display', 'extensions' => $_REQUEST['extensions'], 'callback' => $_REQUEST['callback'], 'dir' => $_REQUEST['dir'], 'TB_iframe' => '1'), admin_url('admin-ajax.php')));
121
- exit;
 
 
 
 
 
 
122
  }
123
 
124
  public function remove_items() {
125
- $input_dir = (isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '');
126
- $cur_dir_path = $input_dir == '' ? $this->uploads_dir : $this->uploads_dir . '/' . $input_dir;
127
 
128
- $file_names = explode(',', (isset($_REQUEST['file_names']) ? $_REQUEST['file_names'] : ''));
129
 
130
- $msg = '';
131
- foreach ($file_names as $file_name) {
132
- $file_path = $cur_dir_path . '/' . $file_name;
133
- $thumb_file_path = $cur_dir_path . '/thumb/' . $file_name;
134
- $original_file_path = $cur_dir_path . '/.original/' . $file_name;
135
- if (file_exists($file_path) == false) {
136
- $msg = 'Some of the file can\'t be removed';
137
- } else {
138
- if (!is_dir(file_path)) {
139
- $this->remove_file_dir($file_path);
140
- $this->remove_file_dir($thumb_file_path);
141
- $this->remove_file_dir($original_file_path);
142
- }
143
- }
144
  }
145
- $_REQUEST['file_names'] = '';
146
- // $_SESSION['filemanager_msg'] = $msg;
147
- header('Location: ' . add_query_arg(array('action' => 'addImages', 'filemanager_msg' => $msg, 'width' => '650', 'height' => '500', 'task' => 'show_file_manager', 'extensions' => $_REQUEST['extensions'], 'callback' => $_REQUEST['callback'], 'dir' => $_REQUEST['dir'], 'TB_iframe' => '1'), admin_url('admin-ajax.php')));
148
- exit;
 
 
 
 
 
 
 
 
149
  }
150
 
151
  public function paste_items() {
152
- $msg = '';
153
 
154
- $file_names = explode(',', (isset($_REQUEST['clipboard_files']) ? $_REQUEST['clipboard_files'] : ''));
155
- // $src_dir = $_SESSION['clipboard_src'];
156
- $src_dir = (isset($_REQUEST['clipboard_src']) ? $_REQUEST['clipboard_src'] : '');
157
- $src_dir = $src_dir == '' ? $this->uploads_dir : $this->uploads_dir . '/' . $src_dir;
158
- // $dest_dir = $_SESSION['clipboard_dest'];
159
- $dest_dir = (isset($_REQUEST['clipboard_dest']) ? $_REQUEST['clipboard_dest'] : '');
160
- $dest_dir = $dest_dir == '' ? $this->uploads_dir : $this->uploads_dir . '/' . $dest_dir;
161
 
162
- switch ((isset($_REQUEST['clipboard_task']) ? $_REQUEST['clipboard_task'] : '')) {
163
- case 'copy':
164
- foreach ($file_names as $file_name) {
165
- $src = $src_dir . '/' . $file_name;
166
- if (file_exists($src) == false) {
167
- $msg = 'Failed to copy some of the files';
168
- continue;
169
- }
170
- $dest = $dest_dir . '/' . $file_name;
171
- if (!is_dir($src_dir . '/' . $file_name)) {
172
- if (!is_dir($dest_dir . '/thumb')) {
173
- mkdir($dest_dir . '/thumb', 0777);
174
- }
175
- $thumb_src = $src_dir . '/thumb/' . $file_name;
176
- $thumb_dest = $dest_dir . '/thumb/' . $file_name;
177
- if (!is_dir($dest_dir . '/.original')) {
178
- mkdir($dest_dir . '/.original', 0777);
179
- }
180
- $original_src = $src_dir . '/.original/' . $file_name;
181
- $original_dest = $dest_dir . '/.original/' . $file_name;
182
- }
183
- $i = 0;
184
- if (file_exists($dest) == true) {
185
- $path_parts = pathinfo($dest);
186
- while (file_exists($path_parts['dirname'] . '/' . $path_parts['filename'] . '(' . ++$i . ')' . '.' . $path_parts['extension'])) {
187
- }
188
- $dest = $path_parts['dirname'] . '/' . $path_parts['filename'] . '(' . $i . ')' . '.' . $path_parts['extension'];
189
- if (!is_dir($src_dir . '/' . $file_name)) {
190
- $thumb_dest = $path_parts['dirname'] . '/thumb/' . $path_parts['filename'] . '(' . $i . ')' . '.' . $path_parts['extension'];
191
- $original_dest = $path_parts['dirname'] . '/.original/' . $path_parts['filename'] . '(' . $i . ')' . '.' . $path_parts['extension'];
192
- }
193
- }
194
 
195
- if (!$this->copy_file_dir($src, $dest)) {
196
- $msg = 'Failed to copy some of the files';
197
- }
198
- if (!is_dir($src_dir . '/' . $file_name)) {
199
- $this->copy_file_dir($thumb_src, $thumb_dest);
200
- $this->copy_file_dir($original_src, $original_dest);
201
- }
 
 
 
 
 
 
 
 
 
 
 
 
202
  }
203
- break;
204
- case 'cut':
205
- if ($src_dir != $dest_dir) {
206
- foreach ($file_names as $file_name) {
207
- $src = $src_dir . '/' . $file_name;
208
- $dest = $dest_dir . '/' . $file_name;
209
- if (!is_dir($src_dir . '/' . $file_name)) {
210
- $thumb_src = $src_dir . '/thumb/' . $file_name;
211
- $thumb_dest = $dest_dir . '/thumb/' . $file_name;
212
- if (!is_dir($dest_dir . '/thumb')) {
213
- mkdir($dest_dir . '/thumb', 0777);
214
- }
215
- $original_src = $src_dir . '/.original/' . $file_name;
216
- $original_dest = $dest_dir . '/.original/' . $file_name;
217
- if (!is_dir($dest_dir . '/.original')) {
218
- mkdir($dest_dir . '/.original', 0777);
219
- }
220
- }
221
- if ((file_exists($src) == false) || (file_exists($dest) == true) || (!rename($src, $dest))) {
222
- $msg = 'Failed to move some of the files';
223
- }
224
- if (!is_dir($src_dir . '/' . $file_name)) {
225
- rename($thumb_src, $thumb_dest);
226
- rename($original_src, $original_dest);
227
- }
228
- }
229
  }
230
- break;
231
- }
232
- // $_SESSION['filemanager_msg'] = $msg;
233
- header('Location: ' . add_query_arg(array('action' => 'addImages', 'filemanager_msg' => $msg, 'width' => '650', 'height' => '500', 'task' => 'show_file_manager', 'extensions' => $_REQUEST['extensions'], 'callback' => $_REQUEST['callback'], 'dir' => $_REQUEST['dir'], 'TB_iframe' => '1'), admin_url('admin-ajax.php')));
234
- exit;
 
 
 
 
 
 
 
 
 
 
235
  }
236
 
237
 
@@ -242,37 +248,40 @@ class FilemanagerController {
242
  // Private Methods //
243
  ////////////////////////////////////////////////////////////////////////////////////////
244
  private function remove_file_dir($del_file_dir) {
245
- if (is_dir($del_file_dir) == true) {
246
- $files_to_remove = scandir($del_file_dir);
247
- foreach ($files_to_remove as $file) {
248
- if ($file != '.' and $file != '..') {
249
- $this->remove_file_dir($del_file_dir . '/' . $file);
250
- }
251
- }
252
- rmdir($del_file_dir);
253
- } else {
254
- unlink($del_file_dir);
255
  }
 
 
 
 
 
256
  }
257
 
258
  private function copy_file_dir($src, $dest) {
259
- if (is_dir($src) == true) {
260
- $dir = opendir($src);
261
- @mkdir($dest);
262
- while (false !== ($file = readdir($dir))) {
263
- if (($file != '.') && ($file != '..')) {
264
- if (is_dir($src . '/' . $file)) {
265
- $this->copy_file_dir($src . '/' . $file, $dest . '/' . $file);
266
- } else {
267
- copy($src . '/' . $file, $dest . '/' . $file);
268
- }
269
- }
270
  }
271
- closedir($dir);
272
- return true;
273
- } else {
274
- return copy($src, $dest);
275
  }
 
 
 
 
 
 
276
  }
277
 
278
 
43
  }
44
 
45
  public function execute() {
46
+ $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : 'display';
47
+ if (method_exists($this, $task)) {
48
+ $this->$task();
49
+ }
50
+ else {
51
+ $this->display();
52
+ }
53
  }
54
 
55
  public function get_uploads_dir() {
56
+ return $this->uploads_dir;
57
  }
58
 
59
  public function get_uploads_url() {
60
+ return $this->uploads_url;
61
  }
62
 
63
  public function display() {
64
+ require_once WD_BWG_DIR . '/filemanager/model.php';
65
+ $model = new FilemanagerModel($this);
66
 
67
+ require_once WD_BWG_DIR . '/filemanager/view.php';
68
+ $view = new FilemanagerView($this, $model);
69
+ $view->display();
70
  }
71
 
72
  public function make_dir() {
73
+ $input_dir = (isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '');
74
+ $cur_dir_path = $input_dir == '' ? $this->uploads_dir : $this->uploads_dir . '/' . $input_dir;
75
 
76
+ $new_dir_path = $cur_dir_path . '/' . (isset($_REQUEST['new_dir_name']) ? $_REQUEST['new_dir_name'] : '');
77
 
78
+ $msg = '';
79
+ if (file_exists($new_dir_path) == true) {
80
+ $msg = 'Directory already exists';
81
+ }
82
+ else {
83
+ mkdir($new_dir_path);
84
+ }
85
+ // $_SESSION['filemanager_msg'] = $msg;
86
+ header('Location: ' . add_query_arg(array('action' => 'addImages', 'filemanager_msg' => $msg, 'width' => '650', 'height' => '500', 'task' => 'display', 'extensions' => $_REQUEST['extensions'], 'callback' => $_REQUEST['callback'], 'dir' => $_REQUEST['dir'], 'TB_iframe' => '1'), admin_url('admin-ajax.php')));
87
+ exit;
88
  }
89
 
90
  public function rename_item() {
91
+ $input_dir = (isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '');
92
+ $cur_dir_path = $input_dir == '' ? $this->uploads_dir : $this->uploads_dir . '/' . $input_dir;
93
 
94
+ $file_names = explode(',', (isset($_REQUEST['file_names']) ? $_REQUEST['file_names'] : ''));
95
+ $file_name = $file_names[0];
96
 
97
+ $file_new_name = (isset($_REQUEST['file_new_name']) ? $_REQUEST['file_new_name'] : '');
98
 
99
+ $file_path = $cur_dir_path . '/' . $file_name;
100
+ $thumb_file_path = $cur_dir_path . '/thumb/' . $file_name;
101
+ $original_file_path = $cur_dir_path . '/.original/' . $file_name;
102
 
103
+ $msg = '';
104
+ if (file_exists($file_path) == false) {
105
+ $msg = 'File doesn\'t exists';
106
+ }
107
+ elseif (is_dir($file_path) == true) {
108
+ if (rename($file_path, $cur_dir_path . '/' . $file_new_name) == false) {
109
+ $msg = 'Can\'t rename the file';
110
+ }
111
+ }
112
+ elseif ((strrpos($file_name, '.') !== false)) {
113
+ $file_extension = substr($file_name, strrpos($file_name, '.') + 1);
114
+ if (rename($file_path, $cur_dir_path . '/' . $file_new_name . '.' . $file_extension) == false) {
 
 
 
115
  $msg = 'Can\'t rename the file';
116
  }
117
+ rename($thumb_file_path, $cur_dir_path . '/thumb/' . $file_new_name . '.' . $file_extension);
118
+ rename($original_file_path, $cur_dir_path . '/.original/' . $file_new_name . '.' . $file_extension);
119
+ }
120
+ else {
121
+ $msg = 'Can\'t rename the file';
122
+ }
123
+ $_REQUEST['file_names'] = '';
124
+ // $_SESSION['filemanager_msg'] = $msg;
125
+ header('Location: ' . add_query_arg(array('action' => 'addImages', 'filemanager_msg' => $msg, 'width' => '650', 'height' => '500', 'task' => 'display', 'extensions' => $_REQUEST['extensions'], 'callback' => $_REQUEST['callback'], 'dir' => $_REQUEST['dir'], 'TB_iframe' => '1'), admin_url('admin-ajax.php')));
126
+ exit;
127
  }
128
 
129
  public function remove_items() {
130
+ $input_dir = (isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '');
131
+ $cur_dir_path = $input_dir == '' ? $this->uploads_dir : $this->uploads_dir . '/' . $input_dir;
132
 
133
+ $file_names = explode(',', (isset($_REQUEST['file_names']) ? $_REQUEST['file_names'] : ''));
134
 
135
+ $msg = '';
136
+ foreach ($file_names as $file_name) {
137
+ $file_path = $cur_dir_path . '/' . $file_name;
138
+ $thumb_file_path = $cur_dir_path . '/thumb/' . $file_name;
139
+ $original_file_path = $cur_dir_path . '/.original/' . $file_name;
140
+ if (file_exists($file_path) == false) {
141
+ $msg = 'Some of the file can\'t be removed';
 
 
 
 
 
 
 
142
  }
143
+ else {
144
+ if (!is_dir(file_path)) {
145
+ $this->remove_file_dir($file_path);
146
+ $this->remove_file_dir($thumb_file_path);
147
+ $this->remove_file_dir($original_file_path);
148
+ }
149
+ }
150
+ }
151
+ $_REQUEST['file_names'] = '';
152
+ // $_SESSION['filemanager_msg'] = $msg;
153
+ header('Location: ' . add_query_arg(array('action' => 'addImages', 'filemanager_msg' => $msg, 'width' => '650', 'height' => '500', 'task' => 'show_file_manager', 'extensions' => $_REQUEST['extensions'], 'callback' => $_REQUEST['callback'], 'dir' => $_REQUEST['dir'], 'TB_iframe' => '1'), admin_url('admin-ajax.php')));
154
+ exit;
155
  }
156
 
157
  public function paste_items() {
158
+ $msg = '';
159
 
160
+ $file_names = explode(',', (isset($_REQUEST['clipboard_files']) ? $_REQUEST['clipboard_files'] : ''));
161
+ // $src_dir = $_SESSION['clipboard_src'];
162
+ $src_dir = (isset($_REQUEST['clipboard_src']) ? $_REQUEST['clipboard_src'] : '');
163
+ $src_dir = $src_dir == '' ? $this->uploads_dir : $this->uploads_dir . '/' . $src_dir;
164
+ // $dest_dir = $_SESSION['clipboard_dest'];
165
+ $dest_dir = (isset($_REQUEST['clipboard_dest']) ? $_REQUEST['clipboard_dest'] : '');
166
+ $dest_dir = $dest_dir == '' ? $this->uploads_dir : $this->uploads_dir . '/' . $dest_dir;
167
 
168
+ switch ((isset($_REQUEST['clipboard_task']) ? $_REQUEST['clipboard_task'] : '')) {
169
+ case 'copy':
170
+ foreach ($file_names as $file_name) {
171
+ $src = $src_dir . '/' . $file_name;
172
+ if (file_exists($src) == false) {
173
+ $msg = 'Failed to copy some of the files';
174
+ continue;
175
+ }
176
+ $dest = $dest_dir . '/' . $file_name;
177
+ if (!is_dir($src_dir . '/' . $file_name)) {
178
+ if (!is_dir($dest_dir . '/thumb')) {
179
+ mkdir($dest_dir . '/thumb', 0777);
180
+ }
181
+ $thumb_src = $src_dir . '/thumb/' . $file_name;
182
+ $thumb_dest = $dest_dir . '/thumb/' . $file_name;
183
+ if (!is_dir($dest_dir . '/.original')) {
184
+ mkdir($dest_dir . '/.original', 0777);
185
+ }
186
+ $original_src = $src_dir . '/.original/' . $file_name;
187
+ $original_dest = $dest_dir . '/.original/' . $file_name;
188
+ }
189
+ $i = 0;
190
+ if (file_exists($dest) == true) {
191
+ $path_parts = pathinfo($dest);
192
+ while (file_exists($path_parts['dirname'] . '/' . $path_parts['filename'] . '(' . ++$i . ')' . '.' . $path_parts['extension'])) {
193
+ }
194
+ $dest = $path_parts['dirname'] . '/' . $path_parts['filename'] . '(' . $i . ')' . '.' . $path_parts['extension'];
195
+ if (!is_dir($src_dir . '/' . $file_name)) {
196
+ $thumb_dest = $path_parts['dirname'] . '/thumb/' . $path_parts['filename'] . '(' . $i . ')' . '.' . $path_parts['extension'];
197
+ $original_dest = $path_parts['dirname'] . '/.original/' . $path_parts['filename'] . '(' . $i . ')' . '.' . $path_parts['extension'];
198
+ }
199
+ }
200
 
201
+ if (!$this->copy_file_dir($src, $dest)) {
202
+ $msg = 'Failed to copy some of the files';
203
+ }
204
+ if (!is_dir($src_dir . '/' . $file_name)) {
205
+ $this->copy_file_dir($thumb_src, $thumb_dest);
206
+ $this->copy_file_dir($original_src, $original_dest);
207
+ }
208
+ }
209
+ break;
210
+ case 'cut':
211
+ if ($src_dir != $dest_dir) {
212
+ foreach ($file_names as $file_name) {
213
+ $src = $src_dir . '/' . $file_name;
214
+ $dest = $dest_dir . '/' . $file_name;
215
+ if (!is_dir($src_dir . '/' . $file_name)) {
216
+ $thumb_src = $src_dir . '/thumb/' . $file_name;
217
+ $thumb_dest = $dest_dir . '/thumb/' . $file_name;
218
+ if (!is_dir($dest_dir . '/thumb')) {
219
+ mkdir($dest_dir . '/thumb', 0777);
220
  }
221
+ $original_src = $src_dir . '/.original/' . $file_name;
222
+ $original_dest = $dest_dir . '/.original/' . $file_name;
223
+ if (!is_dir($dest_dir . '/.original')) {
224
+ mkdir($dest_dir . '/.original', 0777);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  }
226
+ }
227
+ if ((file_exists($src) == false) || (file_exists($dest) == true) || (!rename($src, $dest))) {
228
+ $msg = 'Failed to move some of the files';
229
+ }
230
+ if (!is_dir($src_dir . '/' . $file_name)) {
231
+ rename($thumb_src, $thumb_dest);
232
+ rename($original_src, $original_dest);
233
+ }
234
+ }
235
+ }
236
+ break;
237
+ }
238
+ // $_SESSION['filemanager_msg'] = $msg;
239
+ header('Location: ' . add_query_arg(array('action' => 'addImages', 'filemanager_msg' => $msg, 'width' => '650', 'height' => '500', 'task' => 'show_file_manager', 'extensions' => $_REQUEST['extensions'], 'callback' => $_REQUEST['callback'], 'dir' => $_REQUEST['dir'], 'TB_iframe' => '1'), admin_url('admin-ajax.php')));
240
+ exit;
241
  }
242
 
243
 
248
  // Private Methods //
249
  ////////////////////////////////////////////////////////////////////////////////////////
250
  private function remove_file_dir($del_file_dir) {
251
+ if (is_dir($del_file_dir) == true) {
252
+ $files_to_remove = scandir($del_file_dir);
253
+ foreach ($files_to_remove as $file) {
254
+ if ($file != '.' and $file != '..') {
255
+ $this->remove_file_dir($del_file_dir . '/' . $file);
256
+ }
 
 
 
 
257
  }
258
+ rmdir($del_file_dir);
259
+ }
260
+ else {
261
+ unlink($del_file_dir);
262
+ }
263
  }
264
 
265
  private function copy_file_dir($src, $dest) {
266
+ if (is_dir($src) == true) {
267
+ $dir = opendir($src);
268
+ @mkdir($dest);
269
+ while (false !== ($file = readdir($dir))) {
270
+ if (($file != '.') && ($file != '..')) {
271
+ if (is_dir($src . '/' . $file)) {
272
+ $this->copy_file_dir($src . '/' . $file, $dest . '/' . $file);
273
+ }
274
+ else {
275
+ copy($src . '/' . $file, $dest . '/' . $file);
 
276
  }
277
+ }
 
 
 
278
  }
279
+ closedir($dir);
280
+ return true;
281
+ }
282
+ else {
283
+ return copy($src, $dest);
284
+ }
285
  }
286
 
287
 
filemanager/css/default.css CHANGED
@@ -100,6 +100,15 @@ html, body, div, span, th, td, a {
100
  cursor: default;
101
  }
102
 
 
 
 
 
 
 
 
 
 
103
  .ctrl_bar_btn {
104
  display: table-cell;
105
  margin: 0;
100
  cursor: default;
101
  }
102
 
103
+ .upload_thumb_dim {
104
+ width: 50px;
105
+ }
106
+
107
+ .upload_thumb {
108
+ color: #808080;
109
+ font-size: 16px !important;
110
+ }
111
+
112
  .ctrl_bar_btn {
113
  display: table-cell;
114
  margin: 0;
filemanager/model.php CHANGED
@@ -25,7 +25,7 @@ class FilemanagerModel {
25
  // Constructor & Destructor //
26
  ////////////////////////////////////////////////////////////////////////////////////////
27
  public function __construct($controller) {
28
- $this->controller = $controller;
29
  }
30
 
31
 
@@ -33,24 +33,24 @@ class FilemanagerModel {
33
  // Public Methods //
34
  ////////////////////////////////////////////////////////////////////////////////////////
35
  public function get_file_manager_data() {
36
- $session_data = array();
37
- $session_data['sort_by'] = $this->get_from_session('sort_by', 'name');
38
- $session_data['sort_order'] = $this->get_from_session('sort_order', 'asc');
39
- $session_data['items_view'] = $this->get_from_session('items_view', 'list');
40
- $session_data['clipboard_task'] = $this->get_from_session('clipboard_task', '');
41
- $session_data['clipboard_files'] = $this->get_from_session('clipboard_files', '');
42
- $session_data['clipboard_src'] = $this->get_from_session('clipboard_src', '');
43
- $session_data['clipboard_dest'] = $this->get_from_session('clipboard_dest', '');
44
-
45
- $data = array();
46
- $data['session_data'] = $session_data;
47
- $data['path_components'] = $this->get_path_components();
48
- $data['dir'] = (isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '');
49
- $data['files'] = $this->get_files($session_data['sort_by'], $session_data['sort_order']);
50
- $data['extensions'] = (isset($_REQUEST['extensions']) ? $_REQUEST['extensions'] : '');
51
- $data['callback'] = (isset($_REQUEST['callback']) ? $_REQUEST['callback'] : '');
52
-
53
- return $data;
54
  }
55
 
56
 
@@ -61,100 +61,102 @@ class FilemanagerModel {
61
  // Private Methods //
62
  ////////////////////////////////////////////////////////////////////////////////////////
63
  private function get_from_session($key, $default) {
64
- // if (isset($_SESSION[$key])) {
65
- // if (isset($_REQUEST[$key])) {
66
- if (isset($_REQUEST[$key])) {
67
- // $_SESSION[$key] = $_REQUEST[$key];
68
- $_REQUEST[$key] = $_REQUEST[$key];
69
- } else {
70
- // $_SESSION[$key] = $default;
71
- $_REQUEST[$key] = $default;
72
- }
73
- // return $_SESSION[$key];
74
- return $_REQUEST[$key];
75
- // }
76
- // return '';
 
77
  }
78
 
79
  public function get_path_components() {
80
- $dir_names = explode('/', (isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''));
81
- $path = '';
82
-
83
- $components = array();
 
 
 
 
 
 
 
 
 
 
84
  $component = array();
85
- $component['name'] = 'root';
86
  $component['path'] = $path;
87
  $components[] = $component;
88
- for ($i = 0; $i < count($dir_names); $i++) {
89
- $dir_name = $dir_names[$i];
90
- if ($dir_name == '') {
91
- continue;
92
- }
93
- $path .= (($path == '') ? $dir_name : '/' . $dir_name);
94
- $component = array();
95
- $component['name'] = $dir_name;
96
- $component['path'] = $path;
97
- $components[] = $component;
98
- }
99
- return $components;
100
  }
101
 
102
  function get_files($sort_by, $sort_order) {
103
- $icons_dir_path = WD_BWG_DIR . '/filemanager/images/file_icons';
104
- $icons_dir_url = WD_BWG_URL . '/filemanager/images/file_icons';
105
- $valid_types = explode(',', isset($_REQUEST['extensions']) ? strtolower($_REQUEST['extensions']) : '*');
106
- $parent_dir = $this->controller->get_uploads_dir() . (isset($_REQUEST['dir']) ? '/' . $_REQUEST['dir'] : '');
107
- $parent_dir_url = $this->controller->get_uploads_url() . (isset($_REQUEST['dir']) ? '/' . $_REQUEST['dir'] : '');
108
-
109
-
110
- $file_names = $this->get_sorted_file_names($parent_dir, $sort_by, $sort_order);
111
-
112
- $dirs = array();
113
- $files = array();
114
- foreach ($file_names as $file_name) {
115
- if (($file_name == '.') || ($file_name == '..') || ($file_name == 'thumb') || ($file_name == '.original')) {
116
- continue;
117
- }
118
- if (is_dir($parent_dir . '/' . $file_name) == TRUE) {
119
- $file = array();
120
- $file['is_dir'] = TRUE;
121
- $file['name'] = $file_name;
122
- $file['filename'] = $file_name;
123
- $file['type'] = '';
124
- $file['thumb'] = $icons_dir_url . '/dir.png';
125
- $file['icon'] = $icons_dir_url . '/dir.png';
126
- $file['size'] = '';
127
- $file['date_modified'] = '';
128
- $file['resolution'] = '';
129
- $dirs[] = $file;
130
- } else {
131
- $file = array();
132
- $file['is_dir'] = FALSE;
133
- $file['name'] = $file_name;
134
- $file['filename'] = substr($file_name, 0, strrpos($file_name, '.'));
135
- $file['type'] = end(explode('.', $file_name));
136
- $icon = $icons_dir_url . '/' . $file['type'] . '.png';
137
- if (file_exists($icons_dir_path . '/' . $file['type'] . '.png') == FALSE) {
138
- $icon = $icons_dir_url . '/' . '_blank.png';
139
- }
140
- $file['thumb'] = $this->is_img($file['type']) ? $parent_dir_url . '/thumb/' . $file_name : $icon;
141
- $file['icon'] = $icon;
142
- if (($valid_types[0] != '*') && (in_array($file['type'], $valid_types) == FALSE)) {
143
- continue;
144
- }
145
- $file_size_kb = (int)(filesize($parent_dir . '/' . $file_name) / 1024);
146
- // $file_size_mb = (int)($file_size_kb / 1024);
147
- // $file['size'] = $file_size_kb < 1024 ? (string)$file_size_kb . 'KB' : (string)$file_size_mb . 'MB';
148
- $file['size'] = $file_size_kb . ' KB';
149
- $file['date_modified'] = date('d F Y, H:i', filemtime($parent_dir . '/' . $file_name));
150
- $image_info = getimagesize($parent_dir . '/' . $file_name);
151
- $file['resolution'] = $this->is_img($file['type']) ? $image_info[0] . ' x ' . $image_info[1] . ' px' : '';
152
- $files[] = $file;
153
- }
154
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
 
156
- $result = $sort_order == 'asc' ? array_merge($dirs, $files) : array_merge($files, $dirs);
157
- return $result;
158
  }
159
 
160
  private function get_sorted_file_names($parent_dir, $sort_by, $sort_order) {
@@ -184,36 +186,34 @@ class FilemanagerModel {
184
  return $s_order == 'asc' ? $m_time_a > $m_time_b : $m_time_a < $m_time_b;
185
  }
186
 
187
- switch ($sort_by) {
188
- case 'name':
189
- natcasesort($file_names);
190
- if ($sort_order == 'desc') {
191
- $file_names = array_reverse($file_names);
192
- }
193
- break;
194
- case 'size':
195
- usort($file_names, 'sort_by_size');
196
- break;
197
- case 'date_modified':
198
- usort($file_names, 'sort_by_date');
199
- break;
200
- }
201
-
202
- return $file_names;
203
  }
204
 
205
  private function is_img($file_type) {
206
- switch ($file_type) {
207
- case 'jpg':
208
- case 'jpeg':
209
- case 'png':
210
- case 'bmp':
211
- case 'gif':
212
- return true;
213
- break;
214
- }
215
-
216
- return false;
217
  }
218
 
219
 
25
  // Constructor & Destructor //
26
  ////////////////////////////////////////////////////////////////////////////////////////
27
  public function __construct($controller) {
28
+ $this->controller = $controller;
29
  }
30
 
31
 
33
  // Public Methods //
34
  ////////////////////////////////////////////////////////////////////////////////////////
35
  public function get_file_manager_data() {
36
+ $session_data = array();
37
+ $session_data['sort_by'] = $this->get_from_session('sort_by', 'name');
38
+ $session_data['sort_order'] = $this->get_from_session('sort_order', 'asc');
39
+ $session_data['items_view'] = $this->get_from_session('items_view', 'list');
40
+ $session_data['clipboard_task'] = $this->get_from_session('clipboard_task', '');
41
+ $session_data['clipboard_files'] = $this->get_from_session('clipboard_files', '');
42
+ $session_data['clipboard_src'] = $this->get_from_session('clipboard_src', '');
43
+ $session_data['clipboard_dest'] = $this->get_from_session('clipboard_dest', '');
44
+
45
+ $data = array();
46
+ $data['session_data'] = $session_data;
47
+ $data['path_components'] = $this->get_path_components();
48
+ $data['dir'] = (isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '');
49
+ $data['files'] = $this->get_files($session_data['sort_by'], $session_data['sort_order']);
50
+ $data['extensions'] = (isset($_REQUEST['extensions']) ? $_REQUEST['extensions'] : '');
51
+ $data['callback'] = (isset($_REQUEST['callback']) ? $_REQUEST['callback'] : '');
52
+
53
+ return $data;
54
  }
55
 
56
 
61
  // Private Methods //
62
  ////////////////////////////////////////////////////////////////////////////////////////
63
  private function get_from_session($key, $default) {
64
+ // if (isset($_SESSION[$key])) {
65
+ // if (isset($_REQUEST[$key])) {
66
+ if (isset($_REQUEST[$key])) {
67
+ // $_SESSION[$key] = $_REQUEST[$key];
68
+ $_REQUEST[$key] = $_REQUEST[$key];
69
+ }
70
+ else {
71
+ // $_SESSION[$key] = $default;
72
+ $_REQUEST[$key] = $default;
73
+ }
74
+ // return $_SESSION[$key];
75
+ return $_REQUEST[$key];
76
+ // }
77
+ // return '';
78
  }
79
 
80
  public function get_path_components() {
81
+ $dir_names = explode('/', (isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''));
82
+ $path = '';
83
+
84
+ $components = array();
85
+ $component = array();
86
+ $component['name'] = 'root';
87
+ $component['path'] = $path;
88
+ $components[] = $component;
89
+ for ($i = 0; $i < count($dir_names); $i++) {
90
+ $dir_name = $dir_names[$i];
91
+ if ($dir_name == '') {
92
+ continue;
93
+ }
94
+ $path .= (($path == '') ? $dir_name : '/' . $dir_name);
95
  $component = array();
96
+ $component['name'] = $dir_name;
97
  $component['path'] = $path;
98
  $components[] = $component;
99
+ }
100
+ return $components;
 
 
 
 
 
 
 
 
 
 
101
  }
102
 
103
  function get_files($sort_by, $sort_order) {
104
+ $icons_dir_path = WD_BWG_DIR . '/filemanager/images/file_icons';
105
+ $icons_dir_url = WD_BWG_URL . '/filemanager/images/file_icons';
106
+ $valid_types = explode(',', isset($_REQUEST['extensions']) ? strtolower($_REQUEST['extensions']) : '*');
107
+ $parent_dir = $this->controller->get_uploads_dir() . (isset($_REQUEST['dir']) ? '/' . $_REQUEST['dir'] : '');
108
+ $parent_dir_url = $this->controller->get_uploads_url() . (isset($_REQUEST['dir']) ? '/' . $_REQUEST['dir'] : '');
109
+
110
+
111
+ $file_names = $this->get_sorted_file_names($parent_dir, $sort_by, $sort_order);
112
+
113
+ $dirs = array();
114
+ $files = array();
115
+ foreach ($file_names as $file_name) {
116
+ if (($file_name == '.') || ($file_name == '..') || ($file_name == 'thumb') || ($file_name == '.original')) {
117
+ continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  }
119
+ if (is_dir($parent_dir . '/' . $file_name) == TRUE) {
120
+ $file = array();
121
+ $file['is_dir'] = TRUE;
122
+ $file['name'] = $file_name;
123
+ $file['filename'] = $file_name;
124
+ $file['type'] = '';
125
+ $file['thumb'] = $icons_dir_url . '/dir.png';
126
+ $file['icon'] = $icons_dir_url . '/dir.png';
127
+ $file['size'] = '';
128
+ $file['date_modified'] = '';
129
+ $file['resolution'] = '';
130
+ $dirs[] = $file;
131
+ }
132
+ else {
133
+ $file = array();
134
+ $file['is_dir'] = FALSE;
135
+ $file['name'] = $file_name;
136
+ $file['filename'] = substr($file_name, 0, strrpos($file_name, '.'));
137
+ $file['type'] = end(explode('.', $file_name));
138
+ $icon = $icons_dir_url . '/' . $file['type'] . '.png';
139
+ if (file_exists($icons_dir_path . '/' . $file['type'] . '.png') == FALSE) {
140
+ $icon = $icons_dir_url . '/' . '_blank.png';
141
+ }
142
+ $file['thumb'] = $this->is_img($file['type']) ? $parent_dir_url . '/thumb/' . $file_name : $icon;
143
+ $file['icon'] = $icon;
144
+ if (($valid_types[0] != '*') && (in_array($file['type'], $valid_types) == FALSE)) {
145
+ continue;
146
+ }
147
+ $file_size_kb = (int)(filesize($parent_dir . '/' . $file_name) / 1024);
148
+ // $file_size_mb = (int)($file_size_kb / 1024);
149
+ // $file['size'] = $file_size_kb < 1024 ? (string)$file_size_kb . 'KB' : (string)$file_size_mb . 'MB';
150
+ $file['size'] = $file_size_kb . ' KB';
151
+ $file['date_modified'] = date('d F Y, H:i', filemtime($parent_dir . '/' . $file_name));
152
+ $image_info = getimagesize($parent_dir . '/' . $file_name);
153
+ $file['resolution'] = $this->is_img($file['type']) ? $image_info[0] . ' x ' . $image_info[1] . ' px' : '';
154
+ $files[] = $file;
155
+ }
156
+ }
157
 
158
+ $result = $sort_order == 'asc' ? array_merge($dirs, $files) : array_merge($files, $dirs);
159
+ return $result;
160
  }
161
 
162
  private function get_sorted_file_names($parent_dir, $sort_by, $sort_order) {
186
  return $s_order == 'asc' ? $m_time_a > $m_time_b : $m_time_a < $m_time_b;
187
  }
188
 
189
+ switch ($sort_by) {
190
+ case 'name':
191
+ natcasesort($file_names);
192
+ if ($sort_order == 'desc') {
193
+ $file_names = array_reverse($file_names);
194
+ }
195
+ break;
196
+ case 'size':
197
+ usort($file_names, 'sort_by_size');
198
+ break;
199
+ case 'date_modified':
200
+ usort($file_names, 'sort_by_date');
201
+ break;
202
+ }
203
+ return $file_names;
 
204
  }
205
 
206
  private function is_img($file_type) {
207
+ switch ($file_type) {
208
+ case 'jpg':
209
+ case 'jpeg':
210
+ case 'png':
211
+ case 'bmp':
212
+ case 'gif':
213
+ return true;
214
+ break;
215
+ }
216
+ return false;
 
217
  }
218
 
219
 
filemanager/view.php CHANGED
@@ -22,19 +22,19 @@ class FilemanagerView {
22
  // Constructor & Destructor //
23
  ////////////////////////////////////////////////////////////////////////////////////////
24
  public function __construct($controller, $model) {
25
- $this->controller = $controller;
26
- $this->model = $model;
27
  }
28
 
29
  ////////////////////////////////////////////////////////////////////////////////////////
30
  // Public Methods //
31
  ////////////////////////////////////////////////////////////////////////////////////////
32
  public function display() {
33
- if (isset($_GET['filemanager_msg']) && $_GET['filemanager_msg'] != '') {
34
  ?>
35
  <div id="file_manager_message" style="height:40px;">
36
  <div style="background-color: #FFEBE8; border: 1px solid #CC0000; margin: 5px 15px 2px; padding: 5px 10px;">
37
- <strong style="font-size:14px"><?php echo $_GET['filemanager_msg']; ?></strong>
38
  </div>
39
  </div>
40
  <?php
@@ -42,307 +42,268 @@ class FilemanagerView {
42
  }
43
  $file_manager_data = $this->model->get_file_manager_data();
44
 
45
- $items_view = $file_manager_data['session_data']['items_view'];
46
- $sort_by = $file_manager_data['session_data']['sort_by'];
47
- $sort_order = $file_manager_data['session_data']['sort_order'];
48
- $clipboard_task = $file_manager_data['session_data']['clipboard_task'];
49
- $clipboard_files = $file_manager_data['session_data']['clipboard_files'];
50
- $clipboard_src = $file_manager_data['session_data']['clipboard_src'];
51
- $clipboard_dest = $file_manager_data['session_data']['clipboard_dest'];
52
- $icons_dir_url = WD_BWG_URL . '/filemanager/images/file_icons';
53
- $sort_icon = $icons_dir_url . '/' . $sort_order;
54
- ?>
55
-
56
-
57
- <script language="javascript" type="text/javascript" src="<?php echo get_option("siteurl"); ?>/wp-includes/js/jquery/jquery.js"></script>
58
- <script language="javascript" type="text/javascript" src="<?php echo get_option("siteurl"); ?>/wp-includes/js/jquery/ui/jquery.ui.widget.min.js"></script>
59
- <script src="<?php echo WD_BWG_URL; ?>/filemanager/js/jq_uploader/jquery.iframe-transport.js"></script>
60
- <script src="<?php echo WD_BWG_URL; ?>/filemanager/js/jq_uploader/jquery.fileupload.js"></script>
61
- <script>
62
- var DS = "<?php echo addslashes('/'); ?>";
63
 
64
- var errorLoadingFile = "<?php echo 'File loading failed'; ?>";
 
 
 
 
 
65
 
66
- var warningRemoveItems = "<?php echo 'Are you sure you want to permanently remove selected items?'; ?>";
67
- var warningCancelUploads = "<?php echo 'This will cancel uploads. Continue?'; ?>";
68
 
69
- var messageEnterDirName = "<?php echo 'Enter directory name'; ?>";
70
- var messageEnterNewName = "<?php echo 'Enter new name'; ?>";
71
- var messageFilesUploadComplete = "<?php echo 'Files upload complete'; ?>";
72
 
73
- var root = "<?php echo addslashes($this->controller->get_uploads_dir()); ?>";
74
- var dir = "<?php echo (isset($_REQUEST['dir']) ? addslashes($_REQUEST['dir']) : ''); ?>";
75
- var dirUrl = "<?php echo $this->controller->get_uploads_url() . (isset($_REQUEST['dir']) ? $_REQUEST['dir'] . '/' : ''); ?>";
76
- var callback = "<?php echo (isset($_REQUEST['callback']) ? $_REQUEST['callback'] : ''); ?>";
77
- var sortBy = "<?php echo $sort_by; ?>";
78
- var sortOrder = "<?php echo $sort_order; ?>";
79
- </script>
80
- <script src="<?php echo WD_BWG_URL; ?>/filemanager/js/default.js"></script>
81
- <link href="<?php echo WD_BWG_URL; ?>/filemanager/css/default.css" type="text/css" rel="stylesheet">
82
- <?php
83
- switch ($items_view) {
84
- case 'list':
85
- ?>
86
- <link href="<?php echo WD_BWG_URL; ?>/filemanager/css/default_view_list.css" type="text/css" rel="stylesheet">
87
- <?php
88
- break;
89
- case 'thumbs':
90
- ?>
91
- <link href="<?php echo WD_BWG_URL; ?>/filemanager/css/default_view_thumbs.css" type="text/css" rel="stylesheet">
92
- <?php
93
- break;
94
- }
95
- ?>
96
 
97
- <form id="adminForm" name="adminForm" action="" method="post">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  <div id="wrapper">
99
- <div id="file_manager">
100
  <div class="ctrls_bar ctrls_bar_header">
101
- <div class="ctrls_left">
102
- <a class="ctrl_bar_btn btn_up" onclick="onBtnUpClick(event, this);"
103
- title="<?php echo 'Up'; ?>">
104
- </a>
105
- <a class="ctrl_bar_btn btn_make_dir" onclick="onBtnMakeDirClick(event, this);"
106
- title="<?php echo 'Make a directory'; ?>">
107
- </a>
108
- <a class="ctrl_bar_btn btn_rename_item" onclick="onBtnRenameItemClick(event, this);"
109
- title="<?php echo 'Rename item'; ?>">
110
- </a>
111
- <span class="ctrl_bar_divider">
112
- </span>
113
- <a class="ctrl_bar_btn btn_copy" onclick="onBtnCopyClick(event, this);"
114
- title="<?php echo 'Copy'; ?>">
115
- </a>
116
- <a class="ctrl_bar_btn btn_cut" onclick="onBtnCutClick(event, this);"
117
- title="<?php echo 'Cut'; ?>">
118
- </a>
119
- <a class="ctrl_bar_btn btn_paste" onclick="onBtnPasteClick(event, this);"
120
- title="<?php echo 'Paste'; ?>">
121
- </a>
122
- <a class="ctrl_bar_btn btn_remove_items" onclick="onBtnRemoveItemsClick(event, this);"
123
- title="<?php echo 'Remove items'; ?>">
124
- </a>
125
- <span class="ctrl_bar_divider">
126
- </span>
127
- <a class="ctrl_bar_btn btn_upload_files"
128
- onclick="onBtnShowUploaderClick(event, this);"><?php echo 'Upload files'; ?>
129
- </a>
130
- </div>
131
- <div class="ctrls_right">
132
- <a class="ctrl_bar_btn btn_view_thumbs" onclick="onBtnViewThumbsClick(event, this);"
133
- title="<?php echo 'View thumbs'; ?>"></a>
134
- <a class="ctrl_bar_btn btn_view_list" onclick="onBtnViewListClick(event, this);"
135
- title="<?php echo 'View list'; ?>"></a>
136
- </div>
137
  </div>
138
-
139
  <div id="path">
140
- <?php
141
- foreach ($file_manager_data['path_components'] as $path_component) {
142
- ?>
143
- <a class="path_component path_dir"
144
- onclick="onPathComponentClick(event, this, '<?php echo addslashes($path_component['path']); ?>');">
145
- <?php echo $path_component['name']; ?></a>
146
- <a class="path_component path_separator"><?php echo '/'; ?></a>
147
- <?php
148
- }
149
  ?>
 
 
 
 
 
 
 
150
  </div>
151
-
152
  <div id="explorer">
153
- <div id="explorer_header_wrapper">
154
- <div id="explorer_header_container">
155
- <div id="explorer_header">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  <span class="item_icon">
 
157
  </span>
158
  <span class="item_name">
159
- <span class="clickable" onclick="onNameHeaderClick(event, this);">
160
- <?php
161
- echo 'Name';
162
- if ($sort_by == 'name') {
163
- ?>
164
- <span class="sort_order_<?php echo $sort_order; ?>"></span>
165
- <?php
166
- }
167
- ?>
168
- </span>
169
  </span>
170
  <span class="item_size">
171
- <span class="clickable" onclick="onSizeHeaderClick(event, this);">
172
- <?php
173
- echo 'Size';
174
- if ($sort_by == 'size') {
175
- ?>
176
- <span class="sort_order_<?php echo $sort_order; ?>"></span>
177
- <?php
178
- }
179
- ?>
180
- </span>
181
  </span>
182
  <span class="item_date_modified">
183
- <span class="clickable" onclick="onDateModifiedHeaderClick(event, this);">
184
- <?php
185
- echo 'Date modified';
186
- if ($sort_by == 'date_modified') {
187
- ?>
188
- <span class="sort_order_<?php echo $sort_order; ?>"></span>
189
- <?php
190
- }
191
- ?>
192
- </span>
193
- </span>
194
- <span class="scrollbar_filler">
195
  </span>
196
- </div>
197
- </div>
198
- </div>
199
-
200
- <div id="explorer_body_wrapper">
201
- <div id="explorer_body_container">
202
- <div id="explorer_body">
203
- <?php
204
- foreach ($file_manager_data['files'] as $file) {
205
- ?>
206
- <div class="explorer_item" draggable="true"
207
- name="<?php echo $file['name']; ?>"
208
- filename="<?php echo $file['filename']; ?>"
209
- filethumb="<?php echo $file['thumb']; ?>"
210
- filesize="<?php echo $file['size']; ?>"
211
- filetype="<?php echo strtoupper($file['type']); ?>"
212
- date_modified="<?php echo $file['date_modified']; ?>"
213
- fileresolution="<?php echo $file['resolution']; ?>"
214
- onmouseover="onFileMOver(event, this);"
215
- onmouseout="onFileMOut(event, this);"
216
- onclick="onFileClick(event, this);"
217
- ondblclick="onFileDblClick(event, this);"
218
- ondragstart="onFileDragStart(event, this);"
219
- <?php
220
- if ($file['is_dir'] == true) {
221
- ?>
222
- ondragover="onFileDragOver(event, this);"
223
- ondrop="onFileDrop(event, this);"
224
- <?php
225
- }
226
- ?>
227
- isDir="<?php echo $file['is_dir'] == true ? 'true' : 'false'; ?>">
228
- <span class="item_thumb">
229
- <img src="<?php echo $file['thumb']; ?>"/>
230
- </span>
231
- <span class="item_icon">
232
- <img src="<?php echo $file['icon']; ?>"/>
233
- </span>
234
- <span class="item_name">
235
- <?php echo $file['name']; ?>
236
- </span>
237
- <span class="item_size">
238
- <?php echo $file['size']; ?>
239
- </span>
240
- <span class="item_date_modified">
241
- <?php echo $file['date_modified']; ?></span>
242
- </span>
243
- </div>
244
- <?php
245
- }
246
- ?>
247
- </div>
248
- </div>
249
  </div>
 
250
  </div>
251
-
252
  <div class="ctrls_bar ctrls_bar_footer">
253
- <div class="ctrls_right">
254
- <span id="file_names_span">
255
- <span>
 
256
  </span>
257
- </span>
258
- <a class="ctrl_bar_btn btn_open"
259
- onclick="onBtnOpenClick(event, this);">
260
- <?php echo 'Add'; ?>
261
- </a>
262
- <a class="ctrl_bar_btn btn_cancel"
263
- onclick="onBtnCancelClick(event, this);">
264
- <?php echo 'Cancel'; ?>
265
- </a>
266
- </div>
267
- </div>
268
- </div>
269
-
270
- <div id="uploader">
271
- <div id="uploader_bg">
272
  </div>
273
-
 
 
274
  <div class="ctrls_bar ctrls_bar_header">
275
- <div class="ctrls_right">
276
- <a class="ctrl_bar_btn btn_back" onclick="onBtnBackClick(event, this);"
277
- title="<?php echo 'Back'; ?>"></a>
278
- </div>
 
 
 
 
279
  </div>
280
-
281
  <label for="jQueryUploader">
282
- <div id="uploader_hitter">
283
- <div id="drag_message">
284
- <span><?php echo 'Drag files here or click the button below' . '<br />' . 'to upload files' ?></span>
285
- </div>
286
- <div id="btnBrowseContainer">
287
- <input id="jQueryUploader" type="file" name="files[]"
288
- data-url="<?php echo add_query_arg(array('action' => 'bwg_UploadHandler', 'thumb_width' => $this->controller->get_options_data()->thumb_width, 'thumb_height' => $this->controller->get_options_data()->thumb_height, 'dir' => $this->controller->get_uploads_dir() . '/' . (isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '')), admin_url('admin-ajax.php')); ?>"
289
- multiple>
290
- </div>
291
- <script>
292
- jQuery("#jQueryUploader").fileupload({
293
- dataType: "json",
294
- dropZone: jQuery("#uploader_hitter"),
295
- submit: function (e, data) {
296
- isUploading = true;
297
- jQuery("#uploader_progress_bar").fadeIn();
298
- },
299
- progressall: function (e, data) {
300
- var progress = parseInt(data.loaded / data.total * 100, 10);
301
- jQuery("#uploader_progress_text").text("Progress " + progress + "%");
302
- jQuery("#uploader_progress div div").css({width: progress + "%"});
303
- if (data.loaded == data.total) {
304
- isUploading = false;
305
- jQuery("#uploader_progress_bar").fadeOut(function () {
306
- jQuery("#uploader_progress_text").text(messageFilesUploadComplete);
307
- });
308
- }
309
- },
310
- done: function (e, data) {
311
- jQuery.each(data.result.files, function (index, file) {
312
- console.log(file.name, index);
313
- if (file.error) {
314
- alert(errorLoadingFile + ' :: ' + file.error);
315
- }
316
- if (file.error) {
317
- jQuery("#uploaded_files ul").append(jQuery("<li class=uploaded_item_failed>" + "<?php echo 'Upload failed' ?> :: " + file.error + "</li>"));
318
- } else {
319
- jQuery("#uploaded_files ul").append(jQuery("<li class=uploaded_item>" + file.name + " (<?php echo 'Uploaded' ?>)" + "</li>"));
320
- }
321
- });
322
- }
323
- });
324
- </script>
325
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  </label>
327
-
328
  <div id="uploaded_files">
329
- <ul>
330
- </ul>
331
  </div>
332
-
333
  <div id="uploader_progress">
334
- <div id="uploader_progress_bar">
335
- <div></div>
336
- </div>
337
- <span id="uploader_progress_text">
338
- <?php echo 'No files to upload'; ?>
339
- </span>
340
  </div>
341
- </div>
342
  </div>
343
 
344
- <?php
345
- ?>
346
  <input type="hidden" name="task" value="">
347
  <input type="hidden" name="extensions" value="<?php echo (isset($_REQUEST['extensions']) ? $_REQUEST['extensions'] : '*'); ?>">
348
  <input type="hidden" name="callback" value="<?php echo (isset($_REQUEST['callback']) ? $_REQUEST['callback'] : ''); ?>">
@@ -357,7 +318,7 @@ class FilemanagerView {
357
  <input type="hidden" name="clipboard_files" value="<?php echo $clipboard_files; ?>"/>
358
  <input type="hidden" name="clipboard_src" value="<?php echo $clipboard_src; ?>"/>
359
  <input type="hidden" name="clipboard_dest" value="<?php echo $clipboard_dest; ?>"/>
360
- </form>
361
  <?php
362
  die();
363
  }
22
  // Constructor & Destructor //
23
  ////////////////////////////////////////////////////////////////////////////////////////
24
  public function __construct($controller, $model) {
25
+ $this->controller = $controller;
26
+ $this->model = $model;
27
  }
28
 
29
  ////////////////////////////////////////////////////////////////////////////////////////
30
  // Public Methods //
31
  ////////////////////////////////////////////////////////////////////////////////////////
32
  public function display() {
33
+ if (isset($_GET['filemanager_msg']) && esc_html($_GET['filemanager_msg']) != '') {
34
  ?>
35
  <div id="file_manager_message" style="height:40px;">
36
  <div style="background-color: #FFEBE8; border: 1px solid #CC0000; margin: 5px 15px 2px; padding: 5px 10px;">
37
+ <strong style="font-size:14px"><?php echo esc_html($_GET['filemanager_msg']); ?></strong>
38
  </div>
39
  </div>
40
  <?php
42
  }
43
  $file_manager_data = $this->model->get_file_manager_data();
44
 
45
+ $items_view = $file_manager_data['session_data']['items_view'];
46
+ $sort_by = $file_manager_data['session_data']['sort_by'];
47
+ $sort_order = $file_manager_data['session_data']['sort_order'];
48
+ $clipboard_task = $file_manager_data['session_data']['clipboard_task'];
49
+ $clipboard_files = $file_manager_data['session_data']['clipboard_files'];
50
+ $clipboard_src = $file_manager_data['session_data']['clipboard_src'];
51
+ $clipboard_dest = $file_manager_data['session_data']['clipboard_dest'];
52
+ $icons_dir_url = WD_BWG_URL . '/filemanager/images/file_icons';
53
+ $sort_icon = $icons_dir_url . '/' . $sort_order;
54
+ ?>
 
 
 
 
 
 
 
 
55
 
56
+ <script language="javascript" type="text/javascript" src="<?php echo get_option("siteurl"); ?>/wp-includes/js/jquery/jquery.js"></script>
57
+ <script language="javascript" type="text/javascript" src="<?php echo get_option("siteurl"); ?>/wp-includes/js/jquery/ui/jquery.ui.widget.min.js"></script>
58
+ <script src="<?php echo WD_BWG_URL; ?>/filemanager/js/jq_uploader/jquery.iframe-transport.js"></script>
59
+ <script src="<?php echo WD_BWG_URL; ?>/filemanager/js/jq_uploader/jquery.fileupload.js"></script>
60
+ <script>
61
+ var DS = "<?php echo addslashes('/'); ?>";
62
 
63
+ var errorLoadingFile = "<?php echo 'File loading failed'; ?>";
 
64
 
65
+ var warningRemoveItems = "<?php echo 'Are you sure you want to permanently remove selected items?'; ?>";
66
+ var warningCancelUploads = "<?php echo 'This will cancel uploads. Continue?'; ?>";
 
67
 
68
+ var messageEnterDirName = "<?php echo 'Enter directory name'; ?>";
69
+ var messageEnterNewName = "<?php echo 'Enter new name'; ?>";
70
+ var messageFilesUploadComplete = "<?php echo 'Files upload complete'; ?>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
+ var root = "<?php echo addslashes($this->controller->get_uploads_dir()); ?>";
73
+ var dir = "<?php echo (isset($_REQUEST['dir']) ? addslashes($_REQUEST['dir']) : ''); ?>";
74
+ var dirUrl = "<?php echo $this->controller->get_uploads_url() . (isset($_REQUEST['dir']) ? $_REQUEST['dir'] . '/' : ''); ?>";
75
+ var callback = "<?php echo (isset($_REQUEST['callback']) ? $_REQUEST['callback'] : ''); ?>";
76
+ var sortBy = "<?php echo $sort_by; ?>";
77
+ var sortOrder = "<?php echo $sort_order; ?>";
78
+ </script>
79
+ <script src="<?php echo WD_BWG_URL; ?>/filemanager/js/default.js"></script>
80
+ <link href="<?php echo WD_BWG_URL; ?>/filemanager/css/default.css" type="text/css" rel="stylesheet">
81
+ <?php
82
+ switch ($items_view) {
83
+ case 'list':
84
+ ?>
85
+ <link href="<?php echo WD_BWG_URL; ?>/filemanager/css/default_view_list.css" type="text/css" rel="stylesheet">
86
+ <?php
87
+ break;
88
+ case 'thumbs':
89
+ ?>
90
+ <link href="<?php echo WD_BWG_URL; ?>/filemanager/css/default_view_thumbs.css" type="text/css" rel="stylesheet">
91
+ <?php
92
+ break;
93
+ }
94
+ ?>
95
+
96
+ <form id="adminForm" name="adminForm" action="" method="post">
97
  <div id="wrapper">
98
+ <div id="file_manager">
99
  <div class="ctrls_bar ctrls_bar_header">
100
+ <div class="ctrls_left">
101
+ <a class="ctrl_bar_btn btn_up" onclick="onBtnUpClick(event, this);" title="<?php echo 'Up'; ?>"></a>
102
+ <a class="ctrl_bar_btn btn_make_dir" onclick="onBtnMakeDirClick(event, this);" title="<?php echo 'Make a directory'; ?>"></a>
103
+ <a class="ctrl_bar_btn btn_rename_item" onclick="onBtnRenameItemClick(event, this);" title="<?php echo 'Rename item'; ?>"></a>
104
+ <span class="ctrl_bar_divider"></span>
105
+ <a class="ctrl_bar_btn btn_copy" onclick="onBtnCopyClick(event, this);" title="<?php echo 'Copy'; ?>"></a>
106
+ <a class="ctrl_bar_btn btn_cut" onclick="onBtnCutClick(event, this);" title="<?php echo 'Cut'; ?>"></a>
107
+ <a class="ctrl_bar_btn btn_paste" onclick="onBtnPasteClick(event, this);" title="<?php echo 'Paste'; ?>"> </a>
108
+ <a class="ctrl_bar_btn btn_remove_items" onclick="onBtnRemoveItemsClick(event, this);" title="<?php echo 'Remove items'; ?>"></a>
109
+ <span class="ctrl_bar_divider"></span>
110
+ <a class="ctrl_bar_btn btn_upload_files" onclick="onBtnShowUploaderClick(event, this);"><?php echo 'Upload files'; ?></a>
111
+ </div>
112
+ <div class="ctrls_right">
113
+ <a class="ctrl_bar_btn btn_view_thumbs" onclick="onBtnViewThumbsClick(event, this);" title="<?php echo 'View thumbs'; ?>"></a>
114
+ <a class="ctrl_bar_btn btn_view_list" onclick="onBtnViewListClick(event, this);" title="<?php echo 'View list'; ?>"></a>
115
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  </div>
 
117
  <div id="path">
118
+ <?php
119
+ foreach ($file_manager_data['path_components'] as $path_component) {
 
 
 
 
 
 
 
120
  ?>
121
+ <a class="path_component path_dir"
122
+ onclick="onPathComponentClick(event, this, '<?php echo addslashes($path_component['path']); ?>');">
123
+ <?php echo $path_component['name']; ?></a>
124
+ <a class="path_component path_separator"><?php echo '/'; ?></a>
125
+ <?php
126
+ }
127
+ ?>
128
  </div>
 
129
  <div id="explorer">
130
+ <div id="explorer_header_wrapper">
131
+ <div id="explorer_header_container">
132
+ <div id="explorer_header">
133
+ <span class="item_icon"></span>
134
+ <span class="item_name">
135
+ <span class="clickable" onclick="onNameHeaderClick(event, this);">
136
+ <?php
137
+ echo 'Name';
138
+ if ($sort_by == 'name') {
139
+ ?>
140
+ <span class="sort_order_<?php echo $sort_order; ?>"></span>
141
+ <?php
142
+ }
143
+ ?>
144
+ </span>
145
+ </span>
146
+ <span class="item_size">
147
+ <span class="clickable" onclick="onSizeHeaderClick(event, this);">
148
+ <?php
149
+ echo 'Size';
150
+ if ($sort_by == 'size') {
151
+ ?>
152
+ <span class="sort_order_<?php echo $sort_order; ?>"></span>
153
+ <?php
154
+ }
155
+ ?>
156
+ </span>
157
+ </span>
158
+ <span class="item_date_modified">
159
+ <span class="clickable" onclick="onDateModifiedHeaderClick(event, this);">
160
+ <?php
161
+ echo 'Date modified';
162
+ if ($sort_by == 'date_modified') {
163
+ ?>
164
+ <span class="sort_order_<?php echo $sort_order; ?>"></span>
165
+ <?php
166
+ }
167
+ ?>
168
+ </span>
169
+ </span>
170
+ <span class="scrollbar_filler"></span>
171
+ </div>
172
+ </div>
173
+ </div>
174
+ <div id="explorer_body_wrapper">
175
+ <div id="explorer_body_container">
176
+ <div id="explorer_body">
177
+ <?php
178
+ foreach ($file_manager_data['files'] as $file) {
179
+ ?>
180
+ <div class="explorer_item" draggable="true"
181
+ name="<?php echo $file['name']; ?>"
182
+ filename="<?php echo $file['filename']; ?>"
183
+ filethumb="<?php echo $file['thumb']; ?>"
184
+ filesize="<?php echo $file['size']; ?>"
185
+ filetype="<?php echo strtoupper($file['type']); ?>"
186
+ date_modified="<?php echo $file['date_modified']; ?>"
187
+ fileresolution="<?php echo $file['resolution']; ?>"
188
+ onmouseover="onFileMOver(event, this);"
189
+ onmouseout="onFileMOut(event, this);"
190
+ onclick="onFileClick(event, this);"
191
+ ondblclick="onFileDblClick(event, this);"
192
+ ondragstart="onFileDragStart(event, this);"
193
+ <?php
194
+ if ($file['is_dir'] == true) {
195
+ ?>
196
+ ondragover="onFileDragOver(event, this);"
197
+ ondrop="onFileDrop(event, this);"
198
+ <?php
199
+ }
200
+ ?>
201
+ isDir="<?php echo $file['is_dir'] == true ? 'true' : 'false'; ?>">
202
+ <span class="item_thumb">
203
+ <img src="<?php echo $file['thumb']; ?>"/>
204
+ </span>
205
  <span class="item_icon">
206
+ <img src="<?php echo $file['icon']; ?>"/>
207
  </span>
208
  <span class="item_name">
209
+ <?php echo $file['name']; ?>
 
 
 
 
 
 
 
 
 
210
  </span>
211
  <span class="item_size">
212
+ <?php echo $file['size']; ?>
 
 
 
 
 
 
 
 
 
213
  </span>
214
  <span class="item_date_modified">
215
+ <?php echo $file['date_modified']; ?>
 
 
 
 
 
 
 
 
 
 
 
216
  </span>
217
+ </div>
218
+ <?php
219
+ }
220
+ ?>
221
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  </div>
223
+ </div>
224
  </div>
 
225
  <div class="ctrls_bar ctrls_bar_footer">
226
+ <div class="ctrls_right">
227
+ <span id="file_names_span">
228
+ <span>
229
+ </span>
230
  </span>
231
+ <a class="ctrl_bar_btn btn_open"onclick="onBtnOpenClick(event, this);"><?php echo 'Add'; ?></a>
232
+ <a class="ctrl_bar_btn btn_cancel" onclick="onBtnCancelClick(event, this);"><?php echo 'Cancel'; ?></a>
233
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
234
  </div>
235
+ </div>
236
+ <div id="uploader">
237
+ <div id="uploader_bg"></div>
238
  <div class="ctrls_bar ctrls_bar_header">
239
+ <div class="ctrls_left upload_thumb">
240
+ Generated Thumbnail Maximum Dimensions:
241
+ <input type="text" class="ctrl_bar_btn upload_thumb_dim" name="upload_thumb_width" id="upload_thumb_width" value="<?php echo $this->controller->get_options_data()->upload_thumb_width; ?>" /> x
242
+ <input type="text" class="ctrl_bar_btn upload_thumb_dim" name="upload_thumb_height" id="upload_thumb_height" value="<?php echo $this->controller->get_options_data()->upload_thumb_height; ?>" /> px
243
+ </div>
244
+ <div class="ctrls_right">
245
+ <a class="ctrl_bar_btn btn_back" onclick="onBtnBackClick(event, this);" title="<?php echo 'Back'; ?>"></a>
246
+ </div>
247
  </div>
 
248
  <label for="jQueryUploader">
249
+ <div id="uploader_hitter">
250
+ <div id="drag_message">
251
+ <span><?php echo 'Drag files here or click the button below' . '<br />' . 'to upload files' ?></span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  </div>
253
+ <div id="btnBrowseContainer">
254
+ <input id="jQueryUploader" type="file" name="files[]"
255
+ data-url="<?php echo add_query_arg(array('action' => 'bwg_UploadHandler', 'dir' => $this->controller->get_uploads_dir() . '/' . (isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '')), admin_url('admin-ajax.php')); ?>"
256
+ multiple>
257
+ </div>
258
+ <script>
259
+ jQuery("#jQueryUploader").fileupload({
260
+ dataType: "json",
261
+ dropZone: jQuery("#uploader_hitter"),
262
+ submit: function (e, data) {
263
+ isUploading = true;
264
+ jQuery("#uploader_progress_bar").fadeIn();
265
+ },
266
+ progressall: function (e, data) {
267
+ var progress = parseInt(data.loaded / data.total * 100, 10);
268
+ jQuery("#uploader_progress_text").text("Progress " + progress + "%");
269
+ jQuery("#uploader_progress div div").css({width: progress + "%"});
270
+ if (data.loaded == data.total) {
271
+ isUploading = false;
272
+ jQuery("#uploader_progress_bar").fadeOut(function () {
273
+ jQuery("#uploader_progress_text").text(messageFilesUploadComplete);
274
+ });
275
+ }
276
+ },
277
+ done: function (e, data) {
278
+ jQuery.each(data.result.files, function (index, file) {
279
+ if (file.error) {
280
+ alert(errorLoadingFile + ' :: ' + file.error);
281
+ }
282
+ if (file.error) {
283
+ jQuery("#uploaded_files ul").append(jQuery("<li class=uploaded_item_failed>" + "<?php echo 'Upload failed' ?> :: " + file.error + "</li>"));
284
+ } else {
285
+ jQuery("#uploaded_files ul").append(jQuery("<li class=uploaded_item>" + file.name + " (<?php echo 'Uploaded' ?>)" + "</li>"));
286
+ }
287
+ });
288
+ }
289
+ });
290
+ </script>
291
+ </div>
292
  </label>
 
293
  <div id="uploaded_files">
294
+ <ul></ul>
 
295
  </div>
 
296
  <div id="uploader_progress">
297
+ <div id="uploader_progress_bar">
298
+ <div></div>
299
+ </div>
300
+ <span id="uploader_progress_text">
301
+ <?php echo 'No files to upload'; ?>
302
+ </span>
303
  </div>
304
+ </div>
305
  </div>
306
 
 
 
307
  <input type="hidden" name="task" value="">
308
  <input type="hidden" name="extensions" value="<?php echo (isset($_REQUEST['extensions']) ? $_REQUEST['extensions'] : '*'); ?>">
309
  <input type="hidden" name="callback" value="<?php echo (isset($_REQUEST['callback']) ? $_REQUEST['callback'] : ''); ?>">
318
  <input type="hidden" name="clipboard_files" value="<?php echo $clipboard_files; ?>"/>
319
  <input type="hidden" name="clipboard_src" value="<?php echo $clipboard_src; ?>"/>
320
  <input type="hidden" name="clipboard_dest" value="<?php echo $clipboard_dest; ?>"/>
321
+ </form>
322
  <?php
323
  die();
324
  }
frontend/models/BWGModelAlbum_compact_preview.php CHANGED
@@ -122,7 +122,7 @@ class BWGModelAlbum_compact_preview {
122
  $bwg_post_id = get_page_by_title($title, OBJECT, $post_type);
123
  $options_row = $this->get_options_row_data();
124
  $theme_row = $this->get_theme_row_data(0);
125
- $shortecode_string = '[Best_Wordpress_Gallery type="' . $type . '" gallery_type="album_compact_preview" theme_id="' . $theme_row->id . '" album_id="' . $id . '" sort_by="order" compuct_album_column_number="' . $options_row->album_column_number . '" compuct_albums_per_page="' . $options_row->albums_per_page . '" compuct_album_title="' . $options_row->album_title_show_hover . '" compuct_album_thumb_width="' . $options_row->album_thumb_width . '" compuct_album_thumb_height="' . $options_row->album_thumb_height . '" compuct_album_image_column_number="' . $options_row->image_column_number . '" compuct_album_images_per_page="' . $options_row->images_per_page . '" compuct_album_image_thumb_width="' . $options_row->thumb_width . '" compuct_album_image_thumb_height="' . $options_row->thumb_height . '" compuct_album_enable_page="' . $options_row->album_enable_page . '" popup_width="' . $options_row->popup_width . '" popup_height="' . $options_row->popup_height . '" popup_effect="' . $options_row->popup_type . '" popup_interval="' . $options_row->popup_interval . '" popup_enable_filmstrip="' . $options_row->popup_enable_filmstrip . '" popup_filmstrip_height="' . $options_row->popup_filmstrip_height . '" popup_enable_ctrl_btn="' . $options_row->popup_enable_ctrl_btn . '" popup_enable_fullscreen="' . $options_row->popup_enable_fullscreen . '" popup_enable_comment="' . $options_row->popup_enable_comment . '" popup_enable_facebook="' . $options_row->popup_enable_facebook . '" popup_enable_twitter="' . $options_row->popup_enable_twitter . '" popup_enable_google="' . $options_row->popup_enable_google . '" watermark_type="' . $options_row->watermark_type . '" watermark_link="' . $options_row->watermark_link . '" watermark_text="' . $options_row->watermark_text . '" watermark_font_size="' . $options_row->watermark_font_size . '" watermark_font="' . $options_row->watermark_font . '" watermark_color="' . $options_row->watermark_color . '" watermark_opacity="' . $options_row->watermark_opacity . '" watermark_position="' . $options_row->watermark_position . '" watermark_url="' . $options_row->watermark_url . '" watermark_width="' . $options_row->watermark_width . '" watermark_height="' . $options_row->watermark_height . '"]';
126
  if (!$bwg_post_id) {
127
  $post = array(
128
  'post_content' => $shortecode_string,
122
  $bwg_post_id = get_page_by_title($title, OBJECT, $post_type);
123
  $options_row = $this->get_options_row_data();
124
  $theme_row = $this->get_theme_row_data(0);
125
+ $shortecode_string = '[Best_Wordpress_Gallery type="' . $type . '" gallery_type="album_compact_preview" theme_id="' . $theme_row->id . '" album_id="' . $id . '" sort_by="order" compuct_album_column_number="' . $options_row->album_column_number . '" compuct_albums_per_page="' . $options_row->albums_per_page . '" compuct_album_title="' . $options_row->album_title_show_hover . '" compuct_album_thumb_width="' . $options_row->album_thumb_width . '" compuct_album_thumb_height="' . $options_row->album_thumb_height . '" compuct_album_image_column_number="' . $options_row->image_column_number . '" compuct_album_images_per_page="' . $options_row->images_per_page . '" compuct_album_image_title="' . $options_row->image_title_show_hover . '" compuct_album_image_thumb_width="' . $options_row->thumb_width . '" compuct_album_image_thumb_height="' . $options_row->thumb_height . '" compuct_album_enable_page="' . $options_row->album_enable_page . '" popup_width="' . $options_row->popup_width . '" popup_height="' . $options_row->popup_height . '" popup_effect="' . $options_row->popup_type . '" popup_interval="' . $options_row->popup_interval . '" popup_enable_filmstrip="' . $options_row->popup_enable_filmstrip . '" popup_filmstrip_height="' . $options_row->popup_filmstrip_height . '" popup_enable_ctrl_btn="' . $options_row->popup_enable_ctrl_btn . '" popup_enable_fullscreen="' . $options_row->popup_enable_fullscreen . '" popup_enable_comment="' . $options_row->popup_enable_comment . '" popup_enable_facebook="' . $options_row->popup_enable_facebook . '" popup_enable_twitter="' . $options_row->popup_enable_twitter . '" popup_enable_google="' . $options_row->popup_enable_google . '" watermark_type="' . $options_row->watermark_type . '" watermark_link="' . $options_row->watermark_link . '" watermark_text="' . $options_row->watermark_text . '" watermark_font_size="' . $options_row->watermark_font_size . '" watermark_font="' . $options_row->watermark_font . '" watermark_color="' . $options_row->watermark_color . '" watermark_opacity="' . $options_row->watermark_opacity . '" watermark_position="' . $options_row->watermark_position . '" watermark_url="' . $options_row->watermark_url . '" watermark_width="' . $options_row->watermark_width . '" watermark_height="' . $options_row->watermark_height . '"]';
126
  if (!$bwg_post_id) {
127
  $post = array(
128
  'post_content' => $shortecode_string,
frontend/models/BWGModelWidget.php CHANGED
@@ -48,7 +48,7 @@ class BWGModelWidgetFrontEnd {
48
  $bwg_post_id = get_page_by_title($title, OBJECT, 'bwg_tag');
49
  $options_row = $this->get_options_row_data();
50
  $theme_row = $this->get_theme_row_data(0);
51
- $shortecode_string = '[Best_Wordpress_Gallery type="' . $type . '" gallery_type="thumbnails" theme_id="' . $theme_row->id . '" gallery_id="' . $id . '" sort_by="date" image_column_number="' . $options_row->image_column_number . '" images_per_page="' . $options_row->images_per_page . '" image_enable_page="' . $options_row->image_enable_page . '" thumb_width="' . $options_row->thumb_width . '" thumb_height="' . $options_row->thumb_height . '" popup_width="' . $options_row->popup_width . '" popup_height="' . $options_row->popup_height . '" popup_effect="' . $options_row->popup_type . '" popup_interval="' . $options_row->popup_interval . '" popup_enable_filmstrip="' . $options_row->popup_enable_filmstrip . '" popup_filmstrip_height="' . $options_row->popup_filmstrip_height . '" popup_enable_ctrl_btn="' . $options_row->popup_enable_ctrl_btn . '" popup_enable_fullscreen="' . $options_row->popup_enable_fullscreen . '" popup_enable_comment="' . $options_row->popup_enable_comment . '" popup_enable_facebook="' . $options_row->popup_enable_facebook . '" popup_enable_twitter="' . $options_row->popup_enable_twitter . '" popup_enable_google="' . $options_row->popup_enable_google . '" watermark_type="' . $options_row->watermark_type . '" watermark_link="' . $options_row->watermark_link . '" watermark_text="' . $options_row->watermark_text . '" watermark_font_size="' . $options_row->watermark_font_size . '" watermark_font="' . $options_row->watermark_font . '" watermark_color="' . $options_row->watermark_color . '" watermark_opacity="' . $options_row->watermark_opacity . '" watermark_position="' . $options_row->watermark_position . '" watermark_url="' . $options_row->watermark_url . '" watermark_width="' . $options_row->watermark_width . '" watermark_height="' . $options_row->watermark_height . '"]';
52
  if (!$bwg_post_id) {
53
  $post = array(
54
  'post_content' => $shortecode_string,
48
  $bwg_post_id = get_page_by_title($title, OBJECT, 'bwg_tag');
49
  $options_row = $this->get_options_row_data();
50
  $theme_row = $this->get_theme_row_data(0);
51
+ $shortecode_string = '[Best_Wordpress_Gallery type="' . $type . '" gallery_type="thumbnails" theme_id="' . $theme_row->id . '" gallery_id="' . $id . '" sort_by="date" image_column_number="' . $options_row->image_column_number . '" images_per_page="' . $options_row->images_per_page . '" image_title="' . $options_row->image_title_show_hover . '" image_enable_page="' . $options_row->image_enable_page . '" thumb_width="' . $options_row->thumb_width . '" thumb_height="' . $options_row->thumb_height . '" popup_width="' . $options_row->popup_width . '" popup_height="' . $options_row->popup_height . '" popup_effect="' . $options_row->popup_type . '" popup_interval="' . $options_row->popup_interval . '" popup_enable_filmstrip="' . $options_row->popup_enable_filmstrip . '" popup_filmstrip_height="' . $options_row->popup_filmstrip_height . '" popup_enable_ctrl_btn="' . $options_row->popup_enable_ctrl_btn . '" popup_enable_fullscreen="' . $options_row->popup_enable_fullscreen . '" popup_enable_comment="' . $options_row->popup_enable_comment . '" popup_enable_facebook="' . $options_row->popup_enable_facebook . '" popup_enable_twitter="' . $options_row->popup_enable_twitter . '" popup_enable_google="' . $options_row->popup_enable_google . '" watermark_type="' . $options_row->watermark_type . '" watermark_link="' . $options_row->watermark_link . '" watermark_text="' . $options_row->watermark_text . '" watermark_font_size="' . $options_row->watermark_font_size . '" watermark_font="' . $options_row->watermark_font . '" watermark_color="' . $options_row->watermark_color . '" watermark_opacity="' . $options_row->watermark_opacity . '" watermark_position="' . $options_row->watermark_position . '" watermark_url="' . $options_row->watermark_url . '" watermark_width="' . $options_row->watermark_width . '" watermark_height="' . $options_row->watermark_height . '"]';
52
  if (!$bwg_post_id) {
53
  $post = array(
54
  'post_content' => $shortecode_string,
frontend/views/BWGViewAlbum_compact_preview.php CHANGED
@@ -28,6 +28,9 @@ class BWGViewAlbum_compact_preview {
28
  global $WD_BWG_UPLOAD_DIR;
29
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
30
 
 
 
 
31
  $from = (isset($params['from']) ? esc_html($params['from']) : 0);
32
  $type = (isset($_POST['type_' . $bwg]) ? esc_html($_POST['type_' . $bwg]) : (isset($params['type']) ? $params['type'] : 'album'));
33
  if ($from === "widget") {
@@ -40,8 +43,8 @@ class BWGViewAlbum_compact_preview {
40
  $params['compuct_album_thumb_width'] = $params['width'];
41
  $params['compuct_album_title'] = $options_row->album_title_show_hover;
42
  $params['compuct_album_enable_page'] = 0;
 
43
  }
44
-
45
  $theme_row = $this->model->get_theme_row_data($params['theme_id']);
46
  if (!$theme_row) {
47
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'error');
@@ -81,6 +84,10 @@ class BWGViewAlbum_compact_preview {
81
  display: inline-block;
82
  text-align: center;
83
  }
 
 
 
 
84
  #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_album_thumb_span1_<?php echo $bwg; ?> {
85
  background-color: #<?php echo $theme_row->album_compact_thumb_bg_color; ?>;
86
  border-radius: <?php echo $theme_row->album_compact_thumb_border_radius; ?>;
@@ -143,7 +150,7 @@ class BWGViewAlbum_compact_preview {
143
  }
144
  <?php
145
  }
146
- else { // Show album/gallery title on hover.
147
  ?>
148
  #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_title_span1_<?php echo $bwg; ?> {
149
  display: table;
@@ -159,8 +166,8 @@ class BWGViewAlbum_compact_preview {
159
  }
160
  ?>
161
  #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_album_thumb_span1_<?php echo $bwg; ?>:hover .bwg_title_span1_<?php echo $bwg; ?> {
162
- left: <?php echo $theme_row->album_compact_thumb_padding + $theme_row->album_compact_thumb_border_width; ?>px;
163
- top: <?php echo $theme_row->album_compact_thumb_padding + $theme_row->album_compact_thumb_border_width; ?>px;
164
  opacity: 1;
165
  filter: Alpha(opacity=100);
166
  }
@@ -240,6 +247,58 @@ class BWGViewAlbum_compact_preview {
240
  cursor: pointer;
241
  text-decoration: none;
242
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
 
244
  /*Pagination styles.*/
245
  #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .tablenav-pages_<?php echo $bwg; ?> {
@@ -478,14 +537,38 @@ class BWGViewAlbum_compact_preview {
478
  $thumb_top = ($params['compuct_album_image_thumb_height'] - $image_thumb_height) / 2;
479
  ?>
480
  <a style="font-size: 0;" href="javascript:spider_createpopup('<?php echo addslashes(add_query_arg($params_array, admin_url('admin-ajax.php'))); ?>', '<?php echo $bwg; ?>', '<?php echo $params['popup_width']; ?>', '<?php echo $params['popup_height']; ?>', 1, 'testpopup', 5);">
481
- <span class="bwg_standart_thumb_span1_<?php echo $bwg; ?>">
482
- <span class="bwg_standart_thumb_span2_<?php echo $bwg; ?>">
483
- <img style="max-height:none; max-width:none; width:<?php echo $image_thumb_width; ?>px; height:<?php echo $image_thumb_height; ?>px; margin-left: <?php echo $thumb_left; ?>px; margin-top: <?php echo $thumb_top; ?>px;"
484
- id="<?php echo $image_row->id; ?>"
485
- src="<?php echo site_url() . '/' . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url; ?>"
486
- alt="<?php echo $image_row->alt; ?>"
487
- title="<?php echo $image_row->alt; ?>" />
 
 
 
 
 
 
 
 
 
 
 
 
 
488
  </span>
 
 
 
 
 
 
 
 
 
 
 
489
  </span>
490
  </a>
491
  <?php
28
  global $WD_BWG_UPLOAD_DIR;
29
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
30
 
31
+ if (!isset($params['compuct_album_image_title'])) {
32
+ $params['compuct_album_image_title'] = 'none';
33
+ }
34
  $from = (isset($params['from']) ? esc_html($params['from']) : 0);
35
  $type = (isset($_POST['type_' . $bwg]) ? esc_html($_POST['type_' . $bwg]) : (isset($params['type']) ? $params['type'] : 'album'));
36
  if ($from === "widget") {
43
  $params['compuct_album_thumb_width'] = $params['width'];
44
  $params['compuct_album_title'] = $options_row->album_title_show_hover;
45
  $params['compuct_album_enable_page'] = 0;
46
+ $params['compuct_album_image_title'] = $options_row->image_title_show_hover;
47
  }
 
48
  $theme_row = $this->model->get_theme_row_data($params['theme_id']);
49
  if (!$theme_row) {
50
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'error');
84
  display: inline-block;
85
  text-align: center;
86
  }
87
+ #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .<?php echo $album_gallery_div_class; ?> * {
88
+ -moz-box-sizing: content-box;
89
+ box-sizing: content-box;
90
+ }
91
  #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_album_thumb_span1_<?php echo $bwg; ?> {
92
  background-color: #<?php echo $theme_row->album_compact_thumb_bg_color; ?>;
93
  border-radius: <?php echo $theme_row->album_compact_thumb_border_radius; ?>;
150
  }
151
  <?php
152
  }
153
+ elseif ($params['compuct_album_title'] == 'hover') { // Show album/gallery title on hover.
154
  ?>
155
  #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_title_span1_<?php echo $bwg; ?> {
156
  display: table;
166
  }
167
  ?>
168
  #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_album_thumb_span1_<?php echo $bwg; ?>:hover .bwg_title_span1_<?php echo $bwg; ?> {
169
+ left: <?php echo $theme_row->album_compact_thumb_padding; ?>px;
170
+ top: <?php echo $theme_row->album_compact_thumb_padding; ?>px;
171
  opacity: 1;
172
  filter: Alpha(opacity=100);
173
  }
247
  cursor: pointer;
248
  text-decoration: none;
249
  }
250
+ #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_standart_thumb_<?php echo $bwg; ?> {
251
+ display: inline-block;
252
+ text-align: center;
253
+ }
254
+ <?php
255
+ if ($params['compuct_album_image_title'] == 'show') { // Show image title at the bottom.
256
+ ?>
257
+ #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_image_title_span1_<?php echo $bwg; ?> {
258
+ display: block;
259
+ margin: 0 auto;
260
+ opacity: 1;
261
+ filter: Alpha(opacity=100);
262
+ text-align: center;
263
+ width: <?php echo $params['compuct_album_thumb_width']; ?>px;
264
+ }
265
+ <?php
266
+ }
267
+ elseif ($params['compuct_album_image_title'] == 'hover') { // Show image title on hover.
268
+ ?>
269
+ #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_image_title_span1_<?php echo $bwg; ?> {
270
+ display: table;
271
+ height: inherit;
272
+ left: -3000px;
273
+ opacity: 0;
274
+ filter: Alpha(opacity=0);
275
+ position: absolute;
276
+ top: 0px;
277
+ width: inherit;
278
+ }
279
+ <?php
280
+ }
281
+ ?>
282
+ #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_standart_thumb_span1_<?php echo $bwg; ?>:hover .bwg_image_title_span1_<?php echo $bwg; ?> {
283
+ left: <?php echo $theme_row->thumb_padding; ?>px;
284
+ top: <?php echo $theme_row->thumb_padding; ?>px;
285
+ opacity: 1;
286
+ filter: Alpha(opacity=100);
287
+ }
288
+ #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_image_title_span2_<?php echo $bwg; ?> {
289
+ color: #<?php echo $theme_row->thumb_title_font_color; ?>;
290
+ display: table-cell;
291
+ font-family: <?php echo $theme_row->thumb_title_font_style; ?>;
292
+ font-size: <?php echo $theme_row->thumb_title_font_size; ?>px;
293
+ font-weight: <?php echo $theme_row->thumb_title_font_weight; ?>;
294
+ height: inherit;
295
+ margin: <?php echo $theme_row->thumb_title_margin; ?>;
296
+ text-shadow: <?php echo $theme_row->thumb_title_shadow; ?>;
297
+ vertical-align: middle;
298
+ width: inherit;
299
+ word-break: break-all;
300
+ word-wrap: break-word;
301
+ }
302
 
303
  /*Pagination styles.*/
304
  #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .tablenav-pages_<?php echo $bwg; ?> {
537
  $thumb_top = ($params['compuct_album_image_thumb_height'] - $image_thumb_height) / 2;
538
  ?>
539
  <a style="font-size: 0;" href="javascript:spider_createpopup('<?php echo addslashes(add_query_arg($params_array, admin_url('admin-ajax.php'))); ?>', '<?php echo $bwg; ?>', '<?php echo $params['popup_width']; ?>', '<?php echo $params['popup_height']; ?>', 1, 'testpopup', 5);">
540
+ <span class="bwg_standart_thumb_<?php echo $bwg; ?>">
541
+ <span class="bwg_standart_thumb_span1_<?php echo $bwg; ?>">
542
+ <span class="bwg_standart_thumb_span2_<?php echo $bwg; ?>">
543
+ <img style="max-height:none; max-width:none; width:<?php echo $image_thumb_width; ?>px; height:<?php echo $image_thumb_height; ?>px; margin-left: <?php echo $thumb_left; ?>px; margin-top: <?php echo $thumb_top; ?>px;"
544
+ id="<?php echo $image_row->id; ?>"
545
+ src="<?php echo site_url() . '/' . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url; ?>"
546
+ alt="<?php echo $image_row->alt; ?>"
547
+ title="<?php echo $image_row->alt; ?>" />
548
+ <?php
549
+ if ($params['compuct_album_image_title'] == 'hover') {
550
+ ?>
551
+ <span class="bwg_image_title_span1_<?php echo $bwg; ?>">
552
+ <span class="bwg_image_title_span2_<?php echo $bwg; ?>">
553
+ <?php echo $image_row->alt; ?>
554
+ </span>
555
+ </span>
556
+ <?php
557
+ }
558
+ ?>
559
+ </span>
560
  </span>
561
+ <?php
562
+ if ($params['compuct_album_image_title'] == 'show') {
563
+ ?>
564
+ <span class="bwg_image_title_span1_<?php echo $bwg; ?>">
565
+ <span class="bwg_image_title_span2_<?php echo $bwg; ?>">
566
+ <?php echo $image_row->alt; ?>
567
+ </span>
568
+ </span>
569
+ <?php
570
+ }
571
+ ?>
572
  </span>
573
  </a>
574
  <?php
frontend/views/BWGViewAlbum_extended_preview.php CHANGED
@@ -28,6 +28,9 @@ class BWGViewAlbum_extended_preview {
28
  global $WD_BWG_UPLOAD_DIR;
29
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
30
 
 
 
 
31
  $theme_row = $this->model->get_theme_row_data($params['theme_id']);
32
  if (!$theme_row) {
33
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'error');
@@ -262,6 +265,58 @@ class BWGViewAlbum_extended_preview {
262
  cursor: pointer;
263
  text-decoration: none;
264
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
 
266
  /*Pagination styles.*/
267
  #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .tablenav-pages_<?php echo $bwg; ?> {
@@ -519,14 +574,38 @@ class BWGViewAlbum_extended_preview {
519
  $thumb_top = ($params['extended_album_image_thumb_height'] - $image_thumb_height) / 2;
520
  ?>
521
  <a style="font-size: 0;" href="javascript:spider_createpopup('<?php echo addslashes(add_query_arg($params_array, admin_url('admin-ajax.php'))); ?>', '<?php echo $bwg; ?>', '<?php echo $params['popup_width']; ?>', '<?php echo $params['popup_height']; ?>', 1, 'testpopup', 5);">
522
- <span class="bwg_standart_thumb_span1_<?php echo $bwg; ?>">
523
- <span class="bwg_standart_thumb_span2_<?php echo $bwg; ?>">
524
- <img style="max-height:none; max-width:none; width:<?php echo $image_thumb_width; ?>px; height:<?php echo $image_thumb_height; ?>px; margin-left: <?php echo $thumb_left; ?>px; margin-top: <?php echo $thumb_top; ?>px;"
525
- id="<?php echo $image_row->id; ?>"
526
- src="<?php echo site_url() . '/' . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url; ?>"
527
- alt="<?php echo $image_row->alt; ?>"
528
- title="<?php echo $image_row->alt; ?>" />
 
 
 
 
 
 
 
 
 
 
 
 
 
529
  </span>
 
 
 
 
 
 
 
 
 
 
 
530
  </span>
531
  </a>
532
  <?php
28
  global $WD_BWG_UPLOAD_DIR;
29
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
30
 
31
+ if (!isset($params['extended_album_image_title'])) {
32
+ $params['extended_album_image_title'] = 'none';
33
+ }
34
  $theme_row = $this->model->get_theme_row_data($params['theme_id']);
35
  if (!$theme_row) {
36
  echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'error');
265
  cursor: pointer;
266
  text-decoration: none;
267
  }
268
+ #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_standart_thumb_<?php echo $bwg; ?> {
269
+ display: inline-block;
270
+ text-align: center;
271
+ }
272
+ <?php
273
+ if ($params['extended_album_image_title'] == 'show') { // Show image title at the bottom.
274
+ ?>
275
+ #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_image_title_span1_<?php echo $bwg; ?> {
276
+ display: block;
277
+ margin: 0 auto;
278
+ opacity: 1;
279
+ filter: Alpha(opacity=100);
280
+ text-align: center;
281
+ width: <?php echo $params['extended_album_image_thumb_width']; ?>px;
282
+ }
283
+ <?php
284
+ }
285
+ elseif ($params['extended_album_image_title'] == 'hover') { // Show image title on hover.
286
+ ?>
287
+ #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_image_title_span1_<?php echo $bwg; ?> {
288
+ display: table;
289
+ height: inherit;
290
+ left: -3000px;
291
+ opacity: 0;
292
+ filter: Alpha(opacity=0);
293
+ position: absolute;
294
+ top: 0px;
295
+ width: inherit;
296
+ }
297
+ <?php
298
+ }
299
+ ?>
300
+ #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_standart_thumb_span1_<?php echo $bwg; ?>:hover .bwg_image_title_span1_<?php echo $bwg; ?> {
301
+ left: <?php echo $theme_row->thumb_padding; ?>px;
302
+ top: <?php echo $theme_row->thumb_padding; ?>px;
303
+ opacity: 1;
304
+ filter: Alpha(opacity=100);
305
+ }
306
+ #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_image_title_span2_<?php echo $bwg; ?> {
307
+ color: #<?php echo $theme_row->thumb_title_font_color; ?>;
308
+ display: table-cell;
309
+ font-family: <?php echo $theme_row->thumb_title_font_style; ?>;
310
+ font-size: <?php echo $theme_row->thumb_title_font_size; ?>px;
311
+ font-weight: <?php echo $theme_row->thumb_title_font_weight; ?>;
312
+ height: inherit;
313
+ margin: <?php echo $theme_row->thumb_title_margin; ?>;
314
+ text-shadow: <?php echo $theme_row->thumb_title_shadow; ?>;
315
+ vertical-align: middle;
316
+ width: inherit;
317
+ word-break: break-all;
318
+ word-wrap: break-word;
319
+ }
320
 
321
  /*Pagination styles.*/
322
  #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .tablenav-pages_<?php echo $bwg; ?> {
574
  $thumb_top = ($params['extended_album_image_thumb_height'] - $image_thumb_height) / 2;
575
  ?>
576
  <a style="font-size: 0;" href="javascript:spider_createpopup('<?php echo addslashes(add_query_arg($params_array, admin_url('admin-ajax.php'))); ?>', '<?php echo $bwg; ?>', '<?php echo $params['popup_width']; ?>', '<?php echo $params['popup_height']; ?>', 1, 'testpopup', 5);">
577
+ <span class="bwg_standart_thumb_<?php echo $bwg; ?>">
578
+ <span class="bwg_standart_thumb_span1_<?php echo $bwg; ?>">
579
+ <span class="bwg_standart_thumb_span2_<?php echo $bwg; ?>">
580
+ <img style="max-height:none; max-width:none; width:<?php echo $image_thumb_width; ?>px; height:<?php echo $image_thumb_height; ?>px; margin-left: <?php echo $thumb_left; ?>px; margin-top: <?php echo $thumb_top; ?>px;"
581
+ id="<?php echo $image_row->id; ?>"
582
+ src="<?php echo site_url() . '/' . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url; ?>"
583
+ alt="<?php echo $image_row->alt; ?>"
584
+ title="<?php echo $image_row->alt; ?>" />
585
+ <?php
586
+ if ($params['extended_album_image_title'] == 'hover') {
587
+ ?>
588
+ <span class="bwg_image_title_span1_<?php echo $bwg; ?>">
589
+ <span class="bwg_image_title_span2_<?php echo $bwg; ?>">
590
+ <?php echo $image_row->alt; ?>
591
+ </span>
592
+ </span>
593
+ <?php
594
+ }
595
+ ?>
596
+ </span>
597
  </span>
598
+ <?php
599
+ if ($params['extended_album_image_title'] == 'show') {
600
+ ?>
601
+ <span class="bwg_image_title_span1_<?php echo $bwg; ?>">
602
+ <span class="bwg_image_title_span2_<?php echo $bwg; ?>">
603
+ <?php echo $image_row->alt; ?>
604
+ </span>
605
+ </span>
606
+ <?php
607
+ }
608
+ ?>
609
  </span>
610
  </a>
611
  <?php
frontend/views/BWGViewGalleryBox.php CHANGED
@@ -911,6 +911,9 @@ class BWGViewGalleryBox {
911
  function bwg_none(current_image_class, next_image_class, direction) {
912
  jQuery(current_image_class).css({'opacity' : 0, 'z-index': 1});
913
  jQuery(next_image_class).css({'opacity' : 1, 'z-index' : 2});
 
 
 
914
  }
915
  function bwg_fade(current_image_class, next_image_class, direction) {
916
  // Set active thumbnail.
@@ -1178,7 +1181,8 @@ class BWGViewGalleryBox {
1178
  spider_destroypopup(1000);
1179
  }
1180
  else if (e.keyCode === 32) { // Space.
1181
- jQuery(".bwg_play_pause").trigger(jQuery.browser.mobile ? 'touchend' : 'click');
 
1182
  }
1183
  });
1184
  function bwg_popup_resize() {
@@ -1312,7 +1316,8 @@ class BWGViewGalleryBox {
1312
  });
1313
  jQuery(".spider_popup_close_fullscreen").hide();
1314
  if (jQuery(".bwg_ctrl_btn").hasClass("fa-pause")) {
1315
- jQuery(".bwg_play_pause").trigger(jQuery.browser.mobile ? 'touchend' : 'click');
 
1316
  }
1317
  }
1318
  else {
@@ -1345,7 +1350,8 @@ class BWGViewGalleryBox {
1345
  }
1346
  }
1347
  jQuery(document).ready(function () {
1348
- var bwg_click = jQuery.browser.mobile ? 'touchend' : 'click';
 
1349
  if (navigator.appVersion.indexOf("MSIE 10") != -1 || navigator.appVersion.indexOf("MSIE 9") != -1) {
1350
  setTimeout(function () {
1351
  bwg_popup_resize();
@@ -1380,13 +1386,14 @@ class BWGViewGalleryBox {
1380
  var evt = window.event || e // Equalize event object.
1381
  evt = evt.originalEvent ? evt.originalEvent : evt; // Convert to originalEvent if possible.
1382
  var delta = evt.detail ? evt.detail*(-40) : evt.wheelDelta // Check for detail first, because it is used by Opera and FF.
 
1383
  if (delta > 0) {
1384
  // Scroll up.
1385
- jQuery(".bwg_filmstrip_left").trigger(jQuery.browser.mobile ? 'touchend' : 'click');
1386
  }
1387
  else {
1388
  // Scroll down.
1389
- jQuery(".bwg_filmstrip_right").trigger(jQuery.browser.mobile ? 'touchend' : 'click');
1390
  }
1391
  });
1392
  jQuery(".bwg_filmstrip_right").on(bwg_click, function () {
911
  function bwg_none(current_image_class, next_image_class, direction) {
912
  jQuery(current_image_class).css({'opacity' : 0, 'z-index': 1});
913
  jQuery(next_image_class).css({'opacity' : 1, 'z-index' : 2});
914
+ // Set active thumbnail.
915
+ jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive");
916
+ jQuery("#bwg_filmstrip_thumbnail_" + bwg_current_key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active");
917
  }
918
  function bwg_fade(current_image_class, next_image_class, direction) {
919
  // Set active thumbnail.
1181
  spider_destroypopup(1000);
1182
  }
1183
  else if (e.keyCode === 32) { // Space.
1184
+ var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
1185
+ jQuery(".bwg_play_pause").trigger(isMobile ? 'touchend' : 'click');
1186
  }
1187
  });
1188
  function bwg_popup_resize() {
1316
  });
1317
  jQuery(".spider_popup_close_fullscreen").hide();
1318
  if (jQuery(".bwg_ctrl_btn").hasClass("fa-pause")) {
1319
+ var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
1320
+ jQuery(".bwg_play_pause").trigger(isMobile ? 'touchend' : 'click');
1321
  }
1322
  }
1323
  else {
1350
  }
1351
  }
1352
  jQuery(document).ready(function () {
1353
+ var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
1354
+ var bwg_click = isMobile ? 'touchend' : 'click';
1355
  if (navigator.appVersion.indexOf("MSIE 10") != -1 || navigator.appVersion.indexOf("MSIE 9") != -1) {
1356
  setTimeout(function () {
1357
  bwg_popup_resize();
1386
  var evt = window.event || e // Equalize event object.
1387
  evt = evt.originalEvent ? evt.originalEvent : evt; // Convert to originalEvent if possible.
1388
  var delta = evt.detail ? evt.detail*(-40) : evt.wheelDelta // Check for detail first, because it is used by Opera and FF.
1389
+ var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
1390
  if (delta > 0) {
1391
  // Scroll up.
1392
+ jQuery(".bwg_filmstrip_left").trigger(isMobile ? 'touchend' : 'click');
1393
  }
1394
  else {
1395
  // Scroll down.
1396
+ jQuery(".bwg_filmstrip_right").trigger(isMobile ? 'touchend' : 'click');
1397
  }
1398
  });
1399
  jQuery(".bwg_filmstrip_right").on(bwg_click, function () {
frontend/views/BWGViewSlideshow.php CHANGED
@@ -939,6 +939,11 @@ class BWGViewSlideshow {
939
  function bwg_none_<?php echo $bwg; ?>(current_image_class, next_image_class, direction) {
940
  jQuery(current_image_class).css({'opacity' : 0, 'z-index': 1});
941
  jQuery(next_image_class).css({'opacity' : 1, 'z-index' : 2});
 
 
 
 
 
942
  }
943
  function bwg_fade_<?php echo $bwg; ?>(current_image_class, next_image_class, direction) {
944
  // Set active thumbnail.
@@ -1231,7 +1236,8 @@ class BWGViewSlideshow {
1231
  bwg_popup_resize_<?php echo $bwg; ?>();
1232
  });
1233
  jQuery(window).load(function () {
1234
- var bwg_click = jQuery.browser.mobile ? 'touchend' : 'click';
 
1235
  bwg_popup_resize_<?php echo $bwg; ?>();
1236
  jQuery("#bwg_container1_<?php echo $bwg; ?>").css({visibility: 'visible'});
1237
  jQuery(".bwg_slideshow_watermark_<?php echo $bwg; ?>").css({display: 'none'});
939
  function bwg_none_<?php echo $bwg; ?>(current_image_class, next_image_class, direction) {
940
  jQuery(current_image_class).css({'opacity' : 0, 'z-index': 1});
941
  jQuery(next_image_class).css({'opacity' : 1, 'z-index' : 2});
942
+ // Set active thumbnail.
943
+ jQuery(".bwg_slideshow_filmstrip_thumbnail_<?php echo $bwg; ?>").removeClass("bwg_slideshow_thumb_active_<?php echo $bwg; ?>").addClass("bwg_slideshow_thumb_deactive_<?php echo $bwg; ?>");
944
+ jQuery("#bwg_filmstrip_thumbnail_" + bwg_current_key_<?php echo $bwg; ?> + "_<?php echo $bwg; ?>").removeClass("bwg_slideshow_thumb_deactive_<?php echo $bwg; ?>").addClass("bwg_slideshow_thumb_active_<?php echo $bwg; ?>");
945
+ jQuery(".bwg_slideshow_dots_<?php echo $bwg; ?>").removeClass("bwg_slideshow_dots_active_<?php echo $bwg; ?>").addClass("bwg_slideshow_dots_deactive_<?php echo $bwg; ?>");
946
+ jQuery("#bwg_dots_" + bwg_current_key_<?php echo $bwg; ?> + "_<?php echo $bwg; ?>").removeClass("bwg_slideshow_dots_deactive_<?php echo $bwg; ?>").addClass("bwg_slideshow_dots_active_<?php echo $bwg; ?>");
947
  }
948
  function bwg_fade_<?php echo $bwg; ?>(current_image_class, next_image_class, direction) {
949
  // Set active thumbnail.
1236
  bwg_popup_resize_<?php echo $bwg; ?>();
1237
  });
1238
  jQuery(window).load(function () {
1239
+ var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
1240
+ var bwg_click = isMobile ? 'touchend' : 'click';
1241
  bwg_popup_resize_<?php echo $bwg; ?>();
1242
  jQuery("#bwg_container1_<?php echo $bwg; ?>").css({visibility: 'visible'});
1243
  jQuery(".bwg_slideshow_watermark_<?php echo $bwg; ?>").css({display: 'none'});
frontend/views/BWGViewThumbnails.php CHANGED
@@ -28,6 +28,9 @@ class BWGViewThumbnails {
28
  global $WD_BWG_UPLOAD_DIR;
29
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
30
 
 
 
 
31
  $from = (isset($params['from']) ? esc_html($params['from']) : 0);
32
  if ($from) {
33
  $options_row = $this->model->get_options_row_data();
@@ -35,6 +38,7 @@ class BWGViewThumbnails {
35
  $params['images_per_page'] = $params['count'];
36
  $params['sort_by'] = (($params['show'] == 'random') ? 'RAND()' : 'date');
37
  $params['image_enable_page'] = 0;
 
38
  $params['thumb_height'] = $params['height'];
39
  $params['thumb_width'] = $params['width'];
40
  $params['image_column_number'] = $params['count'];
@@ -142,6 +146,58 @@ class BWGViewThumbnails {
142
  cursor: pointer;
143
  text-decoration: none;
144
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
 
146
  /*pagination styles*/
147
  #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .tablenav-pages_<?php echo $bwg; ?> {
@@ -274,14 +330,38 @@ class BWGViewThumbnails {
274
  $thumb_top = ($params['thumb_height'] - $image_thumb_height) / 2;
275
  ?>
276
  <a style="font-size: 0;" href="javascript:spider_createpopup('<?php echo addslashes(add_query_arg($params_array, admin_url('admin-ajax.php'))); ?>', '<?php echo $bwg; ?>', '<?php echo $params['popup_width']; ?>', '<?php echo $params['popup_height']; ?>', 1, 'testpopup', 5);">
277
- <span class="bwg_standart_thumb_span1_<?php echo $bwg; ?>">
278
- <span class="bwg_standart_thumb_span2_<?php echo $bwg; ?>">
279
- <img class="bwg_standart_thumb_img_<?php echo $bwg; ?>" style="max-height: none !important; max-width: none !important; padding: 0 !important; width:<?php echo $image_thumb_width; ?>px; height:<?php echo $image_thumb_height; ?>px; margin-left: <?php echo $thumb_left; ?>px; margin-top: <?php echo $thumb_top; ?>px;"
280
- id="<?php echo $image_row->id; ?>"
281
- src="<?php echo site_url() . '/' . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url; ?>"
282
- alt="<?php echo $image_row->alt; ?>"
283
- title="<?php echo $image_row->alt; ?>" />
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  </span>
 
 
 
 
 
 
 
 
 
 
 
285
  </span>
286
  </a>
287
  <?php
28
  global $WD_BWG_UPLOAD_DIR;
29
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
30
 
31
+ if (!isset($params['image_title'])) {
32
+ $params['image_title'] = 'none';
33
+ }
34
  $from = (isset($params['from']) ? esc_html($params['from']) : 0);
35
  if ($from) {
36
  $options_row = $this->model->get_options_row_data();
38
  $params['images_per_page'] = $params['count'];
39
  $params['sort_by'] = (($params['show'] == 'random') ? 'RAND()' : 'date');
40
  $params['image_enable_page'] = 0;
41
+ $params['image_title'] = $options_row->image_title_show_hover;
42
  $params['thumb_height'] = $params['height'];
43
  $params['thumb_width'] = $params['width'];
44
  $params['image_column_number'] = $params['count'];
146
  cursor: pointer;
147
  text-decoration: none;
148
  }
149
+ #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_standart_thumb_<?php echo $bwg; ?> {
150
+ display: inline-block;
151
+ text-align: center;
152
+ }
153
+ <?php
154
+ if ($params['image_title'] == 'show') { // Show image title at the bottom.
155
+ ?>
156
+ #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_title_span1_<?php echo $bwg; ?> {
157
+ display: block;
158
+ margin: 0 auto;
159
+ opacity: 1;
160
+ filter: Alpha(opacity=100);
161
+ text-align: center;
162
+ width: <?php echo $params['thumb_width']; ?>px;
163
+ }
164
+ <?php
165
+ }
166
+ elseif ($params['image_title'] == 'hover') { // Show image title on hover.
167
+ ?>
168
+ #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_title_span1_<?php echo $bwg; ?> {
169
+ display: table;
170
+ height: inherit;
171
+ left: -3000px;
172
+ opacity: 0;
173
+ filter: Alpha(opacity=0);
174
+ position: absolute;
175
+ top: 0px;
176
+ width: inherit;
177
+ }
178
+ <?php
179
+ }
180
+ ?>
181
+ #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_standart_thumb_span1_<?php echo $bwg; ?>:hover .bwg_title_span1_<?php echo $bwg; ?> {
182
+ left: <?php echo $theme_row->thumb_padding; ?>px;
183
+ top: <?php echo $theme_row->thumb_padding; ?>px;
184
+ opacity: 1;
185
+ filter: Alpha(opacity=100);
186
+ }
187
+ #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .bwg_title_span2_<?php echo $bwg; ?> {
188
+ color: #<?php echo $theme_row->thumb_title_font_color; ?>;
189
+ display: table-cell;
190
+ font-family: <?php echo $theme_row->thumb_title_font_style; ?>;
191
+ font-size: <?php echo $theme_row->thumb_title_font_size; ?>px;
192
+ font-weight: <?php echo $theme_row->thumb_title_font_weight; ?>;
193
+ height: inherit;
194
+ margin: <?php echo $theme_row->thumb_title_margin; ?>;
195
+ text-shadow: <?php echo $theme_row->thumb_title_shadow; ?>;
196
+ vertical-align: middle;
197
+ width: inherit;
198
+ word-break: break-all;
199
+ word-wrap: break-word;
200
+ }
201
 
202
  /*pagination styles*/
203
  #bwg_container1_<?php echo $bwg; ?> #bwg_container2_<?php echo $bwg; ?> .tablenav-pages_<?php echo $bwg; ?> {
330
  $thumb_top = ($params['thumb_height'] - $image_thumb_height) / 2;
331
  ?>
332
  <a style="font-size: 0;" href="javascript:spider_createpopup('<?php echo addslashes(add_query_arg($params_array, admin_url('admin-ajax.php'))); ?>', '<?php echo $bwg; ?>', '<?php echo $params['popup_width']; ?>', '<?php echo $params['popup_height']; ?>', 1, 'testpopup', 5);">
333
+ <span class="bwg_standart_thumb_<?php echo $bwg; ?>">
334
+ <span class="bwg_standart_thumb_span1_<?php echo $bwg; ?>">
335
+ <span class="bwg_standart_thumb_span2_<?php echo $bwg; ?>">
336
+ <img class="bwg_standart_thumb_img_<?php echo $bwg; ?>" style="max-height: none !important; max-width: none !important; padding: 0 !important; width:<?php echo $image_thumb_width; ?>px; height:<?php echo $image_thumb_height; ?>px; margin-left: <?php echo $thumb_left; ?>px; margin-top: <?php echo $thumb_top; ?>px;"
337
+ id="<?php echo $image_row->id; ?>"
338
+ src="<?php echo site_url() . '/' . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url; ?>"
339
+ alt="<?php echo $image_row->alt; ?>"
340
+ title="<?php echo $image_row->alt; ?>" />
341
+ <?php
342
+ if ($params['image_title'] == 'hover') {
343
+ ?>
344
+ <span class="bwg_title_span1_<?php echo $bwg; ?>">
345
+ <span class="bwg_title_span2_<?php echo $bwg; ?>">
346
+ <?php echo $image_row->alt; ?>
347
+ </span>
348
+ </span>
349
+ <?php
350
+ }
351
+ ?>
352
+ </span>
353
  </span>
354
+ <?php
355
+ if ($params['image_title'] == 'show') {
356
+ ?>
357
+ <span class="bwg_title_span1_<?php echo $bwg; ?>">
358
+ <span class="bwg_title_span2_<?php echo $bwg; ?>">
359
+ <?php echo $image_row->alt; ?>
360
+ </span>
361
+ </span>
362
+ <?php
363
+ }
364
+ ?>
365
  </span>
366
  </a>
367
  <?php
js/bwg.js CHANGED
@@ -735,12 +735,12 @@ function bwg_change_theme_type(type) {
735
  jQuery("#current_type").val(type);
736
 
737
  jQuery("#type_Thumbnail").attr("style", "background-color: #F4F4F4;");
738
- jQuery("#type_Masonry").attr("style", "background-color: #F4F4F4;");
739
  jQuery("#type_Slideshow").attr("style", "background-color: #F4F4F4;");
740
  jQuery("#type_Compact_album").attr("style", "background-color: #F4F4F4;");
741
  jQuery("#type_Extended_album").attr("style", "background-color: #F4F4F4;");
742
  jQuery("#type_Image_browser").attr("style", "background-color: #F4F4F4;");
743
- jQuery("#type_Blog_style").attr("style", "background-color: #F4F4F4;");
744
  jQuery("#type_Lightbox").attr("style", "background-color: #F4F4F4;");
745
  jQuery("#type_Navigation").attr("style", "background-color: #F4F4F4;");
746
  jQuery("#type_" + type).attr("style", "background-color: #CFCBCB;");
735
  jQuery("#current_type").val(type);
736
 
737
  jQuery("#type_Thumbnail").attr("style", "background-color: #F4F4F4;");
738
+ jQuery("#type_Masonry").attr("style", "background-color: #F4F4F4; opacity: 0.4; filter: Alpha(opacity=40);");
739
  jQuery("#type_Slideshow").attr("style", "background-color: #F4F4F4;");
740
  jQuery("#type_Compact_album").attr("style", "background-color: #F4F4F4;");
741
  jQuery("#type_Extended_album").attr("style", "background-color: #F4F4F4;");
742
  jQuery("#type_Image_browser").attr("style", "background-color: #F4F4F4;");
743
+ jQuery("#type_Blog_style").attr("style", "background-color: #F4F4F4; opacity: 0.4; filter: Alpha(opacity=40);");
744
  jQuery("#type_Lightbox").attr("style", "background-color: #F4F4F4;");
745
  jQuery("#type_Navigation").attr("style", "background-color: #F4F4F4;");
746
  jQuery("#type_" + type).attr("style", "background-color: #CFCBCB;");
js/bwg_shortcode.js CHANGED
@@ -15,7 +15,7 @@ function bwg_shortcode_load() {
15
  }
16
 
17
  function bwg_watermark(watermark_type) {
18
- jQuery("#" + watermark_type).attr('checked', 'checked');
19
  jQuery("#tr_watermark_link").css('display', 'none');
20
  jQuery("#tr_watermark_url").css('display', 'none');
21
  jQuery("#tr_watermark_width_height").css('display', 'none');
@@ -50,7 +50,7 @@ function bwg_watermark(watermark_type) {
50
  }
51
 
52
  function bwg_enable_disable(display, id, current) {
53
- jQuery("#" + current).attr('checked', 'checked');
54
  jQuery("#" + id).css('display', display);
55
  }
56
 
@@ -59,7 +59,7 @@ function bwg_change_label(id, text) {
59
  }
60
 
61
  function bwg_gallery_type(gallery_type) {
62
- jQuery("#" + gallery_type).attr('checked', 'checked');
63
  jQuery("#tr_gallery").css('display', 'none');
64
  jQuery("#tr_sort_by").css('display', 'none');
65
  jQuery("#tr_album").css('display', 'none');
@@ -69,6 +69,7 @@ function bwg_gallery_type(gallery_type) {
69
  bwg_change_label("col_num_label", 'Max. number of image columns');
70
  jQuery("#tr_image_column_number").css('display', 'none');
71
  jQuery("#tr_images_per_page").css('display', 'none');
 
72
  jQuery("#tr_image_enable_page").css('display', 'none');
73
  jQuery("#tr_thumb_width_height").css('display', 'none');
74
 
@@ -79,6 +80,8 @@ function bwg_gallery_type(gallery_type) {
79
  jQuery("#tr_compuct_album_thumb_width_height").css('display', 'none');
80
  jQuery("#tr_compuct_album_image_column_number").css('display', 'none');
81
  jQuery("#tr_compuct_album_images_per_page").css('display', 'none');
 
 
82
  jQuery("#tr_compuct_album_image_thumb_width_height").css('display', 'none');
83
  jQuery("#tr_compuct_album_enable_page").css('display', 'none');
84
 
@@ -89,6 +92,7 @@ function bwg_gallery_type(gallery_type) {
89
  jQuery("#tr_extended_album_thumb_width_height").css('display', 'none');
90
  jQuery("#tr_extended_album_image_column_number").css('display', 'none');
91
  jQuery("#tr_extended_album_images_per_page").css('display', 'none');
 
92
  jQuery("#tr_extended_album_image_thumb_width_height").css('display', 'none');
93
  jQuery("#tr_extended_album_enable_page").css('display', 'none');
94
 
@@ -156,6 +160,7 @@ function bwg_gallery_type(gallery_type) {
156
  jQuery('#thumb_width_height_separator').show();
157
  jQuery("#tr_image_column_number").css('display', '');
158
  jQuery("#tr_images_per_page").css('display', '');
 
159
  jQuery("#tr_image_enable_page").css('display', '');
160
  jQuery("#tr_thumb_width_height").css('display', '');
161
  break;
@@ -242,6 +247,8 @@ function bwg_gallery_type(gallery_type) {
242
  jQuery("#tr_compuct_album_thumb_width_height").css('display', '');
243
  jQuery("#tr_compuct_album_image_column_number").css('display', '');
244
  jQuery("#tr_compuct_album_images_per_page").css('display', '');
 
 
245
  jQuery("#tr_compuct_album_image_thumb_width_height").css('display', '');
246
  jQuery("#tr_compuct_album_enable_page").css('display', '');
247
  break;
@@ -255,6 +262,7 @@ function bwg_gallery_type(gallery_type) {
255
  jQuery("#tr_extended_album_thumb_width_height").css('display', '');
256
  jQuery("#tr_extended_album_image_column_number").css('display', '');
257
  jQuery("#tr_extended_album_images_per_page").css('display', '');
 
258
  jQuery("#tr_extended_album_image_thumb_width_height").css('display', '');
259
  jQuery("#tr_extended_album_enable_page").css('display', '');
260
  break;
@@ -296,3 +304,13 @@ function bwg_gallery_type(gallery_type) {
296
  jQuery("#tr_popup_enable_google").css('display', '');
297
  }
298
  }
 
 
 
 
 
 
 
 
 
 
15
  }
16
 
17
  function bwg_watermark(watermark_type) {
18
+ jQuery("#" + watermark_type).prop('checked', true);
19
  jQuery("#tr_watermark_link").css('display', 'none');
20
  jQuery("#tr_watermark_url").css('display', 'none');
21
  jQuery("#tr_watermark_width_height").css('display', 'none');
50
  }
51
 
52
  function bwg_enable_disable(display, id, current) {
53
+ jQuery("#" + current).prop('checked', true);
54
  jQuery("#" + id).css('display', display);
55
  }
56
 
59
  }
60
 
61
  function bwg_gallery_type(gallery_type) {
62
+ jQuery("#" + gallery_type).prop('checked', true);
63
  jQuery("#tr_gallery").css('display', 'none');
64
  jQuery("#tr_sort_by").css('display', 'none');
65
  jQuery("#tr_album").css('display', 'none');
69
  bwg_change_label("col_num_label", 'Max. number of image columns');
70
  jQuery("#tr_image_column_number").css('display', 'none');
71
  jQuery("#tr_images_per_page").css('display', 'none');
72
+ jQuery("#tr_image_title_hover").css('display', 'none');
73
  jQuery("#tr_image_enable_page").css('display', 'none');
74
  jQuery("#tr_thumb_width_height").css('display', 'none');
75
 
80
  jQuery("#tr_compuct_album_thumb_width_height").css('display', 'none');
81
  jQuery("#tr_compuct_album_image_column_number").css('display', 'none');
82
  jQuery("#tr_compuct_album_images_per_page").css('display', 'none');
83
+ jQuery("#tr_compuct_album_image_title").css('display', 'none');
84
+ jQuery("#tr_compuct_album_image_title").css('display', 'none');
85
  jQuery("#tr_compuct_album_image_thumb_width_height").css('display', 'none');
86
  jQuery("#tr_compuct_album_enable_page").css('display', 'none');
87
 
92
  jQuery("#tr_extended_album_thumb_width_height").css('display', 'none');
93
  jQuery("#tr_extended_album_image_column_number").css('display', 'none');
94
  jQuery("#tr_extended_album_images_per_page").css('display', 'none');
95
+ jQuery("#tr_extended_album_image_title").css('display', 'none');
96
  jQuery("#tr_extended_album_image_thumb_width_height").css('display', 'none');
97
  jQuery("#tr_extended_album_enable_page").css('display', 'none');
98
 
160
  jQuery('#thumb_width_height_separator').show();
161
  jQuery("#tr_image_column_number").css('display', '');
162
  jQuery("#tr_images_per_page").css('display', '');
163
+ jQuery("#tr_image_title_hover").css('display', '');
164
  jQuery("#tr_image_enable_page").css('display', '');
165
  jQuery("#tr_thumb_width_height").css('display', '');
166
  break;
247
  jQuery("#tr_compuct_album_thumb_width_height").css('display', '');
248
  jQuery("#tr_compuct_album_image_column_number").css('display', '');
249
  jQuery("#tr_compuct_album_images_per_page").css('display', '');
250
+ jQuery("#tr_compuct_album_image_title").css('display', '');
251
+ jQuery("#tr_compuct_album_image_title").css('display', '');
252
  jQuery("#tr_compuct_album_image_thumb_width_height").css('display', '');
253
  jQuery("#tr_compuct_album_enable_page").css('display', '');
254
  break;
262
  jQuery("#tr_extended_album_thumb_width_height").css('display', '');
263
  jQuery("#tr_extended_album_image_column_number").css('display', '');
264
  jQuery("#tr_extended_album_images_per_page").css('display', '');
265
+ jQuery("#tr_extended_album_image_title").css('display', '');
266
  jQuery("#tr_extended_album_image_thumb_width_height").css('display', '');
267
  jQuery("#tr_extended_album_enable_page").css('display', '');
268
  break;
304
  jQuery("#tr_popup_enable_google").css('display', '');
305
  }
306
  }
307
+
308
+ function bwg_onKeyDown(e) {
309
+ var e = e || window.event;
310
+ var chCode1 = e.which || e.paramlist_keyCode;
311
+ if (chCode1 != 37 && chCode1 != 38 && chCode1 != 39 && chCode1 != 40) {
312
+ if (!e.ctrlKey || (chCode1 != 86 && chCode1 != 67 && chCode1 != 65 && chCode1 != 88)) {
313
+ e.preventDefault();
314
+ }
315
+ }
316
+ }
photo-gallery.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Photo Gallery
5
  * Plugin URI: http://web-dorado.com/products/wordpress-photo-gallery-plugin.html
6
  * Description: This plugin is a fully responsive gallery plugin with advanced functionality. It allows having different image galleries for your posts and pages. You can create unlimited number of galleries, combine them into albums, and provide descriptions and tags.
7
- * Version: 1.0.4
8
  * Author: http://web-dorado.com/
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
  */
@@ -43,6 +43,8 @@ function bwg_options_panel() {
43
  add_action('admin_print_styles-' . $themes_page, 'bwg_styles');
44
  add_action('admin_print_scripts-' . $themes_page, 'bwg_options_scripts');
45
 
 
 
46
  $licensing_plugins_page = add_submenu_page('galleries_bwg', 'Licensing', 'Licensing', 'manage_options', 'licensing_bwg', 'bw_gallery');
47
  add_action('admin_print_styles-' . $licensing_plugins_page, 'bwg_licensing_styles');
48
 
@@ -59,8 +61,8 @@ function bw_gallery() {
59
  global $wpdb;
60
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
61
  $page = WDWLibrary::get('page');
62
- if (($page != '') && (($page == 'galleries_bwg') || ($page != 'albums_bwg') || ($page != 'tags_bwg') || ($page != 'options_bwg') || ($page != 'themes_bwg') || ($page != 'licensing_bwg') || ($page != 'featured_plugins_bwg') || ($page != 'uninstall_bwg'))) {
63
- require_once (WD_BWG_DIR . '/admin/controllers/BWGController' . ucfirst(strtolower($page)) . '.php');
64
  $controller_class = 'BWGController' . ucfirst(strtolower($page));
65
  $controller = new $controller_class();
66
  $controller->execute();
@@ -71,7 +73,7 @@ function bwg_ajax_frontend() {
71
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
72
  $page = WDWLibrary::get('action');
73
  if (($page != '') && ($page == 'GalleryBox')) {
74
- require_once (WD_BWG_DIR . '/frontend/controllers/BWGController' . ucfirst($page) . '.php');
75
  $controller_class = 'BWGController' . ucfirst($page);
76
  $controller = new $controller_class();
77
  $controller->execute();
@@ -93,7 +95,7 @@ add_action('wp_ajax_nopriv_bwg_captcha', 'bwg_captcha');
93
 
94
  // Upload.
95
  function bwg_UploadHandler() {
96
- require_once (WD_BWG_DIR . '/filemanager/UploadHandler.php');
97
  }
98
 
99
  function bwg_filemanager_ajax() {
@@ -101,7 +103,7 @@ function bwg_filemanager_ajax() {
101
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
102
  $page = WDWLibrary::get('action');
103
  if (($page != '') && (($page == 'addImages') || ($page == 'addMusic'))) {
104
- require_once (WD_BWG_DIR . '/filemanager/controller.php');
105
  $controller_class = 'FilemanagerController';
106
  $controller = new $controller_class();
107
  $controller->execute();
@@ -109,7 +111,7 @@ function bwg_filemanager_ajax() {
109
  }
110
 
111
  function bwg_edit_tag() {
112
- require_once (WD_BWG_DIR . '/admin/controllers/BWGControllerTags_bwg.php');
113
  $controller_class = 'BWGControllerTags_bwg';
114
  $controller = new $controller_class();
115
  $controller->edit_tag();
@@ -120,7 +122,7 @@ function bwg_ajax() {
120
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
121
  $page = WDWLibrary::get('action');
122
  if ($page != '' && (($page == 'BWGShortcode') || ($page == 'addAlbumsGalleries') || ($page == 'editThumb') || ($page == 'addTags'))) {
123
- require_once (WD_BWG_DIR . '/admin/controllers/BWGController' . ucfirst($page) . '.php');
124
  $controller_class = 'BWGController' . ucfirst($page);
125
  $controller = new $controller_class();
126
  $controller->execute();
@@ -152,6 +154,7 @@ function bwg_shortcode($params) {
152
  'sort_by' => 'order',
153
  'image_column_number' => 3,
154
  'images_per_page' => 15,
 
155
  'image_enable_page' => 1,
156
  'thumb_width' => 120,
157
  'thumb_height' => 90,
@@ -217,6 +220,7 @@ function bwg_shortcode($params) {
217
  'compuct_album_thumb_height' => 90,
218
  'compuct_album_image_column_number' => 3,
219
  'compuct_album_images_per_page' => 15,
 
220
  'compuct_album_image_thumb_width' => 120,
221
  'compuct_album_image_thumb_height' => 120,
222
  'compuct_album_enable_page' => 1,
@@ -236,6 +240,7 @@ function bwg_shortcode($params) {
236
  'extended_album_thumb_height' => 90,
237
  'extended_album_image_column_number' => 3,
238
  'extended_album_images_per_page' => 15,
 
239
  'extended_album_image_thumb_width' => 120,
240
  'extended_album_image_thumb_height' => 90,
241
  'extended_album_enable_page' => 1,
@@ -366,7 +371,6 @@ if (class_exists('WP_Widget')) {
366
 
367
  // Activate plugin.
368
  function bwg_activate() {
369
- add_option("wd_bwg_version", '1.0.0', '', 'no');
370
  global $wpdb;
371
  $bwg_gallery = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "bwg_gallery` (
372
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -441,7 +445,10 @@ function bwg_activate() {
441
  `images_per_page` int(4) NOT NULL,
442
  `thumb_width` int(4) NOT NULL,
443
  `thumb_height` int(4) NOT NULL,
 
 
444
  `image_enable_page` tinyint(1) NOT NULL,
 
445
 
446
  `album_column_number` int(4) NOT NULL,
447
  `albums_per_page` int(4) NOT NULL,
@@ -540,6 +547,13 @@ function bwg_activate() {
540
  `thumb_hover_effect` varchar(128) NOT NULL,
541
  `thumb_hover_effect_value` varchar(128) NOT NULL,
542
  `thumb_transition` tinyint(1) NOT NULL,
 
 
 
 
 
 
 
543
  `page_nav_position` varchar(64) NOT NULL,
544
  `page_nav_align` varchar(64) NOT NULL,
545
  `page_nav_number` tinyint(1) NOT NULL,
@@ -882,7 +896,10 @@ function bwg_activate() {
882
  'images_per_page' => 30,
883
  'thumb_width' => 180,
884
  'thumb_height' => 90,
 
 
885
  'image_enable_page' => 1,
 
886
 
887
  'album_column_number' => 5,
888
  'albums_per_page' => 30,
@@ -970,6 +987,8 @@ function bwg_activate() {
970
  '%d',
971
  '%d',
972
  '%d',
 
 
973
 
974
  '%d',
975
  '%d',
@@ -1069,6 +1088,12 @@ function bwg_activate() {
1069
  'thumb_hover_effect' => 'scale',
1070
  'thumb_hover_effect_value' => '1.1',
1071
  'thumb_transition' => 1,
 
 
 
 
 
 
1072
 
1073
  'page_nav_position' => 'bottom',
1074
  'page_nav_align' => 'center',
@@ -1174,7 +1199,7 @@ function bwg_activate() {
1174
  'album_compact_back_font_size' => 16,
1175
  'album_compact_back_font_weight' => 'bold',
1176
  'album_compact_back_padding' => '0',
1177
- 'album_compact_title_font_color' => 'FFFFFF',
1178
  'album_compact_title_font_style' => 'segoe ui',
1179
  'album_compact_title_font_size' => 16,
1180
  'album_compact_title_font_weight' => 'bold',
@@ -1391,6 +1416,12 @@ function bwg_activate() {
1391
  '%s',
1392
  '%s',
1393
  '%d',
 
 
 
 
 
 
1394
 
1395
  '%s',
1396
  '%s',
@@ -1715,6 +1746,12 @@ function bwg_activate() {
1715
  'thumb_hover_effect' => 'rotate',
1716
  'thumb_hover_effect_value' => '2deg',
1717
  'thumb_transition' => 1,
 
 
 
 
 
 
1718
 
1719
  'page_nav_position' => 'bottom',
1720
  'page_nav_align' => 'center',
@@ -1820,7 +1857,7 @@ function bwg_activate() {
1820
  'album_compact_back_font_size' => 14,
1821
  'album_compact_back_font_weight' => 'normal',
1822
  'album_compact_back_padding' => '0',
1823
- 'album_compact_title_font_color' => '000000',
1824
  'album_compact_title_font_style' => 'segoe ui',
1825
  'album_compact_title_font_size' => 16,
1826
  'album_compact_title_font_weight' => 'bold',
@@ -2037,6 +2074,12 @@ function bwg_activate() {
2037
  '%s',
2038
  '%s',
2039
  '%d',
 
 
 
 
 
 
2040
 
2041
  '%s',
2042
  '%s',
@@ -2343,6 +2386,21 @@ function bwg_activate() {
2343
  '%d'
2344
  ));
2345
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2346
  }
2347
  register_activation_hook(__FILE__, 'bwg_activate');
2348
 
4
  * Plugin Name: Photo Gallery
5
  * Plugin URI: http://web-dorado.com/products/wordpress-photo-gallery-plugin.html
6
  * Description: This plugin is a fully responsive gallery plugin with advanced functionality. It allows having different image galleries for your posts and pages. You can create unlimited number of galleries, combine them into albums, and provide descriptions and tags.
7
+ * Version: 1.0.5
8
  * Author: http://web-dorado.com/
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
  */
43
  add_action('admin_print_styles-' . $themes_page, 'bwg_styles');
44
  add_action('admin_print_scripts-' . $themes_page, 'bwg_options_scripts');
45
 
46
+ $generate_shortcode = add_submenu_page('galleries_bwg', 'Generate Shortcode', 'Generate Shortcode', 'manage_options', 'BWGShortcode', 'bw_gallery');
47
+
48
  $licensing_plugins_page = add_submenu_page('galleries_bwg', 'Licensing', 'Licensing', 'manage_options', 'licensing_bwg', 'bw_gallery');
49
  add_action('admin_print_styles-' . $licensing_plugins_page, 'bwg_licensing_styles');
50
 
61
  global $wpdb;
62
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
63
  $page = WDWLibrary::get('page');
64
+ if (($page != '') && (($page == 'galleries_bwg') || ($page == 'albums_bwg') || ($page == 'tags_bwg') || ($page == 'options_bwg') || ($page == 'themes_bwg') || ($page == 'licensing_bwg') || ($page == 'featured_plugins_bwg') || ($page == 'uninstall_bwg') || ($page == 'BWGShortcode'))) {
65
+ require_once(WD_BWG_DIR . '/admin/controllers/BWGController' . (($page == 'BWGShortcode') ? $page : ucfirst(strtolower($page))) . '.php');
66
  $controller_class = 'BWGController' . ucfirst(strtolower($page));
67
  $controller = new $controller_class();
68
  $controller->execute();
73
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
74
  $page = WDWLibrary::get('action');
75
  if (($page != '') && ($page == 'GalleryBox')) {
76
+ require_once(WD_BWG_DIR . '/frontend/controllers/BWGController' . ucfirst($page) . '.php');
77
  $controller_class = 'BWGController' . ucfirst($page);
78
  $controller = new $controller_class();
79
  $controller->execute();
95
 
96
  // Upload.
97
  function bwg_UploadHandler() {
98
+ require_once(WD_BWG_DIR . '/filemanager/UploadHandler.php');
99
  }
100
 
101
  function bwg_filemanager_ajax() {
103
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
104
  $page = WDWLibrary::get('action');
105
  if (($page != '') && (($page == 'addImages') || ($page == 'addMusic'))) {
106
+ require_once(WD_BWG_DIR . '/filemanager/controller.php');
107
  $controller_class = 'FilemanagerController';
108
  $controller = new $controller_class();
109
  $controller->execute();
111
  }
112
 
113
  function bwg_edit_tag() {
114
+ require_once(WD_BWG_DIR . '/admin/controllers/BWGControllerTags_bwg.php');
115
  $controller_class = 'BWGControllerTags_bwg';
116
  $controller = new $controller_class();
117
  $controller->edit_tag();
122
  require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
123
  $page = WDWLibrary::get('action');
124
  if ($page != '' && (($page == 'BWGShortcode') || ($page == 'addAlbumsGalleries') || ($page == 'editThumb') || ($page == 'addTags'))) {
125
+ require_once(WD_BWG_DIR . '/admin/controllers/BWGController' . ucfirst($page) . '.php');
126
  $controller_class = 'BWGController' . ucfirst($page);
127
  $controller = new $controller_class();
128
  $controller->execute();
154
  'sort_by' => 'order',
155
  'image_column_number' => 3,
156
  'images_per_page' => 15,
157
+ 'image_title' => 'none',
158
  'image_enable_page' => 1,
159
  'thumb_width' => 120,
160
  'thumb_height' => 90,
220
  'compuct_album_thumb_height' => 90,
221
  'compuct_album_image_column_number' => 3,
222
  'compuct_album_images_per_page' => 15,
223
+ 'compuct_album_image_title' => 'none',
224
  'compuct_album_image_thumb_width' => 120,
225
  'compuct_album_image_thumb_height' => 120,
226
  'compuct_album_enable_page' => 1,
240
  'extended_album_thumb_height' => 90,
241
  'extended_album_image_column_number' => 3,
242
  'extended_album_images_per_page' => 15,
243
+ 'extended_album_image_title' => 'none',
244
  'extended_album_image_thumb_width' => 120,
245
  'extended_album_image_thumb_height' => 90,
246
  'extended_album_enable_page' => 1,
371
 
372
  // Activate plugin.
373
  function bwg_activate() {
 
374
  global $wpdb;
375
  $bwg_gallery = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "bwg_gallery` (
376
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
445
  `images_per_page` int(4) NOT NULL,
446
  `thumb_width` int(4) NOT NULL,
447
  `thumb_height` int(4) NOT NULL,
448
+ `upload_thumb_width` int(4) NOT NULL,
449
+ `upload_thumb_height` int(4) NOT NULL,
450
  `image_enable_page` tinyint(1) NOT NULL,
451
+ `image_title_show_hover` varchar(20) NOT NULL,
452
 
453
  `album_column_number` int(4) NOT NULL,
454
  `albums_per_page` int(4) NOT NULL,
547
  `thumb_hover_effect` varchar(128) NOT NULL,
548
  `thumb_hover_effect_value` varchar(128) NOT NULL,
549
  `thumb_transition` tinyint(1) NOT NULL,
550
+ `thumb_title_font_color` varchar(64) NOT NULL,
551
+ `thumb_title_font_style` varchar(64) NOT NULL,
552
+ `thumb_title_font_size` int(4) NOT NULL,
553
+ `thumb_title_font_weight` varchar(64) NOT NULL,
554
+ `thumb_title_margin` varchar(64) NOT NULL,
555
+ `thumb_title_shadow` varchar(64) NOT NULL,
556
+
557
  `page_nav_position` varchar(64) NOT NULL,
558
  `page_nav_align` varchar(64) NOT NULL,
559
  `page_nav_number` tinyint(1) NOT NULL,
896
  'images_per_page' => 30,
897
  'thumb_width' => 180,
898
  'thumb_height' => 90,
899
+ 'upload_thumb_width' => 300,
900
+ 'upload_thumb_height' => 300,
901
  'image_enable_page' => 1,
902
+ 'image_title_show_hover' => 'none',
903
 
904
  'album_column_number' => 5,
905
  'albums_per_page' => 30,
987
  '%d',
988
  '%d',
989
  '%d',
990
+ '%d',
991
+ '%d',
992
 
993
  '%d',
994
  '%d',
1088
  'thumb_hover_effect' => 'scale',
1089
  'thumb_hover_effect_value' => '1.1',
1090
  'thumb_transition' => 1,
1091
+ 'thumb_title_font_color' => 'CCCCCC',
1092
+ 'thumb_title_font_style' => 'segoe ui',
1093
+ 'thumb_title_font_size' => 16,
1094
+ 'thumb_title_font_weight' => 'bold',
1095
+ 'thumb_title_margin' => '2px',
1096
+ 'thumb_title_shadow' => '0px 0px 0px #888888',
1097
 
1098
  'page_nav_position' => 'bottom',
1099
  'page_nav_align' => 'center',
1199
  'album_compact_back_font_size' => 16,
1200
  'album_compact_back_font_weight' => 'bold',
1201
  'album_compact_back_padding' => '0',
1202
+ 'album_compact_title_font_color' => 'CCCCCC',
1203
  'album_compact_title_font_style' => 'segoe ui',
1204
  'album_compact_title_font_size' => 16,
1205
  'album_compact_title_font_weight' => 'bold',
1416
  '%s',
1417
  '%s',
1418
  '%d',
1419
+ '%s',
1420
+ '%s',
1421
+ '%d',
1422
+ '%s',
1423
+ '%s',
1424
+ '%s',
1425
 
1426
  '%s',
1427
  '%s',
1746
  'thumb_hover_effect' => 'rotate',
1747
  'thumb_hover_effect_value' => '2deg',
1748
  'thumb_transition' => 1,
1749
+ 'thumb_title_font_color' => 'CCCCCC',
1750
+ 'thumb_title_font_style' => 'segoe ui',
1751
+ 'thumb_title_font_size' => 16,
1752
+ 'thumb_title_font_weight' => 'bold',
1753
+ 'thumb_title_margin' => '5px',
1754
+ 'thumb_title_shadow' => '',
1755
 
1756
  'page_nav_position' => 'bottom',
1757
  'page_nav_align' => 'center',
1857
  'album_compact_back_font_size' => 14,
1858
  'album_compact_back_font_weight' => 'normal',
1859
  'album_compact_back_padding' => '0',
1860
+ 'album_compact_title_font_color' => 'CCCCCC',
1861
  'album_compact_title_font_style' => 'segoe ui',
1862
  'album_compact_title_font_size' => 16,
1863
  'album_compact_title_font_weight' => 'bold',
2074
  '%s',
2075
  '%s',
2076
  '%d',
2077
+ '%s',
2078
+ '%s',
2079
+ '%d',
2080
+ '%s',
2081
+ '%s',
2082
+ '%s',
2083
 
2084
  '%s',
2085
  '%s',
2386
  '%d'
2387
  ));
2388
  }
2389
+ $version = str_replace('.', '', get_option("wd_bwg_version"));
2390
+ $new_version = 101;
2391
+ if ($version && $version < $new_version) {
2392
+ require_once WD_BWG_DIR . "/update/bwg_update.php";
2393
+ for ($i = $version; $i < $new_version; $i++) {
2394
+ $func_name = 'bwg_update_' . $i;
2395
+ if (function_exists($func_name)) {
2396
+ $func_name();
2397
+ }
2398
+ }
2399
+ update_option("wd_bwg_version", '1.0.1');
2400
+ }
2401
+ else {
2402
+ add_option("wd_bwg_version", '1.0.1', '', 'no');
2403
+ }
2404
  }
2405
  register_activation_hook(__FILE__, 'bwg_activate');
2406
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://web-dorado.com/products/wordpress-photo-gallery-plugin.html
4
  Tags: gallery, galleries, photo , photo gallery , image gallery, video gallery, wordpress gallery plugin, images gallery, album , photo albums, Simple gallery, best gallery plugin , free photo gallery, wp gallery, wordpress gallery, website gallery, gallery shortcode, best gallery, picture, pictures, gallery slider, photo album, image, photogallery, widget gallery, images, photos, gallery lightbox, photoset, wordpress photo gallery plugin, wp gallery plugins, responsive wordpress photo gallery, media, image album, filterable gallery, banner rotator, fullscreen gallery, Fotogalerie, Galleria, galerie, galeri
5
  Requires at least: 3.0
6
  Tested up to: 3.8
7
- Stable tag: 1.0.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
4
  Tags: gallery, galleries, photo , photo gallery , image gallery, video gallery, wordpress gallery plugin, images gallery, album , photo albums, Simple gallery, best gallery plugin , free photo gallery, wp gallery, wordpress gallery, website gallery, gallery shortcode, best gallery, picture, pictures, gallery slider, photo album, image, photogallery, widget gallery, images, photos, gallery lightbox, photoset, wordpress photo gallery plugin, wp gallery plugins, responsive wordpress photo gallery, media, image album, filterable gallery, banner rotator, fullscreen gallery, Fotogalerie, Galleria, galerie, galeri
5
  Requires at least: 3.0
6
  Tested up to: 3.8
7
+ Stable tag: 1.0.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
update/bwg_update.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function bwg_update_100() {
4
+ global $wpdb;
5
+ // Add image title option.
6
+ $wpdb->query("ALTER TABLE " . $wpdb->prefix . "bwg_option ADD `image_title_show_hover` varchar(20) NOT NULL DEFAULT 'none' AFTER `image_enable_page`");
7
+ // Add image title theme options.
8
+ $wpdb->query("ALTER TABLE " . $wpdb->prefix . "bwg_theme ADD `thumb_title_shadow` varchar(64) NOT NULL DEFAULT '0px 0px 0px #888888' AFTER `thumb_transition`");
9
+ $wpdb->query("ALTER TABLE " . $wpdb->prefix . "bwg_theme ADD `thumb_title_margin` varchar(64) NOT NULL DEFAULT '2px' AFTER `thumb_transition`");
10
+ $wpdb->query("ALTER TABLE " . $wpdb->prefix . "bwg_theme ADD `thumb_title_font_weight` varchar(64) NOT NULL DEFAULT 'bold' AFTER `thumb_transition`");
11
+ $wpdb->query("ALTER TABLE " . $wpdb->prefix . "bwg_theme ADD `thumb_title_font_size` int(4) NOT NULL DEFAULT 16 AFTER `thumb_transition`");
12
+ $wpdb->query("ALTER TABLE " . $wpdb->prefix . "bwg_theme ADD `thumb_title_font_style` varchar(64) NOT NULL DEFAULT 'segoe ui' AFTER `thumb_transition`");
13
+ $wpdb->query("ALTER TABLE " . $wpdb->prefix . "bwg_theme ADD `thumb_title_font_color` varchar(64) NOT NULL DEFAULT 'CCCCCC' AFTER `thumb_transition`");
14
+ // Add thumb upload dimensions.
15
+ $wpdb->query("ALTER TABLE " . $wpdb->prefix . "bwg_option ADD `upload_thumb_height` int(4) NOT NULL DEFAULT 300 AFTER `thumb_height`");
16
+ $wpdb->query("ALTER TABLE " . $wpdb->prefix . "bwg_option ADD `upload_thumb_width` int(4) NOT NULL DEFAULT 300 AFTER `thumb_height`");
17
+ return;
18
+ }