Version Description
- Add support for https protocol
=
Download this release
Release Info
Developer | mediabeta |
Plugin | Enjoy Instagram feed on website with WordPress Widget and Shortcode |
Version | 1.6 |
Comparing to | |
See all releases |
Code changes from version 1.5.2 to 1.6
- enjoyinstagram.php +333 -326
- library/autenticazione.php +1 -1
- library/enjoyinstagram_shortcode.php +11 -2
- library/enjoyinstagram_shortcode_grid.php +12 -3
- library/enjoyinstagram_shortcode_grid_widget.php +15 -2
- library/enjoyinstagram_shortcode_widget.php +70 -61
- readme.txt +13 -4
enjoyinstagram.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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.
|
7 |
Author: F. Prestipino, F. Di Pane - Mediabeta Srl
|
8 |
Author URI: http://www.mediabeta.com/team/
|
9 |
*/
|
@@ -23,188 +23,188 @@ 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 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
if (d.getElementById(id)) return;
|
97 |
-
js = d.createElement(s); js.id = id;
|
98 |
-
js.src = "//connect.facebook.net/it_IT/sdk.js#xfbml=1&appId=359330984151581&version=v2.0";
|
99 |
-
fjs.parentNode.insertBefore(js, fjs);
|
100 |
-
}(document, 'script', 'facebook-jssdk'));</script>
|
101 |
-
<div class="ei_facebook_block">
|
102 |
-
<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">
|
103 |
-
</div>
|
104 |
</div>
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
</div>
|
121 |
-
</div>
|
122 |
-
<div class="ei_block">
|
123 |
-
|
124 |
-
|
125 |
-
<div id="premium_release">
|
126 |
-
|
127 |
-
<div class="pad_premium_release">
|
128 |
-
<span class="coffee_title">Premium Version is <a href="http://www.mediabeta.com/enjoy-instagram-premium/">HERE</a> !</span>
|
129 |
-
<p><span style="color:#900; font-weight: bold;">Enjoy 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 />
|
130 |
-
Discover now all the features and innovations, <a href="http://www.mediabeta.com/enjoy-instagram-premium/">CLICK HERE</a></p>
|
131 |
-
|
132 |
-
</div>
|
133 |
-
|
134 |
-
</div>
|
135 |
-
</div>
|
136 |
-
</h2>
|
137 |
-
|
138 |
-
|
139 |
-
<?php $this->plugin_options_tabs(); ?>
|
140 |
-
<?php
|
141 |
-
if($tab == 'enjoyinstagram_general_settings') {
|
142 |
-
if(isset($_GET['code']) && $_GET['code']!=''){
|
143 |
-
|
144 |
-
// get access token
|
145 |
-
|
146 |
-
$client_id = get_option('enjoyinstagram_client_id');
|
147 |
-
$client_secret = get_option('enjoyinstagram_client_secret');
|
148 |
-
$redirect_uri = admin_url('options-general.php?page=enjoyinstagram_plugin_options&tab=enjoyinstagram_general_settings');
|
149 |
-
$code = $_GET['code'];
|
150 |
-
|
151 |
$apiData = array(
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
);
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
// get accee token fine
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
<?php
|
206 |
}
|
207 |
-
|
208 |
function plugin_options_tabs() {
|
209 |
$current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $this->enjoyinstagram_general_settings_key;
|
210 |
|
@@ -212,116 +212,116 @@ class Settings_enjoyinstagram_Plugin {
|
|
212 |
echo '<h2 class="nav-tab-wrapper">';
|
213 |
foreach ( $this->plugin_settings_tabs as $tab_key => $tab_caption ) {
|
214 |
$active = $current_tab == $tab_key ? 'nav-tab-active' : '';
|
215 |
-
echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->plugin_options_key . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
|
216 |
}
|
217 |
echo '</h2>';
|
218 |
-
|
219 |
-
|
220 |
|
221 |
function replace4byte($string) {
|
222 |
-
|
223 |
\xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
|
224 |
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
|
225 |
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
|
226 |
-
)%xs', '', $string);
|
227 |
-
}
|
228 |
// Initialize the plugin
|
229 |
add_action( 'plugins_loaded', create_function( '', '$Settings_enjoyinstagram_Plugin = new Settings_enjoyinstagram_Plugin;' ) );
|
230 |
|
231 |
|
232 |
function enjoyinstagram_default_option()
|
233 |
{
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
}
|
252 |
|
253 |
register_activation_hook( __FILE__, 'enjoyinstagram_default_option');
|
254 |
|
255 |
function enjoyinstagram_register_options_group_auth()
|
256 |
{
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
}
|
262 |
|
263 |
add_action ('admin_init', 'enjoyinstagram_register_options_group_auth');
|
264 |
|
265 |
function enjoyinstagram_register_options_group()
|
266 |
{
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
}
|
277 |
|
278 |
add_action ('admin_init', 'enjoyinstagram_register_options_group');
|
279 |
|
280 |
function enjoyinstagram_register_options_carousel()
|
281 |
{
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
|
289 |
}
|
290 |
|
291 |
add_action ('admin_init', 'enjoyinstagram_register_options_carousel');
|
292 |
-
|
293 |
function aggiungi_script_instafeed_owl() {
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
}
|
324 |
-
|
325 |
add_action( 'wp_enqueue_scripts', 'aggiungi_script_instafeed_owl' );
|
326 |
|
327 |
function aggiungi_script_in_admin(){
|
@@ -333,89 +333,89 @@ add_action( 'admin_enqueue_scripts', 'aggiungi_script_in_admin' );
|
|
333 |
add_action( 'admin_head', 'aggiungo_javascript_in_pannello_amministrazione' );
|
334 |
|
335 |
function aggiungo_javascript_in_pannello_amministrazione() {
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
}
|
363 |
-
}
|
364 |
-
|
365 |
-
|
366 |
-
document.body.appendChild(form);
|
367 |
-
form.submit();
|
368 |
-
|
369 |
}
|
|
|
370 |
|
371 |
|
372 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
373 |
<?php
|
374 |
}
|
375 |
|
376 |
-
|
377 |
|
378 |
function funzioni_in_head() {
|
379 |
-
|
380 |
-
|
381 |
jQuery(function($) {
|
382 |
$(".swipebox_grid").swipebox({
|
383 |
-
|
384 |
});
|
385 |
-
|
386 |
-
});
|
387 |
|
388 |
jQuery(function(){
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
});
|
398 |
-
|
399 |
-
</script>
|
400 |
-
|
401 |
}
|
402 |
|
403 |
-
|
404 |
add_action('wp_head', 'funzioni_in_head');
|
405 |
|
406 |
-
|
407 |
-
|
408 |
-
function enjoyinstagram_plugin_settings_link($links) {
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
}
|
417 |
-
|
418 |
-
$plugin = plugin_basename(__FILE__);
|
419 |
add_filter("plugin_action_links_$plugin", 'enjoyinstagram_plugin_settings_link');
|
420 |
|
421 |
|
@@ -425,37 +425,37 @@ add_filter("plugin_action_links_$plugin", 'enjoyinstagram_plugin_settings_link')
|
|
425 |
add_action( 'admin_footer', 'add_option_client_ajax' );
|
426 |
|
427 |
function add_option_client_ajax() {
|
428 |
-
?>
|
429 |
-
<script type="text/javascript" >
|
430 |
-
|
431 |
-
jQuery('#button_autorizza_instagram').click(function() {
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
});
|
445 |
-
</script>
|
446 |
<?php
|
447 |
}
|
448 |
|
449 |
add_action( 'wp_ajax_user_option_ajax', 'user_option_ajax_callback' );
|
450 |
|
451 |
function user_option_ajax_callback() {
|
452 |
-
global $wpdb;
|
453 |
|
454 |
$client_id = $_POST['client_id_value'];
|
455 |
-
$client_secret = $_POST['client_secret_value'];
|
456 |
-
echo $client_id."<br />".$client_secret;
|
457 |
-
update_option( 'enjoyinstagram_client_id', $client_id );
|
458 |
-
update_option( 'enjoyinstagram_client_secret', $client_secret );
|
459 |
|
460 |
die();
|
461 |
}
|
@@ -464,37 +464,44 @@ update_option( 'enjoyinstagram_client_secret', $client_secret );
|
|
464 |
add_action( 'admin_footer', 'logout_client_ajax' );
|
465 |
|
466 |
function logout_client_ajax() {
|
467 |
-
?>
|
468 |
-
<script type="text/javascript" >
|
469 |
-
|
470 |
-
jQuery('#button_logout').click(function() {
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
});
|
480 |
-
</script>
|
481 |
<?php
|
482 |
}
|
483 |
|
484 |
add_action( 'wp_ajax_user_logout_ajax', 'user_logout_ajax_callback' );
|
485 |
|
486 |
function user_logout_ajax_callback() {
|
487 |
-
global $wpdb;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
488 |
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
update_option('enjoyinstagram_user_website','');
|
494 |
-
update_option('enjoyinstagram_user_bio','');
|
495 |
-
update_option('enjoyinstagram_access_token','');
|
496 |
|
497 |
-
|
|
|
|
|
498 |
}
|
499 |
|
500 |
|
@@ -502,7 +509,7 @@ update_option('enjoyinstagram_access_token','');
|
|
502 |
|
503 |
include_once ('tinymce/tinymce.php');
|
504 |
require_once ('tinymce/ajax.php');
|
505 |
-
|
506 |
require_once('library/widgets.php');
|
507 |
require_once('library/widgets_grid.php');
|
508 |
require_once('library/enjoyinstagram_shortcode_grid.php');
|
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.6
|
7 |
Author: F. Prestipino, F. Di Pane - Mediabeta Srl
|
8 |
Author URI: http://www.mediabeta.com/team/
|
9 |
*/
|
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/sdk.js#xfbml=1&appId=359330984151581&version=v2.0";
|
99 |
+
fjs.parentNode.insertBefore(js, fjs);
|
100 |
+
}(document, 'script', 'facebook-jssdk'));</script>
|
101 |
+
<div class="ei_facebook_block">
|
102 |
+
<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">
|
103 |
+
</div>
|
104 |
+
</div>
|
105 |
+
</div>
|
106 |
+
|
107 |
+
<div id="buy_me_a_coffee" style="background:url(<?php echo plugins_url( 'images/buymeacoffee.png' , __FILE__ ) ; ?>)#fff no-repeat; ">
|
108 |
+
|
109 |
+
<div class="pad_coffee">
|
110 |
+
<span class="coffee_title">Buy me a coffee!</span>
|
111 |
+
<p><span>If you liked our work please consider to make a kind donation through Paypal.</span></p>
|
112 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
113 |
+
<input type="hidden" name="cmd" value="_s-xclick">
|
114 |
+
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----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-----END PKCS7-----
|
115 |
+
">
|
116 |
+
<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!">
|
117 |
+
<img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
|
118 |
+
</form>
|
119 |
+
</div>
|
120 |
+
</div>
|
121 |
</div>
|
122 |
+
<div class="ei_block">
|
123 |
+
|
124 |
+
|
125 |
+
<div id="premium_release">
|
126 |
+
|
127 |
+
<div class="pad_premium_release">
|
128 |
+
<span class="coffee_title">Premium Version is <a href="http://www.mediabeta.com/enjoy-instagram-premium/">HERE</a> !</span>
|
129 |
+
<p><span style="color:#900; font-weight: bold;">Enjoy 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 />
|
130 |
+
Discover now all the features and innovations, <a href="http://www.mediabeta.com/enjoy-instagram-premium/">CLICK HERE</a></p>
|
131 |
|
132 |
+
</div>
|
133 |
+
|
134 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
</div>
|
136 |
+
</h2>
|
137 |
+
|
138 |
+
|
139 |
+
<?php $this->plugin_options_tabs(); ?>
|
140 |
+
<?php
|
141 |
+
if($tab == 'enjoyinstagram_general_settings') {
|
142 |
+
if(isset($_GET['code']) && $_GET['code']!=''){
|
143 |
+
|
144 |
+
// get access token
|
145 |
+
|
146 |
+
$client_id = get_option('enjoyinstagram_client_id');
|
147 |
+
$client_secret = get_option('enjoyinstagram_client_secret');
|
148 |
+
$redirect_uri = admin_url('options-general.php?page=enjoyinstagram_plugin_options&tab=enjoyinstagram_general_settings');
|
149 |
+
$code = $_GET['code'];
|
150 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
$apiData = array(
|
152 |
+
'client_id' => $client_id,
|
153 |
+
'client_secret' => $client_secret,
|
154 |
+
'grant_type' => 'authorization_code',
|
155 |
+
'redirect_uri' => $redirect_uri,
|
156 |
+
'code' => $code
|
157 |
);
|
158 |
+
|
159 |
+
|
160 |
+
$apiHost = 'https://api.instagram.com/oauth/access_token';
|
161 |
+
|
162 |
+
$ch = curl_init();
|
163 |
+
curl_setopt($ch, CURLOPT_URL, $apiHost);
|
164 |
+
curl_setopt($ch, CURLOPT_POST, count($apiData));
|
165 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($apiData));
|
166 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
|
167 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
168 |
+
$jsonData = curl_exec($ch);
|
169 |
+
curl_close($ch);
|
170 |
+
$user = json_decode($jsonData,true);
|
171 |
+
|
172 |
+
$enjoyinstagram_user_id = $user['user']['id'];
|
173 |
+
$enjoyinstagram_user_username = replace4byte($user['user']['username']);
|
174 |
+
$enjoyinstagram_user_profile_picture = $user['user']['profile_picture'];
|
175 |
+
$enjoyinstagram_user_fullname = replace4byte($user['user']['full_name']);
|
176 |
+
$enjoyinstagram_user_website = $user['user']['website'];
|
177 |
+
$enjoyinstagram_user_bio = replace4byte($user['user']['bio']);
|
178 |
+
$enjoyinstagram_access_token = $user['access_token'];
|
179 |
+
|
180 |
+
update_option( 'enjoyinstagram_user_id', $enjoyinstagram_user_id );
|
181 |
+
update_option( 'enjoyinstagram_user_username', $enjoyinstagram_user_username );
|
182 |
+
update_option( 'enjoyinstagram_user_profile_picture', $enjoyinstagram_user_profile_picture );
|
183 |
+
update_option( 'enjoyinstagram_user_fullname', $enjoyinstagram_user_fullname );
|
184 |
+
update_option( 'enjoyinstagram_user_website', $enjoyinstagram_user_website );
|
185 |
+
update_option( 'enjoyinstagram_user_bio', $enjoyinstagram_user_bio );
|
186 |
+
update_option( 'enjoyinstagram_access_token', $enjoyinstagram_access_token );
|
187 |
+
|
188 |
+
|
189 |
// get accee token fine
|
190 |
+
include('library/profile_auth.php');
|
191 |
+
|
192 |
+
}else{
|
193 |
+
|
194 |
+
if(!(get_option('enjoyinstagram_access_token'))){
|
195 |
+
include('library/autenticazione.php');
|
196 |
+
} else {
|
197 |
+
include('library/profile_auth.php');
|
198 |
+
}
|
199 |
+
|
200 |
+
}
|
201 |
+
}else if($tab == 'enjoyinstagram_advanced_settings'){
|
202 |
+
include('library/impostazioni_shortcode.php');
|
203 |
+
} ?>
|
204 |
+
</div>
|
205 |
+
<?php
|
206 |
}
|
207 |
+
|
208 |
function plugin_options_tabs() {
|
209 |
$current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $this->enjoyinstagram_general_settings_key;
|
210 |
|
212 |
echo '<h2 class="nav-tab-wrapper">';
|
213 |
foreach ( $this->plugin_settings_tabs as $tab_key => $tab_caption ) {
|
214 |
$active = $current_tab == $tab_key ? 'nav-tab-active' : '';
|
215 |
+
echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->plugin_options_key . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
|
216 |
}
|
217 |
echo '</h2>';
|
218 |
+
}
|
219 |
+
};
|
220 |
|
221 |
function replace4byte($string) {
|
222 |
+
return preg_replace('%(?:
|
223 |
\xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
|
224 |
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
|
225 |
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
|
226 |
+
)%xs', '', $string);
|
227 |
+
}
|
228 |
// Initialize the plugin
|
229 |
add_action( 'plugins_loaded', create_function( '', '$Settings_enjoyinstagram_Plugin = new Settings_enjoyinstagram_Plugin;' ) );
|
230 |
|
231 |
|
232 |
function enjoyinstagram_default_option()
|
233 |
{
|
234 |
+
add_option('enjoyinstagram_client_id', '');
|
235 |
+
add_option('enjoyinstagram_client_secret', '');
|
236 |
+
add_option('enjoyinstagram_client_code', '');
|
237 |
+
add_option('enjoyinstagram_user_instagram', '');
|
238 |
+
add_option('enjoyinstagram_user_id', '');
|
239 |
+
add_option('enjoyinstagram_user_username', '');
|
240 |
+
add_option('enjoyinstagram_user_profile_picture', '');
|
241 |
+
add_option('enjoyinstagram_user_fullname', '');
|
242 |
+
add_option('enjoyinstagram_user_website', '');
|
243 |
+
add_option('enjoyinstagram_user_bio', '');
|
244 |
+
add_option('enjoyinstagram_access_token', '');
|
245 |
+
add_option('enjoyinstagram_carousel_items_number', 4);
|
246 |
+
add_option('enjoyinstagram_carousel_navigation', 'false');
|
247 |
+
add_option('enjoyinstagram_grid_rows', '2');
|
248 |
+
add_option('enjoyinstagram_grid_cols', '5');
|
249 |
+
add_option('enjoyinstagram_hashtag', '');
|
250 |
+
add_option('enjoyinstagram_user_or_hashtag', 'user');
|
251 |
}
|
252 |
|
253 |
register_activation_hook( __FILE__, 'enjoyinstagram_default_option');
|
254 |
|
255 |
function enjoyinstagram_register_options_group_auth()
|
256 |
{
|
257 |
+
register_setting('enjoyinstagram_options_group_auth', 'enjoyinstagram_client_id');
|
258 |
+
register_setting('enjoyinstagram_options_group_auth', 'enjoyinstagram_client_secret');
|
259 |
+
register_setting('enjoyinstagram_options_group_auth', 'enjoyinstagram_client_code');
|
260 |
+
register_setting('enjoyinstagram_options_group_auth', 'enjoyinstagram_user_instagram');
|
261 |
}
|
262 |
|
263 |
add_action ('admin_init', 'enjoyinstagram_register_options_group_auth');
|
264 |
|
265 |
function enjoyinstagram_register_options_group()
|
266 |
{
|
267 |
+
register_setting('enjoyinstagram_options_group', 'enjoyinstagram_client_id');
|
268 |
+
register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_instagram');
|
269 |
+
register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_id');
|
270 |
+
register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_username');
|
271 |
+
register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_profile_picture');
|
272 |
+
register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_fullname');
|
273 |
+
register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_website');
|
274 |
+
register_setting('enjoyinstagram_options_group', 'enjoyinstagram_user_bio');
|
275 |
+
register_setting('enjoyinstagram_options_group', 'enjoyinstagram_access_token');
|
276 |
}
|
277 |
|
278 |
add_action ('admin_init', 'enjoyinstagram_register_options_group');
|
279 |
|
280 |
function enjoyinstagram_register_options_carousel()
|
281 |
{
|
282 |
+
register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_carousel_items_number');
|
283 |
+
register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_carousel_navigation');
|
284 |
+
register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_grid_cols');
|
285 |
+
register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_grid_rows');
|
286 |
+
register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_hashtag');
|
287 |
+
register_setting('enjoyinstagram_options_carousel_group', 'enjoyinstagram_user_or_hashtag');
|
288 |
|
289 |
}
|
290 |
|
291 |
add_action ('admin_init', 'enjoyinstagram_register_options_carousel');
|
292 |
+
|
293 |
function aggiungi_script_instafeed_owl() {
|
294 |
+
|
295 |
+
if(!is_admin()) {
|
296 |
+
|
297 |
+
wp_register_script('owl', plugins_url('/js/owl.carousel.js',__FILE__),'jquery','');
|
298 |
+
wp_register_script('swipebox', plugins_url('/js/jquery.swipebox.js',__FILE__),'jquery','');
|
299 |
+
wp_register_script('gridrotator', plugins_url('/js/jquery.gridrotator.js',__FILE__),'jquery','');
|
300 |
+
wp_register_script('modernizr.custom.26633', plugins_url('/js/modernizr.custom.26633.js',__FILE__),'jquery','');
|
301 |
+
wp_register_script('orientationchange', plugins_url('/js/ios-orientationchange-fix.js',__FILE__),'jquery','');
|
302 |
+
|
303 |
+
wp_register_style( 'owl_style', plugins_url('/css/owl.carousel.css',__FILE__) );
|
304 |
+
wp_register_style( 'owl_style_2', plugins_url('/css/owl.theme.css',__FILE__) );
|
305 |
+
wp_register_style( 'owl_style_3', plugins_url('/css/owl.transitions.css',__FILE__) );
|
306 |
+
wp_register_style( 'swipebox_css', plugins_url('/css/swipebox.css',__FILE__) );
|
307 |
+
wp_register_style( 'grid_fallback', plugins_url('/css/grid_fallback.css',__FILE__) );
|
308 |
+
wp_register_style( 'grid_style', plugins_url('/css/grid_style.css',__FILE__) );
|
309 |
+
|
310 |
+
wp_enqueue_script( 'jquery' ); // include jQuery
|
311 |
+
wp_enqueue_script('owl');
|
312 |
+
wp_enqueue_script('swipebox');
|
313 |
+
wp_enqueue_script('modernizr.custom.26633');
|
314 |
+
wp_enqueue_script('gridrotator');
|
315 |
+
wp_enqueue_script('orientationchange');
|
316 |
+
wp_enqueue_style( 'owl_style' );
|
317 |
+
wp_enqueue_style( 'owl_style_2' );
|
318 |
+
wp_enqueue_style( 'owl_style_3' );
|
319 |
+
wp_enqueue_style( 'swipebox_css' );
|
320 |
+
wp_enqueue_style( 'grid_fallback' );
|
321 |
+
wp_enqueue_style( 'grid_style' );
|
322 |
+
}
|
323 |
}
|
324 |
+
|
325 |
add_action( 'wp_enqueue_scripts', 'aggiungi_script_instafeed_owl' );
|
326 |
|
327 |
function aggiungi_script_in_admin(){
|
333 |
add_action( 'admin_head', 'aggiungo_javascript_in_pannello_amministrazione' );
|
334 |
|
335 |
function aggiungo_javascript_in_pannello_amministrazione() {
|
336 |
+
?>
|
337 |
+
<script type="text/javascript">
|
338 |
+
|
339 |
+
|
340 |
+
function post_to_url(path, method) {
|
341 |
+
method = method || "get";
|
342 |
+
var params = new Array();
|
343 |
+
var client_id = document.getElementById('enjoyinstagram_client_id').value;
|
344 |
+
var client_secret = document.getElementById('enjoyinstagram_client_secret').value;
|
345 |
+
params['client_id'] = client_id;
|
346 |
+
params['redirect_uri'] = '<?php echo admin_url('options-general.php?page=enjoyinstagram_plugin_options&tab=enjoyinstagram_general_settings'); ?>';
|
347 |
+
params['scope'] = 'likes';
|
348 |
+
params['response_type'] = 'code';
|
349 |
+
|
350 |
+
var form = document.createElement("form");
|
351 |
+
form.setAttribute("method", method);
|
352 |
+
form.setAttribute("action", path);
|
353 |
+
|
354 |
+
for(var key in params) {
|
355 |
+
if(params.hasOwnProperty(key)) {
|
356 |
+
var hiddenField = document.createElement("input");
|
357 |
+
hiddenField.setAttribute("type", "hidden");
|
358 |
+
hiddenField.setAttribute("name", key);
|
359 |
+
hiddenField.setAttribute("value", params[key]);
|
360 |
+
|
361 |
+
form.appendChild(hiddenField);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
}
|
363 |
+
}
|
364 |
|
365 |
|
366 |
+
document.body.appendChild(form);
|
367 |
+
form.submit();
|
368 |
+
|
369 |
+
}
|
370 |
+
|
371 |
+
|
372 |
+
</script>
|
373 |
<?php
|
374 |
}
|
375 |
|
376 |
+
|
377 |
|
378 |
function funzioni_in_head() {
|
379 |
+
?>
|
380 |
+
<script type="text/javascript">
|
381 |
jQuery(function($) {
|
382 |
$(".swipebox_grid").swipebox({
|
383 |
+
hideBarsDelay : 0
|
384 |
});
|
385 |
+
|
386 |
+
});
|
387 |
|
388 |
jQuery(function(){
|
389 |
+
jQuery(document.body)
|
390 |
+
.on('click touchend','#swipebox-slider .current img', function(e){
|
391 |
+
jQuery('#swipebox-next').click();
|
392 |
+
return false;
|
393 |
+
})
|
394 |
+
.on('click touchend','#swipebox-slider .current', function(e){
|
395 |
+
jQuery('#swipebox-close').trigger('click');
|
396 |
+
});
|
397 |
});
|
398 |
+
|
399 |
+
</script>
|
400 |
+
<?php
|
401 |
}
|
402 |
|
403 |
+
|
404 |
add_action('wp_head', 'funzioni_in_head');
|
405 |
|
406 |
+
|
407 |
+
|
408 |
+
function enjoyinstagram_plugin_settings_link($links) {
|
409 |
+
$settings_link = '<a href="options-general.php?page=enjoyinstagram_plugin_options">' . __( 'Settings' ) . '</a>';
|
410 |
+
$widgets_link = '<a href="widgets.php">' . __( 'Widgets' ) . '</a>';
|
411 |
+
$premium_link = '<a href="http://www.mediabeta.com/enjoy-instagram-premium/">' . __( 'Premium Version' ) . '</a>';
|
412 |
+
array_push($links, $settings_link);
|
413 |
+
array_push($links, $widgets_link);
|
414 |
+
array_push($links, $premium_link);
|
415 |
+
return $links;
|
416 |
}
|
417 |
+
|
418 |
+
$plugin = plugin_basename(__FILE__);
|
419 |
add_filter("plugin_action_links_$plugin", 'enjoyinstagram_plugin_settings_link');
|
420 |
|
421 |
|
425 |
add_action( 'admin_footer', 'add_option_client_ajax' );
|
426 |
|
427 |
function add_option_client_ajax() {
|
428 |
+
?>
|
429 |
+
<script type="text/javascript" >
|
430 |
+
|
431 |
+
jQuery('#button_autorizza_instagram').click(function() {
|
432 |
+
var client_id = document.getElementById('enjoyinstagram_client_id').value;
|
433 |
+
var client_secret = document.getElementById('enjoyinstagram_client_secret').value;
|
434 |
+
var data = {
|
435 |
+
action: 'user_option_ajax',
|
436 |
+
client_id_value: client_id,
|
437 |
+
client_secret_value: client_secret
|
438 |
+
};
|
439 |
+
|
440 |
+
|
441 |
+
jQuery.post(ajaxurl, data, function(response) {
|
442 |
+
post_to_url('https://api.instagram.com/oauth/authorize/','get');
|
443 |
+
});
|
444 |
+
});
|
445 |
+
</script>
|
446 |
<?php
|
447 |
}
|
448 |
|
449 |
add_action( 'wp_ajax_user_option_ajax', 'user_option_ajax_callback' );
|
450 |
|
451 |
function user_option_ajax_callback() {
|
452 |
+
global $wpdb;
|
453 |
|
454 |
$client_id = $_POST['client_id_value'];
|
455 |
+
$client_secret = $_POST['client_secret_value'];
|
456 |
+
echo $client_id."<br />".$client_secret;
|
457 |
+
update_option( 'enjoyinstagram_client_id', $client_id );
|
458 |
+
update_option( 'enjoyinstagram_client_secret', $client_secret );
|
459 |
|
460 |
die();
|
461 |
}
|
464 |
add_action( 'admin_footer', 'logout_client_ajax' );
|
465 |
|
466 |
function logout_client_ajax() {
|
467 |
+
?>
|
468 |
+
<script type="text/javascript" >
|
469 |
+
|
470 |
+
jQuery('#button_logout').click(function() {
|
471 |
+
var data = {
|
472 |
+
action: 'user_logout_ajax'
|
473 |
+
};
|
474 |
+
|
475 |
+
|
476 |
+
jQuery.post(ajaxurl, data, function(response) {
|
477 |
+
location.href = '<?php echo get_admin_url(); ?>options-general.php?page=enjoyinstagram_plugin_options&tab=enjoyinstagram_general_settings';
|
478 |
+
});
|
479 |
+
});
|
480 |
+
</script>
|
481 |
<?php
|
482 |
}
|
483 |
|
484 |
add_action( 'wp_ajax_user_logout_ajax', 'user_logout_ajax_callback' );
|
485 |
|
486 |
function user_logout_ajax_callback() {
|
487 |
+
global $wpdb;
|
488 |
+
|
489 |
+
update_option('enjoyinstagram_user_id','');
|
490 |
+
update_option('enjoyinstagram_user_username','');
|
491 |
+
update_option('enjoyinstagram_user_profile_picture','');
|
492 |
+
update_option('enjoyinstagram_user_fullname','');
|
493 |
+
update_option('enjoyinstagram_user_website','');
|
494 |
+
update_option('enjoyinstagram_user_bio','');
|
495 |
+
update_option('enjoyinstagram_access_token','');
|
496 |
|
497 |
+
die();
|
498 |
+
}
|
499 |
+
|
500 |
+
function isHttps() {
|
|
|
|
|
|
|
501 |
|
502 |
+
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
|
503 |
+
return true;
|
504 |
+
}
|
505 |
}
|
506 |
|
507 |
|
509 |
|
510 |
include_once ('tinymce/tinymce.php');
|
511 |
require_once ('tinymce/ajax.php');
|
512 |
+
|
513 |
require_once('library/widgets.php');
|
514 |
require_once('library/widgets_grid.php');
|
515 |
require_once('library/enjoyinstagram_shortcode_grid.php');
|
library/autenticazione.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<p style="font-size:14px;">Thank you for you
|
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 |
|
1 |
+
<p style="font-size:14px;">Thank you for you choice! <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 |
|
library/enjoyinstagram_shortcode.php
CHANGED
@@ -47,12 +47,21 @@ jQuery("#owl-<?php echo $i; ?>").owlCarousel({
|
|
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'){
|
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(urlencode(get_option('enjoyinstagram_hashtag')));
|
51 |
}else{
|
52 |
+
$result = $instagram->getUserMedia(urlencode(get_option('enjoyinstagram_user_id')));
|
53 |
}
|
54 |
$pre_shortcode_content = "<div id=\"owl-".$i."\" class=\"owl-example\" style=\"display:none;\">";
|
55 |
|
56 |
+
|
57 |
+
if (isHttps()) {
|
58 |
+
foreach ($result->data as $entry) {
|
59 |
+
$entry->images->thumbnail->url = str_replace('http://', 'https://', $entry->images->thumbnail->url);
|
60 |
+
$entry->images->standard_resolution->url = str_replace('http://', 'https://', $entry->images->standard_resolution->url);
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
|
65 |
foreach ($result->data as $entry) {
|
66 |
|
67 |
if(get_option('enjoyinstagram_carousel_items_number')!='1'){
|
library/enjoyinstagram_shortcode_grid.php
CHANGED
@@ -7,14 +7,23 @@ if(get_option('enjoyinstagram_client_id') || get_option('enjoyinstagram_client_i
|
|
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 |
|
19 |
|
20 |
foreach ($result->data as $entry) {
|
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(urlencode(get_option('enjoyinstagram_hashtag')));
|
11 |
}else{
|
12 |
+
$result = $instagram->getUserMedia(urlencode(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 |
+
|
19 |
+
if (isHttps()) {
|
20 |
+
foreach ($result->data as $entry) {
|
21 |
+
$entry->images->thumbnail->url = str_replace('http://', 'https://', $entry->images->thumbnail->url);
|
22 |
+
$entry->images->standard_resolution->url = str_replace('http://', 'https://', $entry->images->standard_resolution->url);
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
|
27 |
|
28 |
|
29 |
foreach ($result->data as $entry) {
|
library/enjoyinstagram_shortcode_grid_widget.php
CHANGED
@@ -11,11 +11,24 @@ if(get_option('enjoyinstagram_client_id') || get_option('enjoyinstagram_client_i
|
|
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
|
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(urlencode(get_option('enjoyinstagram_hashtag')));
|
15 |
}else{
|
16 |
+
$result = $instagram->getUserMedia(urlencode(get_option('enjoyinstagram_user_id')));
|
17 |
}
|
18 |
?>
|
19 |
+
|
20 |
+
<?php
|
21 |
+
|
22 |
+
if (isHttps()) {
|
23 |
+
foreach ($result->data as $entry) {
|
24 |
+
$entry->images->thumbnail->url = str_replace('http://', 'https://', $entry->images->thumbnail->url);
|
25 |
+
$entry->images->standard_resolution->url = str_replace('http://', 'https://', $entry->images->standard_resolution->url);
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
?>
|
30 |
+
|
31 |
+
|
32 |
<div id="rigrid-<?php echo "{$id}"; ?>" class="ri-grid ri-grid-size-2 ri-shadow" style="display:none">
|
33 |
<ul>
|
34 |
<?php
|
library/enjoyinstagram_shortcode_widget.php
CHANGED
@@ -1,67 +1,76 @@
|
|
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 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
?>
|
12 |
-
<script>
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
</script>
|
24 |
-
<script type="text/javascript">
|
25 |
-
jQuery(function($) {
|
26 |
-
|
27 |
-
|
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 |
-
if($result->data){
|
51 |
-
foreach ($result->data as $entry) {
|
52 |
-
|
53 |
-
if(get_option('enjoyinstagram_carousel_items_number')!='1'){
|
54 |
-
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>";
|
55 |
-
}else{
|
56 |
-
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>";
|
57 |
-
}
|
58 |
-
}
|
59 |
-
}
|
60 |
-
?>
|
61 |
-
</div>
|
62 |
-
<?php
|
63 |
|
64 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
add_shortcode( 'enjoyinstagram_mb_widget', 'enjoyinstagram_mb_shortcode_widget' );
|
67 |
|
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(urlencode(get_option('enjoyinstagram_hashtag')));
|
44 |
+
} else {
|
45 |
+
$result = $instagram->getUserMedia(urlencode(get_option('enjoyinstagram_user_id')));
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
+
if (isHttps()){
|
50 |
+
foreach ($result->data 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->data){
|
60 |
+
foreach ($result->data as $entry) {
|
61 |
+
|
62 |
+
if(get_option('enjoyinstagram_carousel_items_number')!='1'){
|
63 |
+
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>";
|
64 |
+
}else{
|
65 |
+
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>";
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
69 |
+
?>
|
70 |
+
</div>
|
71 |
+
<?php
|
72 |
+
|
73 |
+
}
|
74 |
}
|
75 |
add_shortcode( 'enjoyinstagram_mb_widget', 'enjoyinstagram_mb_shortcode_widget' );
|
76 |
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: (mediabeta, frafra85, fabiodipa)
|
|
3 |
Donate link: http://www.mediabeta.com/enjoy-instagram/
|
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.
|
7 |
-
Version: 1.
|
8 |
-
Stable tag: 1.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -107,6 +107,11 @@ Repeat Step 01 and Step 02 again.
|
|
107 |
* Bugs Fix
|
108 |
= 1.5.2 =
|
109 |
* Bug for utf8 4-byte (mobile emoticon) Fixed
|
|
|
|
|
|
|
|
|
|
|
110 |
== Upgrade Notice ==
|
111 |
|
112 |
= 1.0 =
|
@@ -126,4 +131,8 @@ Repeat Step 01 and Step 02 again.
|
|
126 |
= 1.5.1 =
|
127 |
* Bugs Fix
|
128 |
= 1.5.2 =
|
129 |
-
* Bug for utf8 4-byte (mobile emoticon) Fixed
|
|
|
|
|
|
|
|
3 |
Donate link: http://www.mediabeta.com/enjoy-instagram/
|
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.1.1
|
7 |
+
Version: 1.6
|
8 |
+
Stable tag: 1.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
107 |
* Bugs Fix
|
108 |
= 1.5.2 =
|
109 |
* Bug for utf8 4-byte (mobile emoticon) Fixed
|
110 |
+
= 1.5.3 =
|
111 |
+
* Support for swedish specific characters.
|
112 |
+
= 1.6 =
|
113 |
+
* Add support for https protocol
|
114 |
+
|
115 |
== Upgrade Notice ==
|
116 |
|
117 |
= 1.0 =
|
131 |
= 1.5.1 =
|
132 |
* Bugs Fix
|
133 |
= 1.5.2 =
|
134 |
+
* Bug for utf8 4-byte (mobile emoticon) Fixed
|
135 |
+
= 1.5.3 =
|
136 |
+
* Support for swedish specific characters.
|
137 |
+
= 1.6 =
|
138 |
+
* Add support for https protocol
|