Galleries by Angie Makes - Version 1.5

Version Description

Download this release

Release Info

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

Code changes from version 1.4 to 1.5

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.4
50
 
51
  * Better positioning of directional arrows
46
 
47
  ## Changelog ##
48
 
49
+ ### Version 1.5
50
+
51
+ * Enhanced Gallery Options
52
+
53
  ### Version 1.4
54
 
55
  * Better positioning of directional arrows
includes/css/style.css CHANGED
@@ -52,47 +52,36 @@
52
  }
53
 
54
  /* firefox can't handle more than 5 decimals */
55
- .wc-gallery.gallery.gallery-columns-1 .gallery-item {
56
  width: 100%;
57
  }
58
- .wc-gallery.gallery.gallery-columns-2 .gallery-item {
59
  width: 50%;
60
  }
61
- .wc-gallery.gallery.gallery-columns-3 .gallery-item {
62
  width: 33.33333%;
63
  }
64
- .wc-gallery.gallery.gallery-columns-4 .gallery-item {
65
  width: 25%;
66
  }
67
- .wc-gallery.gallery.gallery-columns-5 .gallery-item {
68
  width: 20%;
69
  }
70
- .wc-gallery.gallery.gallery-columns-6 .gallery-item {
71
  width: 16.66666%;
72
  }
73
- .wc-gallery.gallery.gallery-columns-7 .gallery-item {
74
  width: 14.28571%;
75
  }
76
- .wc-gallery.gallery.gallery-columns-8 .gallery-item {
77
  width: 12.5%;
78
  }
79
- .wc-gallery.gallery.gallery-columns-9 .gallery-item {
80
  width: 11.11111%;
81
  }
82
 
83
  .wc-gallery .gallery-caption {
84
  margin: 0;
85
- max-height: 50%;
86
- min-height: 0;
87
- box-shadow: none;
88
- opacity: 1;
89
- position: relative;
90
- background-color: #eeeeee;
91
- color: #666666;
92
- bottom: 0;
93
- left: 0;
94
- right: 0;
95
- text-align: left;
96
  /* -webkit-transition: opacity 400ms ease; */
97
  /* transition: opacity 400ms ease; */
98
 
@@ -108,21 +97,53 @@
108
 
109
  width: auto;
110
  }
111
- .wc-gallery .gallery-caption:after,
112
- .wc-gallery .gallery-caption:before {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  box-shadow: none;
114
  min-height: 0;
115
  position:relative;
116
  display: none;
117
  }
118
 
119
- .wc-gallery .gallery-captions-on-hover .gallery-caption {
 
120
  background: rgba(255, 255, 255, .8);
121
  position: absolute;
122
  display: none;
123
  }
124
 
125
- .wc-gallery .gallery-captions-on-hover .gallery-item:hover .gallery-caption {
 
126
  display: block;
127
  }
128
 
52
  }
53
 
54
  /* firefox can't handle more than 5 decimals */
55
+ .wc-gallery .gallery.gallery-columns-1 .gallery-item {
56
  width: 100%;
57
  }
58
+ .wc-gallery .gallery.gallery-columns-2 .gallery-item {
59
  width: 50%;
60
  }
61
+ .wc-gallery .gallery.gallery-columns-3 .gallery-item {
62
  width: 33.33333%;
63
  }
64
+ .wc-gallery .gallery.gallery-columns-4 .gallery-item {
65
  width: 25%;
66
  }
67
+ .wc-gallery .gallery.gallery-columns-5 .gallery-item {
68
  width: 20%;
69
  }
70
+ .wc-gallery .gallery.gallery-columns-6 .gallery-item {
71
  width: 16.66666%;
72
  }
73
+ .wc-gallery .gallery.gallery-columns-7 .gallery-item {
74
  width: 14.28571%;
75
  }
76
+ .wc-gallery .gallery.gallery-columns-8 .gallery-item {
77
  width: 12.5%;
78
  }
79
+ .wc-gallery .gallery.gallery-columns-9 .gallery-item {
80
  width: 11.11111%;
81
  }
82
 
