Photo Gallery by WD – Responsive Photo Gallery - Version 1.3.55

Version Description

  • Changed: Create custom post on album, gallery, tag save.
  • Fixed: Carousel view.
Download this release

Release Info

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

Code changes from version 1.3.54 to 1.3.55

admin/controllers/BWGControllerAlbums_bwg.php CHANGED
@@ -1,34 +1,15 @@
1
  <?php
2
-
3
  class BWGControllerAlbums_bwg {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
  public function execute() {
22
  $task = WDWLibrary::get('task');
23
  $id = WDWLibrary::get('current_id', 0);
24
-
25
-
26
- if($task != ''){
27
- if(!WDWLibrary::verify_nonce('albums_bwg')){
28
  die('Sorry, your nonce did not verify.');
29
  }
30
  }
31
-
32
 
33
  $message = WDWLibrary::get('message');
34
  echo WDWLibrary::message_id($message);
@@ -152,6 +133,7 @@ class BWGControllerAlbums_bwg {
152
  $name = $this->bwg_get_unique_name($name, $id);
153
  $slug = ((isset($_POST['slug']) && esc_html(stripslashes($_POST['slug'])) != '') ? esc_html(stripslashes($_POST['slug'])) : $name);
154
  $slug = $this->bwg_get_unique_slug($slug, $id);
 
155
  $description = (isset($_POST['description']) ? stripslashes($_POST['description']) : '');
156
  $preview_image = ((isset($_POST['preview_image']) && esc_html(stripslashes($_POST['preview_image'])) != '') ? esc_html(stripslashes($_POST['preview_image'])) : '');
157
  $author = get_current_user_id();
@@ -164,18 +146,7 @@ class BWGControllerAlbums_bwg {
164
  'description' => $description,
165
  'preview_image' => $preview_image,
166
  'published' => $published), array('id' => $id));
167
-
168
- /* Update data in corresponding posts.*/
169
- $query2 = "SELECT ID, post_content FROM " . $wpdb->posts . " WHERE post_type = 'bwg_album'";
170
- $posts = $wpdb->get_results($query2, OBJECT);
171
- foreach ($posts as $post) {
172
- $post_content = $post->post_content;
173
- if (strpos($post_content, ' type="album" ') && strpos($post_content, ' album_id="' . $id . '" ')) {
174
- $album_post = array('ID' => $post->ID, 'post_title' => $name, 'post_name' => $slug);
175
- wp_update_post($album_post);
176
- }
177
- }
178
- }
179
  else {
180
  $save = $wpdb->insert($wpdb->prefix . 'bwg_album', array(
181
  'name' => $name,
@@ -197,9 +168,22 @@ class BWGControllerAlbums_bwg {
197
  '%d'
198
  ));
199
  $id = $wpdb->get_var('SELECT MAX(`id`) FROM ' . $wpdb->prefix . 'bwg_album');
200
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  $this->save_alb_gal($id, $albums_galleries);
202
- // Set random image.
203
  $random_preview_image = (($preview_image == '') ? $this->get_image_for_album($id) : '');
204
  $wpdb->update($wpdb->prefix . 'bwg_album', array('random_preview_image' => $random_preview_image), array('id' => $id));
205
  if ($save !== FALSE) {
@@ -209,7 +193,7 @@ class BWGControllerAlbums_bwg {
209
  return 2;
210
  }
211
  }
212
-
213
  public function save_alb_gal($id, $alb_gal_str) {
214
  global $wpdb;
215
  $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE album_id="%d"', $id);
@@ -233,56 +217,60 @@ class BWGControllerAlbums_bwg {
233
  }
234
  }
235
 
236
- public function delete($id) {
237
  global $wpdb;
238
- $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_album WHERE id="%d"', $id);
239
- $query_gal = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE album_id="%d" OR (is_album AND alb_gal_id="%d")', $id, $id);
240
- if ($wpdb->query($query)) {
241
- $wpdb->query($query_gal);
242
- $message = 3;
243
- }
244
- else {
245
- $message = 2;
246
- }
247
- /* Delete corresponding posts and their meta.*/
248
- $query2 = "SELECT ID, post_content FROM " . $wpdb->posts . " WHERE post_type = 'bwg_album'";
249
- $posts = $wpdb->get_results($query2, OBJECT);
250
- foreach ($posts as $post) {
251
- $post_content = $post->post_content;
252
- if (strpos($post_content, ' type="album" ') && strpos($post_content, ' album_id="'.$id.'" ')) {
253
- wp_delete_post($post->ID, TRUE);
254
- }
255
- }
256
  $page = WDWLibrary::get('page');
257
  $query_url = wp_nonce_url( admin_url('admin.php'), 'albums_bwg', 'bwg_nonce' );
258
  $query_url = add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), $query_url);
259
  WDWLibrary::spider_redirect($query_url);
260
  }
261
 
262
- public function delete_all() {
263
- global $wpdb;
264
- $flag = FALSE;
265
- $album_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . 'bwg_album');
266
- foreach ($album_ids_col as $album_id) {
267
- if (isset($_POST['check_' . $album_id]) || isset($_POST['check_all_items'])) {
268
- $flag = TRUE;
269
- $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_album WHERE id="%d"', $album_id);
270
- $query_gal = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE album_id="%d" OR (is_album AND alb_gal_id="%d")', $album_id, $album_id);
271
- $wpdb->query($query);
272
- $wpdb->query($query_gal);
273
- }
274
- }
275
- if ($flag) {
276
- $message = 5;
277
- }
278
- else {
279
- $message = 6;
280
- }
281
- $page = WDWLibrary::get('page');
282
- $query_url = wp_nonce_url( admin_url('admin.php'), 'albums_bwg', 'bwg_nonce' );
283
- $query_url = add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), $query_url);
284
- WDWLibrary::spider_redirect($query_url);
285
- }
 
 
 
 
 
 
 
 
 
 
286
 
287
  public function publish($id) {
288
  global $wpdb;
1
  <?php
 
2
  class BWGControllerAlbums_bwg {
3
+ public function __construct() {}
4
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  public function execute() {
6
  $task = WDWLibrary::get('task');
7
  $id = WDWLibrary::get('current_id', 0);
8
+ if ( $task != '' ) {
9
+ if ( !WDWLibrary::verify_nonce('albums_bwg') ) {
 
 
10
  die('Sorry, your nonce did not verify.');
11
  }
12
  }
 
13
 
14
  $message = WDWLibrary::get('message');
15
  echo WDWLibrary::message_id($message);
133
  $name = $this->bwg_get_unique_name($name, $id);
134
  $slug = ((isset($_POST['slug']) && esc_html(stripslashes($_POST['slug'])) != '') ? esc_html(stripslashes($_POST['slug'])) : $name);
135
  $slug = $this->bwg_get_unique_slug($slug, $id);
136
+ $old_slug = WDWLibrary::get('old_slug');
137
  $description = (isset($_POST['description']) ? stripslashes($_POST['description']) : '');
138
  $preview_image = ((isset($_POST['preview_image']) && esc_html(stripslashes($_POST['preview_image'])) != '') ? esc_html(stripslashes($_POST['preview_image'])) : '');
139
  $author = get_current_user_id();
146
  'description' => $description,
147
  'preview_image' => $preview_image,
148
  'published' => $published), array('id' => $id));
149
+ }
 
 
 
 
 
 
 
 
 
 
 
150
  else {
151
  $save = $wpdb->insert($wpdb->prefix . 'bwg_album', array(
152
  'name' => $name,
168
  '%d'
169
  ));
170
  $id = $wpdb->get_var('SELECT MAX(`id`) FROM ' . $wpdb->prefix . 'bwg_album');
171
+ }
172
+ // Create custom post (type is album).
173
+ $custom_post_params = array(
174
+ 'id' => $id,
175
+ 'title' => $name,
176
+ 'slug' => $slug,
177
+ 'old_slug' => $old_slug,
178
+ 'type' => array(
179
+ 'post_type' => 'album',
180
+ 'mode' => '',
181
+ ),
182
+ );
183
+ WDWLibrary::bwg_create_custom_post($custom_post_params);
184
+
185
  $this->save_alb_gal($id, $albums_galleries);
186
+ // Set random image.
187
  $random_preview_image = (($preview_image == '') ? $this->get_image_for_album($id) : '');
188
  $wpdb->update($wpdb->prefix . 'bwg_album', array('random_preview_image' => $random_preview_image), array('id' => $id));
189
  if ($save !== FALSE) {
193
  return 2;
194
  }
195
  }
196
+
197
  public function save_alb_gal($id, $alb_gal_str) {
198
  global $wpdb;
199
  $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE album_id="%d"', $id);
217
  }
218
  }
219
 
220
+ public function delete ($id) {
221
  global $wpdb;
222
+ $message = 2;
223
+ $row = $wpdb->get_row( $wpdb->prepare('SELECT id, slug FROM ' . $wpdb->prefix . 'bwg_album WHERE id="%d"', $id) );
224
+ if ( !empty($row) ) {
225
+ $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_album WHERE id="%d"', $id);
226
+ $query_gal = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE album_id="%d" OR (is_album AND alb_gal_id="%d")', $id, $id);
227
+ if ($wpdb->query($query)) {
228
+ $wpdb->query($query_gal);
229
+ // Remove custom post (type by bwg_album).
230
+ WDWLibrary::bwg_remove_custom_post( array( 'slug' => $row->slug, 'post_type' => 'bwg_album') );
231
+ $message = 3;
232
+ }
233
+ }
 
 
 
 
 
 
234
  $page = WDWLibrary::get('page');
235
  $query_url = wp_nonce_url( admin_url('admin.php'), 'albums_bwg', 'bwg_nonce' );
236
  $query_url = add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), $query_url);
237
  WDWLibrary::spider_redirect($query_url);
238
  }
239
 
240
+ public function delete_all() {
241
+ $message_id = 6;
242
+ $albumids = array();
243
+ if ( !empty($_POST['ids_string']) ) {
244
+ $ids = explode(',', $_POST['ids_string']);
245
+ foreach ($ids as $id) {
246
+ $keypost = 'check_' . $id;
247
+ if ( !empty($_POST[$keypost]) ) {
248
+ $albumids[] = $id;
249
+ }
250
+ }
251
+ }
252
+ if ( !empty($albumids) ) {
253
+ global $wpdb;
254
+ $albums = $wpdb->get_results('SELECT `id`, `slug` FROM ' . $wpdb->prefix . 'bwg_album WHERE `id` IN (' . implode(',', $albumids). ')');
255
+ if ( !empty($albums) ) {
256
+ $delete = false;
257
+ foreach( $albums as $album ) {
258
+ $wpdb->query( $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_album WHERE id="%d"', $album->id) );
259
+ $wpdb->query( $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE album_id="%d" OR (is_album AND alb_gal_id="%d")', $album->id, $album->id) );
260
+ // Remove custom post (type by bwg_album).
261
+ WDWLibrary::bwg_remove_custom_post( array( 'slug' => $album->slug, 'post_type' => 'bwg_album') );
262
+ $delete = true;
263
+ }
264
+ if ( $delete ) {
265
+ $message_id = 5;
266
+ }
267
+ }
268
+ }
269
+ $page = WDWLibrary::get('page');
270
+ $query_url = wp_nonce_url( admin_url('admin.php'), 'albums_bwg', 'bwg_nonce' );
271
+ $query_url = add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message_id), $query_url);
272
+ WDWLibrary::spider_redirect($query_url);
273
+ }
274
 
