Responsive Lightbox - Version 1.1

Version Description

Download this release

Release Info

Developer subhansanjaya
Plugin Icon 128x128 Responsive Lightbox
Version 1.1
Comparing to
See all releases

Version 1.1

License.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Wordpress plugin Responsive Lightbox Lite
3
+ * Copyright (C) 2012-2014 www.weaveapps.com
4
+ * http://www.weaveapps.com
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+ */
assets/css/admin.css ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Responsive Lightbox Lite settings */
2
+ .wa-credits { float: right; width: 280px; background: #fff; margin: 20px -300px 20px 20px; position: relative; }
3
+ .wa-credits .inner { padding-left: 10px; padding-right: 10px; }
4
+ .wa-credits h3 { font-size: 14px; line-height: 1.4; margin: 0; padding: 8px 12px; border-bottom: 1px solid #eee; }
5
+ .wa-credits .wa-link { font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-style:italic; padding-bottom: 10px; margin: 0; }
6
+ .wa-credits .wa-link a { vertical-align: middle; padding: 5px 0 0 4px; }
7
+
8
+ .responsive-lightbox-settings { margin-right: 300px; }
9
+ .responsive-lightbox-settings hr { border: solid #eee; border-width: 1px 0 0; clear: both; height: 0; }
10
+ .responsive-lightbox-settings form { float: left; min-width: 463px; width: auto; }
11
+ .responsive-lightbox-settings fieldset span.description { margin-bottom: 8px; margin-top: 4px; display: block; }
12
+
13
+ @media only screen and (max-width: 959px) {
14
+ .responsive-lightbox-settings { width: 100%; float: none; margin: 20px 0; }
15
+ .responsive-lightbox-settings { margin-right: 0; }
16
+ }
assets/inc/script.js ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+
3
+ $(document).on('ready'+rllArgs.custom_events, function() {
4
+ if(rllArgs.script === 'venobox') {
5
+
6
+ $.each($('a[rel*="'+rllArgs.selector+'"]'), function() {
7
+ var match = $(this).attr('rel').match(new RegExp(rllArgs.selector+'\\[(gallery\\-(?:[\\da-z]{1,4}))\\]', 'ig'));
8
+
9
+ if(match !== null) {
10
+ $(this).attr('data-gall', match[0]);
11
+ }
12
+ });
13
+ $('a[rel*="'+rllArgs.selector+'"]').venobox();
14
+ } else if(rllArgs.script === 'nivo_lightbox') {
15
+ $.each($('a[rel*="'+rllArgs.selector+'"]'), function() {
16
+ var match = $(this).attr('rel').match(new RegExp(rllArgs.selector+'\\[(gallery\\-(?:[\\da-z]{1,4}))\\]', 'ig'));
17
+
18
+ if(match !== null) {
19
+ $(this).attr('data-lightbox-gallery', match[0]);
20
+ }
21
+ });
22
+
23
+ $('a[rel*="'+rllArgs.selector+'"]').nivoLightbox();
24
+ }
25
+ });
26
+ });
assets/nivo-lightbox/README.md ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ Nivo Lightbox
2
+ =============
3
+
4
+ A simple, flexible, responsive, retina-ready jQuery lightbox plugin. See http://dev7studios.com/nivo-lightbox for more info.
assets/nivo-lightbox/changelog.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *** Nivo Lightbox Changelog ***
2
+
3
+ 2013.12.11 - version 1.1
4
+ * [New] Added the clickOverlayToClose setting
5
+ * [New] Uppercase image extensions are now supported
6
+ * [Fixed] Can't click anywhere after opening video bug
7
+ * [Fixed] Doesn't work in iOS bug
8
+ * [Fixed] Youtube hyphen in URL bug
9
+ * [Fixed] Inline content overflow bug
10
+
11
+ 2013.08.01 - version 1.0
12
+ * Initial release
assets/nivo-lightbox/license.txt ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2013 Dev7studios
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
assets/nivo-lightbox/nivo-lightbox.css ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Nivo Lightbox v1.1
3
+ * http://dev7studios.com/nivo-lightbox
4
+ *
5
+ * Copyright 2013, Dev7studios
6
+ * Free to use and abuse under the MIT license.
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ */
9
+
10
+ .nivo-lightbox-overlay {
11
+ position: fixed;
12
+ top: 0;
13
+ left: 0;
14
+ z-index: 99998;
15
+ width: 100%;
16
+ height: 100%;
17
+ overflow: hidden;
18
+ visibility: hidden;
19
+ opacity: 0;
20
+ -webkit-box-sizing: border-box;
21
+ -moz-box-sizing: border-box;
22
+ box-sizing: border-box;
23
+ }
24
+ .nivo-lightbox-overlay.nivo-lightbox-open {
25
+ visibility: visible;
26
+ opacity: 1;
27
+ }
28
+ .nivo-lightbox-wrap {
29
+ position: absolute;
30
+ top: 10%;
31
+ bottom: 10%;
32
+ left: 10%;
33
+ right: 10%;
34
+ }
35
+ .nivo-lightbox-content {
36
+ width: 100%;
37
+ height: 100%;
38
+ }
39
+ .nivo-lightbox-title-wrap {
40
+ position: absolute;
41
+ bottom: 0;
42
+ left: 0;
43
+ width: 100%;
44
+ z-index: 99999;
45
+ text-align: center;
46
+ }
47
+ .nivo-lightbox-nav { display: none; }
48
+ .nivo-lightbox-prev {
49
+ position: absolute;
50
+ top: 50%;
51
+ left: 0;
52
+ }
53
+ .nivo-lightbox-next {
54
+ position: absolute;
55
+ top: 50%;
56
+ right: 0;
57
+ }
58
+ .nivo-lightbox-close {
59
+ position: absolute;
60
+ top: 2%;
61
+ right: 2%;
62
+ }
63
+
64
+ .nivo-lightbox-image { text-align: center; }
65
+ .nivo-lightbox-image img {
66
+ max-width: 100%;
67
+ max-height: 100%;
68
+ width: auto;
69
+ height: auto;
70
+ vertical-align: middle;
71
+ }
72
+ .nivo-lightbox-content iframe {
73
+ width: 100%;
74
+ height: 100%;
75
+ }
76
+ .nivo-lightbox-inline,
77
+ .nivo-lightbox-ajax {
78
+ max-height: 100%;
79
+ overflow: auto;
80
+ -webkit-box-sizing: border-box;
81
+ -moz-box-sizing: border-box;
82
+ box-sizing: border-box;
83
+ /* https://bugzilla.mozilla.org/show_bug.cgi?id=308801 */
84
+ }
85
+ .nivo-lightbox-error {
86
+ display: table;
87
+ text-align: center;
88
+ width: 100%;
89
+ height: 100%;
90
+ color: #fff;
91
+ text-shadow: 0 1px 1px #000;
92
+ }
93
+ .nivo-lightbox-error p {
94
+ display: table-cell;
95
+ vertical-align: middle;
96
+ }
97
+
98
+ /* Effects
99
+ **********************************************/
100
+ .nivo-lightbox-notouch .nivo-lightbox-effect-fade,
101
+ .nivo-lightbox-notouch .nivo-lightbox-effect-fadeScale,
102
+ .nivo-lightbox-notouch .nivo-lightbox-effect-slideLeft,
103
+ .nivo-lightbox-notouch .nivo-lightbox-effect-slideRight,
104
+ .nivo-lightbox-notouch .nivo-lightbox-effect-slideUp,
105
+ .nivo-lightbox-notouch .nivo-lightbox-effect-slideDown,
106
+ .nivo-lightbox-notouch .nivo-lightbox-effect-fall {
107
+ -webkit-transition: all 0.2s ease-in-out;
108
+ -moz-transition: all 0.2s ease-in-out;
109
+ -ms-transition: all 0.2s ease-in-out;
110
+ -o-transition: all 0.2s ease-in-out;
111
+ transition: all 0.2s ease-in-out;
112
+ }
113
+
114
+ /* fadeScale */
115
+ .nivo-lightbox-effect-fadeScale .nivo-lightbox-wrap {
116
+ -webkit-transition: all 0.3s;
117
+ -moz-transition: all 0.3s;
118
+ -ms-transition: all 0.3s;
119
+ -o-transition: all 0.3s;
120
+ transition: all 0.3s;
121
+ -webkit-transform: scale(0.7);
122
+ -moz-transform: scale(0.7);
123
+ -ms-transform: scale(0.7);
124
+ transform: scale(0.7);
125
+ }
126
+ .nivo-lightbox-effect-fadeScale.nivo-lightbox-open .nivo-lightbox-wrap {
127
+ -webkit-transform: scale(1);
128
+ -moz-transform: scale(1);
129
+ -ms-transform: scale(1);
130
+ transform: scale(1);
131
+ }
132
+
133
+ /* slideLeft / slideRight / slideUp / slideDown */
134
+ .nivo-lightbox-effect-slideLeft .nivo-lightbox-wrap,
135
+ .nivo-lightbox-effect-slideRight .nivo-lightbox-wrap,
136
+ .nivo-lightbox-effect-slideUp .nivo-lightbox-wrap,
137
+ .nivo-lightbox-effect-slideDown .nivo-lightbox-wrap {
138
+ -webkit-transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
139
+ -moz-transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
140
+ -ms-transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
141
+ -o-transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
142
+ transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
143
+ }
144
+ .nivo-lightbox-effect-slideLeft .nivo-lightbox-wrap {
145
+ -webkit-transform: translateX(-10%);
146
+ -moz-transform: translateX(-10%);
147
+ -ms-transform: translateX(-10%);
148
+ transform: translateX(-10%);
149
+ }
150
+ .nivo-lightbox-effect-slideRight .nivo-lightbox-wrap {
151
+ -webkit-transform: translateX(10%);
152
+ -moz-transform: translateX(10%);
153
+ -ms-transform: translateX(10%);
154
+ transform: translateX(10%);
155
+ }
156
+ .nivo-lightbox-effect-slideLeft.nivo-lightbox-open .nivo-lightbox-wrap,
157
+ .nivo-lightbox-effect-slideRight.nivo-lightbox-open .nivo-lightbox-wrap {
158
+ -webkit-transform: translateX(0);
159
+ -moz-transform: translateX(0);
160
+ -ms-transform: translateX(0);
161
+ transform: translateX(0);
162
+ }
163
+ .nivo-lightbox-effect-slideDown .nivo-lightbox-wrap {
164
+ -webkit-transform: translateY(-10%);
165
+ -moz-transform: translateY(-10%);
166
+ -ms-transform: translateY(-10%);
167
+ transform: translateY(-10%);
168
+ }
169
+ .nivo-lightbox-effect-slideUp .nivo-lightbox-wrap {
170
+ -webkit-transform: translateY(10%);
171
+ -moz-transform: translateY(10%);
172
+ -ms-transform: translateY(10%);
173
+ transform: translateY(10%);
174
+ }
175
+ .nivo-lightbox-effect-slideUp.nivo-lightbox-open .nivo-lightbox-wrap,
176
+ .nivo-lightbox-effect-slideDown.nivo-lightbox-open .nivo-lightbox-wrap {
177
+ -webkit-transform: translateY(0);
178
+ -moz-transform: translateY(0);
179
+ -ms-transform: translateY(0);
180
+ transform: translateY(0);
181
+ }
182
+
183
+ /* fall */
184
+ .nivo-lightbox-body-effect-fall .nivo-lightbox-effect-fall {
185
+ -webkit-perspective: 1000px;
186
+ -moz-perspective: 1000px;
187
+ perspective: 1000px;
188
+ }
189
+ .nivo-lightbox-effect-fall .nivo-lightbox-wrap {
190
+ -webkit-transition: all 0.3s ease-out;
191
+ -moz-transition: all 0.3s ease-out;
192
+ -ms-transition: all 0.3s ease-out;
193
+ -o-transition: all 0.3s ease-out;
194
+ transition: all 0.3s ease-out;
195
+ -webkit-transform: translateZ(300px);
196
+ -moz-transform: translateZ(300px);
197
+ -ms-transform: translateZ(300px);
198
+ transform: translateZ(300px);
199
+ }
200
+ .nivo-lightbox-effect-fall.nivo-lightbox-open .nivo-lightbox-wrap {
201
+ -webkit-transform: translateZ(0);
202
+ -moz-transform: translateZ(0);
203
+ -ms-transform: translateZ(0);
204
+ transform: translateZ(0);
205
+ }
assets/nivo-lightbox/nivo-lightbox.js ADDED
@@ -0,0 +1,359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Nivo Lightbox v1.1
3
+ * http://dev7studios.com/nivo-lightbox
4
+ *
5
+ * Copyright 2013, Dev7studios
6
+ * Free to use and abuse under the MIT license.
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ */
9
+
10
+ ;(function($, window, document, undefined){
11
+
12
+ var pluginName = 'nivoLightbox',
13
+ defaults = {
14
+ effect: 'fade',
15
+ theme: 'default',
16
+ keyboardNav: true,
17
+ clickOverlayToClose: true,
18
+ onInit: function(){},
19
+ beforeShowLightbox: function(){},
20
+ afterShowLightbox: function(lightbox){},
21
+ beforeHideLightbox: function(){},
22
+ afterHideLightbox: function(){},
23
+ onPrev: function(element){},
24
+ onNext: function(element){},
25
+ errorMessage: 'The requested content cannot be loaded. Please try again later.'
26
+ };
27
+
28
+ function NivoLightbox(element, options){
29
+ this.el = element;
30
+ this.$el = $(this.el);
31
+
32
+ this.options = $.extend({}, defaults, options);
33
+
34
+ this._defaults = defaults;
35
+ this._name = pluginName;
36
+
37
+ this.init();
38
+ }
39
+
40
+ NivoLightbox.prototype = {
41
+
42
+ init: function(){
43
+ var $this = this;
44
+
45
+ // Need this so we don't use CSS transitions in mobile
46
+ if(!$('html').hasClass('nivo-lightbox-notouch')) $('html').addClass('nivo-lightbox-notouch');
47
+ if('ontouchstart' in document) $('html').removeClass('nivo-lightbox-notouch');
48
+
49
+ // Setup the click
50
+ this.$el.on('click', function(e){
51
+ e.preventDefault();
52
+ $this.showLightbox();
53
+ });
54
+
55
+ // keyboardNav
56
+ if(this.options.keyboardNav){
57
+ $('body').off('keyup').on('keyup', function(e){
58
+ var code = (e.keyCode ? e.keyCode : e.which);
59
+ // Escape
60
+ if(code == 27) $this.destructLightbox();
61
+ // Left
62
+ if(code == 37) $('.nivo-lightbox-prev').trigger('click');
63
+ // Right
64
+ if(code == 39) $('.nivo-lightbox-next').trigger('click');
65
+ });
66
+ }
67
+
68
+ this.options.onInit.call(this);
69
+
70
+ },
71
+
72
+ showLightbox: function(){
73
+ var $this = this;
74
+ this.options.beforeShowLightbox.call(this);
75
+
76
+ var lightbox = this.constructLightbox();
77
+ if(!lightbox) return;
78
+ var content = lightbox.find('.nivo-lightbox-content');
79
+ if(!content) return;
80
+ var currentLink = this.$el;
81
+ $('body').addClass('nivo-lightbox-body-effect-'+ this.options.effect);
82
+
83
+ // Add content
84
+ this.processContent(content, currentLink);
85
+
86
+ // Nav
87
+ if(this.$el.attr('data-lightbox-gallery')){
88
+ var $this = this,
89
+ galleryItems = $('[data-lightbox-gallery="'+ this.$el.attr('data-lightbox-gallery') +'"]');
90
+
91
+ $('.nivo-lightbox-nav').show();
92
+
93
+ // Prev
94
+ $('.nivo-lightbox-prev').off('click').on('click', function(e){
95
+ e.preventDefault();
96
+ var index = galleryItems.index(currentLink);
97
+ currentLink = galleryItems.eq(index - 1);
98
+ if(!$(currentLink).length) currentLink = galleryItems.last();
99
+ $this.processContent(content, currentLink);
100
+ $this.options.onPrev.call(this, [ currentLink ]);
101
+ });
102
+
103
+ // Next
104
+ $('.nivo-lightbox-next').off('click').on('click', function(e){
105
+ e.preventDefault();
106
+ var index = galleryItems.index(currentLink);
107
+ currentLink = galleryItems.eq(index + 1);
108
+ if(!$(currentLink).length) currentLink = galleryItems.first();
109
+ $this.processContent(content, currentLink);
110
+ $this.options.onNext.call(this, [ currentLink ]);
111
+ });
112
+ }
113
+
114
+ setTimeout(function(){
115
+ lightbox.addClass('nivo-lightbox-open');
116
+ $this.options.afterShowLightbox.call(this, [ lightbox ]);
117
+ }, 1); // For CSS transitions
118
+ },
119
+
120
+ processContent: function(content, link){
121
+ var $this = this;
122
+ var href = link.attr('href');
123
+ content.html('').addClass('nivo-lightbox-loading');
124
+
125
+ // Is HiDPI?
126
+ if(this.isHidpi() && link.attr('data-lightbox-hidpi')){
127
+ href = link.attr('data-lightbox-hidpi');
128
+ }
129
+
130
+ // Image
131
+ if(href.match(/\.(jpeg|jpg|gif|png)$/i) != null){
132
+ var img = $('<img>', { src: href });
133
+ img.one('load', function() {
134
+ var wrap = $('<div class="nivo-lightbox-image" />');
135
+ wrap.append(img);
136
+ content.html(wrap).removeClass('nivo-lightbox-loading');
137
+
138
+ // Vertically center images
139
+ wrap.css({
140
+ 'line-height': $('.nivo-lightbox-content').height() +'px',
141
+ 'height': $('.nivo-lightbox-content').height() +'px' // For Firefox
142
+ });
143
+ $(window).resize(function() {
144
+ wrap.css({
145
+ 'line-height': $('.nivo-lightbox-content').height() +'px',
146
+ 'height': $('.nivo-lightbox-content').height() +'px' // For Firefox
147
+ });
148
+ });
149
+ }).each(function() {
150
+ if(this.complete) $(this).load();
151
+ });
152
+
153
+ img.error(function() {
154
+ var wrap = $('<div class="nivo-lightbox-error"><p>'+ $this.options.errorMessage +'</p></div>');
155
+ content.html(wrap).removeClass('nivo-lightbox-loading');
156
+ });
157
+ }
158
+ // Video (Youtube/Vimeo)
159
+ else if(video = href.match(/(youtube|youtu|vimeo)\.(com|be)\/(watch\?v=([\w-]+)|([\w-]+))/)){
160
+ var src = '',
161
+ classTerm = 'nivo-lightbox-video';
162
+
163
+ if(video[1] == 'youtube'){
164
+ src = 'http://www.youtube.com/v/'+ video[4];
165
+ classTerm = 'nivo-lightbox-youtube';
166
+ }
167
+ if(video[1] == 'youtu'){
168
+ src = 'http://www.youtube.com/v/'+ video[3];
169
+ classTerm = 'nivo-lightbox-youtube';
170
+ }
171
+ if(video[1] == 'vimeo'){
172
+ src = 'http://player.vimeo.com/video/'+ video[3];
173
+ classTerm = 'nivo-lightbox-vimeo';
174
+ }
175
+
176
+ if(src){
177
+ var iframe = $('<iframe>', {
178
+ src: src,
179
+ 'class': classTerm,
180
+ frameborder: 0,
181
+ vspace: 0,
182
+ hspace: 0,
183
+ scrolling: 'auto'
184
+ });
185
+ content.html(iframe);
186
+ iframe.load(function(){ content.removeClass('nivo-lightbox-loading'); });
187
+ }
188
+ }
189
+ // AJAX
190
+ else if(link.attr('data-lightbox-type') == 'ajax'){
191
+ var $this = this;
192
+ $.ajax({
193
+ url: href,
194
+ cache: false,
195
+ success: function(data) {
196
+ var wrap = $('<div class="nivo-lightbox-ajax" />');
197
+ wrap.append(data);
198
+ content.html(wrap).removeClass('nivo-lightbox-loading');
199
+
200
+ // Vertically center html
201
+ if(wrap.outerHeight() < content.height()){
202
+ wrap.css({
203
+ 'position': 'relative',
204
+ 'top': '50%',
205
+ 'margin-top': -(wrap.outerHeight()/2) +'px'
206
+ });
207
+ }
208
+ $(window).resize(function() {
209
+ if(wrap.outerHeight() < content.height()){
210
+ wrap.css({
211
+ 'position': 'relative',
212
+ 'top': '50%',
213
+ 'margin-top': -(wrap.outerHeight()/2) +'px'
214
+ });
215
+ }
216
+ });
217
+ },
218
+ error: function(){
219
+ var wrap = $('<div class="nivo-lightbox-error"><p>'+ $this.options.errorMessage +'</p></div>');
220
+ content.html(wrap).removeClass('nivo-lightbox-loading');
221
+ }
222
+ });
223
+ }
224
+ // Inline HTML
225
+ else if(href.substring(0, 1) == '#'){
226
+ if($(href).length){
227
+ var wrap = $('<div class="nivo-lightbox-inline" />');
228
+ wrap.append($(href).clone().show());
229
+ content.html(wrap).removeClass('nivo-lightbox-loading');
230
+
231
+ // Vertically center html
232
+ if(wrap.outerHeight() < content.height()){
233
+ wrap.css({
234
+ 'position': 'relative',
235
+ 'top': '50%',
236
+ 'margin-top': -(wrap.outerHeight()/2) +'px'
237
+ });
238
+ }
239
+ $(window).resize(function() {
240
+ if(wrap.outerHeight() < content.height()){
241
+ wrap.css({
242
+ 'position': 'relative',
243
+ 'top': '50%',
244
+ 'margin-top': -(wrap.outerHeight()/2) +'px'
245
+ });
246
+ }
247
+ });
248
+ } else {
249
+ var wrap = $('<div class="nivo-lightbox-error"><p>'+ $this.options.errorMessage +'</p></div>');
250
+ content.html(wrap).removeClass('nivo-lightbox-loading');
251
+ }
252
+ }
253
+ // iFrame (default)
254
+ else {
255
+ var iframe = $('<iframe>', {
256
+ src: href,
257
+ 'class': 'nivo-lightbox-item',
258
+ frameborder: 0,
259
+ vspace: 0,
260
+ hspace: 0,
261
+ scrolling: 'auto'
262
+ });
263
+ content.html(iframe);
264
+ iframe.load(function(){ content.removeClass('nivo-lightbox-loading'); });
265
+ }
266
+
267
+ // Set the title
268
+ if(link.attr('title')){
269
+ var titleWrap = $('<span>', { 'class': 'nivo-lightbox-title' });
270
+ titleWrap.text(link.attr('title'));
271
+ $('.nivo-lightbox-title-wrap').html(titleWrap);
272
+ } else {
273
+ $('.nivo-lightbox-title-wrap').html('');
274
+ }
275
+ },
276
+
277
+ constructLightbox: function(){
278
+ if($('.nivo-lightbox-overlay').length) return $('.nivo-lightbox-overlay');
279
+
280
+ var overlay = $('<div>', { 'class': 'nivo-lightbox-overlay nivo-lightbox-theme-'+ this.options.theme +' nivo-lightbox-effect-'+ this.options.effect });
281
+ var wrap = $('<div>', { 'class': 'nivo-lightbox-wrap' });
282
+ var content = $('<div>', { 'class': 'nivo-lightbox-content' });
283
+ var nav = $('<a href="#" class="nivo-lightbox-nav nivo-lightbox-prev">Previous</a><a href="#" class="nivo-lightbox-nav nivo-lightbox-next">Next</a>');
284
+ var close = $('<a href="#" class="nivo-lightbox-close" title="Close">Close</a>');
285
+ var title = $('<div>', { 'class': 'nivo-lightbox-title-wrap' });
286
+
287
+ var isMSIE = /*@cc_on!@*/0;
288
+ if(isMSIE) overlay.addClass('nivo-lightbox-ie');
289
+
290
+ wrap.append(content);
291
+ wrap.append(title);
292
+ overlay.append(wrap);
293
+ overlay.append(nav);
294
+ overlay.append(close);
295
+ $('body').append(overlay);
296
+
297
+ var $this = this;
298
+ if($this.options.clickOverlayToClose){
299
+ overlay.on('click', function(e){
300
+ if(e.target === this ||
301
+ $(e.target).hasClass('nivo-lightbox-content') ||
302
+ $(e.target).hasClass('nivo-lightbox-image')) $this.destructLightbox();
303
+ });
304
+ }
305
+
306
+ close.on('click', function(e){
307
+ e.preventDefault();
308
+ $this.destructLightbox();
309
+ });
310
+
311
+ return overlay;
312
+ },
313
+
314
+ destructLightbox: function(){
315
+ var $this = this;
316
+ this.options.beforeHideLightbox.call(this);
317
+
318
+ $('.nivo-lightbox-overlay').removeClass('nivo-lightbox-open');
319
+ $('.nivo-lightbox-nav').hide();
320
+ $('body').removeClass('nivo-lightbox-body-effect-'+ $this.options.effect);
321
+
322
+ // For IE
323
+ var isMSIE = /*@cc_on!@*/0;
324
+ if(isMSIE){
325
+ $('.nivo-lightbox-overlay iframe').attr("src", " ");
326
+ $('.nivo-lightbox-overlay iframe').remove();
327
+ }
328
+
329
+ // Remove click handlers
330
+ $('.nivo-lightbox-prev').off('click');
331
+ $('.nivo-lightbox-next').off('click');
332
+
333
+ // Empty content (for videos)
334
+ $('.nivo-lightbox-content').empty();
335
+
336
+ this.options.afterHideLightbox.call(this);
337
+ },
338
+
339
+ isHidpi: function(){
340
+ var mediaQuery = "(-webkit-min-device-pixel-ratio: 1.5),\
341
+ (min--moz-device-pixel-ratio: 1.5),\
342
+ (-o-min-device-pixel-ratio: 3/2),\
343
+ (min-resolution: 1.5dppx)";
344
+ if(window.devicePixelRatio > 1) return true;
345
+ if(window.matchMedia && window.matchMedia(mediaQuery).matches) return true;
346
+ return false;
347
+ }
348
+
349
+ };
350
+
351
+ $.fn[pluginName] = function(options){
352
+ return this.each(function(){
353
+ if(!$.data(this, pluginName)){
354
+ $.data(this, pluginName, new NivoLightbox(this, options));
355
+ }
356
+ });
357
+ };
358
+
359
+ })(jQuery, window, document);
assets/nivo-lightbox/themes/default/close.png ADDED
Binary file
assets/nivo-lightbox/themes/default/close@2x.png ADDED
Binary file
assets/nivo-lightbox/themes/default/default.css ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Nivo Lightbox Default Theme v1.0
3
+ * http://dev7studios.com/nivo-lightbox
4
+ *
5
+ * Copyright 2013, Dev7studios
6
+ * Free to use and abuse under the MIT license.
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ */
9
+
10
+ .nivo-lightbox-theme-default.nivo-lightbox-overlay {
11
+ background: #666;
12
+ background: rgba(0,0,0,0.6);
13
+ }
14
+ .nivo-lightbox-theme-default .nivo-lightbox-content.nivo-lightbox-loading { background: url(loading.gif) no-repeat 50% 50%; }
15
+
16
+ .nivo-lightbox-theme-default .nivo-lightbox-nav {
17
+ top: 10%;
18
+ width: 8%;
19
+ height: 80%;
20
+ text-indent: -9999px;
21
+ background-repeat: no-repeat;
22
+ background-position: 50% 50%;
23
+ opacity: 0.5;
24
+ }
25
+ .nivo-lightbox-theme-default .nivo-lightbox-nav:hover {
26
+ opacity: 1;
27
+ background-color: rgba(0,0,0,0.5);
28
+ }
29
+ .nivo-lightbox-theme-default .nivo-lightbox-prev {
30
+ background-image: url(prev.png);
31
+ border-radius: 0 3px 3px 0;
32
+ }
33
+ .nivo-lightbox-theme-default .nivo-lightbox-next {
34
+ background-image: url(next.png);
35
+ border-radius: 3px 0 0 3px;
36
+ }
37
+
38
+ .nivo-lightbox-theme-default .nivo-lightbox-close {
39
+ display: block;
40
+ background: url(close.png) no-repeat 5px 5px;
41
+ width: 16px;
42
+ height: 16px;
43
+ text-indent: -9999px;
44
+ padding: 5px;
45
+ opacity: 0.5;
46
+ }
47
+ .nivo-lightbox-theme-default .nivo-lightbox-close:hover { opacity: 1; }
48
+
49
+ .nivo-lightbox-theme-default .nivo-lightbox-title-wrap { bottom: -7%; }
50
+ .nivo-lightbox-theme-default .nivo-lightbox-title {
51
+ font: 14px/20px 'Helvetica Neue', Helvetica, Arial, sans-serif;
52
+ font-style: normal;
53
+ font-weight: normal;
54
+ background: #000;
55
+ color: #fff;
56
+ padding: 7px 15px;
57
+ border-radius: 30px;
58
+ }
59
+
60
+ .nivo-lightbox-theme-default .nivo-lightbox-image img {
61
+ background: #fff;
62
+ -webkit-box-shadow: 0px 1px 1px rgba(0,0,0,0.4);
63
+ -moz-box-shadow: 0px 1px 1px rgba(0,0,0,0.4);
64
+ box-shadow: 0px 1px 1px rgba(0,0,0,0.4);
65
+ }
66
+ .nivo-lightbox-theme-default .nivo-lightbox-ajax,
67
+ .nivo-lightbox-theme-default .nivo-lightbox-inline {
68
+ background: #fff;
69
+ padding: 40px;
70
+ -webkit-box-shadow: 0px 1px 1px rgba(0,0,0,0.4);
71
+ -moz-box-shadow: 0px 1px 1px rgba(0,0,0,0.4);
72
+ box-shadow: 0px 1px 1px rgba(0,0,0,0.4);
73
+ }
74
+
75
+ @media (-webkit-min-device-pixel-ratio: 1.3),
76
+ (-o-min-device-pixel-ratio: 2.6/2),
77
+ (min--moz-device-pixel-ratio: 1.3),
78
+ (min-device-pixel-ratio: 1.3),
79
+ (min-resolution: 1.3dppx) {
80
+
81
+ .nivo-lightbox-theme-default .nivo-lightbox-content.nivo-lightbox-loading {
82
+ background-image: url(loading@2x.gif);
83
+ background-size: 32px 32px;
84
+ }
85
+ .nivo-lightbox-theme-default .nivo-lightbox-prev {
86
+ background-image: url(prev@2x.png);
87
+ background-size: 48px 48px;
88
+ }
89
+ .nivo-lightbox-theme-default .nivo-lightbox-next {
90
+ background-image: url(next@2x.png);
91
+ background-size: 48px 48px;
92
+ }
93
+ .nivo-lightbox-theme-default .nivo-lightbox-close {
94
+ background-image: url(close@2x.png);
95
+ background-size: 16px 16px;
96
+ }
97
+
98
+ }
assets/nivo-lightbox/themes/default/loading.gif ADDED
Binary file
assets/nivo-lightbox/themes/default/loading@2x.gif ADDED
Binary file
assets/nivo-lightbox/themes/default/next.png ADDED
Binary file
assets/nivo-lightbox/themes/default/next@2x.png ADDED
Binary file
assets/nivo-lightbox/themes/default/prev.png ADDED
Binary file
assets/nivo-lightbox/themes/default/prev@2x.png ADDED
Binary file
index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
readme.txt ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ===Responsive Lightbox===
2
+ Contributors: subhansanjaya
3
+ Author: subhansanjaya
4
+ Author URI: http://weaveapps.com
5
+ Plugin URI: http://wordpress.org/plugins/responsive-lightbox-lite/
6
+ Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BXBCGCKDD74UE
7
+ Tags: responsive Lightbox, Lightbox, Nivo Lightbox, pop up, modal window, modal dialog, pop-up.
8
+ Requires at least: 3.0
9
+ Tested up to: 3.9.1
10
+ Stable tag: 1.1
11
+ License: GPLv2 or later
12
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
+
14
+ This plugin offers a nice and elegant way to add Lightbox functionality for images, html content and media on your webpages.
15
+
16
+ == Description ==
17
+ Responsive Lightbox Wordpress plugin adds Lightbox functionality for images, html content and media on your webpages.
18
+
19
+ [Live demo](http://weaveapps.com/shop/wordpress-plugins/responsive-lightbox-lite/).
20
+
21
+ = Features of this plugin =
22
+ * Responsive / Mobile ready.
23
+ * Light weight.
24
+ * Option to set automatically add Lightbox to your images, gallery, videos etc.
25
+ * Customisable through settings and CSS
26
+
27
+ == Installation ==
28
+
29
+ **Installation Instruction & Configuration**
30
+
31
+ 1.You can use the built-in installer. OR
32
+ Download the zip file and extract the contents. Upload the ‘responsive-lightbox-lite’ folder to your plugins directory (wp-content/plugins/).
33
+
34
+ 2.Activate the plugin through the 'Plugins' menu in WordPress.
35
+
36
+ 3.Log into Admin panel and go to Settings > responsive lightbox lite to change values.
37
+
38
+ == Frequently Asked Questions ==
39
+
40
+ = How to add Lightbox functionality manually? =
41
+
42
+ If you would prefer to add Lightbox manually, first you need to disable automatically add option from the backend (Settings > Responsive Lightbox) and add rel and data-type attributes to your links accordingly.
43
+
44
+ 1. **Single Images**
45
+ rel="lightbox"
46
+
47
+ 2. **Images Gallery**
48
+ rel="lightbox[gallery-0]"
49
+
50
+ 3. **iFrame/ external links**
51
+ rel="lightbox" data-type="iframe"
52
+
53
+ 4. **Gmap**
54
+ rel="lightbox" data-type="iframe"
55
+
56
+ 5. **Vimeo**
57
+ rel="lightbox" data-type="vimeo"
58
+
59
+ 6. **Youtube**
60
+ rel="lightbox" data-type="youtube"
61
+
62
+ 7. **Ajax**
63
+ rel="lightbox" data-type="ajax"
64
+
65
+ 8. **Inline**
66
+ rel="lightbox" data-type="inline"
67
+
68
+ ==changelog==
69
+
70
+ == Screenshots ==
71
+ 1. http://www.backraw.com/plugins/rll/images/screenshot-1.jpg
responsive-lightbox-lite.php ADDED
@@ -0,0 +1,494 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: Responsive Lightbox
4
+ * Description: This plugin offers a nice and elegant way to add Lightbox functionality for images, html content and media on your webpages.
5
+ * Author: subhansanjaya
6
+ * Version: 1.1
7
+ * Plugin URI: http://wordpress.org/plugins/responsive-lightbox-lite/
8
+ * Author URI: http://weaveapps.com
9
+ * Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BXBCGCKDD74UE
10
+ * License: GPLv2 or later
11
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
+ *
13
+ * @package Responsive Lightbox Lite
14
+ * @author subhansanjaya
15
+ */
16
+ class Responsive_Lightbox_Lite {
17
+
18
+ //default settings
19
+ private $defaults = array(
20
+ 'settings' => array(
21
+ 'script' => 'nivo_lightbox',
22
+ 'selector' => 'lightbox',
23
+ 'galleries' => true,
24
+ 'videos' => true,
25
+ 'image_links' => true,
26
+ 'images_as_gallery' => false,
27
+ 'deactivation_delete' => false,
28
+ 'loading_place' => 'header',
29
+ 'enable_custom_events' => false,
30
+ 'custom_events' => 'ajaxComplete'
31
+ ),
32
+ 'version' => '1.0.0'
33
+ );
34
+ private $options = array();
35
+ private $tabs = array();
36
+ private $gallery_no = 0;
37
+
38
+ public function __construct() {
39
+
40
+ register_activation_hook(__FILE__, array(&$this, 'wa_rll_activation'));
41
+ register_deactivation_hook(__FILE__, array(&$this, 'wa_rll_deactivation'));
42
+
43
+ //Add admin option
44
+ add_action('admin_menu', array(&$this, 'admin_menu_options'));
45
+ add_action('admin_init', array(&$this, 'register_settings'));
46
+
47
+ //add text domain for localization
48
+ add_action('plugins_loaded', array(&$this, 'load_textdomain'));
49
+
50
+ //load defaults
51
+ add_action('plugins_loaded', array(&$this, 'load_defaults'));
52
+
53
+ //update plugin version
54
+ update_option('responsive_lightbox_lite_version', $this->defaults['version'], '', 'no');
55
+ $this->options['settings'] = array_merge($this->defaults['settings'], (($array = get_option('responsive_lightbox_lite_settings')) === FALSE ? array() : $array));
56
+
57
+ //insert js and css files
58
+ add_action('wp_enqueue_scripts', array(&$this, 'include_scripts'));
59
+ add_action('admin_enqueue_scripts', array(&$this, 'admin_include_scripts'));
60
+
61
+ //settings link
62
+ add_filter('plugin_action_links', array(&$this, 'wa_rll_settings_link'), 2, 2);
63
+
64
+ if($this->options['settings']['galleries'] === TRUE)
65
+ add_filter('wp_get_attachment_link', array(&$this, 'add_lightbox_selector_gallery'), 1000, 6);
66
+
67
+ if($this->options['settings']['videos'] === TRUE)
68
+ add_filter('the_content', array(&$this, 'add_lightbox_selector_videos'));
69
+
70
+ if($this->options['settings']['image_links'] === TRUE || $this->options['settings']['images_as_gallery'] === TRUE)
71
+ add_filter('the_content', array(&$this, 'add_lightbox_selector_images_links'));
72
+ }
73
+
74
+ /* activation hook */
75
+ public function wa_rll_activation() {
76
+ add_option('responsive_lightbox_lite_settings', $this->defaults['settings'], '', 'no');
77
+ add_option('responsive_lightbox_lite_version', $this->defaults['version'], '', 'no');
78
+ }
79
+
80
+ /* deactivation hook */
81
+ public function wa_rll_deactivation($multi = FALSE)
82
+ {
83
+
84
+ $check = $this->options['settings']['deactivation_delete'];
85
+
86
+ if($check === TRUE)
87
+ {
88
+ delete_option('responsive_lightbox_lite_settings');
89
+ delete_option('responsive_lightbox_lite_version');
90
+ }
91
+ }
92
+
93
+ /* settings link in plugin management screen */
94
+ public function wa_rll_settings_link($actions, $file) {
95
+ if(false !== strpos($file, 'responsive-lightbox-lite'))
96
+ $actions['settings'] = '<a href="options-general.php?page=responsive-lightbox-lite">Settings</a>';
97
+ return $actions;
98
+ }
99
+
100
+ /* Add lightbox selector for gallery */
101
+ public function add_lightbox_selector_gallery($link, $id, $size, $permalink, $icon, $text)
102
+ {
103
+ $link = (preg_match('/<a.*? rel=("|\').*?("|\')>/', $link) === 1 ? preg_replace('/(<a.*? rel=(?:"|\').*?)((?:"|\').*?>)/', '$1 '.$this->options['settings']['selector'].'[gallery-'.$this->gallery_no.']'.'$2', $link) : preg_replace('/(<a.*?)>/', '$1 rel="'.$this->options['settings']['selector'].'[gallery-'.$this->gallery_no.']'.'">', $link));
104
+
105
+ return (preg_match('/<a.*? href=("|\').*?("|\')>/', $link) === 1 ? preg_replace('/(<a.*? href=(?:"|\')).*?((?:"|\').*?>)/', '$1'.wp_get_attachment_url($id).'$2', $link) : preg_replace('/(<a.*?)>/', '$1 href="'.wp_get_attachment_url($id).'">', $link));
106
+ }
107
+
108
+ /* add lightbox selectors for videos */
109
+ public function add_lightbox_selector_videos($content)
110
+ {
111
+ preg_match_all('/<a(.*?)href=(?:\'|")((?:(?:http|https):\/\/)?(?:www\.)?((youtube\.com\/watch\?v=[a-z0-9_\-]+)|(vimeo\.com\/[0-9]{8,})))(?:\'|")(.*?)>/i', $content, $links);
112
+
113
+ if(isset($links[0]))
114
+ {
115
+ foreach($links[0] as $id => $link)
116
+ {
117
+ if(preg_match('/<a.*?rel=(?:\'|")(.*?)(?:\'|").*?>/', $link, $result) === 1)
118
+ {
119
+ if(isset($result[1]))
120
+ {
121
+ $new_rels = array();
122
+ $rels = explode(' ', $result[1]);
123
+
124
+ if(in_array($this->options['settings']['selector'], $rels, TRUE))
125
+ {
126
+ foreach($rels as $no => $rel)
127
+ {
128
+ if($rel !== $this->options['settings']['selector'])
129
+ $new_rels[] = $rel;
130
+ }
131
+
132
+ $content = str_replace($link, preg_replace('/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="'.(!empty($new_rel) ? simplode(' ', $new_rels).' ' : '').$this->options['settings']['selector'].'-video-'.$id.'"', $link), $content);
133
+ }
134
+ else
135
+ $content = str_replace($link, preg_replace('/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="'.($result[1] !== '' ? $result[1].' ' : '').$this->options['settings']['selector'].'-video-'.$id.'"', $link), $content);
136
+ }
137
+ }
138
+ else if(preg_match('/<a(.*?)href=(?:\'|")((?:(?:http|https):\/\/)?(?:www\.)?((youtube\.com\/watch\?v=[a-z0-9_\-]+)))(?:\'|")(.*?)>/', $link, $result) === 1){
139
+ $content = str_replace($link, '<a'.$links[1][$id].'href="'.$links[2][$id].'"'.$links[6][$id].' rel="'.$this->options['settings']['selector'].'-video-'.$id.'" data-type="youtube">', $content);
140
+
141
+ }else if(preg_match('/<a(.*?)href=(?:\'|")((?:(?:http|https):\/\/)?(?:www\.)?((vimeo\.com\/[0-9]{8,})))(?:\'|")(.*?)>/', $link, $result) === 1){
142
+
143
+ $content = str_replace($link, '<a'.$links[1][$id].'href="'.$links[2][$id].'"'.$links[6][$id].' rel="'.$this->options['settings']['selector'].'-video-'.$id.'" data-type="vimeo">', $content);
144
+
145
+ }
146
+
147
+ }
148
+ }
149
+
150
+ return $content;
151
+ }
152
+
153
+ /* add lightbox selectors for images links */
154
+ public function add_lightbox_selector_images_links($content)
155
+ {
156
+ preg_match_all('/<a(.*?)href=(?:\'|")([^<]*?).(bmp|gif|jpeg|jpg|png)(?:\'|")(.*?)>/i', $content, $links);
157
+ if(isset($links[0]))
158
+ {
159
+ if($this->options['settings']['images_as_gallery'] === TRUE)
160
+ $rel_hash = '[gallery-'.wp_generate_password(4, FALSE, FALSE).']';
161
+ foreach($links[0] as $id => $link)
162
+ {
163
+ if(preg_match('/<a.*?rel=(?:\'|")(.*?)(?:\'|").*?>/', $link, $result) === 1)
164
+ {
165
+ if($this->options['settings']['images_as_gallery'] === TRUE)
166
+ {
167
+ $content = str_replace($link, preg_replace('/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="'.$this->options['settings']['selector'].$rel_hash.'"'.($this->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="'.$id.'"' : ''), $link), $content);
168
+ }
169
+ else
170
+ {
171
+ if(isset($result[1]))
172
+ {
173
+ $new_rels = array();
174
+ $rels = explode(' ', $result[1]);
175
+
176
+ if(in_array($this->options['settings']['selector'], $rels, TRUE))
177
+ {
178
+ foreach($rels as $no => $rel)
179
+ {
180
+ if($rel !== $this->options['settings']['selector'])
181
+ $new_rels[] = $rel;
182
+ }
183
+
184
+ $content = str_replace($link, preg_replace('/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="'.(!empty($new_rels) ? implode(' ', $new_rels).' ' : '').$this->options['settings']['selector'].'-'.$id.'"'.($this->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="'.$id.'"' : ''), $link), $content);
185
+ }
186
+ else
187
+ $content = str_replace($link, preg_replace('/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="'.($result[1] !== '' ? $result[1].' ' : '').$this->options['settings']['selector'].'-'.$id.'"'.($this->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="'.$id.'"' : ''), $link), $content);
188
+ }
189
+ }
190
+ }
191
+ else
192
+ $content = str_replace($link, '<a'.$links[1][$id].'href="'.$links[2][$id].'.'.$links[3][$id].'"'.$links[4][$id].' rel="'.$this->options['settings']['selector'].($this->options['settings']['images_as_gallery'] === TRUE ? $rel_hash : '-'.$id).'"'.($this->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="'.$id.'"' : '').'>', $content);
193
+ }
194
+ }
195
+ return $content;
196
+ }
197
+
198
+ /* insert css files js files */
199
+ public function include_scripts() {
200
+
201
+ $args = apply_filters('rll_lightbox_args', array(
202
+ 'script' => $this->options['settings']['script'],
203
+ 'selector' => $this->options['settings']['selector'],
204
+ 'custom_events' => ($this->options['settings']['enable_custom_events'] === TRUE ? ' '.$this->options['settings']['custom_events'] : '')
205
+ ));
206
+
207
+ if($args['script'] === 'nivo_lightbox'){
208
+
209
+ wp_register_script('responsive-lightbox-nivo_lightbox',plugins_url('assets/nivo-lightbox/nivo-lightbox.js', __FILE__),array('jquery'),'',($this->options['settings']['loading_place'] === 'header' ? false : true));
210
+ wp_enqueue_script('responsive-lightbox-nivo_lightbox');
211
+
212
+ wp_register_style('responsive-lightbox-nivo_lightbox-css',plugins_url('assets/nivo-lightbox/nivo-lightbox.css', __FILE__));
213
+ wp_enqueue_style('responsive-lightbox-nivo_lightbox-css');
214
+
215
+ wp_register_style('responsive-lightbox-nivo_lightbox-css-d',plugins_url('assets/nivo-lightbox/themes/default/default.css', __FILE__));
216
+ wp_enqueue_style('responsive-lightbox-nivo_lightbox-css-d');
217
+
218
+ }
219
+ wp_register_script('responsive-lightbox-lite-script',plugins_url('assets/inc/script.js', __FILE__),array('jquery'),'',($this->options['settings']['loading_place'] === 'header' ? false : true));
220
+ wp_enqueue_script('responsive-lightbox-lite-script');
221
+
222
+ wp_localize_script('responsive-lightbox-lite-script','rllArgs',$args);
223
+ }
224
+
225
+ /* insert css files for admin area */
226
+ public function admin_include_scripts() {
227
+ wp_register_style('responsive-lightbox-lite-admin',plugins_url('assets/css/admin.css', __FILE__));
228
+ wp_enqueue_style('responsive-lightbox-lite-admin');
229
+ }
230
+
231
+ public function admin_menu_options()
232
+ {
233
+ add_options_page(
234
+ __('Responsive Lightbox Lite', 'responsive-lightbox-lite'),
235
+ __('Responsive Lightbox Lite', 'responsive-lightbox-lite'),
236
+ 'manage_options',
237
+ 'responsive-lightbox-lite',
238
+ array(&$this, 'options_page')
239
+ );
240
+ }
241
+
242
+ /* register setting for plugins page */
243
+ public function register_settings()
244
+ {
245
+ register_setting('responsive_lightbox_lite_settings', 'responsive_lightbox_lite_settings', array(&$this, 'validate_options'));
246
+ //general settings
247
+ add_settings_section('responsive_lightbox_lite_settings', __('', 'responsive-lightbox-lite'), '', 'responsive_lightbox_lite_settings');
248
+ add_settings_field('rll_galleries', __('Galleries', 'responsive-lightbox-lite'), array(&$this, 'rll_galleries'), 'responsive_lightbox_lite_settings', 'responsive_lightbox_lite_settings');
249
+ add_settings_field('rll_videos', __('Video links', 'responsive-lightbox-lite'), array(&$this, 'rll_videos'), 'responsive_lightbox_lite_settings', 'responsive_lightbox_lite_settings');
250
+ add_settings_field('rll_image_links', __('Image links', 'responsive-lightbox-lite'), array(&$this, 'rll_image_links'), 'responsive_lightbox_lite_settings', 'responsive_lightbox_lite_settings');
251
+ add_settings_field('rll_enable_custom_events', __('Custom events', 'responsive-lightbox-lite'), array(&$this, 'rll_enable_custom_events'), 'responsive_lightbox_lite_settings', 'responsive_lightbox_lite_settings');
252
+ add_settings_field('rll_loading_place', __('Loading place', 'responsive-lightbox-lite'), array(&$this, 'rll_loading_place'), 'responsive_lightbox_lite_settings', 'responsive_lightbox_lite_settings');
253
+ add_settings_field('rll_deactivation_delete', __('Deactivation', 'responsive-lightbox-lite'), array(&$this, 'rll_deactivation_delete'), 'responsive_lightbox_lite_settings', 'responsive_lightbox_lite_settings');
254
+ }
255
+
256
+
257
+
258
+
259
+ public function rll_enable_custom_events()
260
+ {
261
+ echo '
262
+ <div id="rll_enable_custom_events" class="wplikebtns">';
263
+
264
+ foreach($this->choices as $val => $trans)
265
+ {
266
+ $val = esc_attr($val);
267
+
268
+ echo '
269
+ <input id="rll-enable-custom-events-'.$val.'" type="radio" name="responsive_lightbox_settings[enable_custom_events]" value="'.$val.'" '.checked(($val === 'yes' ? true : false), $this->options['settings']['enable_custom_events'], false).' />
270
+ <label for="rll-enable-custom-events-'.$val.'">'.esc_html($trans).'</label>';
271
+ }
272
+
273
+ echo '
274
+ <p class="description">'.__('Enable triggering lightbox on custom jquery events.', 'responsive-lightbox').'</p>
275
+ <div id="rll_custom_events"'.($this->options['settings']['enable_custom_events'] === false ? ' style="display: none;"' : '').'>
276
+ <input type="text" name="responsive_lightbox_settings[custom_events]" value="'.esc_attr($this->options['settings']['custom_events']).'" />
277
+ <p class="description">'.__('Enter a space separated list of events.', 'responsive-lightbox').'</p>
278
+ </div>
279
+ </div>';
280
+ }
281
+
282
+ public function rll_loading_place()
283
+ {
284
+ echo '
285
+ <div id="rll_loading_place" class="wplikebtns">';
286
+
287
+ foreach($this->loading_places as $val => $trans)
288
+ {
289
+ $val = esc_attr($val);
290
+
291
+ echo '
292
+ <input id="rll-loading-place-'.$val.'" type="radio" name="responsive_lightbox_lite_settings[loading_place]" value="'.$val.'" '.checked($val, $this->options['settings']['loading_place'], false).' />
293
+ <label for="rll-loading-place-'.$val.'">'.esc_html($trans).'</label>';
294
+ }
295
+
296
+ echo '
297
+ <p class="description">'.__('Select where all the lightbox scripts should be placed.', 'responsive-lightbox').'</p>
298
+ </div>';
299
+ }
300
+
301
+ public function rll_galleries()
302
+ {
303
+ echo '
304
+ <div id="rll_galleries" class="wplikebtns">';
305
+
306
+ foreach($this->choices as $val => $trans)
307
+ {
308
+ echo '
309
+ <input id="rll-galleries-'.$val.'" type="radio" name="responsive_lightbox_lite_settings[galleries]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['settings']['galleries'], FALSE).' />
310
+ <label for="rll-galleries-'.$val.'">'.$trans.'</label>';
311
+ }
312
+
313
+ echo '
314
+ <p class="description">'.__('Add lightbox to WordPress image galleries by default.', 'responsive-lightbox').'</p>
315
+ </div>';
316
+ }
317
+
318
+ public function rll_videos()
319
+ {
320
+ echo '
321
+ <div id="rll_videos" class="wplikebtns">';
322
+
323
+ foreach($this->choices as $val => $trans)
324
+ {
325
+ echo '
326
+ <input id="rll-videos-'.$val.'" type="radio" name="responsive_lightbox_lite_settings[videos]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['settings']['videos'], FALSE).' />
327
+ <label for="rll-videos-'.$val.'">'.$trans.'</label>';
328
+ }
329
+
330
+ echo '
331
+ <p class="description">'.__('Add lightbox to YouTube and Vimeo video links by default.', 'responsive-lightbox').'</p>
332
+ </div>';
333
+ }
334
+
335
+ public function rll_image_links()
336
+ {
337
+ echo '
338
+ <div id="rll_image_links" class="wplikebtns">';
339
+
340
+ foreach($this->choices as $val => $trans)
341
+ {
342
+ echo '
343
+ <input id="rll-image-links-'.$val.'" type="radio" name="responsive_lightbox_lite_settings[image_links]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['settings']['image_links'], FALSE).' />
344
+ <label for="rll-image-links-'.$val.'">'.$trans.'</label>';
345
+ }
346
+
347
+ echo '
348
+ <p class="description">'.__('Add lightbox to WordPress image links by default.', 'responsive-lightbox').'</p>
349
+ </div>';
350
+ }
351
+
352
+ public function rll_images_as_gallery()
353
+ {
354
+ echo '
355
+ <div id="rll_images_as_gallery" class="wplikebtns">';
356
+
357
+ foreach($this->choices as $val => $trans)
358
+ {
359
+ echo '
360
+ <input id="rll-images-as-gallery-'.$val.'" type="radio" name="responsive_lightbox_lite_settings[images_as_gallery]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['settings']['images_as_gallery'], FALSE).' />
361
+ <label for="rll-images-as-gallery-'.$val.'">'.$trans.'</label>';
362
+ }
363
+
364
+ echo '
365
+ <p class="description">'.__('Display single post images as a gallery.', 'responsive-lightbox').'</p>
366
+ </div>';
367
+ }
368
+
369
+ public function rll_deactivation_delete()
370
+ {
371
+ echo '
372
+ <div id="rll_deactivation_delete" class="wplikebtns">';
373
+
374
+ foreach($this->choices as $val => $trans)
375
+ {
376
+ echo '
377
+ <input id="rll-deactivation-delete-'.$val.'" type="radio" name="responsive_lightbox_lite_settings[deactivation_delete]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['settings']['deactivation_delete'], FALSE).' />
378
+ <label for="rll-deactivation-delete-'.$val.'">'.$trans.'</label>';
379
+ }
380
+
381
+ echo '
382
+ <p class="description">'.__('Delete settings on plugin deactivation.', 'responsive-lightbox').'</p>
383
+ </div>';
384
+ }
385
+
386
+ public function options_page()
387
+ {
388
+ $tab_key = (isset($_GET['tab']) ? $_GET['tab'] : 'general-settings');
389
+
390
+ echo '<div class="wrap">'.screen_icon().'
391
+ <h2>'.__('Responsive Lightbox Lite', 'responsive-lightbox-lite').'</h2>
392
+ <h2 class="nav-tab-wrapper">';
393
+
394
+ foreach($this->tabs as $key => $name) {
395
+ echo '
396
+ <a class="nav-tab '.($tab_key == $key ? 'nav-tab-active' : '').'" href="'.esc_url(admin_url('options-general.php?page=responsive-lightbox-lite&tab='.$key)).'">'.$name['name'].'</a>';
397
+ }
398
+
399
+ echo '
400
+ </h2>
401
+ <div class="responsive-lightbox-settings">
402
+ <div class="wa-credits">
403
+ <h3 class="hndle">'.__('Responsive Lightbox Lite', 'responsive-lightbox').' '.$this->defaults['version'].'</h3>
404
+ <div class="inside">
405
+ <p class="inner">'.__('Plugin URI: ', 'responsive-lightbox').' <a href="http://weaveapps.com/shop/wordpress-plugins/responsive-lightbox-lite/" target="_blank" title="'.__('Plugin URL', 'responsive-lightbox-lite').'">'.__('Weave Apps', 'responsive-lightbox-lite').'</a></p>
406
+ </p>
407
+ <hr />
408
+ <h4 class="inner">'.__('Do you like this plugin?', 'responsive-slideshow').'</h4>
409
+ <p class="inner">'.__('Please, ', 'responsive-lightbox-lite').'<a href="http://wordpress.org/support/view/plugin-reviews/responsive-lightbox-lite" target="_blank" title="'.__('rate it', 'responsive-slideshow').'">'.__('rate it', 'responsive-slideshow').'</a> '.__('on WordPress.org', 'responsive-slideshow').'<br />
410
+
411
+ </div>
412
+ </div><form action="options.php" method="post">
413
+ <input type="hidden" name="script_r" value="'.esc_attr($this->options['settings']['script']).'" />';
414
+
415
+ wp_nonce_field('update-options');
416
+ settings_fields($this->tabs[$tab_key]['key']);
417
+ do_settings_sections($this->tabs[$tab_key]['key']);
418
+
419
+ echo '<p class="submit">';
420
+ submit_button('', 'primary', $this->tabs[$tab_key]['submit'], FALSE);
421
+ echo ' ';
422
+ echo submit_button(__('Reset to defaults', 'responsive-lightbox'), 'secondary', $this->tabs[$tab_key]['reset'], FALSE);
423
+ echo '</p></form></div><div class="clear"></div></div>';
424
+ }
425
+
426
+ public function load_defaults()
427
+ {
428
+
429
+ $this->choices = array(
430
+ 'yes' => __('Enable', 'responsive-lightbox-lite'),
431
+ 'no' => __('Disable', 'responsive-lightbox-lite')
432
+ );
433
+
434
+ $this->loading_places = array(
435
+ 'header' => __('Header', 'responsive-lightbox-lite'),
436
+ 'footer' => __('Footer', 'responsive-lightbox-lite')
437
+ );
438
+
439
+ $this->tabs = array(
440
+ 'general-settings' => array(
441
+ 'name' => __('General settings', 'responsive-lightbox-lite'),
442
+ 'key' => 'responsive_lightbox_lite_settings',
443
+ 'submit' => 'save_rll_settings',
444
+ 'reset' => 'reset_rll_settings',
445
+ )
446
+ );
447
+ }
448
+
449
+ /* load text domain for localization */
450
+ public function load_textdomain()
451
+ {
452
+ load_plugin_textdomain('responsive-lightbox-lite', FALSE, dirname(plugin_basename(__FILE__)).'/languages/');
453
+ }
454
+
455
+ /* validate options and register settings */
456
+ public function validate_options($input)
457
+ {
458
+ if(isset($_POST['save_rll_settings']))
459
+ {
460
+
461
+ // selector
462
+ $input['selector'] = sanitize_text_field(isset($input['selector']) && $input['selector'] !== '' ? $input['selector'] : $this->defaults['settings']['selector']);
463
+
464
+ // loading place
465
+ $input['loading_place'] = (isset($input['loading_place'], $this->loading_places[$input['loading_place']]) ? $input['loading_place'] : $this->defaults['settings']['loading_place']);
466
+
467
+ // enable custom events
468
+ $input['enable_custom_events'] = (isset($input['enable_custom_events'], $this->choices[$input['enable_custom_events']]) ? ($input['enable_custom_events'] === 'yes' ? true : false) : $this->defaults['settings']['enable_custom_events']);
469
+
470
+ // custom events
471
+ if($input['enable_custom_events'] === true)
472
+ {
473
+ $input['custom_events'] = sanitize_text_field(isset($input['custom_events']) && $input['custom_events'] !== '' ? $input['custom_events'] : $this->defaults['settings']['custom_events']);
474
+ }
475
+
476
+ // checkboxes
477
+ $input['galleries'] = (isset($input['galleries'], $this->choices[$input['galleries']]) ? ($input['galleries'] === 'yes' ? true : false) : $this->defaults['settings']['galleries']);
478
+ $input['videos'] = (isset($input['videos'], $this->choices[$input['videos']]) ? ($input['videos'] === 'yes' ? true : false) : $this->defaults['settings']['videos']);
479
+ $input['image_links'] = (isset($input['image_links'], $this->choices[$input['image_links']]) ? ($input['image_links'] === 'yes' ? true : false) : $this->defaults['settings']['image_links']);
480
+ $input['images_as_gallery'] = (isset($input['images_as_gallery'], $this->choices[$input['images_as_gallery']]) ? ($input['images_as_gallery'] === 'yes' ? true : false) : $this->defaults['settings']['images_as_gallery']);
481
+ $input['deactivation_delete'] = (isset($input['deactivation_delete'], $this->choices[$input['deactivation_delete']]) ? ($input['deactivation_delete'] === 'yes' ? true : false) : $this->defaults['settings']['deactivation_delete']);
482
+
483
+
484
+ }elseif(isset($_POST['reset_rll_settings']))
485
+ {
486
+ $input = $this->defaults['settings'];
487
+
488
+ add_settings_error('reset_general_settings', 'general_reset', __('Settings restored to defaults.', 'responsive-lightbox-lite'), 'updated');
489
+ }
490
+
491
+ return $input;
492
+ }
493
+ }
494
+ $responsive_lightbox = new Responsive_Lightbox_Lite();
screenshot-1.jpg ADDED
Binary file