83
  .wc-gallery .gallery-caption {
84
  margin: 0;
 
 
 
 
 
 
 
 
 
 
 
85
  /* -webkit-transition: opacity 400ms ease; */
86
  /* transition: opacity 400ms ease; */
87
 
97
 
98
  width: auto;
99
  }
100
+ .wc-gallery .gallery-caption h2,
101
+ .wc-gallery .gallery-caption h3,
102
+ .wc-gallery .gallery-caption h4,
103
+ .wc-gallery .gallery-caption h5,
104
+ .wc-gallery .gallery-caption h6,
105
+ .wc-gallery .gallery-caption p {
106
+ margin: 0;
107
+ padding: 0;
108
+ text-align: center;
109
+ }
110
+
111
+ .wc-gallery .gallery-caption p {
112
+ text-align: left;
113
+ }
114
+
115
+ .wc-gallery-captions-onhover .gallery-caption,
116
+ .wc-gallery-captions-showon .gallery-caption {
117
+ max-height: 50%;
118
+ min-height: 0;
119
+ box-shadow: none;
120
+ opacity: 1;
121
+ position: relative;
122
+ background-color: #eeeeee;
123
+ color: #666666;
124
+ bottom: 0;
125
+ left: 0;
126
+ right: 0;
127
+ }
128
+ .wc-gallery-captions-onhover .gallery-caption:after,
129
+ .wc-gallery-captions-showon .gallery-caption:after,
130
+ .wc-gallery-captions-onhover .gallery-caption:before,
131
+ .wc-gallery-captions-showon .gallery-caption:before {
132
  box-shadow: none;
133
  min-height: 0;
134
  position:relative;
135
  display: none;
136
  }
137
 
138
+ .wc-gallery-captions-showon .gallery-caption,
139
+ .wc-gallery-captions-onhover .gallery-caption {
140
  background: rgba(255, 255, 255, .8);
141
  position: absolute;
142
  display: none;
143
  }
144
 
145
+ .wc-gallery-captions-showon .gallery-caption,
146
+ .wc-gallery-captions-onhover .gallery-item:hover .gallery-caption {
147
  display: block;
148
  }
149
 
includes/functions.php CHANGED
@@ -27,10 +27,8 @@ function wc_gallery_shortcode($blank, $attr) {
27
  'order' => 'ASC',
28
  'orderby' => 'menu_order ID',
29
  'id' => $post ? $post->ID : 0,
30
- 'itemtag' => 'dl',
31
- 'icontag' => 'dt',
32
- 'captiontag' => 'dd',
33
  'captions' => 'show',
 
34
  'columns' => 3,
35
  'link' => 'post',
36
  'size' => 'thumbnail',
@@ -44,6 +42,11 @@ function wc_gallery_shortcode($blank, $attr) {
44
  'exclude' => ''
45
  ), $attr, 'gallery'));
46
 
 
 
 
 
 
47
  $id = intval($id);
48
  if ( 'RAND' == $order )
49
  $orderby = 'none';
@@ -71,17 +74,6 @@ function wc_gallery_shortcode($blank, $attr) {
71
  return $output;
72
  }
73
 
74
- $itemtag = tag_escape($itemtag);
75
- $captiontag = tag_escape($captiontag);
76
- $icontag = tag_escape($icontag);
77
- $valid_tags = wp_kses_allowed_html( 'post' );
78
- if ( ! isset( $valid_tags[ $itemtag ] ) )
79
- $itemtag = 'dl';
80
- if ( ! isset( $valid_tags[ $captiontag ] ) )
81
- $captiontag = 'dd';
82
- if ( ! isset( $valid_tags[ $icontag ] ) )
83
- $icontag = 'dt';
84
-
85
  $columns = intval($columns);
86
  $itemwidth = $columns > 0 ? floor(100/$columns) : 100;
87
  $float = is_rtl() ? 'right' : 'left';
