Enjoy Instagram feed on website with WordPress Widget and Shortcode - Version 2.1.3

Version Description

  • Add Shortcakes Info

=

Download this release

Release Info

Developer mediabeta
Plugin Icon 128x128 Enjoy Instagram feed on website with WordPress Widget and Shortcode
Version 2.1.3
Comparing to
See all releases

Code changes from version 1.01 to 2.1.3

css/enjoyinstagram_settings.css CHANGED
@@ -28,6 +28,15 @@
28
  display:block;
29
  float:right;
30
  }
 
 
 
 
 
 
 
 
 
31
  .pad_coffee {
32
  display:block;
33
  float:none;
28
  display:block;
29
  float:right;
30
  }
31
+ #premium_release{
32
+ padding: 10px;
33
+ border-left: 4px solid #FF7400;
34
+ background: #B6FFB4;
35
+ -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
36
+ box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
37
+ display:block;
38
+ margin: 10px auto;
39
+ }
40
  .pad_coffee {
41
  display:block;
42
  float:none;
css/swipebox.css CHANGED
@@ -1,9 +1,10 @@
1
- html.swipebox {
2
- overflow: hidden!important;
 
3
  }
4
 
5
  #swipebox-overlay img {
6
- border: none!important;
7
  }
8
 
9
  #swipebox-overlay {
@@ -12,14 +13,23 @@ html.swipebox {
12
  position: fixed;
13
  top: 0;
14
  left: 0;
15
- z-index: 99999!important;
16
  overflow: hidden;
17
  -webkit-user-select: none;
18
- -moz-user-select: none;
19
- user-select: none;
 
 
 
 
 
 
 
20
  }
21
 
22
  #swipebox-slider {
 
 
23
  height: 100%;
24
  left: 0;
25
  top: 0;
@@ -27,17 +37,15 @@ html.swipebox {
27
  white-space: nowrap;
28
  position: absolute;
29
  display: none;
 
30
  }
31
-
32
  #swipebox-slider .slide {
33
- background: url("../images/loader.gif") no-repeat center center;
34
  height: 100%;
35
  width: 100%;
36
  line-height: 1px;
37
  text-align: center;
38
  display: inline-block;
39
  }
40
-
41
  #swipebox-slider .slide:before {
42
  content: "";
43
  display: inline-block;
@@ -45,9 +53,9 @@ html.swipebox {
45
  width: 1px;
46
  margin-right: -1px;
47
  }
48
-
49
  #swipebox-slider .slide img,
50
- #swipebox-slider .slide .swipebox-video-container {
 
51
  display: inline-block;
52
  max-height: 100%;
53
  max-width: 100%;
@@ -57,35 +65,37 @@ html.swipebox {
57
  height: auto;
58
  vertical-align: middle;
59
  }
60
-
61
  #swipebox-slider .slide .swipebox-video-container {
62
- background:none;
63
  max-width: 1140px;
64
  max-height: 100%;
65
  width: 100%;
66
- padding:5%;
67
- box-sizing: border-box;
68
  -webkit-box-sizing: border-box;
69
- -moz-box-sizing: border-box;
70
  }
71
-
72
-
73
- #swipebox-slider .slide .swipebox-video-container .swipebox-video{
74
  width: 100%;
75
  height: 0;
76
  padding-bottom: 56.25%;
77
  overflow: hidden;
78
  position: relative;
79
  }
80
-
81
- #swipebox-slider .slide .swipebox-video-container .swipebox-video iframe{
82
- width: 100%!important;
83
- height: 100%!important;
84
  position: absolute;
85
- top: 0; left: 0;
 
 
 
 
86
  }
87
 
88
- #swipebox-action, #swipebox-caption {
 
 
 
89
  position: absolute;
90
  left: 0;
91
  z-index: 999;
@@ -93,172 +103,185 @@ html.swipebox {
93
  width: 100%;
94
  }
95
 
96
- #swipebox-action {
97
  bottom: -50px;
98
  }
99
- #swipebox-action.visible-bars {
100
- bottom: 0;
 
101
  }
102
 
103
- #swipebox-action.force-visible-bars {
104
- bottom: 0!important;
105
- }
106
-
107
- #swipebox-caption {
108
  top: -50px;
109
- text-align: center;
110
  }
111
- #swipebox-caption.visible-bars {
112
- top: 0;
 
113
  }
114
 
115
- #swipebox-caption.force-visible-bars {
116
- top: 0!important;
 
 
117
  }
118
 
119
- #swipebox-action #swipebox-prev, #swipebox-action #swipebox-next,
120
- #swipebox-action #swipebox-close {
121
- background-image: url("../images/icons.png") !important;
 
122
  background-repeat: no-repeat;
123
- border: none!important;
124
- text-decoration: none!important;
125
  cursor: pointer;
126
- position: absolute;
127
  width: 50px;
128
  height: 50px;
129
  top: 0;
130
  }
131
 
132
- #swipebox-action #swipebox-close {
133
- background-position: 15px 12px;
134
- left: 40px;
 
 
135
  }
136
 
137
- #swipebox-action #swipebox-prev {
138
  background-position: -32px 13px;
139
- right: 100px;
140
  }
141
 
142
- #swipebox-action #swipebox-next {
143
  background-position: -78px 13px;
144
- right: 40px;
 
 
 
 
 
 
 
 
 
 
 
 
145
  }
146
 
147
- #swipebox-action #swipebox-prev.disabled,
148
- #swipebox-action #swipebox-next.disabled {
149
- filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=30);
150
  opacity: 0.3;
151
  }
152
 
153
- #swipebox-slider.rightSpring {
154
- -moz-animation: rightSpring 0.3s;
155
  -webkit-animation: rightSpring 0.3s;
 
156
  }
157
-
158
- #swipebox-slider.leftSpring {
159
- -moz-animation: leftSpring 0.3s;
160
  -webkit-animation: leftSpring 0.3s;
 
161
  }
162
 
163
- @-moz-keyframes rightSpring {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  0% {
165
- margin-left: 0px;
166
  }
167
-
168
  50% {
169
- margin-left: -30px;
170
  }
171
-
172
  100% {
173
- margin-left: 0px;
174
  }
175
  }
176
 
177
- @-moz-keyframes leftSpring {
178
  0% {
179
- margin-left: 0px;
180
  }
181
-
182
  50% {
183
- margin-left: 30px;
184
  }
185
-
186
  100% {
187
- margin-left: 0px;
188
  }
189
  }
190
-
191
- @-webkit-keyframes rightSpring {
192
  0% {
193
- margin-left: 0px;
194
  }
195
-
196
  50% {
197
- margin-left: -30px;
198
  }
199
-
200
  100% {
201
- margin-left: 0px;
202
  }
203
  }
204
-
205
- @-webkit-keyframes leftSpring {
206
  0% {
207
- margin-left: 0px;
208
  }
209
-
210
  50% {
211
- margin-left: 30px;
212
  }
213
-
214
  100% {
215
- margin-left: 0px;
216
- }
217
- }
218
-
219
- @media screen and (max-width: 800px) {
220
- #swipebox-action #swipebox-close {
221
  left: 0;
222
  }
223
-
224
- #swipebox-action #swipebox-prev {
225
- right: 60px;
 
226
  }
227
 
228
- #swipebox-action #swipebox-next {
229
- right: 0;
 
230
  }
231
  }
232
-
233
-
234
  /* Skin
235
  --------------------------*/
236
  #swipebox-overlay {
237
  background: #0d0d0d;
238
  }
239
 
240
- #swipebox-action, #swipebox-caption {
 
241
  text-shadow: 1px 1px 1px black;
242
- background-color: #0d0d0d;
243
- background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #0d0d0d), color-stop(100%, #000000));
244
- background-image: -webkit-linear-gradient(#0d0d0d, #000000);
245
- background-image: -moz-linear-gradient(#0d0d0d, #000000);
246
- background-image: -o-linear-gradient(#0d0d0d, #000000);
247
- background-image: linear-gradient(#0d0d0d, #000000);
248
- filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=95);
249
  opacity: 0.95;
250
  }
251
 
252
- #swipebox-action {
253
- border-top: 1px solid rgba(255, 255, 255, 0.2);
254
- }
255
-
256
- #swipebox-caption {
257
- border-bottom: 1px solid rgba(255, 255, 255, 0.2);
258
- color: white!important;
259
  font-size: 15px;
260
  line-height: 43px;
261
  font-family: Helvetica, Arial, sans-serif;
262
  }
263
-
264
-
1
+ /*! Swipebox v1.3.0 | Constantin Saguin csag.co | MIT License | github.com/brutaldesign/swipebox */
2
+ html.swipebox-html.swipebox-touch {
3
+ overflow: hidden !important;
4
  }
5
 
6
  #swipebox-overlay img {
7
+ border: none !important;
8
  }
9
 
10
  #swipebox-overlay {
13
  position: fixed;
14
  top: 0;
15
  left: 0;
16
+ z-index: 99999 !important;
17
  overflow: hidden;
18
  -webkit-user-select: none;
19
+ -moz-user-select: none;
20
+ -ms-user-select: none;
21
+ user-select: none;
22
+ }
23
+
24
+ #swipebox-container {
25
+ position: relative;
26
+ width: 100%;
27
+ height: 100%;
28
  }
29
 
30
  #swipebox-slider {
31
+ -webkit-transition: -webkit-transform 0.4s ease;
32
+ transition: transform 0.4s ease;
33
  height: 100%;
34
  left: 0;
35
  top: 0;
37
  white-space: nowrap;
38
  position: absolute;
39
  display: none;
40
+ cursor: pointer;
41
  }
 
42
  #swipebox-slider .slide {
 
43
  height: 100%;
44
  width: 100%;
45
  line-height: 1px;
46
  text-align: center;
47
  display: inline-block;
48
  }
 
49
  #swipebox-slider .slide:before {
50
  content: "";
51
  display: inline-block;
53
  width: 1px;
54
  margin-right: -1px;
55
  }
 
56
  #swipebox-slider .slide img,
57
+ #swipebox-slider .slide .swipebox-video-container,
58
+ #swipebox-slider .slide .swipebox-inline-container {
59
  display: inline-block;
60
  max-height: 100%;
61
  max-width: 100%;
65
  height: auto;
66
  vertical-align: middle;
67
  }
 
68
  #swipebox-slider .slide .swipebox-video-container {
69
+ background: none;
70
  max-width: 1140px;
71
  max-height: 100%;
72
  width: 100%;
73
+ padding: 5%;
 
74
  -webkit-box-sizing: border-box;
75
+ box-sizing: border-box;
76
  }
77
+ #swipebox-slider .slide .swipebox-video-container .swipebox-video {
 
 
78
  width: 100%;
79
  height: 0;
80
  padding-bottom: 56.25%;
81
  overflow: hidden;
82
  position: relative;
83
  }
84
+ #swipebox-slider .slide .swipebox-video-container .swipebox-video iframe {
85
+ width: 100% !important;
86
+ height: 100% !important;
 
87
  position: absolute;
88
+ top: 0;
89
+ left: 0;
90
+ }
91
+ #swipebox-slider .slide-loading {
92
+ background: url(../img/loader.gif) no-repeat center center;
93
  }
94
 
95
+ #swipebox-bottom-bar,
96
+ #swipebox-top-bar {
97
+ -webkit-transition: 0.5s;
98
+ transition: 0.5s;
99
  position: absolute;
100
  left: 0;
101
  z-index: 999;
103
  width: 100%;
104
  }
105
 
106
+ #swipebox-bottom-bar {
107
  bottom: -50px;
108
  }
109
+ #swipebox-bottom-bar.visible-bars {
110
+ -webkit-transform: translate3d(0, -50px, 0);
111
+ transform: translate3d(0, -50px, 0);
112
  }
113
 
114
+ #swipebox-top-bar {
 
 
 
 
115
  top: -50px;
 
116
  }
117
+ #swipebox-top-bar.visible-bars {
118
+ -webkit-transform: translate3d(0, 50px, 0);
119
+ transform: translate3d(0, 50px, 0);
120
  }
121
 
122
+ #swipebox-title {
123
+ display: block;
124
+ width: 100%;
125
+ text-align: center;
126
  }
127
 
128
+ #swipebox-prev,
129
+ #swipebox-next,
130
+ #swipebox-close {
131
+ background-image: url(../img/icons.png);
132
  background-repeat: no-repeat;
133
+ border: none !important;
134
+ text-decoration: none !important;
135
  cursor: pointer;
 
136
  width: 50px;
137
  height: 50px;
138
  top: 0;
139
  }
140
 
141
+ #swipebox-arrows {
142
+ display: block;
143
+ margin: 0 auto;
144
+ width: 100%;
145
+ height: 50px;
146
  }
147
 
148
+ #swipebox-prev {
149
  background-position: -32px 13px;
150
+ float: left;
151
  }
152
 
153
+ #swipebox-next {
154
  background-position: -78px 13px;
155
+ float: right;
156
+ }
157
+
158
+ #swipebox-close {
159
+ top: 0;
160
+ right: 0;
161
+ position: absolute;
162
+ z-index: 9999;
163
+ background-position: 15px 12px;
164
+ }
165
+
166
+ .swipebox-no-close-button #swipebox-close {
167
+ display: none;
168
  }
169
 
170
+ #swipebox-prev.disabled,
171
+ #swipebox-next.disabled {
 
172
  opacity: 0.3;
173
  }
174
 
175
+ .swipebox-no-touch #swipebox-overlay.rightSpring #swipebox-slider {
 
176
  -webkit-animation: rightSpring 0.3s;
177
+ animation: rightSpring 0.3s;
178
  }
179
+ .swipebox-no-touch #swipebox-overlay.leftSpring #swipebox-slider {
 
 
180
  -webkit-animation: leftSpring 0.3s;
181
+ animation: leftSpring 0.3s;
182
  }
183
 
184
+ .swipebox-touch #swipebox-container:before, .swipebox-touch #swipebox-container:after {
185
+ -webkit-backface-visibility: hidden;
186
+ backface-visibility: hidden;
187
+ -webkit-transition: all .3s ease;
188
+ transition: all .3s ease;
189
+ content: ' ';
190
+ position: absolute;
191
+ z-index: 999;
192
+ top: 0;
193
+ height: 100%;
194
+ width: 20px;
195
+ opacity: 0;
196
+ }
197
+ .swipebox-touch #swipebox-container:before {
198
+ left: 0;
199
+ -webkit-box-shadow: inset 10px 0px 10px -8px #656565;
200
+ box-shadow: inset 10px 0px 10px -8px #656565;
201
+ }
202
+ .swipebox-touch #swipebox-container:after {
203
+ right: 0;
204
+ -webkit-box-shadow: inset -10px 0px 10px -8px #656565;
205
+ box-shadow: inset -10px 0px 10px -8px #656565;
206
+ }
207
+ .swipebox-touch #swipebox-overlay.leftSpringTouch #swipebox-container:before {
208
+ opacity: 1;
209
+ }
210
+ .swipebox-touch #swipebox-overlay.rightSpringTouch #swipebox-container:after {
211
+ opacity: 1;
212
+ }
213
+
214
+ @-webkit-keyframes rightSpring {
215
  0% {
216
+ left: 0;
217
  }
 
218
  50% {
219
+ left: -30px;
220
  }
 
221
  100% {
222
+ left: 0;
223
  }
224
  }
225
 
226
+ @keyframes rightSpring {
227
  0% {
228
+ left: 0;
229
  }
 
230
  50% {
231
+ left: -30px;
232
  }
 
233
  100% {
234
+ left: 0;
235
  }
236
  }
237
+ @-webkit-keyframes leftSpring {
 
238
  0% {
239
+ left: 0;
240
  }
 
241
  50% {
242
+ left: 30px;
243
  }
 
244
  100% {
245
+ left: 0;
246
  }
247
  }
248
+ @keyframes leftSpring {
 
249
  0% {
250
+ left: 0;
251
  }
 
252
  50% {
253
+ left: 30px;
254
  }
 
255
  100% {
 
 
 
 
 
 
256
  left: 0;
257
  }
258
+ }
259
+ @media screen and (min-width: 800px) {
260
+ #swipebox-close {
261
+ right: 10px;
262
  }
263
 
264
+ #swipebox-arrows {
265
+ width: 92%;
266
+ max-width: 800px;
267
  }
268
  }
 
 
269
  /* Skin
270
  --------------------------*/
271
  #swipebox-overlay {
272
  background: #0d0d0d;
273
  }
274
 
275
+ #swipebox-bottom-bar,
276
+ #swipebox-top-bar {
277
  text-shadow: 1px 1px 1px black;
278
+ background: #000;
 
 
 
 
 
 
279
  opacity: 0.95;
280
  }
281
 
282
+ #swipebox-top-bar {
283
+ color: white !important;
 
 
 
 
 
284
  font-size: 15px;
285
  line-height: 43px;
286
  font-family: Helvetica, Arial, sans-serif;
287
  }
 
 
enjoyinstagram.php CHANGED
@@ -1,15 +1,14 @@
1
  <?php
2
  /*
3
- Plugin Name: Enjoy Instagram
4
  Plugin URI: http://www.mediabeta.com/enjoy-instagram/
5
  Description: Instagram Responsive Images Gallery and Carousel, works with Shortcodes and Widgets.
6
- Version: 1.0
7
  Author: F. Prestipino, F. Di Pane - Mediabeta Srl
8
  Author URI: http://www.mediabeta.com/team/
9
  */
10
 
11
  require_once('library/enjoyinstagram_shortcode.php');
