AccessPress Instagram Feed - Version 2.1.3

Version Description

  • Done the bug fixings for the error display mechanism.
Download this release

Release Info

Developer Access Keys
Plugin Icon 128x128 AccessPress Instagram Feed
Version 2.1.3
Comparing to
See all releases

Code changes from version 2.1.2 to 2.1.3

accesspress-instagram-feed.php CHANGED
@@ -1,10 +1,10 @@
1
<?php
2
defined( 'ABSPATH' ) or die( "No script kiddies please!" );
3
/*
4
- Plugin name: Instagram Feed for WordPress - AccessPress Instagram Feed
5
Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-instagram-feed/
6
Description: A plugin to add various instagram widgets with dynamic configuration options.
7
- Version: 2.1.2
8
Author: AccessPress Themes
9
Author URI: http://accesspressthemes.com
10
Text Domain:accesspress-instagram-feed
@@ -14,7 +14,7 @@ License: GPLv2 or later
14
15
//Decleration of the necessary constants for plugin
16
if( !defined( 'APIF_VERSION' ) ) {
17
- define( 'APIF_VERSION', '2.1.2' );
18
}
19
20
if( !defined( 'APIF_IMAGE_DIR' ) ) {
1
<?php
2
defined( 'ABSPATH' ) or die( "No script kiddies please!" );
3
/*
4
+ Plugin name: AccessPress Instagram Feed
5
Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-instagram-feed/
6
Description: A plugin to add various instagram widgets with dynamic configuration options.
7
+ Version: 2.1.3
8
Author: AccessPress Themes
9
Author URI: http://accesspressthemes.com
10
Text Domain:accesspress-instagram-feed
14
15
//Decleration of the necessary constants for plugin
16
if( !defined( 'APIF_VERSION' ) ) {
17
+ define( 'APIF_VERSION', '2.1.3' );
18
}
19
20
if( !defined( 'APIF_IMAGE_DIR' ) ) {
inc/backend/boards/instagram-profiles.php CHANGED
@@ -32,7 +32,7 @@
32
?>
33
<input type="text" name="instagram[access_token]" value="<?php echo esc_attr($access_token); ?>"/>
34
<div class="apsc-option-note">
35
- <?php _e('Please enter the instagram Access Token.You can get this by clicking the below link. If new access token not received in the above access token field, please copy the access token from the url above after access_token=', 'accesspress-instagram-feed'); ?>
36
<?php _e("Please don't forget to click save button.", 'accesspress-instagram-feed'); ?>
37
<?php $new_url = urlencode(admin_url('admin.php?page=if-instagram-feed')) . '&response_type=token'; ?>
38
<div id="login_with_instagram">
32
?>
33
<input type="text" name="instagram[access_token]" value="<?php echo esc_attr($access_token); ?>"/>
34
<div class="apsc-option-note">
35
+ <?php _e('Please enter the instagram Access Token.You can get this by clicking the below link. If new access token not received in the above Instagram access token field, please copy the access token from the url above after access_token=', 'accesspress-instagram-feed'); ?>
36
<?php _e("Please don't forget to click save button.", 'accesspress-instagram-feed'); ?>
37
<?php $new_url = urlencode(admin_url('admin.php?page=if-instagram-feed')) . '&response_type=token'; ?>
38
<div id="login_with_instagram">
inc/backend/widget.php CHANGED
@@ -27,26 +27,26 @@ class APIF_Widget extends WP_Widget {
27
public function widget($args, $instance) {
28
29
echo $args['before_widget']; ?>
30
- <div class='apif-widget-wrapper'>
31
- <?php
32
- if (!empty($instance['title'])) {
33
- echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
34
- }
35
36
- if(isset($instance['layout']) && $instance['layout'] == 'layout-1'){
37
- echo do_shortcode('[ap_instagram_widget]');
38
- }
39
- else if(isset($instance['layout']) && $instance['layout'] == 'layout-2'){
40
- echo do_shortcode('[ap_instagram_mosaic_lightview]');
41
- }
42
- else if(isset($instance['layout']) && $instance['layout'] == 'layout-3'){
43
- echo do_shortcode('[ap_instagram_slider]');
44
- }
45
- else{
46
- echo do_shortcode('[ap_instagram_feed]');
47
- }
48
- ?>
49
- </div>
50
<?php
51
echo $args['after_widget'];
52
}
27
public function widget($args, $instance) {
28
29
echo $args['before_widget']; ?>
30
+ <div class='apif-widget-wrapper'>
31
+ <?php
32
+ if (!empty($instance['title'])) {
33
+ echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
34
+ }
35
36
+ if(isset($instance['layout']) && $instance['layout'] == 'layout-1'){
37
+ echo do_shortcode('[ap_instagram_widget]');
38
+ }
39
+ else if(isset($instance['layout']) && $instance['layout'] == 'layout-2'){
40
+ echo do_shortcode('[ap_instagram_mosaic_lightview]');
41
+ }
42
+ else if(isset($instance['layout']) && $instance['layout'] == 'layout-3'){
43
+ echo do_shortcode('[ap_instagram_slider]');
44
+ }
45
+ else{
46
+ echo do_shortcode('[ap_instagram_feed]');
47
+ }
48
+ ?>
49
+ </div>
50
<?php
51
echo $args['after_widget'];
52
}
inc/backend/widgetside.php CHANGED
@@ -39,106 +39,113 @@ class APIF_SideWidget extends WP_Widget {
39
$instance_follow = (isset($instance['instance_follow']) && $instance['instance_follow']==1)?'true':'false';
40
$instance_image_link= (isset($instance['instance_image_link']) && $instance['instance_image_link']==1) ? 'true' : 'false';
41
42
43
- global $apif_settings, $insta;
44
- $apif_settings = get_option( 'apif_settings' );
45
- $username = !empty($apif_settings['username']) ? $apif_settings['username'] : '';
46
- $user_id = !empty($apif_settings['user_id']) ? $apif_settings['user_id'] : '';
47
- $social_profile_url = 'https://instagram.com/' . $username;
48
- $access_token = !empty($apif_settings['access_token']) ? $apif_settings['access_token'] : '';
49
- $url = "https://api.instagram.com/v1/users/search?q=" . $username . "&access_token=" . $access_token;
50
- $get = wp_remote_get( $url );
51
- $response = wp_remote_retrieve_body( $get );
52
- $json = json_decode( $response );
53
- foreach( $json->data as $user )
54
- {
55
- if( $user->username == $username )
56
- {
57
- $user_id = $user->id;
58
}
59
- }
60
- $api_url = 'https://api.instagram.com/v1/users/' . $user_id . '?access_token=' . $access_token;
61
- $connection = wp_remote_get($api_url);
62
- $response = json_decode($connection['body'], true);
63
- ?>
64
- <div class="instagram-header">
65
-
66
- <?php if($instance_header != 'true'){ ?>
67
- <div class="apif-profile clearfix">
68
- <div class="apif-profile-img">
69
- <img src="<?php echo $response['data']['profile_picture']; ?>"/>
70
- </div>
71
- <div class="apif-profile-name">
72
- <?php echo $response['data']['full_name']; ?>
73
- </div>
74
- </div>
75
- <?php } ?>
76
-
77
- <?php if($instance_post != 'true' || $instance_followers != 'true' || $instance_following != 'true' || $instance_follow != 'true'): ?>
78
- <div class="apif-profile-follow clearfix">
79
- <div class="post">
80
- <?php if($instance_post != 'true'): ?>
81
- <?php echo $response['data']['counts']['media']; ?>
82
- <span>post</span>
83
- <?php endif; ?>
84
- </div>
85
- <div class="followers">
86
- <?php if($instance_followers != 'true'): ?>
87
- <?php echo $response['data']['counts']['followed_by']; ?>
88
- <span>followers</span>
89
- <?php endif; ?>
90
- </div>
91
- <div class="following">
92
- <?php if($instance_following != 'true'): ?>
93
- <?php echo $response['data']['counts']['follows']; ?>
94
- <span>following</span>
95
- <?php endif; ?>
96
- </div>
97
- <div class="follow">
98
- <?php if($instance_follow != 'true'): ?>
99
- <div class="follow-inner">
100
- <div class="table-outer">
101
- <div class="table-inner">
102
- <a href="https://instagram.com/<?php echo $apif_settings['username']; ?>" target='_blank' title='Follow <?php echo $apif_settings['username']; ?>' >follow</a>
103
- </div>
104
</div>
105
</div>
106
- <?php endif; ?>
107
</div>
108
- </div>
109
- <?php endif; ?>
110
- </div>
111
<?php
112
-
113
- $count = $instagram_num_img;
114
- require_once(APIF_INST_PATH . 'inc/frontend/instagram.php');
115
- $ins_media = $insta->userMedia();
116
- $j = 0;
117
- if(isset($ins_media['meta']['error_message'])){
118
- ?>
119
- <h1 class="widget-title-insta"><span><?php echo $ins_media['meta']['error_message']; ?></span></h1>
120
- <?php
121
- } else if (is_array($ins_media['data']) || is_object($ins_media['data']))
122
- {
123
- echo '<ul class="instagram-widget clear">';
124
- foreach ($ins_media['data'] as $vm)
125
- {
126
- if ($count == $j) {
127
- break;
128
- }
129
- $j++;
130
- $img = $vm['images']['thumbnail']['url'];
131
- ?>
132
- <?php if($instance_image_link == 'true'){ ?>
133
- <li><a href='<?php echo $vm['link']; ?>' target='_blank'><img src="<?php echo esc_url($img); ?>" alt='<?php echo $vm['caption']['text']; ?>' /></a></li>
134
- <?php }else{ ?>
135
- <li><img src="<?php echo esc_url($img); ?>" alt='<?php echo $vm['caption']['text']; ?>' /></li>
136
- <?php } ?>
137
- <?php
138
- }
139
- echo '</ul>';
140
- }
141
- echo $args['after_widget'];
142
}
143
144
/**
39
$instance_follow = (isset($instance['instance_follow']) && $instance['instance_follow']==1)?'true':'false';
40
$instance_image_link= (isset($instance['instance_image_link']) && $instance['instance_image_link']==1) ? 'true' : 'false';
41
42
+ global $insta;
43
+ $apif_settings = get_option( 'apif_settings' );
44
+ $username = !empty($apif_settings['username']) ? $apif_settings['username'] : '';
45
+ $user_id = !empty($apif_settings['user_id']) ? $apif_settings['user_id'] : '';
46
+ $social_profile_url = 'https://instagram.com/' . $username;
47
+ $access_token = !empty($apif_settings['access_token']) ? $apif_settings['access_token'] : '';
48
+ require_once(APIF_INST_PATH . 'inc/frontend/instagram.php');
49
+ ?>
50
+ <?php
51
+ if($username == '' && $access_token ==''){
52
+ $response = array('meta'=>array('error_message'=>'Username and access token field is empty. Please configure.'));
53
54
+ }else if($username == ''){
55
+ $response = array('meta'=>array('error_message'=>'Username field is empty.'));
56
+
57
+ }else if ($access_token == ''){
58
+ $response = array('meta'=>array('error_message'=>'Access token field is empty.'));
59
+ }else{
60
+ $response = $insta->userInfo();
61
}
62
+
63
+ if($response == NULL){
64
+ $response = array('meta'=>array('error_message'=>'Username field is empty.'));
65
+ }
66
+
67
+ if(isset($response['meta']['error_message'])){ ?>
68
+ <h1 class="widget-title-insta"><span><?php echo $response['meta']['error_message']; ?></span></h1>
69
+ <?php
70
+ }else{ ?>
71
+ <div class="instagram-header">
72
+ <?php if($instance_header != 'true'){ ?>
73
+ <div class="apif-profile clearfix">
74
+ <div class="apif-profile-img">
75
+ <img src="<?php echo $response['data']['profile_picture']; ?>" />
76
+ </div>
77
+ <div class="apif-profile-name">
78
+ <?php echo $response['data']['full_name']; ?>
79
+ </div>
80
+ </div>
81
+ <?php } ?>
82
+
83
+ <?php if($instance_post != 'true' || $instance_followers != 'true' || $instance_following != 'true' || $instance_follow != 'true'): ?>
84
+ <div class="apif-profile-follow clearfix">
85
+ <div class="post">
86
+ <?php if($instance_post != 'true'): ?>
87
+ <?php echo $response['data']['counts']['media']; ?>
88
+ <span>post</span>
89
+ <?php endif; ?>
90
+ </div>
91
+ <div class="followers">
92
+ <?php if($instance_followers != 'true'): ?>
93
+ <?php echo $response['data']['counts']['followed_by']; ?>
94
+ <span>followers</span>
95
+ <?php endif; ?>
96
+ </div>
97
+ <div class="following">
98
+ <?php if($instance_following != 'true'): ?>
99
+ <?php echo $response['data']['counts']['follows']; ?>
100
+ <span>following</span>
101
+ <?php endif; ?>
102
+ </div>
103
+ <div class="follow">
104
+ <?php if($instance_follow != 'true'): ?>
105
+ <div class="follow-inner">
106
+ <div class="table-outer">
107
+ <div class="table-inner">
108
+ <a href="https://instagram.com/<?php echo $apif_settings['username']; ?>" target='_blank' title='Follow <?php echo $apif_settings['username']; ?>' >follow</a>
109
+ </div>
110
+ </div>
111
+ </div>
112
+ <?php endif; ?>
113
</div>
114
</div>
115
+ <?php endif; ?>
116
+
117
+ <?php
118
+ ///////////////////////////Display the user's instagram images/////////////////////////////////////////////////////////
119
+ $count = $instagram_num_img;
120
+ $ins_media = $insta->userMedia();
121
+ $j = 0;
122
+ if(isset($ins_media['meta']['error_message'])){
123
+ ?>
124
+ <h1 class="widget-title-insta"><span><?php echo $ins_media['meta']['error_message']; ?></span></h1>
125
+ <?php
126
+ } else if (is_array($ins_media['data']) || is_object($ins_media['data'])) {
127
+ echo '<ul class="instagram-widget clear">';
128
+ foreach ($ins_media['data'] as $vm) {
129
+ if ($count == $j) {
130
+ break;
131
+ }
132
+ $j++;
133
+ $img = $vm['images']['thumbnail']['url'];
134
+ ?>
135
+ <?php if($instance_image_link == 'true'){ ?>
136
+ <li><a href='<?php echo $vm['link']; ?>' target='_blank'><img src="<?php echo esc_url($img); ?>" alt='<?php echo $vm['caption']['text']; ?>' /></a></li>
137
+ <?php }else{ ?>
138
+ <li><img src="<?php echo esc_url($img); ?>" alt='<?php echo $vm['caption']['text']; ?>' /></li>
139
+ <?php } ?>
140
+ <?php
141
+ }
142
+ echo '</ul>';
143
+ } ?>
144
</div>
145
+ <?php
146
+ } ?>
147
+ <?php echo $args['after_widget']; ?>
148
<?php
149
}
150
151
/**
inc/frontend/instagram-feed.php CHANGED
@@ -8,7 +8,24 @@ defined( 'ABSPATH' ) or die( "No script kiddies please!" );
8
$image_like = isset($apif_settings['active']) ? $apif_settings['active'] : '';
9
$count = 7; // number of images to show
10
require_once('instagram.php');
11
- $ins_media = $insta->userMedia();
12
13
if ($layout == 'mosaic' || $layout == 'mosaic_lightview') { ?>
14
<section id="main" class="thumb-view">
@@ -100,65 +117,67 @@ defined( 'ABSPATH' ) or die( "No script kiddies please!" );
100
<?php
101
} else if ($layout == 'slider') {
102
?>
103
- <div id="owl-demo" class="owl-carousel">
104
<?php
105
- $ins_media_slider = $insta->userMedia();
106
$j = 0;
107
if(isset($ins_media['meta']['error_message'])){
108
?>
109
<h1 class="widget-title-insta"><span><?php echo $ins_media['meta']['error_message']; ?></span></h1>
110
<?php
111
- } if (is_array($ins_media_slider['data']) || is_object($ins_media_slider['data'])) {
112
- foreach ($ins_media_slider['data'] as $vm):
113
- if ($count == $j) {
114
- break;
115
- }
116
- $j++;
117
- $imgslider = $vm['images']['standard_resolution']['url'];
118
- ?>
119
- <div class="item">
120
- <img src="<?php echo esc_url($imgslider); ?>" />
121
- <?php if ($image_like == '1') : ?>
122
- <!-- Image like count section start -->
123
- <span class="instagram_like_count">
124
- <p class="instagram_imge_like">
125
- <span class="insta like_image">
126
- <i class="fa fa-heart-o fa-2x"></i>
127
- </span>
128
- <span class="count"><?php echo $likes = $vm['likes']['count']; ?></span>
129
- </p>
130
- </span>
131
- <!-- Image like count section end -->
132
- <?php endif; ?>
133
- </div>
134
<?php
135
- endforeach;
136
- } ?>
137
- </div>
138
139
<?php }else if($layout == 'grid_rotator'){ ?>
140
- <div class="ri-grid apif-ri-grid">
141
- <img class="ri-loading-image" src="<?php echo APIF_IMAGE_DIR. '/ripple.gif'; ?>"/>
142
<?php
143
if(isset($ins_media['meta']['error_message'])){
144
?>
145
<h1 class="widget-title-insta"><span><?php echo $ins_media['meta']['error_message']; ?></span></h1>
146
<?php
147
}else if (is_array($ins_media['data']) || is_object($ins_media['data'])) { ?>
148
- <ul>
149
- <?php
150
- foreach ($ins_media['data'] as $vm):
151
- $img = $vm['images']['standard_resolution']['url'];
152
- $image_url = APIF_IMAGE_DIR . '/image-square.png';
153
- $image = $vm['images']['standard_resolution']['url'];
154
- $link = $vm["link"];
155
- $flow_icon = APIF_IMAGE_DIR . '/sc-icon.png';
156
- ?>
157
- <li><a href="<?php echo $link ?>" target="_blank"><img src="<?php echo esc_url($image); ?>" alt='<?php echo strip_tags(substr($vm['caption']['text'], 0, 20)); ?>'></a></li>
158
<?php
159
- endforeach; ?>
160
- </ul>
161
<?php } ?>
162
- </div>
163
<?php
164
}
8
$image_like = isset($apif_settings['active']) ? $apif_settings['active'] : '';
9
$count = 7; // number of images to show
10
require_once('instagram.php');
11
+
12
+ if($username == '' && $access_token ==''){
13
+ $response = array('meta'=>array('error_message'=>'Username and access token field is empty. Please configure.'));
14
+
15
+ }else if($username == ''){
16
+ $response = array('meta'=>array('error_message'=>'Username field is empty.'));
17
+
18
+ }else if ($access_token == ''){
19
+ $response = array('meta'=>array('error_message'=>'Access token field is empty.'));
20
+ }else{
21
+ $response = $insta->userMedia();
22
+ }
23
+
24
+ if($response == NULL){
25
+ $response = array('meta'=>array('error_message'=>'Username field is empty.'));
26
+ }
27
+
28
+ $ins_media = $response;
29
30
if ($layout == 'mosaic' || $layout == 'mosaic_lightview') { ?>
31
<section id="main" class="thumb-view">
117
<?php
118
} else if ($layout == 'slider') {
119
?>
120
<?php
121
$j = 0;
122
if(isset($ins_media['meta']['error_message'])){
123
?>
124
<h1 class="widget-title-insta"><span><?php echo $ins_media['meta']['error_message']; ?></span></h1>
125
<?php
126
+ } if (is_array($ins_media['data']) || is_object($ins_media['data'])) { ?>
127
+ <div id="owl-demo" class="owl-carousel">
128
<?php
129
+ foreach ($ins_media['data'] as $vm):
130
+ if ($count == $j) {
131
+ break;
132
+ }
133
+ $j++;
134
+ $imgslider = $vm['images']['standard_resolution']['url'];
135
+ ?>
136
+ <div class="item">
137
+ <img src="<?php echo esc_url($imgslider); ?>" />
138
+ <?php if ($image_like == '1') : ?>
139
+ <!-- Image like count section start -->
140
+ <span class="instagram_like_count">
141
+ <p class="instagram_imge_like">
142
+ <span class="insta like_image">
143
+ <i class="fa fa-heart-o fa-2x"></i>
144
+ </span>
145
+ <span class="count"><?php echo $likes = $vm['likes']['count']; ?></span>
146
+ </p>
147
+ </span>
148
+ <!-- Image like count section end -->
149
+ <?php endif; ?>
150
+ </div>
151
+ <?php
152
+ endforeach;
153
+ ?>
154
+ </div>
155
+ <?php } ?>
156
157
<?php }else if($layout == 'grid_rotator'){ ?>
158
+ var_dump($ins_media);
159
<?php
160
if(isset($ins_media['meta']['error_message'])){
161
?>
162
<h1 class="widget-title-insta"><span><?php echo $ins_media['meta']['error_message']; ?></span></h1>
163
<?php
164
}else if (is_array($ins_media['data']) || is_object($ins_media['data'])) { ?>
165
+ <div class="ri-grid apif-ri-grid">
166
+ <img class="ri-loading-image" src="<?php echo APIF_IMAGE_DIR. '/ripple.gif'; ?>"/>
167
+ <ul>
168
<?php
169
+ foreach ($ins_media['data'] as $vm):
170
+ $img = $vm['images']['standard_resolution']['url'];
171
+ $image_url = APIF_IMAGE_DIR . '/image-square.png';
172
+ $image = $vm['images']['standard_resolution']['url'];
173
+ $link = $vm["link"];
174
+ $flow_icon = APIF_IMAGE_DIR . '/sc-icon.png';
175
+ ?>
176
+ <li><a href="<?php echo $link ?>" target="_blank"><img src="<?php echo esc_url($image); ?>" alt='<?php echo strip_tags(substr($vm['caption']['text'], 0, 20)); ?>'></a></li>
177
+ <?php
178
+ endforeach; ?>
179
+ </ul>
180
+ </div>
181
<?php } ?>
182
<?php
183
}
inc/frontend/instagram-grid-rotator.php CHANGED
@@ -8,8 +8,25 @@ defined( 'ABSPATH' ) or die( "No script kiddies please!" );
8
$image_like = $apif_settings['active'];
9
$count = 7; // number of images to show
10
require_once('instagram.php');
11
- $ins_media = $insta->userMedia();
12
$rand_no = rand();
13
?>
14
15
<script type="text/javascript">
@@ -44,27 +61,27 @@ defined( 'ABSPATH' ) or die( "No script kiddies please!" );
44
45
});
46
</script>
47
- <div class="ri-grid ri-grid-<?php echo $rand_no; ?> apif-ri-grid">
48
- <img class="ri-loading-image" src="<?php echo APIF_IMAGE_DIR. '/ripple.gif'; ?>"/>
49
<?php
50
if(isset($ins_media['meta']['error_message'])){
51
?>
52
<h1 class="widget-title-insta"><span><?php echo $ins_media['meta']['error_message']; ?></span></h1>
53
<?php
54
}else if (is_array($ins_media['data']) || is_object($ins_media['data'])) { ?>
55
- <ul>
56
- <?php
57
- foreach ($ins_media['data'] as $vm):
58
- $img = $vm['images']['standard_resolution']['url'];
59
- $image_url = APIF_IMAGE_DIR . '/image-square.png';
60
- $image = $vm['images']['standard_resolution']['url'];
61
-
62
- $link = $vm["link"];
63
- $flow_icon = APIF_IMAGE_DIR . '/sc-icon.png';
64
- ?>
65
- <li><a href="<?php echo $link ?>" target="_blank"><img src="<?php echo esc_url($image); ?>" alt='<?php echo strip_tags(substr($vm['caption']['text'], 0, 20)); ?>'></a></li>
66
<?php
67
- endforeach; ?>
68
- </ul>
69
- <?php } ?>
70
- </div>
8
$image_like = $apif_settings['active'];
9
$count = 7; // number of images to show
10
require_once('instagram.php');
11
+ // $ins_media = $insta->userMedia();
12
$rand_no = rand();
13
+ if($username == '' && $access_token ==''){
14
+ $response = array('meta'=>array('error_message'=>'Username and access token field is empty. Please configure.'));
15
+
16
+ }else if($username == ''){
17
+ $response = array('meta'=>array('error_message'=>'Username field is empty.'));
18
+
19
+ }else if ($access_token == ''){
20
+ $response = array('meta'=>array('error_message'=>'Access token field is empty.'));
21
+ }else{
22
+ $response = $insta->userMedia();
23
+ }
24
+
25
+ if($response == NULL){
26
+ $response = array('meta'=>array('error_message'=>'Username field is empty.'));
27
+ }
28
+
29
+ $ins_media = $response;
30
?>
31
32
<script type="text/javascript">
61
62
});
63
</script>
64
<?php
65
if(isset($ins_media['meta']['error_message'])){
66
?>
67
<h1 class="widget-title-insta"><span><?php echo $ins_media['meta']['error_message']; ?></span></h1>
68
<?php
69
}else if (is_array($ins_media['data']) || is_object($ins_media['data'])) { ?>
70
+ <div class="ri-grid ri-grid-<?php echo $rand_no; ?> apif-ri-grid">
71
+ <img class="ri-loading-image" src="<?php echo APIF_IMAGE_DIR. '/ripple.gif'; ?>"/>
72
+ <ul>
73
<?php
74
+ foreach ($ins_media['data'] as $vm):
75
+ $img = $vm['images']['standard_resolution']['url'];
76
+ $image_url = APIF_IMAGE_DIR . '/image-square.png';
77
+ $image = $vm['images']['standard_resolution']['url'];
78
+
79
+ $link = $vm["link"];
80
+ $flow_icon = APIF_IMAGE_DIR . '/sc-icon.png';
81
+ ?>
82
+ <li><a href="<?php echo $link ?>" target="_blank"><img src="<?php echo esc_url($image); ?>" alt='<?php echo strip_tags(substr($vm['caption']['text'], 0, 20)); ?>'></a></li>
83
+ <?php
84
+ endforeach; ?>
85
+ </ul>
86
+ </div>
87
+ <?php } ?>
inc/frontend/instagram-masaic-light.php CHANGED
@@ -7,16 +7,37 @@ $access_token = $apif_settings['access_token'];
7
$image_like = $apif_settings['active'];
8
$count = 7; // number of images to show
9
require_once('instagram.php');
10
?>
11
<section id="main" class="thumb-view">
12
<div class="row masonry for-mosaic isotope ifgrid">
13
<?php
14
- $ins_media_masaic = $insta->userMedia();
15
$i = 1;
16
$j = 0;
17
- if(isset($ins_media['meta']['error_message'])){
18
?>
19
- <h1 class="widget-title-insta"><span><?php echo $ins_media['meta']['error_message']; ?></span></h1>
20
<?php
21
}else if (is_array($ins_media_masaic['data']) || is_object($ins_media_masaic['data'])) {
22
foreach ($ins_media_masaic['data'] as $vm):
7
$image_like = $apif_settings['active'];
8
$count = 7; // number of images to show
9
require_once('instagram.php');
10
+ // $ins_media_masaic = $insta->userMedia();
11
+ $rand_no = rand();
12
+ if($username == '' && $access_token ==''){
13
+ $response = array('meta'=>array('error_message'=>'Username and access token field is empty. Please configure.'));
14
+
15
+ }else if($username == ''){
16
+ $response = array('meta'=>array('error_message'=>'Username field is empty.'));
17
+
18
+ }else if ($access_token == ''){
19
+ $response = array('meta'=>array('error_message'=>'Access token field is empty.'));
20
+ }else{
21
+ $response = $insta->userMedia();
22
+ }
23
+
24
+ if($response == NULL){
25
+ $response = array('meta'=>array('error_message'=>'Username field is empty.'));
26
+ }
27
+
28
+ $ins_media_masaic = $response;
29
+ // var_dump($response);
30
+ // die();
31
+
32
?>
33
<section id="main" class="thumb-view">
34
<div class="row masonry for-mosaic isotope ifgrid">
35
<?php
36
$i = 1;
37
$j = 0;
38
+ if(isset($ins_media_masaic['meta']['error_message'])){
39
?>
40
+ <h1 class="widget-title-insta"><span><?php echo $ins_media_masaic['meta']['error_message']; ?></span></h1>
41
<?php
42
}else if (is_array($ins_media_masaic['data']) || is_object($ins_media_masaic['data'])) {
43
foreach ($ins_media_masaic['data'] as $vm):
inc/frontend/instagram-slider.php CHANGED
@@ -7,41 +7,60 @@ global $apif_settings, $insta;
7
$image_like = $apif_settings['active'];
8
$count = 10; // number of images to show
9
require_once('instagram.php');
10
- $ins_media_slider = $insta->userMedia();
11
?>
12
- <div id="owl-demo" class="owl-carousel">
13
<?php
14
$j = 0;
15
if(isset($ins_media_slider['meta']['error_message'])){
16
?>
17
<h1 class="widget-title-insta"><span><?php echo $ins_media_slider['meta']['error_message']; ?></span></h1>
18
<?php
19
- }else if (is_array($ins_media_slider['data']) || is_object($ins_media_slider['data'])) {
20
- foreach ($ins_media_slider['data'] as $vm):
21
- if ($count == $j) {
22
- break;
23
- }
24
- $j++;
25
- $imgslider = $vm['images']['standard_resolution']['url'];
26
- ?>
27
- <div class="item">
28
- <img src="<?php echo esc_url($imgslider); ?>" />
29
- <?php if ($image_like == '1') : ?>
30
- <!-- Image like cound section start -->
31
- <span class="instagram_like_count">
32
- <p class="instagram_imge_like">
33
- <span class="insta like_image">
34
- <i class="fa fa-heart-o fa-2x"></i>
35
- </span>
36
- <span class="count"><?php echo $likes = $vm['likes']['count']; ?></span>
37
- </p>
38
- </span>
39
- <!-- Image like cound section end -->
40
- <?php endif; ?>
41
- </div>
42
43
<?php
44
- endforeach;
45
}
46
?>
47
- </div>
7
$image_like = $apif_settings['active'];
8
$count = 10; // number of images to show
9
require_once('instagram.php');
10
+ if($username == '' && $access_token ==''){
11
+ $response = array('meta'=>array('error_message'=>'Username and access token field is empty. Please configure.'));
12
+
13
+ }else if($username == ''){
14
+ $response = array('meta'=>array('error_message'=>'Username field is empty.'));
15
+
16
+ }else if ($access_token == ''){
17
+ $response = array('meta'=>array('error_message'=>'Access token field is empty.'));
18
+ }else{
19
+ $response = $insta->userMedia();
20
+ }
21
+
22
+ if($response == NULL){
23
+ $response = array('meta'=>array('error_message'=>'Username field is empty.'));
24
+ }
25
+
26
+ $ins_media_slider = $response;
27
?>
28
<?php
29
$j = 0;
30
if(isset($ins_media_slider['meta']['error_message'])){
31
?>
32
<h1 class="widget-title-insta"><span><?php echo $ins_media_slider['meta']['error_message']; ?></span></h1>
33
<?php
34
+ }else if (is_array($ins_media_slider['data']) || is_object($ins_media_slider['data'])) { ?>
35
+ <div id="owl-demo" class="owl-carousel">
36
+ <?php
37
+ foreach ($ins_media_slider['data'] as $vm):
38
+ if ($count == $j) {
39
+ break;
40
+ }
41
+ $j++;
42
+ $imgslider = $vm['images']['standard_resolution']['url'];
43
+ ?>
44
+ <div class="item">
45
+ <img src="<?php echo esc_url($imgslider); ?>" />
46
+ <?php if ($image_like == '1') : ?>
47
+ <!-- Image like cound section start -->
48
+ <span class="instagram_like_count">
49
+ <p class="instagram_imge_like">
50
+ <span class="insta like_image">
51
+ <i class="fa fa-heart-o fa-2x"></i>
52
+ </span>
53
+ <span class="count"><?php echo $likes = $vm['likes']['count']; ?></span>
54
+ </p>
55
+ </span>
56
+ <!-- Image like cound section end -->
57
+ <?php endif; ?>
58
+ </div>
59
60
<?php
61
+ endforeach;
62
+ ?>
63
+ </div>
64
+ <?php
65
}
66
?>
inc/frontend/instagram-widget.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
defined( 'ABSPATH' ) or die( "No script kiddies please!" );
3
- global $apif_settings, $insta;
4
- $apif_settings = get_option( 'apif_settings' );
5
$username = $apif_settings['username']; // your username
6
$access_token = $apif_settings['access_token'];
7
$layout = $apif_settings['instagram_mosaic'];
@@ -12,7 +12,21 @@ defined( 'ABSPATH' ) or die( "No script kiddies please!" );
12
<section id="main" class="thumb-view">
13
<div class="row masonry for-mosaic isotope ifgrid">
14
<?php
15
- $ins_media = $insta->userMedia();
16
$i = 1;
17
$j = 0;
18
if(isset($ins_media['meta']['error_message'])){
1
<?php
2
defined( 'ABSPATH' ) or die( "No script kiddies please!" );
3
+ global $insta;
4
+ $apif_settings = get_option( 'apif_settings' );
5
$username = $apif_settings['username']; // your username
6
$access_token = $apif_settings['access_token'];
7
$layout = $apif_settings['instagram_mosaic'];
12
<section id="main" class="thumb-view">
13
<div class="row masonry for-mosaic isotope ifgrid">
14
<?php
15
+ if($username == '' && $access_token ==''){
16
+ $response = array('meta'=>array('error_message'=>'Username and access token field is empty. Please configure.'));
17
+ }else if($username == ''){
18
+ $response = array('meta'=>array('error_message'=>'Username field is empty.'));
19
+ }else if ($access_token == ''){
20
+ $response = array('meta'=>array('error_message'=>'Access token field is empty.'));
21
+ }else{
22
+ $response = $insta->userMedia();
23
+ }
24
+ if($response == NULL){
25
+ $response = array('meta'=>array('error_message'=>'Username field is empty.'));
26
+ }
27
+
28
+ $ins_media = $response;
29
+
30
$i = 1;
31
$j = 0;
32
if(isset($ins_media['meta']['error_message'])){
inc/frontend/instagram.php CHANGED
@@ -5,20 +5,20 @@ class InstaWCD{
5
$username = strtolower($this->username); // sanitization
6
$token = $this->access_token;
7
8
- if(!empty($username) && !empty($token)) {
9
-
10
- $url = "https://api.instagram.com/v1/users/search?q=".$username."&access_token=".$token;
11
- $get = wp_remote_get($url);
12
- $response = wp_remote_retrieve_body( $get );
13
- $json = json_decode($response);
14
-
15
- foreach($json->data as $user){
16
- if($user->username == $username){
17
- return $user->id;
18
}
19
- }
20
return '00000000'; // return this if nothing is found
21
- }
22
}
23
24
function get_remote_data_from_instagram_in_json($url){
@@ -39,6 +39,13 @@ class InstaWCD{
39
$json = self:: get_remote_data_from_instagram_in_json( $url );
40
return $json;
41
}
42
}
43
$insta = new InstaWCD();
44
$insta->username = $username;
5
$username = strtolower($this->username); // sanitization
6
$token = $this->access_token;
7
8
+ if(!empty($username) && !empty($token)) {
9
+ $url = "https://api.instagram.com/v1/users/search?q=".$username."&access_token=".$token;
10
+ $get = wp_remote_get($url);
11
+ $response = wp_remote_retrieve_body( $get );
12
+ $json = json_decode($response);
13
+ if(isset($json->data)){
14
+ foreach($json->data as $user){
15
+ if($user->username == $username){
16
+ return $user->id;
17
+ }
18
+ }
19
}
20
return '00000000'; // return this if nothing is found
21
+ }
22
}
23
24
function get_remote_data_from_instagram_in_json($url){
39
$json = self:: get_remote_data_from_instagram_in_json( $url );
40
return $json;
41
}
42
+
43
+ //retrive user info
44
+ function userInfo(){
45
+ $url = 'https://api.instagram.com/v1/users/' . $this->userID() . '?access_token=' . $this->access_token;
46
+ $json = self:: get_remote_data_from_instagram_in_json( $url );
47
+ return $json;
48
+ }
49
}
50
$insta = new InstaWCD();
51
$insta->username = $username;
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === Instagram Feed for WordPress - AccessPress Instagram Feed ===
2
Contributors: Access Keys
3
Tags: instagram, instagram feed, instagram tag, instagram slider, instagarm mosaic view, instagarm mosaic layout, instagram lightbox, social media instagram, social network, masonry layout, masonry lightbox, instagarm masonry view, grid rotator, grid rotatory
4
Donate link: http://accesspressthemes.com/donation/
5
Requires at least: 3.8
6
Tested up to: 4.5
7
- Stable tag: 2.1.2
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -132,6 +132,9 @@ Once you install the plugin , you can check some general documentation about how
132
5. Backend Display Settings Section
133
134
== Changelog ==
135
= 2.1.2 =
136
* Done the bug fixings for compatible issue with the June 1st Instagram API changes.
137
1
+ === AccessPress Instagram Feed ===
2
Contributors: Access Keys
3
Tags: instagram, instagram feed, instagram tag, instagram slider, instagarm mosaic view, instagarm mosaic layout, instagram lightbox, social media instagram, social network, masonry layout, masonry lightbox, instagarm masonry view, grid rotator, grid rotatory
4
Donate link: http://accesspressthemes.com/donation/
5
Requires at least: 3.8
6
Tested up to: 4.5
7
+ Stable tag: 2.1.3
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
132
5. Backend Display Settings Section
133
134
== Changelog ==
135
+ = 2.1.3 =
136
+ * Done the bug fixings for the error display mechanism.
137
+
138
= 2.1.2 =
139
* Done the bug fixings for compatible issue with the June 1st Instagram API changes.
140