@@ -92,8 +84,12 @@ function wc_gallery_shortcode($blank, $attr) {
92
 
93
  $showcaptions = 'hide' == $captions ? false : true;
94
  $customlink = 'true' == $customlink ? true : false;
95
- $class = explode( ' ', $class );
 
96
  $class[] = 'wc-gallery-bottomspace-' . $bottomspace;
 
 
 
97
 
98
  $sliders = array( 'slider', 'slider2', 'carousel' );
99
 
@@ -101,8 +97,6 @@ function wc_gallery_shortcode($blank, $attr) {
101
  wp_enqueue_script( 'wc-gallery-flexslider' );
102
  wp_enqueue_script( 'wc-gallery' );
103
 
104
- $class[] = 'wc-gallery';
105
- $class[] = 'gallery';
106
  $class[] = 'wc' . $display;
107
  $class[] = 'wcflexslider';
108
  if ( 'true' == $hidecontrols )
@@ -143,10 +137,12 @@ function wc_gallery_shortcode($blank, $attr) {
143
  $output .= "
144
  <li class='wcflex-slide-item'>
145
  $image_output";
146
- if ( $showcaptions && $captiontag && trim($attachment->post_excerpt) ) {
147
  $output .= "
148
  <div class='wp-caption-text gallery-caption'>
 
149
  " . wptexturize($attachment->post_excerpt) . "
 
150
  </div>";
151
  }
152
  $output .= "</li>";
@@ -160,8 +156,6 @@ function wc_gallery_shortcode($blank, $attr) {
160
 
161
  $display = 'float' == $display ? 'default' : $display;
162
 
163
- $class[] = "wc-gallery";
164
- $class[] = "gallery";
165
  $class[] = "gallery-{$display}";
166
  $class[] = "galleryid-{$id}";
167
  $class[] = "gallery-columns-{$columns}";
@@ -170,9 +164,6 @@ function wc_gallery_shortcode($blank, $attr) {
170
  if ( ! $customlink )
171
  $class[] = "gallery-link-{$link}";
172
 
173
- if ( 'onhover' == $captions )
174
- $class[] = 'gallery-captions-on-hover';
175
-
176
  $class = implode( ' ', $class );
177
 
178
  $output = "<div id='$selector' class='{$class}'>";
@@ -194,18 +185,20 @@ function wc_gallery_shortcode($blank, $attr) {
194
  if ( isset( $image_meta['height'], $image_meta['width'] ) )
195
  $orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
196
 
197
- $output .= "<{$itemtag} class='gallery-item'>";
198
  $output .= "
199
- <{$icontag} class='gallery-icon {$orientation}'>
200
  $image_output
201
- </{$icontag}>";
202
- if ( $showcaptions && $captiontag && trim($attachment->post_excerpt) ) {
203
  $output .= "
204
- <{$captiontag} class='wp-caption-text gallery-caption'>
205
- " . wptexturize($attachment->post_excerpt) . "
206
- </{$captiontag}>";
 
 
207
  }
208
- $output .= "</{$itemtag}>";
209
  }
210
 
211
  $output .= "</div>\n";
@@ -314,13 +307,14 @@ function wc_gallery_print_media_templates() {
314
 
315
  <?php
316
  $captions = array(
317
- 'show' => __( 'Show', 'wc_gallery' ),
 
318
  'onhover' => __( 'On Image Hover', 'wc_gallery' ),
319
  'hide' => __( 'Hide', 'wc_gallery' )
320
  );
321
  ?>
322
  <label class="setting">
323
- <span><?php _e( 'Show Captions', 'wc_gallery' ); ?></span>
324
  <select class="captions" name="captions" data-setting="captions">
325
  <?php foreach ( $captions as $key => $value ) : ?>
326
  <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, 'show' ); ?>><?php echo esc_html( $value ); ?></option>
@@ -328,6 +322,25 @@ function wc_gallery_print_media_templates() {
328
  </select>
329
  </label>
330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  <label class="setting">
332
  <span><?php _e( 'Custom Link', 'wc_gallery' ); ?></span>
333
  <input type="checkbox" name="customlink" data-setting="customlink" />
27
  'order' => 'ASC',
28
  'orderby' => 'menu_order ID',
29
  'id' => $post ? $post->ID : 0,
 
 
 
30
  'captions' => 'show',
31
+ 'captiontype' => 'p',
32
  'columns' => 3,
33
  'link' => 'post',
34
  'size' => 'thumbnail',
42
  'exclude' => ''
43
  ), $attr, 'gallery'));
44
 
45
+ $custom_class = trim( $class );
46
+ $valid_caption_types = array( 'p', 'h2', 'h3', 'h4', 'h5', 'h6' );
47
+ $captiontype = in_array( $captiontype, $valid_caption_types ) ? $captiontype : 'p';
48
+ $captiontype = tag_escape($captiontype);
49
+
50
  $id = intval($id);
51
  if ( 'RAND' == $order )
52
  $orderby = 'none';
74
  return $output;
75
  }
76
 
 
 
 
 
 
 
 
 
 
 
 
77
  $columns = intval($columns);
78
  $itemwidth = $columns > 0 ? floor(100/$columns) : 100;
79
  $float = is_rtl() ? 'right' : 'left';
84
 
85
  $showcaptions = 'hide' == $captions ? false : true;
86
  $customlink = 'true' == $customlink ? true : false;
87
+ $class = array();
88
+ $class[] = 'gallery';
89
  $class[] = 'wc-gallery-bottomspace-' . $bottomspace;
90
+ $class[] = 'wc-gallery-captions-' . $captions;
91
+ if ( ! empty( $custom_class ) )
92
+ $class[] = esc_attr( $custom_class );
93
 
94
  $sliders = array( 'slider', 'slider2', 'carousel' );
95
 
97
  wp_enqueue_script( 'wc-gallery-flexslider' );
98
  wp_enqueue_script( 'wc-gallery' );
99
 
 
 
100
  $class[] = 'wc' . $display;
101
  $class[] = 'wcflexslider';
102
  if ( 'true' == $hidecontrols )
137
  $output .= "
138
  <li class='wcflex-slide-item'>
139
  $image_output";
140
+ if ( $showcaptions && trim($attachment->post_excerpt) ) {
141
  $output .= "
142
  <div class='wp-caption-text gallery-caption'>
143
+ <{$captiontype}>
144
  " . wptexturize($attachment->post_excerpt) . "
145
+ </{$captiontype}>
146
  </div>";
147
  }
148
  $output .= "</li>";
156
 
157
  $display = 'float' == $display ? 'default' : $display;
158
 
 
 
159
  $class[] = "gallery-{$display}";
160
  $class[] = "galleryid-{$id}";
161
  $class[] = "gallery-columns-{$columns}";
164
  if ( ! $customlink )
165
  $class[] = "gallery-link-{$link}";
166
 
 
 
 
167
  $class = implode( ' ', $class );
168
 
169
  $output = "<div id='$selector' class='{$class}'>";
185
  if ( isset( $image_meta['height'], $image_meta['width'] ) )
186
  $orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
187
 
188
+ $output .= "<div class='gallery-item'>";
189
  $output .= "
190
+ <div class='gallery-icon {$orientation}'>
191
  $image_output
192
+ </div>";
193
+ if ( $showcaptions && trim($attachment->post_excerpt) ) {
194
  $output .= "
195
+ <div class='wp-caption-text gallery-caption'>
196
+ <{$captiontype}>
197
+ " . wptexturize($attachment->post_excerpt) . "
198
+ </{$captiontype}>
199
+ </div>";
200
  }
201
+ $output .= "</div>";
202
  }
203
 
204
  $output .= "</div>\n";
307
 
308
  <?php
309
  $captions = array(
310
+ 'show' => __( 'Show Below Image', 'wc_gallery' ),
311
+ 'showon' => __( 'Show On Image', 'wc_gallery' ),
312
  'onhover' => __( 'On Image Hover', 'wc_gallery' ),
313
  'hide' => __( 'Hide', 'wc_gallery' )
314
  );
315
  ?>
316
  <label class="setting">
317
+ <span><?php _e( 'Captions', 'wc_gallery' ); ?></span>
318
  <select class="captions" name="captions" data-setting="captions">
319
  <?php foreach ( $captions as $key => $value ) : ?>
320
  <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, 'show' ); ?>><?php echo esc_html( $value ); ?></option>