12
- require_once('library/instagram.class.php');
13
  class Settings_enjoyinstagram_Plugin {
14
 
15
  private $enjoyinstagram_general_settings_key = 'enjoyinstagram_general_settings';
@@ -23,175 +22,171 @@ class Settings_enjoyinstagram_Plugin {
23
  add_action( 'admin_init', array( &$this, 'register_advanced_settings' ) );
24
  add_action( 'admin_menu', array( &$this, 'add_admin_menus' ) );
25
  }
26
-
27
  function load_settings() {
28
  $this->general_settings = (array) get_option( $this->enjoyinstagram_general_settings_key );
29
  $this->advanced_settings = (array) get_option( $this->advanced_settings_key );
30
  $this->general_settings = array_merge( array(
31
  'general_option' => 'General value'
32
  ), $this->general_settings );
33
-
34
  $this->advanced_settings = array_merge( array(
35
  'advanced_option' => 'Advanced value'
36
  ), $this->advanced_settings );
37
  }
38
-
39
  function register_enjoyinstagram_client_id() {
40
  $this->plugin_settings_tabs[$this->enjoyinstagram_general_settings_key] = 'Profile';
41
-
42
  register_setting( $this->enjoyinstagram_general_settings_key, $this->enjoyinstagram_general_settings_key );
43
  add_settings_section( 'section_general', 'General Plugin Settings', array( &$this, 'section_general_desc' ), $this->enjoyinstagram_general_settings_key );
44
  add_settings_field( 'general_option', 'A General Option', array( &$this, 'field_general_option' ), $this->enjoyinstagram_general_settings_key, 'section_general' );
45
  }
46
-
47
-
48
  function register_advanced_settings() {
49
  $this->plugin_settings_tabs[$this->advanced_settings_key] = 'Settings';
50
-
51
  register_setting( $this->advanced_settings_key, $this->advanced_settings_key );
52
  add_settings_section( 'section_advanced', 'Advanced Plugin Settings', array( &$this, 'section_advanced_desc' ), $this->advanced_settings_key );
53
  add_settings_field( 'advanced_option', 'An Advanced Option', array( &$this, 'field_advanced_option' ), $this->advanced_settings_key, 'section_advanced' );
54
  }
55
-
56
-
57
  function section_general_desc() { echo 'Instagram Settings'; }
58
- function section_advanced_desc() { echo 'Manage Enjoy Instagram.'; }
59
-
60
-
61
  function field_general_option() {
62
  ?>
63
- <input type="text" name="<?php echo $this->enjoyinstagram_general_settings_key; ?>[general_option]" value="<?php echo esc_attr( $this->general_settings['general_option'] ); ?>" /><?php
64
  }
65
-
66
-
67
  function field_advanced_option() { ?>
68
- <input type="text" name="<?php echo $this->advanced_settings_key; ?>[advanced_option]" value="<?php echo esc_attr( $this->advanced_settings['advanced_option'] ); ?>" />
69
- <?php
70
  }
71
-
72
-
73
  function add_admin_menus() {
74
- add_options_page( 'Enjoy Instagram', 'Enjoy Instagram', 'manage_options', $this->plugin_options_key, array( &$this, 'enjoyinstagram_options_page' ) );
75
  }
76
-
77
-
78
  function enjoyinstagram_options_page() {
79
  $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $this->enjoyinstagram_general_settings_key;?>
80
- <div class="wrap">
81
- <h2><div class="ei_block">
82
- <div class="ei_left_block">
83
- <div class="ei_hard_block">
84
- <?php echo '<img src="' . plugins_url( 'images/enjoyinstagram.png' , __FILE__ ) . '" > '; ?>
85
- </div>
86
-
87
- <div class="ei_twitter_block">
88
- <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.mediabeta.com/enjoy-instagram/" data-text="I've just installed Enjoy Instagram for wordpress. Awesome!" data-hashtags="wordpress">Tweet</a>
89
- <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
90
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  </div>
 
 
92
 
93
- <div id="fb-root"></div>
94
- <script>(function(d, s, id) {
95
- var js, fjs = d.getElementsByTagName(s)[0];
96
- if (d.getElementById(id)) return;
97
- js = d.createElement(s); js.id = id;
98
- js.src = "//connect.facebook.net/it_IT/all.js#xfbml=1&appId=359330984151581";
99
- fjs.parentNode.insertBefore(js, fjs);
100
- }(document, 'script', 'facebook-jssdk'));
101
- </script>
102
- <div class="ei_facebook_block">
103
- <div class="fb-like" data-href="http://www.mediabeta.com/enjoy-instagram/" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true">
104
- </div>
 
 
105
  </div>
106
- </div>
107
-
108
- <div id="buy_me_a_coffee" style="background:url(<?php echo plugins_url( 'images/buymeacoffee.png' , __FILE__ ) ; ?>)#fff no-repeat; ">
109
-
110
- <div class="pad_coffee">
111
- <span class="coffee_title">Buy me a coffee!</span>
112
- <p><span>If you liked our work please consider to make a kind donation through Paypal.</span></p>
113
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
114
- <input type="hidden" name="cmd" value="_s-xclick">
115
- <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYA2UD9nEEx7DpSJjZ9cMPpXQcwkplkngz5Om2lrCRndClH2wsLNtoW6zpt0WHv90aE8pabeHs019W7MSA/7lPiNbMr62sSV/b8+80b9wBX9ch7GTKNcgXQ3qO2Gg16+iRa0EkwFZY6wjVu1d6cjYUROR1FYziTkOwZ0rFB1BIpDOTELMAkGBSsOAwIaBQAwgcQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIxmfBLfx5kLKAgaCjqYuWhMkP5ATABAMc7wK8XgJ3TEvNz/GfgaA5eVLM1+g3CYoDo/gBat7kKhfRUh03V4NLSuk+AwDbOzHUx0M7jQZEINE9Ur0GWj2lBOipRcAFZziUvUg1cavok3gf+pkNbKdToVs51wWgQkVYu6x0rlLvXk8YX5Z5QLNNGwIkYe8wNI+NrEkYwnQ2axflISLL+BSC1yoSgasv1huhd7QUoIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTQwMzE3MTUzNDA2WjAjBgkqhkiG9w0BCQQxFgQULx/mUONLbAeob5jHfwrjw49VOi0wDQYJKoZIhvcNAQEBBQAEgYBJzOmAZY/fXJWt1EHmthZz55pvpW0T1z7F4XVAk85mH/0ZIgRrA9Bj5lsU/3YKvx3LCj4SFRRkTIb0f77/vWtN1BoZi1wWwSMODl9kdbVlQNh61FVXBp1FaKoiq1pn176D2uKGpRloQiWH2jP+TGrS81XTEI4rVai73+Tr5Ms/RQ==-----END PKCS7-----
116
- ">
117
- <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
118
- <img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
119
- </form>
120
- </div>
121
- </div>
122
- </div>
123
- </h2>
124
-
125
-
126
- <?php $this->plugin_options_tabs(); ?>
127
- <?php
128
- if($tab == 'enjoyinstagram_general_settings') {
129
- if(isset($_GET['code']) && $_GET['code']!=''){
130
-
131
- // get access token
132
-
133
- $client_id = get_option('enjoyinstagram_client_id');
134
- $client_secret = get_option('enjoyinstagram_client_secret');
135
- $redirect_uri = admin_url('options-general.php?page=enjoyinstagram_plugin_options&tab=enjoyinstagram_general_settings');
136
- $code = $_GET['code'];
137
-
138
- $apiData = array(
139
- 'client_id' => $client_id,
140
- 'client_secret' => $client_secret,
141
- 'grant_type' => 'authorization_code',
142
- 'redirect_uri' => $redirect_uri,
143
- 'code' => $code
144
- );
145
-
146
-
147
- $apiHost = 'https://api.instagram.com/oauth/access_token';
148
-
149
- $ch = curl_init();
150
- curl_setopt($ch, CURLOPT_URL, $apiHost);
151
- curl_setopt($ch, CURLOPT_POST, count($apiData));
152
- curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($apiData));
153
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
154
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
155
- $jsonData = curl_exec($ch);
156
- curl_close($ch);
157
- $user = json_decode($jsonData,true);
158
-
159
- $enjoyinstagram_user_id = $user['user']['id'];
160
- $enjoyinstagram_user_username = $user['user']['username'];
161
- $enjoyinstagram_user_profile_picture = $user['user']['profile_picture'];
162
- $enjoyinstagram_user_fullname = $user['user']['full_name'];
163
- $enjoyinstagram_user_website = $user['user']['website'];
164
- $enjoyinstagram_user_bio = $user['user']['bio'];
165
- $enjoyinstagram_access_token = $user['access_token'];
166
-
167
- update_option( 'enjoyinstagram_user_id', $enjoyinstagram_user_id );
168
- update_option( 'enjoyinstagram_user_username', $enjoyinstagram_user_username );
169
- update_option( 'enjoyinstagram_user_profile_picture', $enjoyinstagram_user_profile_picture );
170
- update_option( 'enjoyinstagram_user_fullname', $enjoyinstagram_user_fullname );
171
- update_option( 'enjoyinstagram_user_website', $enjoyinstagram_user_website );
172
- update_option( 'enjoyinstagram_user_bio', $enjoyinstagram_user_bio );
173
- update_option( 'enjoyinstagram_access_token', $enjoyinstagram_access_token );
174
-
175
-
176
  // get accee token fine
177
- include('library/profile_auth.php');
178
-
179
- }else{
180
-
181
- if(!(get_option('enjoyinstagram_access_token'))){
182
- include('library/autenticazione.php');
183
- } else {
184
- include('library/profile_auth.php');
185
- }
186
-
187
- }
188
- }else if($tab == 'enjoyinstagram_advanced_settings'){
189
- include('library/impostazioni_shortcode.php');
190
- } ?>
191
- </div>
192
- <?php
 
193
  }
