Galleries by Angie Makes - Version 1.18

Version Description

Download this release

Release Info

Developer cbaldelomar
Plugin Icon wp plugin Galleries by Angie Makes
Version 1.18
Comparing to
See all releases

Code changes from version 1.17 to 1.18

README.md CHANGED
@@ -46,6 +46,10 @@ Insert a gallery through your dashboard. You will see extra dropdown settings wh
46
 
47
  ## Changelog ##
48
 
 
 
 
 
49
  ### Version 1.17
50
 
51
  * Bug fix
46
 
47
  ## Changelog ##
48
 
49
+ ### Version 1.18
50
+
51
+ * Added option to open images in new tab
52
+
53
  ### Version 1.17
54
 
55
  * Bug fix
includes/functions.php CHANGED
@@ -91,6 +91,7 @@ function wc_gallery_shortcode($blank, $attr) {
91
  'customlink' => 'false',
92
  'bottomspace' => 'default',
93
  'hidecontrols' => 'false',
 
94
  'class' => '',
95
  'include' => '',
96
  'exclude' => ''
@@ -147,6 +148,12 @@ function wc_gallery_shortcode($blank, $attr) {
147
 
148
  $showcaptions = 'hide' == $captions ? false : true;
149
  $customlink = 'true' == $customlink ? true : false;
 
 
 
 
 
 
150
  $class = array();
151
  $class[] = 'gallery';
152
  $class[] = 'wc-gallery-captions-' . $captions;
@@ -169,8 +176,9 @@ function wc_gallery_shortcode($blank, $attr) {
169
 
170
  $class[] = 'wc' . $display;
171
  $class[] = 'wcflexslider';
172
- if ( 'true' == $hidecontrols )
173
  $class[] = 'wcflexslider-hidecontrols';
 
174
 
175
  $wrap_class = array();
176
  $wrap_class[] = 'wcflexslider-container';
@@ -196,15 +204,15 @@ function wc_gallery_shortcode($blank, $attr) {
196
  if ( ! empty( $link ) ) {
197
  if ( $customlink ) {
198
  $url = get_post_meta( $id, _WC_GALLERY_PREFIX . 'custom_image_link', true );
199
- $image_output = '<a href="'.$url.'">' . $image_output . '</a>';
200
  }
201
  else if ( 'post' === $link ) {
202
  $url = get_attachment_link( $id );
203
- $image_output = '<a href="'.$url.'">' . $image_output . '</a>';
204
  }
205
  else if ( 'file' === $link ) {
206
  $url = wp_get_attachment_url( $id );
207
- $image_output = '<a href="'.$url.'">' . $image_output . '</a>';
208
  }
209
  }
210
 
@@ -248,7 +256,7 @@ function wc_gallery_shortcode($blank, $attr) {
248
  $i = 1;
249
  foreach ( $links as $key => $attachment ) {
250
  $id = $attachment->ID;
251
- $image_output = wc_gallery_get_attachment_link( $id, $size, false, false, false, $targetsize, true );
252
 
253
  $image_meta = wp_get_attachment_metadata( $id );
254
 
@@ -306,15 +314,15 @@ function wc_gallery_shortcode($blank, $attr) {
306
  if ( ! empty( $link ) ) {
307
  if ( $customlink ) {
308
  $url = get_post_meta( $id, _WC_GALLERY_PREFIX . 'custom_image_link', true );
309
- $image_output = '<a href="'.$url.'">' . $image_output . '</a>';
310
  }
311
  else if ( 'post' === $link ) {
312
  $url = get_attachment_link( $id );
313
- $image_output = '<a href="'.$url.'">' . $image_output . '</a>';
314
  }
315
  else if ( 'file' === $link ) {
316
  $url = wp_get_attachment_url( $id );
317
- $image_output = '<a href="'.$url.'">' . $image_output . '</a>';
318
  }
319
  }
320
 
@@ -366,15 +374,17 @@ function wc_gallery_shortcode($blank, $attr) {
366
  $i = 0;
367
  foreach ( $attachments as $id => $attachment ) {
368
  if ( $customlink ) {
369
- $image_output = wc_gallery_get_attachment_link( $id, $size, false, false, false, $targetsize, $customlink );
370
  }
371
  else if ( ! empty( $link ) && 'file' === $link ) {
372
- $image_output = wc_gallery_get_attachment_link( $id, $size, false, false, false, $targetsize, $customlink );
373
  }
374
- else if ( ! empty( $link ) && 'none' === $link )
375
  $image_output = wp_get_attachment_image( $id, $size, false );
376
- else
377
- $image_output = wp_get_attachment_link( $id, $size, true, false );
 
 
378
 
379
  $image_meta = wp_get_attachment_metadata( $id );
380
 
@@ -447,7 +457,7 @@ function wc_gallery_seperate_attachments_links( $attachments, $display ) {
447
  * @param string|bool $text Optional, default is false. If string, then will be link text.
448
  * @return string HTML content.
449
  */
450
- function wc_gallery_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $targetsize = 'large', $customlink = false ) {
451
  $id = intval( $id );
452
  $_post = get_post( $id );
453
 
@@ -477,7 +487,7 @@ function wc_gallery_get_attachment_link( $id = 0, $size = 'thumbnail', $permalin
477
  if ( trim( $link_text ) == '' )
478
  $link_text = $_post->post_title;
479
 
480
- return apply_filters( 'wp_get_attachment_link', "<a href='$url' title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon, $text );
481
  }
482
 
483
 
@@ -612,6 +622,11 @@ function wc_gallery_print_media_templates() {
612
  <input class="hidecontrols" type="checkbox" name="hidecontrols" data-setting="hidecontrols" />
613
  </label>
614
 
 
 
 
 
 
615
  <label class="setting">
616
  <span><?php _e( 'Class', 'wc_gallery' ); ?></span>
617
  <input class="class" type="text" name="class" style="float:left;" data-setting="class" />
91
  'customlink' => 'false',
92
  'bottomspace' => 'default',
93
  'hidecontrols' => 'false',
94
+ 'newtab' => 'false',
95
  'class' => '',
96
  'include' => '',
97
  'exclude' => ''
148
 
149
  $showcaptions = 'hide' == $captions ? false : true;
150
  $customlink = 'true' == $customlink ? true : false;
151
+ $newtab = 'true' == $newtab ? true : false;
152
+ $link_target = '_self';
153
+ if ( $newtab ) {
154
+ $link_target = '_blank';
155
+ }
156
+
157
  $class = array();
158
  $class[] = 'gallery';
159
  $class[] = 'wc-gallery-captions-' . $captions;
176
 
177
  $class[] = 'wc' . $display;
178
  $class[] = 'wcflexslider';
179
+ if ( 'true' == $hidecontrols ) {
180
  $class[] = 'wcflexslider-hidecontrols';
181
+ }
182
 
183
  $wrap_class = array();
184
  $wrap_class[] = 'wcflexslider-container';
204
  if ( ! empty( $link ) ) {
205
  if ( $customlink ) {
206
  $url = get_post_meta( $id, _WC_GALLERY_PREFIX . 'custom_image_link', true );
207
+ $image_output = '<a href="'.$url.'" target="'.$link_target.'">' . $image_output . '</a>';
208
  }
209
  else if ( 'post' === $link ) {
210
  $url = get_attachment_link( $id );
211
+ $image_output = '<a href="'.$url.'" target="'.$link_target.'">' . $image_output . '</a>';
212
  }
213
  else if ( 'file' === $link ) {
214
  $url = wp_get_attachment_url( $id );
215
+ $image_output = '<a href="'.$url.'" target="'.$link_target.'">' . $image_output . '</a>';
216
  }
217
  }
218
 
256
  $i = 1;
257
  foreach ( $links as $key => $attachment ) {
258
  $id = $attachment->ID;
259
+ $image_output = wc_gallery_get_attachment_link( $id, $size, false, false, false, $targetsize, true, $link_target );
260
 
261
  $image_meta = wp_get_attachment_metadata( $id );
262
 
314
  if ( ! empty( $link ) ) {
315
  if ( $customlink ) {
316
  $url = get_post_meta( $id, _WC_GALLERY_PREFIX . 'custom_image_link', true );
317
+ $image_output = '<a href="'.$url.'" target="'.$link_target.'">' . $image_output . '</a>';
318
  }
319
  else if ( 'post' === $link ) {
320
  $url = get_attachment_link( $id );
321
+ $image_output = '<a href="'.$url.'" target="'.$link_target.'">' . $image_output . '</a>';
322
  }
323
  else if ( 'file' === $link ) {
324
  $url = wp_get_attachment_url( $id );
325
+ $image_output = '<a href="'.$url.'" target="'.$link_target.'">' . $image_output . '</a>';
326
  }
327
  }
328
 
374
  $i = 0;
375
  foreach ( $attachments as $id => $attachment ) {
376
  if ( $customlink ) {
377
+ $image_output = wc_gallery_get_attachment_link( $id, $size, false, false, false, $targetsize, $customlink, $link_target );
378
  }
379
  else if ( ! empty( $link ) && 'file' === $link ) {
380
+ $image_output = wc_gallery_get_attachment_link( $id, $size, false, false, false, $targetsize, $customlink, $link_target );
381
  }
382
+ else if ( ! empty( $link ) && 'none' === $link ) {
383
  $image_output = wp_get_attachment_image( $id, $size, false );
384
+ }
385
+ else {
386
+ $image_output = wc_gallery_get_attachment_link( $id, $size, true, false, false, 'large', false, $link_target );
387
+ }
388
 
389
  $image_meta = wp_get_attachment_metadata( $id );
390
 
457
  * @param string|bool $text Optional, default is false. If string, then will be link text.
458
  * @return string HTML content.
459
  */
460
+ function wc_gallery_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $targetsize = 'large', $customlink = false, $link_target = '_self' ) {
461
  $id = intval( $id );
462
  $_post = get_post( $id );
463
 
487
  if ( trim( $link_text ) == '' )
488
  $link_text = $_post->post_title;
489
 
490
+ return apply_filters( 'wp_get_attachment_link', "<a href='$url' title='$post_title' target='$link_target'>$link_text</a>", $id, $size, $permalink, $icon, $text );
491
  }
492
 
493
 
622
  <input class="hidecontrols" type="checkbox" name="hidecontrols" data-setting="hidecontrols" />
623
  </label>
624
 
625
+ <label class="setting">
626
+ <span><?php _e( 'New Tab', 'wc_gallery' ); ?></span>
627
+ <input class="newtab" type="checkbox" name="newtab" data-setting="newtab" />
628
+ </label>
629
+
630
  <label class="setting">
631
  <span><?php _e( 'Class', 'wc_gallery' ); ?></span>
632
  <input class="class" type="text" name="class" style="float:left;" data-setting="class" />
includes/js/admin.js CHANGED
@@ -1,6 +1,10 @@
1
  (function ($) {
2
  "use strict";
3
 
 
 
 
 
4
  var media = wp.media;
5
 
6
  // Wrap the render() function to append controls.
@@ -21,6 +25,7 @@
21
  media.gallery.defaults.bottomspace = 'default'; // lil hack that lets media know there's a layout attribute.
22
  media.gallery.defaults.gutterwidth = '0.005'; // lil hack that lets media know there's a layout attribute.
23
  media.gallery.defaults.hidecontrols = false; // lil hack that lets media know there's a layout attribute.
 
24
  media.gallery.defaults.class = ''; // lil hack that lets media know there's a layout attribute.
25
  this.update.apply( this, ['display'] );
26
  this.update.apply( this, ['size'] );
@@ -31,6 +36,7 @@
31
  this.update.apply( this, ['bottomspace'] );
32
  this.update.apply( this, ['gutterwidth'] );
33
  this.update.apply( this, ['hidecontrols'] );
 
34
  this.update.apply( this, ['class'] );
35
 
36
  return this;
1
  (function ($) {
2
  "use strict";
3
 
4
+ if ( 'undefined' == typeof( wp.media ) ) {
5
+ return;
6
+ }
7
+
8
  var media = wp.media;
9
 
10
  // Wrap the render() function to append controls.
25
  media.gallery.defaults.bottomspace = 'default'; // lil hack that lets media know there's a layout attribute.
26
  media.gallery.defaults.gutterwidth = '0.005'; // lil hack that lets media know there's a layout attribute.
27
  media.gallery.defaults.hidecontrols = false; // lil hack that lets media know there's a layout attribute.
28
+ media.gallery.defaults.newtab = false; // lil hack that lets media know there's a layout attribute.
29
  media.gallery.defaults.class = ''; // lil hack that lets media know there's a layout attribute.
30
  this.update.apply( this, ['display'] );
31
  this.update.apply( this, ['size'] );
36
  this.update.apply( this, ['bottomspace'] );
37
  this.update.apply( this, ['gutterwidth'] );
38
  this.update.apply( this, ['hidecontrols'] );
39
+ this.update.apply( this, ['newtab'] );
40
  this.update.apply( this, ['class'] );
41
 
42
  return this;
includes/scripts.php CHANGED
@@ -53,7 +53,11 @@ if( !function_exists ('wc_gallery_scripts') ) :
53
  endif;
54
 
55
  function wc_gallery_enqueue_admin_scripts() {
56
- wp_register_script( 'wc-gallery-admin-js', plugin_dir_url( __FILE__ ) . 'js/admin.js', array ( 'jquery' ), WC_GALLERY_VERSION, true );
57
- wp_enqueue_script( 'wc-gallery-admin-js' );
 
 
 
 
58
  }
59
  add_action('admin_enqueue_scripts', 'wc_gallery_enqueue_admin_scripts' );
53
  endif;
54
 
55
  function wc_gallery_enqueue_admin_scripts() {
56
+ $screen = get_current_screen();
57
+
58
+ if ( 'post' == $screen->base ) {
59
+ wp_register_script( 'wc-gallery-admin-js', plugin_dir_url( __FILE__ ) . 'js/admin.js', array ( 'jquery' ), WC_GALLERY_VERSION, true );
60
+ wp_enqueue_script( 'wc-gallery-admin-js' );
61
+ }
62
  }
63
  add_action('admin_enqueue_scripts', 'wc_gallery_enqueue_admin_scripts' );
readme.txt CHANGED
@@ -46,6 +46,10 @@ Insert a gallery through your dashboard. You will see extra dropdown settings wh
46
 
47
  == Changelog ==
48
 
 
 
 
 
49
  ### Version 1.17
50
 
51
  * Bug fix
46
 
47
  == Changelog ==
48
 
49
+ ### Version 1.18
50
+
51
+ * Added option to open images in new tab
52
+
53
  ### Version 1.17
54
 
55
  * Bug fix
wc-gallery.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://wordpresscanvas.com/features/gallery/
5
  Description: Extend WordPress galleries to display masonry gallery, carousel gallery, and slider gallery
6
  Author: Chris Baldelomar
7
  Author URI: http://webplantmedia.com/
8
- Version: 1.17
9
  License: GPLv2 or later
10
  */
11
 
@@ -13,7 +13,7 @@ function wc_gallery_using_woocommerce() {
13
  return in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
14
  }
15
 
16
- define( 'WC_GALLERY_VERSION', '1.17' );
17
  define( 'WC_GALLERY_PREFIX', 'wc_gallery_' );
18
  define( '_WC_GALLERY_PREFIX', '_wc_gallery_' );
19
  define( 'WC_GALLERY_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
5
  Description: Extend WordPress galleries to display masonry gallery, carousel gallery, and slider gallery
6
  Author: Chris Baldelomar
7
  Author URI: http://webplantmedia.com/
8
+ Version: 1.18
9
  License: GPLv2 or later
10
  */
11
 
13
  return in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
14
  }
15
 
16
+ define( 'WC_GALLERY_VERSION', '1.18' );
17
  define( 'WC_GALLERY_PREFIX', 'wc_gallery_' );
18
  define( '_WC_GALLERY_PREFIX', '_wc_gallery_' );
19
  define( 'WC_GALLERY_PLUGIN_URL', plugin_dir_url( __FILE__ ) );