322
  </select>
323
  </label>
324
 
325
+ <?php
326
+ $caption_tags = array(
327
+ 'p' => __( 'p', 'wc_gallery' ),
328
+ 'h2' => __( 'h2', 'wc_gallery' ),
329
+ 'h3' => __( 'h3', 'wc_gallery' ),
330
+ 'h4' => __( 'h4', 'wc_gallery' ),
331
+ 'h5' => __( 'h5', 'wc_gallery' ),
332
+ 'h6' => __( 'h6', 'wc_gallery' ),
333
+ );
334
+ ?>
335
+ <label class="setting">
336
+ <span><?php _e( 'Caption Type', 'wc_gallery' ); ?></span>
337
+ <select class="captiontype" name="captiontype" data-setting="captiontype">
338
+ <?php foreach ( $caption_tags as $key => $value ) : ?>
339
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, 'p' ); ?>><?php echo esc_html( $value ); ?></option>
340
+ <?php endforeach; ?>
341
+ </select>
342
+ </label>
343
+
344
  <label class="setting">
345
  <span><?php _e( 'Custom Link', 'wc_gallery' ); ?></span>
346
  <input type="checkbox" name="customlink" data-setting="customlink" />
includes/js/admin.js CHANGED
@@ -16,6 +16,7 @@
16
  media.gallery.defaults.size = 'thumbnail'; // lil hack that lets media know there's a layout attribute.
