Instagram Gallery - Version 2.2.3

Version Description

Download this release

Release Info

Developer quadlayers
Plugin Icon 128x128 Instagram Gallery
Version 2.2.3
Comparing to
See all releases

Code changes from version 2.1.8 to 2.2.3

Files changed (50) hide show
  1. app/inc/IGIASpi.php +0 -251
  2. app/inc/utis.php +0 -144
  3. app/views/account.php +0 -250
  4. app/views/documentation.php +0 -145
  5. app/views/edit.php +0 -461
  6. app/views/list.php +0 -288
  7. app/wp-front.php +0 -326
  8. app/wp-panel.php +0 -120
  9. app/wp-widget.php +0 -96
  10. assets/admin-style.css +0 -349
  11. assets/css/qligg-admin.css +348 -0
  12. assets/css/qligg-admin.min.css +1 -0
  13. assets/{insta-gallery.css → css/qligg.css} +187 -186
  14. assets/css/qligg.min.css +1 -0
  15. assets/{media → img}/demo-carousel.jpg +0 -0
  16. assets/{media → img}/demo-gallery.jpg +0 -0
  17. assets/img/gallery.jpg +0 -0
  18. assets/{media → img}/ig-hdp-1.png +0 -0
  19. assets/{media → img}/ig-hdp-2.jpg +0 -0
  20. assets/{media → img}/ig-hdp-3.png +0 -0
  21. assets/{media → img}/ig-hdp-4.png +0 -0
  22. assets/{media → img}/ig-hdp-5.png +0 -0
  23. assets/{media → img}/ig-hdp-6.png +0 -0
  24. assets/{media → img}/ig-hdp-7.png +0 -0
  25. assets/{media → img}/ig-hdp-p1.png +0 -0
  26. assets/img/logo.png +0 -0
  27. assets/{media → img}/paypal-logo.svg +0 -0
  28. assets/img/quadlayers.jpg +0 -0
  29. assets/insta-gallery-min.css +0 -3
  30. assets/insta-gallery-min.js +0 -25
  31. assets/js/qligg-admin.js +473 -0
  32. assets/js/qligg-admin.min.js +1 -0
  33. assets/{insta-gallery.js → js/qligg.js} +0 -0
  34. assets/js/qligg.min.js +1 -0
  35. includes/AJAX.php +255 -0
  36. includes/API.php +266 -0
  37. includes/defaults.php +66 -0
  38. includes/frontend.php +301 -0
  39. includes/pages/documentation.php +154 -0
  40. includes/pages/token.php +89 -0
  41. includes/pages/views/edit.php +358 -0
  42. includes/pages/views/list.php +53 -0
  43. includes/pages/views/spinner.php +113 -0
  44. includes/pages/welcome.php +39 -0
  45. includes/settings.php +175 -0
  46. includes/utis.php +120 -0
  47. includes/widget.php +79 -0
  48. insta-gallery.php +87 -236
  49. readme.txt +16 -3
  50. uninstall.php +10 -11