194
-
195
  function plugin_options_tabs() {
196
  $current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $this->enjoyinstagram_general_settings_key;
197
 
@@ -199,11 +194,184 @@ class Settings_enjoyinstagram_Plugin {
199
  echo '<h2 class="nav-tab-wrapper">';
200
  foreach ( $this->plugin_settings_tabs as $tab_key => $tab_caption ) {
201
  $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
202
- echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->plugin_options_key . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
203
  }
204
  echo '</h2>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  }
206
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
 
208
  // Initialize the plugin
209
  add_action( 'plugins_loaded', create_function( '', '$Settings_enjoyinstagram_Plugin = new Settings_enjoyinstagram_Plugin;' ) );
@@ -211,97 +379,97 @@ add_action( 'plugins_loaded', create_function( '', '$Settings_enjoyinstagram_Plu
211
 
212
  function enjoyinstagram_default_option()
213
  {
214
- add_option('enjoyinstagram_client_id', '');
215
- add_option('enjoyinstagram_client_secret', '');
216
- add_option('enjoyinstagram_client_code', '');
217
- add_option('enjoyinstagram_user_instagram', '');
218
- add_option('enjoyinstagram_user_id', '');
219
- add_option('enjoyinstagram_user_username', '');
220
- add_option('enjoyinstagram_user_profile_picture', '');
221
- add_option('enjoyinstagram_user_fullname', '');
222
- add_option('enjoyinstagram_user_website', '');
223
- add_option('enjoyinstagram_user_bio', '');
224
- add_option('enjoyinstagram_access_token', '');
225
- add_option('enjoyinstagram_carousel_items_number', 4);
226
- add_option('enjoyinstagram_carousel_navigation', 'false');
227
- add_option('enjoyinstagram_grid_rows', '2');
228
- add_option('enjoyinstagram_grid_cols', '5');
229
- add_option('enjoyinstagram_hashtag', '');
230
- add_option('enjoyinstagram_user_or_hashtag', 'user');
231
  }
232
 
233
  register_activation_hook( __FILE__, 'enjoyinstagram_default_option');
234
 
235
  function enjoyinstagram_register_options_group_auth()
236
  {
237
- register_setting('enjoyinstagram_options_group_auth', 'enjoyinstagram_client_id');
238
- register_setting('enjoyinstagram_options_group_auth', 'enjoyinstagram_client_secret');
239
- register_setting('enjoyinstagram_options_group_auth', 'enjoyinstagram_client_code');
240
- register_setting('enjoyinstagram_options_group_auth', 'enjoyinstagram_user_instagram');
241
  }
242
 
243
  add_action ('admin_init', 'enjoyinstagram_register_options_group_auth');
244
 
245
  function enjoyinstagram_register_options_group()
246
  {
247
- register_setting('enjoyinstagram_options_group', 'enjoyinstagram_client_id');
248
- register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_instagram');
249
- register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_id');
250
- register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_username');
251
- register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_profile_picture');
252
- register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_fullname');
253
- register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_website');
254
- register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_bio');
255
- register_setting('enjoyinstagram_options_group', 'enjoyinstagram_access_token');
256
  }
257
 
258
  add_action ('admin_init', 'enjoyinstagram_register_options_group');
259
 
260
  function enjoyinstagram_register_options_carousel()
261
  {
262
- register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_carousel_items_number');
263
- register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_carousel_navigation');
264
- register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_grid_cols');
265
- register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_grid_rows');
266
- register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_hashtag');
267
- register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_user_or_hashtag');
268
 
269
  }
270
 
271
  add_action ('admin_init', 'enjoyinstagram_register_options_carousel');
272
-
273
  function aggiungi_script_instafeed_owl() {
274
-
275
- if(!is_admin()) {
276
-
277
- wp_register_script('owl', plugins_url('/js/owl.carousel.js',__FILE__),'jquery','');
278
- wp_register_script('swipebox', plugins_url('/js/jquery.swipebox.js',__FILE__),'jquery','');
279
- wp_register_script('gridrotator', plugins_url('/js/jquery.gridrotator.js',__FILE__),'jquery','');
280
- wp_register_script('modernizr.custom.26633', plugins_url('/js/modernizr.custom.26633.js',__FILE__),'jquery','');
281
- wp_register_script('orientationchange', plugins_url('/js/ios-orientationchange-fix.js',__FILE__),'jquery','');
282
-
283
- wp_register_style( 'owl_style', plugins_url('/css/owl.carousel.css',__FILE__) );
284
- wp_register_style( 'owl_style_2', plugins_url('/css/owl.theme.css',__FILE__) );
285
- wp_register_style( 'owl_style_3', plugins_url('/css/owl.transitions.css',__FILE__) );
286
- wp_register_style( 'swipebox_css', plugins_url('/css/swipebox.css',__FILE__) );
287
- wp_register_style( 'grid_fallback', plugins_url('/css/grid_fallback.css',__FILE__) );
288
- wp_register_style( 'grid_style', plugins_url('/css/grid_style.css',__FILE__) );
289
-
290
- wp_enqueue_script( 'jquery' ); // include jQuery
291
- wp_enqueue_script('owl');
292
- wp_enqueue_script('swipebox');
293
- wp_enqueue_script('modernizr.custom.26633');
294
- wp_enqueue_script('gridrotator');
295
- wp_enqueue_script('orientationchange');
296
- wp_enqueue_style( 'owl_style' );
297
- wp_enqueue_style( 'owl_style_2' );
298
- wp_enqueue_style( 'owl_style_3' );
299
- wp_enqueue_style( 'swipebox_css' );
300
- wp_enqueue_style( 'grid_fallback' );
301
- wp_enqueue_style( 'grid_style' );
302
- }
303
  }
304
-
305
  add_action( 'wp_enqueue_scripts', 'aggiungi_script_instafeed_owl' );
306
 
307
  function aggiungi_script_in_admin(){
@@ -313,89 +481,90 @@ add_action( 'admin_enqueue_scripts', 'aggiungi_script_in_admin' );
313
  add_action( 'admin_head', 'aggiungo_javascript_in_pannello_amministrazione' );
314
 
315
  function aggiungo_javascript_in_pannello_amministrazione() {
316
- ?>
317
- <script type="text/javascript">
318
-
319
-
320
- function post_to_url(path, method) {
321
- method = method || "get";
322
- var params = new Array();
323
- var client_id = document.getElementById('enjoyinstagram_client_id').value;
324
- var client_secret = document.getElementById('enjoyinstagram_client_secret').value;
325
- params['client_id'] = client_id;
326
- params['redirect_uri'] = '<?php echo admin_url('options-general.php?page=enjoyinstagram_plugin_options&tab=enjoyinstagram_general_settings'); ?>';
327
- params['scope'] = 'likes';
328
- params['response_type'] = 'code';
329
-
330
- var form = document.createElement("form");
331
- form.setAttribute("method", method);
332
- form.setAttribute("action", path);
333
-
334
- for(var key in params) {
335
- if(params.hasOwnProperty(key)) {
336
- var hiddenField = document.createElement("input");
337
- hiddenField.setAttribute("type", "hidden");
338
- hiddenField.setAttribute("name", key);
339
- hiddenField.setAttribute("value", params[key]);
340
-
341
- form.appendChild(hiddenField);
342
- }
343
- }
344
-
345
-
346
- document.body.appendChild(form);
347
- form.submit();
348
-
349
  }
 
350
 
351
 
352
- </script>
 
 
 
 
 
 
353
  <?php
354
  }
355
 
356
-
357
 
358
  function funzioni_in_head() {
359
- ?>
360
- <script type="text/javascript">
361
  jQuery(function($) {
362
  $(".swipebox_grid").swipebox({
363
- hideBarsDelay : 0
364
  });
365
-
366
- });
367
 
368
  jQuery(function(){
369
- jQuery(document.body)
370
- .on('click touchend','#swipebox-slider .current img', function(e){
371
- jQuery('#swipebox-next').click();
372
- return false;
373
- })
374
- .on('click touchend','#swipebox-slider .current', function(e){
375
- jQuery('#swipebox-close').trigger('click');
376
- });
 
 
377
  });
378
-
379
- </script>
380
- <?php
381
  }
382
 
383
-
384
  add_action('wp_head', 'funzioni_in_head');
385
 
386
-
387
-
388
- function enjoyinstagram_plugin_settings_link($links) {
389
- $settings_link = '<a href="options-general.php?page=enjoyinstagram_plugin_options">' . __( 'Settings' ) . '</a>';
390
- $widgets_link = '<a href="widgets.php">' . __( 'Widgets' ) . '</a>';
391
- $premium_link = '<a href="http://www.mediabeta.com/enjoy-instagram/">' . __( 'Premium Version' ) . '</a>';
392
- array_push($links, $settings_link);
393
- array_push($links, $widgets_link);
394
- array_push($links, $premium_link);
395
- return $links;
396
  }
397
-
398
- $plugin = plugin_basename(__FILE__);
399
  add_filter("plugin_action_links_$plugin", 'enjoyinstagram_plugin_settings_link');
400
 
401
 
@@ -405,37 +574,37 @@ add_filter("plugin_action_links_$plugin", 'enjoyinstagram_plugin_settings_link')
405
  add_action( 'admin_footer', 'add_option_client_ajax' );
406
 
407
  function add_option_client_ajax() {
408
- ?>
409
- <script type="text/javascript" >
410
-
411
- jQuery('#button_autorizza_instagram').click(function() {
412
- var client_id = document.getElementById('enjoyinstagram_client_id').value;
413
- var client_secret = document.getElementById('enjoyinstagram_client_secret').value;
414
- var data = {
415
- action: 'user_option_ajax',
416
- client_id_value: client_id,
417
- client_secret_value: client_secret
418
- };
419
-
420
-
421
- jQuery.post(ajaxurl, data, function(response) {
422
- post_to_url('https://api.instagram.com/oauth/authorize/','get');
423
- });
424
- });
425
- </script>
426
  <?php
427
  }
428
 
429
  add_action( 'wp_ajax_user_option_ajax', 'user_option_ajax_callback' );
430
 
431
  function user_option_ajax_callback() {
432
- global $wpdb;
433
 
434
  $client_id = $_POST['client_id_value'];
435
- $client_secret = $_POST['client_secret_value'];
436
- echo $client_id."<br />".$client_secret;
437
- update_option( 'enjoyinstagram_client_id', $client_id );
438
- update_option( 'enjoyinstagram_client_secret', $client_secret );
439
 
440
  die();
441
  }
@@ -444,45 +613,91 @@ update_option( 'enjoyinstagram_client_secret', $client_secret );
444
  add_action( 'admin_footer', 'logout_client_ajax' );
445
 
446
  function logout_client_ajax() {
447
- ?>
448
- <script type="text/javascript" >
449
-
450
- jQuery('#button_logout').click(function() {
451
- var data = {
452
- action: 'user_logout_ajax'
453
- };
454
-
455
-
456
- jQuery.post(ajaxurl, data, function(response) {
457
- location.href = '<?php echo get_admin_url(); ?>options-general.php?page=enjoyinstagram_plugin_options&tab=enjoyinstagram_general_settings';
458
- });
459
- });
460
- </script>
461
  <?php
462
  }
463
 
464
  add_action( 'wp_ajax_user_logout_ajax', 'user_logout_ajax_callback' );
465
 
466
  function user_logout_ajax_callback() {
467
- global $wpdb;
 
 
 
 
 
 
 
 
468
 
469
- update_option('enjoyinstagram_user_id','');
470
- update_option('enjoyinstagram_user_username','');
471
- update_option('enjoyinstagram_user_profile_picture','');
472
- update_option('enjoyinstagram_user_fullname','');
473
- update_option('enjoyinstagram_user_website','');
474
- update_option('enjoyinstagram_user_bio','');
475
- update_option('enjoyinstagram_access_token','');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476
 
477
- die();
 
 
 
478
  }
479
 
 
 
 
 
 
 
 
480
 
481
- //require('custom_editor_button/shortcode_button.php');
482
 
483
  include_once ('tinymce/tinymce.php');
484
  require_once ('tinymce/ajax.php');
485
-
486
  require_once('library/widgets.php');
487
  require_once('library/widgets_grid.php');
488
  require_once('library/enjoyinstagram_shortcode_grid.php');
1
  <?php
2
  /*
3
+ Plugin Name: Enjoy Plugin for Instagram
4
  Plugin URI: http://www.mediabeta.com/enjoy-instagram/
5
  Description: Instagram Responsive Images Gallery and Carousel, works with Shortcodes and Widgets.
6
+ Version: 2.1.3
7
  Author: F. Prestipino, F. Di Pane - Mediabeta Srl
8
  Author URI: http://www.mediabeta.com/team/
9
  */
10
 
11
  require_once('library/enjoyinstagram_shortcode.php');
 
12
  class Settings_enjoyinstagram_Plugin {
13
 
14
  private $enjoyinstagram_general_settings_key = 'enjoyinstagram_general_settings';
22
  add_action( 'admin_init', array( &$this, 'register_advanced_settings' ) );
23
  add_action( 'admin_menu', array( &$this, 'add_admin_menus' ) );
24
  }
25
+
26
  function load_settings() {
27
  $this->general_settings = (array) get_option( $this->enjoyinstagram_general_settings_key );
28
  $this->advanced_settings = (array) get_option( $this->advanced_settings_key );
29
  $this->general_settings = array_merge( array(
30
  'general_option' => 'General value'
31
  ), $this->general_settings );
32
+
33
  $this->advanced_settings = array_merge( array(
34
  'advanced_option' => 'Advanced value'
35
  ), $this->advanced_settings );
36
  }
37
+
38
  function register_enjoyinstagram_client_id() {
39
  $this->plugin_settings_tabs[$this->enjoyinstagram_general_settings_key] = 'Profile';
40
+
41
  register_setting( $this->enjoyinstagram_general_settings_key, $this->enjoyinstagram_general_settings_key );
42
  add_settings_section( 'section_general', 'General Plugin Settings', array( &$this, 'section_general_desc' ), $this->enjoyinstagram_general_settings_key );
43
  add_settings_field( 'general_option', 'A General Option', array( &$this, 'field_general_option' ), $this->enjoyinstagram_general_settings_key, 'section_general' );
44
  }
45
+
46
+
47
  function register_advanced_settings() {
48
  $this->plugin_settings_tabs[$this->advanced_settings_key] = 'Settings';
49
+
50
  register_setting( $this->advanced_settings_key, $this->advanced_settings_key );
51
  add_settings_section( 'section_advanced', 'Advanced Plugin Settings', array( &$this, 'section_advanced_desc' ), $this->advanced_settings_key );
52
  add_settings_field( 'advanced_option', 'An Advanced Option', array( &$this, 'field_advanced_option' ), $this->advanced_settings_key, 'section_advanced' );
53
  }
54
+
55
+
56
  function section_general_desc() { echo 'Instagram Settings'; }
57
+ function section_advanced_desc() { echo 'Manage Enjoy Plugin for Instagram.'; }
58
+
59
+
60
  function field_general_option() {
61
  ?>
62
+ <input type="text" name="<?php echo $this->enjoyinstagram_general_settings_key; ?>[general_option]" value="<?php echo esc_attr( $this->general_settings['general_option'] ); ?>" /><?php
63
  }
64
+
65
+
66
  function field_advanced_option() { ?>
67
+ <input type="text" name="<?php echo $this->advanced_settings_key; ?>[advanced_option]" value="<?php echo esc_attr( $this->advanced_settings['advanced_option'] ); ?>" />
68
+ <?php
69
  }
70
+
71
+
72
  function add_admin_menus() {
73
+ add_options_page( 'Enjoy Plugin for Instagram', 'Enjoy Plugin for Instagram', 'manage_options', $this->plugin_options_key, array( &$this, 'enjoyinstagram_options_page' ) );
74
  }
75
+
76
+
77
  function enjoyinstagram_options_page() {
78
  $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $this->enjoyinstagram_general_settings_key;?>
79
+ <div class="wrap">
80
+ <h2><div class="ei_block">
81
+ <div class="ei_left_block">
82
+ <div class="ei_hard_block">
83
+ <?php echo '<img src="' . plugins_url( 'images/enjoyinstagram.png' , __FILE__ ) . '" > '; ?>
84
+ </div>
85
+
86
+ <div class="ei_twitter_block">
87
+ <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.mediabeta.com/enjoy-instagram/" data-text="I've just installed Enjoy Plugin for Instagram for wordpress. Awesome!" data-hashtags="wordpress">Tweet</a>
88
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
89
+ </script>
90
+ </div>
91
+
92
+ <div id="fb-root"></div>
93
+ <script>(function(d, s, id) {
94
+ var js, fjs = d.getElementsByTagName(s)[0];
95
+ if (d.getElementById(id)) return;
96
+ js = d.createElement(s); js.id = id;
97
+ js.src = "//connect.facebook.net/it_IT/sdk.js#xfbml=1&appId=359330984151581&version=v2.0";
98
+ fjs.parentNode.insertBefore(js, fjs);
99
+ }(document, 'script', 'facebook-jssdk'));</script>
100
+ <div class="ei_facebook_block">
101
+ <div class="fb-like" data-href="http://www.mediabeta.com/enjoy-instagram/" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true">
102
+ </div>
103
+ </div>
104
+ </div>
105
+
106
+ <div id="buy_me_a_coffee" style="background:url(<?php echo plugins_url( 'images/buymeacoffee.png' , __FILE__ ) ; ?>)#fff no-repeat; ">
107
+
108
+ <div class="pad_coffee">
109
+ <span class="coffee_title">Buy me a coffee!</span>
110
+ <p><span>If you liked our work please consider to make a kind donation through Paypal.</span></p>
111
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
112
+ <input type="hidden" name="cmd" value="_s-xclick">
113
+ <input type="hidden" name="hosted_button_id" value="8MXZ37DWHAX46">
114
+ <input type="image" src="https://www.paypalobjects.com/en_US/IT/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
115
+ <img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
116
+ </form>
117
+ </div>
118
+ </div>
119
  </div>
120
+ <div class="ei_block">
121
+
122
 
123
+ <div id="premium_release">
124
+
125
+ <div class="pad_premium_release">
126
+ <span class="coffee_title">Premium Version is <a href="http://www.mediabeta.com/enjoy-instagram-premium/">HERE</a> !</span>
127
+ <p><span style="color:#900; font-weight: bold;">Enjoy Plugin for Instagram Premium</span> is the only plugin that allows you to <span style="color:#900; font-weight: bold;">moderate</span> the pictures and choose which show.<br />
128
+ Discover now all the features and innovations, <a href="http://www.mediabeta.com/enjoy-instagram-premium/">CLICK HERE</a></p>
129
+
130
+ </div>
131
+
132
+ </div>
133
+ <?php /*
134
+ <div class="promo_enjoy">
135
+ <a target="_blank" href="http://www.mediabetaprojects.com/enjoy-instagram-premium/"><img src="<?php echo plugins_url('/img/gift2016.jpg',__FILE__); ?>" /></a>
136
+ </div> */ ?>
137
  </div>
138
+ </h2>
139
+
140
+
141
+ <?php $this->plugin_options_tabs(); ?>
142
+ <?php
143
+ if($tab == 'enjoyinstagram_general_settings') {
144
+
145
+ if(isset($_GET['access_token']) && $_GET['access_token']!=''){
146
+
147
+ $user = array();
148
+ $user = get_user_info($_GET['access_token']);
149
+
150
+
151
+
152
+
153
+ $enjoyinstagram_user_id = $user['data']['id'];
154
+ $enjoyinstagram_user_username = replace4byte($user['data']['username']);
155
+ $enjoyinstagram_user_profile_picture = $user['data']['profile_picture'];
156
+ $enjoyinstagram_user_fullname = replace4byte($user['data']['full_name']);
157
+ $enjoyinstagram_user_website = $user['data']['website'];
158
+ $enjoyinstagram_user_bio = replace4byte($user['data']['bio']);
159
+ $enjoyinstagram_access_token = $_GET['access_token'];
160
+
161
+ update_option( 'enjoyinstagram_user_id', $enjoyinstagram_user_id );
162
+ update_option( 'enjoyinstagram_user_username', $enjoyinstagram_user_username );
163
+ update_option( 'enjoyinstagram_user_profile_picture', $enjoyinstagram_user_profile_picture );
164
+ update_option( 'enjoyinstagram_user_fullname', $enjoyinstagram_user_fullname );
165
+ update_option( 'enjoyinstagram_user_website', $enjoyinstagram_user_website );
166
+ update_option( 'enjoyinstagram_user_bio', $enjoyinstagram_user_bio );
167
+ update_option( 'enjoyinstagram_access_token', $enjoyinstagram_access_token );
168
+
169
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  // get accee token fine
171
+ include('library/profile_auth.php');
172
+
173
+ }
174
+ else{
175
+
176
+ if(!(get_option('enjoyinstagram_access_token'))){
177
+ include('library/autenticazione.php');
178
+ } else {
179
+ include('library/profile_auth.php');
180
+ }
181
+
182
+ }
183
+ }else if($tab == 'enjoyinstagram_advanced_settings'){
184
+ include('library/impostazioni_shortcode.php');
185
+ } ?>
186
+ </div>
187
+ <?php
188
  }
189
+
190
  function plugin_options_tabs() {
191
  $current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $this->enjoyinstagram_general_settings_key;
192
 
194
  echo '<h2 class="nav-tab-wrapper">';
195
  foreach ( $this->plugin_settings_tabs as $tab_key => $tab_caption ) {
196
  $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
197
+ echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->plugin_options_key . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
198
  }
199
  echo '</h2>';
200
+ }
201
+ };
202
+
203
+
204
+
205
+
206
+ function get_user_info($access_token){
207
+ $url = 'https://api.instagram.com/v1/users/self/?access_token='.$access_token;
208
+ try {
209
+ $curl_connection = curl_init($url);
210
+ curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
211
+ curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
212
+ curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
213
+
214
+ //Data are stored in $data
215
+ $data = json_decode(curl_exec($curl_connection), true);
216
+ curl_close($curl_connection);
217
+ return $data;
218
+ } catch(Exception $e) {
219
+ return $e->getMessage();
220
+ }
221
+
222
+ }
223
+ function get_hash($hashtag,$count){
224
+
225
+
226
+ $access_token = get_option('enjoyinstagram_access_token');
227
+
228
+
229
+ $url = 'https://api.instagram.com/v1/tags/' . $hashtag . '/media/recent?count=' . $count . '&access_token=' . $access_token;
230
+ try {
231
+ $curl_connection = curl_init($url);
232
+ curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
233
+ curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
234
+ curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
235
+
236
+ //Data are stored in $data
237
+ $result = json_decode(curl_exec($curl_connection), true);
238
+ curl_close($curl_connection);
239
+ return $result;
240
+ } catch (Exception $e) {
241
+ return $e->getMessage();
242
+ }
243
+
244
+ }
245
+ function get_hash_code($hashtag,$count){
246
+
247
+ $access_token = get_option('enjoyinstagram_access_token');
248
+
249
+
250
+ $url = 'https://api.instagram.com/v1/tags/' . $hashtag . '/media/recent?count=' . $count . '&access_token=' . $access_token;
251
+ try {
252
+ $curl_connection = curl_init($url);
253
+ curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
254
+ curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
255
+ curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
256
+
257
+ //Data are stored in $data
258
+ $result = json_decode(curl_exec($curl_connection), true);
259
+ $code = $result['meta']['code'];
260
+ curl_close($curl_connection);
261
+ return $code;
262
+ } catch (Exception $e) {
263
+ return $e->getMessage();
264
  }
265
+
266
+ }
267
+ function get_user($user,$count){
268
+
269
+
270
+
271
+ $access_token = get_option('enjoyinstagram_access_token');
272
+
273
+
274
+ $url = 'https://api.instagram.com/v1/users/self/media/recent?count='.$count.'&access_token='.$access_token;
275
+ try {
276
+ $curl_connection = curl_init($url);
277
+ curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
278
+ curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
279
+ curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
280
+
281
+ //Data are stored in $data
282
+ $result = json_decode(curl_exec($curl_connection), true);
283
+ curl_close($curl_connection);
284
+ return $result;
285
+ } catch(Exception $e) {
286
+ return $e->getMessage();
287
+ }
288
+
289
+ }
290
+ function get_user_code($user,$count){
291
+
292
+ $access_token = get_option('enjoyinstagram_access_token');
293
+
294
+
295
+ $url = 'https://api.instagram.com/v1/users/self/media/recent?count='.$count.'&access_token='.$access_token;
296
+ try {
297
+ $curl_connection = curl_init($url);
298
+ curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
299
+ curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
300
+ curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
301
+
302
+ //Data are stored in $data
303
+ $result = json_decode(curl_exec($curl_connection), true);
304
+ $code = $result['meta']['code'];
305
+ curl_close($curl_connection);
306
+ return $code;
307
+ } catch(Exception $e) {
308
+ return $e->getMessage();
309
+ }
310
+
311
+ }
312
+ function get_media($user,$media){
313
+
314
+ $access_token = get_option('enjoyinstagram_access_token');
315
+
316
+
317
+ $url = 'https://api.instagram.com/v1/media/'.$media.'?access_token='.$access_token;
318
+ try {
319
+ $curl_connection = curl_init($url);
320
+ curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
321
+ curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
322
+ curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
323
+
324
+ //Data are stored in $data
325
+ $result = json_decode(curl_exec($curl_connection), true);
326
+ curl_close($curl_connection);
327
+ return $result;
328
+ } catch(Exception $e) {
329
+ return $e->getMessage();
330
+ }
331
+
332
+ }
333
+ function get_likes($user,$count){
334
+ $access_token = get_option('enjoyinstagram_access_token');
335
+ $url = 'https://api.instagram.com/v1/users/self/media/liked?count='.$count.'&access_token='.$access_token;
336
+ try {
337
+ $curl_connection = curl_init($url);
338
+ curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
339
+ curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
340
+ curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
341
+
342
+ //Data are stored in $data
343
+ $result = json_decode(curl_exec($curl_connection), true);
344
+ curl_close($curl_connection);
345
+ return $result;
346
+ } catch(Exception $e) {
347
+ return $e->getMessage();
348
+ }
349
+ }
350
+ function get_likes_code($user,$count){
351
+ $access_token = get_option('enjoyinstagram_access_token');
352
+ $url = 'https://api.instagram.com/v1/users/self/media/liked?count='.$count.'&access_token='.$access_token;
353
+ try {
354
+ $curl_connection = curl_init($url);
355
+ curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
356
+ curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
357
+ curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
358
+
359
+ //Data are stored in $data
360
+ $result = json_decode(curl_exec($curl_connection), true);
361
+ $code = $result['meta']['code'];
362
+ curl_close($curl_connection);
363
+ return $code;
364
+ } catch(Exception $e) {
365
+ return $e->getMessage();
366
+ }
367
+ }
368
+ function replace4byte($string) {
369
+ return preg_replace('%(?:
370
+ \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
371
+ | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
372
+ | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
373
+ )%xs', '', $string);
374
+ }
375
 
376
  // Initialize the plugin
377
  add_action( 'plugins_loaded', create_function( '', '$Settings_enjoyinstagram_Plugin = new Settings_enjoyinstagram_Plugin;' ) );
379
 
380
  function enjoyinstagram_default_option()
381
  {
382
+ add_option('enjoyinstagram_client_id', '');
383
+ add_option('enjoyinstagram_client_secret', '');
384
+ add_option('enjoyinstagram_client_code', '');
385
+ add_option('enjoyinstagram_user_instagram', '');
386
+ add_option('enjoyinstagram_user_id', '');
387
+ add_option('enjoyinstagram_user_username', '');
388
+ add_option('enjoyinstagram_user_profile_picture', '');
389
+ add_option('enjoyinstagram_user_fullname', '');
390
+ add_option('enjoyinstagram_user_website', '');
391
+ add_option('enjoyinstagram_user_bio', '');
392
+ add_option('enjoyinstagram_access_token', '');
393
+ add_option('enjoyinstagram_carousel_items_number', 4);
394
+ add_option('enjoyinstagram_carousel_navigation', 'false');
395
+ add_option('enjoyinstagram_grid_rows', '2');
396
+ add_option('enjoyinstagram_grid_cols', '5');
397
+ add_option('enjoyinstagram_hashtag', '');
398
+ add_option('enjoyinstagram_user_or_hashtag', 'user');
399
  }
400
 
401
  register_activation_hook( __FILE__, 'enjoyinstagram_default_option');
402
 
403
  function enjoyinstagram_register_options_group_auth()
404
  {
405
+ register_setting('enjoyinstagram_options_group_auth', 'enjoyinstagram_client_id');
406
+ register_setting('enjoyinstagram_options_group_auth', 'enjoyinstagram_client_secret');
407
+ register_setting('enjoyinstagram_options_group_auth', 'enjoyinstagram_client_code');
408
+ register_setting('enjoyinstagram_options_group_auth', 'enjoyinstagram_user_instagram');
409
  }
410
 
411
  add_action ('admin_init', 'enjoyinstagram_register_options_group_auth');
412
 
413
  function enjoyinstagram_register_options_group()
414
  {
415
+ register_setting('enjoyinstagram_options_group', 'enjoyinstagram_client_id');
416
+ register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_instagram');
417
+ register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_id');
418
+ register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_username');
419
+ register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_profile_picture');
420
+ register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_fullname');
421
+ register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_website');
422
+ register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_bio');
423
+ register_setting('enjoyinstagram_options_group', 'enjoyinstagram_access_token');
424
  }
425
 
426
  add_action ('admin_init', 'enjoyinstagram_register_options_group');
427
 
428
  function enjoyinstagram_register_options_carousel()
429
  {
430
+ register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_carousel_items_number');
431
+ register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_carousel_navigation');
432
+ register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_grid_cols');
433
+ register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_grid_rows');
434
+ register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_hashtag');
435
+ register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_user_or_hashtag');
436
 
437
  }
438
 
439
  add_action ('admin_init', 'enjoyinstagram_register_options_carousel');
440
+
441
  function aggiungi_script_instafeed_owl() {
442
+
443
+ if(!is_admin()) {
444
+
445
+ wp_register_script('owl', plugins_url('/js/owl.carousel.js',__FILE__),'jquery','');
446
+ wp_register_script('swipebox', plugins_url('/js/jquery.swipebox.js',__FILE__),'jquery','');
447
+ wp_register_script('gridrotator', plugins_url('/js/jquery.gridrotator.js',__FILE__),'jquery','');
448
+ wp_register_script('modernizr.custom.26633', plugins_url('/js/modernizr.custom.26633.js',__FILE__),'jquery','');
449
+ wp_register_script('orientationchange', plugins_url('/js/ios-orientationchange-fix.js',__FILE__),'jquery','');
450
+
451
+ wp_register_style( 'owl_style', plugins_url('/css/owl.carousel.css',__FILE__) );
452
+ wp_register_style( 'owl_style_2', plugins_url('/css/owl.theme.css',__FILE__) );
453
+ wp_register_style( 'owl_style_3', plugins_url('/css/owl.transitions.css',__FILE__) );
454
+ wp_register_style( 'swipebox_css', plugins_url('/css/swipebox.css',__FILE__) );
455
+ wp_register_style( 'grid_fallback', plugins_url('/css/grid_fallback.css',__FILE__) );
456
+ wp_register_style( 'grid_style', plugins_url('/css/grid_style.css',__FILE__) );
457
+
458
+ wp_enqueue_script( 'jquery' ); // include jQuery
459
+ wp_enqueue_script('owl');
460
+ wp_enqueue_script('swipebox');
461
+ wp_enqueue_script('modernizr.custom.26633');
462
+ wp_enqueue_script('gridrotator');
463
+ wp_enqueue_script('orientationchange');
464
+ wp_enqueue_style( 'owl_style' );
465
+ wp_enqueue_style( 'owl_style_2' );
466
+ wp_enqueue_style( 'owl_style_3' );
467
+ wp_enqueue_style( 'swipebox_css' );
468
+ wp_enqueue_style( 'grid_fallback' );
469
+ wp_enqueue_style( 'grid_style' );
470
+ }
471
  }
472
+
473
  add_action( 'wp_enqueue_scripts', 'aggiungi_script_instafeed_owl' );
474
 
475
  function aggiungi_script_in_admin(){
481
  add_action( 'admin_head', 'aggiungo_javascript_in_pannello_amministrazione' );
482
 
483
  function aggiungo_javascript_in_pannello_amministrazione() {
484
+ ?>
485
+ <script type="text/javascript">
486
+
487
+
488
+ function post_to_url(path, method) {
489
+ method = method || "get";
490
+ var params = new Array();
491
+ var client_id = '1f1bf91b383647749df62b59526d9be1';
492
+ var client_secret = 'c1e2c0d890bf4602ac5786b3073288d4';
493
+ params['client_id'] = client_id;
494
+ params['redirect_uri'] = 'http://www.mediabetaprojects.com/put_access_token.php?url_redirect=<?php echo admin_url('options-general.php?page=enjoyinstagram_plugin_options&tab=enjoyinstagram_general_settings'); ?>';
495
+ params['response_type'] = 'token';
496
+
497
+ var form = document.createElement("form");
498
+ form.setAttribute("method", method);
499
+ form.setAttribute("action", path);
500
+
501
+ for(var key in params) {
502
+ if(params.hasOwnProperty(key)) {
503
+ var hiddenField = document.createElement("input");
504
+ hiddenField.setAttribute("type", "hidden");
505
+ hiddenField.setAttribute("name", key);
506
+ hiddenField.setAttribute("value", params[key]);
507
+
508
+ form.appendChild(hiddenField);
 
 
 
 
 
 
 
 
509
  }
510
+ }
511
 
512
 
513
+ document.body.appendChild(form);
514
+ form.submit();
515
+
516
+ }
517
+
518
+
519
+ </script>
520
  <?php
521
  }
522
 
523
+
524
 
525
  function funzioni_in_head() {
526
+ ?>
527
+ <script type="text/javascript">
528
  jQuery(function($) {
529
  $(".swipebox_grid").swipebox({
530
+ hideBarsDelay : 0
531
  });
532
+
533
+ });
534
 
535
  jQuery(function(){
536
+ /*
537
+ jQuery(document.body)
538
+ .on('click touchend','#swipebox-slider .current img', function(e){
539
+ jQuery('#swipebox-next').click();
540
+ return false;
541
+ })
542
+ .on('click touchend','#swipebox-slider .current', function(e){
543
+ jQuery('#swipebox-close').trigger('click');
544
+ });
545
+ */
546
  });
547
+
548
+ </script>
549
+ <?php
550
  }
551
 
552
+
553
  add_action('wp_head', 'funzioni_in_head');
554
 
555
+
556
+
557
+ function enjoyinstagram_plugin_settings_link($links) {
558
+ $settings_link = '<a href="options-general.php?page=enjoyinstagram_plugin_options">' . __( 'Settings' ) . '</a>';
559
+ $widgets_link = '<a href="widgets.php">' . __( 'Widgets' ) . '</a>';
560
+ $premium_link = '<a href="http://www.mediabeta.com/enjoy-instagram-premium/">' . __( 'Premium Version' ) . '</a>';
561
+ array_push($links, $settings_link);
562
+ array_push($links, $widgets_link);
563
+ array_push($links, $premium_link);
564
+ return $links;
565
  }
566
+
567
+ $plugin = plugin_basename(__FILE__);
568
  add_filter("plugin_action_links_$plugin", 'enjoyinstagram_plugin_settings_link');
569
 
570
 
574
  add_action( 'admin_footer', 'add_option_client_ajax' );
575
 
576
  function add_option_client_ajax() {
577
+ ?>
578
+ <script type="text/javascript" >
579
+
580
+ jQuery('#button_autorizza_instagram').click(function() {
581
+ var client_id = '1f1bf91b383647749df62b59526d9be1';
582
+ var client_secret = 'c1e2c0d890bf4602ac5786b3073288d4';
583
+ var data = {
584
+ action: 'user_option_ajax',
585
+ client_id_value: client_id,
586
+ client_secret_value: client_secret
587
+ };
588
+
589
+
590
+ jQuery.post(ajaxurl, data, function(response) {
591
+ post_to_url('https://api.instagram.com/oauth/authorize/','get');
592
+ });
593
+ });
594
+ </script>
595
  <?php
596
  }
597
 
598
  add_action( 'wp_ajax_user_option_ajax', 'user_option_ajax_callback' );
599
 
600
  function user_option_ajax_callback() {
601
+ global $wpdb;
602
 
603
  $client_id = $_POST['client_id_value'];
604
+ $client_secret = $_POST['client_secret_value'];
605
+ echo $client_id."<br />".$client_secret;
606
+ update_option( 'enjoyinstagram_client_id', $client_id );
607
+ update_option( 'enjoyinstagram_client_secret', $client_secret );
608
 
609
  die();
610
  }
613
  add_action( 'admin_footer', 'logout_client_ajax' );
614
 
615
  function logout_client_ajax() {
616
+ ?>
617
+ <script type="text/javascript" >
618
+
619
+ jQuery('#button_logout').click(function() {
620
+ var data = {
621
+ action: 'user_logout_ajax'
622
+ };
623
+
624
+
625
+ jQuery.post(ajaxurl, data, function(response) {
626
+ location.href = '<?php echo get_admin_url(); ?>options-general.php?page=enjoyinstagram_plugin_options&tab=enjoyinstagram_general_settings';
627
+ });
628
+ });
629
+ </script>
630
  <?php
631
  }
632
 
633
  add_action( 'wp_ajax_user_logout_ajax', 'user_logout_ajax_callback' );
634
 
635
  function user_logout_ajax_callback() {
636
+ global $wpdb;
637
+
638
+ update_option('enjoyinstagram_user_id','');
639
+ update_option('enjoyinstagram_user_username','');
640
+ update_option('enjoyinstagram_user_profile_picture','');
641
+ update_option('enjoyinstagram_user_fullname','');
642
+ update_option('enjoyinstagram_user_website','');
643
+ update_option('enjoyinstagram_user_bio','');
644
+ update_option('enjoyinstagram_access_token','');
645
 
646
+ die();
647
+ }
648
+
649
+ function isHttps() {
650
+
651
+ if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
652
+ return true;
653
+ }
654
+ }
655
+ /*
656
+ add_action('admin_notices', 'banner_admin_notice');
657
+ function banner_admin_notice() {
658
+ global $current_user ;
659
+ $user_id = $current_user->ID;
660
+ if ( ! get_user_meta($user_id, 'ignore_enjoy_notice') ) {
661
+ echo '<div style="padding: 20px;border:1px solid #ccc;background: #fff;margin-top: 20px;"><div class="promo_enjoy">
662
+ <a target="_blank" href="http://www.mediabetaprojects.com/enjoy-instagram-premium/"><img src="'.plugins_url('/img/gift2016.jpg',__FILE__).'" /></a>
663
+ </div>';
664
+ printf(__('It not interesting to me | <a href="%1$s">Hide Notice</a>'), '?ignore_enjoy=0');
665
+ echo '</div>';
666
+ }
667
+ }
668
+ */
669
+ add_action('admin_init', 'ignore_enjoy');
670
+
671
+ function ignore_enjoy() {
672
+ global $current_user;
673
+ $user_id = $current_user->ID;
674
+ /* If user clicks to ignore the notice, add that to their user meta */
675
+ if ( isset($_GET['ignore_enjoy']) && '0' == $_GET['ignore_enjoy'] ) {
676
+ add_user_meta($user_id, 'ignore_enjoy_notice', 'true', true);
677
+ }
678
+ }
679
+
680
+ /*
681
+ add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets');
682
 
683
+ function my_custom_dashboard_widgets() {
684
+ global $wp_meta_boxes;
685
+
686
+ wp_add_dashboard_widget('custom_help_widget', 'Enjoy Instagram', 'custom_dashboard_help');
687
  }
688
 
689
+ function custom_dashboard_help() {
690
+ echo '<div class="promo_enjoy">
691
+ <a href="http://www.mediabetaprojects.com/enjoy-instagram-premium/" target="_blank"><img src="'.plugins_url('/img/gift2016_dashboard.jpg',__FILE__).'" style="width:100%;"/></a>
692
+ </div>'
693
+ ;
694
+ }
695
+ */
696
 
 
697
 
698
  include_once ('tinymce/tinymce.php');
699
  require_once ('tinymce/ajax.php');
700
+
701
  require_once('library/widgets.php');
702
  require_once('library/widgets_grid.php');
703
  require_once('library/enjoyinstagram_shortcode_grid.php');
images/.png DELETED
Binary file
images/enjoyinstagram.png CHANGED
Binary file
img/gift2016.jpg ADDED
Binary file
img/gift2016_dashboard.jpg ADDED
Binary file
img/icons.png ADDED
Binary file
img/icons.svg ADDED
@@ -0,0 +1 @@
 
1
+ <?xml version="1.0" encoding="utf-8"?> <!-- Generator: IcoMoon.io --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="120" height="24" viewBox="0 0 120 24" fill="#ffffff" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M 17.384,17.705q0.00,0.536 -0.375,0.911l-1.821,1.821q-0.375,0.375 -0.911,0.375t-0.911-0.375l-3.938-3.938l-3.938,3.938q-0.375,0.375 -0.911,0.375t-0.911-0.375l-1.821-1.821q-0.375-0.375 -0.375-0.911t 0.375-0.911l 3.938-3.938l-3.938-3.938q-0.375-0.375 -0.375-0.911t 0.375-0.911l 1.821-1.821q 0.375-0.375 0.911-0.375t 0.911,0.375l 3.938,3.938l 3.938-3.938q 0.375-0.375 0.911-0.375t 0.911,0.375l 1.821,1.821q 0.375,0.375 0.375,0.911 t-0.375,0.911l-3.938,3.938l 3.938,3.938q 0.375,0.375 0.375,0.911zM 57.938,21.067l-8.732-8.719q-0.496-0.496 -0.496-1.212t 0.496-1.212l 8.732-8.719q 0.496-0.496 1.212-0.496t 1.212,0.496l 1.004,1.004q 0.496,0.496 0.496,1.212t-0.496,1.212l-6.509,6.509l 6.509,6.496q 0.496,0.509 0.496,1.219t-0.496,1.205l-1.004,1.004q-0.496,0.496 -1.212,0.496t-1.212-0.496zM 110.719,11.143q0.00,0.696 -0.496,1.219l-8.732,8.719q-0.496,0.496 -1.205,0.496t-1.205-0.496l-1.018-1.004q-0.496-0.522 -0.496-1.219q0.00-0.71 0.496-1.205l 6.509-6.509l-6.509-6.496q-0.496-0.522 -0.496-1.219q0.00-0.71 0.496-1.205l 1.018-1.004q 0.482-0.509 1.205-0.509t 1.205,0.509l 8.732,8.719q 0.496,0.496 0.496,1.205z"></path></svg>
img/loader.gif ADDED
Binary file
js/jquery.swipebox.js CHANGED
@@ -1,42 +1,67 @@
1
- /*! Swipebox v1.2.7 | Constantin Saguin csag.co | MIT License | github.com/brutaldesign/swipebox */
2
 
3
  ;( function ( window, document, $, undefined ) {
4
 
5
  $.swipebox = function( elem, options ) {
6
 
7
  // Default options
8
- var defaults = {
9
- useCSS : true,
10
- initialIndexOnArray : 0,
11
- hideBarsDelay : 3000,
12
- videoMaxWidth : 1140,
13
- vimeoColor : 'CCCCCC',
14
- beforeOpen: null,
15
- afterClose: null
16
- },
17
-
18
- plugin = this,
19
- elements = [], // slides array [ { href:'...', title:'...' }, ...],
20
- selector = elem.selector,
21
- $selector = $( selector ),
22
- isMobile = navigator.userAgent.match( /(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i ),
23
- isTouch = isMobile !== null || document.createTouch !== undefined || ( 'ontouchstart' in window ) || ( 'onmsgesturechange' in window ) || navigator.msMaxTouchPoints,
24
- supportSVG = !! document.createElementNS && !! document.createElementNS( 'http://www.w3.org/2000/svg', "svg").createSVGRect,
25
- winWidth = window.innerWidth ? window.innerWidth : $( window ).width(),
26
- winHeight = window.innerHeight ? window.innerHeight : $( window ).height(),
27
- /* jshint multistr: true */
28
- html = '<div id="swipebox-overlay">\
29
- <div id="swipebox-slider"></div>\
30
- <div id="swipebox-caption"></div>\
31
- <div id="swipebox-action">\
32
- <a id="swipebox-close"></a>\
33
- <a id="swipebox-prev"></a>\
34
- <a id="swipebox-next"></a>\
35
- </div>\
36
- </div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  plugin.settings = {};
39
 
 
 
 
 
 
 
 
 
40
  plugin.init = function() {
41
 
42
  plugin.settings = $.extend( {}, defaults, options );
@@ -56,23 +81,28 @@
56
  if ( event.target.parentNode.className === 'slide current' ) {
57
 
58
  return false;
59
-
60
  }
61
-
62
  if ( ! $.isArray( elem ) ) {
63
  ui.destroy();
64
  $elem = $( selector );
65
  ui.actions();
66
  }
67
-
68
  elements = [];
69
  var index , relType, relVal;
70
 
 
71
  if ( ! relVal ) {
72
- relType = 'rel';
73
  relVal = $( this ).attr( relType );
74
  }
75
 
 
 
 
 
 
76
  if ( relVal && relVal !== '' && relVal !== 'nofollow' ) {
77
  $elem = $selector.filter( '[' + relType + '="' + relVal + '"]' );
78
  } else {
@@ -81,18 +111,18 @@
81
 
82
  $elem.each( function() {
83
 
84
- var title = null,
85
  href = null;
86
-
87
  if ( $( this ).attr( 'title' ) ) {
88
  title = $( this ).attr( 'title' );
89
  }
90
-
91
 
92
  if ( $( this ).attr( 'href' ) ) {
93
  href = $( this ).attr( 'href' );
94
  }
95
-
96
  elements.push( {
97
  href: href,
98
  title: title
@@ -108,25 +138,15 @@
108
  }
109
  };
110
 
111
- /**
112
- * Refresh method
113
- */
114
- plugin.refresh = function() {
115
- if ( ! $.isArray( elem ) ) {
116
- ui.destroy();
117
- $elem = $( selector );
118
- ui.actions();
119
- }
120
- };
121
-
122
- var ui = {
123
 
124
  /**
125
  * Initiate Swipebox
126
  */
127
  init : function( index ) {
128
- if ( plugin.settings.beforeOpen )
129
  plugin.settings.beforeOpen();
 
130
  this.target.trigger( 'swipebox-start' );
131
  $.swipebox.isOpen = true;
132
  this.build();
@@ -134,65 +154,48 @@
134
  this.openMedia( index );
135
  this.preloadMedia( index+1 );
136
  this.preloadMedia( index-1 );
 
 
 
137
  },
138
 
139
  /**
140
  * Built HTML containers and fire main functions
141
  */
142
  build : function () {
143
- var $this = this;
144
 
145
  $( 'body' ).append( html );
146
-
147
- if ( $this.doCssTrans() ) {
148
- $( '#swipebox-slider' ).css( {
149
- '-webkit-transition' : 'left 0.4s ease',
150
- '-moz-transition' : 'left 0.4s ease',
151
- '-o-transition' : 'left 0.4s ease',
152
- '-khtml-transition' : 'left 0.4s ease',
153
- 'transition' : 'left 0.4s ease'
154
- } );
155
- $( '#swipebox-overlay' ).css( {
156
- '-webkit-transition' : 'opacity 1s ease',
157
- '-moz-transition' : 'opacity 1s ease',
158
- '-o-transition' : 'opacity 1s ease',
159
- '-khtml-transition' : 'opacity 1s ease',
160
- 'transition' : 'opacity 1s ease'
161
- } );
162
- $( '#swipebox-action, #swipebox-caption' ).css( {
163
- '-webkit-transition' : '0.5s',
164
- '-moz-transition' : '0.5s',
165
- '-o-transition' : '0.5s',
166
- '-khtml-transition' : '0.5s',
167
- 'transition' : '0.5s'
168
- } );
169
- }
170
 
171
-
172
- if ( supportSVG ) {
173
- var bg = $( '#swipebox-action #swipebox-close' ).css( 'background-image' );
174
  bg = bg.replace( 'png', 'svg' );
175
- $( '#swipebox-action #swipebox-prev,#swipebox-action #swipebox-next,#swipebox-action #swipebox-close' ).css( {
176
  'background-image' : bg
177
  } );
178
  }
179
-
 
 
 
 
180
  $.each( elements, function() {
181
  $( '#swipebox-slider' ).append( '<div class="slide"></div>' );
182
  } );
183
 
184
  $this.setDim();
185
  $this.actions();
186
-
187
  if ( isTouch ) {
188
  $this.gesture();
189
- } else {
190
- $this.keyboard();
191
  }
192
-
 
 
 
193
  $this.animBars();
194
  $this.resize();
195
-
196
  },
197
 
198
  /**
@@ -201,11 +204,11 @@
201
  setDim : function () {
202
 
203
  var width, height, sliderCss = {};
204
-
205
  // Reset dimensions on mobile orientation change
206
- if ( "onorientationchange" in window ) {
207
 
208
- window.addEventListener( "orientationchange", function() {
209
  if ( window.orientation === 0 ) {
210
  width = winWidth;
211
  height = winHeight;
@@ -214,8 +217,8 @@
214
  height = winWidth;
215
  }
216
  }, false );
217
-
218
-
219
  } else {
220
 
221
  width = window.innerWidth ? window.innerWidth : $( window ).width();
@@ -236,7 +239,7 @@
236
  */
237
  resize : function () {
238
  var $this = this;
239
-
240
  $( window ).resize( function() {
241
  $this.setDim();
242
  } ).resize();
@@ -246,10 +249,11 @@
246
  * Check if device supports CSS transitions
247
  */
248
  supportTransition : function () {
249
-
250
- var prefixes = 'transition WebkitTransition MozTransition OTransition msTransition KhtmlTransition'.split( ' ' );
251
-
252
- for ( var i = 0; i < prefixes.length; i++ ) {
 
253
  if ( document.createElement( 'div' ).style[ prefixes[i] ] !== undefined ) {
254
  return prefixes[i];
255
  }
@@ -270,50 +274,151 @@
270
  * Touch navigation
271
  */
272
  gesture : function () {
273
-
274
  var $this = this,
275
- distance = null,
276
- swipMinDistance = 10,
277
- startCoords = {},
278
- endCoords = {};
279
- var bars = $( '#swipebox-caption, #swipebox-action' );
 
 
 
 
 
 
 
 
 
280
 
281
  bars.addClass( 'visible-bars' );
282
  $this.setTimeout();
283
 
284
  $( 'body' ).bind( 'touchstart', function( event ) {
285
 
286
- $(this).addClass( 'touching' );
287
-
288
  endCoords = event.originalEvent.targetTouches[0];
289
  startCoords.pageX = event.originalEvent.targetTouches[0].pageX;
 
 
 
 
 
 
290
 
291
  $( '.touching' ).bind( 'touchmove',function( event ) {
292
  event.preventDefault();
293
  event.stopPropagation();
294
  endCoords = event.originalEvent.targetTouches[0];
295
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  } );
297
-
298
  return false;
299
 
300
  } ).bind( 'touchend',function( event ) {
301
  event.preventDefault();
302
  event.stopPropagation();
303
-
304
- distance = endCoords.pageX - startCoords.pageX;
305
-
306
- if ( distance >= swipMinDistance ) {
307
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  // swipeLeft
309
- $this.getPrev();
310
-
311
- } else if ( distance <= - swipMinDistance ) {
312
-
313
  // swipeRight
314
- $this.getNext();
315
 
316
- } else {
 
 
 
317
  // tap
318
  if ( ! bars.hasClass( 'visible-bars' ) ) {
319
  $this.showBars();
@@ -322,13 +427,17 @@
322
  $this.clearTimeout();
323
  $this.hideBars();
324
  }
 
325
 
326
- }
 
 
 
327
 
 
328
  $( '.touching' ).off( 'touchmove' ).removeClass( 'touching' );
329
-
330
- } );
331
 
 
332
  },
333
 
334
  /**
@@ -339,18 +448,18 @@
339
  var $this = this;
340
  $this.clearTimeout();
341
  $this.timeout = window.setTimeout( function() {
342
- $this.hideBars();
343
  },
344
-
345
  plugin.settings.hideBarsDelay
346
  );
347
  }
348
  },
349
-
350
  /**
351
  * Clear timer
352
  */
353
- clearTimeout: function () {
354
  window.clearTimeout( this.timeout );
355
  this.timeout = null;
356
  },
@@ -359,12 +468,12 @@
359
  * Show navigation and title bars
360
  */
361
  showBars : function () {
362
- var bars = $( '#swipebox-caption, #swipebox-action' );
363
  if ( this.doCssTrans() ) {
364
  bars.addClass( 'visible-bars' );
365
  } else {
366
- $( '#swipebox-caption' ).animate( { top : 0 }, 500 );
367
- $( '#swipebox-action' ).animate( { bottom : 0 }, 500 );
368
  setTimeout( function() {
369
  bars.addClass( 'visible-bars' );
370
  }, 1000 );
@@ -375,12 +484,12 @@
375
  * Hide navigation and title bars
376
  */
377
  hideBars : function () {
378
- var bars = $( '#swipebox-caption, #swipebox-action' );
379
  if ( this.doCssTrans() ) {
380
  bars.removeClass( 'visible-bars' );
381
  } else {
382
- $( '#swipebox-caption' ).animate( { top : '-50px' }, 500 );
383
- $( '#swipebox-action' ).animate( { bottom : '-50px' }, 500 );
384
  setTimeout( function() {
385
  bars.removeClass( 'visible-bars' );
386
  }, 1000 );
@@ -391,12 +500,12 @@
391
  * Animate navigation and top bars
392
  */
393
  animBars : function () {
394
- var $this = this;
395
- var bars = $( '#swipebox-caption, #swipebox-action' );
396
-
397
  bars.addClass( 'visible-bars' );
398
  $this.setTimeout();
399
-
400
  $( '#swipebox-slider' ).click( function() {
401
  if ( ! bars.hasClass( 'visible-bars' ) ) {
402
  $this.showBars();
@@ -404,20 +513,18 @@
404
  }
405
  } );
406
 
407
- if ( ! isTouch ) {
408
-
409
- $( '#swipebox-action' ).hover( function() {
410
- $this.showBars();
411
- bars.addClass( 'visible-bars' );
412
- $this.clearTimeout();
413
-
414
- }, function() {
415
- bars.removeClass( 'visible-bars' );
416
- $this.setTimeout();
417
 
418
- } );
 
 
 
 
419
 
420
- }
421
  },
422
 
423
  /**
@@ -428,19 +535,18 @@
428
  $( window ).bind( 'keyup', function( event ) {
429
  event.preventDefault();
430
  event.stopPropagation();
431
-
432
  if ( event.keyCode === 37 ) {
433
-
434
  $this.getPrev();
435
-
436
  } else if ( event.keyCode === 39 ) {
437
-
438
  $this.getNext();
439
-
440
  } else if ( event.keyCode === 27 ) {
441
-
442
  $this.closeSlide();
443
-
444
  }
445
  } );
446
  },
@@ -449,14 +555,17 @@
449
  * Navigation events : go to next slide, go to prevous slide and close
450
  */
451
  actions : function () {
452
- var $this = this;
 
453
 
454
- var action = isTouch ? 'touchend' : 'click';
455
-
456
  if ( elements.length < 2 ) {
457
-
458
- $( '#swipebox-prev, #swipebox-next' ).hide();
459
-
 
 
 
 
460
  } else {
461
  $( '#swipebox-prev' ).bind( action, function( event ) {
462
  event.preventDefault();
@@ -464,7 +573,7 @@
464
  $this.getPrev();
465
  $this.setTimeout();
466
  } );
467
-
468
  $( '#swipebox-next' ).bind( action, function( event ) {
469
  event.preventDefault();
470
  event.stopPropagation();
@@ -477,21 +586,27 @@
477
  $this.closeSlide();
478
  } );
479
  },
480
-
481
  /**
482
  * Set current slide
483
  */
484
  setSlide : function ( index, isFirst ) {
 
485
  isFirst = isFirst || false;
486
-
487
  var slider = $( '#swipebox-slider' );
488
-
 
 
489
  if ( this.doCssTrans() ) {
490
- slider.css( { left : ( -index*100 )+'%' } );
 
 
 
491
  } else {
492
  slider.animate( { left : ( -index*100 )+'%' } );
493
  }
494
-
495
  $( '#swipebox-slider .slide' ).removeClass( 'current' );
496
  $( '#swipebox-slider .slide' ).eq( index ).addClass( 'current' );
497
  this.setTitle( index );
@@ -501,14 +616,14 @@
501
  }
502
 
503
  $( '#swipebox-prev, #swipebox-next' ).removeClass( 'disabled' );
504
-
505
  if ( index === 0 ) {
506
  $( '#swipebox-prev' ).addClass( 'disabled' );
507
- } else if ( index === elements.length - 1 ) {
508
  $( '#swipebox-next' ).addClass( 'disabled' );
509
  }
510
  },
511
-
512
  /**
513
  * Open slide
514
  */
@@ -516,20 +631,27 @@
516
  $( 'html' ).addClass( 'swipebox-html' );
517
  if ( isTouch ) {
518
  $( 'html' ).addClass( 'swipebox-touch' );
 
 
 
 
 
 
519
  }
520
  $( window ).trigger( 'resize' ); // fix scroll bar visibility on desktop
521
  this.setSlide( index, true );
522
  },
523
-
524
  /**
525
  * Set a time out if the media is a video
526
  */
527
  preloadMedia : function ( index ) {
528
- var $this = this,
529
- src = null;
530
 
531
- if ( elements[index] !== undefined )
532
- src = elements[index].href;
 
533
 
534
  if ( ! $this.isVideo( src ) ) {
535
  setTimeout( function() {
@@ -539,44 +661,54 @@
539
  $this.openMedia( index );
540
  }
541
  },
542
-
543
  /**
544
  * Open
545
  */
546
  openMedia : function ( index ) {
547
- var $this = this,
548
- src = null;
 
549
 
550
- if ( elements[index] !== undefined )
551
- src = elements[index].href;
 
552
 
553
- if (index < 0 || index >= elements.length) {
554
  return false;
555
  }
556
 
 
 
557
  if ( ! $this.isVideo( src ) ) {
 
558
  $this.loadMedia( src, function() {
559
- $( '#swipebox-slider .slide' ).eq( index ).html( this );
 
560
  } );
561
  } else {
562
- $( '#swipebox-slider .slide' ).eq( index ).html( $this.getVideo( src ) );
563
  }
564
-
565
  },
566
 
567
  /**
568
  * Set link title attribute as caption
569
  */
570
- setTitle : function ( index, isFirst ) {
571
  var title = null;
572
 
573
- $( '#swipebox-caption' ).empty();
 
 
 
 
574
 
575
- if ( elements[index] !== undefined )
576
- title = elements[index].title;
577
-
578
  if ( title ) {
579
- $( '#swipebox-caption' ).append( title );
 
 
 
580
  }
581
  },
582
 
@@ -586,85 +718,160 @@
586
  isVideo : function ( src ) {
587
 
588
  if ( src ) {
589
- if ( src.match( /youtube\.com\/watch\?v=([a-zA-Z0-9\-_]+)/) || src.match( /vimeo\.com\/([0-9]*)/ ) || src.match( /youtu\.be\/([a-zA-Z0-9\-_]+)/ ) ) {
590
  return true;
591
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
592
  }
593
-
 
 
 
 
 
 
 
 
594
  },
595
 
596
  /**
597
  * Get video iframe code from URL
598
  */
599
  getVideo : function( url ) {
600
- var iframe = '';
601
- var output = '';
602
- var youtubeUrl = url.match( /watch\?v=([a-zA-Z0-9\-_]+)/ );
603
- var youtubeShortUrl = url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/);
604
- var vimeoUrl = url.match( /vimeo\.com\/([0-9]*)/ );
605
  if ( youtubeUrl || youtubeShortUrl) {
606
  if ( youtubeShortUrl ) {
607
  youtubeUrl = youtubeShortUrl;
608
  }
609
- iframe = '<iframe width="560" height="315" src="//www.youtube.com/embed/' + youtubeUrl[1] + '" frameborder="0" allowfullscreen></iframe>';
610
-
 
 
 
 
611
  } else if ( vimeoUrl ) {
 
 
 
 
 
 
 
612
 
613
- iframe = '<iframe width="560" height="315" src="//player.vimeo.com/video/' + vimeoUrl[1] + '?byline=0&amp;portrait=0&amp;color='+plugin.settings.vimeoColor+'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
614
-
615
  }
616
 
617
- return '<div class="swipebox-video-container" style="max-width:' + plugin.settings.videomaxWidth + 'px"><div class="swipebox-video">'+iframe+'</div></div>';
618
  },
619
-
620
  /**
621
  * Load image
622
  */
623
  loadMedia : function ( src, callback ) {
624
- if ( ! this.isVideo( src ) ) {
625
- var img = $( '<img>' ).on( 'load', function() {
626
- callback.call( img );
627
- } );
628
-
629
- img.attr( 'src', src );
630
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
631
  },
632
-
633
  /**
634
  * Get next slide
635
  */
636
  getNext : function () {
637
- var $this = this;
638
- index = $( '#swipebox-slider .slide' ).index( $( '#swipebox-slider .slide.current' ) );
639
- if ( index+1 < elements.length ) {
 
 
 
 
640
  index++;
641
  $this.setSlide( index );
642
  $this.preloadMedia( index+1 );
643
-
644
  } else {
645
-
646
- $( '#swipebox-slider' ).addClass( 'rightSpring' );
647
- setTimeout( function() {
648
- $( '#swipebox-slider' ).removeClass( 'rightSpring' );
649
- }, 500 );
 
 
 
 
 
 
 
 
 
650
  }
651
  },
652
-
653
  /**
654
  * Get previous slide
655
  */
656
  getPrev : function () {
657
- index = $( '#swipebox-slider .slide' ).index( $( '#swipebox-slider .slide.current' ) );
 
658
  if ( index > 0 ) {
 
 
659
  index--;
660
  this.setSlide( index );
661
  this.preloadMedia( index-1 );
662
- }
663
- else {
664
-
665
- $( '#swipebox-slider' ).addClass( 'leftSpring' );
666
  setTimeout( function() {
667
- $( '#swipebox-slider' ).removeClass( 'leftSpring' );
668
  }, 500 );
669
  }
670
  },
@@ -689,19 +896,24 @@
689
  $( 'body' ).unbind( 'touchend' );
690
  $( '#swipebox-slider' ).unbind();
691
  $( '#swipebox-overlay' ).remove();
692
- if ( ! $.isArray( elem ) )
 
693
  elem.removeData( '_swipebox' );
694
- if ( this.target )
 
 
695
  this.target.trigger( 'swipebox-destroy' );
 
 
696
  $.swipebox.isOpen = false;
697
- if ( plugin.settings.afterClose )
 
698
  plugin.settings.afterClose();
 
699
  }
700
-
701
  };
702
 
703
  plugin.init();
704
-
705
  };
706
 
707
  $.fn.swipebox = function( options ) {
@@ -711,7 +923,7 @@
711
  this.data( '_swipebox', swipebox );
712
  }
713
  return this.data( '_swipebox' );
714
-
715
  };
716
 
717
- }( window, document, jQuery ) );
1
+ /*! Swipebox v1.3.0.2 | Constantin Saguin csag.co | MIT License | github.com/brutaldesign/swipebox */
2
 
3
  ;( function ( window, document, $, undefined ) {
4
 
5
  $.swipebox = function( elem, options ) {
6
 
7
  // Default options
8
+ var ui,
9
+ defaults = {
10
+ useCSS : true,
11
+ useSVG : true,
12
+ initialIndexOnArray : 0,
13
+ removeBarsOnMobile : true,
14
+ hideCloseButtonOnMobile : false,
15
+ hideBarsDelay : 3000,
16
+ videoMaxWidth : 1140,
17
+ vimeoColor : 'cccccc',
18
+ beforeOpen: null,
19
+ afterOpen: null,
20
+ afterClose: null,
21
+ loopAtEnd: false,
22
+ autoplayVideos: false,
23
+ queryStringData: {},
24
+ toggleClassOnLoad: ''
25
+ },
26
+
27
+ plugin = this,
28
+ elements = [], // slides array [ { href:'...', title:'...' }, ...],
29
+ $elem,
30
+ selector = elem.selector,
31
+ $selector = $( selector ),
32
+ isMobile = navigator.userAgent.match( /(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i ),
33
+ isTouch = isMobile !== null || document.createTouch !== undefined || ( 'ontouchstart' in window ) || ( 'onmsgesturechange' in window ) || navigator.msMaxTouchPoints,
34
+ supportSVG = !! document.createElementNS && !! document.createElementNS( 'http://www.w3.org/2000/svg', 'svg').createSVGRect,
35
+ winWidth = window.innerWidth ? window.innerWidth : $( window ).width(),
36
+ winHeight = window.innerHeight ? window.innerHeight : $( window ).height(),
37
+ currentX = 0,
38
+ /* jshint multistr: true */
39
+ html = '<div id="swipebox-overlay">\
40
+ <div id="swipebox-container">\
41
+ <div id="swipebox-slider"></div>\
42
+ <div id="swipebox-top-bar">\
43
+ <div id="swipebox-title"></div>\
44
+ </div>\
45
+ <div id="swipebox-bottom-bar">\
46
+ <div id="swipebox-arrows">\
47
+ <a id="swipebox-prev"></a>\
48
+ <a id="swipebox-next"></a>\
49
+ </div>\
50
+ </div>\
51
+ <a id="swipebox-close"></a>\
52
+ </div>\
53
+ </div>';
54
 
55
  plugin.settings = {};
56
 
57
+ $.swipebox.close = function () {
58
+ ui.closeSlide();
59
+ };
60
+
61
+ $.swipebox.extend = function () {
62
+ return ui;
63
+ };
64
+
65
  plugin.init = function() {
66
 
67
  plugin.settings = $.extend( {}, defaults, options );
81
  if ( event.target.parentNode.className === 'slide current' ) {
82
 
83
  return false;
 
84
  }
85
+
86
  if ( ! $.isArray( elem ) ) {
87
  ui.destroy();
88
  $elem = $( selector );
89
  ui.actions();
90
  }
91
+
92
  elements = [];
93
  var index , relType, relVal;
94
 
95
+ // Allow for HTML5 compliant attribute before legacy use of rel
96
  if ( ! relVal ) {
97
+ relType = 'data-rel';
98
  relVal = $( this ).attr( relType );
99
  }
100
 
101
+ if ( ! relVal ) {
102
+ relType = 'rel';
103
+ relVal = $( this ).attr( relType );
104
+ }
105
+
106
  if ( relVal && relVal !== '' && relVal !== 'nofollow' ) {
107
  $elem = $selector.filter( '[' + relType + '="' + relVal + '"]' );
108
  } else {
111
 
112
  $elem.each( function() {
113
 
114
+ var title = null,
115
  href = null;
116
+
117
  if ( $( this ).attr( 'title' ) ) {
118
  title = $( this ).attr( 'title' );
119
  }
120
+
121
 
122
  if ( $( this ).attr( 'href' ) ) {
123
  href = $( this ).attr( 'href' );
124
  }
125
+
126
  elements.push( {
127
  href: href,
128
  title: title
138
  }
139
  };
140
 
141
+ ui = {
 
 
 
 
 
 
 
 
 
 
 
142
 
143
  /**
144
  * Initiate Swipebox
145
  */
146
  init : function( index ) {
147
+ if ( plugin.settings.beforeOpen ) {
148
  plugin.settings.beforeOpen();
149
+ }
150
  this.target.trigger( 'swipebox-start' );
151
  $.swipebox.isOpen = true;
152
  this.build();
154
  this.openMedia( index );
155
  this.preloadMedia( index+1 );
156
  this.preloadMedia( index-1 );
157
+ if ( plugin.settings.afterOpen ) {
158
+ plugin.settings.afterOpen();
159
+ }
160
  },
161
 
162
  /**
163
  * Built HTML containers and fire main functions
164
  */
165
  build : function () {
166
+ var $this = this, bg;
167
 
168
  $( 'body' ).append( html );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
 
170
+ if ( supportSVG && plugin.settings.useSVG === true ) {
171
+ bg = $( '#swipebox-close' ).css( 'background-image' );
 
172
  bg = bg.replace( 'png', 'svg' );
173
+ $( '#swipebox-prev, #swipebox-next, #swipebox-close' ).css( {
174
  'background-image' : bg
175
  } );
176
  }
177
+
178
+ if ( isMobile && plugin.settings.removeBarsOnMobile ) {
179
+ $( '#swipebox-bottom-bar, #swipebox-top-bar' ).remove();
180
+ }
181
+
182
  $.each( elements, function() {
183
  $( '#swipebox-slider' ).append( '<div class="slide"></div>' );
184
  } );
185
 
186
  $this.setDim();
187
  $this.actions();
188
+
189
  if ( isTouch ) {
190
  $this.gesture();
 
 
191
  }
192
+
193
+ // Devices can have both touch and keyboard input so always allow key events
194
+ $this.keyboard();
195
+
196
  $this.animBars();
197
  $this.resize();
198
+
199
  },
200
 
201
  /**
204
  setDim : function () {
205
 
206
  var width, height, sliderCss = {};
207
+
208
  // Reset dimensions on mobile orientation change
209
+ if ( 'onorientationchange' in window ) {
210
 
211
+ window.addEventListener( 'orientationchange', function() {
212
  if ( window.orientation === 0 ) {
213
  width = winWidth;
214
  height = winHeight;
217
  height = winWidth;
218
  }
219
  }, false );
220
+
221
+
222
  } else {
223
 
224
  width = window.innerWidth ? window.innerWidth : $( window ).width();
239
  */
240
  resize : function () {
241
  var $this = this;
242
+
243
  $( window ).resize( function() {
244
  $this.setDim();
245
  } ).resize();
249
  * Check if device supports CSS transitions
250
  */
251
  supportTransition : function () {
252
+
253
+ var prefixes = 'transition WebkitTransition MozTransition OTransition msTransition KhtmlTransition'.split( ' ' ),
254
+ i;
255
+
256
+ for ( i = 0; i < prefixes.length; i++ ) {
257
  if ( document.createElement( 'div' ).style[ prefixes[i] ] !== undefined ) {
258
  return prefixes[i];
259
  }
274
  * Touch navigation
275
  */
276
  gesture : function () {
277
+
278
  var $this = this,
279
+ index,
280
+ hDistance,
281
+ vDistance,
282
+ hDistanceLast,
283
+ vDistanceLast,
284
+ hDistancePercent,
285
+ vSwipe = false,
286
+ hSwipe = false,
287
+ hSwipMinDistance = 10,
288
+ vSwipMinDistance = 50,
289
+ startCoords = {},
290
+ endCoords = {},
291
+ bars = $( '#swipebox-top-bar, #swipebox-bottom-bar' ),
292
+ slider = $( '#swipebox-slider' );
293
 
294
  bars.addClass( 'visible-bars' );
295
  $this.setTimeout();
296
 
297
  $( 'body' ).bind( 'touchstart', function( event ) {
298
 
299
+ $( this ).addClass( 'touching' );
300
+ index = $( '#swipebox-slider .slide' ).index( $( '#swipebox-slider .slide.current' ) );
301
  endCoords = event.originalEvent.targetTouches[0];
302
  startCoords.pageX = event.originalEvent.targetTouches[0].pageX;
303
+ startCoords.pageY = event.originalEvent.targetTouches[0].pageY;
304
+
305
+ $( '#swipebox-slider' ).css( {
306
+ '-webkit-transform' : 'translate3d(' + currentX +'%, 0, 0)',
307
+ 'transform' : 'translate3d(' + currentX + '%, 0, 0)'
308
+ } );
309
 
310
  $( '.touching' ).bind( 'touchmove',function( event ) {
311
  event.preventDefault();
312
  event.stopPropagation();
313
  endCoords = event.originalEvent.targetTouches[0];
314
 
315
+ if ( ! hSwipe ) {
316
+ vDistanceLast = vDistance;
317
+ vDistance = endCoords.pageY - startCoords.pageY;
318
+ if ( Math.abs( vDistance ) >= vSwipMinDistance || vSwipe ) {
319
+ var opacity = 0.75 - Math.abs(vDistance) / slider.height();
320
+
321
+ slider.css( { 'top': vDistance + 'px' } );
322
+ slider.css( { 'opacity': opacity } );
323
+
324
+ vSwipe = true;
325
+ }
326
+ }
327
+
328
+ hDistanceLast = hDistance;
329
+ hDistance = endCoords.pageX - startCoords.pageX;
330
+ hDistancePercent = hDistance * 100 / winWidth;
331
+
332
+ if ( ! hSwipe && ! vSwipe && Math.abs( hDistance ) >= hSwipMinDistance ) {
333
+ $( '#swipebox-slider' ).css( {
334
+ '-webkit-transition' : '',
335
+ 'transition' : ''
336
+ } );
337
+ hSwipe = true;
338
+ }
339
+
340
+ if ( hSwipe ) {
341
+
342
+ // swipe left
343
+ if ( 0 < hDistance ) {
344
+
345
+ // first slide
346
+ if ( 0 === index ) {
347
+ // console.log( 'first' );
348
+ $( '#swipebox-overlay' ).addClass( 'leftSpringTouch' );
349
+ } else {
350
+ // Follow gesture
351
+ $( '#swipebox-overlay' ).removeClass( 'leftSpringTouch' ).removeClass( 'rightSpringTouch' );
352
+ $( '#swipebox-slider' ).css( {
353
+ '-webkit-transform' : 'translate3d(' + ( currentX + hDistancePercent ) +'%, 0, 0)',
354
+ 'transform' : 'translate3d(' + ( currentX + hDistancePercent ) + '%, 0, 0)'
355
+ } );
356
+ }
357
+
358
+ // swipe rught
359
+ } else if ( 0 > hDistance ) {
360
+
361
+ // last Slide
362
+ if ( elements.length === index +1 ) {
363
+ // console.log( 'last' );
364
+ $( '#swipebox-overlay' ).addClass( 'rightSpringTouch' );
365
+ } else {
366
+ $( '#swipebox-overlay' ).removeClass( 'leftSpringTouch' ).removeClass( 'rightSpringTouch' );
367
+ $( '#swipebox-slider' ).css( {
368
+ '-webkit-transform' : 'translate3d(' + ( currentX + hDistancePercent ) +'%, 0, 0)',
369
+ 'transform' : 'translate3d(' + ( currentX + hDistancePercent ) + '%, 0, 0)'
370
+ } );
371
+ }
372
+
373
+ }
374
+ }
375
  } );
376
+
377
  return false;
378
 
379
  } ).bind( 'touchend',function( event ) {
380
  event.preventDefault();
381
  event.stopPropagation();
382
+
383
+ $( '#swipebox-slider' ).css( {
384
+ '-webkit-transition' : '-webkit-transform 0.4s ease',
385
+ 'transition' : 'transform 0.4s ease'
386
+ } );
387
+
388
+ vDistance = endCoords.pageY - startCoords.pageY;
389
+ hDistance = endCoords.pageX - startCoords.pageX;
390
+ hDistancePercent = hDistance*100/winWidth;
391
+
392
+ // Swipe to bottom to close
393
+ if ( vSwipe ) {
394
+ vSwipe = false;
395
+ if ( Math.abs( vDistance ) >= 2 * vSwipMinDistance && Math.abs( vDistance ) > Math.abs( vDistanceLast ) ) {
396
+ var vOffset = vDistance > 0 ? slider.height() : - slider.height();
397
+ slider.animate( { top: vOffset + 'px', 'opacity': 0 },
398
+ 300,
399
+ function () {
400
+ $this.closeSlide();
401
+ } );
402
+ } else {
403
+ slider.animate( { top: 0, 'opacity': 1 }, 300 );
404
+ }
405
+
406
+ } else if ( hSwipe ) {
407
+
408
+ hSwipe = false;
409
+
410
  // swipeLeft
411
+ if( hDistance >= hSwipMinDistance && hDistance >= hDistanceLast) {
412
+
413
+ $this.getPrev();
414
+
415
  // swipeRight
416
+ } else if ( hDistance <= -hSwipMinDistance && hDistance <= hDistanceLast) {
417
 
418
+ $this.getNext();
419
+ }
420
+
421
+ } else { // Top and bottom bars have been removed on touchable devices
422
  // tap
423
  if ( ! bars.hasClass( 'visible-bars' ) ) {
424
  $this.showBars();
427
  $this.clearTimeout();
428
  $this.hideBars();
429
  }
430
+ }
431
 
432
+ $( '#swipebox-slider' ).css( {
433
+ '-webkit-transform' : 'translate3d(' + currentX + '%, 0, 0)',
434
+ 'transform' : 'translate3d(' + currentX + '%, 0, 0)'
435
+ } );
436
 
437
+ $( '#swipebox-overlay' ).removeClass( 'leftSpringTouch' ).removeClass( 'rightSpringTouch' );
438
  $( '.touching' ).off( 'touchmove' ).removeClass( 'touching' );
 
 
439
 
440
+ } );
441
  },
442
 
443
  /**
448
  var $this = this;
449
  $this.clearTimeout();
450
  $this.timeout = window.setTimeout( function() {
451
+ $this.hideBars();
452
  },
453
+
454
  plugin.settings.hideBarsDelay
455
  );
456
  }
457
  },
458
+
459
  /**
460
  * Clear timer
461
  */
462
+ clearTimeout: function () {
463
  window.clearTimeout( this.timeout );
464
  this.timeout = null;
465
  },
468
  * Show navigation and title bars
469
  */
470
  showBars : function () {
471
+ var bars = $( '#swipebox-top-bar, #swipebox-bottom-bar' );
472
  if ( this.doCssTrans() ) {
473
  bars.addClass( 'visible-bars' );
474
  } else {
475
+ $( '#swipebox-top-bar' ).animate( { top : 0 }, 500 );
476
+ $( '#swipebox-bottom-bar' ).animate( { bottom : 0 }, 500 );
477
  setTimeout( function() {
478
  bars.addClass( 'visible-bars' );
479
  }, 1000 );
484
  * Hide navigation and title bars
485
  */
486
  hideBars : function () {
487
+ var bars = $( '#swipebox-top-bar, #swipebox-bottom-bar' );
488
  if ( this.doCssTrans() ) {
489
  bars.removeClass( 'visible-bars' );
490
  } else {
491
+ $( '#swipebox-top-bar' ).animate( { top : '-50px' }, 500 );
492
+ $( '#swipebox-bottom-bar' ).animate( { bottom : '-50px' }, 500 );
493
  setTimeout( function() {
494
  bars.removeClass( 'visible-bars' );
495
  }, 1000 );
500
  * Animate navigation and top bars
501
  */
502
  animBars : function () {
503
+ var $this = this,
504
+ bars = $( '#swipebox-top-bar, #swipebox-bottom-bar' );
505
+
506
  bars.addClass( 'visible-bars' );
507
  $this.setTimeout();
508
+
509
  $( '#swipebox-slider' ).click( function() {
510
  if ( ! bars.hasClass( 'visible-bars' ) ) {
511
  $this.showBars();
513
  }
514
  } );
515
 
516
+ $( '#swipebox-bottom-bar' ).hover( function() {
517
+ $this.showBars();
518
+ bars.addClass( 'visible-bars' );
519
+ $this.clearTimeout();
 
 
 
 
 
 
520
 
521
+ }, function() {
522
+ if ( plugin.settings.hideBarsDelay > 0 ) {
523
+ bars.removeClass( 'visible-bars' );
524
+ $this.setTimeout();
525
+ }
526
 
527
+ } );
528
  },
529
 
530
  /**
535
  $( window ).bind( 'keyup', function( event ) {
536
  event.preventDefault();
537
  event.stopPropagation();
538
+
539
  if ( event.keyCode === 37 ) {
540
+
541
  $this.getPrev();
542
+
543
  } else if ( event.keyCode === 39 ) {
544
+
545
  $this.getNext();
546
+
547
  } else if ( event.keyCode === 27 ) {
548
+
549
  $this.closeSlide();
 
550
  }
551
  } );
552
  },
555
  * Navigation events : go to next slide, go to prevous slide and close
556
  */
557
  actions : function () {
558
+ var $this = this,
559
+ action = 'touchend click'; // Just detect for both event types to allow for multi-input
560
 
 
 
561
  if ( elements.length < 2 ) {
562
+
563
+ $( '#swipebox-bottom-bar' ).hide();
564
+
565
+ if ( undefined === elements[ 1 ] ) {
566
+ $( '#swipebox-top-bar' ).hide();
567
+ }
568
+
569
  } else {
570
  $( '#swipebox-prev' ).bind( action, function( event ) {
571
  event.preventDefault();
573
  $this.getPrev();
574
  $this.setTimeout();
575
  } );
576
+
577
  $( '#swipebox-next' ).bind( action, function( event ) {
578
  event.preventDefault();
579
  event.stopPropagation();
586
  $this.closeSlide();
587
  } );
588
  },
589
+
590
  /**
591
  * Set current slide
592
  */
593
  setSlide : function ( index, isFirst ) {
594
+
595
  isFirst = isFirst || false;
596
+
597
  var slider = $( '#swipebox-slider' );
598
+
599
+ currentX = -index*100;
600
+
601
  if ( this.doCssTrans() ) {
602
+ slider.css( {
603
+ '-webkit-transform' : 'translate3d(' + (-index*100)+'%, 0, 0)',
604
+ 'transform' : 'translate3d(' + (-index*100)+'%, 0, 0)'
605
+ } );
606
  } else {
607
  slider.animate( { left : ( -index*100 )+'%' } );
608
  }
609
+
610
  $( '#swipebox-slider .slide' ).removeClass( 'current' );
611
  $( '#swipebox-slider .slide' ).eq( index ).addClass( 'current' );
612
  this.setTitle( index );
616
  }
617
 
618
  $( '#swipebox-prev, #swipebox-next' ).removeClass( 'disabled' );
619
+
620
  if ( index === 0 ) {
621
  $( '#swipebox-prev' ).addClass( 'disabled' );
622
+ } else if ( index === elements.length - 1 && plugin.settings.loopAtEnd !== true ) {
623
  $( '#swipebox-next' ).addClass( 'disabled' );
624
  }
625
  },
626
+
627
  /**
628
  * Open slide
629
  */
631
  $( 'html' ).addClass( 'swipebox-html' );
632
  if ( isTouch ) {
633
  $( 'html' ).addClass( 'swipebox-touch' );
634
+
635
+ if ( plugin.settings.hideCloseButtonOnMobile ) {
636
+ $( 'html' ).addClass( 'swipebox-no-close-button' );
637
+ }
638
+ } else {
639
+ $( 'html' ).addClass( 'swipebox-no-touch' );
640
  }
641
  $( window ).trigger( 'resize' ); // fix scroll bar visibility on desktop
642
  this.setSlide( index, true );
643
  },
644
+
645
  /**
646
  * Set a time out if the media is a video
647
  */
648
  preloadMedia : function ( index ) {
649
+ var $this = this,
650
+ src = null;
651
 
652
+ if ( elements[ index ] !== undefined ) {
653
+ src = elements[ index ].href;
654
+ }
655
 
656
  if ( ! $this.isVideo( src ) ) {
657
  setTimeout( function() {
661
  $this.openMedia( index );
662
  }
663
  },
664
+
665
  /**
666
  * Open
667
  */
668
  openMedia : function ( index ) {
669
+ var $this = this,
670
+ src,
671
+ slide;
672
 
673
+ if ( elements[ index ] !== undefined ) {
674
+ src = elements[ index ].href;
675
+ }
676
 
677
+ if ( index < 0 || index >= elements.length ) {
678
  return false;
679
  }
680
 
681
+ slide = $( '#swipebox-slider .slide' ).eq( index );
682
+
683
  if ( ! $this.isVideo( src ) ) {
684
+ slide.addClass( 'slide-loading' );
685
  $this.loadMedia( src, function() {
686
+ slide.removeClass( 'slide-loading' );
687
+ slide.html( this );
688
  } );
689
  } else {
690
+ slide.html( $this.getVideo( src ) );
691
  }
692
+
693
  },
694
 
695
  /**
696
  * Set link title attribute as caption
697
  */
698
+ setTitle : function ( index ) {
699
  var title = null;
700
 
701
+ $( '#swipebox-title' ).empty();
702
+
703
+ if ( elements[ index ] !== undefined ) {
704
+ title = elements[ index ].title;
705
+ }
706
 
 
 
 
707
  if ( title ) {
708
+ $( '#swipebox-top-bar' ).show();
709
+ $( '#swipebox-title' ).append( title );
710
+ } else {
711
+ $( '#swipebox-top-bar' ).hide();
712
  }
713
  },
714
 
718
  isVideo : function ( src ) {
719
 
720
  if ( src ) {
721
+ if ( src.match( /(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || src.match( /vimeo\.com\/([0-9]*)/ ) || src.match( /youtu\.be\/([a-zA-Z0-9\-_]+)/ ) ) {
722
  return true;
723
  }
724
+
725
+ if ( src.toLowerCase().indexOf( 'swipeboxvideo=1' ) >= 0 ) {
726
+
727
+ return true;
728
+ }
729
+ }
730
+
731
+ },
732
+
733
+ /**
734
+ * Parse URI querystring and:
735
+ * - overrides value provided via dictionary
736
+ * - rebuild it again returning a string
737
+ */
738
+ parseUri : function (uri, customData) {
739
+ var a = document.createElement('a'),
740
+ qs = {};
741
+
742
+ // Decode the URI
743
+ a.href = decodeURIComponent( uri );
744
+
745
+ // QueryString to Object
746
+ qs = JSON.parse( '{"' + a.search.toLowerCase().replace('?','').replace(/&/g,'","').replace(/=/g,'":"') + '"}' );
747
+
748
+ // Extend with custom data
749
+ if ( $.isPlainObject( customData ) ) {
750
+ qs = $.extend( qs, customData, plugin.settings.queryStringData ); // The dev has always the final word
751
  }
752
+
753
+ // Return querystring as a string
754
+ return $
755
+ .map( qs, function (val, key) {
756
+ if ( val && val > '' ) {
757
+ return encodeURIComponent( key ) + '=' + encodeURIComponent( val );
758
+ }
759
+ })
760
+ .join('&');
761
  },
762
 
763
  /**
764
  * Get video iframe code from URL
765
  */
766
  getVideo : function( url ) {
767
+ var iframe = '',
768
+ youtubeUrl = url.match( /((?:www\.)?youtube\.com|(?:www\.)?youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/ ),
769
+ youtubeShortUrl = url.match(/(?:www\.)?youtu\.be\/([a-zA-Z0-9\-_]+)/),
770
+ vimeoUrl = url.match( /(?:www\.)?vimeo\.com\/([0-9]*)/ ),
771
+ qs = '';
772
  if ( youtubeUrl || youtubeShortUrl) {
773
  if ( youtubeShortUrl ) {
774
  youtubeUrl = youtubeShortUrl;
775
  }
776
+ qs = ui.parseUri( url, {
777
+ 'autoplay' : ( plugin.settings.autoplayVideos ? '1' : '0' ),
778
+ 'v' : ''
779
+ });
780
+ iframe = '<iframe width="560" height="315" src="//' + youtubeUrl[1] + '/embed/' + youtubeUrl[2] + '?' + qs + '" frameborder="0" allowfullscreen></iframe>';
781
+
782
  } else if ( vimeoUrl ) {
783
+ qs = ui.parseUri( url, {
784
+ 'autoplay' : ( plugin.settings.autoplayVideos ? '1' : '0' ),
785
+ 'byline' : '0',
786
+ 'portrait' : '0',
787
+ 'color': plugin.settings.vimeoColor
788
+ });
789
+ iframe = '<iframe width="560" height="315" src="//player.vimeo.com/video/' + vimeoUrl[1] + '?' + qs + '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
790
 
791
+ } else {
792
+ iframe = '<iframe width="560" height="315" src="' + url + '" frameborder="0" allowfullscreen></iframe>';
793
  }
794
 
795
+ return '<div class="swipebox-video-container" style="max-width:' + plugin.settings.videoMaxWidth + 'px"><div class="swipebox-video">' + iframe + '</div></div>';
796
  },
797
+
798
  /**
799
  * Load image
800
  */
801
  loadMedia : function ( src, callback ) {
802
+ // Inline content
803
+ if ( src.trim().indexOf('#') === 0 ) {
804
+ callback.call(
805
+ $('<div>', {
806
+ 'class' : 'swipebox-inline-container'
807
+ })
808
+ .append(
809
+ $(src)
810
+ .clone()
811
+ .toggleClass( plugin.settings.toggleClassOnLoad )
812
+ )
813
+ );
814
+ }
815
+ // Everything else
816
+ else {
817
+ if ( ! this.isVideo( src ) ) {
818
+ var img = $( '<img>' ).on( 'load', function() {
819
+ callback.call( img );
820
+ } );
821
+
822
+ img.attr( 'src', src );
823
+ }
824
+ }
825
  },
826
+
827
  /**
828
  * Get next slide
829
  */
830
  getNext : function () {
831
+ var $this = this,
832
+ src,
833
+ index = $( '#swipebox-slider .slide' ).index( $( '#swipebox-slider .slide.current' ) );
834
+ if ( index + 1 < elements.length ) {
835
+
836
+ src = $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src' );
837
+ $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src', src );
838
  index++;
839
  $this.setSlide( index );
840
  $this.preloadMedia( index+1 );
 
841
  } else {
842
+
843
+ if ( plugin.settings.loopAtEnd === true ) {
844
+ src = $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src' );
845
+ $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src', src );
846
+ index = 0;
847
+ $this.preloadMedia( index );
848
+ $this.setSlide( index );
849
+ $this.preloadMedia( index + 1 );
850
+ } else {
851
+ $( '#swipebox-overlay' ).addClass( 'rightSpring' );
852
+ setTimeout( function() {
853
+ $( '#swipebox-overlay' ).removeClass( 'rightSpring' );
854
+ }, 500 );
855
+ }
856
  }
857
  },
858
+
859
  /**
860
  * Get previous slide
861
  */
862
  getPrev : function () {
863
+ var index = $( '#swipebox-slider .slide' ).index( $( '#swipebox-slider .slide.current' ) ),
864
+ src;
865
  if ( index > 0 ) {
866
+ src = $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe').attr( 'src' );
867
+ $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src', src );
868
  index--;
869
  this.setSlide( index );
870
  this.preloadMedia( index-1 );
871
+ } else {
872
+ $( '#swipebox-overlay' ).addClass( 'leftSpring' );
 
 
873
  setTimeout( function() {
874
+ $( '#swipebox-overlay' ).removeClass( 'leftSpring' );
875
  }, 500 );
876
  }
877
  },
896
  $( 'body' ).unbind( 'touchend' );
897
  $( '#swipebox-slider' ).unbind();
898
  $( '#swipebox-overlay' ).remove();
899
+
900
+ if ( ! $.isArray( elem ) ) {
901
  elem.removeData( '_swipebox' );
902
+ }
903
+
904
+ if ( this.target ) {
905
  this.target.trigger( 'swipebox-destroy' );
906
+ }
907
+
908
  $.swipebox.isOpen = false;
909
+
910
+ if ( plugin.settings.afterClose ) {
911
  plugin.settings.afterClose();
912
+ }
913
  }
 
914
  };
915
 
916
  plugin.init();
 
917
  };
918
 
919
  $.fn.swipebox = function( options ) {
923
  this.data( '_swipebox', swipebox );
924
  }
925
  return this.data( '_swipebox' );
926
+
927
  };
928
 
929
+ }( window, document, jQuery ) );
library/autenticazione.php CHANGED
@@ -1,4 +1,4 @@
1
- <p style="font-size:14px;">Thank you for you choise! <strong>Enjoy Instagram - Responsive gallery</strong> is a plugin lovingly developed for you by <a href="http://www.mediabeta.com" target="_blank"> Mediabeta</a>.</p>
2
 
3
  <p style="font-size:14px;">By using this plugin, you are agreeing to the <a href="http://instagram.com/about/legal/terms/api/" target="_blank">Instagram API Terms of Use</a>.</p>
4
 
@@ -80,77 +80,14 @@ display:inline-block;
80
 
81
  </style>
82
 
83
- <dl class="enjoy_accordion">
84
- <h3>Follow these 2 simple steps to configure the plugin and... enjoy it!</h3>
85
- <dt><a href=""><span class="step_number">01</span> Create an Instagram Application </a></dt>
86
- <dd><ol>
87
- <li>Once you're logged in with your Instagram account go to <a href="http://instagram.com/developer/" target="_blank" rel="nofollow">http://instagram.com/developer/</a></li>
88
- <li>Enter the data related to your site and the information required by Instagram. Accept API Terms of Use and Brand Guidelines</li>
89
- <li>Click "Register Your Application" button.</li>
90
- <li>Click "Register a New Client".</li>
91
- <li>
92
- Once you've verified your account fill the form with:
93
-
94
- <ul>
95
- <li><br /><strong>Application Name</strong>: Your App Name (Your WebSite for example)</li>
96
- <li><strong>Description</strong>: Your App Description</li>
97
- <li><span><strong>Website URL</strong> (copy it exactly as shown below) :</span>
98
- <br /><font style="font-size:12px; color:#0074A2; font-weight:bold;"><?php echo get_home_url(); ?></font></li>
99
-
100
- <li><strong>OAuth redirect_uri</strong> (copy it exactly as shown below) : <br /><font style="font-size:12px; color:#0074A2; font-weight:bold;"><?php echo admin_url('options-general.php?page=enjoyinstagram_plugin_options&tab=enjoyinstagram_general_settings'); ?></font><br /></li>
101
- </ul>
102
- </li>
103
- <li><b>Click the "Register" button. Copy Client ID and Client Secret values for the next step.</b></li>
104
- </ol></dd>
105
-
106
-
107
-
108
-
109
- <dt><a href=""> <span class="step_number">02</span> Enter Your Client ID and Client Secret</a></dt>
110
- <dd>
111
-
112
-
113
-
114
 
115
  <form method="post" action="options.php">
116
- <?php settings_fields('enjoyinstagram_options_group_auth'); ?>
117
-
118
-
119
-
120
- <div style="margin-top: 20px;
121
- padding: 20px;
122
- border: 1px solid #DDDDDD;"
123
- >
124
- Insert your <u>Client ID</u> and your <u>Client Secret</u>
125
- <p>
126
 
127
- <label class="enjoy_label" for="enjoyinstagram_client_id"><strong>Client ID:</strong></label>
128
- <input type="text" id="enjoyinstagram_client_id" value="<?php echo get_option('enjoyinstagram_client_id'); ?>" name="enjoyinstagram_client_id" />
129
- <span class="description">
130
- Your Client ID </span></p>
131
- <p>
132
- <label class="enjoy_label" for="enjoyinstagram_client_secret"><strong>Client Secret:</strong></label>
133
- <input type="text" id="enjoyinstagram_client_secret" value="<?php echo get_option('enjoyinstagram_client_secret'); ?>" name="enjoyinstagram_client_secret" />
134
- <span class="description">
135
- Your Client Secret </span>
136
- </p>
137
- </div>
138
- <p>
139
- By clicking this button this plugin will be activated!</p><p>
140
- <input type="button" class="button-primary" id="button_autorizza_instagram" name="button_autorizza_instagram" value="Authorize Application" />
141
- </p>
142
-
143
- </form>
144
-
145
-
146
-
147
- </dd>
148
-
149
 
150
-
151
-
152
- </dl>
153
-
154
-
155
 
156
 
1
+ <p style="font-size:14px;">Thank you for you choice! <strong>Enjoy Plugin for Instagram - Responsive gallery</strong> is a plugin lovingly developed for you by <a href="http://www.mediabeta.com" target="_blank"> Mediabeta</a>.</p>
2
 
3
  <p style="font-size:14px;">By using this plugin, you are agreeing to the <a href="http://instagram.com/about/legal/terms/api/" target="_blank">Instagram API Terms of Use</a>.</p>
4
 
80
 
81
  </style>
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
  <form method="post" action="options.php">
85
+ <?php settings_fields('enjoyinstagram_options_group_auth'); ?>
 
 
 
 
 
 
 
 
 
86
 
87
+ <p>
88
+ <input type="button" class="button-primary" id="button_autorizza_instagram" name="button_autorizza_instagram" value="Connect your Account" />
89
+ </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
+ </form>
 
 
 
 
92
 
93
 
library/enjoyinstagram_shortcode.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
  // Add Shortcode
3
- function enjoyinstagram_mb_shortcode($atts) {
 
4
  STATIC $i = 1;
5
 
6
 
@@ -44,21 +45,37 @@ jQuery("#owl-<?php echo $i; ?>").owlCarousel({
44
  });
45
  </script>
46
  <?php
47
- $instagram = new Enjoy_Instagram(get_option('enjoyinstagram_client_id'));
48
- $instagram->setAccessToken(get_option('enjoyinstagram_access_token'));
49
  if(get_option('enjoyinstagram_user_or_hashtag')=='hashtag'){
50
- $result = $instagram->getTagMedia(get_option('enjoyinstagram_hashtag'));
 
51
  }else{
52
- $result = $instagram->getUserMedia(get_option('enjoyinstagram_user_id'));
 
53
  }
54
  $pre_shortcode_content = "<div id=\"owl-".$i."\" class=\"owl-example\" style=\"display:none;\">";
55
 
56
- foreach ($result->data as $entry) {
57
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  if(get_option('enjoyinstagram_carousel_items_number')!='1'){
59
- $shortcode_content .= "<div class=\"box\"><a title=\"{$entry->caption->text}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry->images->standard_resolution->url}\"><img src=\"{$entry->images->standard_resolution->url}\"></a></div>";
60
  }else{
61
- $shortcode_content .= "<div class=\"box\"><a title=\"{$entry->caption->text}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry->images->standard_resolution->url}\"><img style=\"width:100%;\" src=\"{$entry->images->standard_resolution->url}\"></a></div>";
62
  }
63
  }
64
 
1
  <?php
2
  // Add Shortcode
3
+ function enjoyinstagram_mb_shortcode($atts) {
4
+ $shortcode_content = '';
5
  STATIC $i = 1;
6
 
7
 
45
  });
46
  </script>
47
  <?php
48
+
 
49
  if(get_option('enjoyinstagram_user_or_hashtag')=='hashtag'){
50
+ $result = get_hash(urlencode(get_option('enjoyinstagram_hashtag')),20);
51
+ $result = $result['data'];
52
  }else{
53
+ $result = get_user(urlencode(get_option('enjoyinstagram_user_username')),20);
54
+ $result = $result['data'];
55
  }
56
  $pre_shortcode_content = "<div id=\"owl-".$i."\" class=\"owl-example\" style=\"display:none;\">";
57
 
58
+
59
+ if (isHttps()) {
60
+ foreach ($result as $entry) {
61
+ $entry['images']['thumbnail']['url'] = str_replace('http://', 'https://', $entry['images']['thumbnail']['url']);
62
+ $entry['images']['standard_resolution']['url'] = str_replace('http://', 'https://', $entry['images']['standard_resolution']['url']);
63
+ }
64
+ }
65
+
66
+
67
+
68
+
69
+ foreach ($result as $entry) {
70
+ if(!empty($entry['caption'])) {
71
+ $caption = $entry['caption']['text'];
72
+ }else{
73
+ $caption = '';
74
+ }
75
  if(get_option('enjoyinstagram_carousel_items_number')!='1'){
76
+ $shortcode_content .= "<div class=\"box\"><a title=\"{$caption}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry['images']['standard_resolution']['url']}\"><img src=\"{$entry['images']['standard_resolution']['url']}\"></a></div>";
77
  }else{
78
+ $shortcode_content .= "<div class=\"box\"><a title=\"{$caption}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry['images']['standard_resolution']['url']}\"><img style=\"width:100%;\" src=\"{$entry['images']['standard_resolution']['url']}\"></a></div>";
79
  }
80
  }
81
 
library/enjoyinstagram_shortcode_grid.php CHANGED
@@ -1,23 +1,40 @@
1
  <?php
2
  // Add Shortcode
3
- function enjoyinstagram_mb_shortcode_grid() {
 
4
  STATIC $i = 1;
5
  if(get_option('enjoyinstagram_client_id') || get_option('enjoyinstagram_client_id') != '') {
6
 
7
- $instagram = new Enjoy_Instagram(get_option('enjoyinstagram_client_id'));
8
- $instagram->setAccessToken(get_option('enjoyinstagram_access_token'));
9
  if(get_option('enjoyinstagram_user_or_hashtag')=='hashtag'){
10
- $result = $instagram->getTagMedia(get_option('enjoyinstagram_hashtag'));
 
11
  }else{
12
- $result = $instagram->getUserMedia(get_option('enjoyinstagram_user_id'));
 
13
  }
14
 
15
  $pre_shortcode_content = "<div id=\"grid-".$i."\" class=\"ri-grid ri-grid-size-2 ri-shadow\" style=\"display:none;\"><ul>";
16
 
17
-
18
- foreach ($result->data as $entry) {
19
-
20
- $shortcode_content .= "<li><a title=\"{$entry->caption->text}\" class=\"swipebox_grid\" href=\"{$entry->images->standard_resolution->url}\"><img src=\"{$entry->images->standard_resolution->url}\"></a></li>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  }
23
 
@@ -31,38 +48,39 @@ $post_shortcode_content = "</ul></div>";
31
 
32
  jQuery(function() {
33
  jQuery('#grid-<?php echo $i; ?>').gridrotator({
34
- rows : 1,
35
- columns : 2,
36
  animType : 'fadeInOut',
37
  onhover : false,
 
38
  preventClick : false,
39
  w1400 : {
40
- rows : 1,
41
- columns : 2
42
  },
43
- w1024 : {
44
- rows : 1,
45
- columns : 2
46
  },
47
 
48
  w768 : {
49
- rows : 1,
50
- columns : 1
51
  },
52
 
53
  w480 : {
54
- rows : 1,
55
- columns : 1
56
  },
57
 
58
  w320 : {
59
- rows : 1,
60
- columns : 1
61
  },
62
 
63
  w240 : {
64
- rows : 1,
65
- columns : 3
66
  }
67
  });
68
 
1
  <?php
2
  // Add Shortcode
3
+ function enjoyinstagram_mb_shortcode_grid() {
4
+ $shortcode_content = '';
5
  STATIC $i = 1;
6
  if(get_option('enjoyinstagram_client_id') || get_option('enjoyinstagram_client_id') != '') {
7
 
8
+
 
9
  if(get_option('enjoyinstagram_user_or_hashtag')=='hashtag'){
10
+ $result = get_hash(urlencode(get_option('enjoyinstagram_hashtag')),20);
11
+ $result = $result['data'];
12
  }else{
13
+ $result = get_user(urlencode(get_option('enjoyinstagram_user_username')),20);
14
+ $result = $result['data'];
15
  }
16
 
17
  $pre_shortcode_content = "<div id=\"grid-".$i."\" class=\"ri-grid ri-grid-size-2 ri-shadow\" style=\"display:none;\"><ul>";
18
 
19
+
20
+
21
+ if (isHttps()) {
22
+ foreach ($result as $entry) {
23
+ $entry['images']['thumbnail']['url'] = str_replace('http://', 'https://', $entry['images']['thumbnail']['url']);
24
+ $entry['images']['standard_resolution']['url'] = str_replace('http://', 'https://', $entry['images']['standard_resolution']['url']);
25
+ }
26
+ }
27
+
28
+
29
+
30
+
31
+ foreach ($result as $entry) {
32
+ if(!empty($entry['caption'])) {
33
+ $caption = $entry['caption']['text'];
34
+ }else{
35
+ $caption = '';
36
+ }
37
+ $shortcode_content .= "<li><a title=\"{$caption}\" class=\"swipebox_grid\" href=\"{$entry['images']['standard_resolution']['url']}\"><img src=\"{$entry['images']['standard_resolution']['url']}\"></a></li>";
38
 
39
  }
40
 
48
 
49
  jQuery(function() {
50
  jQuery('#grid-<?php echo $i; ?>').gridrotator({
51
+ rows : <?php echo get_option('enjoyinstagram_grid_rows'); ?>,
52
+ columns : <?php echo get_option('enjoyinstagram_grid_cols'); ?>,
53
  animType : 'fadeInOut',
54
  onhover : false,
55
+ interval : 7000,
56
  preventClick : false,
57
  w1400 : {
58
+ rows : <?php echo get_option('enjoyinstagram_grid_rows'); ?>,
59
+ columns : <?php echo get_option('enjoyinstagram_grid_cols'); ?>
60
  },
61
+ w1024 : {
62
+ rows : <?php echo get_option('enjoyinstagram_grid_rows'); ?>,
63
+ columns : <?php echo get_option('enjoyinstagram_grid_cols'); ?>
64
  },
65
 
66
  w768 : {
67
+ rows : <?php echo get_option('enjoyinstagram_grid_rows'); ?>,
68
+ columns : <?php echo get_option('enjoyinstagram_grid_cols'); ?>
69
  },
70
 
71
  w480 : {
72
+ rows : <?php echo get_option('enjoyinstagram_grid_rows'); ?>,
73
+ columns : <?php echo get_option('enjoyinstagram_grid_cols'); ?>
74
  },
75
 
76
  w320 : {
77
+ rows : <?php echo get_option('enjoyinstagram_grid_rows'); ?>,
78
+ columns : <?php echo get_option('enjoyinstagram_grid_cols'); ?>
79
  },
80
 
81
  w240 : {
82
+ rows : <?php echo get_option('enjoyinstagram_grid_rows'); ?>,
83
+ columns : <?php echo get_option('enjoyinstagram_grid_cols'); ?>
84
  }
85
  });
86
 
library/enjoyinstagram_shortcode_grid_widget.php CHANGED
@@ -8,24 +8,49 @@ if(get_option('enjoyinstagram_client_id') || get_option('enjoyinstagram_client_i
8
  'n_r' => '2',
9
  'u_or_h' => 'user'
10
  ), $atts ) );
11
- $instagram = new Enjoy_Instagram(get_option('enjoyinstagram_client_id'));
12
- $instagram->setAccessToken(get_option('enjoyinstagram_access_token'));
13
  if("{$u_or_h}"=='hashtag'){
14
- $result = $instagram->getTagMedia(get_option('enjoyinstagram_hashtag'));
 
15
  }else{
16
- $result = $instagram->getUserMedia(get_option('enjoyinstagram_user_id'));
 
17
  }
18
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  <div id="rigrid-<?php echo "{$id}"; ?>" class="ri-grid ri-grid-size-2 ri-shadow" style="display:none">
20
  <ul>
21
  <?php
22
 
23
- foreach ($result->data as $entry) {
24
-
25
- echo "<li><a title=\"{$entry->caption->text}\" class=\"swipebox_grid\" href=\"{$entry->images->standard_resolution->url}\"><img src=\"{$entry->images->standard_resolution->url}\"></a></li>";
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  }
28
-
29
  ?>
30
  </ul></div>
31
 
@@ -39,6 +64,7 @@ foreach ($result->data as $entry) {
39
  columns : <?php echo "{$n_c}"; ?>,
40
  animType : 'fadeInOut',
41
  onhover : false,
 
42
  preventClick : false,
43
  w1024 : {
44
  rows : <?php echo "{$n_r}"; ?>,
8
  'n_r' => '2',
9
  'u_or_h' => 'user'
10
  ), $atts ) );
11
+
 
12
  if("{$u_or_h}"=='hashtag'){
13
+ $result = get_hash(urlencode(get_option('enjoyinstagram_hashtag')),20);
14
+ $result = $result['data'];
15
  }else{
16
+ $result = get_user(urlencode(get_option('enjoyinstagram_user_username')),20);
17
+ $result = $result['data'];
18
  }
19
  ?>
20
+
21
+ <?php
22
+
23
+ if (isHttps()) {
24
+ foreach ($result as $entry) {
25
+ $entry['images']['thumbnail']['url'] = str_replace('http://', 'https://', $entry->images->thumbnail->url);
26
+ $entry['images']['standard_resolution']['url'] = str_replace('http://', 'https://', $entry['images']['standard_resolution']['url']);
27
+ }
28
+ }
29
+
30
+ ?>
31
+
32
+
33
  <div id="rigrid-<?php echo "{$id}"; ?>" class="ri-grid ri-grid-size-2 ri-shadow" style="display:none">
34
  <ul>
35
  <?php
36
 
37
+ if($result){
38
+ foreach ($result as $entry) {
39
+ if(!empty($entry['caption'])) {
40
+ $caption = $entry['caption']['text'];
41
+ }else{
42
+ $caption = '';
43
+ }
44
+ if(!empty($entry['images'])) {
45
+ $image = $entry['images']['standard_resolution']['url'];
46
+ }else{
47
+ $image = '';
48
+ }
49
+
50
+ echo "<li><a title=\"{$caption}\" class=\"swipebox_grid\" href=\"{$image}\"><img src=\"{$image}\"></a></li>";
51
 
52
  }
53
+ }
54
  ?>
55
  </ul></div>
56
 
64
  columns : <?php echo "{$n_c}"; ?>,
65
  animType : 'fadeInOut',
66
  onhover : false,
67
+ interval : 7000,
68
  preventClick : false,
69
  w1024 : {
70
  rows : <?php echo "{$n_r}"; ?>,
library/enjoyinstagram_shortcode_widget.php CHANGED
@@ -1,65 +1,80 @@
1
  <?php
2
  // Add Shortcode
3
- function enjoyinstagram_mb_shortcode_widget($atts) {
4
- if(get_option('enjoyinstagram_client_id') || get_option('enjoyinstagram_client_id') != '') {
5
- extract( shortcode_atts( array(
6
- 'n' => '4',
7
- 'id' => 'owl',
8
- 'n_y_n' =>'false',
9
- 'u_or_h' => 'user'
10
- ), $atts ) );
11
- ?>
12
- <script>
13
- jQuery(function(){
14
- jQuery(document.body)
15
- .on('click touchend','#swipebox-slider .current img', function(e){
16
- jQuery('#swipebox-next').click();
17
- return false;
18
- })
19
- .on('click touchend','#swipebox-slider .current', function(e){
20
- jQuery('#swipebox-close').trigger('click');
21
- });
22
- });
23
- </script>
24
- <script type="text/javascript">
25
- jQuery(function($) {
26
- $(".swipebox").swipebox({
27
- hideBarsDelay : 0
28
- });
29
-
30
- });
31
- jQuery(document).ready(function() {
32
- jQuery("#owl-<?php echo "{$id}"; ?>").owlCarousel({
33
- items : <?php echo "{$n}"; ?>,
34
- navigation: <?php echo "{$n_y_n}"; ?>,
35
- });
36
- jQuery("#owl-<?php echo "{$id}"; ?>").fadeIn('slow');
37
- });
38
- </script>
39
- <?php
40
- $instagram = new Enjoy_Instagram(get_option('enjoyinstagram_client_id'));
41
- $instagram->setAccessToken(get_option('enjoyinstagram_access_token'));
42
- if("{$u_or_h}"=='hashtag'){
43
- $result = $instagram->getTagMedia(get_option('enjoyinstagram_hashtag'));
44
- }else{
45
- $result = $instagram->getUserMedia(get_option('enjoyinstagram_user_id'));
46
- }
47
- ?>
48
- <div id="owl-<?php echo "{$id}"; ?>" class="owl-example">
49
- <?php
50
- foreach ($result->data as $entry) {
51
-
52
- if(get_option('enjoyinstagram_carousel_items_number')!='1'){
53
- echo "<div class=\"box\"><a title=\"{$entry->caption->text}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry->images->standard_resolution->url}\"><img src=\"{$entry->images->thumbnail->url}\"></a></div>";
54
- }else{
55
- echo "<div class=\"box\"><a title=\"{$entry->caption->text}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry->images->standard_resolution->url}\"><img style=\"width:100%;\" src=\"{$entry->images->standard_resolution->url}\"></a></div>";
56
- }
57
- }
58
- ?>
59
- </div>
60
- <?php
61
 
62
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
64
  add_shortcode( 'enjoyinstagram_mb_widget', 'enjoyinstagram_mb_shortcode_widget' );
65
 
1
  <?php
2
  // Add Shortcode
3
+ function enjoyinstagram_mb_shortcode_widget($atts) {
4
+ if(get_option('enjoyinstagram_client_id') || get_option('enjoyinstagram_client_id') != '') {
5
+ extract(shortcode_atts(array(
6
+ 'n' => '4',
7
+ 'id' => 'owl',
8
+ 'n_y_n' => 'false',
9
+ 'u_or_h' => 'user'
10
+ ), $atts));
11
+ ?>
12
+ <script>
13
+ jQuery(function () {
14
+ jQuery(document.body)
15
+ .on('click touchend', '#swipebox-slider .current img', function (e) {
16
+ jQuery('#swipebox-next').click();
17
+ return false;
18
+ })
19
+ .on('click touchend', '#swipebox-slider .current', function (e) {
20
+ jQuery('#swipebox-close').trigger('click');
21
+ });
22
+ });
23
+ </script>
24
+ <script type="text/javascript">
25
+ jQuery(function ($) {
26
+ $(".swipebox").swipebox({
27
+ hideBarsDelay: 0
28
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
+ });
31
+ jQuery(document).ready(function () {
32
+ jQuery("#owl-<?php echo "{$id}"; ?>").owlCarousel({
33
+ items: <?php echo "{$n}"; ?>,
34
+ navigation: <?php echo "{$n_y_n}"; ?>,
35
+ });
36
+ jQuery("#owl-<?php echo "{$id}"; ?>").fadeIn('slow');
37
+ });
38
+ </script>
39
+ <?php
40
+ if ("{$u_or_h}" == 'hashtag') {
41
+ $result = get_hash(urlencode(get_option('enjoyinstagram_hashtag')),20);
42
+ $result = $result['data'];
43
+ } else {
44
+ $result = get_user(urlencode(get_option('enjoyinstagram_user_username')),20);
45
+ $result = $result['data'];
46
+ }
47
+
48
+
49
+ if (isHttps()){
50
+ foreach ($result as $entry) {
51
+ $entry['images']['thumbnail']['url'] = str_replace('http://', 'https://', $entry['images']['thumbnail']['url']);
52
+ $entry['images']['standard_resolution']['url'] = str_replace('http://', 'https://', $entry['images']['standard_resolution']['url']);
53
+ }
54
+ }
55
+
56
+ ?>
57
+ <div id="owl-<?php echo "{$id}"; ?>" class="owl-example">
58
+ <?php
59
+ if($result){
60
+ foreach ($result as $entry) {
61
+ if(!empty($entry['caption'])) {
62
+ $caption = $entry['caption']['text'];
63
+ }else{
64
+ $caption = '';
65
+ }
66
+ if(get_option('enjoyinstagram_carousel_items_number')!='1'){
67
+ echo "<div class=\"box\"><a title=\"{$caption}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry['images']['standard_resolution']['url']}\"><img src=\"{$entry['images']['thumbnail']['url']}\"></a></div>";
68
+ }else{
69
+ echo "<div class=\"box\"><a title=\"{$caption}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry['images']['standard_resolution']['url']}\"><img style=\"width:100%;\" src=\"{$entry['images']['standard_resolution']['url']}\"></a></div>";
70
+ }
71
+ }
72
+ }
73
+ ?>
74
+ </div>
75
+ <?php
76
+
77
+ }
78
  }
79
  add_shortcode( 'enjoyinstagram_mb_widget', 'enjoyinstagram_mb_shortcode_widget' );
80
 
library/impostazioni_shortcode.php CHANGED
@@ -1,4 +1,4 @@
1
- <form method="post" action="options.php">
2
  <?php settings_fields('enjoyinstagram_options_carousel_group'); ?>
3
  <?php echo realpath(home_url()); ?>
4
 
@@ -8,7 +8,11 @@
8
  jQuery(document).ready(function($){
9
  $("input[name$='enjoyinstagram_user_or_hashtag']").click(function() {
10
  var test = $(this).val();
11
-
 
 
 
 
12
  $("div.desc").hide();
13
  $("#enjoyinstagram_user_or_hashtag_" + test).show();
14
  });});
@@ -36,7 +40,7 @@ jQuery(document).ready(function($){
36
  </div>
37
 
38
  <div id="enjoyinstagram_user_or_hashtag_hashtag" class="desc" <?php if (get_option('enjoyinstagram_user_or_hashtag')!='hashtag') echo 'style="display:none;"';?>>
39
- #<input type="text" id="enjoyinstagram_hashtag" value="<?php echo get_option('enjoyinstagram_hashtag'); ?>" name="enjoyinstagram_hashtag" />
40
  <span class="description">insert a hashtag without '#'</span>
41
 
42
  </div>
@@ -151,4 +155,15 @@ jQuery(document).ready(function($){
151
  <hr/>
152
  <p><strong>Free version</strong>: Only 20 images allowed.</p>
153
  <input type="submit" class="button-primary" id="button_enjoyinstagram_advanced" name="button_enjoyinstagram_advanced" value="Save Settings"/>
154
- </form>
 
 
 
 
 
 
 
 
 
 
 
1
+ <form method="post" action="options.php" novalidate>
2
  <?php settings_fields('enjoyinstagram_options_carousel_group'); ?>
3
  <?php echo realpath(home_url()); ?>
4
 
8
  jQuery(document).ready(function($){
9
  $("input[name$='enjoyinstagram_user_or_hashtag']").click(function() {
10
  var test = $(this).val();
11
+ if(test=='user'){
12
+ $('#enjoyinstagram_hashtag').attr('disabled',true);
13
+ }else if(test=='hashtag'){
14
+ $('#enjoyinstagram_hashtag').attr('disabled',false);
15
+ }
16
  $("div.desc").hide();
17
  $("#enjoyinstagram_user_or_hashtag_" + test).show();
18
  });});
40
  </div>
41
 
42
  <div id="enjoyinstagram_user_or_hashtag_hashtag" class="desc" <?php if (get_option('enjoyinstagram_user_or_hashtag')!='hashtag') echo 'style="display:none;"';?>>
43
+ #<input type="text" id="enjoyinstagram_hashtag" required value="<?php echo get_option('enjoyinstagram_hashtag'); ?>" name="enjoyinstagram_hashtag" />
44
  <span class="description">insert a hashtag without '#'</span>
45
 
46
  </div>
155
  <hr/>
156
  <p><strong>Free version</strong>: Only 20 images allowed.</p>
157
  <input type="submit" class="button-primary" id="button_enjoyinstagram_advanced" name="button_enjoyinstagram_advanced" value="Save Settings"/>
158
+ </form>
159
+ <div class="wrap" style="
160
+ float: left;
161
+ width: 95%;
162
+ background: rgba(79, 173, 26, 0.45);
163
+ padding: 20px;
164
+ margin-top: 20px;
165
+ border: 2px solid green;">
166
+ <h3>Shortocodes to use:</h3>
167
+ <b>[enjoyinstagram_mb]</b> -> Carousel View <br />
168
+ <b>[enjoyinstagram_mb_grid]</b> -> Grid View
169
+ </div>
library/instagram.class.php CHANGED
@@ -264,8 +264,8 @@ class Enjoy_Instagram {
264
  * @param integer [optional] $limit Limit of returned results
265
  * @return mixed
266
  */
267
- public function getTagMedia($name, $limit = 0) {
268
- return $this->_makeCall('tags/' . $name . '/media/recent', false, array('count' => $limit));
269
  }
270
 
271
  /**
264
  * @param integer [optional] $limit Limit of returned results
265
  * @return mixed
266
  */
267
+ public function getTagMedia($name, $params = array()) {
268
+ return $this->_makeCall('tags/' . $name . '/media/recent', false, $params);
269
  }
270
 
271
  /**
library/profile_auth.php CHANGED
@@ -15,4 +15,16 @@
15
 
16
  <hr />
17
  </div>
18
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  <hr />
17
  </div>
18
+
19
+ </p>
20
+ <div class="wrap" style="
21
+ float: left;
22
+ width: 95%;
23
+ background: rgba(79, 173, 26, 0.45);
24
+ padding: 20px;
25
+ margin-top: 20px;
26
+ border: 2px solid green;">
27
+ <h3>Shortocodes to use:</h3>
28
+ <b>[enjoyinstagram_mb]</b> -> Carousel View <br />
29
+ <b>[enjoyinstagram_mb_grid]</b> -> Grid View
30
+ </div>
readme.txt CHANGED
@@ -1,35 +1,110 @@
1
- === Enjoy Instagram ===
2
  Contributors: (mediabeta, frafra85, fabiodipa)
3
- Donate link: http://www.mediabeta.com/enjoy-instagram/
4
- Tags: instagram, instagram images, instagram gallery, photos, widgets, gallery, instagram responsive, instagram touch
5
  Requires at least: 3.0.1
6
- Tested up to: 3.8
7
- Stable tag: 1.01
 
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Display in your site awesome carousels or images sliders of Instagram photos by user or hashtag.
12
 
13
  == Description ==
14
 
15
- Display in your site awesome carousels or images sliders of Instagram photos by user or hashtag. You can easily use Enjoy Instagram in your pages, posts, sidebars with shortcodes or widgets.
16
-
17
- Each photo can be shown in “Lightbox” mode. Everything is responsive and optimized for mobile devices.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  == Installation ==
20
 
 
 
21
  1. After you have installed and activated the plugin , go to Settings - > Enjoy Instagram and follow the instructions on the screen.
22
  2. To add shortcode to editor click on the Enjoy Instagram icon and choose where include a Carousel View or a Grid View.
23
  3. Configure the display of your shortcodes from the plugin settings page
24
  4. To add to the Sidebar Enjoy Instagram go to Appearance - > Widgets and configure to your liking widgets Enjoy Instagram
25
 
 
26
  == Frequently Asked Questions ==
27
 
28
- = My profile disappeared. What’s happened? =
 
 
 
 
 
29
 
 
 
30
  Repeat Step 01 and Step 02 again.
31
 
32
 
 
 
 
 
 
 
 
 
 
 
33
  == Screenshots ==
34
 
35
  1. Enjoy Instagram settings page
@@ -47,6 +122,44 @@ Repeat Step 01 and Step 02 again.
47
  * Initial Version
48
  = 1.01 =
49
  * Bux Fix
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
  == Upgrade Notice ==
52
 
@@ -54,3 +167,41 @@ Repeat Step 01 and Step 02 again.
54
  * Initial Version
55
  = 1.01 =
56
  * Bux Fix
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Enjoy Plugin for Instagram ===
2
  Contributors: (mediabeta, frafra85, fabiodipa)
3
+ Donate link: https://www.google.com/url?q=https%3A%2F%2Fwww.paypal.com%2Fcgi-bin%2Fwebscr%3Fcmd%3D_s-xclick%26hosted_button_id%3D8MXZ37DWHAX46&sa=D&sntz=1&usg=AFQjCNFHixLdowdc2AAEXDYmM9tQBl-TXQ
4
+ Tags: Instagram plugin, Instagram, Instagram gallery, Instagram images, Lightbox Instagram,Grid Instagram view, Instagram responsive, Instagram touch, Instagram photos,Instagram posts, Instagram page, Instagram widgets
5
  Requires at least: 3.0.1
6
+ Tested up to: 4.5
7
+ Version: 2.1.3
8
+ Stable tag: 2.1.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
+ Instagram on your website with shortcodes and widgets! Images of Instagram profiles and hashtags on posts, pages, sidebars with Carousel and Grid view
13
 
14
  == Description ==
15
 
16
+
17
+ = “Important: "Instagram has changed its API. You need to install the latest version of our plugin and then, necessarily, you'll have to disconnect and then reconnect your Instagram account (from the "settings" page) in order to keep your Enjoy Plugin Instagram functioning after the 1st of June ". =
18
+
19
+ —————
20
+
21
+ = Show Instagram Photos in your website! =
22
+
23
+ Publish easily Instagram photos in your pages, posts, sidebars thanks to simple shortcodes and widgets.
24
+
25
+ Each photo can be shown in Carousel and Grid mode with Lightbox effect.
26
+ Everything is responsive and optimized for mobile devices.
27
+
28
+ = Here is Live Demo: = http://www.mediabeta.com/enjoy-instagram/
29
+
30
+ = Basic Features =
31
+
32
+ * Show pictures of Instagram profiles and/or Hashtags
33
+ * Grid View
34
+ * Fade In Effect for Grid View
35
+ * Number of columns and rows customizable
36
+ * Carousel View
37
+ * Number of pictures to see in same time customizable
38
+ * Navigations buttons (yes/no)
39
+ * Shortcodes button in the editor
40
+ * Widgets for sidebars
41
+ * Touch
42
+ * Completely responsive and Optimized Mobile Devices
43
+
44
+ = Very Simple Installation and Configuration =
45
+ * http://www.mediabetaprojects.com/enjoy-instagram-premium/install-enjoy-instagram-wordpress-plugin/
46
+
47
+ = PREMIUM VERSION =
48
+
49
+ = The first and alone wordpress plugin = that gives you the chance to choose which Instagram photos display in your website.
50
+
51
+ In the premium configuration you will have a useful and amazing Moderation Panel!
52
+
53
+ = See LIVE PREVIEW: = http://www.mediabetaprojects.com/enjoy-instagram-premium/
54
+
55
+ * NEW Polaroid View to overlay images as polaroid pictures
56
+ * NEW Album View to show your pictures organized for username and or hashtags
57
+ * NEW Badge View that will help you link to and promote your Instagram web profile
58
+ * Autoreload Stream of Photos
59
+ * Moderation Panel: In real time you can moderate new photos and decide to approve and to publish or to rejected (Watch how it works:
60
+ [youtube https://www.youtube.com/watch?v=W6gNqlghbLE]
61
+ * Autoplay
62
+ * Loop
63
+ * Possibility to choose what link on the photo: Lightbox, Instagram, Custom URL or nothing.
64
+ * Custom CSS: edit CSS, set border, margin, background and much more
65
+ * Custom Transition Effect
66
+ * Custom JS: set time to autoplay and speed, set name of prev and next buttons and much more.
67
+ * Possibility to choose if show photo’s author, caption and likes number.
68
+
69
+ and many others features..
70
+
71
+ = LIVE PREMIUM VERSION DEMO: =
72
+ http://www.mediabetaprojects.com/enjoy-instagram-premium/
73
 
74
  == Installation ==
75
 
76
+ Installation and Configuration are very simple :
77
+
78
  1. After you have installed and activated the plugin , go to Settings - > Enjoy Instagram and follow the instructions on the screen.
79
  2. To add shortcode to editor click on the Enjoy Instagram icon and choose where include a Carousel View or a Grid View.
80
  3. Configure the display of your shortcodes from the plugin settings page
81
  4. To add to the Sidebar Enjoy Instagram go to Appearance - > Widgets and configure to your liking widgets Enjoy Instagram
82
 
83
+
84
  == Frequently Asked Questions ==
85
 
86
+ = “Important: "Instagram has changed its API. You need to install the latest version of our plugin and then, necessarily, you'll have to disconnect and then reconnect your Instagram account (from the "settings" page) in order to keep your Enjoy Plugin Instagram functioning after the 1st of June ". =
87
+
88
+ —————
89
+
90
+ = How to Install Enjoy Instagram WordPress Plugin =
91
+ http://www.mediabetaprojects.com/enjoy-instagram-premium/install-enjoy-instagram-wordpress-plugin/
92
 
93
+
94
+ = My profile disappeared. What’s happened? =
95
  Repeat Step 01 and Step 02 again.
96
 
97
 
98
+ = Where can i find ShortCodes ? =
99
+ The shortcodes are automatically generated by clicking the “Enjoy Instagram Button” that you can see on text editor of posts and pages.
100
+ If you do not see the button of shortcodes, ​you can use these ​shortcode​s​ to:
101
+
102
+ [enjoyinstagram_mb] -> Carousel View
103
+ [enjoyinstagram_mb_grid] -> Grid View
104
+
105
+ In the Setting section yon can customize grid and/or Carousle view
106
+
107
+
108
  == Screenshots ==
109
 
110
  1. Enjoy Instagram settings page
122
  * Initial Version
123
  = 1.01 =
124
  * Bux Fix
125
+ = 1.1 =
126
+ * Bux Fix
127
+ = 1.2 =
128
+ * Bux Fix
129
+ = 1.3 =
130
+ * Bux Fix
131
+ = 1.4 =
132
+ * Fix warning for empty hashtag value
133
+ = 1.5 =
134
+ * Fix shortcode use and setting saving
135
+ = 1.5.1 =
136
+ * Bugs Fix
137
+ = 1.5.2 =
138
+ * Bug for utf8 4-byte (mobile emoticon) Fixed
139
+ = 1.5.3 =
140
+ * Support for swedish specific characters.
141
+ = 1.6 =
142
+ * Add support for https protocol
143
+ = 1.6.1 =
144
+ * Fix hashtag mode
145
+ = 1.6.2 =
146
+ * Bug Fix
147
+ = 1.6.3 =
148
+ * Bug Fix
149
+ = 1.6.4 =
150
+ * Bug Fix
151
+ = 1.6.5 =
152
+ * Bug Fix
153
+ = 2.0 =
154
+ * Small Bug Fixed
155
+ = 2.1 =
156
+ * Small Bug Fixed
157
+ = 2.1.1 =
158
+ * Hashtag mode fixed
159
+ = 2.1.2 =
160
+ * Banner Removed
161
+ = 2.1.3 =
162
+ * Add Shortcakes Info
163
 
164
  == Upgrade Notice ==
165
 
167
  * Initial Version
168
  = 1.01 =
169
  * Bux Fix
170
+ = 1.1 =
171
+ * Bux Fix
172
+ = 1.2 =
173
+ * Bux Fix
174
+ = 1.3 =
175
+ * Bux Fix
176
+ = 1.4 =
177
+ * Fix warning for empty hashtag value
178
+ = 1.5 =
179
+ * Fix shortcode use and setting saving
180
+ = 1.5.1 =
181
+ * Bugs Fix
182
+ = 1.5.2 =
183
+ * Bug for utf8 4-byte (mobile emoticon) Fixed
184
+ = 1.5.3 =
185
+ * Support for swedish specific characters.
186
+ = 1.6 =
187
+ * Add support for https protocol
188
+ = 1.6.1 =
189
+ * Fix hashtag mode
190
+ = 1.6.2 =
191
+ * Bug Fix
192
+ = 1.6.3 =
193
+ * Bug Fix
194
+ = 1.6.4 =
195
+ * Bug Fix
196
+ = 1.6.5 =
197
+ * Bug Fix
198
+ = 2.0 =
199
+ * Small Bug Fixed
200
+ = 2.1 =
201
+ * Small Bug Fixed
202
+ = 2.1.1 =
203
+ * Hashtag mode fixed
204
+ = 2.1.2 =
205
+ * Banner Removed
206
+ = 2.1.3 =
207
+ * Add Shortcakes Info
tinymce/editor_plugin.js CHANGED
@@ -28,7 +28,7 @@
28
  },
29
  getInfo: function() {
30
  return {
31
- longname: 'Plugin to add Enjoy Instagram Button',
32
  author: 'Mediabeta Srl',
33
  authorurl: 'http://www.mediabeta.com/',
34
  infourl: 'http://www.mediabeta.com/',
28
  },
29
  getInfo: function() {
30
  return {
31
+ longname: 'Plugin to add Enjoy Plugin for Instagram Button',
32
  author: 'Mediabeta Srl',
33
  authorurl: 'http://www.mediabeta.com/',
34
  infourl: 'http://www.mediabeta.com/',
tinymce/enjoyinstagramtinymce.js CHANGED
@@ -8,13 +8,19 @@ function insertenjoyinstagramshortcode() {
8
 
9
  tagtext = "[" + shortcode + "]";
10
 
11
- if (window.tinyMCE) {
12
- window.tinyMCE.execInstanceCommand(window.tinyMCE.activeEditor.id, 'mceInsertContent', false, tagtext);
13
- //Peforms a clean up of the current editor HTML.
14
- //tinyMCEPopup.editor.execCommand('mceCleanup');
15
- //Repaints the editor. Sometimes the browser has graphic glitches.
16
- tinyMCEPopup.editor.execCommand('mceRepaint');
17
- tinyMCEPopup.close();
 
 
 
 
 
 
18
  }
19
  return;
20
  }
8
 
9
  tagtext = "[" + shortcode + "]";
10
 
11
+ if(window.tinyMCE) {
12
+
13
+ /* get the TinyMCE version to account for API diffs */
14
+ var tmce_ver=window.tinyMCE.majorVersion;
15
+
16
+ if (tmce_ver>="4") {
17
+ window.tinyMCE.execCommand('mceInsertContent', false, tagtext);
18
+ } else {
19
+ window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, tagtext);
20
+ }
21
+
22
+ tinyMCEPopup.editor.execCommand('mceRepaint');
23
+ tinyMCEPopup.close();
24
  }
25
  return;
26
  }
tinymce/window.php CHANGED
@@ -23,7 +23,7 @@ global $wp_scripts;
23
  <form name="enjoyinstagram" action="#">
24
  <table border="0" cellpadding="4" cellspacing="0" style="margin:0 auto;">
25
  <tr>
26
- <td colspan="2">Insert Enjoy Instagram Shortcode</td>
27
  </tr><tr>
28
  <td colspan="2" style="height:100px;">
29
  <input type="radio" name="newshortcode" id="id_shortcode_carousel" value="enjoyinstagram_mb" checked/> <label for="id_shortcode_carousel" >Carousel View</label>
23
  <form name="enjoyinstagram" action="#">
24
  <table border="0" cellpadding="4" cellspacing="0" style="margin:0 auto;">
25
  <tr>
26
+ <td colspan="2">Insert Enjoy Plugin for Instagram Shortcode</td>
27
  </tr><tr>
28
  <td colspan="2" style="height:100px;">
29
  <input type="radio" name="newshortcode" id="id_shortcode_carousel" value="enjoyinstagram_mb" checked/> <label for="id_shortcode_carousel" >Carousel View</label>