17
  media.gallery.defaults.targetsize = 'large'; // lil hack that lets media know there's a layout attribute.
18
  media.gallery.defaults.captions = 'show'; // lil hack that lets media know there's a layout attribute.
 
19
  media.gallery.defaults.customlink = false; // lil hack that lets media know there's a layout attribute.
20
  media.gallery.defaults.bottomspace = 'default'; // lil hack that lets media know there's a layout attribute.
21
  media.gallery.defaults.hidecontrols = false; // lil hack that lets media know there's a layout attribute.
@@ -24,6 +25,7 @@
24
  this.update.apply( this, ['size'] );
25
  this.update.apply( this, ['targetsize'] );
26
  this.update.apply( this, ['captions'] );
 
27
  this.update.apply( this, ['customlink'] );
28
  this.update.apply( this, ['bottomspace'] );
29
  this.update.apply( this, ['hidecontrols'] );
16
  media.gallery.defaults.size = 'thumbnail'; // lil hack that lets media know there's a layout attribute.
17
  media.gallery.defaults.targetsize = 'large'; // lil hack that lets media know there's a layout attribute.
18
  media.gallery.defaults.captions = 'show'; // lil hack that lets media know there's a layout attribute.
19
+ media.gallery.defaults.captiontype = 'p'; // lil hack that lets media know there's a layout attribute.
20
  media.gallery.defaults.customlink = false; // lil hack that lets media know there's a layout attribute.
21
  media.gallery.defaults.bottomspace = 'default'; // lil hack that lets media know there's a layout attribute.
22
  media.gallery.defaults.hidecontrols = false; // lil hack that lets media know there's a layout attribute.
25
  this.update.apply( this, ['size'] );
26
  this.update.apply( this, ['targetsize'] );
27
  this.update.apply( this, ['captions'] );
28
+ this.update.apply( this, ['captiontype'] );
29
  this.update.apply( this, ['customlink'] );
30
  this.update.apply( this, ['bottomspace'] );
31
  this.update.apply( this, ['hidecontrols'] );
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.4
50
 
51
  * Better positioning of directional arrows
46
 
47
  == Changelog ==
48
 
49
+ ### Version 1.5
50
+
51
+ * Enhanced Gallery Options
52
+
53
  ### Version 1.4
54
 
55
  * Better positioning of directional arrows
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.4
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.4' );
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.5
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.5' );
17
  define( 'WC_GALLERY_PREFIX', 'wc_gallery_' );
18
  define( '_WC_GALLERY_PREFIX', '_wc_gallery_' );
19
  define( 'WC_GALLERY_PLUGIN_URL', plugin_dir_url( __FILE__ ) );