app/inc/IGIASpi.php DELETED
@@ -1,251 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * IGIASpi
5
- * @author Karan Singh
6
- * @version 1.2.1
7
- * @depends Wordpress
8
- * @description script to get instagram public media by using Username and Tag-name.
9
- */
10
- if (! defined('INSGALLERY_PATH')) {
11
- return;
12
- }
13
-
14
- class IGIASpi
15
- {
16
-
17
- protected $instagram;
18
-
19
- // handle raw result from server, for further processing in your app
20
- public $remoteResult;
21
-
22
- public $message;
23
-
24
- private $resultsLimit;
25
-
26
- public function __construct()
27
- {
28
- $this->instagram = 'https://www.instagram.com/';
29
- $this->message = '';
30
- $this->resultsLimit = 50; // limit to 50 only
31
- }
32
-
33
- /*
34
- * API call to get access token using authorization code
35
- * @return boolean or string[access token]
36
- */
37
- public function getAccessToken($client_id, $client_secret, $redirect_uri, $code)
38
- {
39
- $url = 'https://api.instagram.com/oauth/access_token';
40
-
41
- $response = wp_remote_post($url, array(
42
- 'body' => array(
43
- 'client_id' => $client_id,
44
- 'client_secret' => $client_secret,
45
- 'redirect_uri' => $redirect_uri,
46
- 'code' => $code,
47
- 'grant_type' => 'authorization_code',
48
- 'scope' => 'public_content'
49
- )
50
- ));
51
- if (! is_wp_error($response) && isset($response['body']) && ! empty($response['body'])) {
52
- $data = json_decode($response['body'], true);
53
- if (isset($data['error_message'])) {
54
- $this->message = $data['error_message'];
55
- }
56
- if (isset($data['access_token'])) {
57
- return $data['access_token'];
58
- }
59
- }
60
- return false;
61
- }
62
-
63
- /*
64
- * API call to get user profile information using access token
65
- * @return false or array[result]
66
- */
67
- public function getUserProfileInfo($access_token)
68
- {
69
- $url = 'https://api.instagram.com/v1/users/self/?access_token=' . $access_token;
70
-
71
- $response = $this->spider($url);
72
- if (empty($response)) {
73
- return false;
74
- }
75
- $response = json_decode($response, true);
76
-
77
- if (isset($response['meta']['code']) && ($response['meta']['code'] != 200) && isset($response['meta']['error_message'])) {
78
- $this->message = $response['meta']['error_message'];
79
- return false;
80
- }
81
-
82
- return isset($response['data']) ? $response['data'] : false;
83
- }
84
-
85
- /*
86
- * API call to check if access token is valid
87
- * @return true or error message
88
- */
89
- public function isTokenValid($access_token)
90
- {
91
- $url = 'https://api.instagram.com/v1/users/self/?access_token=' . $access_token;
92
-
93
- $response = $this->spider($url);
94
- if (empty($response)) {
95
- return $this->message;
96
- }
97
- $response = json_decode($response);
98
-
99
- if (isset($response->meta->code) && ($response->meta->code != 200) && isset($response->meta->error_message)) {
100
- return $response->meta->error_message;
101
- }
102
-
103
- return true;
104
- }
105
-
106
- // API call to get user feed using access token :
107
- public function getUserMedia($access_token, $count = 30)
108
- {
109
- $url = 'https://api.instagram.com/v1/users/self/media/recent/?access_token=' . $access_token . '&count=' . $count;
110
-
111
- $response = $this->spider($url);
112
- if (empty($response)) {
113
- return false;
114
- }
115
- $response = json_decode($response, true);
116
-
117
- if (isset($response['meta']['code']) && ($response['meta']['code'] != 200) && isset($response['meta']['error_message'])) {
118
- $this->message = $response['meta']['error_message'];
119
- return false;
120
- }
121
-
122
- if (! isset($response['data'])) {
123
- return false;
124
- }
125
-
126
- return $this->setupUserMedia($response['data']);
127
- }
128
-
129
- protected function setupUserMedia($data)
130
- {
131
- $instaItems = array();
132
- if (is_array($data) && ! empty($data)) {
133
- foreach ($data as $item)
134
- $instaItems[] = array(
135
- 'img_standard' => $item['images']['standard_resolution']['url'],
136
- 'img_low' => $item['images']['low_resolution']['url'],
137
- 'img_thumb' => $item['images']['thumbnail']['url'],
138
- 'likes' => $item['likes']['count'],
139
- 'comments' => $item['comments']['count'],
140
- 'caption' => '',
141
- 'code' => '',
142
- 'link' => $item['link'],
143
- 'type' => $item['type'],
144
- 'owner_id' => ''
145
- );
146
- }
147
- return $instaItems;
148
- }
149
-
150
- /**
151
- * takes Tag name and return items list array
152
- *
153
- * @param string $tag
154
- * @return array|false
155
- */
156
- public function getTagItems($tag = '')
157
- {
158
- $instalink = 'https://www.' . 'instagram.com/';
159
- $tag = urlencode((string) $tag);
160
- if (empty($tag)) {
161
- $this->message = 'Please provide a valid # tag';
162
- return false;
163
- }
164
- $url = $instalink . 'explore/tags/' . $tag . '/?__a=1';
165
-
166
- $response = $this->spider($url);
167
- if (empty($response)) {
168
- return false;
169
- }
170
- $response = json_decode($response);
171
-
172
- $items = array();
173
- // API updated on Jan 03 17
174
- if (isset($response->graphql->hashtag->edge_hashtag_to_media->edges)) {
175
- $instaItems = $response->graphql->hashtag->edge_hashtag_to_media->edges;
176
-
177
- if (! empty($instaItems) && is_array($instaItems)) {
178
- $instaItems = array_slice($instaItems, 0, $this->resultsLimit);
179
- foreach ($instaItems as $res) {
180
- // its to check if this API have required variables
181
- if (! isset($res->node->display_url)) {
182
- continue;
183
- }
184
- $type = 'image';
185
- if (isset($res->node->is_video) && (true === $res->node->is_video)) {
186
- $type = 'video';
187
- }
188
- $caption = isset($res->node->edge_media_to_caption->edges[0]->node->text) ? htmlspecialchars($res->node->edge_media_to_caption->edges[0]->node->text) : '';
189
- $items[] = array(
190
- 'img_standard' => $res->node->display_url,
191
- 'img_low' => $res->node->thumbnail_src,
192
- 'img_thumb' => $res->node->thumbnail_resources[0]->src,
193
- 'likes' => $res->node->edge_liked_by->count,
194
- 'comments' => $res->node->edge_media_to_comment->count,
195
- 'caption' => '', // $caption
196
- 'code' => $res->node->shortcode,
197
- 'type' => $type,
198
- 'owner_id' => $res->node->owner->id
199
- );
200
- }
201
- }
202
- }
203
-
204
- return empty($items) ? false : $items;
205
- }
206
-
207
- /**
208
- * takes URL string and return URL content
209
- *
210
- * @param string $url
211
- * @return string|boolean
212
- */
213
- public function spider($url = '')
214
- {
215
- if (empty($url) || (! filter_var($url, FILTER_VALIDATE_URL))) {
216
- $this->message = 'Please provide a Valid URL';
217
- return false;
218
- }
219
- $responseBody = '';
220
-
221
- // get results if script executed in WP
222
- if (function_exists('wp_remote_request')) {
223
- $response = wp_remote_request($url);
224
- if (is_wp_error($response)) {
225
- $this->message = 'WP Error: ' . implode(', ', $response->get_error_messages());
226
- } else {
227
- if (200 !== wp_remote_retrieve_response_code($response)) {
228
- $this->message = 'ERROR: Response Code: ' . wp_remote_retrieve_response_code($response);
229
- }
230
-
231
- if (isset($response['body']) && ! empty($response['body'])) {
232
- $responseBody = $response['body'];
233
- }
234
- }
235
- } else {
236
- $this->message = 'Error: running outside WP.';
237
- }
238
- if (! defined('INSGALLERY' . '_PATH'))
239
- $responseBody = '';
240
-
241
- $this->remoteResult = $responseBody;
242
- return $responseBody;
243
- }
244
-
245
- // return message
246
- public function getMessage()
247
- {
248
- return $this->message;
249
- }
250
- }
251
-
app/inc/utis.php DELETED
@@ -1,144 +0,0 @@
1
- <?php
2
- /*
3
- * @package Instagram Gallery
4
- * @version 1
5
- * some usefull application utilities
6
- */
7
- if (! defined('INSGALLERY_PATH')) {
8
- return;
9
- }
10
- global $insgalleryIAC, $iispi;
11
-
12
- // some global instagram galley functions
13
-
14
- // save account info
15
- function igf_saveIAC()
16
- {
17
- global $insgalleryIAC;
18
- $option = $insgalleryIAC;
19
- $option = array_map(function ($value) {
20
- return base64_encode($value);
21
- }, $option);
22
- update_option('insta_gallery_iac', $option, false);
23
- }
24
-
25
- // clear old cache
26
- function igf_clearTransients($tk = false)
27
- {
28
- if ($tk) {
29
- delete_transient($tk);
30
- } else {
31
- delete_transient('instagallery_user_profile_info');
32
- delete_transient('instagallery_user_feed');
33
- }
34
- }
35
-
36
- // initialise account info
37
- function igf_initIAC()
38
- {
39
- global $insgalleryIAC;
40
- $option = get_option('insta_gallery_iac');
41
- if ($option && is_array($option)) {
42
- $option = array_map(function ($value) {
43
- return base64_decode($value);
44
- }, $option);
45
- $insgalleryIAC = $option;
46
- }
47
- }
48
-
49
- // generate code generation url
50
- function igf_getCodegURL()
51
- {
52
- $redtURL = 'https://api.instagram.com/oauth/authorize/';
53
- global $insgalleryIAC;
54
- $red_uri = urlencode(igf_getIGRedURI());
55
- $redtURL .= "?client_id={$insgalleryIAC ['client_id']}&response_type=code&scope=public_content&redirect_uri={$red_uri}";
56
- return $redtURL;
57
- }
58
-
59
- // generate code generation url
60
- function igf_getIGRedURI()
61
- {
62
- return admin_url('options-general.php?page=insta_gallery&igigresponse=1');
63
- }
64
-
65
- // return profile info
66
- function igf_getUserProfileInfo()
67
- {
68
- $profileInfo = false;
69
- global $insgalleryIAC, $iispi;
70
- $tk = 'instagallery_user_profile_info';
71
-
72
- if (false === ($profileInfo = get_transient($tk))) {
73
- $profileInfo = $iispi->getUserProfileInfo($insgalleryIAC['access_token']);
74
- if (! empty($profileInfo)) {
75
- set_transient($tk, $profileInfo, HOUR_IN_SECONDS);
76
- }
77
- }
78
- return $profileInfo;
79
- }
80
-
81
- // get user feed
82
- function igf_getUserItems($IGItem)
83
- {
84
- $instaItems = '';
85
- $limit = empty($IGItem['insta_user-limit']) ? 12 : (int) $IGItem['insta_user-limit'];
86
- global $insgalleryIAC, $iispi;
87
-
88
- if (empty($insgalleryIAC['access_token'])) {
89
- return '';
90
- }
91
- $tk = 'instagallery_user_feed'; // transient key
92
- $tkart = $tk . '_artimeout'; // transient key admin request timeout
93
- if (current_user_can('administrator') && (false === get_transient($tkart))) {
94
- $instaItems = $iispi->getUserMedia($insgalleryIAC['access_token'], $limit);
95
- if (! empty($instaItems)) {
96
- set_transient($tk, $instaItems, 2 * HOUR_IN_SECONDS);
97
- set_transient($tkart, true, 5 * MINUTE_IN_SECONDS);
98
- }
99
- } else {
100
- // Get any existing copy of our transient data
101
- if (false === ($instaItems = get_transient($tk))) {
102
- $instaItems = $iispi->getUserMedia($insgalleryIAC['access_token'], $limit);
103
- if (! empty($instaItems)) {
104
- set_transient($tk, $instaItems, 2 * HOUR_IN_SECONDS);
105
- }
106
- }
107
- }
108
-
109
- return $instaItems;
110
- }
111
-
112
- // get Tag Items
113
- function igf_getTagItems($IGItem)
114
- {
115
- $instaItems = '';
116
- global $insgalleryIAC, $iispi;
117
-
118
- if (empty($IGItem['insta_tag'])) {
119
- return '';
120
- }
121
- $tk = 'instagallery_tag_' . $IGItem['insta_tag']; // transient key
122
- $tkart = $tk . '_artimeout'; // transient key admin request timeout
123
- if (current_user_can('administrator') && (false === get_transient($tkart))) {
124
- $instaItems = $iispi->getTagItems($IGItem['insta_tag']);
125
- if (! empty($instaItems)) {
126
- set_transient($tk, $instaItems, 2 * HOUR_IN_SECONDS);
127
- set_transient($tkart, true, 5 * MINUTE_IN_SECONDS);
128
- }
129
- } else {
130
- // Get any existing copy of our transient data
131
- if (false === ($instaItems = get_transient($tk))) {
132
- $instaItems = $iispi->getTagItems($IGItem['insta_tag']);
133
- if (! empty($instaItems)) {
134
- set_transient($tk, $instaItems, 2 * HOUR_IN_SECONDS);
135
- }
136
- }
137
- }
138
-
139
- return $instaItems;
140
- }
141
- // --------------------------------------------------
142
- igf_initIAC();
143
- include_once (INSGALLERY_PATH . 'app/inc/IGIASpi.php');
144
- $iispi = new IGIASpi();
app/views/account.php DELETED
@@ -1,250 +0,0 @@
1
- <?php
2
- if (! defined('ABSPATH')) {
3
- die();
4
- }
5
-
6
- global $insgalleryIAC;
7
- // $insgalleryIAC['access_token'] = '12hfjhdsurybbjdjsudydsghgh';
8
-
9
- ?>
10
-
11
- <div class="ig-account-section">
12
- <header>
13
- <h3>
14
- <?php _e('Instagram account connection','insta-gallery'); ?> &nbsp; &nbsp; &nbsp; <a
15
- href="<?php echo INSGALLERY_URL_ADMIN_PAGE; ?>&tab=documentation" target="_blank" class="button-link" style="font-size: 14px;"><?php _e('How to connect?','insta-gallery'); ?></a>
16
- </h3>
17
- </header>
18
- <?php
19
- if(isset($_GET['code']) && isset($_GET['igigresponse'])){
20
- global $iispi;
21
- $msg = $iispi->getMessage();
22
- if(!empty($msg)){ ?>
23
- <div class="notice notice-warning">
24
- <p><strong><?php echo $msg; ?></strong></p>
25
- </div>
26
- <?php }
27
- }
28
- ?>
29
- <?php if(empty($insgalleryIAC['access_token'])): ?>
30
- <?php
31
- $ig_client_id = empty($insgalleryIAC['client_id']) ? '' : $insgalleryIAC['client_id'];
32
- $ig_client_secret = empty($insgalleryIAC['client_secret']) ? '' : $insgalleryIAC['client_secret'];
33
- ?>
34
- <div class="notice notice-warning">
35
- <p>
36
- <?php _e('No Instagram account connected. please connect an account with the website to access Instagram feed.','insta-gallery'); ?><br /> <strong
37
- style="font-style: italic;"><?php _e('valid Instagram access token is required to connect.','insta-gallery'); ?></strong>
38
- </p>
39
- </div>
40
-
41
- <div class="ig-account-cards">
42
- <form method="post" class="ig-account-card" id="ig-generate-token">
43
- <h4>Generate new access token.</h4>
44
- <p class="field-item">
45
- <input name="ig_client_id" type="text" maxlength="200" placeholder="Instagram Client ID" value="<?php echo $ig_client_id; ?>" required />
46
- </p>
47
- <p class="field-item">
48
- <input name="ig_client_secret" type="text" maxlength="200" placeholder="Instagram Client Secret" value="<?php echo $ig_client_secret; ?>" required />
49
- </p>
50
- <button type="submit" class="button button-primary">Generate Token</button>
51
- <input type="hidden" name="action" value="igara_generate_token" /> <input type="hidden" name="ig_nonce"
52
- value="<?php echo wp_create_nonce( 'igfreq_nonce_key' ); ?>" />
53
- <div class="igf-response"></div>
54
- <p>
55
- <a href="<?php echo INSGALLERY_URL_ADMIN_PAGE; ?>&tab=documentation" target="_blank" class="button-link" style="font-size: 14px;"><?php _e('click here','insta-gallery'); ?></a>
56
- for instructions on how to generate these credentials.
57
- </p>
58
- </form>
59
- <form method="post" class="ig-account-card" id="ig-update-token">
60
- <h4>Already have access token?</h4>
61
- <p class="field-item">
62
- <input name="ig_access_token" type="text" maxlength="200" placeholder="Enter a valid Access Token" required />
63
- </p>
64
- <button type="submit" class="button button-primary">Update Token</button>
65
- <div class="igf-response"></div>
66
- <input type="hidden" name="action" value="igara_update_token" /> <input type="hidden" name="ig_nonce"
67
- value="<?php echo wp_create_nonce( 'igfreq_nonce_key' ); ?>" />
68
- </form>
69
- </div>
70
- <?php endif; ?>
71
-
72
- <?php if(!empty($insgalleryIAC['access_token'])): ?>
73
- <div class="ig-account-cards ig-ac-have-token">
74
- <?php
75
- $token = filter_var($insgalleryIAC['access_token'], FILTER_SANITIZE_STRING);
76
- global $iispi;
77
- $profileInfo = igf_getUserProfileInfo();
78
- ?>
79
- <div class="ig-account-card">
80
- <?php if($profileInfo): ?>
81
- <figure>
82
- <img src="<?php echo $profileInfo['profile_picture']; ?>" width="150" />
83
- <figcaption>
84
- <strong style="color: #e23565;">Connected: </strong> <?php echo $profileInfo['full_name']; ?></figcaption>
85
- </figure>
86
- <?php else : ?>
87
- <?php $msg = $iispi->getMessage();
88
- if(!empty($msg)){ ?>
89
- <div class="notice notice-warning">
90
- <p><strong><?php echo $msg; ?></strong></p>
91
- </div>
92
- <?php } ?>
93
- <?php endif; ?>
94
- <div style="text-align: center;">
95
- <button type="submit" data-igtoggle="#ig-remove-token" class="button">Disconnect</button>
96
- </div>
97
- </div>
98
- <form method="post" class="ig-account-card" id="ig-remove-token">
99
- <p class="field-item">
100
- <label>Active access token:</label> <input name="ig_access_token" type="text" maxlength="200"
101
- value="x x x x x x <?php echo substr($token,-10); ?>" readonly />
102
- </p>
103
- <button type="submit" class="button button-primary">Remove Token</button>
104
- <span class="igf-response"></span> <input type="hidden" name="action" value="igara_remove_token" /> <input type="hidden" name="ig_nonce"
105
- value="<?php echo wp_create_nonce( 'igfreq_nonce_key' ); ?>" />
106
-
107
- <p>
108
- note: it will remove <strong>access token</strong> and <strong>client secret</strong>.
109
- </p>
110
- <p>
111
- you can also Login to <a href="https://www.instagram.com/developer/clients/manage/" rel="noreferrer nofollow noopener"
112
- target="_blank">Instagram Developer Web page</a> and can delete the registered App.
113
- </p>
114
- </form>
115
- </div>
116
- <?php endif; ?>
117
-
118
- </div>
119
- <hr />
120
-
121
-
122
- <script>
123
- jQuery(function($){
124
- // update Token handling
125
- $('#ig-update-token').on('submit',function(ev){
126
- ev.preventDefault();
127
- $f = $(this);
128
- var $fresponse = $f.find('.igf-response');
129
- var spinner = '<span class="spinner" style="float: none; margin: 0 3px; visibility: visible;"></span>';
130
- jQuery.ajax({
131
- url : ajaxurl,
132
- type : 'post',
133
- dataType: 'JSON',
134
- data : $f.serialize(),
135
- beforeSend : function()
136
- {
137
- $fresponse.html(spinner);
138
- },
139
- success : function( response ) {
140
- if ((typeof response === 'object') && response.hasOwnProperty('success')) {
141
- $fresponse.html(response.data);
142
- if(response.success){
143
- setTimeout(function(){
144
- window.location.href = window.location.href;
145
- },3000);
146
- }
147
- }else{
148
- $fresponse.html('invalid response.');
149
- }
150
- }
151
- }).fail(function (jqXHR, textStatus) {
152
- console.log(textStatus);
153
- }).always(function()
154
- {
155
- if($fresponse.find('.spinner').length){
156
- $fresponse.empty();
157
- }
158
- });
159
- });
160
-
161
- // generate Token handling
162
- $('#ig-generate-token').on('submit',function(ev){
163
- ev.preventDefault();
164
- $f = $(this);
165
- var $fresponse = $f.find('.igf-response');
166
- var spinner = '<span class="spinner" style="float: none; margin: 0 3px; visibility: visible;"></span>';
167
- jQuery.ajax({
168
- url : ajaxurl,
169
- type : 'post',
170
- dataType: 'JSON',
171
- data : $f.serialize(),
172
- beforeSend : function()
173
- {
174
- $fresponse.html(spinner);
175
- },
176
- success : function( response ) {
177
- if ((typeof response === 'object') && response.hasOwnProperty('success')) {
178
-
179
- if(response.success){
180
- window.location.href = response.data;
181
- //$fresponse.html(response.data);
182
- }else{
183
- $fresponse.html(response.data);
184
- }
185
- }else{
186
- $fresponse.html('invalid response.');
187
- }
188
- }
189
- }).fail(function (jqXHR, textStatus) {
190
- console.log(textStatus);
191
- }).always(function()
192
- {
193
- if($fresponse.find('.spinner').length){
194
- $fresponse.empty();
195
- }
196
- });
197
- });
198
-
199
- // remove Token handling
200
- $('#ig-remove-token').on('submit',function(ev){
201
- ev.preventDefault();
202
- var c = confirm('<?php _e('Are you sure want to delete this Token?','insta-gallery'); ?>');
203
- if(!c){
204
- return false;
205
- }
206
- $f = $(this);
207
- var $fresponse = $f.find('.igf-response');
208
- var spinner = '<span class="spinner" style="float: none; margin: 0 3px; visibility: visible;"></span>';
209
- jQuery.ajax({
210
- url : ajaxurl,
211
- type : 'post',
212
- dataType: 'JSON',
213
- data : $f.serialize(),
214
- beforeSend : function()
215
- {
216
- $fresponse.html(spinner);
217
- },
218
- success : function( response ) {
219
- if ((typeof response === 'object') && response.hasOwnProperty('success')) {
220
- $fresponse.html(response.data);
221
- if(response.success){
222
- setTimeout(function(){
223
- window.location.href = window.location.href;
224
- },3000);
225
- }
226
- }else{
227
- $fresponse.html('invalid response.');
228
- }
229
- }
230
- }).fail(function (jqXHR, textStatus) {
231
- console.log(textStatus);
232
- }).always(function()
233
- {
234
- if($fresponse.find('.spinner').length){
235
- $fresponse.empty();
236
- }
237
- });
238
- });
239
-
240
- // toggler
241
- jQuery('[data-igtoggle]').on('click',function(ev){
242
- var $e = $(this);
243
- var target = $e.data('igtoggle');
244
- if($(target).length){
245
- ev.preventDefault();
246
- $(target).fadeToggle();
247
- }
248
- });
249
- });
250
- </script>
app/views/documentation.php DELETED
@@ -1,145 +0,0 @@
1
-
2
- <header class="ig-doc-header">
3
- <h3>
4
- How to Get Instagram API Credentials: <a href="#TB_inline?&width=920&height=600&inlineId=ig-ahcreds" class="thickbox" style="font-size: 75%;">(i
5
- already have API credentials)</a>
6
- </h3>
7
- <p>
8
- To fetch Instagram feed you have to pass <strong>access token</strong> to Instagram. And access token can be generated using Instagram API (which
9
- need to register an Application). So please register Instagram Gallery plugin to access feed, which requires authentication. <strong><a
10
- href="https://www.instagram.com/developer/" title="Instagram Developer Documentation" target="_blank" rel="noreferrer nofollow noopener">Read More</a></strong>
11
- </p>
12
- <p>
13
- Please follow the below steps carefully to get API Credentials. Let’s go!<br />
14
- </p>
15
- </header>
16
- <div class="notice notice-info is-dismissible"><p>if you are facing any issue while generating access token, then you can take help from <a href="https://www.google.co.in/search?q=how+to+generate+instagram+access+token&amp;ie=UTF-8&amp;oe=UTF-8" title="Google search for Instagram access token" target="_blank" rel="noreferrer nofollow noopener">Internet</a>. there are lots of videos and articles available there.</p></div>
17
- <div id="ig-ahcreds" style="display: none;">
18
- <h4>
19
- if you already have API credentials and already registerd an Application, but <strong>access token</strong> is not generated,<br /> then you can use
20
- same credentials by following the simple steps below:
21
- </h4>
22
- <ol>
23
- <li>Login to <a href="https://www.instagram.com/developer/" target="_blank" rel="noreferrer nofollow noopener">Instagram developer web page</a></li>
24
- <li>goto <strong>Manage Clients</strong> section.
25
- </li>
26
- <li>click <strong>Manage</strong> button within specific client.
27
- </li>
28
- <li>click <strong>Security</strong> tab within the opened client.
29
- </li>
30
- <li>and add the below <strong>redirect URI</strong> within the <strong>Valid redirect URIs:</strong> field.
31
- </li>
32
- </ol>
33
- <p>
34
- <label ><strong>Redirect URI</strong>: <input type="url" onclick="select();document.execCommand('copy');alert('copied');" title="click to copy" value="<?php echo igf_getIGRedURI(); ?>"
35
- class="ig-doc-red-url" readonly /></label>
36
- </p>
37
- <hr />
38
- <figure class="ig-doc-figure">
39
- <img src="<?php echo INSGALLERY_URL; ?>/assets/media/ig-hdp-p1.png" />
40
- </figure>
41
- </div>
42
- <div class="ig-doc-body">
43
- <article>
44
- <h3>
45
- <span>Step 1:</span> Sign in Instargam as a developer.
46
- </h3>
47
- <p>
48
- You have to register as a developer in Instagram to receive <b>Client ID</b> and <b>Client Secret</b>. That’s why please follow the link to the <a
49
- href="https://www.instagram.com/developer/" target="_blank" rel="noreferrer nofollow noopener">Instagram developer web page</a> and Login to your
50
- account.
51
- </p>
52
- <figure>
53
- <img src="<?php echo INSGALLERY_URL; ?>/assets/media/ig-hdp-1.png" />
54
- </figure>
55
- <p>
56
- After login click on <strong>Register Your Application</strong> button to continue.
57
- </p>
58
- <figure>
59
- <img src="<?php echo INSGALLERY_URL; ?>/assets/media/ig-hdp-2.jpg" />
60
- </figure>
61
- </article>
62
- <article>
63
- <h3>
64
- <span>Step 2:</span> Fill in the Developer Signup Details.
65
- </h3>
66
- <p>Instagram demands to be registered as a developer from everyone, who wants to display Instagram feed on his website. After you log in the next
67
- window will appear.</p>
68
- <p>Fill-up all the fields on the web page:</p>
69
- <table>
70
- <tr>
71
- <th>Your website:</th>
72
- <td>the URL of your website.</td>
73
- </tr>
74
- <tr>
75
- <th>Phone number:</th>
76
- <td>your phone number.</td>
77
- </tr>
78
- <tr>
79
- <th>What do you want to build with API?</th>
80
- <td>any short description.</td>
81
- </tr>
82
- </table>
83
- <figure>
84
- <img src="<?php echo INSGALLERY_URL; ?>/assets/media/ig-hdp-3.png" />
85
- </figure>
86
- </article>
87
- <article>
88
- <h3>
89
- <span>Step 3:</span> Register your Application.
90
- </h3>
91
- <p>After Developer signup, Now you can register your Application.</p>
92
- <figure>
93
- <img src="<?php echo INSGALLERY_URL; ?>/assets/media/ig-hdp-4.png" />
94
- </figure>
95
- <h3>Register New Client ID</h3>
96
- <p>Check the fields on the web page:</p>
97
- <table>
98
- <tr>
99
- <th>Application name</th>
100
- <td>choose any appropriate name, which fits Instagram requirements.</td>
101
- </tr>
102
- <tr>
103
- <th>Description</th>
104
- <td>any short description.</td>
105
- </tr>
106
- <tr>
107
- <th>Company Name</th>
108
- <td>company/website name.</td>
109
- </tr>
110
- <tr>
111
- <th>Website URL</th>
112
- <td>your website url e.g. <strong><?php echo home_url(); ?></strong></td>
113
- </tr>
114
- <tr>
115
- <th>Valid redirect URIs</th>
116
- <td>have to be <input type="url" onclick="select();document.execCommand('copy');alert('copied');" title="click to copy"
117
- value="<?php echo igf_getIGRedURI(); ?>" class="ig-doc-red-url" readonly /><br /> <strong
118
- style="color: #e93b59; font-size: 15px; line-height: normal; font-style: italic;">(note that you should set the redirect link exactly the same
119
- displayed here.)</strong></td>
120
- </tr>
121
- <tr>
122
- <th>Privacy Policy URL</th>
123
- <td>your website url e.g. <strong><?php echo home_url(); ?></strong></td>
124
- </tr>
125
- <tr>
126
- <th>Contact email</th>
127
- <td>your email address.</td>
128
- </tr>
129
- </table>
130
- <p>In the "Security" tab, leave the default settings ("Disable implicit OAuth" should be checked & "Enforce signed requests" should be unchecked).</p>
131
-
132
- <figure>
133
- <img src="<?php echo INSGALLERY_URL; ?>/assets/media/ig-hdp-5.png" />
134
- </figure>
135
- <p>Now confirm the filled details and proceed to the next page. Here you can see Instagram Client ID and Client Secret.</p>
136
- <figure>
137
- <img src="<?php echo INSGALLERY_URL; ?>/assets/media/ig-hdp-6.png" />
138
- </figure>
139
- <p>Copy the crendentials and go back to your Instagram Gallery plugin setting page and enter the generated crendentials to get Access Token.</p>
140
- <figure>
141
- <img src="<?php echo INSGALLERY_URL; ?>/assets/media/ig-hdp-7.png" />
142
- </figure>
143
- </article>
144
- </div>
145
- <footer> </footer>
app/views/edit.php DELETED
@@ -1,461 +0,0 @@
1
- <?php
2
- if (! defined('ABSPATH')) {
3
- die();
4
- }
5
- global $insgalleryIAC;
6
- $InstaGalleryItem = null;
7
- if (isset($_GET['ig_item']) && ! empty($_GET['ig_item'])) {
8
- $ig_item_id = (int) $_GET['ig_item'];
9
- $InstaGalleryItems = get_option('insta_gallery_items');
10
- if (isset($InstaGalleryItems[$ig_item_id])) {
11
- $InstaGalleryItem = $InstaGalleryItems[$ig_item_id];
12
- $InstaGalleryItem['ig_item_id'] = $ig_item_id;
13
- }
14
- }
15
-
16
- $active_username = true;
17
- $active_tag = false;
18
- if (isset($InstaGalleryItem['ig_select_from'])) {
19
- if ($InstaGalleryItem['ig_select_from'] != 'username') {
20
- $active_username = false;
21
- $active_tag = true;
22
- }
23
- }
24
-
25
- $active_gallery = true;
26
- $active_carousel = false;
27
- if (isset($InstaGalleryItem['ig_display_type'])) {
28
- if ($InstaGalleryItem['ig_display_type'] == 'carousel') {
29
- $active_gallery = false;
30
- $active_carousel = true;
31
- }
32
- }
33
-
34
- ?>
35
- <p>
36
- <a href="<?php echo INSGALLERY_URL_ADMIN_PAGE; ?>" title="<?php _e('View Galleries List','insta-gallery'); ?>" class="ig-btn"><span
37
- class="dashicons dashicons-arrow-left-alt"></span><?php _e('Back to List','insta-gallery'); ?></a>
38
- </p>
39
-
40
- <!-- Fix: Exifography plugin drag-n-drop rows issue -->
41
- <div class="form-table"></div>
42
-
43
- <div class="form-table"></div>
44
- <!-- Exifography sortable fix -->
45
- <form method="post" id="ig-form-update" action="<?php if(empty($InstaGalleryItem)) echo INSGALLERY_URL_ADMIN_PAGE; ?>">
46
- <table class="form-table ig-table-edit">
47
- <tbody>
48
- <tr>
49
- <th scope="row"><?php _e('Display Instagram Gallery from','insta-gallery'); ?>:</th>
50
- <td>
51
- <ul class="ig-list-buttons">
52
- <li><input type="radio" id="ig_select_from-username" name="ig_select_from" value="username" <?php if($active_username) echo 'checked';?> /><label
53
- for="ig_select_from-username"><?php _e('My Account','insta-gallery'); ?></label>
54
- <div class="check"></div></li>
55
- <li><input type="radio" id="ig_select_from-tag" name="ig_select_from" value="tag" <?php if($active_tag) echo 'checked';?> /> <label
56
- for="ig_select_from-tag"><?php _e('Tagname','insta-gallery'); ?></label>
57
- <div class="check"></div></li>
58
- </ul> <span class="description"> (<?php _e('Please select option to display pictures from Instagram Username OR # Tag.','insta-gallery'); ?>)</span>
59
-
60
- </td>
61
- </tr>
62
- <tr id="ig-select-username-wrap" class="ig-tab-content-row <?php if($active_username) echo 'active';?>">
63
- <td colspan="100%">
64
- <table>
65
- <tr>
66
- <th scope="row"><?php _e('Instagram Username','insta-gallery'); ?>:</th>
67
- <td>
68
- <?php if(empty($insgalleryIAC['access_token'])): ?>
69
- <p class="ig-thm-color">
70
- <strong><?php _e('No Instagram account connected. please connect an account with the website to access Instagram media.','insta-gallery'); ?></strong></strong>
71
- </p>
72
- <input name="insta_user" type="hidden" value="nousername" readonly />
73
- <?php
74
- else :
75
- $profileInfo = igf_getUserProfileInfo();
76
- $username = empty($profileInfo['username']) ? 'nousername' : $profileInfo['username'];
77
- ?>
78
- <input name="insta_user" type="text" placeholder="myusername" value="<?php echo $username; ?>" readonly /> <span class="description"></span>
79
- <p class="ig-generate-msgs"><?php _e('Please enter Instagram Username.','insta-gallery'); ?></p>
80
- <?php endif; ?>
81
- </td>
82
- </tr>
83
- <tr>
84
- <th scope="row"><?php _e('Pictures Limit','insta-gallery'); ?>:</th>
85
- <td><input name="insta_user-limit" type="number" min="1" max="50"
86
- value="<?php if(!empty($InstaGalleryItem['insta_user-limit'])){echo $InstaGalleryItem['insta_user-limit']; } else {echo '12'; }?>" /> <span
87
- class="description"><?php _e('number of pictures to display','insta-gallery'); ?></span></td>
88
- </tr>
89
- </table>
90
- </td>
91
- </tr>
92
- <tr id="ig-select-tag-wrap" class="ig-tab-content-row <?php if($active_tag) echo 'active';?>">
93
- <td colspan="100%">
94
- <table>
95
- <tr>
96
- <th scope="row"><?php _e('Instagram Tagname','insta-gallery'); ?>:</th>
97
- <td><input name="insta_tag" type="text" placeholder="beautiful"
98
- value="<?php if(!empty($InstaGalleryItem['insta_tag'])){echo $InstaGalleryItem['insta_tag']; }?>" /> <span class="description">e.g. <strong
99
- style="font-size: 120%; color: #e23565;">beautiful</strong><br /> <small>https://www.instagram.com/explore/tags/<strong
100
- style="font-size: 120%; color: #e23565;">beautiful</strong>/
101
- </small>
102
- </span>
103
- <p class="ig-generate-msgs"><?php _e('Please enter Instagram Tagname.','insta-gallery'); ?></p></td>
104
- </tr>
105
- <tr>
106
- <th scope="row"><?php _e('Pictures Limit','insta-gallery'); ?>:</th>
107
- <td><input name="insta_tag-limit" type="number" min="1" max="30"
108
- value="<?php if(!empty($InstaGalleryItem['insta_tag-limit'])){echo $InstaGalleryItem['insta_tag-limit']; } else {echo '12'; }?>" /> <span
109
- class="description"><?php _e('number of pictures to display.','insta-gallery'); ?></span></td>
110
- </tr>
111
- </table>
112
- </td>
113
- </tr>
114
- <tr>
115
- <th scope="row"><?php _e('Show As','insta-gallery'); ?>:</th>
116
- <td>
117
- <ul class="ig-list-buttons">
118
- <li><input type="radio" id="ig_display_type-gallery" name="ig_display_type" value="gallery" <?php if($active_gallery) echo 'checked';?> /><label
119
- for="ig_display_type-gallery"><?php _e('Gallery','insta-gallery'); ?></label>
120
- <div class="check"></div></li>
121
- <li><input type="radio" id="ig_display_type-carousel" name="ig_display_type" value="carousel" <?php if($active_carousel) echo 'checked';?> /><label
122
- for="ig_display_type-carousel"><?php _e('Carousel','insta-gallery'); ?></label>
123
- <div class="check"></div></li>
124
- </ul>
125
- </td>
126
- </tr>
127
- <tr id="ig-section-as-galllery" class="ig-tab-content-row <?php if($active_gallery) echo 'active';?>">
128
- <td colspan="100%">
129
- <p>
130
- <strong><?php _e('Pictures will be displayed as Grid.','insta-gallery'); ?></strong>
131
- </p>
132
- <table>
133
- <tr>
134
- <th scope="row"><?php _e('No. of Grid Columns','insta-gallery'); ?>:</th>
135
- <td><input name="insta_gal-cols" type="number" min="1" max="20"
136
- value="<?php if(!empty($InstaGalleryItem['insta_gal-cols'])){echo $InstaGalleryItem['insta_gal-cols']; } else {echo 3;}?>" /> <span
137
- class="description"><?php _e('number of pictures in a row','insta-gallery'); ?>. </span></td>
138
- <td rowspan="3"><img src="<?php echo INSGALLERY_URL; ?>/assets/media/demo-gallery.jpg" alt="demo gallery" width="500" /></td>
139
- </tr>
140
- <tr>
141
- <th scope="row"><?php _e('Image hover effect','insta-gallery'); ?>:</th>
142
- <td><input name="insta_gal-hover" type="checkbox" value="1"
143
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_gal-hover'])) ? '' : 'checked'; ?> /> <span class="description"><?php _e('mouseover animation effect on image','insta-gallery'); ?> </span></td>
144
- </tr>
145
- <tr>
146
- <th scope="row"><?php _e('Space between images','insta-gallery'); ?>:</th>
147
- <td><input name="insta_gal-spacing" type="checkbox" value="1"
148
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_gal-spacing'])) ? '' : 'checked'; ?> /> <span class="description"><?php _e('add blank space between images','insta-gallery'); ?> </span></td>
149
- </tr>
150
- </table>
151
- </td>
152
- </tr>
153
- <tr id="ig-section-as-carousel" class="ig-tab-content-row <?php if($active_carousel) echo 'active';?>">
154
- <td colspan="100%">
155
- <p>
156
- <strong><?php _e('Pictures will be displayed as Carousel slider.','insta-gallery'); ?></strong>
157
- </p>
158
- <table>
159
- <tr>
160
- <th scope="row"><?php _e('Slides per view','insta-gallery'); ?>:</th>
161
- <td><input name="insta_car-slidespv" type="number" min="1" max="10"
162
- value="<?php if(!empty($InstaGalleryItem['insta_car-slidespv'])){echo $InstaGalleryItem['insta_car-slidespv']; } else {echo 5;}?>" /> <span
163
- class="description"><?php _e('display number of pictures per slide view.','insta-gallery'); ?> </span></td>
164
- <td rowspan="5"><img src="<?php echo INSGALLERY_URL; ?>/assets/media/demo-carousel.jpg" alt="demo carousel" width="500" /></td>
165
- </tr>
166
- <tr>
167
- <th scope="row"><?php _e('Autoplay','insta-gallery'); ?>:</th>
168
- <td><input name="insta_car-autoplay" type="checkbox" value="1"
169
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_car-autoplay'])) ? '' : 'checked'; ?> /> <span class="description"><?php _e('autoplay carousel items.','insta-gallery'); ?> </span></td>
170
- </tr>
171
- <tr>
172
- <th scope="row"><?php _e('Autoplay Interval','insta-gallery'); ?>:</th>
173
- <td><input name="insta_car-autoplay-interval" type="number" min="1000" max="300000" step="100"
174
- value="<?php if(!empty($InstaGalleryItem['insta_car-autoplay-interval'])){echo $InstaGalleryItem['insta_car-autoplay-interval']; } else {echo 3000;}?>" />
175
- <span class="description"><?php _e('moves to next picture after specified time interval.','insta-gallery'); ?> <br />( <span
176
- class="ig-thm-color"><?php _e('Interval is in milliseconds','insta-gallery'); ?>
177
- </span> ) </span></td>
178
- </tr>
179
- <tr>
180
- <th scope="row"><?php _e('Navigation arrows','insta-gallery'); ?>:</th>
181
- <td><input name="insta_car-navarrows" type="checkbox" value="1"
182
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_car-navarrows'])) ? '' : 'checked'; ?> /> <span class="description"><?php _e('show prev-next navigation arrows.','insta-gallery'); ?> </span></td>
183
- </tr>
184
- <tr>
185
- <th scope="row"><?php _e('Navigation arrows color','insta-gallery'); ?>:</th>
186
- <td><input id="insta_car-navarrows-color-choose" type="color"
187
- value="<?php echo (!empty($InstaGalleryItem['insta_car-navarrows-color']) ? $InstaGalleryItem['insta_car-navarrows-color'] : '#c32a67'); ?>" />
188
- <input name="insta_car-navarrows-color" type="text" placeholder="#c32a67"
189
- value="<?php echo (!empty($InstaGalleryItem['insta_car-navarrows-color']) ? $InstaGalleryItem['insta_car-navarrows-color'] : ''); ?>" /> <span
190
- class="description"><?php _e('change navigation arrows color here.','insta-gallery'); ?></span></td>
191
- </tr>
192
-
193
-
194
- <!--
195
- <tr>
196
- <th scope="row"><?php _e('Dotted navigation','insta-gallery'); ?>:</th>
197
- <td><input name="insta_car-dots" type="checkbox" value="1" <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_car-dots'])) ? '' : 'checked'; ?> /> <span
198
- class="description"><?php _e('show dotted navigation buttons.','insta-gallery'); ?><br />( <span class="ig-thm-color"><strong><?php
199
- _e('Deprecated: this option will be removed in the future updates.', 'insta-gallery');
200
- ?></strong></span> )</span></td>
201
- </tr>
202
- -->
203
-
204
-
205
- <tr>
206
- <th scope="row"><?php _e('Space between slides','insta-gallery'); ?>:</th>
207
- <td><input name="insta_car-spacing" type="checkbox" value="1"
208
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_car-spacing'])) ? '' : 'checked'; ?> /> <span class="description"><?php _e('add blank space between carousel items.','insta-gallery'); ?> </span></td>
209
- </tr>
210
- </table>
211
- </td>
212
- </tr>
213
- <tr>
214
- <th scope="row"><?php _e('Images thumbnail size','insta-gallery'); ?>:</th>
215
- <td><select name="insta_thumb-size">
216
- <option value="standard"><?php _e('Standard','insta-gallery'); ?> (640 x auto)</option>
217
- <option value="medium" <?php echo (isset($InstaGalleryItem['insta_thumb-size']) && ($InstaGalleryItem['insta_thumb-size'] == 'medium')) ? 'selected' : ''; ?>><?php _e('Medium','insta-gallery'); ?> (320 x auto)</option>
218
- <option value="small"
219
- <?php echo (isset($InstaGalleryItem['insta_thumb-size']) && ($InstaGalleryItem['insta_thumb-size'] == 'small')) ? 'selected' : ''; ?>><?php _e('Small','insta-gallery'); ?> (150
220
- x 150)</option>
221
- </select></td>
222
- </tr>
223
- <tr>
224
- <th scope="row"><?php _e('Images hover effect color','insta-gallery'); ?>:</th>
225
- <td><input id="insta_hover-color-choose" type="color"
226
- value="<?php echo (!empty($InstaGalleryItem['insta_hover-color']) ? $InstaGalleryItem['insta_hover-color'] : '#007aff'); ?>" /> <input
227
- name="insta_hover-color" type="text" placeholder="#007aff"
228
- value="<?php echo (!empty($InstaGalleryItem['insta_hover-color']) ? $InstaGalleryItem['insta_hover-color'] : ''); ?>" /> <span
229
- class="description"><?php _e('select color which is displayed when hovered over images.','insta-gallery'); ?><br />( <span class="ig-thm-color"><?php _e('color name should be in Hexadecimal notation. e.g. #dddddd','insta-gallery'); ?>
230
- </span> ) </span></td>
231
- </tr>
232
- <tr>
233
- <th scope="row"><?php _e('Popup images on click','insta-gallery'); ?>:</th>
234
- <td><input name="insta_gal-popup" type="checkbox" value="1"
235
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_gal-popup'])) ? '' : 'checked'; ?> /> <span class="description"><?php _e('show popup gallery by clicking on image thumbnail. else it will open Instagram page.','insta-gallery'); ?> <br />(
236
- <span class="ig-thm-color"><?php
237
- _e('uncheck this if it conflicts with other plugins, like: fancybox, prettyphoto, elementor etc.', 'insta-gallery');
238
- ?></span> ) </span></td>
239
- </tr>
240
- <tr hidden>
241
- <th scope="row"><?php _e('Display image caption','insta-gallery'); ?>:</th>
242
- <td><input name="insta_popup-caption" type="checkbox" readonly value="1"
243
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_popup-caption'])) ? '' : 'checked'; ?> /> <span class="description"><?php _e('Display caption/tags below images when popup.','insta-gallery'); ?><br />(
244
- <span class="ig-thm-color"><strong><?php
245
- _e('Deprecated: this option will be removed in the future updates.', 'insta-gallery');
246
- ?></strong></span> ) </span></td>
247
- </tr>
248
- <tr>
249
- <th scope="row"><?php _e('Display Likes','insta-gallery'); ?>:</th>
250
- <td><input name="insta_likes" type="checkbox" value="1"
251
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_likes'])) ? '' : 'checked'; ?> /> <span class="description"><?php _e('display likes count of images.','insta-gallery'); ?> </span></td>
252
- </tr>
253
- <tr>
254
- <th scope="row"><?php _e('Display Comments','insta-gallery'); ?>:</th>
255
- <td><input name="insta_comments" type="checkbox" value="1"
256
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_comments'])) ? '' : 'checked'; ?> /> <span class="description"><?php _e('display comments count of images.','insta-gallery'); ?> </span></td>
257
- </tr>
258
- <tr>
259
- <th scope="row"><?php _e('Display Instagram Link Button','insta-gallery'); ?>:</th>
260
- <td><input name="insta_instalink" type="checkbox" value="1"
261
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_instalink'])) ? '' : 'checked'; ?> /> <span class="description"><?php _e('show the button to open Instagram site link','insta-gallery'); ?> </span></td>
262
- </tr>
263
- <tr id="ig-section-igbtn"
264
- class="ig-tab-content-row <?php if(isset($InstaGalleryItem) && !empty($InstaGalleryItem['insta_instalink'])) echo 'active';?>">
265
- <td colspan="100%">
266
- <table>
267
- <tr>
268
- <th scope="row"><?php _e('Instagram Button Text','insta-gallery'); ?>:</th>
269
- <td><input name="insta_instalink-text" type="text" placeholder="view on Instagram"
270
- value="<?php if(!empty($InstaGalleryItem['insta_instalink-text'])){echo $InstaGalleryItem['insta_instalink-text']; }?>" /> <span
271
- class="description"><?php _e('update Instagram button text here.','insta-gallery'); ?></span></td>
272
- </tr>
273
- <tr>
274
- <th scope="row"><?php _e('Button Background Color','insta-gallery'); ?>:</th>
275
- <td><input id="insta_instalink-bgcolor-choose" type="color"
276
- value="<?php echo (!empty($InstaGalleryItem['insta_instalink-bgcolor']) ? $InstaGalleryItem['insta_instalink-bgcolor'] : '#c32a67'); ?>" /> <input
277
- name="insta_instalink-bgcolor" type="text" placeholder="#c32a67"
278
- value="<?php echo (!empty($InstaGalleryItem['insta_instalink-bgcolor']) ? $InstaGalleryItem['insta_instalink-bgcolor'] : ''); ?>" /> <span
279
- class="description"><?php _e('color which is displayed on button background.','insta-gallery'); ?></span></td>
280
- </tr>
281
- <tr>
282
- <th scope="row"><?php _e('Button Hover Color','insta-gallery'); ?>:</th>
283
- <td><input id="insta_instalink-hvrcolor-choose" type="color"
284
- value="<?php echo (!empty($InstaGalleryItem['insta_instalink-hvrcolor']) ? $InstaGalleryItem['insta_instalink-hvrcolor'] : '#da894a'); ?>" />
285
- <input name="insta_instalink-hvrcolor" type="text" placeholder="#da894a"
286
- value="<?php echo (!empty($InstaGalleryItem['insta_instalink-hvrcolor']) ? $InstaGalleryItem['insta_instalink-hvrcolor'] : ''); ?>" /> <span
287
- class="description"><?php _e('color which is displayed when hovered over button.','insta-gallery'); ?></span></td>
288
- </tr>
289
- </table>
290
- </td>
291
- </tr>
292
- </tbody>
293
- </table>
294
- <div>
295
- <button class="button-primary ig-add-update" type="submit">
296
- <?php _e('Update','insta-gallery'); ?>
297
- </button>
298
- <p class="description"><?php _e('update settings and copy/paste generated shortcode in your post/pages or goto Widgets and use Instagram Gallery widget.','insta-gallery'); ?></p>
299
- </div>
300
- <input type="hidden" name="ig-form-update" value="true" />
301
- <input type="hidden" name="ig_nonce" value="<?php echo wp_create_nonce( 'igfreq_nonce_key' ); ?>" />
302
- <?php if(!empty($InstaGalleryItem['ig_item_id'])) {?>
303
- <input type="hidden" name="igitem_id" value="<?php echo $InstaGalleryItem['ig_item_id']; ?>" />
304
- <?php } ?>
305
- </form>
306
- <script>
307
- jQuery(document).ready(function($){
308
- // by username/tag toggle
309
- $('input[name="ig_select_from"]').on('change',function(){
310
- if(this.value == 'username'){
311
- $('#ig-select-tag-wrap').hide(500, function() {
312
- $('#ig-select-username-wrap').show( ).addClass('active');
313
- }).removeClass('active');
314
- }else{
315
- $('#ig-select-username-wrap').hide(500, function() {
316
- $('#ig-select-tag-wrap').show( ).addClass('active');
317
- }).removeClass('active');
318
- }
319
- });
320
-
321
- // gallery, carousel toggle
322
- $('input[name="ig_display_type"]').on('change',function(){
323
-
324
- if(this.value == 'gallery'){
325
- $('#ig-section-as-carousel').hide(500, function() {
326
- $('#ig-section-as-galllery').show( ).addClass('active');
327
- }).removeClass('active');
328
- }else if(this.value == 'carousel'){
329
- $('#ig-section-as-galllery').hide(500, function() {
330
- $('#ig-section-as-carousel').show( ).addClass('active');
331
- }).removeClass('active');
332
- }
333
-
334
- });
335
-
336
- $('#ig-form-update').on('submit',function(ev){
337
- var select_from = $('input[name="ig_select_from"]:checked').val();
338
- var $insta_user = $('input[name="insta_user"]');
339
- var $insta_tag = $('input[name="insta_tag"]');
340
- var valid = true;
341
- if(select_from == 'username'){
342
- if($insta_user.val() == ''){
343
- valid = false;
344
- $('#ig-select-username-wrap').addClass('error');
345
- }else{
346
- if ($insta_user.val().indexOf("instagram.com/") >= 0){
347
- alert('Please enter username only(e.g. myusername), do not enter the complete url.');
348
- $insta_user.focus();
349
- return false;
350
- }
351
- }
352
- }else if(select_from == 'tag'){
353
- if($insta_tag.val() == ''){
354
- valid = false;
355
- $('#ig-select-tag-wrap').addClass('error');
356
- }else{
357
- if ($insta_tag.val().indexOf("instagram.com/") >= 0){
358
- alert('Please enter tagname only(e.g. beautiful), do not enter the complete url.');
359
- $insta_tag.focus();
360
- return false;
361
- }
362
- }
363
- }
364
- if( !valid ){
365
-
366
- setTimeout(function(){$('#ig-select-tag-wrap,#ig-select-username-wrap').removeClass('error');},5000);
367
- $('html, body').animate({
368
- scrollTop: 100
369
- }, 500);
370
- ev.preventDefault();
371
- return false;
372
- }
373
- });
374
-
375
- // gallery color sync
376
- $('#insta_hover-color-choose').on('change',function(){
377
- $('input[name="insta_hover-color"]').val($(this).val());
378
- });
379
- $('input[name="insta_hover-color"]').on('change',function(){
380
- var hvcolor = $(this).val();
381
- if(hvcolor != ''){
382
- var isOk = /^#[0-9A-F]{6}#x2F;i.test(hvcolor);
383
- if(!isOk){
384
- alert('please enter valid color code');
385
- $(this).val('');
386
- return;
387
- }
388
- $('#insta_hover-color-choose').val($(this).val());
389
- }else {
390
- $('#insta_hover-color-choose').val('#007aff');
391
- }
392
- });
393
-
394
- // instagram link button toggle
395
- $('input[name="insta_instalink"]').on('change',function(){
396
- if(this.checked){
397
- $('#ig-section-igbtn').show('slow').addClass('active');
398
- }else{
399
- $('#ig-section-igbtn').hide('slow').removeClass('active');
400
- }
401
- });
402
-
403
- // nav arrows color sync
404
- $('#insta_car-navarrows-color-choose').on('change',function(){
405
- $('input[name="insta_car-navarrows-color"]').val($(this).val());
406
- });
407
- $('input[name="insta_car-navarrows-color"]').on('change',function(){
408
- var hvcolor = $(this).val();
409
- if(hvcolor != ''){
410
- var isOk = /^#[0-9A-F]{6}#x2F;i.test(hvcolor);
411
- if(!isOk){
412
- alert('please enter valid color code');
413
- $(this).val('');
414
- return;
415
- }
416
- $('#insta_car-navarrows-color-choose').val($(this).val());
417
- }else {
418
- $('#insta_car-navarrows-color-choose').val('#c32a67');
419
- }
420
- });
421
-
422
-
423
- // button bgcolor sync
424
- $('#insta_instalink-bgcolor-choose').on('change',function(){
425
- $('input[name="insta_instalink-bgcolor"]').val($(this).val());
426
- });
427
- $('input[name="insta_instalink-bgcolor"]').on('change',function(){
428
- var hvcolor = $(this).val();
429
- if(hvcolor != ''){
430
- var isOk = /^#[0-9A-F]{6}#x2F;i.test(hvcolor);
431
- if(!isOk){
432
- alert('please enter valid color code');
433
- $(this).val('');
434
- return;
435
- }
436
- $('#insta_instalink-bgcolor-choose').val($(this).val());
437
- }else {
438
- $('#insta_instalink-bgcolor-choose').val('#c32a67');
439
- }
440
- });
441
-
442
- // button hover color sync
443
- $('#insta_instalink-hvrcolor-choose').on('change',function(){
444
- $('input[name="insta_instalink-hvrcolor"]').val($(this).val());
445
- });
446
- $('input[name="insta_instalink-hvrcolor"]').on('change',function(){
447
- var hvcolor = $(this).val();
448
- if(hvcolor != ''){
449
- var isOk = /^#[0-9A-F]{6}#x2F;i.test(hvcolor);
450
- if(!isOk){
451
- alert('please enter valid color code');
452
- $(this).val('');
453
- return;
454
- }
455
- $('#insta_instalink-hvrcolor-choose').val($(this).val());
456
- }else {
457
- $('#insta_instalink-hvrcolor-choose').val('#da894a');
458
- }
459
- });
460
- });
461
- </script>
app/views/list.php DELETED
@@ -1,288 +0,0 @@
1
- <?php
2
- if (! defined('ABSPATH')) {
3
- die();
4
- }
5
-
6
- $InstaGalleryItems = get_option('insta_gallery_items');
7
- $InstaGallerySetting = get_option('insta_gallery_setting');
8
- ?>
9
-
10
- <p>
11
- <a href="<?php echo INSGALLERY_URL_ADMIN_PAGE; ?>&tab=edit" title="<?php _e('Add New Gallery','insta-gallery'); ?>" class="ig-btn"><span
12
- class="dashicons dashicons-plus"></span><?php _e('Add New Gallery','insta-gallery'); ?></a>
13
- </p>
14
-
15
-
16
- <?php if( !empty($InstaGalleryItems) && is_array($InstaGalleryItems) ){ ?>
17
- <div>
18
- <table class="widefat ig-gallery-list">
19
- <thead>
20
- <tr>
21
- <th></th>
22
- <th><?php _e('Gallery Item','insta-gallery'); ?></th>
23
- <th><?php _e('Shortcode','insta-gallery'); ?></th>
24
- <th><?php _e('Action','insta-gallery'); ?></th>
25
- </tr>
26
- </thead>
27
- <tbody>
28
- <?php $i = 1; foreach($InstaGalleryItems as $k => $IGItem){ ?>
29
- <tr>
30
- <td><?php echo $i++; ?></td>
31
- <td>
32
- <?php
33
-
34
- if ($IGItem['ig_select_from'] == 'username') {
35
- echo __('Username', 'insta-gallery') . ' / ' . $IGItem['insta_user'];
36
- } else {
37
- echo __('Tagname', 'insta-gallery') . ' / ' . $IGItem['insta_tag'];
38
- }
39
- ?>
40
- </td>
41
- <td><input type="text" onclick="select()" value='[insta-gallery id="<?php echo $k; ?>"]' readonly /></td>
42
- <td><a href="<?php echo INSGALLERY_URL_ADMIN_PAGE; ?>&tab=edit&ig_item=<?php echo $k; ?>" class="ig-btn"><span class="dashicons dashicons-edit"></span><?php _e('Edit','insta-gallery'); ?> </a>
43
- <a href="<?php echo INSGALLERY_URL_ADMIN_PAGE; ?>&ig_item_delete=<?php echo $k; ?>" class="ig-btn" onclick="return ig_item_delete();"><span
44
- class="dashicons dashicons-trash"></span><?php _e('Delete','insta-gallery'); ?></a></td>
45
- </tr>
46
- <?php } unset($i); ?>
47
- </tbody>
48
- </table>
49
- </div>
50
- <br />
51
- <hr />
52
- <div id="ig_adv-setting-panel">
53
- <p>
54
- <button class="ig_adv-setting-toggle ig-btn">
55
- <span class="dashicons dashicons-plus"></span><span class="dashicons dashicons-minus"></span><?php _e('Additional Setting','insta-gallery'); ?>
56
- </button>
57
- </p>
58
- <div class="ig_adv-setting">
59
- <form method="post">
60
- <table class="widefat">
61
- <tbody>
62
- <tr>
63
- <th><?php _e('Gallery Loader Icon','insta-gallery'); ?>:</th>
64
- <td>
65
- <?php
66
- $mid = '';
67
- $misrc = '';
68
- if (isset($InstaGallerySetting['igs_spinner_image_id'])) {
69
- $mid = $InstaGallerySetting['igs_spinner_image_id'];
70
- $image = wp_get_attachment_image_src($mid);
71
- if ($image) {
72
- $misrc = $image[0];
73
- }
74
- }
75
- ?>
76
- <input type="hidden" name="igs_spinner_image_id" value="<?php echo $mid; ?>" data-misrc="<?php echo $misrc; ?>" />
77
- <button type='button' class="ig-btn" id="igs-spinner_media_manager" /><?php _e('Update Spinner','insta-gallery'); ?></button>
78
- <button type='button' class="ig-btn" id="igs-spinner_reset" /><?php _e('Reset Spinner','insta-gallery'); ?></button> <br /> <span
79
- class="description">
80
- <?php
81
- _e('please select the image from media to replace with default Gallery loader icon.', 'insta-gallery');
82
- ?> </span>
83
-
84
- </td>
85
- <td rowspan="2">
86
- <div class="ig-spinner">
87
- <svg version="1.1" class="ig-spin" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
88
- viewBox="0 0 551.034 551.034" style="enable-background: new 0 0 551.034 551.034;" xml:space="preserve">
89
- <g>
90
- <linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="275.517" y1="4.57" x2="275.517" y2="549.72"
91
- gradientTransform="matrix(1 0 0 -1 0 554)">
92
- <stop offset="0" style="stop-color:#E09B3D" />
93
- <stop offset="0.3" style="stop-color:#C74C4D" />
94
- <stop offset="0.6" style="stop-color:#C21975" />
95
- <stop offset="1" style="stop-color:#7024C4" />
96
- </linearGradient>
97
- <path style="fill:url(#SVGID_1_);"
98
- d="M386.878,0H164.156C73.64,0,0,73.64,0,164.156v222.722
99
- c0,90.516,73.64,164.156,164.156,164.156h222.722c90.516,0,164.156-73.64,164.156-164.156V164.156
100
- C551.033,73.64,477.393,0,386.878,0z M495.6,386.878c0,60.045-48.677,108.722-108.722,108.722H164.156
101
- c-60.045,0-108.722-48.677-108.722-108.722V164.156c0-60.046,48.677-108.722,108.722-108.722h222.722
102
- c60.045,0,108.722,48.676,108.722,108.722L495.6,386.878L495.6,386.878z" />
103
- <linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="275.517" y1="4.57" x2="275.517" y2="549.72"
104
- gradientTransform="matrix(1 0 0 -1 0 554)">
105
- <stop offset="0" style="stop-color:#E09B3D" />
106
- <stop offset="0.3" style="stop-color:#C74C4D" />
107
- <stop offset="0.6" style="stop-color:#C21975" />
108
- <stop offset="1" style="stop-color:#7024C4" />
109
- </linearGradient>
110
- <path style="fill:url(#SVGID_2_);"
111
- d="M275.517,133C196.933,133,133,196.933,133,275.516s63.933,142.517,142.517,142.517
112
- S418.034,354.1,418.034,275.516S354.101,133,275.517,133z M275.517,362.6c-48.095,0-87.083-38.988-87.083-87.083
113
- s38.989-87.083,87.083-87.083c48.095,0,87.083,38.988,87.083,87.083C362.6,323.611,323.611,362.6,275.517,362.6z" />
114
- <linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="418.31" y1="4.57" x2="418.31" y2="549.72"
115
- gradientTransform="matrix(1 0 0 -1 0 554)">
116
- <stop offset="0" style="stop-color:#E09B3D" />
117
- <stop offset="0.3" style="stop-color:#C74C4D" />
118
- <stop offset="0.6" style="stop-color:#C21975" />
119
- <stop offset="1" style="stop-color:#7024C4" />
120
- </linearGradient>
121
- <circle style="fill:url(#SVGID_3_);" cx="418.31" cy="134.07" r="34.15" />
122
- </g>
123
- </svg>
124
- </div>
125
- </td>
126
- </tr>
127
- <tr>
128
- <th><?php _e('Remove everything on uninstall','insta-gallery'); ?>:</th>
129
- <td><input type="checkbox" name="igs_flush" value="1" onclick="ig_validate_flush(this)"
130
- <?php if(!empty($InstaGallerySetting['igs_flush'])) echo 'checked';?> /><span class="description"> <?php _e('check this box to remove all data related to this plugin when removing the plugin.','insta-gallery'); ?> </span></td>
131
- </tr>
132
- </tbody>
133
- <tfoot>
134
- <tr>
135
- <td colspan="3"><button type="submit" class="ig-btn"><?php _e('Update','insta-gallery'); ?></button> <span class="igf-response"></span></td>
136
- </tr>
137
- </tfoot>
138
- </table>
139
- <input type="hidden" name="ig_nonce" value="<?php echo wp_create_nonce( 'igfreq_nonce_key' ); ?>" /> <input type="hidden" name="action"
140
- value="save_igadvs" />
141
- </form>
142
- </div>
143
- </div>
144
- <div class="ig_donation-wrap ig-thm-color">
145
- <p>
146
- <span class="ig_donation_text"><?php _e('Please Donate now to support the Maintainance and Advancement of this plugin.','insta-gallery'); ?>
147
- <br /><?php _e('Thank you so much to each and everyone who has already supported me.','insta-gallery'); ?></span> <a class="ig_donation_btn"
148
- href="https://www.paypal.me/karanpay" target="blank"><?php _e('Donate','insta-gallery'); ?>
149
- <img src="<?php echo INSGALLERY_URL; ?>/assets/media/paypal-logo.svg" class="ig-logo" /> </a>
150
- </p>
151
- </div>
152
- <?php } ?>
153
-
154
- <script>
155
- function ig_item_delete(){
156
- var c = confirm('<?php _e('Are you sure want to delete this item?','insta-gallery'); ?>');
157
- if(!c){
158
- return false;
159
- }
160
- }
161
- function ig_change_spinner(link){
162
- if(link){
163
- if(!jQuery('.ig_adv-setting .ig-spinner img').length){
164
- var img = '<img src="'+link+'" class="ig-spin" />';
165
- jQuery('.ig_adv-setting .ig-spinner').append(img);
166
- }else{
167
- jQuery('.ig_adv-setting .ig-spinner img').attr('src',link);
168
- }
169
- jQuery('.ig_adv-setting .ig-spinner .ig-spin').hide();
170
- jQuery('.ig_adv-setting .ig-spinner img').show();
171
- } else {
172
- jQuery('.ig_adv-setting .ig-spinner .ig-spin').show();
173
- jQuery('.ig_adv-setting .ig-spinner img').remove();
174
- }
175
-
176
- }
177
- function ig_validate_flush(ele){
178
- if(ele.checked){
179
- var c = confirm('<?php _e('please make sure every settings will be removed on plugin uninstall.','insta-gallery'); ?>');
180
- if(!c){
181
- ele.checked = false;
182
- }
183
- }
184
- }
185
- jQuery(function($){
186
- var $igs_image_id = jQuery('input[name="igs_spinner_image_id"]');
187
- var $igs_reset = jQuery('#igs-spinner_reset');
188
-
189
- $('.ig_adv-setting input[name="igs-spinner"]').trigger('change');
190
- jQuery('.ig_adv-setting-toggle').on('click',function(){
191
- $(this).toggleClass('active');
192
- $('.ig_adv-setting').slideToggle();
193
- });
194
- $('.ig_adv-setting form').on('submit',function(ev){
195
- ev.preventDefault();
196
- $f = $(this);
197
- var $fresponse = $f.find('.igf-response');
198
- jQuery.ajax({
199
- url : ajaxurl,
200
- type : 'post',
201
- dataType: 'JSON',
202
- data : $f.serialize(),
203
- beforeSend : function()
204
- {
205
- $fresponse.empty();
206
- },
207
- success : function( response ) {
208
- if ((typeof response === 'object') && response.hasOwnProperty('success')) {
209
- $fresponse.html(response.data);
210
- }
211
- }
212
- }).fail(function (jqXHR, textStatus) {
213
- console.log(textStatus);
214
- }).always(function()
215
- {
216
- });
217
- });
218
-
219
- // reset spinner to default
220
- $igs_reset.click(function(){
221
- $igs_image_id.val('');
222
- ig_change_spinner();
223
- jQuery(this).hide();
224
- });
225
-
226
- if($igs_image_id.val() == '')$igs_reset.hide();
227
- if($igs_image_id.data('misrc') != '') ig_change_spinner($igs_image_id.data('misrc'));
228
-
229
- // select media image
230
- jQuery('#igs-spinner_media_manager').click(function(e) {
231
-
232
- e.preventDefault();
233
- var image_frame;
234
- if(image_frame){
235
- image_frame.open();
236
- }
237
- // Define image_frame as wp.media object
238
- image_frame = wp.media({
239
- title: 'Select Media',
240
- multiple : false,
241
- library : {
242
- type : 'image',
243
- }
244
- });
245
-
246
- image_frame.on('close',function() {
247
- // On close, get selections and save to the hidden input
248
- // plus other AJAX stuff to refresh the image preview
249
- var selection = image_frame.state().get('selection');
250
- if(selection.length){
251
- var gallery_ids = new Array();
252
- var i = 0,attachment_url;
253
- selection.each(function(attachment) {
254
- gallery_ids[i] = attachment['id'];
255
- attachment_url = attachment.attributes.url;
256
- i++;
257
- });
258
- var ids = gallery_ids.join(",");
259
- $igs_image_id.val(ids);
260
- ig_change_spinner(attachment_url)
261
- }
262
-
263
- // toggle reset button
264
- if($igs_image_id.val() == ''){
265
- $igs_reset.hide();
266
- }else{
267
- $igs_reset.show();
268
- }
269
-
270
- });
271
-
272
- image_frame.on('open',function() {
273
- // On open, get the id from the hidden input
274
- // and select the appropiate images in the media manager
275
- var selection = image_frame.state().get('selection');
276
- ids = $igs_image_id.val().split(',');
277
- ids.forEach(function(id) {
278
- attachment = wp.media.attachment(id);
279
- attachment.fetch();
280
- selection.add( attachment ? [ attachment ] : [] );
281
- });
282
-
283
- });
284
-
285
- image_frame.open();
286
- });
287
- });
288
- </script>
app/wp-front.php DELETED
@@ -1,326 +0,0 @@
1
- <?php
2
- if (! defined('ABSPATH')) {
3
- die();
4
- }
5
-
6
- /**
7
- * Instagram Gallery
8
- * WP front page
9
- */
10
-
11
- // registering session
12
- /*
13
- * add_action('init', function(){
14
- * if( !session_id() )
15
- * session_start();
16
- * });
17
- */
18
-
19
- // load template files
20
- function insgal_template_path($template_name)
21
- {
22
- // load from parent/child theme
23
- if (file_exists(trailingslashit(get_stylesheet_directory()) . 'insta-gallery/' . $template_name)) {
24
- return (trailingslashit(get_stylesheet_directory()) . 'insta-gallery/' . $template_name);
25
- }
26
-
27
- // load defaults
28
- if (file_exists(INSGALLERY_PATH . 'templates/' . $template_name)) {
29
- return (INSGALLERY_PATH . 'templates/' . $template_name);
30
- }
31
- }
32
-
33
- // Registering css.
34
- add_action('wp_enqueue_scripts', 'insgal_enqueue_scripts');
35
-
36
- function insgal_enqueue_scripts()
37
- {
38
- if (INSGALLERY_PRODUCTION) {
39
- wp_enqueue_style('insta-gallery', INSGALLERY_URL . '/assets/insta-gallery-min.css', array(), INSGALLERY_VER);
40
- } else {
41
- wp_enqueue_style('insta-gallery', INSGALLERY_URL . '/assets/insta-gallery.css', array(), INSGALLERY_VER);
42
- }
43
-
44
- if (INSGALLERY_PRODUCTION) {
45
- wp_register_script('insta-gallery', INSGALLERY_URL . '/assets/insta-gallery-min.js', array(
46
- 'jquery'
47
- ), INSGALLERY_VER, true);
48
- } else {
49
- wp_register_script('insta-gallery', INSGALLERY_URL . '/assets/insta-gallery.js', array(
50
- 'jquery'
51
- ), INSGALLERY_VER, true);
52
- }
53
-
54
- wp_localize_script('insta-gallery', 'insgalajax', array(
55
- 'ajax_url' => admin_url('admin-ajax.php')
56
- ));
57
-
58
- wp_register_script('swiper', INSGALLERY_URL . '/assets/swiper/swiper.min.js', array(
59
- 'jquery'
60
- ), null, true);
61
-
62
- wp_register_script('magnific-popup', INSGALLERY_URL . '/assets/magnific-popup/jquery.magnific-popup.min.js', array(
63
- 'jquery'
64
- ), null, true);
65
-
66
- // WP 5 FIX
67
- wp_enqueue_script('insta-gallery');
68
- wp_enqueue_script('swiper');
69
- wp_enqueue_script('magnific-popup');
70
- }
71
-
72
- // shortcode added
73
- add_shortcode('insta-gallery', 'insta_gallery');
74
-
75
- // Insta-Gallery shortcode handler
76
- function insta_gallery($atts)
77
- {
78
- if (empty($atts) || ! isset($atts['id'])) {
79
- return;
80
- }
81
- // update/validate attributes
82
- $atts = shortcode_atts(array(
83
- 'id' => 0,
84
- 'ajax' => true
85
- ), $atts);
86
- $atts['ajax'] = filter_var($atts['ajax'], FILTER_VALIDATE_BOOLEAN);
87
-
88
- //disable ajax loading from frontend request
89
- if(isset($_GET['insgal_ajax']) && ($_GET['insgal_ajax'] == 'false')){
90
- $atts['ajax'] = false;
91
- }
92
-
93
- $gid = (int) $atts['id'];
94
- $InstaGalleryItems = get_option('insta_gallery_items');
95
- $InstaGallerySetting = get_option('insta_gallery_setting');
96
- if (! isset($InstaGalleryItems[$gid])) {
97
- return;
98
- }
99
-
100
- $IGItem = $InstaGalleryItems[$gid];
101
-
102
- wp_enqueue_script('insta-gallery');
103
- if ($IGItem['ig_display_type'] == 'gallery') {
104
- wp_enqueue_script('magnific-popup');
105
- } else if ($IGItem['ig_display_type'] == 'carousel') {
106
- wp_enqueue_script('swiper');
107
- wp_enqueue_script('magnific-popup');
108
- }
109
-
110
- $insta_source = ($IGItem['ig_select_from'] == 'username') ? 'user_' . $IGItem['insta_user'] : 'tag_' . $IGItem['insta_tag'];
111
-
112
- $insta_svg = '<svg version="1.1" class="ig-spin" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
113
- viewBox="0 0 551.034 551.034" style="enable-background:new 0 0 551.034 551.034;" xml:space="preserve"><g>
114
- <linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="275.517" y1="4.57" x2="275.517" y2="549.72" gradientTransform="matrix(1 0 0 -1 0 554)">
115
- <stop offset="0" style="stop-color:#E09B3D"/><stop offset="0.3" style="stop-color:#C74C4D"/><stop offset="0.6" style="stop-color:#C21975"/><stop offset="1" style="stop-color:#7024C4"/>
116
- </linearGradient>
117
- <path style="fill:url(#SVGID_1_);" d="M386.878,0H164.156C73.64,0,0,73.64,0,164.156v222.722
118
- c0,90.516,73.64,164.156,164.156,164.156h222.722c90.516,0,164.156-73.64,164.156-164.156V164.156
119
- C551.033,73.64,477.393,0,386.878,0z M495.6,386.878c0,60.045-48.677,108.722-108.722,108.722H164.156
120
- c-60.045,0-108.722-48.677-108.722-108.722V164.156c0-60.046,48.677-108.722,108.722-108.722h222.722
121
- c60.045,0,108.722,48.676,108.722,108.722L495.6,386.878L495.6,386.878z"/>
122
- <linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="275.517" y1="4.57" x2="275.517" y2="549.72" gradientTransform="matrix(1 0 0 -1 0 554)">
123
- <stop offset="0" style="stop-color:#E09B3D"/><stop offset="0.3" style="stop-color:#C74C4D"/><stop offset="0.6" style="stop-color:#C21975"/><stop offset="1" style="stop-color:#7024C4"/>
124
- </linearGradient>
125
- <path style="fill:url(#SVGID_2_);" d="M275.517,133C196.933,133,133,196.933,133,275.516s63.933,142.517,142.517,142.517
126
- S418.034,354.1,418.034,275.516S354.101,133,275.517,133z M275.517,362.6c-48.095,0-87.083-38.988-87.083-87.083
127
- s38.989-87.083,87.083-87.083c48.095,0,87.083,38.988,87.083,87.083C362.6,323.611,323.611,362.6,275.517,362.6z"/>
128
- <linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="418.31" y1="4.57" x2="418.31" y2="549.72" gradientTransform="matrix(1 0 0 -1 0 554)">
129
- <stop offset="0" style="stop-color:#E09B3D"/><stop offset="0.3" style="stop-color:#C74C4D"/><stop offset="0.6" style="stop-color:#C21975"/><stop offset="1" style="stop-color:#7024C4"/>
130
- </linearGradient>
131
- <circle style="fill:url(#SVGID_3_);" cx="418.31" cy="134.07" r="34.15"/>
132
- </g></svg>';
133
-
134
- $results = '';
135
- $results .= '<div class="ig-block ' . ((! $atts['ajax']) ? 'ig-block-loaded' : '') . '" id="ig-block-' . $gid . '" data-insgalid="' . $gid . '" data-source="' . $insta_source . '">';
136
- $results .= '<div class="ig-spinner" ' . ((! $atts['ajax']) ? 'hidden' : '') . '>';
137
- if (! empty($InstaGallerySetting['igs_spinner'])) {
138
- // for backward compatibility only
139
- $results .= '<img src="' . $InstaGallerySetting['igs_spinner'] . '" alt="' . __('Instagram Gallery', 'insta-gallery') . '" class="ig-spin" />';
140
- } else if (! empty($InstaGallerySetting['igs_spinner_image_id'])) {
141
- $mid = $InstaGallerySetting['igs_spinner_image_id'];
142
- $image = wp_get_attachment_image_src($mid);
143
- if ($image) {
144
- $results .= '<img src="' . $image[0] . '" alt="' . __('Instagram Gallery', 'insta-gallery') . '" class="ig-spin" />';
145
- } else {
146
- $results .= $insta_svg;
147
- }
148
- } else {
149
- $results .= $insta_svg;
150
- }
151
- $results .= '</div>';
152
-
153
- // load content with page/shortcode
154
- if (! $atts['ajax']) {
155
- $_REQUEST['insgalid'] = $gid;
156
- $_REQUEST['insgal_ajax'] = $atts['ajax'];
157
- $results .= load_ig_item();
158
- }
159
-
160
- $results .= '</div> <!-- // IG BLOCK -->';
161
- return $results;
162
- }
163
-
164
- // ajax request served
165
- add_action('wp_ajax_nopriv_load_ig_item', 'load_ig_item');
166
- add_action('wp_ajax_load_ig_item', 'load_ig_item');
167
-
168
- function load_ig_item()
169
- {
170
- if (! isset($_REQUEST['insgalid'])) {
171
- return;
172
- }
173
- $gid = (int) $_REQUEST['insgalid'];
174
- $InstaGalleryItems = get_option('insta_gallery_items');
175
- if (! isset($InstaGalleryItems[$gid])) {
176
- return;
177
- }
178
- $IGItem = $InstaGalleryItems[$gid];
179
- $IGItem['gid'] = $gid; // push gallery ID for later use
180
- global $insgalleryIAC,$iispi;
181
-
182
- // validating options
183
- if (empty($IGItem['ig_select_from'])) {
184
- return;
185
- }
186
- // backward compatibility v1.5.11
187
- if(!empty($IGItem['insta_limit'])){
188
- $IGItem['insta_user-limit'] = (int) $IGItem['insta_limit'];
189
- $IGItem['insta_tag-limit'] = (int) $IGItem['insta_limit'];
190
- }else {
191
- $IGItem['insta_user-limit'] = (int) $IGItem['insta_user-limit'];
192
- $IGItem['insta_tag-limit'] = (int) $IGItem['insta_tag-limit'];
193
- }
194
- $IGItem['insta_gal-hover'] = filter_var($IGItem['insta_gal-hover'], FILTER_VALIDATE_BOOLEAN);
195
- $IGItem['insta_gal-spacing'] = filter_var($IGItem['insta_gal-spacing'], FILTER_VALIDATE_BOOLEAN);
196
-
197
- $IGItem['insta_instalink'] = filter_var($IGItem['insta_instalink'], FILTER_VALIDATE_BOOLEAN);
198
- $IGItem['insta_instalink-text'] = empty($IGItem['insta_instalink-text']) ? 'view on Instagram' : $IGItem['insta_instalink-text'];
199
- $IGItem['insta_instalink-bgcolor'] = @$IGItem['insta_instalink-bgcolor'];
200
- $IGItem['insta_instalink-hvrcolor'] = @$IGItem['insta_instalink-hvrcolor'];
201
-
202
- $IGItem['insta_car-autoplay'] = isset($IGItem['insta_car-autoplay']) ? filter_var($IGItem['insta_car-autoplay'], FILTER_VALIDATE_BOOLEAN) : true;
203
- $IGItem['insta_car-navarrows'] = @filter_var($IGItem['insta_car-navarrows'], FILTER_VALIDATE_BOOLEAN);
204
- $IGItem['insta_car-navarrows-color'] = @$IGItem['insta_car-navarrows-color'];
205
- $IGItem['insta_car-dots'] = @filter_var($IGItem['insta_car-dots'], FILTER_VALIDATE_BOOLEAN);
206
- $IGItem['insta_car-spacing'] = @filter_var($IGItem['insta_car-spacing'], FILTER_VALIDATE_BOOLEAN);
207
-
208
- $IGItem['insta_thumb-size'] = empty($IGItem['insta_thumb-size']) ? 'medium' : $IGItem['insta_thumb-size'];
209
- $IGItem['insta_hover-color'] = @$IGItem['insta_hover-color'];
210
- $IGItem['insta_gal-popup'] = filter_var($IGItem['insta_gal-popup'], FILTER_VALIDATE_BOOLEAN);
211
- $IGItem['insta_popup-caption'] = filter_var($IGItem['insta_popup-caption'], FILTER_VALIDATE_BOOLEAN);
212
- $IGItem['insta_likes'] = @filter_var($IGItem['insta_likes'], FILTER_VALIDATE_BOOLEAN);
213
- $IGItem['insta_comments'] = @filter_var($IGItem['insta_comments'], FILTER_VALIDATE_BOOLEAN);
214
-
215
- // continue to results
216
- $results = '';
217
- $instaItems = '';
218
- if ($IGItem['ig_select_from'] == 'username') { // get from username
219
- $instaItems = igf_getUserItems($IGItem);
220
- } else { // continue to tag
221
- $instaItems = igf_getTagItems($IGItem);
222
- }
223
-
224
- if (! empty($instaItems)) {
225
-
226
- $insta_source = ($IGItem['ig_select_from'] == 'username') ? 'user_' . $IGItem['insta_user'] : 'tag_' . $IGItem['insta_tag'];
227
-
228
- $instaUrl = 'https://www.instagram.com/';
229
- $instaItemLimit = 12;
230
- if ($IGItem['ig_select_from'] == 'username') {
231
- $instaUrl .= $IGItem['insta_user'];
232
- if (!empty($IGItem['insta_user-limit'])){
233
- $instaItemLimit = (int)$IGItem['insta_user-limit'];
234
- }
235
- } else {
236
- $instaUrl .= 'explore/tags/' . $IGItem['insta_tag'];
237
- if (!empty($IGItem['insta_tag-limit'])){
238
- $instaItemLimit = (int)$IGItem['insta_tag-limit'];
239
- }
240
- }
241
-
242
-
243
-
244
- if ($IGItem['ig_display_type'] == 'gallery') {
245
- ob_start();
246
- // include (INSGALLERY_PATH . 'templates/gallery.php');
247
- include insgal_template_path('gallery.php');
248
- $results .= ob_get_clean();
249
-
250
- // output dynamic CSS to head
251
- $IGBSelector = '#ig-block-' . $IGItem['gid']; // Gallery block selector
252
- $ig_dstyle = '';
253
- if (! empty($IGItem['insta_hover-color'])) {
254
- $ig_dstyle .= $IGBSelector . ' .ig-item.ighover a:hover:after, ' . $IGBSelector . ' .swiper-slide a:hover:after {background: ' . $IGItem['insta_hover-color'] . ';}';
255
- }
256
- if (! empty($IGItem['insta_instalink-bgcolor'])) {
257
- $ig_dstyle .= $IGBSelector . ' .instagallery-actions .igact-instalink {background: ' . $IGItem['insta_instalink-bgcolor'] . ';}';
258
- }
259
- if (! empty($IGItem['insta_instalink-hvrcolor'])) {
260
- $ig_dstyle .= $IGBSelector . ' .instagallery-actions .igact-instalink:hover {background: ' . $IGItem['insta_instalink-hvrcolor'] . ';}';
261
- }
262
- if (! empty($ig_dstyle)) {
263
- $results .= "<script>jQuery(function(){jQuery('head').append('<style>$ig_dstyle</style>');});</script>";
264
- }
265
- } else if ($IGItem['ig_display_type'] == 'carousel') {
266
- ob_start();
267
- // include (INSGALLERY_PATH . 'templates/carousel.php');
268
- include insgal_template_path('carousel.php');
269
- $results .= ob_get_clean();
270
-
271
- // output dynamic CSS to head
272
- $IGBSelector = '#ig-block-' . $IGItem['gid']; // Gallery block selector
273
- $ig_dstyle = '';
274
- if (! empty($IGItem['insta_car-navarrows-color'])) {
275
- $ig_dstyle .= $IGBSelector . ' .instacarousel .swiper-button-next svg, ' . $IGBSelector . ' .instacarousel .swiper-button-prev svg {fill: ' . $IGItem['insta_car-navarrows-color'] . ';}';
276
- }
277
- if (! empty($IGItem['insta_hover-color'])) {
278
- $ig_dstyle .= $IGBSelector . ' .ig-item.ighover a:hover:after, ' . $IGBSelector . ' .swiper-slide a:hover:after {background: ' . $IGItem['insta_hover-color'] . ';}';
279
- }
280
- if (! empty($IGItem['insta_instalink-bgcolor'])) {
281
- $ig_dstyle .= $IGBSelector . ' .instagallery-actions .igact-instalink {background: ' . $IGItem['insta_instalink-bgcolor'] . ';}';
282
- }
283
- if (! empty($IGItem['insta_instalink-hvrcolor'])) {
284
- $ig_dstyle .= $IGBSelector . ' .instagallery-actions .igact-instalink:hover {background: ' . $IGItem['insta_instalink-hvrcolor'] . ';}';
285
- }
286
- if (! empty($ig_dstyle)) {
287
- $results .= "<script>jQuery(function(){jQuery('head').append('<style>$ig_dstyle</style>');});</script>";
288
- }
289
- } else {
290
- if (current_user_can('administrator')) {
291
- $results .= '<div class="ig-no-items-msg"><p class="ig_front_msg-color">' . __('ERROR: invalid display type, please check gallery settings.', 'insta-gallery') . '</p></div>';
292
- }
293
- }
294
- } else {
295
- if (current_user_can('administrator')) {
296
- $results .= '<div class="ig-no-items-msg"><p class="ig_front_msg-color"><strong>Admin Notice:</strong> unable to get results.</p>';
297
- $results .= '<ul>';
298
- if(($IGItem['ig_select_from'] == 'username') && empty($insgalleryIAC['access_token'])){
299
- $results .= '<li>' . __('please update Instagram Access Token in plugin setting.', 'insta-gallery') . '</li>';
300
- }
301
- $igsMsg = $iispi->getMessage();
302
- if (! empty($igsMsg)) {
303
- $results .= '<li>' . $igsMsg . '</li>';
304
- }
305
- $results .= '</ul></div>';
306
- }
307
- }
308
- // echo $results;
309
- /*
310
- * $result = array(
311
- * 'igsuccess' => true,
312
- * 'result' => $results
313
- * );
314
- * echo json_encode($result);
315
- * die();
316
- */
317
- if (isset($_REQUEST['insgal_ajax']) && ! $_REQUEST['insgal_ajax']) {
318
- return $results;
319
- } else {
320
- wp_send_json_success($results);
321
- }
322
- }
323
-
324
-
325
-
326
-
app/wp-panel.php DELETED
@@ -1,120 +0,0 @@
1
- <?php
2
- if (! defined('ABSPATH')) {
3
- die();
4
- }
5
- /*
6