275
  public function publish($id) {
276
  global $wpdb;
admin/controllers/BWGControllerBWGShortcode.php CHANGED
@@ -1,36 +1,18 @@
1
  <?php
2
 
3
  class BWGControllerBWGShortcode {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
  public function __construct() {
17
  }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
  public function execute() {
22
  $task = WDWLibrary::get('task');
23
-
24
  $from_menu = ((isset($_GET['page']) && (esc_html($_GET['page']) == 'BWGShortcode')) ? TRUE : FALSE);
25
-
26
- if($task != '' && $from_menu){
27
- if(!WDWLibrary::verify_nonce('BWGShortcode')){
28
  die('Sorry, your nonce did not verify.');
29
  }
30
  }
31
-
32
-
33
- if (method_exists($this, $task)) {
34
  $this->$task();
35
  }
36
  $this->display();
@@ -52,12 +34,12 @@ class BWGControllerBWGShortcode {
52
  $id = ((isset($_POST['currrent_id'])) ? (int) esc_html(stripslashes($_POST['currrent_id'])) : 0);
53
  $insert = ((isset($_POST['bwg_insert'])) ? (int) esc_html(stripslashes($_POST['bwg_insert'])) : 0);
54
  if (!$insert) {
55
- $save = $wpdb->update($wpdb->prefix . 'bwg_shortcode', array(
56
  'tagtext' => $tagtext
57
  ), array('id' => $id));
58
  }
59
  else {
60
- $save = $wpdb->insert($wpdb->prefix . 'bwg_shortcode', array(
61
  'id' => $id,
62
  'tagtext' => $tagtext
63
  ), array(
@@ -67,13 +49,4 @@ class BWGControllerBWGShortcode {
67
  }
68
  }
69
  }
70
- ////////////////////////////////////////////////////////////////////////////////////////
71
- // Getters & Setters //
72
- ////////////////////////////////////////////////////////////////////////////////////////
73
- ////////////////////////////////////////////////////////////////////////////////////////
74
- // Private Methods //
75
- ////////////////////////////////////////////////////////////////////////////////////////
76
- ////////////////////////////////////////////////////////////////////////////////////////
77
- // Listeners //
78
- ////////////////////////////////////////////////////////////////////////////////////////
79
  }
1
  <?php
2
 
3
  class BWGControllerBWGShortcode {
 
 
 
 
 
 
 
 
 
 
 
 
4
  public function __construct() {
5
  }
6
+
 
 
7
  public function execute() {
8
  $task = WDWLibrary::get('task');
 
9
  $from_menu = ((isset($_GET['page']) && (esc_html($_GET['page']) == 'BWGShortcode')) ? TRUE : FALSE);
10
+ if ( $task != '' && $from_menu ) {
11
+ if ( !WDWLibrary::verify_nonce('BWGShortcode') ) {
 
12
  die('Sorry, your nonce did not verify.');
13
  }
14
  }
15
+ if ( method_exists($this, $task) ) {
 
 
16
  $this->$task();
17
  }
18
  $this->display();
34
  $id = ((isset($_POST['currrent_id'])) ? (int) esc_html(stripslashes($_POST['currrent_id'])) : 0);
35
  $insert = ((isset($_POST['bwg_insert'])) ? (int) esc_html(stripslashes($_POST['bwg_insert'])) : 0);
36
  if (!$insert) {
37
+ $wpdb->update($wpdb->prefix . 'bwg_shortcode', array(
38
  'tagtext' => $tagtext
39
  ), array('id' => $id));
40
  }
41
  else {
42
+ $wpdb->insert($wpdb->prefix . 'bwg_shortcode', array(
43
  'id' => $id,
44
  'tagtext' => $tagtext
45
  ), array(
49
  }
50
  }
51
  }
 
 
 
 
 
 
 
 
 
52
  }
admin/controllers/BWGControllerGalleries_bwg.php CHANGED
@@ -510,11 +510,12 @@ class BWGControllerGalleries_bwg {
510
  public function save_db() {
511
  global $wpdb;
512
  global $WD_BWG_UPLOAD_DIR;
513
- $id = (isset($_POST['current_id']) ? (int) $_POST['current_id'] : 0);
514
  $name = ((isset($_POST['name']) && esc_html(stripslashes($_POST['name'])) != '') ? esc_html(stripslashes($_POST['name'])) : 'Gallery');
515
  $name = $this->bwg_get_unique_name($name, $id);
516
  $slug = ((isset($_POST['slug']) && esc_html(stripslashes($_POST['slug'])) != '') ? esc_html(stripslashes($_POST['slug'])) : $name);
517
  $slug = $this->bwg_get_unique_slug($slug, $id);
 
518
  $description = (isset($_POST['description']) ? stripslashes($_POST['description']) : '');
519
  $preview_image = (isset($_POST['preview_image']) ? esc_html(stripslashes($_POST['preview_image'])) : '');
520
  $random_preview_image = '';
@@ -560,16 +561,6 @@ class BWGControllerGalleries_bwg {
560
  $data['preview_image'] = $preview_image;
561
  }
562
  $save = $wpdb->update($wpdb->prefix . 'bwg_gallery', $data, array('id' => $id));
563
- /* Update data in corresponding posts.*/
564
- $query2 = "SELECT ID, post_content FROM " . $wpdb->posts . " WHERE post_type = 'bwg_gallery'";
565
- $posts = $wpdb->get_results($query2, OBJECT);
566
- foreach ($posts as $post) {
567
- $post_content = $post->post_content;
568
- if (strpos($post_content, ' type="gallery" ') && strpos($post_content, ' gallery_id="' . $id . '" ')) {
569
- $album_post = array('ID' => $post->ID, 'post_title' => $name, 'post_name' => $slug);
570
- wp_update_post($album_post);
571
- }
572
- }
573
  }
574
  else {
575
  $save = $wpdb->insert($wpdb->prefix . 'bwg_gallery', array(
@@ -601,8 +592,21 @@ class BWGControllerGalleries_bwg {
601
  '%s',
602
  '%d',
603
  ));
604
- }
605
- if ($save !== FALSE) {
 
 
 
 
 
 
 
 
 
 
 
 
 
606
  echo WDWLibrary::message(__('Item Succesfully Saved.', 'bwg_back'), 'wd_updated');
607
  }
608
  else {
@@ -636,52 +640,59 @@ class BWGControllerGalleries_bwg {
636
  }
637
 
638
  public function delete($id) {
639
- global $wpdb;
640
- $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_gallery WHERE id="%d"', $id);
641
- $query_image = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_image WHERE gallery_id="%d"', $id);
642
- $query_album_gallery = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE alb_gal_id="%d" AND is_album="%d"', $id, 0);
643
- if ($wpdb->query($query)) {
644
- $wpdb->query($query_image);
645
- $wpdb->query($query_album_gallery);
646
- echo WDWLibrary::message(__('Item Succesfully Deleted.', 'bwg_back'), 'wd_updated');
647
- }
648
- else {
649
- echo WDWLibrary::message(__('Error. Please install plugin again.', 'bwg_back'), 'wd_error');
650
- }
651
- /* Delete corresponding posts and their meta.*/
652
- $query2 = "SELECT ID, post_content FROM " . $wpdb->posts . " WHERE post_type = 'bwg_gallery'";
653
- $posts = $wpdb->get_results($query2, OBJECT);
654
- foreach ($posts as $post) {
655
- $post_content = $post->post_content;
656
- if (strpos($post_content, ' type="gallery" ') && strpos($post_content, ' gallery_id="'.$id.'" ')) {
657
- wp_delete_post($post->ID, TRUE);
658
- }
659
  }
660
  $this->display();
661
  }
662
 
663
  public function delete_all() {
664
- global $wpdb;
665
- $flag = FALSE;
666
- $gal_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . 'bwg_gallery');
667
- foreach ($gal_ids_col as $gal_id) {
668
- if (isset($_POST['check_' . $gal_id]) || isset($_POST['check_all_items'])) {
669
- $flag = TRUE;
670
- $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_gallery WHERE id="%d"', $gal_id);
671
- $wpdb->query($query);
672
- $query_image = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_image WHERE gallery_id="%d"', $gal_id);
673
- $wpdb->query($query_image);
674
- $query_album_gallery = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE alb_gal_id="%d" AND is_album="%d"', $gal_id, 0);
675
- $wpdb->query($query_album_gallery);
676
- }
677
- }
678
- if ($flag) {
679
- echo WDWLibrary::message(__('Items Succesfully Deleted.', 'bwg_back'), 'wd_updated');
680
- }
681
- else {
682
- echo WDWLibrary::message(__('You must select at least one item.', 'bwg_back'), 'wd_error');
683
- }
684
- $this->display();
 
 
 
 
 
 
 
 
 
 
685
  }
686
 
687
  public function publish($id) {
510
  public function save_db() {
511
  global $wpdb;
512
  global $WD_BWG_UPLOAD_DIR;
513
+ $id = (isset($_POST['current_id']) ? (int) $_POST['current_id'] : 0);
514
  $name = ((isset($_POST['name']) && esc_html(stripslashes($_POST['name'])) != '') ? esc_html(stripslashes($_POST['name'])) : 'Gallery');
515
  $name = $this->bwg_get_unique_name($name, $id);
516
  $slug = ((isset($_POST['slug']) && esc_html(stripslashes($_POST['slug'])) != '') ? esc_html(stripslashes($_POST['slug'])) : $name);
517
  $slug = $this->bwg_get_unique_slug($slug, $id);
518
+ $old_slug = WDWLibrary::get('old_slug');
519
  $description = (isset($_POST['description']) ? stripslashes($_POST['description']) : '');
520
  $preview_image = (isset($_POST['preview_image']) ? esc_html(stripslashes($_POST['preview_image'])) : '');
521
  $random_preview_image = '';
561
  $data['preview_image'] = $preview_image;
562
  }
563
  $save = $wpdb->update($wpdb->prefix . 'bwg_gallery', $data, array('id' => $id));
 
 
 
 
 
 
 
 
 
 
564
  }
565
  else {
566
  $save = $wpdb->insert($wpdb->prefix . 'bwg_gallery', array(
592
  '%s',
593
  '%d',
594
  ));
595
+ $id = $wpdb->insert_id;
596
+ }
597
+ // Create custom post (type is gallery).
598
+ $custom_post_params = array(
599
+ 'id' => $id,
600
+ 'title' => $name,
601
+ 'slug' => $slug,
602
+ 'old_slug' => $old_slug,
603
+ 'type' => array(
604
+ 'post_type' => 'gallery',
605
+ 'mode' => '',
606
+ ),
607
+ );
608
+ WDWLibrary::bwg_create_custom_post($custom_post_params);
609
+ if ( $save !== FALSE ) {
610
  echo WDWLibrary::message(__('Item Succesfully Saved.', 'bwg_back'), 'wd_updated');
611
  }
612
  else {
640
  }
641
 
642
  public function delete($id) {
643
+ global $wpdb;
644
+ $row = $wpdb->get_row( $wpdb->prepare('SELECT id, slug FROM ' . $wpdb->prefix . 'bwg_gallery WHERE id="%d"', $id) );
645
+ if ( !empty($row) ) {
646
+ $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_gallery WHERE id="%d"', $id);
647
+ $query_image = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_image WHERE gallery_id="%d"', $id);
648
+ $query_album_gallery = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE alb_gal_id="%d" AND is_album="%d"', $id, 0);
649
+ if ($wpdb->query($query)) {
650
+ $wpdb->query($query_image);
651
+ $wpdb->query($query_album_gallery);
652
+ // Remove custom post (type by bwg_gallery).
653
+ WDWLibrary::bwg_remove_custom_post( array( 'slug' => $row->slug, 'post_type' => 'bwg_gallery') );
654
+ echo WDWLibrary::message(__('Item Succesfully Deleted.', 'bwg_back'), 'wd_updated');
655
+ }
656
+ else {
657
+ // TODO change message.
658
+ echo WDWLibrary::message(__('Error. Please install plugin again.', 'bwg_back'), 'wd_error');
659
+ }
 
 
 
660
  }
661
  $this->display();
662
  }
663
 
664
  public function delete_all() {
665
+ $message = WDWLibrary::message(__('You must select at least one item.', 'bwg_back'), 'wd_error');
666
+ $galleryids = array();
667
+ if ( !empty($_POST['ids_string']) ){
668
+ $ids = explode(',', $_POST['ids_string']);
669
+ foreach ($ids as $id) {
670
+ $keypost = 'check_' . $id;
671
+ if ( !empty($_POST[$keypost]) ) {
672
+ $galleryids[] = $id;
673
+ }
674
+ }
675
+ }
676
+ if ( !empty($galleryids) ) {
677
+ global $wpdb;
678
+ $gallerys = $wpdb->get_results('SELECT `id`, `slug` FROM ' . $wpdb->prefix . 'bwg_gallery WHERE `id` IN (' . implode(',', $galleryids). ')');
679
+ if ( !empty($gallerys) ) {
680
+ $delete = false;
681
+ foreach( $gallerys as $gallery ) {
682
+ $wpdb->query( $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_gallery WHERE id="%d"', $gallery->id) );
683
+ $wpdb->query( $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_image WHERE gallery_id="%d"', $gallery->id) );
684
+ $wpdb->query( $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE alb_gal_id="%d" AND is_album="%d"', $gallery->id, 0) );
685
+ // Remove custom post (type by bwg_gallery).
686
+ WDWLibrary::bwg_remove_custom_post( array( 'slug' => $gallery->slug, 'post_type' => 'bwg_gallery') );
687
+ $delete = true;
688
+ }
689
+ if ( $delete ) {
690
+ $message = WDWLibrary::message(__('Items Succesfully Deleted.', 'bwg_back'), 'wd_updated');
691
+ }
692
+ }
693
+ }
694
+ echo $message;
695
+ $this->display();
696
  }
697
 
698
  public function publish($id) {
admin/controllers/BWGControllerTags_bwg.php CHANGED
@@ -1,37 +1,20 @@
1
  <?php
2
 
3
  class BWGControllerTags_bwg {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
  public function __construct() {
17
  }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
  public function execute() {
22
  $task = WDWLibrary::get('task');
23
  $id = WDWLibrary::get('current_id', 0);
24
-
25
- if($task != ''){
26
- if(!WDWLibrary::verify_nonce('tags_bwg')){
27
  die('Sorry, your nonce did not verify.');
28
  }
29
  }
30
-
31
-
32
  $message = WDWLibrary::get('message');
33
  echo WDWLibrary::message_id($message);
34
- if (method_exists($this, $task)) {
35
  $this->$task($id);
36
  }
37
  else {
@@ -96,67 +79,76 @@ class BWGControllerTags_bwg {
96
  }*/
97
  return $name;
98
  }
99
-
100
  public function save_tag() {
 
101
  $name = ((isset($_POST['tagname'])) ? esc_html(stripslashes($_POST['tagname'])) : '');
102
- $name = $this->bwg_get_unique_name($name, 0);
103
  $slug = ((isset($_POST['slug']) && (esc_html($_POST['slug']) != '')) ? esc_html(stripslashes($_POST['slug'])) : $name);
104
  $slug = $this->bwg_get_unique_slug($slug, 0);
105
- $slug = sanitize_title($slug);
106
- if ($name) {
107
  $save = wp_insert_term($name, 'bwg_tag', array(
108
- 'description'=> '',
 
 
 
 
 
 
 
 
109
  'slug' => $slug,
110
- 'parent' => 0
111
- )
 
 
112
  );
113
- if (isset($save->errors)) {
114
- return 14;
 
 
115
  }
116
- else {
117
- return 1;
118
- }
119
- }
120
- else {
121
- return 15;
122
  }
 
 
123
  }
124
-
125
  function edit_tag() {
126
  global $wpdb;
127
- $flag = FALSE;
128
  $id = ((isset($_REQUEST['tag_id'])) ? esc_html(stripslashes($_REQUEST['tag_id'])) : '');
129
  $query = $wpdb->prepare("SELECT count FROM " . $wpdb->prefix . "term_taxonomy WHERE term_id=%d", $id);
130
  $count = $wpdb->get_var($query);
131
  $name = ((isset($_REQUEST['tagname'])) ? esc_html(stripslashes($_REQUEST['tagname'])) : '');
132
  $name = $this->bwg_get_unique_name($name, $id);
133
- if ($name) {
134
  $slug = ((isset($_REQUEST['slug']) && (esc_html($_REQUEST['slug']) != '')) ? esc_html(stripslashes($_REQUEST['slug'])) : $name);
135
  $slug = $this->bwg_get_unique_slug($slug, $id);
136
  $save = wp_update_term($id, 'bwg_tag', array(
137
  'name' => $name,
138
- 'slug' => $slug
139
  ));
140
-
141
- /*update data in corresponding posts*/
142
- $query2 = "SELECT ID, post_content FROM ".$wpdb->posts." WHERE post_type = 'bwg_tag' ";
143
- $posts = $wpdb->get_results($query2, OBJECT);
144
- foreach($posts as $post){
145
- $post_content = $post->post_content;
146
- if( strpos($post_content, ' type="tag" ') && strpos($post_content, ' gallery_id="'.$id.'" ') ){
147
- $tag_post = array('ID' => $post->ID, 'post_title' => $name, 'post_name' => $slug);
148
- wp_update_post( $tag_post );
149
- }
150
- }
151
-
152
- if (isset($save->errors)) {
 
153
  echo 'The slug must be unique.';
154
  }
155
  else {
156
  $flag = TRUE;
157
  }
158
  }
159
- if ($flag) {
160
  echo $name . '.' . $slug . '.' . $count;
161
  }
162
  die();
@@ -164,91 +156,84 @@ class BWGControllerTags_bwg {
164
 
165
  public function edit_tags() {
166
  global $wpdb;
 
167
  $flag = FALSE;
168
  $rows = get_terms('bwg_tag', array('orderby' => 'count', 'hide_empty' => 0));
169
- $name = ((isset($_POST['tagname'])) ? esc_html(stripslashes($_POST['tagname'])) : '');
170
- $name = $this->bwg_get_unique_name($name, 0);
171
- $slug = ((isset($_POST['slug']) && (esc_html($_POST['slug']) != '')) ? esc_html(stripslashes($_POST['slug'])) : $name);
172
- $slug = $this->bwg_get_unique_slug($slug, 0);
173
- if ($name) {
174
- $save = wp_insert_term($name, 'bwg_tag', array(
175
- 'description'=> '',
176
- 'slug' => $slug,
177
- 'parent' => 0
178
- )
179
- );
180
- if (isset($save->errors)) {
181
- $message = 15;
182
- }
183
- else {
184
- $message = 1;
185
- }
186
- }
187
  foreach ($rows as $row) {
188
  $id = $row->term_id;
189
  $name = ((isset($_POST['tagname' . $row->term_id])) ? esc_html(stripslashes($_POST['tagname' . $id])) : '');
190
  $name = $this->bwg_get_unique_name($name, $id);
191
  if ($name) {
192
- $slug = ((isset($_POST['slug' . $row->term_id]) && (esc_html($_POST['slug' . $id]) != '')) ? esc_html(stripslashes($_POST['slug' . $id])) : $name);
193
- $slug = $this->bwg_get_unique_slug($slug, $id);
194
- $save = wp_update_term($id, 'bwg_tag', array(
195
- 'name' => $name,
196
- 'slug' => $slug
197
- ));
198
  if (isset($save->errors)) {
199
- $message = 16;
200
  }
201
  else {
202
  $flag = TRUE;
203
  }
204
-
205
- /*update data in corresponding posts*/
206
- $query2 = "SELECT ID, post_content FROM ".$wpdb->posts." WHERE post_type = 'bwg_tag' ";
207
- $posts = $wpdb->get_results($query2, OBJECT);
208
- foreach($posts as $post){
209
- $post_content = $post->post_content;
210
- if( strpos($post_content, ' type="tag" ') && strpos($post_content, ' gallery_id="'.$id.'" ') ){
211
- $tag_post = array('ID' => $post->ID, 'post_title' => $name, 'post_name' => $slug);
212
- wp_update_post( $tag_post );
213
- }
214
- }
215
-
216
  }
217
  }
218
- if ($flag) {
219
- $message = 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  }
221
- else {
222
- $message = '';
223
  }
224
- $page = WDWLibrary::get('page');
225
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  $query_url = wp_nonce_url( admin_url('admin.php'), 'tags_bwg', 'bwg_nonce' );
227
- $query_url = add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), $query_url);
228
  WDWLibrary::spider_redirect($query_url);
229
  }
230
 
231
  public function delete($id) {
232
  global $wpdb;
233
- wp_delete_term($id, 'bwg_tag');
234
- $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE tag_id="%d"', $id);
235
- $flag = $wpdb->query($query);
236
-
237
- /* Delete corresponding posts and their meta.*/
238
- $query2 = "SELECT ID, post_content FROM " . $wpdb->posts . " WHERE post_type = 'bwg_tag'";
239
- $posts = $wpdb->get_results($query2, OBJECT);
240
- foreach ($posts as $post) {
241
- $post_content = $post->post_content;
242
- if (strpos($post_content, ' type="tag" ') && strpos($post_content, ' gallery_id="' . $id . '" ')) {
243
- wp_delete_post($post->ID, TRUE);
244
- }
245
- }
246
- if ($flag !== FALSE) {
247
- $message = 3;
248
- }
249
- else {
250
- $message = 2;
251
- }
252
  $page = WDWLibrary::get('page');
253
  $query_url = wp_nonce_url( admin_url('admin.php'), 'tags_bwg', 'bwg_nonce' );
254
  $query_url = add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), $query_url);
@@ -256,46 +241,38 @@ class BWGControllerTags_bwg {
256
  }
257
 
258
  public function delete_all() {
259
- global $wpdb;
260
- $flag = FALSE;
261
- $tag_ids_col = $wpdb->get_col("SELECT term_id FROM " . $wpdb->prefix . "terms");
262
- foreach ($tag_ids_col as $tag_id) {
263
- if (isset($_POST['check_' . $tag_id]) || isset($_POST['check_all_items'])) {
264
- wp_delete_term($tag_id, 'bwg_tag');
265
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE tag_id="%d"', $tag_id));
266
- $flag = TRUE;
267
- }
268
- }
269
-
270
- /*delete corresponding posts and their meta*/
271
- $query2 = "SELECT ID, post_content FROM ".$wpdb->posts." WHERE post_type = 'bwg_tag' ";
272
- $posts = $wpdb->get_results($query2, OBJECT);
273
- foreach($posts as $post){
274
- $post_content = $post->post_content;
275
- if( strpos($post_content, ' type="tag" ') ){
276
- wp_delete_post( $post->ID, true );
277
- }
278
- }
279
-
280
- if ($flag) {
281
- $message = 5;
282
- }
283
- else {
284
- $message = 6;
285
- }
 
 
286
  $page = WDWLibrary::get('page');
287
  $query_url = wp_nonce_url( admin_url('admin.php'), 'tags_bwg', 'bwg_nonce' );
288
- $query_url = add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), $query_url);
289
  WDWLibrary::spider_redirect($query_url);
290
  }
291
-
292
- ////////////////////////////////////////////////////////////////////////////////////////
293
- // Getters & Setters //
294
- ////////////////////////////////////////////////////////////////////////////////////////
295
- ////////////////////////////////////////////////////////////////////////////////////////
296
- // Private Methods //
297
- ////////////////////////////////////////////////////////////////////////////////////////
298
- ////////////////////////////////////////////////////////////////////////////////////////
299
- // Listeners //
300
- ////////////////////////////////////////////////////////////////////////////////////////
301
  }
1
  <?php
2
 
3
  class BWGControllerTags_bwg {
 
 
 
 
 
 
 
 
 
 
 
 
4
  public function __construct() {
5
  }
6
+
 
 
7
  public function execute() {
8
  $task = WDWLibrary::get('task');
9
  $id = WDWLibrary::get('current_id', 0);
10
+ if ( $task != '' ) {
11
+ if ( !WDWLibrary::verify_nonce('tags_bwg') ) {
 
12
  die('Sorry, your nonce did not verify.');
13
  }
14
  }
 
 
15
  $message = WDWLibrary::get('message');
16
  echo WDWLibrary::message_id($message);
17
+ if ( method_exists($this, $task) ) {
18
  $this->$task($id);
19
  }
20
  else {
79
  }*/
80
  return $name;
81
  }
82
+
83
  public function save_tag() {
84
+ $message_id = 15;
85
  $name = ((isset($_POST['tagname'])) ? esc_html(stripslashes($_POST['tagname'])) : '');
 
86
  $slug = ((isset($_POST['slug']) && (esc_html($_POST['slug']) != '')) ? esc_html(stripslashes($_POST['slug'])) : $name);
87
  $slug = $this->bwg_get_unique_slug($slug, 0);
88
+ $slug = sanitize_title($slug);
89
+ if ( $name ) {
90
  $save = wp_insert_term($name, 'bwg_tag', array(
91
+ 'description' => '',
92
+ 'slug' => $slug,
93
+ 'parent' => 0
94
+ )
95
+ );
96
+ // Create custom post (type is tag).
97
+ $custom_post_params = array(
98
+ 'id' => $save['term_id'],
99
+ 'title' => $name,
100
  'slug' => $slug,
101
+ 'type' => array(
102
+ 'post_type' => 'tag',
103
+ 'mode' => '',
104
+ ),
105
  );
106
+ WDWLibrary::bwg_create_custom_post($custom_post_params);
107
+ $message_id = 1;
108
+ if ( isset($save->errors) ) {
109
+ $message_id = 14;
110
  }
 
 
 
 
 
 
111
  }
112
+
113
+ return $message_id;
114
  }
115
+
116
  function edit_tag() {
117
  global $wpdb;
118
+ $flag = FALSE;
119
  $id = ((isset($_REQUEST['tag_id'])) ? esc_html(stripslashes($_REQUEST['tag_id'])) : '');
120
  $query = $wpdb->prepare("SELECT count FROM " . $wpdb->prefix . "term_taxonomy WHERE term_id=%d", $id);
121
  $count = $wpdb->get_var($query);
122
  $name = ((isset($_REQUEST['tagname'])) ? esc_html(stripslashes($_REQUEST['tagname'])) : '');
123
  $name = $this->bwg_get_unique_name($name, $id);
124
+ if ( $name ) {
125
  $slug = ((isset($_REQUEST['slug']) && (esc_html($_REQUEST['slug']) != '')) ? esc_html(stripslashes($_REQUEST['slug'])) : $name);
126
  $slug = $this->bwg_get_unique_slug($slug, $id);
127
  $save = wp_update_term($id, 'bwg_tag', array(
128
  'name' => $name,
129
+ 'slug' => $slug,
130
  ));
131
+
132
+ // Create custom post (type is tag).
133
+ $custom_post_params = array(
134
+ 'id' => $id,
135
+ 'title' => $name,
136
+ 'slug' => $slug,
137
+ 'old_slug' => !empty($_POST['old_slug']) ? $_POST['old_slug'] : '',
138
+ 'type' => array(
139
+ 'post_type' => 'tag',
140
+ 'mode' => '',
141
+ ),
142
+ );
143
+ WDWLibrary::bwg_create_custom_post($custom_post_params);
144
+ if ( isset($save->errors) ) {
145
  echo 'The slug must be unique.';
146
  }
147
  else {
148
  $flag = TRUE;
149
  }
150
  }
151
+ if ( $flag ) {
152
  echo $name . '.' . $slug . '.' . $count;
153
  }
154
  die();
156
 
157
  public function edit_tags() {
158
  global $wpdb;
159
+ $message_id = '';
160
  $flag = FALSE;
161
  $rows = get_terms('bwg_tag', array('orderby' => 'count', 'hide_empty' => 0));
162
+ $terms = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  foreach ($rows as $row) {
164
  $id = $row->term_id;
165
  $name = ((isset($_POST['tagname' . $row->term_id])) ? esc_html(stripslashes($_POST['tagname' . $id])) : '');
166
  $name = $this->bwg_get_unique_name($name, $id);
167
  if ($name) {
168
+ $old_slug = ((isset($_POST['old_slug' . $row->term_id]) && (esc_html($_POST['old_slug' . $id]) != '')) ? esc_html(stripslashes($_POST['old_slug' . $id])) : '');
169
+ $slug = ((isset($_POST['slug' . $row->term_id]) && (esc_html($_POST['slug' . $id]) != '')) ? esc_html(stripslashes($_POST['slug' . $id])) : $name);
170
+ $terms[] = array('id' => $id, 'name' => $name, 'slug' => $slug, 'old_slug' => $old_slug);
171
+ $slug = $this->bwg_get_unique_slug($slug, $id);
172
+ $save = wp_update_term($id, 'bwg_tag', array('name' => $name, 'slug' => $slug));
 
173
  if (isset($save->errors)) {
174
+ $message_id = 16;
175
  }
176
  else {
177
  $flag = TRUE;
178
  }
 
 
 
 
 
 
 
 
 
 
 
 
179
  }
180
  }
181
+
182
+ $name = ((isset($_POST['tagname'])) ? esc_html(stripslashes($_POST['tagname'])) : '');
183
+ $name = $this->bwg_get_unique_name($name, 0);
184
+ $slug = ((isset($_POST['slug']) && (esc_html($_POST['slug']) != '')) ? esc_html(stripslashes($_POST['slug'])) : $name);
185
+ $slug = $this->bwg_get_unique_slug($slug, 0);
186
+ if ($name) {
187
+ $save = wp_insert_term($name, 'bwg_tag', array(
188
+ 'description'=> '',
189
+ 'slug' => $slug,
190
+ 'parent' => 0)
191
+ );
192
+ $term = array('id' => $save['term_id'], 'name' => $name, 'old_slug' => '', 'slug' => $slug);
193
+ $terms[count($terms)] = $term;
194
+ $message_id = 1;
195
+ if (isset($save->errors)) {
196
+ $message_id = 15;
197
+ }
198
  }
199
+ if ($flag) {
200
+ $message_id = 1;
201
  }
202
+ // Create custom post (type is tag).
203
+ if ( !empty($terms) ) {
204
+ foreach($terms as $term){
205
+ $custom_post_params = array(
206
+ 'id' => $term['id'],
207
+ 'title' => $term['name'],
208
+ 'slug' => $term['slug'],
209
+ 'old_slug' => $term['old_slug'],
210
+ 'type' => array(
211
+ 'post_type' => 'tag',
212
+ 'mode' => '',
213
+ ),
214
+ );
215
+ WDWLibrary::bwg_create_custom_post($custom_post_params);
216
+ }
217
+ }
218
+ $page = WDWLibrary::get('page');
219
  $query_url = wp_nonce_url( admin_url('admin.php'), 'tags_bwg', 'bwg_nonce' );
220
+ $query_url = add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message_id), $query_url);
221
  WDWLibrary::spider_redirect($query_url);
222
  }
223
 
224
  public function delete($id) {
225
  global $wpdb;
226
+ $message = 2;
227
+ $row = $wpdb->get_row( $wpdb->prepare('SELECT term_id, slug FROM ' . $wpdb->prefix . 'terms WHERE term_id="%d"', $id) );
228
+ if ( !empty($row) ) {
229
+ wp_delete_term($id, 'bwg_tag');
230
+ $flag = $wpdb->query( $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE tag_id="%d"', $id) );
231
+ if ($flag !== FALSE) {
232
+ // Remove custom post (type by bwg_album).
233
+ WDWLibrary::bwg_remove_custom_post( array( 'slug' => $row->slug, 'post_type' => 'bwg_tag') );
234
+ $message = 3;
235
+ }
236
+ }
 
 
 
 
 
 
 
 
237
  $page = WDWLibrary::get('page');
238
  $query_url = wp_nonce_url( admin_url('admin.php'), 'tags_bwg', 'bwg_nonce' );
239
  $query_url = add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), $query_url);
241
  }
242
 
243
  public function delete_all() {
244
+ $message_id = 6;
245
+ $termids = array();
246
+ if ( !empty($_POST['ids_string']) ){
247
+ $ids = explode(',', $_POST['ids_string']);
248
+ foreach ($ids as $id) {
249
+ $keypost = 'check_' . $id;
250
+ if ( !empty($_POST[$keypost]) ) {
251
+ $termids[] = $id;
252
+ }
253
+ }
254
+ }
255
+
256
+ if ( !empty($termids) ){
257
+ global $wpdb;
258
+ $terms = $wpdb->get_results('SELECT `term_id` AS `id`, `slug` FROM ' . $wpdb->prefix . 'terms WHERE `term_id` IN (' . implode(',', $termids). ')');
259
+ if ( !empty($terms) ) {
260
+ $delete = false;
261
+ foreach( $terms as $term ) {
262
+ wp_delete_term($term->id, 'bwg_tag');
263
+ $wpdb->query( $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE tag_id="%d"', $term->id) );
264
+ // Remove custom post (type by bwg_tag).
265
+ WDWLibrary::bwg_remove_custom_post( array( 'slug' => $term->slug, 'post_type' => 'bwg_tag') );
266
+ $delete = true;
267
+ }
268
+ if ( $delete ) {
269
+ $message_id = 5;
270
+ }
271
+ }
272
+ }
273
  $page = WDWLibrary::get('page');
274
  $query_url = wp_nonce_url( admin_url('admin.php'), 'tags_bwg', 'bwg_nonce' );
275
+ $query_url = add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message_id), $query_url);
276
  WDWLibrary::spider_redirect($query_url);
277
  }
 
 
 
 
 
 
 
 
 
 
278
  }
admin/controllers/BWGControllerUninstall_bwg.php CHANGED
@@ -1,18 +1,7 @@
1
  <?php
2
 
3
  class BWGControllerUninstall_bwg {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
  public function __construct() {
17
  global $bwg_options;
18
  if (!class_exists("DoradoWebConfig")) {
@@ -23,9 +12,7 @@ class BWGControllerUninstall_bwg {
23
  $deactivate_reasons = new DoradoWebDeactivate($config);
24
  $deactivate_reasons->submit_and_deactivate();
25
  }
26
- ////////////////////////////////////////////////////////////////////////////////////////
27
- // Public Methods //
28
- ////////////////////////////////////////////////////////////////////////////////////////
29
  public function execute() {
30
  $task = ((isset($_POST['task'])) ? esc_html(stripslashes($_POST['task'])) : '');
31
 
@@ -60,13 +47,4 @@ class BWGControllerUninstall_bwg {
60
  $view = new BWGViewUninstall_bwg($model);
61
  $view->uninstall();
62
  }
63
- ////////////////////////////////////////////////////////////////////////////////////////
64
- // Getters & Setters //
65
- ////////////////////////////////////////////////////////////////////////////////////////
66
- ////////////////////////////////////////////////////////////////////////////////////////
67
- // Private Methods //
68
- ////////////////////////////////////////////////////////////////////////////////////////
69
- ////////////////////////////////////////////////////////////////////////////////////////
70
- // Listeners //
71
- ////////////////////////////////////////////////////////////////////////////////////////
72
  }
1
  <?php
2
 
3
  class BWGControllerUninstall_bwg {
4
+
 
 
 
 
 
 
 
 
 
 
 
5
  public function __construct() {
6
  global $bwg_options;
7
  if (!class_exists("DoradoWebConfig")) {
12
  $deactivate_reasons = new DoradoWebDeactivate($config);
13
  $deactivate_reasons->submit_and_deactivate();
14
  }
15
+
 
 
16
  public function execute() {
17
  $task = ((isset($_POST['task'])) ? esc_html(stripslashes($_POST['task'])) : '');
18
 
47
  $view = new BWGViewUninstall_bwg($model);
48
  $view->uninstall();
49
  }
 
 
 
 
 
 
 
 
 
50
  }
admin/controllers/BWGControllerWidget.php CHANGED
@@ -1,20 +1,10 @@
1
  <?php
2
 
3
  class BWGControllerWidget extends WP_Widget {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
  private $view;
14
  private $model;
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- // Constructor & Destructor //
17
- ////////////////////////////////////////////////////////////////////////////////////////
18
  public function __construct() {
19
  $widget_ops = array(
20
  'classname' => 'bwp_gallery',
@@ -30,9 +20,6 @@ class BWGControllerWidget extends WP_Widget {
30
  require_once WD_BWG_DIR . "/admin/views/BWGViewWidget.php";
31
  $this->view = new BWGViewWidget($this->model);
32
  }
33
- ////////////////////////////////////////////////////////////////////////////////////////
34
- // Public Methods //
35
- ////////////////////////////////////////////////////////////////////////////////////////
36
 
37
  public function widget($args, $instance) {
38
  $this->view->widget($args, $instance);
@@ -55,14 +42,4 @@ class BWGControllerWidget extends WP_Widget {
55
  $instance['theme_id'] = $new_instance['theme_id'];
56
  return $instance;
57
  }
58
-
59
- ////////////////////////////////////////////////////////////////////////////////////////
60
- // Getters & Setters //
61
- ////////////////////////////////////////////////////////////////////////////////////////
62
- ////////////////////////////////////////////////////////////////////////////////////////
63
- // Private Methods //
64
- ////////////////////////////////////////////////////////////////////////////////////////
65
- ////////////////////////////////////////////////////////////////////////////////////////
66
- // Listeners //
67
- ////////////////////////////////////////////////////////////////////////////////////////
68
  }
1
  <?php
2
 
3
  class BWGControllerWidget extends WP_Widget {
4
+
 
 
 
 
 
 
 
 
5
  private $view;
6
  private $model;
7
+
 
 
8
  public function __construct() {
9
  $widget_ops = array(
10
  'classname' => 'bwp_gallery',
20
  require_once WD_BWG_DIR . "/admin/views/BWGViewWidget.php";
21
  $this->view = new BWGViewWidget($this->model);
22
  }
 
 
 
23
 
24
  public function widget($args, $instance) {
25
  $this->view->widget($args, $instance);
42
  $instance['theme_id'] = $new_instance['theme_id'];
43
  return $instance;
44
  }
 
 
 
 
 
 
 
 
 
 
45
  }
admin/controllers/BWGControllerWidgetSlideshow.php CHANGED
@@ -1,20 +1,9 @@
1
  <?php
2
 
3
  class BWGControllerWidgetSlideshow extends WP_Widget {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
  private $view;
14
  private $model;
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- // Constructor & Destructor //
17
- ////////////////////////////////////////////////////////////////////////////////////////
18
  public function __construct() {
19
  $widget_ops = array(
20
  'classname' => 'bwp_gallery_slideshow',
@@ -26,13 +15,9 @@ class BWGControllerWidgetSlideshow extends WP_Widget {
26
  parent::__construct('bwp_gallery_slideshow', 'Photo Gallery Slideshow', $widget_ops, $control_ops);
27
  require_once WD_BWG_DIR . "/admin/models/BWGModelWidgetSlideshow.php";
28
  $this->model = new BWGModelWidgetSlideshow();
29
-
30
  require_once WD_BWG_DIR . "/admin/views/BWGViewWidgetSlideshow.php";
31
  $this->view = new BWGViewWidgetSlideshow($this->model);
32
  }
33
- ////////////////////////////////////////////////////////////////////////////////////////
34
- // Public Methods //
35
- ////////////////////////////////////////////////////////////////////////////////////////
36
 
37
  public function widget($args, $instance) {
38
  $this->view->widget($args, $instance);
@@ -56,14 +41,4 @@ class BWGControllerWidgetSlideshow extends WP_Widget {
56
  $instance['enable_autoplay'] = $new_instance['enable_autoplay'];
57
  return $instance;
58
  }
59
-
60
- ////////////////////////////////////////////////////////////////////////////////////////
61
- // Getters & Setters //
62
- ////////////////////////////////////////////////////////////////////////////////////////
63
- ////////////////////////////////////////////////////////////////////////////////////////
64
- // Private Methods //
65
- ////////////////////////////////////////////////////////////////////////////////////////
66
- ////////////////////////////////////////////////////////////////////////////////////////
67
- // Listeners //
68
- ////////////////////////////////////////////////////////////////////////////////////////
69
  }
1
  <?php
2
 
3
  class BWGControllerWidgetSlideshow extends WP_Widget {
 
 
 
 
 
 
 
 
 
4
  private $view;
5
  private $model;
6
+
 
 
7
  public function __construct() {
8
  $widget_ops = array(
9
  'classname' => 'bwp_gallery_slideshow',
15
  parent::__construct('bwp_gallery_slideshow', 'Photo Gallery Slideshow', $widget_ops, $control_ops);
16
  require_once WD_BWG_DIR . "/admin/models/BWGModelWidgetSlideshow.php";
17
  $this->model = new BWGModelWidgetSlideshow();
 
18
  require_once WD_BWG_DIR . "/admin/views/BWGViewWidgetSlideshow.php";
19
  $this->view = new BWGViewWidgetSlideshow($this->model);
20
  }
 
 
 
21
 
22
  public function widget($args, $instance) {
23
  $this->view->widget($args, $instance);
41
  $instance['enable_autoplay'] = $new_instance['enable_autoplay'];
42
  return $instance;
43
  }
 
 
 
 
 
 
 
 
 
 
44
  }
admin/controllers/BWGControllerWidgetTags.php CHANGED
@@ -1,20 +1,10 @@
1
  <?php
2
 
3
  class BWGControllerWidgetTags extends WP_Widget {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
  private $view;
14
  private $model;
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- // Constructor & Destructor //
17
- ////////////////////////////////////////////////////////////////////////////////////////
18
  public function __construct() {
19
  $widget_ops = array(
20
  'classname' => 'bwp_gallery_tags',
@@ -30,9 +20,6 @@ class BWGControllerWidgetTags extends WP_Widget {
30
  require_once WD_BWG_DIR . "/admin/views/BWGViewWidgetTags.php";
31
  $this->view = new BWGViewWidgetTags($this->model);
32
  }
33
- ////////////////////////////////////////////////////////////////////////////////////////
34
- // Public Methods //
35
- ////////////////////////////////////////////////////////////////////////////////////////
36
 
37
  public function widget($args, $instance) {
38
  $this->view->widget($args, $instance);
@@ -57,14 +44,4 @@ class BWGControllerWidgetTags extends WP_Widget {
57
  $instance['theme_id'] = $new_instance['theme_id'];
58
  return $instance;
59
  }
60
-
61
- ////////////////////////////////////////////////////////////////////////////////////////
62
- // Getters & Setters //
63
- ////////////////////////////////////////////////////////////////////////////////////////
64
- ////////////////////////////////////////////////////////////////////////////////////////
65
- // Private Methods //
66
- ////////////////////////////////////////////////////////////////////////////////////////
67
- ////////////////////////////////////////////////////////////////////////////////////////
68
- // Listeners //
69
- ////////////////////////////////////////////////////////////////////////////////////////
70
  }
1
  <?php
2
 
3
  class BWGControllerWidgetTags extends WP_Widget {
4
+
 
 
 
 
 
 
 
 
5
  private $view;
6
  private $model;
7
+
 
 
8
  public function __construct() {
9
  $widget_ops = array(
10
  'classname' => 'bwp_gallery_tags',
20
  require_once WD_BWG_DIR . "/admin/views/BWGViewWidgetTags.php";
21
  $this->view = new BWGViewWidgetTags($this->model);
22
  }
 
 
 
23
 
24
  public function widget($args, $instance) {
25
  $this->view->widget($args, $instance);
44
  $instance['theme_id'] = $new_instance['theme_id'];
45
  return $instance;
46
  }
 
 
 
 
 
 
 
 
 
 
47
  }
admin/models/BWGModelAddTags.php CHANGED
@@ -1,25 +1,11 @@
1
  <?php
2
-
3
  class BWGModelAddTags {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
  private $per_page = 20;
14
- ////////////////////////////////////////////////////////////////////////////////////////
15
- // Constructor & Destructor //
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
  public function __construct() {
18
  $this->per_page = ((isset($_GET['bwg_items_per_page'])) ? esc_html($_GET['bwg_items_per_page']) : ((isset($_POST['bwg_items_per_page'])) ? esc_html($_POST['bwg_items_per_page']) : 20));
19
  }
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- // Public Methods //
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
 
24
  public function get_rows_data() {
25
  global $wpdb;
@@ -53,17 +39,8 @@ class BWGModelAddTags {
53
  $page_nav['limit'] = (int) ($limit / $this->per_page + 1);
54
  return $page_nav;
55
  }
56
- ////////////////////////////////////////////////////////////////////////////////////////
57
- // Getters & Setters //
58
- ////////////////////////////////////////////////////////////////////////////////////////
59
- public function per_page(){
60
- return $this->per_page;
61
 
 
 
62
  }
63
- ////////////////////////////////////////////////////////////////////////////////////////
64
- // Private Methods //
65
- ////////////////////////////////////////////////////////////////////////////////////////
66
- ////////////////////////////////////////////////////////////////////////////////////////
67
- // Listeners //
68
- ////////////////////////////////////////////////////////////////////////////////////////
69
  }
1
  <?php
 
2
  class BWGModelAddTags {
3
+
 
 
 
 
 
 
 
 
4
  private $per_page = 20;
5
+
 
 
6
  public function __construct() {
7
  $this->per_page = ((isset($_GET['bwg_items_per_page'])) ? esc_html($_GET['bwg_items_per_page']) : ((isset($_POST['bwg_items_per_page'])) ? esc_html($_POST['bwg_items_per_page']) : 20));
8
  }
 
 
 
9
 
10
  public function get_rows_data() {
11
  global $wpdb;
39
  $page_nav['limit'] = (int) ($limit / $this->per_page + 1);
40
  return $page_nav;
41
  }
 
 
 
 
 
42
 
43
+ public function per_page() {
44
+ return $this->per_page;
45
  }
 
 
 
 
 
 
46
  }
admin/models/BWGModelBWGShortcode.php CHANGED
@@ -1,27 +1,12 @@
1
  <?php
2
 
3
  class BWGModelBWGShortcode {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
 
22
  public function get_shortcode_data() {
23
  global $wpdb;
24
  $shortcode = $wpdb->get_results("SELECT id, tagtext FROM " . $wpdb->prefix . "bwg_shortcode ORDER BY `id` ASC");
 
25
  return $shortcode;
26
  }
27
 
@@ -58,14 +43,4 @@ class BWGModelBWGShortcode {
58
  $rows = $wpdb->get_results($query);
59
  return $rows;
60
  }
61
-
62
- ////////////////////////////////////////////////////////////////////////////////////////
63
- // Getters & Setters //
64
- ////////////////////////////////////////////////////////////////////////////////////////
65
- ////////////////////////////////////////////////////////////////////////////////////////
66
- // Private Methods //
67
- ////////////////////////////////////////////////////////////////////////////////////////
68
- ////////////////////////////////////////////////////////////////////////////////////////
69
- // Listeners //
70
- ////////////////////////////////////////////////////////////////////////////////////////
71
  }
1
  <?php
2
 
3
  class BWGModelBWGShortcode {
4
+ public function __construct() {}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  public function get_shortcode_data() {
7
  global $wpdb;
8
  $shortcode = $wpdb->get_results("SELECT id, tagtext FROM " . $wpdb->prefix . "bwg_shortcode ORDER BY `id` ASC");
9
+
10
  return $shortcode;
11
  }
12
 
43
  $rows = $wpdb->get_results($query);
44
  return $rows;
45
  }
 
 
 
 
 
 
 
 
 
 
46
  }
admin/models/BWGModelGalleries_bwg.php CHANGED
@@ -1,19 +1,8 @@
1
  <?php
2
-
3
  class BWGModelGalleries_bwg {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
  private $per_page = 20;
14
- ////////////////////////////////////////////////////////////////////////////////////////
15
- // Constructor & Destructor //
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
  public function __construct() {
18
  $user = get_current_user_id();
19
  $screen = get_current_screen();
@@ -26,9 +15,6 @@ class BWGModelGalleries_bwg {
26
 
27
  }
28
  }
29
- ////////////////////////////////////////////////////////////////////////////////////////
30
- // Public Methods //
31
- ////////////////////////////////////////////////////////////////////////////////////////
32
 
33
  public function get_image_rows_data($gallery_id) {
34
  global $wpdb;
@@ -178,17 +164,8 @@ class BWGModelGalleries_bwg {
178
  return $row;
179
  }
180
 
181
- ////////////////////////////////////////////////////////////////////////////////////////
182
- // Getters & Setters //
183
- ////////////////////////////////////////////////////////////////////////////////////////
184
  public function per_page(){
185
  return $this->per_page;
186
 
187
  }
188
- ////////////////////////////////////////////////////////////////////////////////////////
189
- // Private Methods //
190
- ////////////////////////////////////////////////////////////////////////////////////////
191
- ////////////////////////////////////////////////////////////////////////////////////////
192
- // Listeners //
193
- ////////////////////////////////////////////////////////////////////////////////////////
194
  }
1
  <?php
 
2
  class BWGModelGalleries_bwg {
3
+
 
 
 
 
 
 
 
 
4
  private $per_page = 20;
5
+
 
 
6
  public function __construct() {
7
  $user = get_current_user_id();
8
  $screen = get_current_screen();
15
 
16
  }
17
  }
 
 
 
18
 
19
  public function get_image_rows_data($gallery_id) {
20
  global $wpdb;
164
  return $row;
165
  }
166
 
 
 
 
167
  public function per_page(){
168
  return $this->per_page;
169
 
170
  }
 
 
 
 
 
 
171
  }
admin/views/BWGViewAddAlbumsGalleries.php CHANGED
@@ -53,7 +53,7 @@ class BWGViewAddAlbumsGalleries {
53
  </a>
54
  <div class="tablenav top">
55
  <?php
56
- WDWLibrary::search(__("Name", 'bwg_back'), $search_value, 'albums_galleries_form','position_search');
57
  WDWLibrary::html_page_nav($page_nav['total'],$pager++, $page_nav['limit'], 'albums_galleries_form', $per_page);
58
  ?>
59
  </div>
53
  </a>
54
  <div class="tablenav top">
55
  <?php
56
+ WDWLibrary::search(__('Name','bwg_back'), $search_value, 'albums_galleries_form', 'position_search');
57
  WDWLibrary::html_page_nav($page_nav['total'],$pager++, $page_nav['limit'], 'albums_galleries_form', $per_page);
58
  ?>
59
  </div>
admin/views/BWGViewAddTags.php CHANGED
@@ -1,27 +1,12 @@
1
  <?php
2
-
3
  class BWGViewAddTags {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
  private $model;
14
 
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
  public function __construct($model) {
20
  $this->model = $model;
21
  }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
  public function display() {
26
  $rows_data = $this->model->get_rows_data();
27
  $page_nav = $this->model->page_nav();
@@ -31,7 +16,7 @@ class BWGViewAddTags {
31
  $image_id = ((isset($_GET['image_id'])) ? esc_html($_GET['image_id']) : ((isset($_POST['image_id'])) ? esc_html($_POST['image_id']) : '0'));
32
  $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
33
  $per_page = $this->model->per_page();
34
- $pager = 0;
35
  wp_print_scripts('jquery');
36
  wp_print_styles('admin-bar');
37
  wp_print_styles('wp-admin');
@@ -47,18 +32,18 @@ class BWGViewAddTags {
47
  <?php wp_nonce_field( 'addTags', 'bwg_nonce' ); ?>
48
  <h2 style="width:200px; float:left;"><?php _e("Tags", 'bwg_back'); ?></h2>
49
  <a href="" class="thickbox thickbox-preview" id="content-add_media" title="Add Tag" onclick="bwg_get_tags('<?php echo $image_id; ?>', event);" style="float:right; padding: 9px 0px 4px 0">
50
- <div class="wd-btn wd-btn-primary wd-btn-icon wd-btn-add" style="border:none;padding-top:8px !important;">ADD </div>
51
  </a>
52
  <div class="tablenav top">
53
  <?php
54
- WDWLibrary::search(__('Name', 'bwg_back'), $search_value, 'tags_form','position_search');
55
  WDWLibrary::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'tags_form', $per_page);
56
  ?>
57
  </div>
58
  <table class="wp-list-table widefat fixed pages">
59
  <thead>
60
- <th class="manage-column column-cb check-column table_small_col"><input id="check_all" type="checkbox" style="margin:0;" /></th>
61
- <th class="sortable table_small_col <?php if ($order_by == 'term_id') {echo $order_class;} ?>" style="padding-left:15px">
62
  <a onclick="spider_set_input_value('order_by', 'term_id');
63
  spider_set_input_value('asc_or_desc', '<?php echo ((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (esc_html(stripslashes($_POST['order_by'])) == 'term_id') && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc') ? 'desc' : 'asc'); ?>');
64
  spider_form_submit(event, 'tags_form')" href="">
@@ -108,16 +93,7 @@ class BWGViewAddTags {
108
  </form>
109
  <script src="<?php echo get_admin_url(); ?>load-scripts.php?c=1&load%5B%5D=common,admin-bar" type="text/javascript"></script>
110
  <?php
 
111
  die();
112
  }
113
-
114
- ////////////////////////////////////////////////////////////////////////////////////////
115
- // Getters & Setters //
116
- ////////////////////////////////////////////////////////////////////////////////////////
117
- ////////////////////////////////////////////////////////////////////////////////////////
118
- // Private Methods //
119
- ////////////////////////////////////////////////////////////////////////////////////////
120
- ////////////////////////////////////////////////////////////////////////////////////////
121
- // Listeners //
122
- ////////////////////////////////////////////////////////////////////////////////////////
123
  }
1
  <?php
 
2
  class BWGViewAddTags {
3
+
 
 
 
 
 
 
 
 
4
  private $model;
5
 
 
 
 
 
6
  public function __construct($model) {
7
  $this->model = $model;
8
  }
9
+
 
 
10
  public function display() {
11
  $rows_data = $this->model->get_rows_data();
12
  $page_nav = $this->model->page_nav();
16
  $image_id = ((isset($_GET['image_id'])) ? esc_html($_GET['image_id']) : ((isset($_POST['image_id'])) ? esc_html($_POST['image_id']) : '0'));
17
  $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
18
  $per_page = $this->model->per_page();
19
+ $pager = 0;
20
  wp_print_scripts('jquery');
21
  wp_print_styles('admin-bar');
22
  wp_print_styles('wp-admin');
32
  <?php wp_nonce_field( 'addTags', 'bwg_nonce' ); ?>
33
  <h2 style="width:200px; float:left;"><?php _e("Tags", 'bwg_back'); ?></h2>
34
  <a href="" class="thickbox thickbox-preview" id="content-add_media" title="Add Tag" onclick="bwg_get_tags('<?php echo $image_id; ?>', event);" style="float:right; padding: 9px 0px 4px 0">
35
+ <div class="wd-btn wd-btn-primary wd-btn-icon wd-btn-add" style="border:none;padding-top:8px !important;">ADD </div>
36
  </a>
37
  <div class="tablenav top">
38
  <?php
39
+ WDWLibrary::search(__('Name','bwg_back'), $search_value, 'tags_form', 'position_search');
40
  WDWLibrary::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'tags_form', $per_page);
41
  ?>
42
  </div>
43
  <table class="wp-list-table widefat fixed pages">
44
  <thead>
45
+ <th class="sortable manage-column column-cb check-column table_small_col"><input id="check_all" type="checkbox" style="margin:0;" /></th>
46
+ <th class="sortable table_small_col <?php if ($order_by == 'term_id') {echo $order_class;} ?>" style="padding-left:15px;">
47
  <a onclick="spider_set_input_value('order_by', 'term_id');
48
  spider_set_input_value('asc_or_desc', '<?php echo ((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (esc_html(stripslashes($_POST['order_by'])) == 'term_id') && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc') ? 'desc' : 'asc'); ?>');
49
  spider_form_submit(event, 'tags_form')" href="">
93
  </form>
94
  <script src="<?php echo get_admin_url(); ?>load-scripts.php?c=1&load%5B%5D=common,admin-bar" type="text/javascript"></script>
95
  <?php
96
+
97
  die();
98
  }
 
 
 
 
 
 
 
 
 
 
99
  }
admin/views/BWGViewAlbums_bwg.php CHANGED
@@ -1,27 +1,11 @@
1
  <?php
2
-
3
  class BWGViewAlbums_bwg {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
  private $model;
14
 
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
  public function __construct($model) {
20
  $this->model = $model;
21
  }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
  public function display() {
26
  global $WD_BWG_UPLOAD_DIR;
27
  $rows_data = $this->model->get_rows_data();
@@ -33,44 +17,42 @@ class BWGViewAlbums_bwg {
33
  $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
34
  $ids_string = '';
35
  $per_page = $this->model->per_page();
36
- $pager = 0;
37
  $album_button_array = array(
38
  'publish_all' => __('Publish', 'bwg_back'),
39
  'unpublish_all' => __('Unpublish', 'bwg_back'),
40
  'delete_all' => __('Delete', 'bwg_back')
41
  );
42
  ?>
43
- <form class="wrap bwg_form" id="albums_form" method="post" action="admin.php?page=albums_bwg" style="float: left; width: 98%;">
44
- <?php wp_nonce_field( 'albums_bwg', 'bwg_nonce' ); ?>
45
  <div>
46
  <span class="album-icon"></span>
47
  <h2>
48
- <?php _e("Albums", 'bwg_back'); ?>
49
  <a href="" class="add-new-h2" onclick="spider_set_input_value('task', 'add');
50
- spider_form_submit(event, 'albums_form')"><?php _e("Add new", 'bwg_back'); ?></a>
51
  </h2>
52
  </div>
53
- <div id="draganddrop" class="wd_updated" style="display:none;"><strong><p><?php _e("Changes made in this table should be saved.", 'bwg_back'); ?></p></strong></div>
54
- <?php WDWLibrary::search(__('Name','bwg_back'), $search_value, 'albums_form',''); ?>
55
- <div class="tablenav top buttons_div buttons_div_left">
56
  <span class="wd-btn wd-btn-primary-gray bwg_check_all non_selectable" onclick="spider_check_all_items()">
57
  <input type="checkbox" id="check_all_items" name="check_all_items" onclick="spider_check_all_items_checkbox()" style="margin: 0; vertical-align: middle;" />
58
  <span style="vertical-align: middle;"><?php echo __('Select All', 'bwg_back'); ?></span>
59
  </span>
60
  <select class='select_icon bulk_action'>
61
- <option value=""><?php echo __("Bulk Actions"); ?></option>
62
- <?php
63
- foreach($album_button_array as $key => $value) {
64
- ?>
65
- <option value="<?php echo $key;?>">
66
- <?php echo $value;?>
67
- </option>
68
- <?php
69
- }
70
- ?>
71
  </select>
72
- <input class="wd-btn wd-btn-primary wd-btn-icon wd-btn-apply" type="button" title="<?php echo __("Apply","bwg_back"); ?>" onclick="if (!bwg_bulk_actions('.bulk_action', 'album_page')) {return false;}" value="<?php echo __("Apply","bwg_back"); ?>" />
73
- <?php WDWLibrary::html_page_nav($page_nav['total'],$pager++, $page_nav['limit'], 'albums_form', $per_page); ?>
74
  </div>
75
  <table class="wp-list-table widefat fixed pages">
76
  <thead>
@@ -225,8 +207,8 @@ class BWGViewAlbums_bwg {
225
  td_drag.setAttribute('title','Drag to re-order');
226
 
227
  var div_drag = document.createElement('div');
228
- div_drag.setAttribute('class', 'handle');
229
-
230
  td_drag.appendChild(div_drag);
231
  tr.appendChild(td_drag);
232
 
@@ -256,29 +238,29 @@ class BWGViewAlbums_bwg {
256
  tb_remove();
257
  }
258
  </script>
259
- <form class="wrap bwg_form" method="post" action="admin.php?page=albums_bwg" style="float: left; width: 98%;">
260
  <?php wp_nonce_field( 'albums_bwg', 'bwg_nonce' ); ?>
261
  <div>
262
  <span class="album-icon"></span>
263
  <h2><?php echo $page_title; ?></h2>
264
  </div>
265
  <div style="float:right;">
266
- <input class="wd-btn wd-btn-primary wd-btn-icon wd-btn-save" id='save_albums' type="submit" onclick="if(spider_check_required('name', 'Name')){return false;};spider_set_input_value('task', 'save')" value="<?php _e("Save", 'bwg_back'); ?>" />
267
- <input class="wd-btn wd-btn-primary wd-btn-icon wd-btn-apply" type="submit" onclick="if(spider_check_required('name', 'Name')){return false;};spider_set_input_value('task', 'apply')" value="<?php _e("Apply", 'bwg_back'); ?>" />
268
- <input class="wd-btn wd-btn-primary wd-btn-icon wd-btn-cancel" type="submit" onclick="spider_set_input_value('task', 'cancel')" value="<?php _e("Cancel", 'bwg_back'); ?>" />
269
  </div>
270
  <table style="clear:both;">
271
  <tbody>
272
  <tr>
273
- <td class="spider_label"><label for="name"><?php _e("Name:", 'bwg_back'); ?> <span style="color:#FF0000;">*</span> </label></td>
274
  <td><input type="text" id="name" name="name" value="<?php echo $row->name; ?>" size="39" class="bwg_requried"/></td>
275
  </tr>
276
  <tr>
277
- <td class="spider_label"><label for="slug"><?php _e("Slug:", 'bwg_back'); ?> </label></td>
278
- <td><input type="text" id="slug" name="slug" value="<?php echo $row->slug; ?>" size="39" /></td>
279
  </tr>
280
  <tr>
281
- <td class="spider_label"><label for="description"><?php _e("Description:", 'bwg_back'); ?> </label></td>
282
  <td>
283
  <div style="width:500px;">
284
  <?php
@@ -297,20 +279,20 @@ class BWGViewAlbums_bwg {
297
  </td>
298
  </tr>
299
  <tr>
300
- <td class="spider_label"><label><?php _e("Author:", 'bwg_back'); ?> </label></td>
301
  <td><?php echo get_userdata($row->author)->display_name; ?></td>
302
  </tr>
303
  <tr>
304
- <td class="spider_label"><label for="published1"><?php _e("Published:", 'bwg_back'); ?> </label></td>
305
  <td>
306
  <input type="radio" class="inputbox" id="published0" name="published" <?php echo (($row->published) ? '' : 'checked="checked"'); ?> value="0" >
307
- <label for="published0"><?php _e("No", 'bwg_back'); ?></label>
308
  <input type="radio" class="inputbox" id="published1" name="published" <?php echo (($row->published) ? 'checked="checked"' : ''); ?> value="1" >
309
- <label for="published1"><?php _e("Yes", 'bwg_back'); ?></label>
310
  </td>
311
  </tr>
312
  <tr>
313
- <td class="spider_label"><label for="url"><?php _e("Preview image:", 'bwg_back'); ?> </label></td>
314
  <td>
315
  <?php
316
  $query_url = add_query_arg(array('action' => 'addImages', 'width' => '700', 'height' => '550', 'extensions' => 'jpg,jpeg,png,gif', 'callback' => 'bwg_add_preview_image'), admin_url('admin-ajax.php'));
@@ -336,7 +318,7 @@ class BWGViewAlbums_bwg {
336
  </td>
337
  </tr>
338
  <tr>
339
- <td class="spider_label"><label for="content-add_media"><?php _e("Albums And Galleries:", 'bwg_back'); ?> </label></td>
340
  <td>
341
  <?php
342
  $query_url = add_query_arg(array('action' => 'addAlbumsGalleries', 'album_id' => $id, 'width' => '700', 'height' => '550', 'bwg_items_per_page'=>$per_page ), admin_url('admin-ajax.php'));
@@ -345,8 +327,8 @@ class BWGViewAlbums_bwg {
345
 
346
 
347
  ?>
348
- <a href="<?php echo $query_url; ?>" class="wd-btn wd-btn-primary wd-btn-icon wd-btn-add thickbox thickbox-preview" id="content-add_media" title="Add Images" onclick="return false;">
349
- <?php _e("Add Albums/Galleries", 'bwg_back'); ?>
350
  </a>
351
  <?php $albums_galleries = $this->model->get_albums_galleries_rows_data($id) ?>
352
  <table id="table_albums_galleries" class="widefat spider_table" <?php echo (($albums_galleries) ? '' : 'style="display:none;"'); ?>>
@@ -358,7 +340,7 @@ class BWGViewAlbums_bwg {
358
  if ($alb_gal) {
359
  ?>
360
  <tr id="tr_<?php echo $alb_gal->id . ":" . $alb_gal->is_album . ":" . $alb_gal->alb_gal_id ?>" style="height:35px;">
361
- <td class="connectedSortable table_small_col" title="<?php _e("Drag to re-order", 'bwg_back'); ?>"><div class="handle"></div></td>
362
  <td style="max-width:420px; min-width:400px;"><?php echo ($alb_gal->is_album ? 'Album: ' : 'Gallery: ') . $alb_gal->name; ?></td>
363
  <td class="table_small_col">
364
  <span class="spider_delete_img" onclick="spider_remove_row('tbody_albums_galleries', event, this)"/>
@@ -394,13 +376,5 @@ class BWGViewAlbums_bwg {
394
  </form>
395
  <?php
396
  }
397
- ////////////////////////////////////////////////////////////////////////////////////////
398
- // Getters & Setters //
399
- ////////////////////////////////////////////////////////////////////////////////////////
400
- ////////////////////////////////////////////////////////////////////////////////////////
401
- // Private Methods //
402
- ////////////////////////////////////////////////////////////////////////////////////////
403
- ////////////////////////////////////////////////////////////////////////////////////////
404
- // Listeners //
405
- ////////////////////////////////////////////////////////////////////////////////////////
406
  }
1
  <?php
 
2
  class BWGViewAlbums_bwg {
3
+
 
 
 
 
 
 
 
 
4
  private $model;
5
 
 
 
 
 
6
  public function __construct($model) {
7
  $this->model = $model;
8
  }
 
 
 
9
  public function display() {
10
  global $WD_BWG_UPLOAD_DIR;
11
  $rows_data = $this->model->get_rows_data();
17
  $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
18
  $ids_string = '';
19
  $per_page = $this->model->per_page();
20
+ $pager = 0;
21
  $album_button_array = array(
22
  'publish_all' => __('Publish', 'bwg_back'),
23
  'unpublish_all' => __('Unpublish', 'bwg_back'),
24
  'delete_all' => __('Delete', 'bwg_back')
25
  );
26
  ?>
27
+ <form class="wrap bwg_form" id="albums_form" method="post" action="admin.php?page=albums_bwg" style="width: 98%; float: left;">
28
+ <?php wp_nonce_field( 'albums_bwg', 'bwg_nonce' ); ?>
29
  <div>
30
  <span class="album-icon"></span>
31
  <h2>
32
+ <?php _e('Albums', 'bwg_back'); ?>
33
  <a href="" class="add-new-h2" onclick="spider_set_input_value('task', 'add');
34
+ spider_form_submit(event, 'albums_form')"><?php _e('Add new', 'bwg_back'); ?></a>
35
  </h2>
36
  </div>
37
+ <div id="draganddrop" class="wd_updated" style="display:none;"><strong><p><?php _e('Changes made in this table should be saved.', 'bwg_back'); ?></p></strong></div>
38
+ <?php WDWLibrary::search(__('Name', 'bwg_back'), $search_value, 'albums_form',''); ?>
39
+ <div class="tablenav top buttons_div buttons_div_left">
40
  <span class="wd-btn wd-btn-primary-gray bwg_check_all non_selectable" onclick="spider_check_all_items()">
41
  <input type="checkbox" id="check_all_items" name="check_all_items" onclick="spider_check_all_items_checkbox()" style="margin: 0; vertical-align: middle;" />
42
  <span style="vertical-align: middle;"><?php echo __('Select All', 'bwg_back'); ?></span>
43
  </span>
44
  <select class='select_icon bulk_action'>
45
+ <option value=""><?php _e('Bulk Actions', 'bwg_back'); ?></option>
46
+ <?php
47
+ foreach ($album_button_array as $key => $value) {
48
+ ?>
49
+ <option value="<?php echo $key; ?>"><?php echo $value; ?></option>
50
+ <?php
51
+ }
52
+ ?>
 
 
53
  </select>
54
+ <input class="wd-btn wd-btn-primary wd-btn-icon wd-btn-apply" type="button" title="<?php _e("Apply", "bwg_back"); ?>" onclick="if (!bwg_bulk_actions('.bulk_action', 'album_page')) {return false;}" value="<?php _e("Apply", "bwg_back"); ?>" />
55
+ <?php WDWLibrary::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'albums_form', $per_page); ?>
56
  </div>
57
  <table class="wp-list-table widefat fixed pages">
58
  <thead>
207
  td_drag.setAttribute('title','Drag to re-order');
208
 
209
  var div_drag = document.createElement('div');
210
+ div_drag.setAttribute('class', 'bwg_img_handle handle');
211
+ div_drag.setAttribute('style','margin-left:10px;');
212
  td_drag.appendChild(div_drag);
213
  tr.appendChild(td_drag);
214
 
238
  tb_remove();
239
  }
240
  </script>
241
+ <form class="wrap bwg_form" method="post" action="admin.php?page=albums_bwg" style="width: 98%; float: left;">
242
  <?php wp_nonce_field( 'albums_bwg', 'bwg_nonce' ); ?>
243
  <div>
244
  <span class="album-icon"></span>
245
  <h2><?php echo $page_title; ?></h2>
246
  </div>
247
  <div style="float:right;">
248
+ <input id="save_albums" class="wd-btn wd-btn-primary wd-btn-icon wd-btn-save" type="submit" onclick="if(spider_check_required('name', 'Name')){return false;};spider_set_input_value('task', 'save')" value="<?php echo __('Save', 'bwg_back'); ?>" />
249
+ <input class="wd-btn wd-btn-primary wd-btn-icon wd-btn-apply" type="submit" onclick="if(spider_check_required('name', 'Name')){return false;};spider_set_input_value('task', 'apply')" value="<?php echo __('Apply', 'bwg_back'); ?>" />
250
+ <input class="wd-btn wd-btn-primary wd-btn-icon wd-btn-cancel" type="submit" onclick="spider_set_input_value('task', 'cancel')" value="<?php echo __('Cancel', 'bwg_back'); ?>" />
251
  </div>
252
  <table style="clear:both;">
253
  <tbody>
254
  <tr>
255
+ <td class="spider_label"><label for="name"><?php _e('Name:', 'bwg_back'); ?> <span style="color:#FF0000;">*</span> </label></td>
256
  <td><input type="text" id="name" name="name" value="<?php echo $row->name; ?>" size="39" class="bwg_requried"/></td>
257
  </tr>
258
  <tr>
259
+ <td class="spider_label"><label for="slug"><?php _e('Slug:', 'bwg_back'); ?> </label></td>
260
+ <td><input type="text" id="slug" name="slug" value="<?php echo $row->slug; ?>" size="39" /><input type="hidden" id="old_slug" name="old_slug" value="<?php echo $row->slug; ?>" size="39" /></td>
261
  </tr>
262
  <tr>
263
+ <td class="spider_label"><label for="description"><?php _e('Description:', 'bwg_back'); ?> </label></td>
264
  <td>
265
  <div style="width:500px;">
266
  <?php
279
  </td>
280
  </tr>
281
  <tr>
282
+ <td class="spider_label"><label><?php _e('Author:', 'bwg_back'); ?> </label></td>
283
  <td><?php echo get_userdata($row->author)->display_name; ?></td>
284
  </tr>
285
  <tr>
286
+ <td class="spider_label"><label for="published1"><?php _e('Published:', 'bwg_back'); ?> </label></td>
287
  <td>
288
  <input type="radio" class="inputbox" id="published0" name="published" <?php echo (($row->published) ? '' : 'checked="checked"'); ?> value="0" >
289
+ <label for="published0"><?php _e('No', 'bwg_back'); ?></label>
290
  <input type="radio" class="inputbox" id="published1" name="published" <?php echo (($row->published) ? 'checked="checked"' : ''); ?> value="1" >
291
+ <label for="published1"><?php _e('Yes', 'bwg_back'); ?></label>
292
  </td>
293
  </tr>
294
  <tr>
295
+ <td class="spider_label"><label for="url"><?php _e('Preview image:', 'bwg_back'); ?> </label></td>
296
  <td>
297
  <?php
298
  $query_url = add_query_arg(array('action' => 'addImages', 'width' => '700', 'height' => '550', 'extensions' => 'jpg,jpeg,png,gif', 'callback' => 'bwg_add_preview_image'), admin_url('admin-ajax.php'));
318
  </td>
319
  </tr>
320
  <tr>
321
+ <td class="spider_label"><label for="content-add_media"><?php _e('Albums And Galleries:', 'bwg_back'); ?> </label></td>
322
  <td>
323
  <?php
324
  $query_url = add_query_arg(array('action' => 'addAlbumsGalleries', 'album_id' => $id, 'width' => '700', 'height' => '550', 'bwg_items_per_page'=>$per_page ), admin_url('admin-ajax.php'));
327
 
328
 
329
  ?>
330
+ <a href="<?php echo $query_url; ?>" class="wd-btn wd-btn-primary wd-btn-icon wd-btn-add thickbox thickbox-preview" id="content-add_media" title="<?php echo __("Add Images", 'bwg_back'); ?>" onclick="return false;">
331
+ <?php _e('Add Albums/Galleries', 'bwg_back'); ?>
332
  </a>
333
  <?php $albums_galleries = $this->model->get_albums_galleries_rows_data($id) ?>
334
  <table id="table_albums_galleries" class="widefat spider_table" <?php echo (($albums_galleries) ? '' : 'style="display:none;"'); ?>>
340
  if ($alb_gal) {
341
  ?>
342
  <tr id="tr_<?php echo $alb_gal->id . ":" . $alb_gal->is_album . ":" . $alb_gal->alb_gal_id ?>" style="height:35px;">
343
+ <td class="connectedSortable table_small_col" title="<?php _e('Drag to re-order', 'bwg_back'); ?>"><div class="handle"></div></td>
344
  <td style="max-width:420px; min-width:400px;"><?php echo ($alb_gal->is_album ? 'Album: ' : 'Gallery: ') . $alb_gal->name; ?></td>
345
  <td class="table_small_col">
346
  <span class="spider_delete_img" onclick="spider_remove_row('tbody_albums_galleries', event, this)"/>
376
  </form>
377
  <?php
378
  }
379
+
 
 
 
 
 
 
 
 
380
  }
admin/views/BWGViewBWGShortcode.php CHANGED
@@ -1,27 +1,12 @@
1
  <?php
2
-
3
  class BWGViewBWGShortcode {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- private $model;
14
-
15
 
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
  public function __construct($model) {
20
  $this->model = $model;
21
  }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
  public function display() {
26
  $gallery_rows = $this->model->get_gallery_rows_data();
27
  $album_rows = $this->model->get_album_rows_data();
@@ -77,7 +62,7 @@ class BWGViewBWGShortcode {
77
  ?>
78
  <html xmlns="http://www.w3.org/1999/xhtml">
79
  <head>
80
- <title><?php _e("Photo Gallery", 'bwg_back'); ?></title>
81
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
82
  <?php
83
  wp_print_scripts('jquery');
@@ -242,7 +227,7 @@ class BWGViewBWGShortcode {
242
  </div>
243
  <hr class="bwg_hr_shortcode" />
244
  <div class="bwg_short_div type_them" style="border-right: 1px solid #000000;">
245
- <div style="display:table;width:100%;">
246
  <div style="display:table-cell;">
247
  <div class="gallery_album_option_left">
248
  <table style="display:inline-block;">
@@ -250,8 +235,8 @@ class BWGViewBWGShortcode {
250
  <tr id="tr_theme">
251
  <td <?php echo (get_option("wd_bwg_theme_version") ? 'title="This option is disabled in free version." class="spider_label spider_free_version_label"' : 'class="spider_label"'); ?>><label for="theme"><?php _e("Theme:", 'bwg_back'); ?> </label></td>
252
  <td>
253
- <select name="theme" class="select_icon" id="theme" style="width:150px;" <?php echo (get_option("wd_bwg_theme_version") ? 'disabled="disabled"' : ''); ?>>
254
- <option value="0" selected="selected"><?php _e("Select Theme", 'bwg_back'); ?></option>
255
  <?php
256
  foreach ($theme_rows as $theme_row) {
257
  ?>
@@ -263,10 +248,10 @@ class BWGViewBWGShortcode {
263
  </td>
264
  </tr>
265
  <tr id="tr_gallery">
266
- <td class="spider_label"><label for="gallery"><?php _e("Gallery:", 'bwg_back'); ?> </label></td>
267
  <td>
268
- <select name="gallery" class="select_icon" id="gallery" style="width:150px;">
269
- <option value="0" selected="selected"><?php _e("All Galleries", 'bwg_back'); ?></option>
270
  <?php
271
  foreach ($gallery_rows as $gallery_row) {
272
  ?>
@@ -278,10 +263,10 @@ class BWGViewBWGShortcode {
278
  </td>
279
  </tr>
280
  <tr id="tr_album">
281
- <td title="<?php _e('The selected album expanded content will be displayed.', 'bwg_back'); ?>" class="spider_label"><label for="album"><?php _e("Album:", 'bwg_back'); ?> </label></td>
282
  <td>
283
- <select name="album" class="select_icon" id="album" style="width:150px;">
284
- <option value="0" selected="selected"><?php _e("Select Album", 'bwg_back'); ?></option>
285
  <?php
286
  foreach ($album_rows as $album_row) {
287
  ?>
@@ -293,25 +278,25 @@ class BWGViewBWGShortcode {
293
  </td>
294
  </tr>
295
  <tr id="tr_sort_by">
296
- <td class="spider_label"><label for="sort_by"><?php _e("Sort images by:", 'bwg_back'); ?> </label></td>
297
- <td>
298
- <select name="sort_by" class="select_icon" id="sort_by" style="width:150px;">
299
- <option value="order" selected="selected"><?php _e("Order", 'bwg_back'); ?></option>
300
- <option value="alt"><?php _e("Title", 'bwg_back'); ?></option>
301
- <option value="date"><?php _e("Date", 'bwg_back'); ?></option>
302
- <option value="filename"><?php _e("Filename", 'bwg_back'); ?></option>
303
- <option value="size"><?php _e("Size", 'bwg_back'); ?></option>
304
- <option value="filetype"><?php _e("Type", 'bwg_back'); ?></option>
305
- <option value="resolution"><?php _e("Resolution", 'bwg_back'); ?></option>
306
- <option value="random"><?php _e("Random", 'bwg_back'); ?></option>
307
  </select>
308
  </td>
309
  </tr>
310
  <tr id="tr_tag">
311
- <td class="spider_label"><label for="gallery"><?php echo __('Tag:', 'bwg_back'); ?> </label></td>
312
  <td>
313
  <select name="tag" id="tag" class="select_icon" style="width:150px;">
314
- <option value="0" selected="selected"><?php echo __('All Tags', 'bwg_back'); ?></option>
315
  <?php
316
  foreach ($tag_rows as $tag_row) {
317
  ?>
@@ -1195,11 +1180,11 @@ class BWGViewBWGShortcode {
1195
  <input type="button" class="wd-btn wd-btn-primary wd-btn-icon wd-btn-import" id="import" name="import" value="<?php echo __("Import", 'bwg_back'); ?>" onclick="bwg_update_shortcode()" />
1196
  <div>
1197
  <input type="text" size="55" id="bwg_shortcode" name="bwg_shortcode" value='<?php echo $tagtext; ?>' onclick="bwg_onKeyDown(event)" />
1198
- <b><?php _e("Shortcode", 'bwg_back'); ?></b>
1199
  </div>
1200
  <div>
1201
  <input type="text" size="55" id="bwg_function" name="bwg_function" value="<?php echo $tagfunction; ?>" onclick="spider_select_value(this)" readonly="readonly" />
1202
- <b><?php _e("PHP function", 'bwg_back'); ?></b>
1203
  </div>
1204
  </span>
1205
  </div>
@@ -1267,7 +1252,22 @@ class BWGViewBWGShortcode {
1267
  jQuery('#insert').attr('onclick', "bwg_insert_shortcode(content)");
1268
  jQuery("select[id=theme] option[value='" + short_code['theme_id'] + "']").attr('selected', 'selected');
1269
  jQuery("select[id=gallery_types_name] option[value='" + short_code['gallery_type'] + "']").attr('selected', 'selected');
1270
- switch (short_code['gallery_type']) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1271
  case 'thumbnails': {
1272
  jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
1273
  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
@@ -1400,7 +1400,6 @@ class BWGViewBWGShortcode {
1400
  jQuery("#slideshow_music_no").attr('checked', 'checked');
1401
  }
1402
  break;
1403
-
1404
  }
1405
  case 'image_browser': {
1406
  jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
@@ -1528,7 +1527,6 @@ class BWGViewBWGShortcode {
1528
  else {
1529
  jQuery("#show_tag_box_0").attr('checked', 'checked');
1530
  }
1531
- jQuery("#compuct_album_mosaic_total_width").val(short_code['compuct_album_mosaic_total_width']);
1532
  if (short_code['show_gallery_description'] == 1) {
1533
  jQuery("#show_gallery_description_1").attr('checked', 'checked');
1534
  }
@@ -1541,6 +1539,7 @@ class BWGViewBWGShortcode {
1541
  else {
1542
  jQuery("#show_album_name_0").attr('checked', 'checked');
1543
  }
 
1544
  break;
1545
 
1546
  }
@@ -1896,6 +1895,8 @@ class BWGViewBWGShortcode {
1896
  var title = "";
1897
  var short_code = '[Best_Wordpress_Gallery';
1898
  var tagtext = ' gallery_type="' + gallery_type + '" theme_id="' + theme + '"';
 
 
1899
  switch (gallery_type) {
1900
  case 'thumbnails': {
1901
  tagtext += ' gallery_id="' + jQuery("#gallery").val() + '"';
@@ -1986,7 +1987,7 @@ class BWGViewBWGShortcode {
1986
  tagtext += ' compuct_album_load_more_image_count="' + jQuery("#compuct_album_load_more_image_count").val() + '"';
1987
  tagtext += ' compuct_albums_per_page_load_more="' + jQuery("#compuct_albums_per_page_load_more").val() + '"';
1988
  tagtext += ' show_tag_box="' + jQuery("input[name=show_tag_box]:checked").val() + '"';
1989
- title = ' gal_title="' + jQuery.trim(jQuery('#album option:selected').text().replace("'", "").replace('"', '')) + '"';
1990
  tagtext += ' show_gallery_description="' + jQuery("input[name=show_gallery_description]:checked").val() + '"';
1991
  tagtext += ' show_album_name="' + jQuery("input[name=show_album_name]:checked").val() + '"';
1992
  break;
@@ -2100,7 +2101,10 @@ class BWGViewBWGShortcode {
2100
  post_data['currrent_id'] = shortcode_id;
2101
  post_data['title'] = title;
2102
  post_data['bwg_insert'] = (content && !bwg_insert) ? 0 : 1;
2103
- jQuery.post(
 
 
 
2104
  url,
2105
  post_data
2106
  ).success(function (data, textStatus, errorThrown) {
@@ -2113,7 +2117,7 @@ class BWGViewBWGShortcode {
2113
  });
2114
  <?php } ?>
2115
  }
2116
- jQuery(document).ready(function () {
2117
  bwg_loadmore();
2118
  bwg_change_tab();
2119
  });
@@ -2131,18 +2135,8 @@ class BWGViewBWGShortcode {
2131
  <?php
2132
  include_once (WD_BWG_DIR .'/includes/bwg_pointers.php');
2133
  new BWG_pointers();
2134
- if (!$from_menu) {
2135
  die();
2136
  }
2137
  }
2138
-
2139
- ////////////////////////////////////////////////////////////////////////////////////////
2140
- // Getters & Setters //
2141
- ////////////////////////////////////////////////////////////////////////////////////////
2142
- ////////////////////////////////////////////////////////////////////////////////////////
2143
- // Private Methods //
2144
- ////////////////////////////////////////////////////////////////////////////////////////
2145
- ////////////////////////////////////////////////////////////////////////////////////////
2146
- // Listeners //
2147
- ////////////////////////////////////////////////////////////////////////////////////////
2148
  }
1
  <?php
 
2
  class BWGViewBWGShortcode {
 
 
 
 
 
 
 
 
 
 
 
3
 
4
+ private $model;
5
+
 
6
  public function __construct($model) {
7
  $this->model = $model;
8
  }
9
+
 
 
10
  public function display() {
11
  $gallery_rows = $this->model->get_gallery_rows_data();
12
  $album_rows = $this->model->get_album_rows_data();
62
  ?>
63
  <html xmlns="http://www.w3.org/1999/xhtml">
64
  <head>
65
+ <title><?php _e('Photo Gallery', 'bwg_back'); ?></title>
66
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
67
  <?php
68
  wp_print_scripts('jquery');
227
  </div>
228
  <hr class="bwg_hr_shortcode" />
229
  <div class="bwg_short_div type_them" style="border-right: 1px solid #000000;">
230
+ <div style="width:100%;display:table;">
231
  <div style="display:table-cell;">
232
  <div class="gallery_album_option_left">
233
  <table style="display:inline-block;">
235
  <tr id="tr_theme">
236
  <td <?php echo (get_option("wd_bwg_theme_version") ? 'title="This option is disabled in free version." class="spider_label spider_free_version_label"' : 'class="spider_label"'); ?>><label for="theme"><?php _e("Theme:", 'bwg_back'); ?> </label></td>
237
  <td>
238
+ <select name="theme" id="theme" class="select_icon" style="width:150px;" <?php echo (get_option("wd_bwg_theme_version") ? 'disabled="disabled"' : ''); ?>>
239
+ <option value="0"><?php echo __('Select Theme', 'bwg_back'); ?></option>
240
  <?php
241
  foreach ($theme_rows as $theme_row) {
242
  ?>
248
  </td>
249
  </tr>
250
  <tr id="tr_gallery">
251
+ <td class="spider_label"><label for="gallery"><?php _e('Gallery:', 'bwg_back'); ?> </label></td>
252
  <td>
253
+ <select name="gallery" id="gallery" class="select_icon" style="width:150px;">
254
+ <option value="0"><?php _e('All Galleries', 'bwg_back'); ?></option>
255
  <?php
256
  foreach ($gallery_rows as $gallery_row) {
257
  ?>
263
  </td>
264
  </tr>
265
  <tr id="tr_album">
266
+ <td title="<?php _e('The selected album expanded content will be displayed.', 'bwg_back'); ?>" class="spider_label"><label for="album"><?php echo __('Album:', 'bwg_back'); ?> </label></td>
267
  <td>
268
+ <select name="album" id="album" class="select_icon" style="width:150px;">
269
+ <option value="0" selected="selected"><?php _e('Select Album', 'bwg_back'); ?></option>
270
  <?php
271
  foreach ($album_rows as $album_row) {
272
  ?>
278
  </td>
279
  </tr>
280
  <tr id="tr_sort_by">
281
+ <td class="spider_label"><label for="sort_by"><?php _e('Sort images by:', 'bwg_back'); ?> </label></td>
282
+ <td>
283
+ <select name="sort_by" id="sort_by" class="select_icon" style="width:150px;">
284
+ <option value="order" selected="selected"><?php _e('Order', 'bwg_back'); ?></option>
285
+ <option value="alt"><?php _e('Title', 'bwg_back'); ?></option>
286
+ <option value="date"><?php _e('Date', 'bwg_back'); ?></option>
287
+ <option value="filename"><?php _e('Filename', 'bwg_back'); ?></option>
288
+ <option value="size"><?php _e('Size', 'bwg_back'); ?></option>
289
+ <option value="filetype"><?php _e('Type', 'bwg_back'); ?></option>
290
+ <option value="resolution"><?php _e('Resolution', 'bwg_back'); ?></option>
291
+ <option value="random"><?php _e('Random', 'bwg_back'); ?></option>
292
  </select>
293
  </td>
294
  </tr>
295
  <tr id="tr_tag">
296
+ <td class="spider_label"><label for="tag"><?php echo __('Tag:', 'bwg_back'); ?> </label></td>
297
  <td>
298
  <select name="tag" id="tag" class="select_icon" style="width:150px;">
299
+ <option value="0"><?php _e('All Tags', 'bwg_back'); ?></option>
300
  <?php
301
  foreach ($tag_rows as $tag_row) {
302
  ?>
1180
  <input type="button" class="wd-btn wd-btn-primary wd-btn-icon wd-btn-import" id="import" name="import" value="<?php echo __("Import", 'bwg_back'); ?>" onclick="bwg_update_shortcode()" />
1181
  <div>
1182
  <input type="text" size="55" id="bwg_shortcode" name="bwg_shortcode" value='<?php echo $tagtext; ?>' onclick="bwg_onKeyDown(event)" />
1183
+ <b><?php _e('Shortcode', 'bwg_back'); ?></b>
1184
  </div>
1185
  <div>
1186
  <input type="text" size="55" id="bwg_function" name="bwg_function" value="<?php echo $tagfunction; ?>" onclick="spider_select_value(this)" readonly="readonly" />
1187
+ <b><?php _e('PHP function', 'bwg_back'); ?></b>
1188
  </div>
1189
  </span>
1190
  </div>
1252
  jQuery('#insert').attr('onclick', "bwg_insert_shortcode(content)");
1253
  jQuery("select[id=theme] option[value='" + short_code['theme_id'] + "']").attr('selected', 'selected');
1254
  jQuery("select[id=gallery_types_name] option[value='" + short_code['gallery_type'] + "']").attr('selected', 'selected');
1255
+ if ( short_code['use_option_defaults'] == 1 ) {
1256
+ switch ( short_code['type'] ) {
1257
+ case 'gallery': {
1258
+ jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
1259
+ break;
1260
+ }
1261
+ case 'album': {
1262
+ jQuery("select[id=album] option[value='" + short_code['album_id'] + "']").attr('selected', 'selected');
1263
+ break;
1264
+ }
1265
+ }
1266
+ jQuery("select[id=tag] option[value='" + short_code['tag'] + "']").attr('selected', 'selected');
1267
+ bwg_gallery_type(short_code['gallery_type']);
1268
+ return false;
1269
+ }
1270
+ switch (short_code['gallery_type']) {
1271
  case 'thumbnails': {
1272
  jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
1273
  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
1400
  jQuery("#slideshow_music_no").attr('checked', 'checked');
1401
  }
1402
  break;
 
1403
  }
1404
  case 'image_browser': {
1405
  jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
1527
  else {
1528
  jQuery("#show_tag_box_0").attr('checked', 'checked');
1529
  }
 
1530
  if (short_code['show_gallery_description'] == 1) {
1531
  jQuery("#show_gallery_description_1").attr('checked', 'checked');
1532
  }
1539
  else {
1540
  jQuery("#show_album_name_0").attr('checked', 'checked');
1541
  }
1542
+ jQuery("#compuct_album_mosaic_total_width").val(short_code['compuct_album_mosaic_total_width']);
1543
  break;
1544
 
1545
  }
1895
  var title = "";
1896
  var short_code = '[Best_Wordpress_Gallery';
1897
  var tagtext = ' gallery_type="' + gallery_type + '" theme_id="' + theme + '"';
1898
+ // TODO need works (this value get dinamic).
1899
+ tagtext += ' use_option_defaults="0"';
1900
  switch (gallery_type) {
1901
  case 'thumbnails': {
1902
  tagtext += ' gallery_id="' + jQuery("#gallery").val() + '"';
1987
  tagtext += ' compuct_album_load_more_image_count="' + jQuery("#compuct_album_load_more_image_count").val() + '"';
1988
  tagtext += ' compuct_albums_per_page_load_more="' + jQuery("#compuct_albums_per_page_load_more").val() + '"';
1989
  tagtext += ' show_tag_box="' + jQuery("input[name=show_tag_box]:checked").val() + '"';
1990
+ title = ' gal_title="' + jQuery.trim(jQuery('#album option:selected').text().replace("'", "").replace('"', '')) + '"';
1991
  tagtext += ' show_gallery_description="' + jQuery("input[name=show_gallery_description]:checked").val() + '"';
1992
  tagtext += ' show_album_name="' + jQuery("input[name=show_album_name]:checked").val() + '"';
1993
  break;
2101
  post_data['currrent_id'] = shortcode_id;
2102
  post_data['title'] = title;
2103
  post_data['bwg_insert'] = (content && !bwg_insert) ? 0 : 1;
2104
+ // TODO need works (this value get dinamic).
2105
+ post_data['use_option_defaults'] = 0;
2106
+
2107
+ jQuery.post(
2108
  url,
2109
  post_data
2110
  ).success(function (data, textStatus, errorThrown) {
2117
  });
2118
  <?php } ?>
2119
  }
2120
+ jQuery(document).ready(function () {
2121
  bwg_loadmore();
2122
  bwg_change_tab();
2123
  });
2135
  <?php
2136
  include_once (WD_BWG_DIR .'/includes/bwg_pointers.php');
2137
  new BWG_pointers();
2138
+ if ( !$from_menu ) {
2139
  die();
2140
  }
2141
  }
 
 
 
 
 
 
 
 
 
 
2142
  }
admin/views/BWGViewGalleries_bwg.php CHANGED
@@ -1,27 +1,12 @@
1
  <?php
2
-
3
  class BWGViewGalleries_bwg {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
  private $model;
14
-
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
  public function __construct($model) {
20
  $this->model = $model;
21
  }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
  public function display() {
26
  global $WD_BWG_UPLOAD_DIR;
27
  $rows_data = $this->model->get_rows_data();
@@ -39,14 +24,14 @@ class BWGViewGalleries_bwg {
39
  'delete_all' => __('Delete', 'bwg_back')
40
  );
41
  ?>
42
- <form class="wrap bwg_form" id="galleries_form" method="post" action="admin.php?page=galleries_bwg" style="float: left; width: 98%;">
43
- <?php wp_nonce_field( 'galleries_bwg', 'bwg_nonce' ); ?>
44
  <div>
45
  <span class="gallery-icon"></span>
46
  <h2>
47
  <?php _e("Galleries", 'bwg_back'); ?>
48
- <a href="" id="galleries_id" class="add-new-h2" onclick="spider_set_input_value('task', 'add');
49
- spider_form_submit(event, 'galleries_form')"><?php _e("Add new", 'bwg_back'); ?></a>
50
  </h2>
51
  </div>
52
  <div id="draganddrop" class="wd_updated" style="display:none;"><strong><p><?php _e("Changes made in this table should be saved.", 'bwg_back'); ?></p></strong></div>
@@ -532,12 +517,15 @@ class BWGViewGalleries_bwg {
532
  <table style="clear:both; width:99.9%">
533
  <tbody>
534
  <tr>
535
- <td class="spider_label_galleries"><label for="name"><?php _e("Name:", 'bwg_back'); ?> <span style="color:#FF0000;">*</span> </label></td>
536
  <td><input type="text" id="name" name="name" value="<?php echo $row->name; ?>" size="39" class="bwg_requried"/></td>
537
  </tr>
538
  <tr>
539
- <td class="spider_label_galleries"><label for="slug"><?php _e("Slug:", 'bwg_back'); ?> </label></td>
540
- <td><input type="text" id="slug" name="slug" value="<?php echo $row->slug; ?>" size="39" /></td>
 
 
 
541
  </tr>
542
  <tr>
543
  <td class="spider_label_galleries"><label for="gallery_type" ><?php _e("Gallery content type:", 'bwg_back'); ?> </label></td>
1
  <?php
 
2
  class BWGViewGalleries_bwg {
3
+
 
 
 
 
 
 
 
 
4
  private $model;
5
+
 
 
 
 
6
  public function __construct($model) {
7
  $this->model = $model;
8
  }
9
+
 
 
10
  public function display() {
11
  global $WD_BWG_UPLOAD_DIR;
12
  $rows_data = $this->model->get_rows_data();
24
  'delete_all' => __('Delete', 'bwg_back')
25
  );
26
  ?>
27
+ <form class="wrap bwg_form" id="galleries_form" method="post" action="admin.php?page=galleries_bwg" style="width: 98%; float: left;">
28
+ <?php wp_nonce_field( 'galleries_bwg', 'bwg_nonce' ); ?>
29
  <div>
30
  <span class="gallery-icon"></span>
31
  <h2>
32
  <?php _e("Galleries", 'bwg_back'); ?>
33
+ <a href="" id="galleries_id" class="add-new-h2" onclick="spider_set_input_value('task', 'add');
34
+ spider_form_submit(event, 'galleries_form')"><?php _e('Add new', 'bwg_back'); ?></a>
35
  </h2>
36
  </div>
37
  <div id="draganddrop" class="wd_updated" style="display:none;"><strong><p><?php _e("Changes made in this table should be saved.", 'bwg_back'); ?></p></strong></div>
517
  <table style="clear:both; width:99.9%">
518
  <tbody>
519
  <tr>
520
+ <td class="spider_label_galleries"><label for="name"><?php _e('Name:', 'bwg_back'); ?> <span style="color:#FF0000;">*</span> </label></td>
521
  <td><input type="text" id="name" name="name" value="<?php echo $row->name; ?>" size="39" class="bwg_requried"/></td>
522
  </tr>
523
  <tr>
524
+ <td class="spider_label_galleries"><label for="slug"><?php _e('Slug:', 'bwg_back'); ?> </label></td>
525
+ <td>
526
+ <input type="text" id="slug" name="slug" value="<?php echo $row->slug; ?>" size="39" />
527
+ <input type="hidden" id="old_slug" name="old_slug" value="<?php echo $row->slug; ?>" size="39" />
528
+ </td>
529
  </tr>
530
  <tr>
531
  <td class="spider_label_galleries"><label for="gallery_type" ><?php _e("Gallery content type:", 'bwg_back'); ?> </label></td>
admin/views/BWGViewTags_bwg.php CHANGED
@@ -1,27 +1,12 @@
1
  <?php
2
-
3
  class BWGViewTags_bwg {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
  private $model;
14
 
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
  public function __construct($model) {
20
  $this->model = $model;
21
  }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
  public function display() {
26
  $rows_data = $this->model->get_rows_data();
27
  $page_nav = $this->model->page_nav();
@@ -36,14 +21,14 @@ class BWGViewTags_bwg {
36
  $query_url = add_query_arg(array('action' => ''), $query_url);
37
  ?>
38
  <script>
39
- var ajax_url = "<?php echo $query_url; ?>"
40
  </script>
41
- <div id="wordpress_message_1" style="width:99%;display:none;"><div id="wordpress_message_2" class="wd_updated"><p><strong><?php echo __('Item Succesfully Saved.', 'bwg_back'); ?></strong></p></div></div>
42
- <form class="wrap bwg_form" id="tags_form" method="post" action="admin.php?page=tags_bwg" style="float:left; width: 98%;">
43
- <?php wp_nonce_field( 'tags_bwg', 'bwg_nonce' ); ?>
44
  <div>
45
  <span class="tag_icon"></span>
46
- <h2><?php _e("Tags", 'bwg_back'); ?></h2>
47
  </div>
48
  <div class="buttons_div_right">
49
  <span class="wd-btn wd-btn-primary-gray bwg_check_all non_selectable " onclick="spider_check_all_items()">
@@ -176,16 +161,8 @@ class BWGViewTags_bwg {
176
  <input id="ids_string" name="ids_string" type="hidden" value="<?php echo $ids_string; ?>" />
177
  <input id="asc_or_desc" name="asc_or_desc" type="hidden" value="<?php echo $asc_or_desc; ?>" />
178
  <input id="order_by" name="order_by" type="hidden" value="<?php echo $order_by; ?>" />
 
179
  </form>
180
  <?php
181
- }
182
- ////////////////////////////////////////////////////////////////////////////////////////
183
- // Getters & Setters //
184
- ////////////////////////////////////////////////////////////////////////////////////////
185
- ////////////////////////////////////////////////////////////////////////////////////////
186
- // Private Methods //
187
- ////////////////////////////////////////////////////////////////////////////////////////
188
- ////////////////////////////////////////////////////////////////////////////////////////
189
- // Listeners //
190
- ////////////////////////////////////////////////////////////////////////////////////////
191
  }
1
  <?php
 
2
  class BWGViewTags_bwg {
3
+
 
 
 
 
 
 
 
 
4
  private $model;
5
 
 
 
 
 
6
  public function __construct($model) {
7
  $this->model = $model;
8
  }
9
+
 
 
10
  public function display() {
11
  $rows_data = $this->model->get_rows_data();
12
  $page_nav = $this->model->page_nav();
21
  $query_url = add_query_arg(array('action' => ''), $query_url);
22
  ?>
23
  <script>
24
+ var ajax_url = "<?php echo $query_url; ?>";
25
  </script>
26
+ <div id="wordpress_message_1" style="width:99%;display:none"><div id="wordpress_message_2" class="wd_updated"><p><strong><?php echo __('Item Succesfully Saved.', 'bwg_back'); ?></strong></p></div></div>
27
+ <form class="wrap bwg_form" id="tags_form" method="post" action="admin.php?page=tags_bwg" style="width: 98%; float: left;">
28
+ <?php wp_nonce_field( 'tags_bwg', 'bwg_nonce' ); ?>
29
  <div>
30
  <span class="tag_icon"></span>
31
+ <h2><?php _e('Tags', 'bwg_back'); ?></h2>
32
  </div>
33
  <div class="buttons_div_right">
34
  <span class="wd-btn wd-btn-primary-gray bwg_check_all non_selectable " onclick="spider_check_all_items()">
161
  <input id="ids_string" name="ids_string" type="hidden" value="<?php echo $ids_string; ?>" />
162
  <input id="asc_or_desc" name="asc_or_desc" type="hidden" value="<?php echo $asc_or_desc; ?>" />
163
  <input id="order_by" name="order_by" type="hidden" value="<?php echo $order_by; ?>" />
164
+ <input id="tag_current_id" name="tag_current_id" type="hidden" value="" />
165
  </form>
166
  <?php
167
+ }
 
 
 
 
 
 
 
 
 
168
  }
admin/views/BWGViewWidgetTags.php CHANGED
@@ -1,27 +1,13 @@
1
  <?php
2
 
3
  class BWGViewWidgetTags {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- private $model;
14
 
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- // Constructor & Destructor //
17
- ////////////////////////////////////////////////////////////////////////////////////////
18
  public function __construct($model) {
19
  $this->model = $model;
20
  }
21
- ////////////////////////////////////////////////////////////////////////////////////////
22
- // Public Methods //
23
- ////////////////////////////////////////////////////////////////////////////////////////
24
-
25
  public function display() {
26
  }
27
 
@@ -111,47 +97,47 @@ class BWGViewWidgetTags {
111
  </script>
112
  <script src="<?php echo WD_BWG_URL . '/js/jscolor/jscolor.js?ver='.wd_bwg_version(); ?>" type="text/javascript" charset="utf-8"></script>
113
  <p>
114
- <label for="<?php echo $id_title; ?>"><?php _e("Title:", 'bwg_back'); ?></label>
115
  <input class="widefat" id="<?php echo $id_title; ?>" name="<?php echo $name_title; ?>'" type="text" value="<?php echo $instance['title']; ?>"/>
116
  </p>
117
  <p>
118
- <input type="radio" name="<?php echo $name_type; ?>" id="<?php echo $id_type . "_1"; ?>" value="text" class="sel_text" <?php if ($instance['type'] == "text") echo 'checked="checked"'; ?> onclick="bwg_change_type_tag(event, this)" /><label for="<?php echo $id_type . "_1"; ?>"><?php _e("Text", 'bwg_back'); ?></label>
119
- <input type="radio" name="<?php echo $name_type; ?>" id="<?php echo $id_type . "_2"; ?>" value="image" class="sel_image" <?php if ($instance['type'] == "image") echo 'checked="checked"'; ?> onclick="bwg_change_type_tag(event, this)" /><label for="<?php echo $id_type . "_2"; ?>"><?php _e("Image", 'bwg_back'); ?></label>
120
  <input type="hidden" name="<?php echo $name_type; ?>" id="<?php echo $id_type; ?>" value="<?php echo $instance['type']; ?>" class="bwg_hidden" />
121
  </p>
122
  <p id="p_show_name" style="display:<?php echo ($instance['type'] == 'image') ? "" : "none" ?>;">
123
- <label><?php _e("Show Tag Names:", 'bwg_back'); ?></label>
124
- <input type="radio" name="<?php echo $name_show_name; ?>" id="<?php echo $id_show_name . "_1"; ?>" value="1" <?php if ($instance['show_name']) echo 'checked="checked"'; ?> onclick='jQuery(this).nextAll(".bwg_hidden").first().attr("value", "1");' /><label for="<?php echo $id_show_name . "_1"; ?>"><?php _e("Yes", 'bwg_back'); ?></label>
125
- <input type="radio" name="<?php echo $name_show_name; ?>" id="<?php echo $id_show_name . "_0"; ?>" value="0" <?php if (!$instance['show_name']) echo 'checked="checked"'; ?> onclick='jQuery(this).nextAll(".bwg_hidden").first().attr("value", "0");' /><label for="<?php echo $id_show_name . "_0"; ?>"><?php _e("No", 'bwg_back'); ?></label>
126
  <input type="hidden" name="<?php echo $name_show_name; ?>" id="<?php echo $id_show_name; ?>" value="<?php echo $instance['show_name']; ?>" class="bwg_hidden" />
127
  </p>
128
  <p>
129
- <label><?php _e("Open in:", 'bwg_back'); ?> </label>
130
- <input type="radio" name="<?php echo $name_open_option; ?>" id="<?php echo $id_open_option . "_1"; ?>" value="page" <?php if ($instance['open_option'] == 'page') echo 'checked="checked"'; ?> onclick='jQuery(this).nextAll(".bwg_hidden").first().attr("value", "page");' /><label for="<?php echo $id_open_option . "_1"; ?>"> <?php _e("page", 'bwg_back'); ?></label>
131
- <input type="radio" name="<?php echo $name_open_option; ?>" id="<?php echo $id_open_option . "_0"; ?>" value="lightbox" <?php if ($instance['open_option'] == 'lightbox') echo 'checked="checked"'; ?> onclick='jQuery(this).nextAll(".bwg_hidden").first().attr("value", "lightbox");' /><label for="<?php echo $id_open_option . "_0"; ?>"> <?php _e("lightbox", 'bwg_back'); ?></label>
132
  <input type="hidden" name="<?php echo $name_open_option; ?>" id="<?php echo $id_open_option; ?>" value="<?php echo $instance['open_option']; ?>" class="bwg_hidden" />
133
  </p>
134
  <p>
135
- <label for="<?php echo $id_count; ?>"><?php _e("Number (0 for all):", 'bwg_back'); ?></label>
136
  <input class="widefat" style="width:25%;" id="<?php echo $id_count; ?>" name="<?php echo $name_count; ?>'" type="text" value="<?php echo $instance['count']; ?>"/>
137
  </p>
138
  <p>
139
- <label for="<?php echo $id_width; ?>"><?php _e("Dimensions:", 'bwg_back'); ?></label>
140
  <input class="widefat" style="width:25%;" id="<?php echo $id_width; ?>" name="<?php echo $name_width; ?>'" type="text" value="<?php echo $instance['width']; ?>"/> x
141
  <input class="widefat" style="width:25%;" id="<?php echo $id_height; ?>" name="<?php echo $name_height; ?>'" type="text" value="<?php echo $instance['height']; ?>"/> px
142
  </p>
143
  <p>
144
- <label><?php _e("Transparent Background:", 'bwg_back'); ?></label>
145
- <input type="radio" name="<?php echo $name_background_transparent; ?>" id="<?php echo $id_background_transparent . "_1"; ?>" value="1" <?php if ($instance['background_transparent']) echo 'checked="checked"'; ?> onclick="bwg_change_bg_transparency(event, this)" class="bg_transparent" /><label for="<?php echo $id_background_transparent . "_1"; ?>"><?php _e("Yes", 'bwg_back'); ?></label>
146
- <input type="radio" name="<?php echo $name_background_transparent; ?>" id="<?php echo $id_background_transparent . "_0"; ?>" value="0" <?php if (!$instance['background_transparent']) echo 'checked="checked"'; ?> onclick="bwg_change_bg_transparency(event, this)" /><label for="<?php echo $id_background_transparent . "_0"; ?>"><?php _e("No", 'bwg_back'); ?></label>
147
  <input type="hidden" name="<?php echo $name_background_transparent; ?>" id="<?php echo $id_background_transparent; ?>" value="<?php echo $instance['background_transparent']; ?>" class="bwg_hidden" />
148
  </p>
149
  <p id="p_bg_color" style="display:<?php echo (!$instance['background_transparent']) ? "" : "none" ?>;">
150
- <label for="<?php echo $id_background_color; ?>"><?php _e("Background Color:", 'bwg_back'); ?></label>
151
  <input class="color" style="width:25%;" id="<?php echo $id_background_color; ?>" name="<?php echo $name_background_color; ?>'" type="text" value="<?php echo $instance['background_color']; ?>"/>
152
  </p>
153
  <p>
154
- <label for="<?php echo $id_text_color; ?>"><?php _e("Text Color:", 'bwg_back'); ?></label>
155
  <input class="color" style="width:25%;" id="<?php echo $id_text_color; ?>" name="<?php echo $name_text_color; ?>'" type="text" value="<?php echo $instance['text_color']; ?>"/>
156
  </p>
157
  <p>
@@ -170,14 +156,4 @@ class BWGViewWidgetTags {
170
  </script>
171
  <?php
172
  }
173
-
174
- ////////////////////////////////////////////////////////////////////////////////////////
175
- // Getters & Setters //
176
- ////////////////////////////////////////////////////////////////////////////////////////
177
- ////////////////////////////////////////////////////////////////////////////////////////
178
- // Private Methods //
179
- ////////////////////////////////////////////////////////////////////////////////////////
180
- ////////////////////////////////////////////////////////////////////////////////////////
181
- // Listeners //
182
- ////////////////////////////////////////////////////////////////////////////////////////
183
  }
1
  <?php
2
 
3
  class BWGViewWidgetTags {
 
 
 
 
 
 
 
 
 
 
4
 
5
+ private $model;
6
+
 
7
  public function __construct($model) {
8
  $this->model = $model;
9
  }
10
+
 
 
 
11
  public function display() {
12
  }
13
 
97
  </script>
98
  <script src="<?php echo WD_BWG_URL . '/js/jscolor/jscolor.js?ver='.wd_bwg_version(); ?>" type="text/javascript" charset="utf-8"></script>
99
  <p>
100
+ <label for="<?php echo $id_title; ?>"><?php _e('Title:', 'bwg_back'); ?></label>
101
  <input class="widefat" id="<?php echo $id_title; ?>" name="<?php echo $name_title; ?>'" type="text" value="<?php echo $instance['title']; ?>"/>
102
  </p>
103
  <p>
104
+ <input type="radio" name="<?php echo $name_type; ?>" id="<?php echo $id_type . "_1"; ?>" value="text" class="sel_text" <?php if ($instance['type'] == "text") echo 'checked="checked"'; ?> onclick="bwg_change_type_tag(event, this)" /><label for="<?php echo $id_type . "_1"; ?>"><?php echo __('Text', 'bwg_back'); ?></label>
105
+ <input type="radio" name="<?php echo $name_type; ?>" id="<?php echo $id_type . "_2"; ?>" value="image" class="sel_image" <?php if ($instance['type'] == "image") echo 'checked="checked"'; ?> onclick="bwg_change_type_tag(event, this)" /><label for="<?php echo $id_type . "_2"; ?>"><?php echo __('Image', 'bwg_back'); ?></label>
106
  <input type="hidden" name="<?php echo $name_type; ?>" id="<?php echo $id_type; ?>" value="<?php echo $instance['type']; ?>" class="bwg_hidden" />
107
  </p>
108
  <p id="p_show_name" style="display:<?php echo ($instance['type'] == 'image') ? "" : "none" ?>;">
109
+ <label><?php _e('Show Tag Names:', 'bwg_back'); ?></label>
110
+ <input type="radio" name="<?php echo $name_show_name; ?>" id="<?php echo $id_show_name . "_1"; ?>" value="1" <?php if ($instance['show_name']) echo 'checked="checked"'; ?> onclick='jQuery(this).nextAll(".bwg_hidden").first().attr("value", "1");' /><label for="<?php echo $id_show_name . "_1"; ?>"><?php _e('Yes', 'bwg_back'); ?></label>
111
+ <input type="radio" name="<?php echo $name_show_name; ?>" id="<?php echo $id_show_name . "_0"; ?>" value="0" <?php if (!$instance['show_name']) echo 'checked="checked"'; ?> onclick='jQuery(this).nextAll(".bwg_hidden").first().attr("value", "0");' /><label for="<?php echo $id_show_name . "_0"; ?>"><?php _e('No', 'bwg_back'); ?></label>
112
  <input type="hidden" name="<?php echo $name_show_name; ?>" id="<?php echo $id_show_name; ?>" value="<?php echo $instance['show_name']; ?>" class="bwg_hidden" />
113
  </p>
114
  <p>
115
+ <label><?php _e('Open in:', 'bwg_back'); ?></label>
116
+ <input type="radio" name="<?php echo $name_open_option; ?>" id="<?php echo $id_open_option . "_1"; ?>" value="page" <?php if ($instance['open_option'] == 'page') echo 'checked="checked"'; ?> onclick='jQuery(this).nextAll(".bwg_hidden").first().attr("value", "page");' /><label for="<?php echo $id_open_option . "_1"; ?>"> <?php _e('page', 'bwg_back'); ?></label>
117
+ <input type="radio" name="<?php echo $name_open_option; ?>" id="<?php echo $id_open_option . "_0"; ?>" value="lightbox" <?php if ($instance['open_option'] == 'lightbox') echo 'checked="checked"'; ?> onclick='jQuery(this).nextAll(".bwg_hidden").first().attr("value", "lightbox");' /><label for="<?php echo $id_open_option . "_0"; ?>"> <?php _e('lightbox', 'bwg_back'); ?></label>
118
  <input type="hidden" name="<?php echo $name_open_option; ?>" id="<?php echo $id_open_option; ?>" value="<?php echo $instance['open_option']; ?>" class="bwg_hidden" />
119
  </p>
120
  <p>
121
+ <label for="<?php echo $id_count; ?>"><?php _e('Number (0 for all):', 'bwg_back'); ?></label>
122
  <input class="widefat" style="width:25%;" id="<?php echo $id_count; ?>" name="<?php echo $name_count; ?>'" type="text" value="<?php echo $instance['count']; ?>"/>
123
  </p>
124
  <p>
125
+ <label for="<?php echo $id_width; ?>"><?php _e('Dimensions:', 'bwg_back'); ?></label>
126
  <input class="widefat" style="width:25%;" id="<?php echo $id_width; ?>" name="<?php echo $name_width; ?>'" type="text" value="<?php echo $instance['width']; ?>"/> x
127
  <input class="widefat" style="width:25%;" id="<?php echo $id_height; ?>" name="<?php echo $name_height; ?>'" type="text" value="<?php echo $instance['height']; ?>"/> px
128
  </p>
129
  <p>
130
+ <label><?php _e('Transparent Background:', 'bwg_back'); ?></label>
131
+ <input type="radio" name="<?php echo $name_background_transparent; ?>" id="<?php echo $id_background_transparent . "_1"; ?>" value="1" <?php if ($instance['background_transparent']) echo 'checked="checked"'; ?> onclick="bwg_change_bg_transparency(event, this)" class="bg_transparent" /><label for="<?php echo $id_background_transparent . "_1"; ?>"><?php _e('Yes', 'bwg_back'); ?></label>
132
+ <input type="radio" name="<?php echo $name_background_transparent; ?>" id="<?php echo $id_background_transparent . "_0"; ?>" value="0" <?php if (!$instance['background_transparent']) echo 'checked="checked"'; ?> onclick="bwg_change_bg_transparency(event, this)" /><label for="<?php echo $id_background_transparent . "_0"; ?>"><?php _e('No', 'bwg_back'); ?></label>
133
  <input type="hidden" name="<?php echo $name_background_transparent; ?>" id="<?php echo $id_background_transparent; ?>" value="<?php echo $instance['background_transparent']; ?>" class="bwg_hidden" />
134
  </p>
135
  <p id="p_bg_color" style="display:<?php echo (!$instance['background_transparent']) ? "" : "none" ?>;">
136
+ <label for="<?php echo $id_background_color; ?>"><?php _e('Background Color:', 'bwg_back'); ?></label>
137
  <input class="color" style="width:25%;" id="<?php echo $id_background_color; ?>" name="<?php echo $name_background_color; ?>'" type="text" value="<?php echo $instance['background_color']; ?>"/>
138
  </p>
139
  <p>
140
+ <label for="<?php echo $id_text_color; ?>"><?php _e('Text Color:', 'bwg_back'); ?></label>
141
  <input class="color" style="width:25%;" id="<?php echo $id_text_color; ?>" name="<?php echo $name_text_color; ?>'" type="text" value="<?php echo $instance['text_color']; ?>"/>
142
  </p>
143
  <p>
156
  </script>
157
  <?php
158
  }
 
 
 
 
 
 
 
 
 
 
159
  }
framework/WDWLibrary.php CHANGED
@@ -180,11 +180,11 @@ class WDWLibrary {
180
  </script>
181
  <div class="alignleft actions">
182
  <label for="search_value" style="font-size:14px; width:50px; display:inline-block;"><?php echo $search_by; ?>:</label>
183
- <input type="text" id="search_value" name="search_value" class="spider_search_value" onkeypress="return check_search_key(event, this);" value="<?php echo esc_html($search_value); ?>" style="width: 150px; margin-right:<?php echo $margin_right; ?>px; <?php echo (get_bloginfo('version') > '3.7') ? ' height: 33px;' : ''; ?>" />
184
  </div>
185
  <div class="alignleft actions">
186
- <input type="button" value="" onclick="spider_search()" title="<?php echo __('Reset', 'bwg'); ?>" class="wd-search-btn action">
187
- <input type="button" value="" onclick="spider_reset()" title="<?php echo __('Search', 'bwg'); ?>" class="wd-reset-btn action">
188
  </div>
189
  </div>
190
  <?php
@@ -914,12 +914,10 @@ class WDWLibrary {
914
  global $wpdb;
915
  $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_gallery WHERE published=1 AND id="%d"', $id));
916
  if ($row) {
917
- if ($from != '') {
918
- $row->permalink = self::bwg_create_post($row->name, $row->slug, array("type" => "gallery", "mode" => $from), $id);
919
- }
920
- else {
921
  $row->permalink = '';
922
- }
 
 
923
  }
924
  else {
925
  $row_count = $wpdb->get_var('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_gallery');
@@ -940,63 +938,194 @@ class WDWLibrary {
940
  return $row;
941
  }
942
 
943
- public static function bwg_create_post($title, $slug, $type, $id) {
944
- $post_type = 'bwg_' . $type['type'];
945
- $bwg_post_id = get_page_by_title($title, OBJECT, $post_type);
946
- global $wd_bwg_options;
947
- $theme_row = self::get_theme_row_data(0);
948
- switch ($type['mode']) {
949
- case 'compact':
950
- $shortecode_string = '[Best_Wordpress_Gallery type="' . $type['type'] . '" gallery_type="album_compact_preview" theme_id="' . $theme_row->id . '" album_id="' . $id . '" sort_by="order" order_by="asc" compuct_album_column_number="' . $wd_bwg_options->album_column_number . '" compuct_albums_per_page="' . $wd_bwg_options->albums_per_page . '" compuct_album_title="' . $wd_bwg_options->album_title_show_hover . '" compuct_album_view_type="' . $wd_bwg_options->album_view_type . '" compuct_album_thumb_width="' . $wd_bwg_options->album_thumb_width . '" compuct_album_thumb_height="' . $wd_bwg_options->album_thumb_height . '" compuct_album_image_column_number="' . $wd_bwg_options->image_column_number . '" compuct_album_images_per_page="' . $wd_bwg_options->images_per_page . '" compuct_album_image_title="' . $wd_bwg_options->image_title_show_hover . '" compuct_album_image_thumb_width="' . $wd_bwg_options->thumb_width . '" compuct_album_image_thumb_height="' . $wd_bwg_options->thumb_height . '" compuct_album_enable_page="' . $wd_bwg_options->album_enable_page . '" popup_fullscreen="' . $wd_bwg_options->popup_fullscreen . '" popup_autoplay="' . $wd_bwg_options->popup_autoplay . '" popup_width="' . $wd_bwg_options->popup_width . '" popup_height="' . $wd_bwg_options->popup_height . '" popup_effect="' . $wd_bwg_options->popup_type . '" popup_interval="' . $wd_bwg_options->popup_interval . '" popup_enable_filmstrip="' . $wd_bwg_options->popup_enable_filmstrip . '" popup_filmstrip_height="' . $wd_bwg_options->popup_filmstrip_height . '" popup_enable_ctrl_btn="' . $wd_bwg_options->popup_enable_ctrl_btn . '" popup_enable_fullscreen="' . $wd_bwg_options->popup_enable_fullscreen . '" popup_enable_comment="' . $wd_bwg_options->popup_enable_comment . '" popup_enable_facebook="' . $wd_bwg_options->popup_enable_facebook . '" popup_enable_twitter="' . $wd_bwg_options->popup_enable_twitter . '" popup_enable_google="' . $wd_bwg_options->popup_enable_google . '" popup_enable_pinterest="' . $wd_bwg_options->popup_enable_pinterest . '" popup_enable_tumblr="' . $wd_bwg_options->popup_enable_tumblr . '" watermark_type="' . $wd_bwg_options->watermark_type . '" watermark_link="' . $wd_bwg_options->watermark_link . '" watermark_text="' . $wd_bwg_options->watermark_text . '" watermark_font_size="' . $wd_bwg_options->watermark_font_size . '" watermark_font="' . $wd_bwg_options->watermark_font . '" watermark_color="' . $wd_bwg_options->watermark_color . '" watermark_opacity="' . $wd_bwg_options->watermark_opacity . '" watermark_position="' . $wd_bwg_options->watermark_position . '" watermark_url="' . $wd_bwg_options->watermark_url . '" watermark_width="' . $wd_bwg_options->watermark_width . '" watermark_height="' . $wd_bwg_options->watermark_height . '" show_search_box="' . $wd_bwg_options->show_search_box . '" search_box_width="' . $wd_bwg_options->search_box_width . '" popup_enable_info="' . $wd_bwg_options->popup_enable_info . '" popup_info_always_show="' . $wd_bwg_options->popup_info_always_show . '" popup_enable_rate="' . $wd_bwg_options->popup_enable_rate . '" popup_hit_counter="' . $wd_bwg_options->popup_hit_counter . '"]';
951
- break;
952
- case 'masonry':
953
- $shortecode_string = '[Best_Wordpress_Gallery type="' . $type['type'] . '" gallery_type="album_masonry_preview" theme_id="' . $theme_row->id . '" album_id="' . $id . '" sort_by="order" order_by="asc" masonry_album_column_number="' . $wd_bwg_options->album_column_number . '" masonry_albums_per_page="' . $wd_bwg_options->albums_per_page . '" masonry_album_title="' . $wd_bwg_options->album_title_show_hover . '" masonry_album_thumb_width="' . $wd_bwg_options->album_thumb_width . '" masonry_album_thumb_height="' . $wd_bwg_options->album_thumb_height . '" masonry_album_image_column_number="' . $wd_bwg_options->image_column_number . '" masonry_album_images_per_page="' . $wd_bwg_options->images_per_page . '" masonry_album_image_title="' . $wd_bwg_options->image_title_show_hover . '" masonry_album_image_thumb_width="' . $wd_bwg_options->thumb_width . '" masonry_album_image_thumb_height="' . $wd_bwg_options->thumb_height . '" masonry_album_enable_page="' . $wd_bwg_options->album_enable_page . '" popup_fullscreen="' . $wd_bwg_options->popup_fullscreen . '" popup_autoplay="' . $wd_bwg_options->popup_autoplay . '" popup_width="' . $wd_bwg_options->popup_width . '" popup_height="' . $wd_bwg_options->popup_height . '" popup_effect="' . $wd_bwg_options->popup_type . '" popup_interval="' . $wd_bwg_options->popup_interval . '" popup_enable_filmstrip="' . $wd_bwg_options->popup_enable_filmstrip . '" popup_filmstrip_height="' . $wd_bwg_options->popup_filmstrip_height . '" popup_enable_ctrl_btn="' . $wd_bwg_options->popup_enable_ctrl_btn . '" popup_enable_fullscreen="' . $wd_bwg_options->popup_enable_fullscreen . '" popup_enable_comment="' . $wd_bwg_options->popup_enable_comment . '" popup_enable_facebook="' . $wd_bwg_options->popup_enable_facebook . '" popup_enable_twitter="' . $wd_bwg_options->popup_enable_twitter . '" popup_enable_google="' . $wd_bwg_options->popup_enable_google . '" popup_enable_pinterest="' . $wd_bwg_options->popup_enable_pinterest . '" popup_enable_tumblr="' . $wd_bwg_options->popup_enable_tumblr . '" watermark_type="' . $wd_bwg_options->watermark_type . '" watermark_link="' . $wd_bwg_options->watermark_link . '" watermark_text="' . $wd_bwg_options->watermark_text . '" watermark_font_size="' . $wd_bwg_options->watermark_font_size . '" watermark_font="' . $wd_bwg_options->watermark_font . '" watermark_color="' . $wd_bwg_options->watermark_color . '" watermark_opacity="' . $wd_bwg_options->watermark_opacity . '" watermark_position="' . $wd_bwg_options->watermark_position . '" watermark_url="' . $wd_bwg_options->watermark_url . '" watermark_width="' . $wd_bwg_options->watermark_width . '" watermark_height="' . $wd_bwg_options->watermark_height . '" show_search_box="' . $wd_bwg_options->show_search_box . '" search_box_width="' . $wd_bwg_options->search_box_width . '" popup_enable_info="' . $wd_bwg_options->popup_enable_info . '" popup_info_always_show="' . $wd_bwg_options->popup_info_always_show . '" popup_enable_rate="' . $wd_bwg_options->popup_enable_rate . '" popup_hit_counter="' . $wd_bwg_options->popup_hit_counter . '"]';
954
- break;
955
- case 'tag':
956
- $shortecode_string = '[Best_Wordpress_Gallery type="' . $type['type'] . '" gallery_type="thumbnails" theme_id="' . $theme_row->id . '" gallery_id="" tag="' . $id . '" sort_by="date" order_by="asc" image_column_number="' . $wd_bwg_options->image_column_number . '" images_per_page="' . $wd_bwg_options->images_per_page . '" image_title="' . $wd_bwg_options->image_title_show_hover . '" image_enable_page="' . $wd_bwg_options->image_enable_page . '" thumb_width="' . $wd_bwg_options->thumb_width . '" thumb_height="' . $wd_bwg_options->thumb_height . '" popup_fullscreen="' . $wd_bwg_options->popup_fullscreen . '" popup_autoplay="' . $wd_bwg_options->popup_autoplay . '" popup_width="' . $wd_bwg_options->popup_width . '" popup_height="' . $wd_bwg_options->popup_height . '" popup_effect="' . $wd_bwg_options->popup_type . '" popup_interval="' . $wd_bwg_options->popup_interval . '" popup_enable_filmstrip="' . $wd_bwg_options->popup_enable_filmstrip . '" popup_filmstrip_height="' . $wd_bwg_options->popup_filmstrip_height . '" popup_enable_ctrl_btn="' . $wd_bwg_options->popup_enable_ctrl_btn . '" popup_enable_fullscreen="' . $wd_bwg_options->popup_enable_fullscreen . '" popup_enable_comment="' . $wd_bwg_options->popup_enable_comment . '" popup_enable_facebook="' . $wd_bwg_options->popup_enable_facebook . '" popup_enable_twitter="' . $wd_bwg_options->popup_enable_twitter . '" popup_enable_google="' . $wd_bwg_options->popup_enable_google . '" popup_enable_pinterest="' . $wd_bwg_options->popup_enable_pinterest . '" popup_enable_tumblr="' . $wd_bwg_options->popup_enable_tumblr . '" watermark_type="' . $wd_bwg_options->watermark_type . '" watermark_link="' . $wd_bwg_options->watermark_link . '" watermark_text="' . $wd_bwg_options->watermark_text . '" watermark_font_size="' . $wd_bwg_options->watermark_font_size . '" watermark_font="' . $wd_bwg_options->watermark_font . '" watermark_color="' . $wd_bwg_options->watermark_color . '" watermark_opacity="' . $wd_bwg_options->watermark_opacity . '" watermark_position="' . $wd_bwg_options->watermark_position . '" watermark_url="' . $wd_bwg_options->watermark_url . '" watermark_width="' . $wd_bwg_options->watermark_width . '" watermark_height="' . $wd_bwg_options->watermark_height . '" show_search_box="' . $wd_bwg_options->show_search_box . '" search_box_width="' . $wd_bwg_options->search_box_width . '" popup_enable_info="' . $wd_bwg_options->popup_enable_info . '" popup_info_always_show="' . $wd_bwg_options->popup_info_always_show . '" popup_enable_rate="' . $wd_bwg_options->popup_enable_rate . '" popup_hit_counter="' . $wd_bwg_options->popup_hit_counter . '" thumb_click_action="' . $wd_bwg_options->thumb_click_action . '" thumb_link_target="' . $wd_bwg_options->thumb_link_target . '"]';
957
- break;
958
- default:
959
- $shortecode_string = '[Best_Wordpress_Gallery type="' . $type['type'] . '" gallery_type="thumbnails" theme_id="' . $theme_row->id . '" gallery_id="' . $id . '" sort_by="date" order_by="asc" image_column_number="' . $wd_bwg_options->image_column_number . '" images_per_page="' . $wd_bwg_options->images_per_page . '" image_title="' . $wd_bwg_options->image_title_show_hover . '" image_enable_page="' . $wd_bwg_options->image_enable_page . '" thumb_width="' . $wd_bwg_options->thumb_width . '" thumb_height="' . $wd_bwg_options->thumb_height . '" popup_fullscreen="' . $wd_bwg_options->popup_fullscreen . '" popup_autoplay="' . $wd_bwg_options->popup_autoplay . '" popup_width="' . $wd_bwg_options->popup_width . '" popup_height="' . $wd_bwg_options->popup_height . '" popup_effect="' . $wd_bwg_options->popup_type . '" popup_interval="' . $wd_bwg_options->popup_interval . '" popup_enable_filmstrip="' . $wd_bwg_options->popup_enable_filmstrip . '" popup_filmstrip_height="' . $wd_bwg_options->popup_filmstrip_height . '" popup_enable_ctrl_btn="' . $wd_bwg_options->popup_enable_ctrl_btn . '" popup_enable_fullscreen="' . $wd_bwg_options->popup_enable_fullscreen . '" popup_enable_comment="' . $wd_bwg_options->popup_enable_comment . '" popup_enable_facebook="' . $wd_bwg_options->popup_enable_facebook . '" popup_enable_twitter="' . $wd_bwg_options->popup_enable_twitter . '" popup_enable_google="' . $wd_bwg_options->popup_enable_google . '" popup_enable_pinterest="' . $wd_bwg_options->popup_enable_pinterest . '" popup_enable_tumblr="' . $wd_bwg_options->popup_enable_tumblr . '" watermark_type="' . $wd_bwg_options->watermark_type . '" watermark_link="' . $wd_bwg_options->watermark_link . '" watermark_text="' . $wd_bwg_options->watermark_text . '" watermark_font_size="' . $wd_bwg_options->watermark_font_size . '" watermark_font="' . $wd_bwg_options->watermark_font . '" watermark_color="' . $wd_bwg_options->watermark_color . '" watermark_opacity="' . $wd_bwg_options->watermark_opacity . '" watermark_position="' . $wd_bwg_options->watermark_position . '" watermark_url="' . $wd_bwg_options->watermark_url . '" watermark_width="' . $wd_bwg_options->watermark_width . '" watermark_height="' . $wd_bwg_options->watermark_height . '" show_search_box="' . $wd_bwg_options->show_search_box . '" search_box_width="' . $wd_bwg_options->search_box_width . '" popup_enable_info="' . $wd_bwg_options->popup_enable_info . '" popup_info_always_show="' . $wd_bwg_options->popup_info_always_show . '" popup_enable_rate="' . $wd_bwg_options->popup_enable_rate . '" popup_hit_counter="' . $wd_bwg_options->popup_hit_counter . '" thumb_click_action="' . $wd_bwg_options->thumb_click_action . '" thumb_link_target="' . $wd_bwg_options->thumb_link_target . '"]';
960
- break;
961
- }
962
- if (!$bwg_post_id) {
 
963
  $post = array(
964
- 'post_content' => $shortecode_string,
965
- 'post_name' => $slug,
966
- 'post_status' => 'publish',
967
- 'post_title' => $title,
968
- 'post_author' => 1,
969
- 'post_type' => $post_type
 
970
  );
971
  wp_insert_post($post);
972
  }
973
  else {
974
- $bwg_post_id->post_name = $slug;
975
- $bwg_post_id->post_author = 1;
976
- $bwg_post_id->post_content = $shortecode_string;
977
- wp_update_post($bwg_post_id);
978
  }
979
- $bwg_post_id = get_page_by_title($title, OBJECT, $post_type);
980
- return get_permalink($bwg_post_id->ID);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
981
  }
982
 
983
- public static function get_image_rows_data($gallery_id, $bwg, $type, $tag_input_name, $tag, $images_per_page, $load_more_image_count, $sort_by, $sort_direction = 'ASC') {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
984
  $gallery_id = (int) $gallery_id;
985
  $tag = (int) $tag;
986
  global $wpdb;
987
  $bwg_search = ((isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '') ? esc_html($_POST['bwg_search_' . $bwg]) : '');
988
  $join = '';
989
  $where = '';
990
- if ($bwg_search) {
991
  $where = 'AND (image.alt LIKE "%%' . $bwg_search . '%%" OR image.description LIKE "%%' . $bwg_search . '%%")';
992
  }
993
- if ($sort_by == 'size' || $sort_by == 'resolution') {
994
  $sort_by = ' CAST(image.' . $sort_by . ' AS SIGNED) ';
995
  }
996
- elseif ($sort_by == 'random' || $sort_by == 'RAND()') {
997
  $sort_by = 'RAND()';
998
  }
999
- elseif (($sort_by != 'alt') && ($sort_by != 'date') && ($sort_by != 'filetype') && ($sort_by != 'RAND()') && ($sort_by != 'filename')) {
1000
  $sort_by = 'image.`order`';
1001
  }
1002
  else {
@@ -1004,113 +1133,107 @@ class WDWLibrary {
1004
  }
1005
  $items_in_page = $images_per_page;
1006
  $limit = 0;
1007
- if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
1008
- if ($_REQUEST['page_number_' . $bwg] > 1) {
1009
  $items_in_page = $load_more_image_count;
1010
  }
1011
  $limit = (((int) $_REQUEST['page_number_' . $bwg] - 2) * $items_in_page) + $images_per_page;
1012
- $bwg_random_seed = isset($_SESSION['bwg_random_seed_'. $bwg]) ? $_SESSION['bwg_random_seed_'. $bwg] : '';
1013
  }
1014
  else {
1015
  $bwg_random_seed = rand();
1016
- $_SESSION['bwg_random_seed_'. $bwg] = $bwg_random_seed;
1017
  }
1018
  $limit_str = '';
1019
- if ($images_per_page) {
1020
  $limit_str = 'LIMIT ' . $limit . ',' . $items_in_page;
1021
  }
1022
-
1023
  $where .= ($gallery_id ? ' AND image.gallery_id = "' . $gallery_id . '" ' : '') . ($tag ? ' AND tag.tag_id = "' . $tag . '" ' : '');
1024
  $join = $tag ? 'LEFT JOIN ' . $wpdb->prefix . 'bwg_image_tag as tag ON image.id=tag.image_id' : '';
1025
-
1026
- if (isset($_REQUEST[$tag_input_name]) && $_REQUEST[$tag_input_name]){
1027
  $join .= ' LEFT JOIN (SELECT GROUP_CONCAT(tag_id SEPARATOR ",") AS tags_combined, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag' . ($gallery_id ? ' WHERE gallery_id="' . $gallery_id . '"' : '') . ' GROUP BY image_id) AS tags ON image.id=tags.image_id';
1028
  $where .= ' AND CONCAT(",", tags.tags_combined, ",") REGEXP ",(' . implode("|", $_REQUEST[$tag_input_name]) . ')," ';
1029
  }
1030
-
1031
  $row = $wpdb->get_results('SELECT image.* FROM ' . $wpdb->prefix . 'bwg_image as image ' . $join . ' WHERE image.published=1 ' . $where . ' ORDER BY ' . str_replace('RAND()', 'RAND(' . $bwg_random_seed . ')', $sort_by) . ' ' . $sort_direction . ' ' . $limit_str);
1032
  $total = $wpdb->get_var('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_image as image ' . $join . ' WHERE image.published=1 ' . $where);
1033
-
1034
  $page_nav['total'] = $total;
1035
  $page_nav['limit'] = 1;
1036
- if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
1037
  $page_nav['limit'] = (int) $_REQUEST['page_number_' . $bwg];
1038
  }
1039
- return array('images' => $row, 'page_nav' => $page_nav);
 
1040
  }
1041
 
1042
- public static function get_album_row_data($id, $create_post) {
1043
  global $wpdb;
1044
  $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_album WHERE published=1 AND id="%d"', $id));
1045
- if ($row) {
1046
- if ($create_post) {
1047
- $row->permalink = WDWLibrary::bwg_create_post($row->name, $row->slug, array("type" => "album", "mode" => "compact"), $id);
1048
- }
1049
- else {
1050
- $row->permalink = '';
1051
  }
1052
  }
 
1053
  return $row;
1054
  }
1055
 
1056
- public static function get_alb_gals_row($id, $albums_per_page, $sort_by, $bwg, $sort_direction = 'ASC') {
1057
  global $wpdb;
1058
  $limit = 0;
1059
- if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
1060
  $limit = ((int) $_REQUEST['page_number_' . $bwg] - 1) * $albums_per_page;
1061
  }
1062
  $limit_str = '';
1063
- if ($albums_per_page) {
1064
  $limit_str = 'LIMIT ' . $limit . ',' . $albums_per_page;
1065
  }
1066
- if ($sort_by != "RAND()") {
1067
  $sort_by = '`' . $sort_by . '`';
1068
  }
1069
  $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE album_id="%d" ORDER BY ' . $sort_by . ' ' . $sort_direction . ' ' . $limit_str, $id));
1070
-
1071
  $total = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE album_id="%d"', $id));
1072
  $page_nav['total'] = $total;
1073
  $page_nav['limit'] = 1;
1074
- if (isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg]) {
1075
  $page_nav['limit'] = (int) $_REQUEST['page_number_' . $bwg];
1076
  }
1077
 
1078
- return array('rows' => $row, 'page_nav' => $page_nav);
1079
  }
1080
 
1081
- public static function bwg_image_set_watermark($gallery_id) {
1082
  global $wpdb;
1083
  global $WD_BWG_UPLOAD_DIR;
1084
  global $wd_bwg_options;
1085
- if ($gallery_id != 0) {
1086
  $images = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_image WHERE gallery_id="%d"', $gallery_id));
1087
  }
1088
  else {
1089
  $images = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'bwg_image');
1090
  }
1091
- switch ($wd_bwg_options->built_in_watermark_type) {
1092
  case 'text':
1093
- foreach ($images as $image) {
1094
- if (isset($_POST['check_' . $image->id]) || isset($_POST['check_all_items'])) {
1095
  self::set_text_watermark(ABSPATH . $WD_BWG_UPLOAD_DIR . $image->image_url, ABSPATH . $WD_BWG_UPLOAD_DIR . $image->image_url, html_entity_decode($wd_bwg_options->built_in_watermark_text), $wd_bwg_options->built_in_watermark_font, $wd_bwg_options->built_in_watermark_font_size, '#' . $wd_bwg_options->built_in_watermark_color, $wd_bwg_options->built_in_watermark_opacity, $wd_bwg_options->built_in_watermark_position);
1096
  }
1097
- if ($gallery_id == 0) {
1098
  self::set_text_watermark(ABSPATH . $WD_BWG_UPLOAD_DIR . $image->image_url, ABSPATH . $WD_BWG_UPLOAD_DIR . $image->image_url, html_entity_decode($wd_bwg_options->built_in_watermark_text), $wd_bwg_options->built_in_watermark_font, $wd_bwg_options->built_in_watermark_font_size, '#' . $wd_bwg_options->built_in_watermark_color, $wd_bwg_options->built_in_watermark_opacity, $wd_bwg_options->built_in_watermark_position);
1099
  }
1100
  }
1101
  break;
1102
  case 'image':
1103
  $watermark_path = str_replace(site_url() . '/', ABSPATH, $wd_bwg_options->built_in_watermark_url);
1104
- foreach ($images as $image) {
1105
- if (isset($_POST['check_' . $image->id]) || isset($_POST['check_all_items'])) {
1106
  self::set_image_watermark(ABSPATH . $WD_BWG_UPLOAD_DIR . $image->image_url, ABSPATH . $WD_BWG_UPLOAD_DIR . $image->image_url, $watermark_path, $wd_bwg_options->built_in_watermark_size, $wd_bwg_options->built_in_watermark_size, $wd_bwg_options->built_in_watermark_position);
1107
  }
1108
- if ($gallery_id == 0) {
1109
  self::set_image_watermark(ABSPATH . $WD_BWG_UPLOAD_DIR . $image->image_url, ABSPATH . $WD_BWG_UPLOAD_DIR . $image->image_url, $watermark_path, $wd_bwg_options->built_in_watermark_size, $wd_bwg_options->built_in_watermark_size, $wd_bwg_options->built_in_watermark_position);
1110
  }
1111
  }
1112
  break;
1113
- }
1114
  }
1115
 
1116
  public static function set_text_watermark($original_filename, $dest_filename, $watermark_text, $watermark_font, $watermark_font_size, $watermark_color, $watermark_transparency, $watermark_position) {
@@ -1507,7 +1630,326 @@ class WDWLibrary {
1507
  *
1508
  * @param $value
1509
  */
1510
- public static function validate_integers(&$value) {
1511
- $value = (int)$value;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1512
  }
1513
  }
180
  </script>
181
  <div class="alignleft actions">
182
  <label for="search_value" style="font-size:14px; width:50px; display:inline-block;"><?php echo $search_by; ?>:</label>
183
+ <input type="text" id="search_value" name="search_value" class="spider_search_value" onkeypress="return check_search_key(event, this);" value="<?php echo esc_html($search_value); ?>" style="width: 150px;margin-right:<?php echo $margin_right; ?>px; padding-top:10px; <?php echo (get_bloginfo('version') > '3.7') ? ' height: 33px;' : ''; ?>" />
184
  </div>
185
  <div class="alignleft actions">
186
+ <input type="button" value="" title="<?php _e('Search','bwg_back'); ?>" onclick="spider_search()" class="wd-search-btn action">
187
+ <input type="button" value="" title="<?php _e('Reset','bwg_back'); ?>" onclick="spider_reset()" class="wd-reset-btn action">
188
  </div>
189
  </div>
190
  <?php
914
  global $wpdb;
915
  $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_gallery WHERE published=1 AND id="%d"', $id));
916
  if ($row) {
 
 
 
 
917
  $row->permalink = '';
918
+ if ($from != '') {
919
+ $row->permalink = self::get_custom_post_permalink( array( 'slug' => $row->slug, 'post_type' => 'gallery' ) );
920
+ }
921
  }
922
  else {
923
  $row_count = $wpdb->get_var('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_gallery');
938
  return $row;
939
  }
940
 
941
+ /**
942
+ * Create custom post.
943
+ *
944
+ * @param array $params
945
+ *
946
+ * @return object $post
947
+ */
948
+ public static function bwg_create_custom_post( $params ) {
949
+ $id = $params['id'];
950
+ $title = $params['title'];
951
+ $slug = $params['slug'];
952
+ $type = $params['type'];
953
+ $post_type = 'bwg_' . $type['post_type'];
954
+
955
+ // Get post by slug.
956
+ $slugcheck = !empty( $params['old_slug'] ) ? $params['old_slug'] : $slug;
957
+ $post = get_page_by_path($slugcheck, OBJECT, $post_type);
958
+ if ( !$post ) {
959
+ // Insert shortcode data.
960
+ $shortecode_id = self::create_shortcode($params);
961
+ $custom_post_shortecode = '[Best_Wordpress_Gallery id="' . $shortecode_id . '" gal_title="' . $title . '"]';
962
  $post = array(
963
+ 'post_name' => $slug,
964
+ 'post_title' => $title,
965
+ 'post_content' => $custom_post_shortecode,
966
+ 'post_status' => 'publish',
967
+ 'comment_status' => 'closed',
968
+ 'post_author' => 1,
969
+ 'post_type' => $post_type,
970
  );
971
  wp_insert_post($post);
972
  }
973
  else {
974
+ $post->post_name = $slug;
975
+ $post->post_title = $title;
976
+ wp_update_post($post);
 
977
  }
978
+ $post = get_page_by_path($slug, OBJECT, $post_type);
979
+ return $post;
980
+ }
981
+
982
+ /**
983
+ * Remove custom post.
984
+ *
985
+ * @param array $params
986
+ *
987
+ * @return object $post
988
+ */
989
+ public static function bwg_remove_custom_post( $params ) {
990
+ $slug = $params['slug'];
991
+ $post_type = $params['post_type'];
992
+ $post = get_page_by_path($slug, OBJECT, $post_type);
993
+ $delete = new stdClass();
994
+ if ( !empty($post) ) {
995
+ $delete = wp_delete_post($post->ID, TRUE);
996
+ }
997
+ return $delete;
998
  }
999
 
1000
+ /**
1001
+ * Create shortcode.
1002
+ *
1003
+ * @param array $params
1004
+ *
1005
+ * @return int $shortcode_id
1006
+ */
1007
+ private static function create_shortcode( $params ) {
1008
+ global $wpdb;
1009
+ $id = $params['id'];
1010
+ $type = $params['type'];
1011
+ $theme_row = self::get_theme_row_data(0);
1012
+ $theme_id = $theme_row->id;
1013
+ $shortcode_id = 0;
1014
+ if ( !empty($type['post_type']) ) {
1015
+ $shortcode = ' use_option_defaults="1" type="' . $type['post_type'] . '" theme_id="' . $theme_id . '" ';
1016
+ switch ( $type['post_type'] ) {
1017
+ case 'gallery':
1018
+ $shortcode .= 'gallery_id="' . $id . '" tag="0" gallery_type="thumbnails"';
1019
+ break;
1020
+ case 'album':
1021
+ $shortcode .= 'album_id="' . $id . '" tag="0" gallery_type="album_compact_preview"';
1022
+ break;
1023
+ case 'tag':
1024
+ $shortcode .= 'tag="' . $id . '" gallery_id="0" gallery_type="thumbnails"';
1025
+ break;
1026
+ default:
1027
+ break;
1028
+ }
1029
+ $shortcode_id = self::get_shortcode_max_id();
1030
+ $wpdb->insert($wpdb->prefix . 'bwg_shortcode',
1031
+ array('id' => $shortcode_id, 'tagtext' => $shortcode),
1032
+ array('%d','%s')
1033
+ );
1034
+ }
1035
+
1036
+ return $shortcode_id;
1037
+ }
1038
+
1039
+ /**
1040
+ * Create custom posts before update.
1041
+ *
1042
+ * @param array $params
1043
+ *
1044
+ * @return bool
1045
+ */
1046
+ public static function before_update_create_custom_posts() {
1047
+ global $wpdb;
1048
+ $query = new WP_Query( array('post_type' => array( 'bwg_gallery', 'bwg_tag', 'bwg_album')) );
1049
+ if( !empty($query->posts) ){
1050
+ foreach( $query->posts as $post ) {
1051
+ $delete = wp_delete_post($post->ID, TRUE);
1052
+ }
1053
+ }
1054
+
1055
+ $sql_query = '(SELECT `a`.`id` AS `id`, `a`.`name` AS `title`, `a`.`slug` AS `slug`, CONCAT("album") as `type` FROM `'. $wpdb->prefix .'bwg_album` `a`)
1056
+ UNION
1057
+ (SELECT `g`.`id` AS `id`, `g`.`name` AS `title`,`g`.`slug` AS `slug`, CONCAT("gallery") as `type` FROM `'. $wpdb->prefix .'bwg_gallery` `g`)
1058
+ UNION
1059
+ (SELECT `t`.`term_id` AS `id`, `t`.`name` AS `title`,`t`.`slug` AS `slug`, CONCAT("tag") as `type` FROM '. $wpdb->prefix .'terms as `t`
1060
+ LEFT JOIN '. $wpdb->prefix .'term_taxonomy as `tt`
1061
+ ON `t`.`term_id` = `tt`.`term_id` WHERE `tt`.`taxonomy`="bwg_tag");';
1062
+
1063
+ $results = $wpdb->get_results( $sql_query, OBJECT );
1064
+ if( !empty($results) ) {
1065
+ foreach($results as $row){
1066
+ $custom_params = array(
1067
+ 'id' => $row->id,
1068
+ 'title' => $row->title,
1069
+ 'slug' => $row->slug,
1070
+ 'type' => array(
1071
+ 'post_type' => $row->type,
1072
+ 'mode' => '',
1073
+ ),
1074
+ );
1075
+ self::bwg_create_custom_post( $custom_params );
1076
+ }
1077
+ }
1078
+ }
1079
+
1080
+ /**
1081
+ * Get custom post.
1082
+ *
1083
+ * @param array $params
1084
+ *
1085
+ * @return string $permalink
1086
+ */
1087
+ public static function get_custom_post_permalink( $params ) {
1088
+ $slug = $params['slug'];
1089
+ $post_type = $params['post_type'];
1090
+ $post_type = 'bwg_' . $post_type;
1091
+ // Get post by slug.
1092
+ $post = get_page_by_path($slug, OBJECT, $post_type);
1093
+ if ( $post ) {
1094
+ return get_permalink($post->ID);
1095
+ }
1096
+
1097
+ return '';
1098
+ }
1099
+
1100
+ /**
1101
+ * Get shortcode max id.
1102
+ *
1103
+ * @return int $id
1104
+ */
1105
+ public static function get_shortcode_max_id() {
1106
+ global $wpdb;
1107
+ $id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "bwg_shortcode");
1108
+
1109
+ return $id + 1;
1110
+ }
1111
+
1112
+ public static function get_image_rows_data( $gallery_id, $bwg, $type, $tag_input_name, $tag, $images_per_page, $load_more_image_count, $sort_by, $sort_direction = 'ASC' ) {
1113
  $gallery_id = (int) $gallery_id;
1114
  $tag = (int) $tag;
1115
  global $wpdb;
1116
  $bwg_search = ((isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '') ? esc_html($_POST['bwg_search_' . $bwg]) : '');
1117
  $join = '';
1118
  $where = '';
1119
+ if ( $bwg_search ) {
1120
  $where = 'AND (image.alt LIKE "%%' . $bwg_search . '%%" OR image.description LIKE "%%' . $bwg_search . '%%")';
1121
  }
1122
+ if ( $sort_by == 'size' || $sort_by == 'resolution' ) {
1123
  $sort_by = ' CAST(image.' . $sort_by . ' AS SIGNED) ';
1124
  }
1125
+ elseif ( $sort_by == 'random' || $sort_by == 'RAND()' ) {
1126
  $sort_by = 'RAND()';
1127
  }
1128
+ elseif ( ($sort_by != 'alt') && ($sort_by != 'date') && ($sort_by != 'filetype') && ($sort_by != 'RAND()') && ($sort_by != 'filename') ) {
1129
  $sort_by = 'image.`order`';
1130
  }
1131
  else {
1133
  }
1134
  $items_in_page = $images_per_page;
1135
  $limit = 0;
1136
+ if ( isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg] ) {
1137
+ if ( $_REQUEST['page_number_' . $bwg] > 1 ) {
1138
  $items_in_page = $load_more_image_count;
1139
  }
1140
  $limit = (((int) $_REQUEST['page_number_' . $bwg] - 2) * $items_in_page) + $images_per_page;
1141
+ $bwg_random_seed = isset($_SESSION['bwg_random_seed_' . $bwg]) ? $_SESSION['bwg_random_seed_' . $bwg] : '';
1142
  }
1143
  else {
1144
  $bwg_random_seed = rand();
1145
+ $_SESSION['bwg_random_seed_' . $bwg] = $bwg_random_seed;
1146
  }
1147
  $limit_str = '';
1148
+ if ( $images_per_page ) {
1149
  $limit_str = 'LIMIT ' . $limit . ',' . $items_in_page;
1150
  }
 
1151
  $where .= ($gallery_id ? ' AND image.gallery_id = "' . $gallery_id . '" ' : '') . ($tag ? ' AND tag.tag_id = "' . $tag . '" ' : '');
1152
  $join = $tag ? 'LEFT JOIN ' . $wpdb->prefix . 'bwg_image_tag as tag ON image.id=tag.image_id' : '';
1153
+ if ( isset($_REQUEST[$tag_input_name]) && $_REQUEST[$tag_input_name] ) {
 
1154
  $join .= ' LEFT JOIN (SELECT GROUP_CONCAT(tag_id SEPARATOR ",") AS tags_combined, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag' . ($gallery_id ? ' WHERE gallery_id="' . $gallery_id . '"' : '') . ' GROUP BY image_id) AS tags ON image.id=tags.image_id';
1155
  $where .= ' AND CONCAT(",", tags.tags_combined, ",") REGEXP ",(' . implode("|", $_REQUEST[$tag_input_name]) . ')," ';
1156
  }
 
1157
  $row = $wpdb->get_results('SELECT image.* FROM ' . $wpdb->prefix . 'bwg_image as image ' . $join . ' WHERE image.published=1 ' . $where . ' ORDER BY ' . str_replace('RAND()', 'RAND(' . $bwg_random_seed . ')', $sort_by) . ' ' . $sort_direction . ' ' . $limit_str);
1158
  $total = $wpdb->get_var('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_image as image ' . $join . ' WHERE image.published=1 ' . $where);
 
1159
  $page_nav['total'] = $total;
1160
  $page_nav['limit'] = 1;
1161
+ if ( isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg] ) {
1162
  $page_nav['limit'] = (int) $_REQUEST['page_number_' . $bwg];
1163
  }
1164
+
1165
+ return array( 'images' => $row, 'page_nav' => $page_nav );
1166
  }
1167
 
1168
+ public static function get_album_row_data( $id, $from ) {
1169
  global $wpdb;
1170
  $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_album WHERE published=1 AND id="%d"', $id));
1171
+ if ( $row ) {
1172
+ if ( $from ) {
1173
+ $row->permalink = WDWLibrary::get_custom_post_permalink(array( 'slug' => $row->slug, 'post_type' => 'album' ));
 
 
 
1174
  }
1175
  }
1176
+
1177
  return $row;
1178
  }
1179
 
1180
+ public static function get_alb_gals_row( $id, $albums_per_page, $sort_by, $bwg, $sort_direction = 'ASC' ) {
1181
  global $wpdb;
1182
  $limit = 0;
1183
+ if ( isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg] ) {
1184
  $limit = ((int) $_REQUEST['page_number_' . $bwg] - 1) * $albums_per_page;
1185
  }
1186
  $limit_str = '';
1187
+ if ( $albums_per_page ) {
1188
  $limit_str = 'LIMIT ' . $limit . ',' . $albums_per_page;
1189
  }
1190
+ if ( $sort_by != "RAND()" ) {
1191
  $sort_by = '`' . $sort_by . '`';
1192
  }
1193
  $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE album_id="%d" ORDER BY ' . $sort_by . ' ' . $sort_direction . ' ' . $limit_str, $id));
 
1194
  $total = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_album_gallery WHERE album_id="%d"', $id));
1195
  $page_nav['total'] = $total;
1196
  $page_nav['limit'] = 1;
1197
+ if ( isset($_REQUEST['page_number_' . $bwg]) && $_REQUEST['page_number_' . $bwg] ) {
1198
  $page_nav['limit'] = (int) $_REQUEST['page_number_' . $bwg];
1199
  }
1200
 
1201
+ return array( 'rows' => $row, 'page_nav' => $page_nav );
1202
  }
1203
 
1204
+ public static function bwg_image_set_watermark( $gallery_id ) {
1205
  global $wpdb;
1206
  global $WD_BWG_UPLOAD_DIR;
1207
  global $wd_bwg_options;
1208
+ if ( $gallery_id != 0 ) {
1209
  $images = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_image WHERE gallery_id="%d"', $gallery_id));
1210
  }
1211
  else {
1212
  $images = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'bwg_image');
1213
  }
1214
+ switch ( $wd_bwg_options->built_in_watermark_type ) {
1215
  case 'text':
1216
+ foreach ( $images as $image ) {
1217
+ if ( isset($_POST['check_' . $image->id]) || isset($_POST['check_all_items']) ) {
1218
  self::set_text_watermark(ABSPATH . $WD_BWG_UPLOAD_DIR . $image->image_url, ABSPATH . $WD_BWG_UPLOAD_DIR . $image->image_url, html_entity_decode($wd_bwg_options->built_in_watermark_text), $wd_bwg_options->built_in_watermark_font, $wd_bwg_options->built_in_watermark_font_size, '#' . $wd_bwg_options->built_in_watermark_color, $wd_bwg_options->built_in_watermark_opacity, $wd_bwg_options->built_in_watermark_position);
1219
  }
1220
+ if ( $gallery_id == 0 ) {
1221
  self::set_text_watermark(ABSPATH . $WD_BWG_UPLOAD_DIR . $image->image_url, ABSPATH . $WD_BWG_UPLOAD_DIR . $image->image_url, html_entity_decode($wd_bwg_options->built_in_watermark_text), $wd_bwg_options->built_in_watermark_font, $wd_bwg_options->built_in_watermark_font_size, '#' . $wd_bwg_options->built_in_watermark_color, $wd_bwg_options->built_in_watermark_opacity, $wd_bwg_options->built_in_watermark_position);
1222
  }
1223
  }
1224
  break;
1225
  case 'image':
1226
  $watermark_path = str_replace(site_url() . '/', ABSPATH, $wd_bwg_options->built_in_watermark_url);
1227
+ foreach ( $images as $image ) {
1228
+ if ( isset($_POST['check_' . $image->id]) || isset($_POST['check_all_items']) ) {
1229
  self::set_image_watermark(ABSPATH . $WD_BWG_UPLOAD_DIR . $image->image_url, ABSPATH . $WD_BWG_UPLOAD_DIR . $image->image_url, $watermark_path, $wd_bwg_options->built_in_watermark_size, $wd_bwg_options->built_in_watermark_size, $wd_bwg_options->built_in_watermark_position);
1230
  }
1231
+ if ( $gallery_id == 0 ) {
1232
  self::set_image_watermark(ABSPATH . $WD_BWG_UPLOAD_DIR . $image->image_url, ABSPATH . $WD_BWG_UPLOAD_DIR . $image->image_url, $watermark_path, $wd_bwg_options->built_in_watermark_size, $wd_bwg_options->built_in_watermark_size, $wd_bwg_options->built_in_watermark_position);
1233
  }
1234
  }
1235
  break;
1236
+ }
1237
  }
1238
 
1239
  public static function set_text_watermark($original_filename, $dest_filename, $watermark_text, $watermark_font, $watermark_font_size, $watermark_color, $watermark_transparency, $watermark_position) {
1630
  *
1631
  * @param $value
1632
  */
1633
+ public static function validate_integers( &$value ) {
1634
+ $value = (int) $value;
1635
+ }
1636
+
1637
+ /**
1638
+ * Get shortcode defauls.
1639
+ *
1640
+ * @param array $params
1641
+ *
1642
+ * @return array $defauls
1643
+ */
1644
+ public static function get_shortcode_option_params( $params ) {
1645
+ global $wd_bwg_options;
1646
+ $theme = self::get_theme_row_data(0);
1647
+ $type = (!empty($params['gallery_type'])) ? $params['gallery_type'] : 'thumbnails';
1648
+ $use_option_defaults = (isset($params['use_option_defaults']) && $params['use_option_defaults'] == 1) ? TRUE : FALSE;
1649
+ $everyone_option = array(
1650
+ 'gallery_type' => $params['gallery_type'],
1651
+ 'thumb_click_action' => (!$use_option_defaults && isset($params['thumb_click_action'])) ? $params['thumb_click_action'] : $wd_bwg_options->thumb_click_action,
1652
+ 'thumb_link_target' => (!$use_option_defaults && isset($params['thumb_link_target'])) ? $params['thumb_link_target'] : $wd_bwg_options->thumb_link_target,
1653
+ 'popup_fullscreen' => (!$use_option_defaults && isset($params['popup_fullscreen'])) ? $params['popup_fullscreen'] : $wd_bwg_options->popup_fullscreen,
1654
+ 'popup_autoplay' => (!$use_option_defaults && isset($params['popup_autoplay'])) ? $params['popup_autoplay'] : $wd_bwg_options->popup_autoplay,
1655
+ 'popup_width' => (!$use_option_defaults && isset($params['popup_width'])) ? $params['popup_width'] : $wd_bwg_options->popup_width,
1656
+ 'popup_height' => (!$use_option_defaults && isset($params['popup_height'])) ? $params['popup_height'] : $wd_bwg_options->popup_height,
1657
+ 'popup_effect' => (!$use_option_defaults && isset($params['popup_effect'])) ? $params['popup_effect'] : $wd_bwg_options->popup_type,
1658
+ 'popup_interval' => (!$use_option_defaults && isset($params['popup_interval'])) ? $params['popup_interval'] : $wd_bwg_options->popup_interval,
1659
+ 'popup_enable_filmstrip' => (!$use_option_defaults && isset($params['popup_enable_filmstrip'])) ? $params['popup_enable_filmstrip'] : $wd_bwg_options->popup_enable_filmstrip,
1660
+ 'popup_filmstrip_height' => (!$use_option_defaults && isset($params['popup_filmstrip_height'])) ? $params['popup_filmstrip_height'] : $wd_bwg_options->popup_filmstrip_height,
1661
+ 'popup_enable_ctrl_btn' => (!$use_option_defaults && isset($params['popup_enable_ctrl_btn'])) ? $params['popup_enable_ctrl_btn'] : $wd_bwg_options->popup_enable_ctrl_btn,
1662
+ 'popup_enable_fullscreen' => (!$use_option_defaults && isset($params['popup_enable_fullscreen'])) ? $params['popup_enable_fullscreen'] : $wd_bwg_options->popup_enable_fullscreen,
1663
+ 'popup_enable_info' => (!$use_option_defaults && isset($params['popup_enable_info'])) ? $params['popup_enable_info'] : $wd_bwg_options->popup_enable_info,
1664
+ 'popup_info_always_show' => (!$use_option_defaults && isset($params['popup_info_always_show'])) ? $params['popup_info_always_show'] : $wd_bwg_options->popup_info_always_show,
1665
+ 'popup_info_full_width' => (!$use_option_defaults && isset($params['popup_info_full_width'])) ? $params['popup_info_full_width'] : $wd_bwg_options->popup_info_full_width,
1666
+ 'popup_enable_rate' => (!$use_option_defaults && isset($params['popup_enable_rate'])) ? $params['popup_enable_rate'] : $wd_bwg_options->popup_enable_rate,
1667
+ 'popup_enable_comment' => (!$use_option_defaults && isset($params['popup_enable_comment'])) ? $params['popup_enable_comment'] : $wd_bwg_options->popup_enable_comment,
1668
+ 'popup_hit_counter' => (!$use_option_defaults && isset($params['popup_hit_counter'])) ? $params['popup_hit_counter'] : $wd_bwg_options->popup_hit_counter,
1669
+ 'popup_enable_facebook' => (!$use_option_defaults && isset($params['popup_enable_facebook'])) ? $params['popup_enable_facebook'] : $wd_bwg_options->popup_enable_facebook,
1670
+ 'popup_enable_twitter' => (!$use_option_defaults && isset($params['popup_enable_twitter'])) ? $params['popup_enable_twitter'] : $wd_bwg_options->popup_enable_twitter,
1671
+ 'popup_enable_google' => (!$use_option_defaults && isset($params['popup_enable_google'])) ? $params['popup_enable_google'] : $wd_bwg_options->popup_enable_google,
1672
+ 'popup_enable_ecommerce' => (!$use_option_defaults && isset($params['popup_enable_ecommerce'])) ? $params['popup_enable_ecommerce'] : $wd_bwg_options->popup_enable_ecommerce,
1673
+ 'popup_enable_pinterest' => (!$use_option_defaults && isset($params['popup_enable_pinterest'])) ? $params['popup_enable_pinterest'] : $wd_bwg_options->popup_enable_pinterest,
1674
+ 'popup_enable_tumblr' => (!$use_option_defaults && isset($params['popup_enable_tumblr'])) ? $params['popup_enable_tumblr'] : $wd_bwg_options->popup_enable_tumblr,
1675
+ 'popup_effect_duration' => (!$use_option_defaults && isset($params['popup_effect_duration'])) ? $params['popup_effect_duration'] : $wd_bwg_options->popup_effect_duration,
1676
+ 'watermark_type' => (!$use_option_defaults && isset($params['watermark_type'])) ? $params['watermark_type'] : $wd_bwg_options->watermark_type,
1677
+ 'watermark_link' => (!$use_option_defaults && isset($params['watermark_link'])) ? urlencode($params['watermark_link']) : urlencode($wd_bwg_options->watermark_link),
1678
+ 'watermark_url' => (!$use_option_defaults && isset($params['watermark_url'])) ? urlencode($params['watermark_url']) : urlencode($wd_bwg_options->watermark_url),
1679
+ 'watermark_width' => (!$use_option_defaults && isset($params['watermark_width'])) ? $params['watermark_width'] : $wd_bwg_options->watermark_width,
1680
+ 'watermark_height' => (!$use_option_defaults && isset($params['watermark_height'])) ? $params['watermark_height'] : $wd_bwg_options->watermark_height,
1681
+ 'watermark_opacity' => (!$use_option_defaults && isset($params['watermark_opacity'])) ? $params['watermark_opacity'] : $wd_bwg_options->watermark_opacity,
1682
+ 'watermark_position' => (!$use_option_defaults && isset($params['watermark_position'])) ? $params['watermark_position'] : $wd_bwg_options->watermark_position,
1683
+ 'ecommerce_icon' => (!$use_option_defaults && isset($params['ecommerce_icon'])) ? $params['ecommerce_icon'] : $wd_bwg_options->ecommerce_icon_show_hover,
1684
+ 'show_search_box' => (!$use_option_defaults && isset($params['show_search_box'])) ? $params['show_search_box'] : $wd_bwg_options->show_search_box,
1685
+ 'search_box_width' => (!$use_option_defaults && isset($params['search_box_width'])) ? $params['search_box_width'] : $wd_bwg_options->search_box_width,
1686
+ );
1687
+ $defaul = array();
1688
+ switch ( $type ) {
1689
+ case 'thumbnails' : {
1690
+ $defaul = array(
1691
+ 'gallery_id' => $params['gallery_id'],
1692
+ 'gal_title' => isset($params['gal_title']) ? $params['gal_title'] : '',
1693
+ 'theme_id' => (!$use_option_defaults && isset($params['theme_id'])) ? $params['theme_id'] : $theme->id,
1694
+ 'tag' => (!$use_option_defaults && isset($params['tag'])) ? $params['tag'] : 0,
1695
+ 'sort_by' => (!$use_option_defaults && isset($params['sort_by'])) ? $params['sort_by'] : 'order',
1696
+ 'order_by' => (!$use_option_defaults && isset($params['order_by'])) ? $params['order_by'] : 'asc',
1697
+ 'image_title' => (!$use_option_defaults && isset($params['image_title'])) ? $params['image_title'] : $wd_bwg_options->image_title_show_hover,
1698
+ 'load_more_image_count' => (!$use_option_defaults && isset($params['load_more_image_count'])) ? $params['load_more_image_count'] : $wd_bwg_options->images_per_page,
1699
+ 'image_column_number' => (!$use_option_defaults && isset($params['image_column_number'])) ? $params['image_column_number'] : $wd_bwg_options->image_column_number,
1700
+ 'image_enable_page' => (!$use_option_defaults && isset($params['image_enable_page'])) ? $params['image_enable_page'] : $wd_bwg_options->image_enable_page,
1701
+ 'thumb_width' => (!$use_option_defaults && isset($params['thumb_width'])) ? $params['thumb_width'] : $wd_bwg_options->thumb_width,
1702
+ 'thumb_height' => (!$use_option_defaults && isset($params['thumb_height'])) ? $params['thumb_height'] : $wd_bwg_options->thumb_height,
1703
+ 'images_per_page' => (!$use_option_defaults && isset($params['images_per_page'])) ? $params['images_per_page'] : $wd_bwg_options->images_per_page,
1704
+ 'show_sort_images' => (!$use_option_defaults && isset($params['show_sort_images'])) ? $params['show_sort_images'] : $wd_bwg_options->show_sort_images,
1705
+ 'show_tag_box' => (!$use_option_defaults && isset($params['show_tag_box'])) ? $params['show_tag_box'] : $wd_bwg_options->show_tag_box,
1706
+ 'showthumbs_name' => (!$use_option_defaults && isset($params['showthumbs_name'])) ? $params['showthumbs_name'] : $wd_bwg_options->showthumbs_name,
1707
+ 'show_gallery_description' => (!$use_option_defaults && isset($params['show_gallery_description'])) ? $params['show_gallery_description'] : $wd_bwg_options->show_gallery_description,
1708
+ );
1709
+ }
1710
+ break;
1711
+ case 'thumbnails_masonry': {
1712
+ $defaul = array(
1713
+ 'gallery_id' => 1,
1714
+ 'theme_id' => (!$use_option_defaults && isset($params['theme_id'])) ? $params['theme_id'] : $theme->id,
1715
+ 'sort_by' => 'order',
1716
+ 'order_by' => 'asc',
1717
+ 'show_search_box' => 0,
1718
+ 'search_box_width' => 180,
1719
+ 'masonry_hor_ver' => 'vertical',
1720
+ 'image_column_number' => 3,
1721
+ 'ecommerce_icon' => 'none',
1722
+ 'images_per_page' => 15,
1723
+ 'image_enable_page' => 1,
1724
+ 'thumb_width' => 120,
1725
+ 'thumb_height' => 90,
1726
+ 'watermark_type' => 'none',
1727
+ 'load_more_image_count' => 15,
1728
+ 'show_tag_box' => 0,
1729
+ 'show_gallery_description' => 0,
1730
+ 'showthumbs_name' => 0,
1731
+ );
1732
+ }
1733
+ break;
1734
+ case 'thumbnails_mosaic': {
1735
+ $defaul = array(
1736
+ 'gallery_id' => 1,
1737
+ 'theme_id' => (!$use_option_defaults && isset($params['theme_id'])) ? $params['theme_id'] : $theme->id,
1738
+ 'sort_by' => 'order',
1739
+ 'order_by' => 'asc',
1740
+ 'show_search_box' => 0,
1741
+ 'search_box_width' => 180,
1742
+ 'mosaic_hor_ver' => 'vertical',
1743
+ 'images_per_page' => 15,
1744
+ 'image_enable_page' => 1,
1745
+ 'resizable_mosaic' => 0,
1746
+ 'mosaic_total_width' => 100,
1747
+ 'thumb_width' => 120,
1748
+ 'thumb_height' => 90,
1749
+ 'watermark_type' => 'none',
1750
+ 'load_more_image_count' => 15,
1751
+ 'show_tag_box' => 0,
1752
+ 'ecommerce_icon' => 'none',
1753
+ 'show_gallery_description' => 0,
1754
+ 'showthumbs_name' => 0,
1755
+ );
1756
+ }
1757
+ break;
1758
+ case 'slideshow': {
1759
+ $defaul = array(
1760
+ 'gallery_id' => 1,
1761
+ 'theme_id' => (!$use_option_defaults && isset($params['theme_id'])) ? $params['theme_id'] : $theme->id,
1762
+ 'sort_by' => 'order',
1763
+ 'order_by' => 'asc',
1764
+ 'slideshow_effect' => 'fade',
1765
+ 'slideshow_interval' => 5,
1766
+ 'slideshow_width' => 800,
1767
+ 'slideshow_height' => 600,
1768
+ 'enable_slideshow_autoplay' => 0,
1769
+ 'enable_slideshow_shuffle' => 0,
1770
+ 'enable_slideshow_ctrl' => 1,
1771
+ 'enable_slideshow_filmstrip' => 1,
1772
+ 'slideshow_filmstrip_height' => 70,
1773
+ 'slideshow_enable_title' => 0,
1774
+ 'slideshow_title_full_width' => 0,
1775
+ 'slideshow_title_position' => 'top-right',
1776
+ 'slideshow_enable_description' => 0,
1777
+ 'slideshow_description_position' => 'bottom-right',
1778
+ 'enable_slideshow_music' => 0,
1779
+ 'slideshow_music_url' => '',
1780
+ 'slideshow_effect_duration' => 1,
1781
+ 'show_gallery_description' => 0,
1782
+ );
1783
+ }
1784
+ break;
1785
+ case 'carousel': {
1786
+ $defaul = array(
1787
+ 'gallery_id' => 1,
1788
+ 'theme_id' => (!$use_option_defaults && isset($params['theme_id'])) ? $params['theme_id'] : $theme->id,
1789
+ 'sort_by' => 'order',
1790
+ 'order_by' => 'asc',
1791
+ 'carousel_interval' => 5,
1792
+ 'carousel_width' => 300,
1793
+ 'carousel_height' => 300,
1794
+ 'carousel_image_column_number' => 5,
1795
+ 'carousel_image_par' => '0.75',
1796
+ 'carousel_enable_title' => 0,
1797
+ 'carousel_enable_autoplay' => 0,
1798
+ 'carousel_r_width' => 800,
1799
+ 'carousel_fit_containerWidth' => 1,
1800
+ 'carousel_prev_next_butt' => 1,
1801
+ 'carousel_play_pause_butt' => 1,
1802
+ 'show_gallery_description' => 0,
1803
+ );
1804
+ }
1805
+ break;
1806
+ case 'image_browser': {
1807
+ $defaul = array(
1808
+ 'gallery_id' => 1,
1809
+ 'theme_id' => (!$use_option_defaults && isset($params['theme_id'])) ? $params['theme_id'] : $theme->id,
1810
+ 'sort_by' => 'order',
1811
+ 'order_by' => 'asc',
1812
+ 'show_search_box' => 0,
1813
+ 'search_box_width' => 180,
1814
+ 'image_browser_width' => 800,
1815
+ 'image_browser_title_enable' => 1,
1816
+ 'image_browser_description_enable' => 1,
1817
+ 'watermark_type' => 'none',
1818
+ 'show_gallery_description' => 0,
1819
+ 'showthumbs_name' => 0,
1820
+ );
1821
+ }
1822
+ break;
1823
+ case 'album_compact_preview': {
1824
+ $defaul = array(
1825
+ 'album_id' => $params['album_id'],
1826
+ 'theme_id' => (!$use_option_defaults && isset($params['theme_id'])) ? $params['theme_id'] : $theme->id,
1827
+ 'sort_by' => (!$use_option_defaults && isset($params['order'])) ? $params['order'] : 'order',
1828
+ 'order_by' => (!$use_option_defaults && isset($params['order_by'])) ? $params['order_by'] : 'asc',
1829
+ 'show_search_box' => (!$use_option_defaults && isset($params['show_search_box'])) ? $params['show_search_box'] : $wd_bwg_options->show_search_box,
1830
+ 'search_box_width' => (!$use_option_defaults && isset($params['search_box_width'])) ? $params['search_box_width'] : $wd_bwg_options->search_box_width,
1831
+ 'compuct_album_column_number' => (!$use_option_defaults && isset($params['compuct_album_column_number'])) ? $params['compuct_album_column_number'] : $wd_bwg_options->album_column_number,
1832
+ 'compuct_albums_per_page' => (!$use_option_defaults && isset($params['compuct_albums_per_page'])) ? $params['compuct_albums_per_page'] : $wd_bwg_options->albums_per_page,
1833
+ 'compuct_album_title' => (!$use_option_defaults && isset($params['compuct_album_title'])) ? $params['compuct_album_title'] : $wd_bwg_options->album_title_show_hover,
1834
+ 'compuct_album_view_type' => (!$use_option_defaults && isset($params['compuct_album_view_type'])) ? $params['compuct_album_view_type'] : $wd_bwg_options->album_view_type,
1835
+ 'compuct_album_thumb_width' => (!$use_option_defaults && isset($params['compuct_album_thumb_width'])) ? $params['compuct_album_thumb_width'] : $wd_bwg_options->album_thumb_width,
1836
+ 'compuct_album_thumb_height' => (!$use_option_defaults && isset($params['compuct_album_thumb_height'])) ? $params['compuct_album_thumb_height'] : $wd_bwg_options->album_thumb_height,
1837
+ 'compuct_album_image_column_number' => (!$use_option_defaults && isset($params['compuct_album_image_column_number'])) ? $params['compuct_album_image_column_number'] : $wd_bwg_options->image_column_number,
1838
+ 'compuct_album_images_per_page' => (!$use_option_defaults && isset($params['compuct_album_images_per_page'])) ? $params['compuct_album_images_per_page'] : $wd_bwg_options->images_per_page,
1839
+ 'compuct_album_image_title' => (!$use_option_defaults && isset($params['compuct_album_image_title'])) ? $params['compuct_album_image_title'] : $wd_bwg_options->image_title_show_hover,
1840
+ 'compuct_album_image_thumb_width' => (!$use_option_defaults && isset($params['compuct_album_image_thumb_width'])) ? $params['compuct_album_image_thumb_width'] : $wd_bwg_options->thumb_width,
1841
+ 'compuct_album_image_thumb_height' => (!$use_option_defaults && isset($params['compuct_album_image_thumb_height'])) ? $params['compuct_album_image_thumb_height'] : $wd_bwg_options->thumb_height,
1842
+ 'compuct_album_enable_page' => (!$use_option_defaults && isset($params['compuct_album_enable_page'])) ? $params['compuct_album_enable_page'] : $wd_bwg_options->album_enable_page,
1843
+ 'compuct_album_load_more_image_count' => (!$use_option_defaults && isset($params['compuct_album_load_more_image_count'])) ? $params['compuct_album_load_more_image_count'] : $wd_bwg_options->images_per_page,
1844
+ 'compuct_albums_per_page_load_more' => (!$use_option_defaults && isset($params['compuct_albums_per_page_load_more'])) ? $params['compuct_albums_per_page_load_more'] : $wd_bwg_options->albums_per_page,
1845
+ 'compuct_album_mosaic_hor_ver' => (!$use_option_defaults && isset($params['compuct_album_mosaic_hor_ver'])) ? $params['compuct_album_mosaic_hor_ver'] : $wd_bwg_options->mosaic,
1846
+ 'compuct_album_resizable_mosaic' => (!$use_option_defaults && isset($params['compuct_album_resizable_mosaic'])) ? $params['compuct_album_resizable_mosaic'] : $wd_bwg_options->resizable_mosaic,
1847
+ 'compuct_album_mosaic_total_width' => (!$use_option_defaults && isset($params['compuct_album_mosaic_total_width'])) ? $params['compuct_album_mosaic_total_width'] : $wd_bwg_options->mosaic_total_width,
1848
+ 'show_tag_box' => (!$use_option_defaults && isset($params['show_tag_box'])) ? $params['show_tag_box'] : $wd_bwg_options->show_tag_box,
1849
+ 'show_sort_images' => (!$use_option_defaults && isset($params['show_sort_images'])) ? $params['show_sort_images'] : $wd_bwg_options->show_sort_images,
1850
+ 'show_album_name' => (!$use_option_defaults && isset($params['show_album_name'])) ? $params['show_album_name'] : $wd_bwg_options->show_album_name,
1851
+ 'show_gallery_description' => (!$use_option_defaults && isset($params['show_gallery_description'])) ? $params['show_gallery_description'] : $wd_bwg_options->show_gallery_description,
1852
+ );
1853
+ }
1854
+ break;
1855
+ case 'album_masonry_preview': {
1856
+ $defaul = array(
1857
+ 'album_id' => 1,
1858
+ 'theme_id' => (!$use_option_defaults && isset($params['theme_id'])) ? $params['theme_id'] : $theme->id,
1859
+ 'sort_by' => 'order',
1860
+ 'show_search_box' => 0,
1861
+ 'search_box_width' => 180,
1862
+ 'masonry_album_column_number' => 3,
1863
+ 'masonry_albums_per_page' => 15,
1864
+ 'masonry_album_title' => 'hover',
1865
+ 'masonry_album_thumb_width' => 120,
1866
+ 'masonry_album_thumb_height' => 90,
1867
+ 'masonry_album_image_column_number' => 3,
1868
+ 'masonry_album_images_per_page' => 15,
1869
+ 'masonry_album_image_title' => 'none',
1870
+ 'masonry_album_image_thumb_width' => 120,
1871
+ 'masonry_album_image_thumb_height' => 120,
1872
+ 'masonry_album_enable_page' => 1,
1873
+ 'watermark_type' => 'none',
1874
+ 'masonry_album_load_more_image_count' => 15,
1875
+ 'masonry_albums_per_page_load_more' => 15,
1876
+ 'show_gallery_description' => 0,
1877
+ 'show_album_name' => 0,
1878
+ );
1879
+ }
1880
+ break;
1881
+ case 'album_extended_preview': {
1882
+ $defaul = array(
1883
+ 'album_id' => 1,
1884
+ 'theme_id' => (!$use_option_defaults && isset($params['theme_id'])) ? $params['theme_id'] : $theme->id,
1885
+ 'sort_by' => 'order',
1886
+ 'show_search_box' => 0,
1887
+ 'search_box_width' => 180,
1888
+ 'extended_albums_per_page' => 15,
1889
+ 'extended_album_height' => 150,
1890
+ 'extended_album_description_enable' => 1,
1891
+ 'extended_album_view_type' => 'thumbnail',
1892
+ 'extended_album_thumb_width' => 120,
1893
+ 'extended_album_thumb_height' => 90,
1894
+ 'extended_album_image_column_number' => 3,
1895
+ 'extended_album_images_per_page' => 15,
1896
+ 'extended_album_image_title' => 'none',
1897
+ 'extended_album_image_thumb_width' => 120,
1898
+ 'extended_album_image_thumb_height' => 90,
1899
+ 'extended_album_enable_page' => 1,
1900
+ 'watermark_type' => 'none',
1901
+ 'extended_album_load_more_image_count' => 15,
1902
+ 'extended_albums_per_page_load_more' => 15,
1903
+ 'show_gallery_description' => 0,
1904
+ 'show_album_name' => 0,
1905
+ );
1906
+ }
1907
+ break;
1908
+ case 'blog_style': {
1909
+ $defaul = array(
1910
+ 'gallery_id' => 1,
1911
+ 'theme_id' => (!$use_option_defaults && isset($params['theme_id'])) ? $params['theme_id'] : $theme->id,
1912
+ 'sort_by' => 'order',
1913
+ 'order_by' => 'asc',
1914
+ 'show_search_box' => 0,
1915
+ 'search_box_width' => 180,
1916
+ 'blog_style_width' => 800,
1917
+ 'blog_style_title_enable' => 1,
1918
+ 'blog_style_images_per_page' => 5,
1919
+ 'blog_style_enable_page' => 1,
1920
+ 'watermark_type' => 'none',
1921
+ 'blog_style_load_more_image_count' => 5,
1922
+ 'blog_style_description_enable' => 0,
1923
+ 'show_gallery_description' => 0,
1924
+ 'showthumbs_name' => 0,
1925
+ );
1926
+ }
1927
+ break;
1928
+ }
1929
+ $data = array_merge($defaul, $everyone_option);
1930
+
1931
+ return $data;
1932
+ }
1933
+ }
1934
+
1935
+ /**
1936
+ * Rre.
1937
+ *
1938
+ * @param array $data
1939
+ * @param boolean $e
1940
+ *
1941
+ * @return string $data
1942
+ */
1943
+ if ( !function_exists('pre') ) {
1944
+ function pre( $data = FALSE, $e = FALSE ) {
1945
+ $bt = debug_backtrace();
1946
+ $caller = array_shift($bt);
1947
+ print "<pre><xmp>";
1948
+ print_r($data);
1949
+ print "\r\n Called in : " . $caller['file'] . ", At line:" . $caller['line'];
1950
+ echo "</xmp></pre>\n";
1951
+ if ( $e ) {
1952
+ exit;
1953
+ }
1954
  }
1955
  }
framework/WDWLibraryEmbed.php CHANGED
@@ -4,30 +4,8 @@
4
  * Class for handling embedded media in gallery
5
  *
6
  */
7
-
8
  class WDWLibraryEmbed {
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- // Events //
11
- ////////////////////////////////////////////////////////////////////////////////////////
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- // Constants //
14
- ////////////////////////////////////////////////////////////////////////////////////////
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- // Variables //
17
- ////////////////////////////////////////////////////////////////////////////////////////
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Constructor & Destructor //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- public function __construct() {
22
- }
23
-
24
-
25
- ////////////////////////////////////////////////////////////////////////////////////////
26
- // Public Methods //
27
- ////////////////////////////////////////////////////////////////////////////////////////
28
- ////////////////////////////////////////////////////////////////////////////////////////
29
- // Getters & Setters //
30
- ////////////////////////////////////////////////////////////////////////////////////////
31
 
32
  public function get_provider($oembed, $url, $args = '') {
33
  $provider = false;
@@ -531,10 +509,4 @@ class WDWLibraryEmbed {
531
 
532
  }
533
 
534
- ////////////////////////////////////////////////////////////////////////////////////////
535
- // Private Methods //
536
- ////////////////////////////////////////////////////////////////////////////////////////
537
- ////////////////////////////////////////////////////////////////////////////////////////
538
- // Listeners //
539
- ////////////////////////////////////////////////////////////////////////////////////////
540
  }
4
  * Class for handling embedded media in gallery
5
  *
6
  */
 
7
  class WDWLibraryEmbed {
8
+ public function __construct() {}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  public function get_provider($oembed, $url, $args = '') {
11
  $provider = false;
509
 
510
  }
511
 
 
 
 
 
 
 
512
  }
frontend/controllers/BWGControllerGalleryBox.php CHANGED
@@ -1,23 +1,9 @@
1
  <?php
2
-
3
  class BWGControllerGalleryBox {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
  public function __construct() {
17
  }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
  public function execute() {
22
  $ajax_task = (isset($_POST['ajax_task']) ? esc_html($_POST['ajax_task']) : '');
23
  if (method_exists($this, $ajax_task)) {
@@ -129,13 +115,4 @@ class BWGControllerGalleryBox {
129
  $wpdb->query($wpdb->prepare('UPDATE ' . $wpdb->prefix . 'bwg_image SET comment_count=comment_count-1 WHERE id="%d"', $image_id));
130
  $this->display();
131
  }
132
- ////////////////////////////////////////////////////////////////////////////////////////
133
- // Getters & Setters //
134
- ////////////////////////////////////////////////////////////////////////////////////////
135
- ////////////////////////////////////////////////////////////////////////////////////////
136
- // Private Methods //
137
- ////////////////////////////////////////////////////////////////////////////////////////
138
- ////////////////////////////////////////////////////////////////////////////////////////
139
- // Listeners //
140
- ////////////////////////////////////////////////////////////////////////////////////////
141
  }
1
  <?php
 
2
  class BWGControllerGalleryBox {
3
+
 
 
 
 
 
 
 
 
 
 
 
4
  public function __construct() {
5
  }
6
+
 
 
7
  public function execute() {
8
  $ajax_task = (isset($_POST['ajax_task']) ? esc_html($_POST['ajax_task']) : '');
9
  if (method_exists($this, $ajax_task)) {
115
  $wpdb->query($wpdb->prepare('UPDATE ' . $wpdb->prefix . 'bwg_image SET comment_count=comment_count-1 WHERE id="%d"', $image_id));
116
  $this->display();
117
  }
 
 
 
 
 
 
 
 
 
118
  }
frontend/controllers/BWGControllerWidget.php CHANGED
@@ -1,23 +1,9 @@
1
  <?php
2
-
3
  class BWGControllerWidgetFrontEnd {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
  }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
  public function execute($params = array(), $from_shortcode = "tags") {
22
  if ($from_shortcode == 'tags') {
23
  $this->view_tags($params);
@@ -33,13 +19,4 @@ class BWGControllerWidgetFrontEnd {
33
 
34
  $view->view_tags($params);
35
  }
36
- ////////////////////////////////////////////////////////////////////////////////////////
37
- // Getters & Setters //
38
- ////////////////////////////////////////////////////////////////////////////////////////
39
- ////////////////////////////////////////////////////////////////////////////////////////
40
- // Private Methods //
41
- ////////////////////////////////////////////////////////////////////////////////////////
42
- ////////////////////////////////////////////////////////////////////////////////////////
43
- // Listeners //
44
- ////////////////////////////////////////////////////////////////////////////////////////
45
  }
1
  <?php
 
2
  class BWGControllerWidgetFrontEnd {
3
+
4
+ public function __construct() {
 
 
 
 
 
 
 
 
 
 
 
5
  }
6
+
 
 
7
  public function execute($params = array(), $from_shortcode = "tags") {
8
  if ($from_shortcode == 'tags') {
9
  $this->view_tags($params);
19
 
20
  $view->view_tags($params);
21
  }
 
 
 
 
 
 
 
 
 
22
  }
frontend/models/BWGModelWidget.php CHANGED
@@ -3,9 +3,10 @@ class BWGModelWidgetFrontEnd {
3
  public function get_tags_data($count) {
4
  global $wpdb;
5
  $rows = $wpdb->get_results('SELECT image.thumb_url as thumb_url, image.id as image_id, tags.name, tags.slug, tags.term_id, image.filetype FROM ' . $wpdb->prefix . 'terms AS tags INNER JOIN ' . $wpdb->prefix . 'term_taxonomy AS taxonomy ON taxonomy.term_id=tags.term_id INNER JOIN (SELECT image.thumb_url, tag.tag_id, image.id, image.filetype FROM ' . $wpdb->prefix . 'bwg_image AS image INNER JOIN ' . $wpdb->prefix . 'bwg_image_tag AS tag ON image.id=tag.image_id ORDER BY RAND()) AS image ON image.tag_id=tags.term_id WHERE taxonomy.taxonomy="bwg_tag" GROUP BY tags.term_id' . ($count ? ' LIMIT ' . $count : ""));
6
- foreach ($rows as $row) {
7
- $row->permalink = WDWLibrary::bwg_create_post($row->name, $row->slug, array("type" => "tag", "mode" => "tag"), $row->term_id);
8
  }
 
9
  return $rows;
10
  }
11
  }
3
  public function get_tags_data($count) {
4
  global $wpdb;
5
  $rows = $wpdb->get_results('SELECT image.thumb_url as thumb_url, image.id as image_id, tags.name, tags.slug, tags.term_id, image.filetype FROM ' . $wpdb->prefix . 'terms AS tags INNER JOIN ' . $wpdb->prefix . 'term_taxonomy AS taxonomy ON taxonomy.term_id=tags.term_id INNER JOIN (SELECT image.thumb_url, tag.tag_id, image.id, image.filetype FROM ' . $wpdb->prefix . 'bwg_image AS image INNER JOIN ' . $wpdb->prefix . 'bwg_image_tag AS tag ON image.id=tag.image_id ORDER BY RAND()) AS image ON image.tag_id=tags.term_id WHERE taxonomy.taxonomy="bwg_tag" GROUP BY tags.term_id' . ($count ? ' LIMIT ' . $count : ""));
6
+ foreach ( $rows as $row ) {
7
+ $row->permalink = WDWLibrary::get_custom_post_permalink(array( 'slug' => $row->slug, 'post_type' => 'tag' ));
8
  }
9
+
10
  return $rows;
11
  }
12
  }
js/bwg.js CHANGED
@@ -8,7 +8,7 @@ function edit_tag(m) {
8
  var name, slug, tr;
9
  name = jQuery("#name" + m).html();
10
  slug = jQuery("#slug" + m).html();
11
- tr = ' <td id="td_check_'+m+'" ></td> <td id="td_id_'+m+'" ></td> <td id="td_name_'+m+'" class="edit_input"><input id="edit_tagname" name="tagname'+m+'" class="input_th2" type="text" value="'+name+'"></td> <td id="td_slug_'+m+'" class="edit_input"><input id="edit_slug" class="input_th2" name="slug'+m+'" type="text" value="'+slug+'"></td> <td id="td_count_'+m+'" ></td> <td id="td_edit_'+m+'" class="table_big_col"><a class="wd-btn wd-btn-primary wd-btn-icon wd-btn-save button-small" title="'+ bwg_objectL10B.save_tag +'" onclick="save_tag('+m+')" >'+bwg_objectL10B.save_tag+' </a></td><td id="td_delete_'+m+'" class="table_big_col" ></td> ';
12
  jQuery("#tr_" + m).html(tr);
13
  jQuery("#td_id_" + m).attr('class', 'table_big_col');
14
  }
@@ -16,7 +16,8 @@ function edit_tag(m) {
16
  function save_tag(tag_id) {
17
  var tagname=jQuery('input[name=tagname'+tag_id+']').val();
18
  var slug = jQuery('input[name=slug'+tag_id+']').val();
19
- var datas = "tagname="+tagname+"&"+"slug="+slug+"&"+"tag_id="+tag_id;
 
20
  var td_check,td_name,td_slug,td_count,td_edit,td_delete,massege;
21
  jQuery.ajax({
22
  type: "POST",
@@ -75,6 +76,7 @@ function spider_ajax_save(form_id, tr_group) {
75
  var bwg_nonce = jQuery("#bwg_nonce").val();
76
  var name = jQuery("#name").val();
77
  var slug = jQuery("#slug").val();
 
78
 
79
  if ((typeof tinyMCE != "undefined") && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden() && tinyMCE.activeEditor.getContent) {
80
  var description = tinyMCE.activeEditor.getContent();
@@ -116,7 +118,7 @@ function spider_ajax_save(form_id, tr_group) {
116
  post_data["bwg_nonce"] = bwg_nonce;
117
  post_data["name"] = name;
118
  post_data["slug"] = slug;
119
-
120
  post_data["description"] = description;
121
  post_data["preview_image"] = preview_image;
122
  post_data["published"] = published;
@@ -194,6 +196,7 @@ function spider_ajax_save(form_id, tr_group) {
194
  spider_run_checkbox();
195
 
196
  if (ajax_task == 'ajax_apply') {
 
197
  jQuery('#message_div').html("<strong><p>" + bwg_objectL10B.saved + "</p></strong>");
198
  jQuery('#message_div').show();
199
  }
8
  var name, slug, tr;
9
  name = jQuery("#name" + m).html();
10
  slug = jQuery("#slug" + m).html();
11
+ tr = ' <td id="td_check_'+m+'" ></td> <td id="td_id_'+m+'" ></td> <td id="td_name_'+m+'" class="edit_input"><input id="edit_tagname'+m+'" name="tagname'+m+'" class="input_th2" type="text" value="'+name+'" data-old-name"'+name+'"></td> <td id="td_slug_'+m+'" class="edit_input"><input id="edit_slug'+m+'" class="input_th2" name="slug'+m+'" type="text" value="'+slug+'" data-old-slug="'+slug+'"><input id="edit_old_slug'+m+'" class="input_th2" name="old_slug'+m+'" type="hidden" value="'+slug+'"></td> <td id="td_count_'+m+'" ></td> <td id="td_edit_'+m+'" class="table_big_col"><a class="wd-btn wd-btn-primary wd-btn-icon wd-btn-save button-small" title="'+ bwg_objectL10B.save_tag +'" onclick="save_tag('+m+')" >'+bwg_objectL10B.save_tag+' </a></td><td id="td_delete_'+m+'" class="table_big_col" ></td> ';
12
  jQuery("#tr_" + m).html(tr);
13
  jQuery("#td_id_" + m).attr('class', 'table_big_col');
14
  }
16
  function save_tag(tag_id) {
17
  var tagname=jQuery('input[name=tagname'+tag_id+']').val();
18
  var slug = jQuery('input[name=slug'+tag_id+']').val();
19
+ var old_slug = jQuery('input[name=old_slug'+tag_id+']').val();
20
+ var datas = "tagname="+tagname+"&old_slug="+old_slug+"&slug="+slug+"&tag_id="+tag_id;
21
  var td_check,td_name,td_slug,td_count,td_edit,td_delete,massege;
22
  jQuery.ajax({
23
  type: "POST",
76
  var bwg_nonce = jQuery("#bwg_nonce").val();
77
  var name = jQuery("#name").val();
78
  var slug = jQuery("#slug").val();
79
+ var old_slug = jQuery("#old_slug").val();
80
 
81
  if ((typeof tinyMCE != "undefined") && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden() && tinyMCE.activeEditor.getContent) {
82
  var description = tinyMCE.activeEditor.getContent();
118
  post_data["bwg_nonce"] = bwg_nonce;
119
  post_data["name"] = name;
120
  post_data["slug"] = slug;
121
+ post_data["old_slug"] = old_slug;
122
  post_data["description"] = description;
123
  post_data["preview_image"] = preview_image;
124
  post_data["published"] = published;
196
  spider_run_checkbox();
197
 
198
  if (ajax_task == 'ajax_apply') {
199
+ jQuery('#old_slug').val(jQuery('#slug').val());
200
  jQuery('#message_div').html("<strong><p>" + bwg_objectL10B.saved + "</p></strong>");
201
  jQuery('#message_div').show();
202
  }
js/bwg_editor_button.js CHANGED
@@ -29,17 +29,15 @@ jQuery(window).load(function(){
29
  ed.addCommand('mcebwg_mce', function () {
30
  ed.windowManager.open({
31
  file:bwg_admin_ajax,
32
- width:width_window + ed.getLang('bwg_mce.delta_width', 0),
33
- height:height_window + ed.getLang('bwg_mce.delta_height', 0),
34
- inline:1,
35
- title:'Photo Gallery'
36
  }, {
37
  plugin_url:url
38
  });
39
-
40
  var window = ed.windowManager.windows[ed.windowManager.windows.length - 1],
41
  $window = window.$el;
42
-
43
  $window.css({
44
  maxWidth: "100%",
45
  maxHeight: "100%"
@@ -51,7 +49,7 @@ jQuery(window).load(function(){
51
  $window.find(".mce-container-body").find("iframe").css({
52
  width:'1px',
53
  minWidth:'100%',
54
- });
55
  var e = ed.selection.getNode(), d = wp.media.gallery, f;
56
  if (typeof wp === "undefined" || !wp.media || !wp.media.gallery) {
57
  return
29
  ed.addCommand('mcebwg_mce', function () {
30
  ed.windowManager.open({
31
  file:bwg_admin_ajax,
32
+ width: width_window + ed.getLang('bwg_mce.delta_width', 0),
33
+ height: height_window + ed.getLang('bwg_mce.delta_height', 0),
34
+ inline: 1,
35
+ title: 'Photo Gallery'
36
  }, {
37
  plugin_url:url
38
  });
 
39
  var window = ed.windowManager.windows[ed.windowManager.windows.length - 1],
40
  $window = window.$el;
 
41
  $window.css({
42
  maxWidth: "100%",
43
  maxHeight: "100%"
49
  $window.find(".mce-container-body").find("iframe").css({
50
  width:'1px',
51
  minWidth:'100%',
52
+ });
53
  var e = ed.selection.getNode(), d = wp.media.gallery, f;
54
  if (typeof wp === "undefined" || !wp.media || !wp.media.gallery) {
55
  return
js/bwg_frontend.js CHANGED
@@ -1,4 +1,4 @@
1
- function spider_frontend_ajax(form_id, current_view, id, album_gallery_id, cur_album_id, type, srch_btn, title, sortByParam, load_more) {console.log("aaaaaaa");
2
  var masonry_loaded = 0;
3
  var mosaic_loaded = 0;
4
  if (typeof load_more == "undefined") {
@@ -75,7 +75,6 @@ function spider_frontend_ajax(form_id, current_view, id, album_gallery_id, cur_a
75
  // There are no images.
76
  if (jQuery("#bwg_search_input_" + current_view).length > 0 && album_gallery_id == 0) { // Search box exists and not album view.
77
  var bwg_images_count = jQuery('#bwg_images_count_' + current_view).val();
78
- debugger;
79
  if (bwg_images_count == 0) {
80
  var cont = jQuery("#" + id).parent().html();
81
  var error_msg = '<div style="width:95%"><div class="wd_error"><p><strong>' + bwg_objectL10n.bwg_search_result + '</strong></p></div></div>';
@@ -91,7 +90,7 @@ function spider_frontend_ajax(form_id, current_view, id, album_gallery_id, cur_a
91
  else if (jQuery(this).attr("data-src") != '') {
92
  jQuery(this).attr("src", jQuery(this).attr("data-src"));
93
  }
94
- });
95
  jQuery(".blog_style_image_buttons_conteiner_" + current_view).find(jQuery(".bwg_blog_style_img_" + current_view)).load(function(){
96
  jQuery(".bwg_blog_style_img_" + current_view).closest(jQuery(".blog_style_image_buttons_conteiner_" + current_view)).show();
97
  });
1
+ function spider_frontend_ajax(form_id, current_view, id, album_gallery_id, cur_album_id, type, srch_btn, title, sortByParam, load_more) {
2
  var masonry_loaded = 0;
3
  var mosaic_loaded = 0;
4
  if (typeof load_more == "undefined") {
75
  // There are no images.
76
  if (jQuery("#bwg_search_input_" + current_view).length > 0 && album_gallery_id == 0) { // Search box exists and not album view.
77
  var bwg_images_count = jQuery('#bwg_images_count_' + current_view).val();
 
78
  if (bwg_images_count == 0) {
79
  var cont = jQuery("#" + id).parent().html();
80
  var error_msg = '<div style="width:95%"><div class="wd_error"><p><strong>' + bwg_objectL10n.bwg_search_result + '</strong></p></div></div>';
90
  else if (jQuery(this).attr("data-src") != '') {
91
  jQuery(this).attr("src", jQuery(this).attr("data-src"));
92
  }
93
+ });
94
  jQuery(".blog_style_image_buttons_conteiner_" + current_view).find(jQuery(".bwg_blog_style_img_" + current_view)).load(function(){
95
  jQuery(".bwg_blog_style_img_" + current_view).closest(jQuery(".blog_style_image_buttons_conteiner_" + current_view)).show();
96
  });
photo-gallery.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Photo Gallery
5
  * Plugin URI: https://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.3.54
8
  * Author: Photo Gallery Team
9
  * Author URI: https://web-dorado.com/
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -283,216 +283,13 @@ function bwg_shortcode($params) {
283
  }
284
  }
285
  else {
286
- die();
287
  }
288
- }
289
- shortcode_atts(array(
290
- 'gallery_type' => 'thumbnails',
291
- 'theme_id' => 1,
292
- ), $params);
293
- switch ($params['gallery_type']) {
294
- case 'thumbnails': {
295
- shortcode_atts(array(
296
- 'gallery_id' => 1,
297
- 'sort_by' => 'order',
298
- 'order_by' => 'asc',
299
- 'show_search_box' => 0,
300
- 'search_box_width' => 180,
301
- 'image_column_number' => 3,
302
- 'images_per_page' => 15,
303
- 'image_title' => 'none',
304
- 'image_enable_page' => 1,
305
- 'thumb_width' => 120,
306
- 'thumb_height' => 90,
307
- 'image_width' => 800,
308
- 'image_height' => 600,
309
- 'image_effect' => 'fade',
310
- 'enable_image_filmstrip' => 0,
311
- 'image_filmstrip_height' => 50,
312
- 'enable_image_ctrl_btn' => 1,
313
- 'enable_image_fullscreen' => 1,
314
- 'enable_comment_social' => 1,
315
- 'enable_image_facebook' => 1,
316
- 'enable_image_twitter' => 1,
317
- 'enable_image_google' => 1,
318
- 'watermark_type' => 'none',
319
- 'load_more_image_count' => 15,
320
- 'show_tag_box' => 0,
321
- 'show_gallery_description' => 0,
322
- 'showthumbs_name' => 0,
323
- ), $params);
324
- break;
325
-
326
- }
327
-
328
- case 'slideshow': {
329
- shortcode_atts(array(
330
- 'gallery_id' => 1,
331
- 'sort_by' => 'order',
332
- 'order_by' => 'asc',
333
- 'slideshow_effect' => 'fade',
334
- 'slideshow_interval' => 5,
335
- 'slideshow_width' => 800,
336
- 'slideshow_height' => 600,
337
- 'enable_slideshow_autoplay' => 0,
338
- 'enable_slideshow_shuffle' => 0,
339
- 'enable_slideshow_ctrl' => 1,
340
- 'enable_slideshow_filmstrip' => 0,
341
- 'slideshow_filmstrip_height' => 70,
342
- 'slideshow_enable_title' => 0,
343
- 'slideshow_title_full_width' => 0,
344
- 'slideshow_title_position' => 'top-right',
345
- 'slideshow_enable_description' => 0,
346
- 'slideshow_description_position' => 'bottom-right',
347
- 'enable_slideshow_music' => 0,
348
- 'slideshow_music_url' => '',
349
- 'slideshow_effect_duration' => 1,
350
- 'show_gallery_description' => 0
351
- ), $params);
352
- break;
353
-
354
- }
355
- case 'image_browser': {
356
- shortcode_atts(array(
357
- 'gallery_id' => 1,
358
- 'sort_by' => 'order',
359
- 'order_by' => 'asc',
360
- 'show_search_box' => 0,
361
- 'search_box_width' => 180,
362
- 'image_browser_width' => 800,
363
- 'image_browser_title_enable' => 1,
364
- 'image_browser_description_enable' => 1,
365
- 'watermark_type' => 'none',
366
- 'show_gallery_description' => 0,
367
- 'showthumbs_name' => 0,
368
- ), $params);
369
- break;
370
-
371
- }
372
- case 'album_compact_preview': {
373
- shortcode_atts(array(
374
- 'album_id' => 1,
375
- 'sort_by' => 'order',
376
- 'show_search_box' => 0,
377
- 'search_box_width' => 180,
378
- 'compuct_album_column_number' => 3,
379
- 'compuct_albums_per_page' => 15,
380
- 'compuct_album_title' => 'hover',
381
- 'compuct_album_view_type' => 'thumbnail',
382
- 'compuct_album_thumb_width' => 120,
383
- 'compuct_album_thumb_height' => 90,
384
- 'compuct_album_image_column_number' => 3,
385
- 'compuct_album_images_per_page' => 15,
386
- 'compuct_album_image_title' => 'none',
387
- 'compuct_album_image_thumb_width' => 120,
388
- 'compuct_album_image_thumb_height' => 120,
389
- 'compuct_album_enable_page' => 1,
390
- 'watermark_type' => 'none',
391
- 'compuct_album_load_more_image_count' => 15,
392
- 'compuct_albums_per_page_load_more' => 15,
393
- 'show_gallery_description' => 0,
394
- 'show_album_name' => 0,
395
- ), $params);
396
- break;
397
-
398
- }
399
- case 'album_extended_preview': {
400
- shortcode_atts(array(
401
- 'album_id' => 1,
402
- 'sort_by' => 'order',
403
- 'show_search_box' => 0,
404
- 'search_box_width' => 180,
405
- 'extended_albums_per_page' => 15,
406
- 'extended_album_height' => 150,
407
- 'extended_album_description_enable' => 1,
408
- 'extended_album_view_type' => 'thumbnail',
409
- 'extended_album_thumb_width' => 120,
410
- 'extended_album_thumb_height' => 90,
411
- 'extended_album_image_column_number' => 3,
412
- 'extended_album_images_per_page' => 15,
413
- 'extended_album_image_title' => 'none',
414
- 'extended_album_image_thumb_width' => 120,
415
- 'extended_album_image_thumb_height' => 90,
416
- 'extended_album_enable_page' => 1,
417
- 'watermark_type' => 'none',
418
- 'extended_album_load_more_image_count' => 15,
419
- 'extended_albums_per_page_load_more' => 15,
420
- 'show_gallery_description' => 0,
421
- 'show_album_name' => 0,
422
- ), $params);
423
- break;
424
-
425
- }
426
-
427
- default: {
428
- die();
429
- }
430
- }
431
-
432
- shortcode_atts(array(
433
- 'popup_fullscreen' => 0,
434
- 'popup_autoplay' => 0,
435
- 'popup_width' => 800,
436
- 'popup_height' => 600,
437
- 'popup_effect' => 'fade',
438
- 'popup_interval' => 5,
439
- 'popup_enable_filmstrip' => 0,
440
- 'popup_filmstrip_height' => 70,
441
- 'popup_enable_ctrl_btn' => 1,
442
- 'popup_enable_fullscreen' => 1,
443
- 'popup_enable_info' => 1,
444
- 'popup_info_full_width' => 0,
445
- 'popup_info_always_show' => 0,
446
- 'popup_hit_counter' => 0,
447
- 'popup_enable_rate' => 0,
448
- 'popup_enable_comment' => 1,
449
- 'popup_enable_facebook' => 1,
450
- 'popup_enable_twitter' => 1,
451
- 'popup_enable_google' => 1,
452
- 'popup_enable_pinterest' => 0,
453
- 'popup_enable_tumblr' => 0,
454
- 'watermark_type' => 'none',
455
- 'popup_effect_duration' => 1,
456
- ), $params);
457
-
458
- switch ($params['watermark_type']) {
459
- case 'text': {
460
- shortcode_atts(array(
461
- 'watermark_link' => '',
462
- 'watermark_text' => '',
463
- 'watermark_font_size' => 12,
464
- 'watermark_font' => 'segoe ui',
465
- 'watermark_color' => 'FFFFFF',
466
- 'watermark_opacity' => 30,
467
- 'watermark_position' => 'bottom-right',
468
- ), $params);
469
- break;
470
-
471
- }
472
- case 'image': {
473
- shortcode_atts(array(
474
- 'watermark_link' => '',
475
- 'watermark_url' => '',
476
- 'watermark_width' => 120,
477
- 'watermark_height' => 90,
478
- 'watermark_opacity' => 30,
479
- 'watermark_position' => 'bottom-right',
480
- ), $params);
481
- break;
482
-
483
- }
484
- default: {
485
- $params['watermark_type'] = 'none';
486
- break;
487
- }
488
- }
489
- foreach ($params as $key => $param) {
490
- if (empty($param[$key]) == FALSE) {
491
- $param[$key] = esc_html(addslashes($param[$key]));
492
- }
493
- }
494
- ob_start();
495
- bwg_front_end($params);
496
  return str_replace(array("\r\n", "\n", "\r"), '', ob_get_clean());
497
  // return ob_get_clean();
498
  }
@@ -1707,7 +1504,7 @@ function bwg_activate() {
1707
  }
1708
 
1709
  $version = get_option('wd_bwg_version');
1710
- $new_version = '1.3.54';
1711
  if ($version && version_compare($version, $new_version, '<')) {
1712
  require_once WD_BWG_DIR . "/update/bwg_update.php";
1713
  bwg_update($version);
@@ -1759,7 +1556,7 @@ wp_oembed_add_provider( '#https://instagr(\.am|am\.com)/p/.*#i', 'https://api.in
1759
 
1760
  function bwg_update_hook() {
1761
  $version = get_option('wd_bwg_version');
1762
- $new_version = '1.3.54';
1763
  if ($version && version_compare($version, $new_version, '<')) {
1764
  require_once WD_BWG_DIR . "/update/bwg_update.php";
1765
  bwg_update($version);
4
  * Plugin Name: Photo Gallery
5
  * Plugin URI: https://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.3.55
8
  * Author: Photo Gallery Team
9
  * Author URI: https://web-dorado.com/
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
283
  }
284
  }
285
  else {
286
+ return;
287
  }
288
+ }
289
+ $pairs = array();
290
+ $pairs = WDWLibrary::get_shortcode_option_params( $params );
291
+ ob_start();
292
+ bwg_front_end( $pairs );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  return str_replace(array("\r\n", "\n", "\r"), '', ob_get_clean());
294
  // return ob_get_clean();
295
  }
1504
  }
1505
 
1506
  $version = get_option('wd_bwg_version');
1507
+ $new_version = '1.3.55';
1508
  if ($version && version_compare($version, $new_version, '<')) {
1509
  require_once WD_BWG_DIR . "/update/bwg_update.php";
1510
  bwg_update($version);
1556
 
1557
  function bwg_update_hook() {
1558
  $version = get_option('wd_bwg_version');
1559
+ $new_version = '1.3.55';
1560
  if ($version && version_compare($version, $new_version, '<')) {
1561
  require_once WD_BWG_DIR . "/update/bwg_update.php";
1562
  bwg_update($version);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://web-dorado.com/products/wordpress-photo-gallery-plugin.html
4
  Tags: gallery, photo gallery, image gallery, responsive gallery, wordpress gallery plugin, photo albums, gallery slider, gallery lightbox, wordpress photo gallery plugin, fullscreen gallery, watermarking, video gallery
5
  Requires at least: 3.4
6
  Tested up to: 4.8
7
- Stable tag: 1.3.54
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -187,6 +187,10 @@ To enable the feature of adding Media Library images, go to Photo Gallery > Opti
187
 
188
  == Changelog ==
189
 
 
 
 
 
190
  = 1.3.54 =
191
  * Changed: Show notification to install Backup WD plugin only on plugin pages.
192
 
4
  Tags: gallery, photo gallery, image gallery, responsive gallery, wordpress gallery plugin, photo albums, gallery slider, gallery lightbox, wordpress photo gallery plugin, fullscreen gallery, watermarking, video gallery
5
  Requires at least: 3.4
6
  Tested up to: 4.8
7
+ Stable tag: 1.3.55
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
187
 
188
  == Changelog ==
189
 
190
+ = 1.3.55 =
191
+ * Changed: Create custom post on album, gallery, tag save.
192
+ * Fixed: Carousel view.
193
+
194
  = 1.3.54 =
195
  * Changed: Show notification to install Backup WD plugin only on plugin pages.
196
 
update/bwg_update.php CHANGED
@@ -376,5 +376,9 @@ function bwg_update($version) {
376
  $bwg_options_row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_option WHERE id="%d"', 1));
377
  add_option('wd_bwg_options', json_encode($bwg_options_row), '', 'no');
378
  }
379
- return;
 
 
 
 
380
  }
376
  $bwg_options_row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'bwg_option WHERE id="%d"', 1));
377
  add_option('wd_bwg_options', json_encode($bwg_options_row), '', 'no');
378
  }
379
+ if (version_compare($version, '1.3.55') == -1) {
380
+ require_once(WD_BWG_DIR . '/framework/WDWLibrary.php');
381
+ WDWLibrary::before_update_create_custom_posts();
382
+ }
383
+ return;
384
  }