Instagram Gallery - Version 1.5.11

Version Description

  • code bug fixed
Download this release

Release Info

Developer buntisoft
Plugin Icon 128x128 Instagram Gallery
Version 1.5.11
Comparing to
See all releases

Code changes from version 1.4.6 to 1.5.11

app/Libra/InstagramSpider.php CHANGED
@@ -1,142 +1,219 @@
1
<?php
2
3
/**
4
- * Instagram Spider
5
* @author Karan Singh
6
- * @version 1.2.3
7
- * @description script to get instagram media by using Username and/or Tag. added WP (wp_remote_request) to run in WP.
8
*/
9
class InstagramSpider
10
{
11
-
12
protected $instagram;
13
-
14
public $messages;
15
-
16
public function __construct()
17
{
18
$this->instagram = 'https://www.instagram.com/';
19
$this->messages = array();
20
}
21
-
22
/**
23
* takes username and return items list array
24
*
25
- * @param string $username
26
- * @return array
27
*/
28
- function getUserItems($username = '')
29
{
30
$username = urlencode((string) $username); // non-english string support
31
if (empty($username)) {
32
$this->messages[] = 'Please provide a valid username';
33
- return;
34
}
35
36
- $inURL = $this->instagram . $username . '/media/';
37
- $instaRes = $this->ig_spider($inURL);
38
$instaRes = @json_decode($instaRes);
39
40
$items = array();
41
- if (isset($instaRes->items)) {
42
- $instaItems = $instaRes->items;
43
-
44
if (! empty($instaItems) && is_array($instaItems)) {
45
foreach ($instaItems as $res) {
46
$items[] = array(
47
- 'img_standard' => $res->images->standard_resolution->url,
48
- 'img_low' => $res->images->low_resolution->url,
49
- 'img_thumb' => $res->images->thumbnail->url,
50
- 'likes' => $res->likes->count,
51
- 'comments' => $res->comments->count,
52
- 'caption' => isset($res->caption->text) ? htmlspecialchars($res->caption->text) : ''
53
);
54
}
55
}
56
}
57
- if(empty($items)){
58
- $inURL = $this->instagram . $username . '/?__a=1';
59
- $instaRes = $this->ig_spider($inURL);
60
- $instaRes = @json_decode($instaRes);
61
- $items = array();
62
- if (isset($instaRes->user->media->nodes)) {
63
- $instaItems = $instaRes->user->media->nodes;
64
-
65
- if (! empty($instaItems) && is_array($instaItems)) {
66
- foreach ($instaItems as $res) {
67
- $items[] = array(
68
- 'img_standard' => $res->display_src,
69
- 'img_low' => $res->thumbnail_resources[4]->src,
70
- 'img_thumb' => $res->thumbnail_resources[0]->src,
71
- 'likes' => $res->likes->count,
72
- 'comments' => $res->comments->count,
73
- 'caption' => isset($res->caption) ? htmlspecialchars($res->caption) : ''
74
- );
75
- }
76
- }
77
- }
78
}
79
- return $items;
80
}
81
-
82
/**
83
* takes #Tag name and return items list array
84
*
85
- * @param string $tag
86
- * @param boolean get top posts
87
- * @return array
88
*/
89
- function getTagItems($tag = '',$getTopItems = false)
90
{
91
$tag = urlencode((string) $tag);
92
if (empty($tag)) {
93
$this->messages[] = 'Please provide a valid # tag';
94
- return;
95
}
96
$inURL = $this->instagram . 'explore/tags/' . $tag . '/?__a=1';
97
- $instaRes = $this->ig_spider($inURL);
98
$instaRes = json_decode($instaRes);
99
$items = array();
100
- if (isset($instaRes->tag->media->nodes)) {
101
-
102
- $instaItems = $instaRes->tag->media->nodes;
103
- if (empty($instaItems) && isset($instaRes->tag->top_posts->nodes)) {
104
- $instaItems = $instaRes->tag->top_posts->nodes;
105
- }
106
107
// get top posts
108
- if($getTopItems && isset($instaRes->tag->top_posts->nodes)){
109
- $instaItems = $instaRes->tag->top_posts->nodes;
110
}
111
112
if (! empty($instaItems) && is_array($instaItems)) {
113
foreach ($instaItems as $res) {
114
$items[] = array(
115
- 'img_standard' => $res->display_src,
116
- 'img_low' => $res->thumbnail_src,
117
- 'img_thumb' => str_replace('s640x640', 's150x150', $res->thumbnail_src),
118
- 'likes' => $res->likes->count,
119
- 'comments' => $res->comments->count,
120
- 'caption' => isset($res->caption) ? htmlspecialchars($res->caption) : ''
121
);
122
}
123
}
124
}
125
126
- return $items;
127
}
128
-
129
/**
130
* takes URL string and return URL content
131
*
132
- * @param string $url
133
- * @return string
134
*/
135
- protected function ig_spider($url = '')
136
{
137
if (empty($url) || (! filter_var($url, FILTER_VALIDATE_URL))) {
138
$this->messages[] = 'Please provide a Valid URL';
139
- return;
140
}
141
$instaItems = '';
142
@@ -144,43 +221,28 @@ class InstagramSpider
144
if (function_exists('wp_remote_request')) {
145
$result = wp_remote_request($url);
146
if (is_wp_error($result)) {
147
- $this->messages[] = 'WP Error: ' . $result->get_error_messages();
148
- } else {
149
- if (! empty($result['body'])) {
150
- $instaItems = $result['body'];
151
- }
152
- }
153
- }
154
-
155
- if (empty($instaItems)) { // continue via PHP
156
-
157
- if (function_exists('curl_version')) {
158
- $ch = curl_init();
159
- curl_setopt($ch, CURLOPT_URL, $url);
160
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
161
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
162
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
163
- $contents = curl_exec($ch);
164
- if (curl_error($ch)) {
165
- $this->messages[] = 'error: ' . curl_error($ch);
166
- }
167
- curl_close($ch);
168
- $instaItems = $contents;
169
} else {
170
- if (ini_get('allow_url_fopen')) {
171
- $instaItems = @file_get_contents($url);
172
} else {
173
- $this->messages[] = 'Your server does\'t have enabled the required extensions/functions.';
174
}
175
}
176
}
177
return $instaItems;
178
}
179
-
180
// return messages array
181
public function getMessages()
182
{
183
- return $this->messages;
184
}
185
}
186
1
<?php
2
3
/**
4
+ * Instagram Spider [MOD : WP - Insta Gallery]
5
* @author Karan Singh
6
+ * @version 1.3.9
7
+ * @depends RUSpider
8
+ * @description script to get instagram media by using Username and Tag-name. added WP (wp_remote_request) to run in WP.
9
*/
10
+
11
+ // loading dependencies
12
class InstagramSpider
13
{
14
+
15
protected $instagram;
16
+
17
+ // handle raw result from server, for further processing in your app
18
+ public $instagramResult;
19
+
20
public $messages;
21
+
22
public function __construct()
23
{
24
$this->instagram = 'https://www.instagram.com/';
25
$this->messages = array();
26
}
27
+
28
/**
29
* takes username and return items list array
30
*
31
+ * @param string $username
32
+ * @return array|false
33
*/
34
+ public function getUserItems($username = '')
35
{
36
$username = urlencode((string) $username); // non-english string support
37
if (empty($username)) {
38
$this->messages[] = 'Please provide a valid username';
39
+ return false;
40
}
41
42
+ // $inURL = $this->instagram . $username . '/media/';
43
+ $inURL = $this->instagram . $username . '/?__a=1';
44
+ // For next 12 images, use ID of the last item (maxId = media.nodes[11].id) in the max_id param: /{USER_NAME}/?__a=1&max_id={maxId}
45
+ $instaRes = $this->igSpider($inURL);
46
$instaRes = @json_decode($instaRes);
47
48
$items = array();
49
+
50
+ // new API update Mar1418
51
+ if (isset($instaRes->graphql->user->edge_owner_to_timeline_media->edges)) {
52
+ $instaItems = $instaRes->graphql->user->edge_owner_to_timeline_media->edges;
53
if (! empty($instaItems) && is_array($instaItems)) {
54
foreach ($instaItems as $res) {
55
+
56
+ if (! isset($res->node->display_url)) {
57
+ continue;
58
+ }
59
+
60
+ $type = 'image';
61
+ if (isset($res->node->is_video) && (true === $res->node->is_video)) {
62
+ $type = 'video';
63
+ }
64
+
65
$items[] = array(
66
+ 'img_standard' => $res->node->display_url,
67
+ 'img_low' => $res->node->thumbnail_src,
68
+ 'img_thumb' => $res->node->thumbnail_resources[0]->src,
69
+ 'likes' => $res->node->edge_liked_by->count,
70
+ 'comments' => $res->node->edge_media_to_comment->count,
71
+ 'caption' => isset($res->node->edge_media_to_caption->edges[0]->node->text) ? htmlspecialchars($res->node->edge_media_to_caption->edges[0]->node->text) : '',
72
+ 'code' => $res->node->shortcode,
73
+ 'type' => $type
74
);
75
}
76
}
77
}
78
+
79
+ // if empty, continus with the HTML API
80
+ if (empty($items)) {
81
+ $inURL = $this->instagram . $username . '/';
82
+ $items = $this->getFromHtmlAPI($inURL);
83
}
84
+
85
+ return empty($items) ? false : $items;
86
}
87
+
88
/**
89
* takes #Tag name and return items list array
90
*
91
+ * @param string $tag
92
+ * @param
93
+ * boolean get top posts (10 posts)
94
+ * @return array|false
95
*/
96
+ public function getTagItems($tag = '', $getTopItems = false)
97
{
98
$tag = urlencode((string) $tag);
99
if (empty($tag)) {
100
$this->messages[] = 'Please provide a valid # tag';
101
+ return false;
102
}
103
$inURL = $this->instagram . 'explore/tags/' . $tag . '/?__a=1';
104
+ $instaRes = $this->igSpider($inURL);
105
$instaRes = json_decode($instaRes);
106
+
107
$items = array();
108
+ // continue to next API : API updated on Jan 03 17
109
+ if (isset($instaRes->graphql->hashtag->edge_hashtag_to_media->edges)) {
110
+ $instaItems = $instaRes->graphql->hashtag->edge_hashtag_to_media->edges;
111
112
// get top posts
113
+ if ($getTopItems && isset($instaRes->graphql->hashtag->edge_hashtag_to_top_posts->edges)) {
114
+ $instaItems = $instaRes->graphql->hashtag->edge_hashtag_to_top_posts->edges;
115
}
116
117
if (! empty($instaItems) && is_array($instaItems)) {
118
foreach ($instaItems as $res) {
119
+
120
+ if (! isset($res->node->display_url)) {
121
+ continue;
122
+ }
123
+
124
+ $type = 'image';
125
+ if (isset($res->node->is_video) && (true === $res->node->is_video)) {
126
+ $type = 'video';
127
+ }
128
+
129
+ $items[] = array(
130
+ 'img_standard' => $res->node->display_url,
131
+ 'img_low' => $res->node->thumbnail_src,
132
+ 'img_thumb' => $res->node->thumbnail_resources[0]->src,
133
+ 'likes' => $res->node->edge_liked_by->count,
134
+ 'comments' => $res->node->edge_media_to_comment->count,
135
+ 'caption' => isset($res->node->edge_media_to_caption->edges[0]->node->text) ? htmlspecialchars($res->node->edge_media_to_caption->edges[0]->node->text) : '',
136
+ 'code' => $res->node->shortcode,
137
+ 'type' => $type
138
+ );
139
+ }
140
+ }
141
+ }
142
+
143
+ // if empty, continus with the HTML API
144
+ if (empty($items)) {
145
+ $inURL = $this->instagram . 'explore/tags/' . $tag . '/';
146
+ $items = $this->getFromHtmlAPI($inURL);
147
+ }
148
+
149
+ return empty($items) ? false : $items;
150
+ }
151
+
152
+ /**
153
+ * takes page URL and return items list array
154
+ *
155
+ * @param
156
+ * string url
157
+ * @return array
158
+ */
159
+ protected function getFromHtmlAPI($inURL = '')
160
+ {
161
+ $instaRes = $this->igSpider($inURL);
162
+
163
+ $items = array();
164
+
165
+ if (! empty($instaRes)) {
166
+ $insta_json = explode('window._sharedData = ', $instaRes);
167
+ $insta_json = explode(';</script>', $insta_json[1]);
168
+ $instaArray = json_decode($insta_json[0], true);
169
+
170
+ $nodes = array();
171
+ if (isset($instaArray['entry_data']['ProfilePage'][0]['graphql']['user']['edge_owner_to_timeline_media']['edges'])) {
172
+ $nodes = $instaArray['entry_data']['ProfilePage'][0]['graphql']['user']['edge_owner_to_timeline_media']['edges'];
173
+ } else if (isset($instaArray['entry_data']['TagPage'][0]['graphql']['hashtag']['edge_hashtag_to_media']['edges'])) {
174
+ $nodes = $instaArray['entry_data']['TagPage'][0]['graphql']['hashtag']['edge_hashtag_to_media']['edges'];
175
+ }
176
+ if (! empty($nodes) && is_array($nodes)) {
177
+ foreach ($nodes as $node) {
178
+ if (! isset($node['node']['display_url'])) {
179
+ continue;
180
+ }
181
+
182
+ $node = $node['node'];
183
+
184
+ $type = 'image';
185
+ if (isset($node['is_video']) && (true === $node['is_video'])) {
186
+ $type = 'video';
187
+ }
188
+ $caption = (! empty($node['caption'])) ? $node['caption'] : '';
189
$items[] = array(
190
+ 'img_standard' => $node['display_url'],
191
+ 'img_low' => $node['thumbnail_src'],
192
+ 'img_thumb' => $node['thumbnail_resources'][0]['src'],
193
+ 'likes' => $node['edge_liked_by']['count'],
194
+ 'comments' => $node['edge_media_to_comment']['count'],
195
+ 'caption' => $caption,
196
+ 'code' => $node['shortcode'],
197
+ 'type' => $type
198
);
199
}
200
}
201
}
202
203
+ return empty($items) ? false : $items;
204
}
205
+
206
/**
207
* takes URL string and return URL content
208
*
209
+ * @param string $url
210
+ * @return string|boolean
211
*/
212
+ public function igSpider($url = '')
213
{
214
if (empty($url) || (! filter_var($url, FILTER_VALIDATE_URL))) {
215
$this->messages[] = 'Please provide a Valid URL';
216
+ return false;
217
}
218
$instaItems = '';
219
221
if (function_exists('wp_remote_request')) {
222
$result = wp_remote_request($url);
223
if (is_wp_error($result)) {
224
+ $this->messages[] = 'WP Error: ' . implode(', ', $result->get_error_messages());
225
} else {
226
+ if (200 !== wp_remote_retrieve_response_code($result)) {
227
+ $this->messages[] = 'Invalid response from Instagram.';
228
} else {
229
+ if (! empty($result['body'])) {
230
+ $instaItems = $result['body'];
231
+ }
232
}
233
}
234
+ } else {
235
+ $this->messages[] = 'Error: running outside WP.';
236
}
237
+
238
+ $this->instagramResult = $instaItems;
239
return $instaItems;
240
}
241
+
242
// return messages array
243
public function getMessages()
244
{
245
+ return array_unique($this->messages);
246
}
247
}
248
app/views/edit.php CHANGED
@@ -1,263 +1,238 @@
1
<?php
2
- if (! defined('ABSPATH')) {
3
- die();
4
- }
5
- $InstaGalleryItem = null;
6
- if (isset($_GET['ig_item']) && ! empty($_GET['ig_item'])) {
7
- $ig_item_id = (int) $_GET['ig_item'];
8
- $InstaGalleryItems = get_option('insta_gallery_items');
9
- if (isset($InstaGalleryItems[$ig_item_id])) {
10
- $InstaGalleryItem = $InstaGalleryItems[$ig_item_id];
11
- $InstaGalleryItem['ig_item_id'] = $ig_item_id;
12
- }
13
- }
14
-
15
- $active_username = true;
16
- $active_tag = false;
17
- if (isset($InstaGalleryItem['ig_select_from'])) {
18
- if ($InstaGalleryItem['ig_select_from'] != 'username') {
19
- $active_username = false;
20
- $active_tag = true;
21
- }
22
- }
23
- $active_gallery = true;
24
- $active_carousel = false;
25
- if (isset($InstaGalleryItem['ig_display_type'])) {
26
- if ($InstaGalleryItem['ig_display_type'] == 'carousel') {
27
- $active_gallery = false;
28
- $active_carousel = true;
29
- }
30
- }
31
-
32
?>
33
<p>
34
- <a href="<?php echo INSGALLERY_URL_ADMIN_PAGE; ?>" title="View Galleries List"
35
- class="ig-btn"><span class="dashicons dashicons-arrow-left-alt"></span>Back to
36
- List</a>
37
</p>
38
- <form method="post" id="ig-form-update"
39
- action="<?php if(empty($InstaGalleryItem)) echo INSGALLERY_URL_ADMIN_PAGE; ?>">
40
<table class="form-table ig-table-edit">
41
<tbody>
42
<tr>
43
- <th scope="row">Display Instagram Gallery from:</th>
44
<td>
45
<ul class="ig-list-buttons">
46
- <li><input type="radio" id="ig_select_from-username" name="ig_select_from"
47
- value="username" <?php if($active_username) echo 'checked';?> /><label
48
- for="ig_select_from-username">User Name</label>
49
- <div class="check"></div></li>
50
- <li><input type="radio" id="ig_select_from-tag" name="ig_select_from"
51
- value="tag" <?php if($active_tag) echo 'checked';?> /> <label
52
- for="ig_select_from-tag"># Tag</label>
53
- <div class="check"></div></li>
54
- </ul> <span class="description"> (Please select option to show pics from
55
- Instagram Username OR # Tag.)</span>
56
-
57
</td>
58
</tr>
59
- <tr id="ig-select-username-wrap"
60
- class="ig-tab-content-row <?php if($active_username) echo 'active';?>">
61
<td colspan="100%">
62
<table>
63
<tr>
64
- <th scope="row">Instagram User Name:</th>
65
- <td><input name="insta_user" type="text" placeholder="MyUsername"
66
- value="<?php if(!empty($InstaGalleryItem['insta_user'])){echo $InstaGalleryItem['insta_user']; }?>" />
67
- <span class="description">e.g. https://www.instagram.com/<strong
68
- class="ig-thm-color" style="font-size: 120%;">MyUsername</strong>/
69
- </span>
70
- <p class="ig-generate-msgs">Please enter Instagram User Name.</p></td>
71
</tr>
72
</table>
73
</td>
74
</tr>
75
- <tr id="ig-select-tag-wrap"
76
- class="ig-tab-content-row <?php if($active_tag) echo 'active';?>">
77
<td colspan="100%">
78
<table>
79
<tr>
80
- <th scope="row">Instagram # Tag:</th>
81
- <td><input name="insta_tag" type="text" placeholder="beautiful"
82
- value="<?php if(!empty($InstaGalleryItem['insta_tag'])){echo $InstaGalleryItem['insta_tag']; }?>" />
83
- <span class="description">e.g. https://www.instagram.com/explore/tags/<strong
84
- style="font-size: 120%; color: #e23565;">beautiful</strong>/
85
- </span>
86
- <p class="ig-generate-msgs">Please enter Instagram # Tag.</p></td>
87
</tr>
88
</table>
89
</td>
90
</tr>
91
<tr>
92
- <th scope="row">Pictures Limit:</th>
93
- <td><input name="insta_limit" type="number" min="1" max="20"
94
- value="<?php if(!empty($InstaGalleryItem['insta_limit'])){echo $InstaGalleryItem['insta_limit']; } else {echo '12'; }?>" />
95
- <span class="description">number of pics to display on page. (max: 20)</span></td>
96
</tr>
97
<tr>
98
- <th scope="row">Show As:</th>
99
<td>
100
<ul class="ig-list-buttons">
101
- <li><input type="radio" id="ig_display_type-gallery"
102
- name="ig_display_type" value="gallery"
103
- <?php if($active_gallery) echo 'checked';?> /><label
104
- for="ig_display_type-gallery">Gallery</label>
105
- <div class="check"></div></li>
106
- <li><input type="radio" id="ig_display_type-carousel"
107
- name="ig_display_type" value="carousel"
108
- <?php if($active_carousel) echo 'checked';?> /><label
109
- for="ig_display_type-carousel">Carousel</label>
110
- <div class="check"></div></li>
111
</ul>
112
</td>
113
</tr>
114
- <tr id="ig-section-as-galllery"
115
- class="ig-tab-content-row <?php if($active_gallery) echo 'active';?>">
116
<td colspan="100%">
117
- <p>Pictures will be displayed as Grid and we can popup gallery by clicking
118
- them.</p>
119
<table>
120
<tr>
121
- <th scope="row">No. of Pics Columns:</th>
122
<td><input name="insta_gal-cols" type="number" min="1" max="20"
123
- value="<?php if(!empty($InstaGalleryItem['insta_gal-cols'])){echo $InstaGalleryItem['insta_gal-cols']; } else {echo 3;}?>" />
124
- <span class="description">number of pics in a row. </span></td>
125
- <td rowspan="3"><img
126
- src="<?php echo INSGALLERY_URL; ?>/assets/media/demo-gallery.jpg"
127
- alt="demo gallery" width="500" /></td>
128
</tr>
129
<tr>
130
- <th scope="row">Image hover effect:</th>
131
- <td><input name="insta_gal-hover" type="checkbox" value="1"
132
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_gal-hover'])) ? '' : 'checked'; ?> />
133
- <span class="description">mouseover animation effect on image </span></td>
134
</tr>
135
<tr>
136
- <th scope="row">Space between images:</th>
137
- <td><input name="insta_gal-spacing" type="checkbox" value="1"
138
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_gal-spacing'])) ? '' : 'checked'; ?> />
139
- <span class="description">add blank space between images </span></td>
140
</tr>
141
</table>
142
</td>
143
</tr>
144
- <tr id="ig-section-as-carousel"
145
- class="ig-tab-content-row <?php if($active_carousel) echo 'active';?>">
146
<td colspan="100%">
147
- <p>Pictures will be displayed as Carousel.</p>
148
<table>
149
<tr>
150
- <th scope="row">Slides per view:</th>
151
<td><input name="insta_car-slidespv" type="number" min="1" max="10"
152
- value="<?php if(!empty($InstaGalleryItem['insta_car-slidespv'])){echo $InstaGalleryItem['insta_car-slidespv']; } else {echo 5;}?>" />
153
- <span class="description">display number of pictures per slide view. </span></td>
154
- <td rowspan="5"><img
155
- src="<?php echo INSGALLERY_URL; ?>/assets/media/demo-carousel.jpg"
156
- alt="demo carousel" width="500" /></td>
157
</tr>
158
<tr>
159
- <th scope="row">Navigation arrows:</th>
160
- <td><input name="insta_car-navarrows" type="checkbox" value="1"
161
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_car-navarrows'])) ? '' : 'checked'; ?> />
162
- <span class="description">show prev-next navigation arrows. </span></td>
163
</tr>
164
<tr>
165
- <th scope="row">Dotted navigation:</th>
166
- <td><input name="insta_car-dots" type="checkbox" value="1"
167
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_car-dots'])) ? '' : 'checked'; ?> />
168
- <span class="description">show dotted navigation buttons. </span></td>
169
</tr>
170
<tr>
171
- <th scope="row">Space between slides:</th>
172
- <td><input name="insta_car-spacing" type="checkbox" value="1"
173
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_car-spacing'])) ? '' : 'checked'; ?> />
174
- <span class="description">add space between carousel items. </span></td>
175
</tr>
176
</table>
177
</td>
178
</tr>
179
<tr>
180
- <th scope="row">Images thumbnail size:</th>
181
<td><select name="insta_thumb-size">
182
- <option value="medium">Medium(640,320 x auto)</option>
183
- <option value="small"
184
- <?php echo (isset($InstaGalleryItem['insta_thumb-size']) && ($InstaGalleryItem['insta_thumb-size'] == 'small')) ? 'selected' : ''; ?>>Small(150
185
- x 150)</option>
186
- </select> <span class="description"><br />select small for square size
187
- images. </span></td>
188
</tr>
189
<tr>
190
- <th scope="row">Images hover color:</th>
191
<td><input id="insta_hover-color-choose" type="color"
192
- value="<?php echo (!empty($InstaGalleryItem['insta_hover-color']) ? $InstaGalleryItem['insta_hover-color'] : '#007aff'); ?>" />
193
- <input name="insta_hover-color" type="text" placeholder="#007aff"
194
- value="<?php echo (!empty($InstaGalleryItem['insta_hover-color']) ? $InstaGalleryItem['insta_hover-color'] : ''); ?>" />
195
- <span class="description">select color which is displayed when hovered over
196
- images.<br />( <span class="ig-thm-color">color name should be in <i>hexadecimal
197
- notation</i> e.g. #000000
198
- </span> )
199
- </span></td>
200
</tr>
201
<tr>
202
- <th scope="row">Popup images on thumbnail click:</th>
203
- <td><input name="insta_gal-popup" type="checkbox" value="1"
204
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_gal-popup'])) ? '' : 'checked'; ?> />
205
- <span class="description">show popup gallery by clicking on image
206
- thumbnail. <br />( <span class="ig-thm-color">uncheck this if it conflicts
207
- with other plugins, like: fancybox popup etc.</span> )
208
- </span></td>
209
</tr>
210
<tr>
211
- <th scope="row">Display Likes:</th>
212
- <td><input name="insta_likes" type="checkbox" value="1"
213
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_likes'])) ? '' : 'checked'; ?> />
214
- <span class="description">display likes count of images. </span></td>
215
</tr>
216
<tr>
217
- <th scope="row">Display Comments:</th>
218
- <td><input name="insta_comments" type="checkbox" value="1"
219
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_comments'])) ? '' : 'checked'; ?> />
220
- <span class="description">display comments count of images. </span></td>
221
</tr>
222
<tr>
223
- <th scope="row">Display Instagram Link Button:</th>
224
- <td><input name="insta_instalink" type="checkbox" value="1"
225
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_instalink'])) ? '' : 'checked'; ?> />
226
- <span class="description">show the button to open Instagram site link </span></td>
227
</tr>
228
- <tr id="ig-section-igbtn"
229
- class="ig-tab-content-row <?php if(isset($InstaGalleryItem) && !empty($InstaGalleryItem['insta_instalink'])) echo 'active';?>">
230
<td colspan="100%">
231
<table>
232
<tr>
233
- <th scope="row">Instagram Button Text:</th>
234
- <td><input name="insta_instalink-text" type="text"
235
- placeholder="view on Instagram"
236
- value="<?php if(!empty($InstaGalleryItem['insta_instalink-text'])){echo $InstaGalleryItem['insta_instalink-text']; }?>" />
237
- <span class="description">update Instagram button text here.</span></td>
238
</tr>
239
<tr>
240
- <th scope="row">Button Background Color:</th>
241
<td><input id="insta_instalink-bgcolor-choose" type="color"
242
- value="<?php echo (!empty($InstaGalleryItem['insta_instalink-bgcolor']) ? $InstaGalleryItem['insta_instalink-bgcolor'] : '#c32a67'); ?>" />
243
- <input name="insta_instalink-bgcolor" type="text" placeholder="#c32a67"
244
- value="<?php echo (!empty($InstaGalleryItem['insta_instalink-bgcolor']) ? $InstaGalleryItem['insta_instalink-bgcolor'] : ''); ?>" />
245
- <span class="description">select color which is displayed on button background.<br />( <span class="ig-thm-color">color name should be in
246
- <i>hexadecimal notation</i> e.g. #000000
247
- </span> )
248
- </span></td>
249
</tr>
250
<tr>
251
- <th scope="row">Button Mouse Hover Color:</th>
252
<td><input id="insta_instalink-hvrcolor-choose" type="color"
253
- value="<?php echo (!empty($InstaGalleryItem['insta_instalink-hvrcolor']) ? $InstaGalleryItem['insta_instalink-hvrcolor'] : '#da894a'); ?>" />
254
- <input name="insta_instalink-hvrcolor" type="text" placeholder="#da894a"
255
- value="<?php echo (!empty($InstaGalleryItem['insta_instalink-hvrcolor']) ? $InstaGalleryItem['insta_instalink-hvrcolor'] : ''); ?>" />
256
- <span class="description">select color which is displayed when hovered
257
- over button.<br />( <span class="ig-thm-color">color name should be in
258
- <i>hexadecimal notation</i> e.g. #000000
259
- </span> )
260
- </span></td>
261
</tr>
262
</table>
263
</td>
@@ -266,15 +241,13 @@ if (isset($InstaGalleryItem['ig_display_type'])) {
266
</table>
267
<div>
268
<button class="button-primary ig-add-update" type="submit">
269
- <span class="dashicons dashicons-plus"></span> Update / Add
270
</button>
271
- <p class="description">update info here and copy/paste generated shortcode in
272
- your post/pages.</p>
273
</div>
274
<input type="hidden" name="ig-form-update" value="true" />
275
<?php if(!empty($InstaGalleryItem['ig_item_id'])) {?>
276
- <input type="hidden" name="igitem_id"
277
- value="<?php echo $InstaGalleryItem['ig_item_id']; ?>" />
278
<?php } ?>
279
</form>
280
<script>
@@ -284,56 +257,72 @@ if (isset($InstaGalleryItem['ig_display_type'])) {
284
if(this.value == 'username'){
285
$('#ig-select-tag-wrap').hide(500, function() {
286
$('#ig-select-username-wrap').show( ).addClass('active');
287
- }).removeClass('active');
288
- }else{
289
$('#ig-select-username-wrap').hide(500, function() {
290
$('#ig-select-tag-wrap').show( ).addClass('active');
291
- }).removeClass('active');
292
}
293
- });
294
-
295
// gallery, carousel toggle
296
$('input[name="ig_display_type"]').on('change',function(){
297
298
if(this.value == 'gallery'){
299
$('#ig-section-as-carousel').hide(500, function() {
300
$('#ig-section-as-galllery').show( ).addClass('active');
301
- }).removeClass('active');
302
- }else if(this.value == 'carousel'){
303
$('#ig-section-as-galllery').hide(500, function() {
304
$('#ig-section-as-carousel').show( ).addClass('active');
305
- }).removeClass('active');
306
}
307
-
308
- });
309
310
$('#ig-form-update').on('submit',function(ev){
311
var select_from = $('input[name="ig_select_from"]:checked').val();
312
var $insta_user = $('input[name="insta_user"]');
313
var $insta_tag = $('input[name="insta_tag"]');
314
var valid = true;
315
- if((select_from == 'username') && ($insta_user.val() == '')){
316
- valid = false;
317
- $('#ig-select-username-wrap').addClass('error');
318
- }else if((select_from == 'tag') && ($insta_tag.val() == '')){
319
- valid = false;
320
- $('#ig-select-tag-wrap').addClass('error');
321
- }
322
if( !valid ){
323
324
setTimeout(function(){$('#ig-select-tag-wrap,#ig-select-username-wrap').removeClass('error');},5000);
325
$('html, body').animate({
326
scrollTop: 100
327
- }, 500);
328
ev.preventDefault();
329
return false;
330
- }
331
- });
332
-
333
// gallery color sync
334
$('#insta_hover-color-choose').on('change',function(){
335
$('input[name="insta_hover-color"]').val($(this).val());
336
- });
337
$('input[name="insta_hover-color"]').on('change',function(){
338
var hvcolor = $(this).val();
339
if(hvcolor != ''){
@@ -342,26 +331,46 @@ if (isset($InstaGalleryItem['ig_display_type'])) {
342
alert('please enter valid color code');
343
$(this).val('');
344
return;
345
- }
346
$('#insta_hover-color-choose').val($(this).val());
347
- }else {
348
$('#insta_hover-color-choose').val('#007aff');
349
- }
350
- });
351
-
352
// instagram link button toggle
353
$('input[name="insta_instalink"]').on('change',function(){
354
if(this.checked){
355
$('#ig-section-igbtn').show('slow').addClass('active');
356
- }else{
357
$('#ig-section-igbtn').hide('slow').removeClass('active');
358
- }
359
- });
360
-
361
// button bgcolor sync
362
$('#insta_instalink-bgcolor-choose').on('change',function(){
363
$('input[name="insta_instalink-bgcolor"]').val($(this).val());
364
- });
365
$('input[name="insta_instalink-bgcolor"]').on('change',function(){
366
var hvcolor = $(this).val();
367
if(hvcolor != ''){
@@ -370,17 +379,17 @@ if (isset($InstaGalleryItem['ig_display_type'])) {
370
alert('please enter valid color code');
371
$(this).val('');
372
return;
373
- }
374
$('#insta_instalink-bgcolor-choose').val($(this).val());
375
- }else {
376
$('#insta_instalink-bgcolor-choose').val('#c32a67');
377
- }
378
- });
379
-
380
// button hover color sync
381
$('#insta_instalink-hvrcolor-choose').on('change',function(){
382
$('input[name="insta_instalink-hvrcolor"]').val($(this).val());
383
- });
384
$('input[name="insta_instalink-hvrcolor"]').on('change',function(){
385
var hvcolor = $(this).val();
386
if(hvcolor != ''){
@@ -389,11 +398,11 @@ if (isset($InstaGalleryItem['ig_display_type'])) {
389
alert('please enter valid color code');
390
$(this).val('');
391
return;
392
- }
393
$('#insta_instalink-hvrcolor-choose').val($(this).val());
394
- }else {
395
$('#insta_instalink-hvrcolor-choose').val('#da894a');
396
- }
397
- });
398
- });
399
</script>
1
<?php
2
+ if (! defined('ABSPATH')) {
3
+ die();
4
+ }
5
+
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 class="dashicons dashicons-arrow-left-alt"></span><?php _e('Back to List','insta-gallery'); ?></a>
37
</p>
38
+ <form method="post" id="ig-form-update" action="<?php if(empty($InstaGalleryItem)) echo INSGALLERY_URL_ADMIN_PAGE; ?>">
39
<table class="form-table ig-table-edit">
40
<tbody>
41
<tr>
42
+ <th scope="row"><?php _e('Display Instagram Gallery from','insta-gallery'); ?>:</th>
43
<td>
44
<ul class="ig-list-buttons">
45
+ <li><input type="radio" id="ig_select_from-username" name="ig_select_from" value="username" <?php if($active_username) echo 'checked';?> /><label
46
+ for="ig_select_from-username"><?php _e('Username','insta-gallery'); ?></label>
47
+ <div class="check"></div></li>
48
+ <li><input type="radio" id="ig_select_from-tag" name="ig_select_from" value="tag" <?php if($active_tag) echo 'checked';?> /> <label for="ig_select_from-tag"><?php _e('Tagname','insta-gallery'); ?></label>
49
+ <div class="check"></div></li>
50
+ </ul> <span class="description"> (<?php _e('Please select option to display pictures from Instagram Username OR # Tag.','insta-gallery'); ?>)</span>
51
+
52
</td>
53
</tr>
54
+ <tr id="ig-select-username-wrap" class="ig-tab-content-row <?php if($active_username) echo 'active';?>">
55
<td colspan="100%">
56
<table>
57
<tr>
58
+ <th scope="row"><?php _e('Instagram Username','insta-gallery'); ?>:</th>
59
+ <td><input name="insta_user" type="text" placeholder="myusername"
60
+ value="<?php if(!empty($InstaGalleryItem['insta_user'])){echo $InstaGalleryItem['insta_user']; }?>" /> <span class="description">e.g. <strong
61
+ class="ig-thm-color" style="font-size: 130%;">myusername</strong><br/><small>https://www.instagram.com/<strong
62
+ class="ig-thm-color" style="font-size: 130%;">myusername</strong>/</small>
63
+ </span>
64
+ <p class="ig-generate-msgs"><?php _e('Please enter Instagram Username.','insta-gallery'); ?></p></td>
65
</tr>
66
</table>
67
</td>
68
</tr>
69
+ <tr id="ig-select-tag-wrap" class="ig-tab-content-row <?php if($active_tag) echo 'active';?>">
70
<td colspan="100%">
71
<table>
72
<tr>
73
+ <th scope="row"><?php _e('Instagram Tagname','insta-gallery'); ?>:</th>
74
+ <td><input name="insta_tag" type="text" placeholder="beautiful" value="<?php if(!empty($InstaGalleryItem['insta_tag'])){echo $InstaGalleryItem['insta_tag']; }?>" /> <span
75
+ class="description">e.g. <strong style="font-size: 120%; color: #e23565;">beautiful</strong><br/><small>https://www.instagram.com/explore/tags/<strong style="font-size: 120%; color: #e23565;">beautiful</strong>/</small>
76
+ </span>
77
+ <p class="ig-generate-msgs"><?php _e('Please enter Instagram Tagname.','insta-gallery'); ?></p></td>
78
</tr>
79
</table>
80
</td>
81
</tr>
82
<tr>
83
+ <th scope="row"><?php _e('Pictures Limit','insta-gallery'); ?>:</th>
84
+ <td><input name="insta_limit" type="number" min="1" max="12"
85
+ value="<?php if(!empty($InstaGalleryItem['insta_limit'])){echo $InstaGalleryItem['insta_limit']; } else {echo '12'; }?>" /> <span class="description"><?php _e('number of pictures to display (max: 12)','insta-gallery'); ?></span></td>
86
</tr>
87
<tr>
88
+ <th scope="row"><?php _e('Show As','insta-gallery'); ?>:</th>
89
<td>
90
<ul class="ig-list-buttons">
91
+ <li><input type="radio" id="ig_display_type-gallery" name="ig_display_type" value="gallery" <?php if($active_gallery) echo 'checked';?> /><label for="ig_display_type-gallery"><?php _e('Gallery','insta-gallery'); ?></label>
92
+ <div class="check"></div></li>
93
+ <li><input type="radio" id="ig_display_type-carousel" name="ig_display_type" value="carousel" <?php if($active_carousel) echo 'checked';?> /><label
94
+ for="ig_display_type-carousel"><?php _e('Carousel','insta-gallery'); ?></label>
95
+ <div class="check"></div></li>
96
</ul>
97
</td>
98
</tr>
99
+ <tr id="ig-section-as-galllery" class="ig-tab-content-row <?php if($active_gallery) echo 'active';?>">
100
<td colspan="100%">
101
+ <p>
102
+ <strong><?php _e('Pictures will be displayed as Grid.','insta-gallery'); ?></strong>
103
+ </p>
104
<table>
105
<tr>
106
+ <th scope="row"><?php _e('No. of Grid Columns','insta-gallery'); ?>:</th>
107
<td><input name="insta_gal-cols" type="number" min="1" max="20"
108
+ value="<?php if(!empty($InstaGalleryItem['insta_gal-cols'])){echo $InstaGalleryItem['insta_gal-cols']; } else {echo 3;}?>" /> <span class="description"><?php _e('number of pictures in a row','insta-gallery'); ?>. </span></td>
109
+ <td rowspan="3"><img src="<?php echo INSGALLERY_URL; ?>/assets/media/demo-gallery.jpg" alt="demo gallery" width="500" /></td>
110
</tr>
111
<tr>
112
+ <th scope="row"><?php _e('Image hover effect','insta-gallery'); ?>:</th>
113
+ <td><input name="insta_gal-hover" type="checkbox" value="1" <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_gal-hover'])) ? '' : 'checked'; ?> /> <span
114
+ class="description"><?php _e('mouseover animation effect on image','insta-gallery'); ?> </span></td>
115
</tr>
116
<tr>
117
+ <th scope="row"><?php _e('Space between images','insta-gallery'); ?>:</th>
118
+ <td><input name="insta_gal-spacing" type="checkbox" value="1" <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_gal-spacing'])) ? '' : 'checked'; ?> />
119
+ <span class="description"><?php _e('add blank space between images','insta-gallery'); ?> </span></td>
120
</tr>
121
</table>
122
</td>
123
</tr>
124
+ <tr id="ig-section-as-carousel" class="ig-tab-content-row <?php if($active_carousel) echo 'active';?>">
125
<td colspan="100%">
126
+ <p>
127
+ <strong><?php _e('Pictures will be displayed as Carousel slider.','insta-gallery'); ?></strong>
128
+ </p>
129
<table>
130
<tr>
131
+ <th scope="row"><?php _e('Slides per view','insta-gallery'); ?>:</th>
132
<td><input name="insta_car-slidespv" type="number" min="1" max="10"
133
+ value="<?php if(!empty($InstaGalleryItem['insta_car-slidespv'])){echo $InstaGalleryItem['insta_car-slidespv']; } else {echo 5;}?>" /> <span class="description"><?php _e('display number of pictures per slide view.','insta-gallery'); ?> </span></td>
134
+ <td rowspan="5"><img src="<?php echo INSGALLERY_URL; ?>/assets/media/demo-carousel.jpg" alt="demo carousel" width="500" /></td>
135
</tr>
136
<tr>
137
+ <th scope="row"><?php _e('Autoplay','insta-gallery'); ?>:</th>
138
+ <td><input name="insta_car-autoplay" type="checkbox" value="1" <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_car-autoplay'])) ? '' : 'checked'; ?> />
139
+ <span class="description"><?php _e('autoplay carousel items.','insta-gallery'); ?> </span></td>
140
</tr>
141
<tr>
142
+ <th scope="row"><?php _e('Navigation arrows','insta-gallery'); ?>:</th>
143
+ <td><input name="insta_car-navarrows" type="checkbox" value="1" <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_car-navarrows'])) ? '' : 'checked'; ?> />
144
+ <span class="description"><?php _e('show prev-next navigation arrows.','insta-gallery'); ?> </span></td>
145
+ </tr>
146
+ <tr>
147
+ <th scope="row"><?php _e('Navigation arrows color','insta-gallery'); ?>:</th>
148
+ <td><input id="insta_car-navarrows-color-choose" type="color"
149
+ value="<?php echo (!empty($InstaGalleryItem['insta_car-navarrows-color']) ? $InstaGalleryItem['insta_car-navarrows-color'] : '#c32a67'); ?>" /> <input
150
+ name="insta_car-navarrows-color" type="text" placeholder="#c32a67"
151
+ value="<?php echo (!empty($InstaGalleryItem['insta_car-navarrows-color']) ? $InstaGalleryItem['insta_car-navarrows-color'] : ''); ?>" /> <span class="description"><?php _e('change navigation arrows color here.','insta-gallery'); ?></span></td>
152
+ </tr>
153
+ <tr>
154
+ <th scope="row"><?php _e('Dotted navigation','insta-gallery'); ?>:</th>
155
+ <td><input name="insta_car-dots" type="checkbox" value="1" <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_car-dots'])) ? '' : 'checked'; ?> /> <span
156
+ class="description"><?php _e('show dotted navigation buttons.','insta-gallery'); ?><br/>(
157
+ <span class="ig-thm-color"><strong><?php
158
+ _e('Deprecated: this option will be removed in the future updates.', 'insta-gallery');
159
+ ?></strong></span> )</span></td>
160
</tr>
161
<tr>
162
+ <th scope="row"><?php _e('Space between slides','insta-gallery'); ?>:</th>
163
+ <td><input name="insta_car-spacing" type="checkbox" value="1" <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_car-spacing'])) ? '' : 'checked'; ?> />
164
+ <span class="description"><?php _e('add blank space between carousel items.','insta-gallery'); ?> </span></td>
165
</tr>
166
</table>
167
</td>
168
</tr>
169
<tr>
170
+ <th scope="row"><?php _e('Images thumbnail size','insta-gallery'); ?>:</th>
171
<td><select name="insta_thumb-size">
172
+ <option value="medium"><?php _e('Medium','insta-gallery'); ?>(640,320 x auto)</option>
173
+ <option value="small" <?php echo (isset($InstaGalleryItem['insta_thumb-size']) && ($InstaGalleryItem['insta_thumb-size'] == 'small')) ? 'selected' : ''; ?>><?php _e('Small','insta-gallery'); ?>(150
174
+ x 150)</option>
175
+ </select></td>
176
</tr>
177
<tr>
178
+ <th scope="row"><?php _e('Images hover effect color','insta-gallery'); ?>:</th>
179
<td><input id="insta_hover-color-choose" type="color"
180
+ value="<?php echo (!empty($InstaGalleryItem['insta_hover-color']) ? $InstaGalleryItem['insta_hover-color'] : '#007aff'); ?>" /> <input name="insta_hover-color" type="text"
181
+ placeholder="#007aff" value="<?php echo (!empty($InstaGalleryItem['insta_hover-color']) ? $InstaGalleryItem['insta_hover-color'] : ''); ?>" /> <span class="description"><?php _e('select color which is displayed when hovered over images.','insta-gallery'); ?><br />(
182
+ <span class="ig-thm-color"><?php _e('color name should be in Hexadecimal notation. e.g. #dddddd','insta-gallery'); ?>
183
+ </span> ) </span></td>
184
</tr>
185
<tr>
186
+ <th scope="row"><?php _e('Popup images on click','insta-gallery'); ?>:</th>
187
+ <td><input name="insta_gal-popup" type="checkbox" value="1" <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_gal-popup'])) ? '' : 'checked'; ?> /> <span
188
+ class="description"><?php _e('show popup gallery by clicking on image thumbnail. else it will open Instagram page.','insta-gallery'); ?> <br />( <span class="ig-thm-color"><?php
189
+ _e('uncheck this if it conflicts with other plugins, like: fancybox, prettyphoto etc.', 'insta-gallery');
190
+ ?></span> ) </span></td>
191
</tr>
192
<tr>
193
+ <th scope="row"><?php _e('Display image caption','insta-gallery'); ?>:</th>
194
+ <td><input name="insta_popup-caption" type="checkbox" readonly value="1"
195
+ <?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 />(
196
+ <span class="ig-thm-color"><strong><?php
197
+ _e('Deprecated: this option will be removed in the future updates.', 'insta-gallery');
198
+ ?></strong></span> ) </span></td>
199
</tr>
200
<tr>
201
+ <th scope="row"><?php _e('Display Likes','insta-gallery'); ?>:</th>
202
+ <td><input name="insta_likes" type="checkbox" value="1" <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_likes'])) ? '' : 'checked'; ?> /> <span
203
+ class="description"><?php _e('display likes count of images.','insta-gallery'); ?> </span></td>
204
</tr>
205
<tr>
206
+ <th scope="row"><?php _e('Display Comments','insta-gallery'); ?>:</th>
207
+ <td><input name="insta_comments" type="checkbox" value="1" <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_comments'])) ? '' : 'checked'; ?> /> <span
208
+ class="description"><?php _e('display comments count of images.','insta-gallery'); ?> </span></td>
209
</tr>
210
+ <tr>
211
+ <th scope="row"><?php _e('Display Instagram Link Button','insta-gallery'); ?>:</th>
212
+ <td><input name="insta_instalink" type="checkbox" value="1" <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_instalink'])) ? '' : 'checked'; ?> /> <span
213
+ class="description"><?php _e('show the button to open Instagram site link','insta-gallery'); ?> </span></td>
214
+ </tr>
215
+ <tr id="ig-section-igbtn" class="ig-tab-content-row <?php if(isset($InstaGalleryItem) && !empty($InstaGalleryItem['insta_instalink'])) echo 'active';?>">
216
<td colspan="100%">
217
<table>
218
<tr>
219
+ <th scope="row"><?php _e('Instagram Button Text','insta-gallery'); ?>:</th>
220
+ <td><input name="insta_instalink-text" type="text" placeholder="view on Instagram"
221
+ value="<?php if(!empty($InstaGalleryItem['insta_instalink-text'])){echo $InstaGalleryItem['insta_instalink-text']; }?>" /> <span class="description"><?php _e('update Instagram button text here.','insta-gallery'); ?></span></td>
222
</tr>
223
<tr>
224
+ <th scope="row"><?php _e('Button Background Color','insta-gallery'); ?>:</th>
225
<td><input id="insta_instalink-bgcolor-choose" type="color"
226
+ value="<?php echo (!empty($InstaGalleryItem['insta_instalink-bgcolor']) ? $InstaGalleryItem['insta_instalink-bgcolor'] : '#c32a67'); ?>" /> <input
227
+ name="insta_instalink-bgcolor" type="text" placeholder="#c32a67"
228
+ value="<?php echo (!empty($InstaGalleryItem['insta_instalink-bgcolor']) ? $InstaGalleryItem['insta_instalink-bgcolor'] : ''); ?>" /> <span class="description"><?php _e('color which is displayed on button background.','insta-gallery'); ?></span></td>
229
</tr>
230
<tr>
231
+ <th scope="row"><?php _e('Button Hover Color','insta-gallery'); ?>:</th>
232
<td><input id="insta_instalink-hvrcolor-choose" type="color"
233
+ value="<?php echo (!empty($InstaGalleryItem['insta_instalink-hvrcolor']) ? $InstaGalleryItem['insta_instalink-hvrcolor'] : '#da894a'); ?>" /> <input
234
+ name="insta_instalink-hvrcolor" type="text" placeholder="#da894a"
235
+ value="<?php echo (!empty($InstaGalleryItem['insta_instalink-hvrcolor']) ? $InstaGalleryItem['insta_instalink-hvrcolor'] : ''); ?>" /> <span class="description"><?php _e('color which is displayed when hovered over button.','insta-gallery'); ?></span></td>
236
</tr>
237
</table>
238
</td>
241
</table>
242
<div>
243
<button class="button-primary ig-add-update" type="submit">
244
+ <?php _e('Update','insta-gallery'); ?>
245
</button>
246
+ <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>
247
</div>
248
<input type="hidden" name="ig-form-update" value="true" />
249
<?php if(!empty($InstaGalleryItem['ig_item_id'])) {?>
250
+ <input type="hidden" name="igitem_id" value="<?php echo $InstaGalleryItem['ig_item_id']; ?>" />
251
<?php } ?>
252
</form>
253
<script>
257
if(this.value == 'username'){
258
$('#ig-select-tag-wrap').hide(500, function() {
259
$('#ig-select-username-wrap').show( ).addClass('active');
260
+ }).removeClass('active');
261
+ }else{
262
$('#ig-select-username-wrap').hide(500, function() {
263
$('#ig-select-tag-wrap').show( ).addClass('active');
264
+ }).removeClass('active');
265
}
266
+ });
267
+
268
// gallery, carousel toggle
269
$('input[name="ig_display_type"]').on('change',function(){
270
271
if(this.value == 'gallery'){
272
$('#ig-section-as-carousel').hide(500, function() {
273
$('#ig-section-as-galllery').show( ).addClass('active');
274
+ }).removeClass('active');
275
+ }else if(this.value == 'carousel'){
276
$('#ig-section-as-galllery').hide(500, function() {
277
$('#ig-section-as-carousel').show( ).addClass('active');
278
+ }).removeClass('active');
279
}
280
+
281
+ });
282
283
$('#ig-form-update').on('submit',function(ev){
284
var select_from = $('input[name="ig_select_from"]:checked').val();
285
var $insta_user = $('input[name="insta_user"]');
286
var $insta_tag = $('input[name="insta_tag"]');
287
var valid = true;
288
+ if(select_from == 'username'){
289
+ if($insta_user.val() == ''){
290
+ valid = false;
291
+ $('#ig-select-username-wrap').addClass('error');
292
+ }else{
293
+ if ($insta_user.val().indexOf("instagram.com/") >= 0){
294
+ alert('Please enter username only(e.g. myusername), do not the complete url.');
295
+ $insta_user.focus();
296
+ return false;
297
+ }
298
+ }
299
+ }else if(select_from == 'tag'){
300
+ if($insta_tag.val() == ''){
301
+ valid = false;
302
+ $('#ig-select-tag-wrap').addClass('error');
303
+ }else{
304
+ if ($insta_tag.val().indexOf("instagram.com/") >= 0){
305
+ alert('Please enter tagname only(e.g. beautiful), do not the complete url.');
306
+ $insta_tag.focus();
307
+ return false;
308
+ }
309
+ }
310
+ }
311
if( !valid ){
312
313
setTimeout(function(){$('#ig-select-tag-wrap,#ig-select-username-wrap').removeClass('error');},5000);
314
$('html, body').animate({
315
scrollTop: 100
316
+ }, 500);
317
ev.preventDefault();
318
return false;
319
+ }
320
+ });
321
+
322
// gallery color sync
323
$('#insta_hover-color-choose').on('change',function(){
324
$('input[name="insta_hover-color"]').val($(this).val());
325
+ });
326
$('input[name="insta_hover-color"]').on('change',function(){
327
var hvcolor = $(this).val();
328
if(hvcolor != ''){
331
alert('please enter valid color code');
332
$(this).val('');
333
return;
334
+ }
335
$('#insta_hover-color-choose').val($(this).val());
336
+ }else {
337
$('#insta_hover-color-choose').val('#007aff');
338
+ }
339
+ });
340
+
341
// instagram link button toggle
342
$('input[name="insta_instalink"]').on('change',function(){
343
if(this.checked){
344
$('#ig-section-igbtn').show('slow').addClass('active');
345
+ }else{
346
$('#ig-section-igbtn').hide('slow').removeClass('active');
347
+ }
348
+ });
349
+
350
+ // nav arrows color sync
351
+ $('#insta_car-navarrows-color-choose').on('change',function(){
352
+ $('input[name="insta_car-navarrows-color"]').val($(this).val());
353
+ });
354
+ $('input[name="insta_car-navarrows-color"]').on('change',function(){
355
+ var hvcolor = $(this).val();
356
+ if(hvcolor != ''){
357
+ var isOk = /^#[0-9A-F]{6}#x2F;i.test(hvcolor);
358
+ if(!isOk){
359
+ alert('please enter valid color code');
360
+ $(this).val('');
361
+ return;
362
+ }
363
+ $('#insta_car-navarrows-color-choose').val($(this).val());
364
+ }else {
365
+ $('#insta_car-navarrows-color-choose').val('#c32a67');
366
+ }
367
+ });
368
+
369
+
370
// button bgcolor sync
371
$('#insta_instalink-bgcolor-choose').on('change',function(){
372
$('input[name="insta_instalink-bgcolor"]').val($(this).val());
373
+ });
374
$('input[name="insta_instalink-bgcolor"]').on('change',function(){
375
var hvcolor = $(this).val();
376
if(hvcolor != ''){
379
alert('please enter valid color code');
380
$(this).val('');
381
return;
382
+ }
383
$('#insta_instalink-bgcolor-choose').val($(this).val());
384
+ }else {
385
$('#insta_instalink-bgcolor-choose').val('#c32a67');
386
+ }
387
+ });
388
+
389
// button hover color sync
390
$('#insta_instalink-hvrcolor-choose').on('change',function(){
391
$('input[name="insta_instalink-hvrcolor"]').val($(this).val());
392
+ });
393
$('input[name="insta_instalink-hvrcolor"]').on('change',function(){
394
var hvcolor = $(this).val();
395
if(hvcolor != ''){
398
alert('please enter valid color code');
399
$(this).val('');
400
return;
401
+ }
402
$('#insta_instalink-hvrcolor-choose').val($(this).val());
403
+ }else {
404
$('#insta_instalink-hvrcolor-choose').val('#da894a');
405
+ }
406
+ });
407
+ });
408
</script>
app/views/list.php CHANGED
@@ -2,47 +2,25 @@
2
if (! defined('ABSPATH')) {
3
die();
4
}
5
$InstaGalleryItems = get_option('insta_gallery_items');
6
$InstaGallerySetting = get_option('insta_gallery_setting');
7
-
8
?>
9
10
- <?php
11
- // check cURL / remote url access
12
- if (! function_exists('curl_version') && ! @ini_get('allow_url_fopen')) {
13
- ?>
14
- <div class="ig_phpc_warning">
15
- <p>
16
- <strong>Warning: </strong> cURL is NOT installed in your PHP installation. <br />
17
- <sub>cURL is the required PHP extension to work this plugin properly. Please
18
- install/activate cURL OR contact with your Server Administrator.</sub>
19
- </p>
20
- </div>
21
- <?php } ?>
22
-
23
<p>
24
- <a href="<?php echo INSGALLERY_URL_ADMIN_PAGE; ?>&tab=edit"
25
- title="Add New Gallery" class="ig-btn"><span class="dashicons dashicons-plus"></span>Add
26
- New Gallery</a>
27
</p>
28
- <?php
29
- // update_option( 'insta_gallery_items', '' );
30
- // delete_option('wpshout_tut_option');
31
- if (empty($InstaGalleryItems)) {
32
- ?>
33
- <h3 class="ig-no-items-msg">It looks like you have not added any gallery yet.
34
- Please Click on 'ADD NEW GALLERY' to add one.</h3>
35
- <?php } ?>
36
37
<?php if( !empty($InstaGalleryItems) && is_array($InstaGalleryItems) ){ ?>
38
<div>
39
- <table class="widefat">
40
<thead>
41
<tr>
42
- <th>Sr. No.</th>
43
- <th>Item</th>
44
- <th>Shortcode</th>
45
- <th>Action</th>
46
</tr>
47
</thead>
48
<tbody>
@@ -53,19 +31,15 @@ if (empty($InstaGalleryItems)) {
53
<?php
54
55
if ($IGItem['ig_select_from'] == 'username') {
56
- echo 'Username / ' . $IGItem['insta_user'];
57
} else {
58
- echo '# Tag / ' . $IGItem['insta_tag'];
59
}
60
?>
61
</td>
62
<td><code>[insta-gallery id="<?php echo $k; ?>"]</code></td>
63
- <td><a
64
- href="<?php echo INSGALLERY_URL_ADMIN_PAGE; ?>&tab=edit&ig_item=<?php echo $k; ?>"
65
- class="ig-btn"><span class="dashicons dashicons-edit"></span> Edit</a> <a
66
- href="<?php echo INSGALLERY_URL_ADMIN_PAGE; ?>&ig_item_delete=<?php echo $k; ?>"
67
- class="ig-btn" onclick="return ig_item_delete();"><span
68
- class="dashicons dashicons-trash"></span> Delete</a></td>
69
</tr>
70
<?php } unset($i); ?>
71
</tbody>
@@ -76,8 +50,7 @@ if (empty($InstaGalleryItems)) {
76
<div id="ig_adv-setting-panel">
77
<p>
78
<button class="ig_adv-setting-toggle ig-btn">
79
- <span class="dashicons dashicons-plus"></span><span
80
- class="dashicons dashicons-minus"></span>Additional Setting
81
</button>
82
</p>
83
<div class="ig_adv-setting">
@@ -85,23 +58,35 @@ if (empty($InstaGalleryItems)) {
85
<table class="widefat">
86
<tbody>
87
<tr>
88
- <th>Gallery Loader Image URL:</th>
89
- <td><input type="url" name="igs-spinner"
90
- value="<?php if(!empty($InstaGallerySetting['igs_spinner'])) echo $InstaGallerySetting['igs_spinner'];?>"
91
- onchange="ig_change_spinner(this)" /><span class="description"><br />please
92
- paste the image url to replace with default Gallery loader(Instagram
93
- icon). </span></td>
94
<td rowspan="2">
95
<div class="ig-spinner">
96
- <svg version="1.1" class="ig-spin" xmlns="http://www.w3.org/2000/svg"
97
- xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
98
- viewBox="0 0 551.034 551.034"
99
- style="enable-background: new 0 0 551.034 551.034;"
100
- xml:space="preserve">
101
<g>
102
- <linearGradient id="SVGID_1_"
103
- gradientUnits="userSpaceOnUse" x1="275.517" y1="4.57" x2="275.517"
104
- y2="549.72" 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" />
@@ -113,9 +98,8 @@ if (empty($InstaGalleryItems)) {
113
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
114
c-60.045,0-108.722-48.677-108.722-108.722V164.156c0-60.046,48.677-108.722,108.722-108.722h222.722
115
c60.045,0,108.722,48.676,108.722,108.722L495.6,386.878L495.6,386.878z" />
116
- <linearGradient id="SVGID_2_"
117
- gradientUnits="userSpaceOnUse" x1="275.517" y1="4.57" x2="275.517"
118
- y2="549.72" gradientTransform="matrix(1 0 0 -1 0 554)">
119
<stop offset="0" style="stop-color:#E09B3D" />
120
<stop offset="0.3" style="stop-color:#C74C4D" />
121
<stop offset="0.6" style="stop-color:#C21975" />
@@ -125,65 +109,58 @@ if (empty($InstaGalleryItems)) {
125
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_"
129
- gradientUnits="userSpaceOnUse" x1="418.31" y1="4.57" x2="418.31"
130
- y2="549.72" gradientTransform="matrix(1 0 0 -1 0 554)">
131
<stop offset="0" style="stop-color:#E09B3D" />
132
<stop offset="0.3" style="stop-color:#C74C4D" />
133
<stop offset="0.6" style="stop-color:#C21975" />
134
<stop offset="1" style="stop-color:#7024C4" />
135
</linearGradient>
136
- <circle style="fill:url(#SVGID_3_);"
137
- cx="418.31" cy="134.07" r="34.15" />
138
</g>
139
</svg>
140
</div>
141
</td>
142
</tr>
143
<tr>
144
- <th>Remove everything on uninstall</th>
145
- <td><input type="checkbox" name="igs-flush" value="1"
146
- onclick="ig_validate_flush(this)"
147
- <?php if(!empty($InstaGallerySetting['igs_flush'])) echo 'checked';?> /><span
148
- class="description"> check this to remove all data related to this plugin
149
- when removing this plugin. </span></td>
150
</tr>
151
</tbody>
152
<tfoot>
153
<tr>
154
- <td colspan="3"><button type="submit" class="ig-btn">update</button> <span
155
- class="ig_adv-setting-fmsg"></span></td>
156
</tr>
157
</tfoot>
158
</table>
159
- <input type="hidden" name="igadvs_nonce"
160
- value="<?php echo wp_create_nonce( 'igadvs_nonce_key' ); ?>" /> <input
161
- type="hidden" name="action" value="save_igadvs" />
162
</form>
163
</div>
164
</div>
165
- <div class="ig_donation-wrap">
166
- <p>
167
- Please Donate now to support the Advancement of this plugin. Thanks <a
168
- class="ig_donation_btn" href="https://www.paypal.me/karanpay" target="blank">Donate
169
- <img src="<?php echo INSGALLERY_URL; ?>/assets/media/paypal-logo.svg"
170
- class="ig-logo" />
171
- </a>
172
</p>
173
</div>
174
<?php } ?>
175
176
<script>
177
function ig_item_delete(){
178
- var c = confirm('Are you sure want to delete this item ?');
179
if(!c){
180
return false;
181
}
182
}
183
- function ig_change_spinner(ele){
184
- if(ele.value != ''){
185
- var img = '<img src="'+ele.value+'" class="ig-spin" />';
186
- jQuery('.ig_adv-setting .ig-spinner').append(img);
187
jQuery('.ig_adv-setting .ig-spinner .ig-spin').hide();
188
jQuery('.ig_adv-setting .ig-spinner img').show();
189
} else {
@@ -194,13 +171,16 @@ function ig_change_spinner(ele){
194
}
195
function ig_validate_flush(ele){
196
if(ele.checked){
197
- var c = confirm('please make sure every setting will be removed on plugin uninstall.');
198
if(!c){
199
ele.checked = false;
200
}
201
}
202
}
203
jQuery(function($){
204
$('.ig_adv-setting input[name="igs-spinner"]').trigger('change');
205
jQuery('.ig_adv-setting-toggle').on('click',function(){
206
$(this).toggleClass('active');
@@ -218,8 +198,8 @@ jQuery(function($){
218
{
219
},
220
success : function( response ) {
221
- if ((typeof response === 'object') && response.hasOwnProperty('igsuccess')) {
222
- $('.ig_adv-setting-fmsg').html(response.message);
223
setTimeout(function(){
224
$('.ig_adv-setting-fmsg').empty();
225
},2000);
@@ -231,5 +211,74 @@ jQuery(function($){
231
{
232
});
233
});
234
});
235
</script>
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 class="dashicons dashicons-plus"></span><?php _e('Add New Gallery','insta-gallery'); ?></a>
12
</p>
13
+
14
15
<?php if( !empty($InstaGalleryItems) && is_array($InstaGalleryItems) ){ ?>
16
<div>
17
+ <table class="widefat ig-gallery-list">
18
<thead>
19
<tr>
20
+ <th></th>
21
+ <th><?php _e('Gallery Item','insta-gallery'); ?></th>
22
+ <th><?php _e('Shortcode','insta-gallery'); ?></th>
23
+ <th><?php _e('Action','insta-gallery'); ?></th>
24
</tr>
25
</thead>
26
<tbody>
31
<?php
32
33
if ($IGItem['ig_select_from'] == 'username') {
34
+ echo __('Username', 'insta-gallery') . ' / ' . $IGItem['insta_user'];
35
} else {
36
+ echo __('Tagname', 'insta-gallery') . ' / ' . $IGItem['insta_tag'];
37
}
38
?>
39
</td>
40
<td><code>[insta-gallery id="<?php echo $k; ?>"]</code></td>
41
+ <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>
42
+ <a href="<?php echo INSGALLERY_URL_ADMIN_PAGE; ?>&ig_item_delete=<?php echo $k; ?>" class="ig-btn" onclick="return ig_item_delete();"><span class="dashicons dashicons-trash"></span><?php _e('Delete','insta-gallery'); ?></a></td>
43
</tr>
44
<?php } unset($i); ?>
45
</tbody>
50
<div id="ig_adv-setting-panel">
51
<p>
52
<button class="ig_adv-setting-toggle ig-btn">
53
+ <span class="dashicons dashicons-plus"></span><span class="dashicons dashicons-minus"></span><?php _e('Additional Setting','insta-gallery'); ?>
54
</button>
55
</p>
56
<div class="ig_adv-setting">
58
<table class="widefat">
59
<tbody>
60
<tr>
61
+ <th><?php _e('Gallery Loader Icon','insta-gallery'); ?>:</th>
62
+ <td>
63
+ <?php
64
+ $mid = '';
65
+ $misrc = '';
66
+ if (isset($InstaGallerySetting['igs_spinner_image_id'])) {
67
+ $mid = $InstaGallerySetting['igs_spinner_image_id'];
68
+ $image = wp_get_attachment_image_src($mid);
69
+ if ($image) {
70
+ $misrc = $image[0];
71
+ }
72
+ }
73
+ ?>
74
+ <input type="hidden" name="igs_spinner_image_id" value="<?php echo $mid; ?>" data-misrc="<?php echo $misrc; ?>" />
75
+ <button type='button' class="ig-btn" id="igs-spinner_media_manager" /><?php _e('Update Spinner','insta-gallery'); ?></button>
76
+ <button type='button' class="ig-btn" id="igs-spinner_reset" /><?php _e('Reset Spinner','insta-gallery'); ?></button> <br />
77
+ <span class="description">
78
+ <?php
79
+ _e('please select the image from media to replace with default Gallery loader icon.', 'insta-gallery');
80
+ ?> </span>
81
+
82
+ </td>
83
<td rowspan="2">
84
<div class="ig-spinner">
85
+ <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" viewBox="0 0 551.034 551.034"
86
+ style="enable-background: new 0 0 551.034 551.034;" xml:space="preserve">
87
<g>
88
+ <linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="275.517" y1="4.57" x2="275.517" y2="549.72"
89
+ gradientTransform="matrix(1 0 0 -1 0 554)">
90
<stop offset="0" style="stop-color:#E09B3D" />
91
<stop offset="0.3" style="stop-color:#C74C4D" />
92
<stop offset="0.6" style="stop-color:#C21975" />
98
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
99
c-60.045,0-108.722-48.677-108.722-108.722V164.156c0-60.046,48.677-108.722,108.722-108.722h222.722
100
c60.045,0,108.722,48.676,108.722,108.722L495.6,386.878L495.6,386.878z" />
101
+ <linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="275.517" y1="4.57" x2="275.517" y2="549.72"
102
+ gradientTransform="matrix(1 0 0 -1 0 554)">
103
<stop offset="0" style="stop-color:#E09B3D" />
104
<stop offset="0.3" style="stop-color:#C74C4D" />
105
<stop offset="0.6" style="stop-color:#C21975" />
109
d="M275.517,133C196.933,133,133,196.933,133,275.516s63.933,142.517,142.517,142.517
110
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
111
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" />
112
+ <linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="418.31" y1="4.57" x2="418.31" y2="549.72"
113
+ gradientTransform="matrix(1 0 0 -1 0 554)">
114
<stop offset="0" style="stop-color:#E09B3D" />
115
<stop offset="0.3" style="stop-color:#C74C4D" />
116
<stop offset="0.6" style="stop-color:#C21975" />
117
<stop offset="1" style="stop-color:#7024C4" />
118
</linearGradient>
119
+ <circle style="fill:url(#SVGID_3_);" cx="418.31" cy="134.07" r="34.15" />
120
</g>
121
</svg>
122
</div>
123
</td>
124
</tr>
125
<tr>
126
+ <th><?php _e('Remove everything on uninstall','insta-gallery'); ?>:</th>
127
+ <td><input type="checkbox" name="igs_flush" value="1" onclick="ig_validate_flush(this)" <?php if(!empty($InstaGallerySetting['igs_flush'])) echo 'checked';?> /><span
128
+ class="description"> <?php _e('check this box to remove all data related to this plugin when removing the plugin.','insta-gallery'); ?> </span></td>
129
</tr>
130
</tbody>
131
<tfoot>
132
<tr>
133
+ <td colspan="3"><button type="submit" class="ig-btn"><?php _e('Update','insta-gallery'); ?></button> <span class="ig_adv-setting-fmsg"></span></td>
134
</tr>
135
</tfoot>
136
</table>
137
+ <input type="hidden" name="igadvs_nonce" value="<?php echo wp_create_nonce( 'igadvs_nonce_key' ); ?>" /> <input type="hidden" name="action" value="save_igadvs" />
138
</form>
139
</div>
140
</div>
141
+ <div class="ig_donation-wrap ig-thm-color">
142
+ <p><?php _e('Please Donate now to support the Maintainance and Advancement of this plugin. Thanks','insta-gallery'); ?>
143
+ <a class="ig_donation_btn" href="https://www.paypal.me/karanpay" target="blank"><?php _e('Donate','insta-gallery'); ?>
144
+ <img src="<?php echo INSGALLERY_URL; ?>/assets/media/paypal-logo.svg" class="ig-logo" /> </a>
145
</p>
146
</div>
147
<?php } ?>
148
149
<script>
150
function ig_item_delete(){
151
+ var c = confirm('<?php _e('Are you sure want to delete this item?','insta-gallery'); ?>');
152
if(!c){
153
return false;
154
}
155
}
156
+ function ig_change_spinner(link){
157
+ if(link){
158
+ if(!jQuery('.ig_adv-setting .ig-spinner img').length){
159
+ var img = '<img src="'+link+'" class="ig-spin" />';
160
+ jQuery('.ig_adv-setting .ig-spinner').append(img);
161
+ }else{
162
+ jQuery('.ig_adv-setting .ig-spinner img').attr('src',link);
163
+ }
164
jQuery('.ig_adv-setting .ig-spinner .ig-spin').hide();
165
jQuery('.ig_adv-setting .ig-spinner img').show();
166
} else {
171
}
172
function ig_validate_flush(ele){
173
if(ele.checked){
174
+ var c = confirm('<?php _e('please make sure every settings will be removed on plugin uninstall.','insta-gallery'); ?>');
175
if(!c){
176
ele.checked = false;
177
}
178
}
179
}
180
jQuery(function($){
181
+ var $igs_image_id = jQuery('input[name="igs_spinner_image_id"]');
182
+ var $igs_reset = jQuery('#igs-spinner_reset');
183
+
184
$('.ig_adv-setting input[name="igs-spinner"]').trigger('change');
185
jQuery('.ig_adv-setting-toggle').on('click',function(){
186
$(this).toggleClass('active');
198
{
199
},
200
success : function( response ) {
201
+ if ((typeof response === 'object') && response.hasOwnProperty('success')) {
202
+ $('.ig_adv-setting-fmsg').html(response.data);
203
setTimeout(function(){
204
$('.ig_adv-setting-fmsg').empty();
205
},2000);
211
{
212
});
213
});
214
+
215
+ // reset spinner to default
216
+ $igs_reset.click(function(){
217
+ $igs_image_id.val('');
218
+ ig_change_spinner();
219
+ jQuery(this).hide();
220
+ });
221
+
222
+ if($igs_image_id.val() == '')$igs_reset.hide();
223
+ if($igs_image_id.data('misrc') != '') ig_change_spinner($igs_image_id.data('misrc'));
224
+
225
+ // select media image
226
+ jQuery('#igs-spinner_media_manager').click(function(e) {
227
+
228
+ e.preventDefault();
229
+ var image_frame;
230
+ if(image_frame){
231
+ image_frame.open();
232
+ }
233
+ // Define image_frame as wp.media object
234
+ image_frame = wp.media({
235
+ title: 'Select Media',
236
+ multiple : false,
237
+ library : {
238
+ type : 'image',
239
+ }
240
+ });
241
+
242
+ image_frame.on('close',function() {
243
+ // On close, get selections and save to the hidden input
244
+ // plus other AJAX stuff to refresh the image preview
245
+ var selection = image_frame.state().get('selection');
246
+ if(selection.length){
247
+ var gallery_ids = new Array();
248
+ var i = 0,attachment_url;
249
+ selection.each(function(attachment) {
250
+ gallery_ids[i] = attachment['id'];
251
+ attachment_url = attachment.attributes.url;
252
+ i++;
253
+ });
254
+ var ids = gallery_ids.join(",");
255
+ $igs_image_id.val(ids);
256
+ ig_change_spinner(attachment_url)
257
+ }
258
+
259
+ // toggle reset button
260
+ if($igs_image_id.val() == ''){
261
+ $igs_reset.hide();
262
+ }else{
263
+ $igs_reset.show();
264
+ }
265
+
266
+ });
267
+
268
+ image_frame.on('open',function() {
269
+ // On open, get the id from the hidden input
270
+ // and select the appropiate images in the media manager
271
+ var selection = image_frame.state().get('selection');
272
+ ids = $igs_image_id.val().split(',');
273
+ ids.forEach(function(id) {
274
+ attachment = wp.media.attachment(id);
275
+ attachment.fetch();
276
+ selection.add( attachment ? [ attachment ] : [] );
277
+ });
278
+
279
+ });
280
+
281
+ image_frame.open();
282
+ });
283
});
284
</script>
app/wp-front.php CHANGED
@@ -3,67 +3,102 @@ if (! defined('ABSPATH')) {
3
die();
4
}
5
6
// registering session
7
- /* add_action('init', function(){
8
- if( !session_id() )
9
- session_start();
10
- }); */
11
-
12
- // Registering css.
13
- add_action('wp_enqueue_scripts', 'insgal_enqueue_scripts');
14
- function insgal_enqueue_scripts()
15
- {
16
- wp_enqueue_style('insta-gallery', INSGALLERY_URL . '/assets/insta-gallery.css',array(),INSGALLERY_VER);
17
- wp_enqueue_style( 'dashicons' );
18
-
19
- wp_register_script('insta-gallery', INSGALLERY_URL . '/assets/insta-gallery.js', array('jquery'),INSGALLERY_VER,true);
20
- wp_localize_script( 'insta-gallery', 'insgalajax', array(
21
- 'ajax_url' => admin_url( 'admin-ajax.php' )
22
- ));
23
- wp_register_script('swiper', INSGALLERY_URL . '/assets/swiper/swiper.jquery.min.js', array('jquery'),null,true);
24
- wp_register_script('magnific-popup', INSGALLERY_URL . '/assets/magnific-popup/jquery.magnific-popup.min.js', array('jquery'),null,true);
25
-
26
- }
27
- include_once (INSGALLERY_PATH . 'app/Libra/InstagramSpider.php');
28
-
29
-
30
- // shortcode added
31
- add_shortcode('insta-gallery', 'insta_gallery');
32
-
33
- // Insta-Gallery shortcode handler
34
- function insta_gallery($atts)
35
- {
36
- if (empty($atts) || ! isset($atts['id'])) {
37
- return;
38
- }
39
- $gid = (int) $atts['id'];
40
- $InstaGalleryItems = get_option('insta_gallery_items');
41
- $InstaGallerySetting = get_option('insta_gallery_setting');
42
- if (! isset($InstaGalleryItems[$gid])) {
43
- return;
44
- }
45
-
46
- wp_enqueue_script('insta-gallery');
47
-
48
- $IGItem = $InstaGalleryItems[$gid];
49
- if ($IGItem['ig_display_type'] == 'gallery') {
50
- wp_enqueue_script('magnific-popup');
51
- } else if ($IGItem['ig_display_type'] == 'carousel') {
52
- wp_enqueue_script('swiper');
53
- wp_enqueue_script('magnific-popup');
54
- }
55
-
56
- $insta_source = ($IGItem['ig_select_from'] == 'username') ? 'user_'. $IGItem['insta_user'] : 'tag_'. $IGItem['insta_tag'];
57
-
58
-
59
- $results = '';
60
- $results .= '<!--[if lte IE 8]><div class="igblock-wrap-IElte8"><![endif]-->';
61
- $results .= '<div class="ig-block" id="ig-block-'.$gid.'" data-igalid="'.$gid.'" data-source="'.$insta_source.'">';
62
- $results .= '<div class="ig-spinner">';
63
- if(!empty($InstaGallerySetting['igs_spinner'])){
64
- $results .= '<img src="'.$InstaGallerySetting['igs_spinner'].'" alt="Instagram Gallery" class="ig-spin" />';
65
- }else {
66
- $results .= '<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"
67
viewBox="0 0 551.034 551.034" style="enable-background:new 0 0 551.034 551.034;" xml:space="preserve">
68
<g>
69
<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)">
@@ -95,149 +130,235 @@ if (! defined('ABSPATH')) {
95
<circle style="fill:url(#SVGID_3_);" cx="418.31" cy="134.07" r="34.15"/>
96
</g>
97
</svg>';
98
- }
99
- $results .= '</div>';
100
- $results .= '</div> <!-- // IG BLOCK -->';
101
- $results .= '<!--[if lte IE 8]></div><![endif]-->';
102
- return $results;
103
- }
104
-
105
-
106
- // ajax request served
107
- add_action( 'wp_ajax_nopriv_load_ig_item', 'load_ig_item' );
108
- add_action( 'wp_ajax_load_ig_item', 'load_ig_item' );
109
-
110
- function load_ig_item() {
111
- // loading session for AJAX request
112
- if( !session_id()){
113
- session_start();
114
- }
115
-
116
- if (! isset($_POST['igalid']) ) {
117
- return;
118
- }
119
- $gid = (int)$_POST['igalid'];
120
- $InstaGalleryItems = get_option('insta_gallery_items');
121
- if (! isset($InstaGalleryItems[$gid])) {
122
- return;
123
- }
124
- $IGItem = $InstaGalleryItems[$gid];
125
- $IGItem['gid'] = $gid; // push gallery ID for later use
126
- $igs = new InstagramSpider();
127
-
128
- // validating options
129
- if (empty($IGItem['ig_select_from'])) {
130
- return;
131
- }
132
- $IGItem['insta_limit'] = (int) $IGItem['insta_limit'];
133
- $IGItem['insta_limit'] = (($IGItem['insta_limit'] > 0) && ($IGItem['insta_limit'] <= 20)) ? $IGItem['insta_limit'] : 12;
134
-
135
- $IGItem['insta_gal-hover'] = filter_var($IGItem['insta_gal-hover'], FILTER_VALIDATE_BOOLEAN);
136
- $IGItem['insta_gal-spacing'] = filter_var($IGItem['insta_gal-spacing'], FILTER_VALIDATE_BOOLEAN);
137
-
138
- $IGItem['insta_instalink'] = filter_var($IGItem['insta_instalink'], FILTER_VALIDATE_BOOLEAN);
139
- $IGItem['insta_instalink-text'] = empty($IGItem['insta_instalink-text']) ? 'view on Instagram' : $IGItem['insta_instalink-text'];
140
- $IGItem['insta_instalink-bgcolor'] = @$IGItem['insta_instalink-bgcolor'];
141
- $IGItem['insta_instalink-hvrcolor'] = @$IGItem['insta_instalink-hvrcolor'];
142
-
143
- $IGItem['insta_car-navarrows'] = @filter_var($IGItem['insta_car-navarrows'], FILTER_VALIDATE_BOOLEAN);
144
- $IGItem['insta_car-dots'] = @filter_var($IGItem['insta_car-dots'], FILTER_VALIDATE_BOOLEAN);
145
- $IGItem['insta_car-spacing'] = @filter_var($IGItem['insta_car-spacing'], FILTER_VALIDATE_BOOLEAN);
146
-
147
- $IGItem['insta_thumb-size'] = empty($IGItem['insta_thumb-size']) ? 'medium' : $IGItem['insta_thumb-size'];
148
- $IGItem['insta_hover-color'] = @$IGItem['insta_hover-color'];
149
- $IGItem['insta_gal-popup'] = filter_var($IGItem['insta_gal-popup'], FILTER_VALIDATE_BOOLEAN);
150
- $IGItem['insta_likes'] = @filter_var($IGItem['insta_likes'], FILTER_VALIDATE_BOOLEAN);
151
- $IGItem['insta_comments'] = @filter_var($IGItem['insta_comments'], FILTER_VALIDATE_BOOLEAN);
152
-
153
- // continue to results
154
- $results = '';
155
- $instaItems = '';
156
- $igsess_time = (current_user_can('administrator')) ? 60 : 300;
157
- if ($IGItem['ig_select_from'] == 'username') { // get from username
158
- if (! empty($IGItem['insta_user'])) { // valid Instagram Username
159
- $sk = 'user_'.$IGItem['insta_user'];
160
- if(isset($_SESSION['IGSession'][$sk])) {
161
- $time = ($igsess_time - (time() - $_SESSION['IGSession'][$sk]['started']));
162
- if($time <= 0) { // refresh session if expired
163
- $instaItems = $igs->getUserItems($IGItem['insta_user']);
164
- $_SESSION['IGSession'][$sk]['started'] = time();
165
- $_SESSION['IGSession'][$sk]['items'] = $instaItems;
166
- }else {
167
- $instaItems = $_SESSION['IGSession'][$sk]['items'];
168
- }
169
- } else { // create new session
170
- $instaItems = $igs->getUserItems($IGItem['insta_user']);
171
- $_SESSION['IGSession'][$sk]['started'] = time();
172
- $_SESSION['IGSession'][$sk]['items'] = $instaItems;
173
- }
174
- }
175
- } else { // continue to tag
176
- if (! empty($IGItem['insta_tag'])) { // valid Instagram Tag;
177
- $sk = 'tag_'.$IGItem['insta_tag'];
178
- if(isset($_SESSION['IGSession'][$sk])){
179
- $time = ($igsess_time - (time() - $_SESSION['IGSession'][$sk]['started']));
180
- if($time <= 0) { // refresh session if expired
181
- $instaItems = $igs->getTagItems($IGItem['insta_tag']);
182
- $_SESSION['IGSession'][$sk]['started'] = time();
183
- $_SESSION['IGSession'][$sk]['items'] = $instaItems;
184
- }else {
185
- $instaItems = $_SESSION['IGSession'][$sk]['items'];
186
- }
187
- } else { // create new session
188
- $instaItems = $igs->getTagItems($IGItem['insta_tag']);
189
- $_SESSION['IGSession'][$sk]['started'] = time();
190
- $_SESSION['IGSession'][$sk]['items'] = $instaItems;
191
- }
192
- }
193
- }
194
-
195
- if (! empty($instaItems)) {
196
-
197
- $insta_source = ($IGItem['ig_select_from'] == 'username') ? 'user_' . $IGItem['insta_user'] : 'tag_'. $IGItem['insta_tag'];
198
-
199
- $instaUrl = 'https://www.instagram.com/';
200
- if($IGItem['ig_select_from'] == 'username') {
201
- $instaUrl .= $IGItem['insta_user'];
202
- } else {
203
- $instaUrl .= 'explore/tags/'.$IGItem['insta_tag'];
204
- }
205
-
206
- if ($IGItem['ig_display_type'] == 'gallery') {
207
- include (INSGALLERY_PATH . 'templates/gallery.php');
208
- } else if ($IGItem['ig_display_type'] == 'carousel') {
209
- include (INSGALLERY_PATH . 'templates/carousel.php');
210
- } else {
211
- if (current_user_can('administrator')) {
212
- $results .= '<div class="ig-no-items-msg"><p class="ig_front_msg-color">ERROR: invalid display type, please check gallery settings.</p></div>';
213
- }
214
- }
215
- } else {
216
- if (current_user_can('administrator')) {
217
- $results .= '<div class="ig-no-items-msg"><p class="ig_front_msg-color"><strong>(Admin Notice) ERROR:</strong> unable to get results. possible reasons:</p>';
218
- $results .= '<ul>';
219
- $results .= '<li>your Instagram account may be private.</li>';
220
- $results .= '<li>inavalid Instagram username/tag.</li>';
221
- $results .= '<li>network or server issue.</li>';
222
-
223
- $igsMsgs = $igs->getMessages();
224
- if(!empty($igsMsgs)){
225
- foreach ($igsMsgs as $igsMsg){
226
- $results .= "<li>$igsMsg</li>";
227
- }
228
- }
229
-
230
- $results .= '</ul></div>';
231
- }
232
- }
233
- // echo $results;
234
- $result = array(
235
- 'igsuccess' => true,
236
- 'result' => $results,
237
- );
238
- echo json_encode($result);
239
- die();
240
- }
241
242
243
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
+ wp_register_script('swiper', INSGALLERY_URL . '/assets/swiper/swiper.jquery.min.js', array(
58
+ 'jquery'
59
+ ), null, true);
60
+ wp_register_script('magnific-popup', INSGALLERY_URL . '/assets/magnific-popup/jquery.magnific-popup.min.js', array(
61
+ 'jquery'
62
+ ), null, true);
63
+ }
64
+ include_once (INSGALLERY_PATH . 'app/Libra/InstagramSpider.php');
65
+
66
+ // shortcode added
67
+ add_shortcode('insta-gallery', 'insta_gallery');
68
+
69
+ // Insta-Gallery shortcode handler
70
+ function insta_gallery($atts)
71
+ {
72
+ if (empty($atts) || ! isset($atts['id'])) {
73
+ return;
74
+ }
75
+ // update/validate attributes
76
+ $atts = shortcode_atts(array(
77
+ 'id' => 0,
78
+ 'ajax' => true
79
+ ), $atts);
80
+ $atts['ajax'] = filter_var($atts['ajax'], FILTER_VALIDATE_BOOLEAN);
81
+
82
+ $gid = (int) $atts['id'];
83
+ $InstaGalleryItems = get_option('insta_gallery_items');
84
+ $InstaGallerySetting = get_option('insta_gallery_setting');
85
+ if (! isset($InstaGalleryItems[$gid])) {
86
+ return;
87
+ }
88
+
89
+ wp_enqueue_script('insta-gallery');
90
+
91
+ $IGItem = $InstaGalleryItems[$gid];
92
+ if ($IGItem['ig_display_type'] == 'gallery') {
93
+ wp_enqueue_script('magnific-popup');
94
+ } else if ($IGItem['ig_display_type'] == 'carousel') {
95
+ wp_enqueue_script('swiper');
96
+ wp_enqueue_script('magnific-popup');
97
+ }
98
+
99
+ $insta_source = ($IGItem['ig_select_from'] == 'username') ? 'user_' . $IGItem['insta_user'] : 'tag_' . $IGItem['insta_tag'];
100
+
101
+ $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"
102
viewBox="0 0 551.034 551.034" style="enable-background:new 0 0 551.034 551.034;" xml:space="preserve">
103
<g>
104
<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)">
130
<circle style="fill:url(#SVGID_3_);" cx="418.31" cy="134.07" r="34.15"/>
131
</g>
132
</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
+ $igs = new InstagramSpider();
181
+
182
+ // validating options
183
+ if (empty($IGItem['ig_select_from'])) {
184
+ return;
185
+ }
186
+ $IGItem['insta_limit'] = (int) $IGItem['insta_limit'];
187
+ $IGItem['insta_limit'] = (($IGItem['insta_limit'] > 0) && ($IGItem['insta_limit'] <= 20)) ? $IGItem['insta_limit'] : 12;
188
+
189
+ $IGItem['insta_gal-hover'] = filter_var($IGItem['insta_gal-hover'], FILTER_VALIDATE_BOOLEAN);
190
+ $IGItem['insta_gal-spacing'] = filter_var($IGItem['insta_gal-spacing'], FILTER_VALIDATE_BOOLEAN);
191
+
192
+ $IGItem['insta_instalink'] = filter_var($IGItem['insta_instalink'], FILTER_VALIDATE_BOOLEAN);
193
+ $IGItem['insta_instalink-text'] = empty($IGItem['insta_instalink-text']) ? 'view on Instagram' : $IGItem['insta_instalink-text'];
194
+ $IGItem['insta_instalink-bgcolor'] = @$IGItem['insta_instalink-bgcolor'];
195
+ $IGItem['insta_instalink-hvrcolor'] = @$IGItem['insta_instalink-hvrcolor'];
196
+
197
+ $IGItem['insta_car-autoplay'] = isset($IGItem['insta_car-autoplay']) ? filter_var($IGItem['insta_car-autoplay'], FILTER_VALIDATE_BOOLEAN) : true;
198
+ $IGItem['insta_car-navarrows'] = @filter_var($IGItem['insta_car-navarrows'], FILTER_VALIDATE_BOOLEAN);
199
+ $IGItem['insta_car-navarrows-color'] = @$IGItem['insta_car-navarrows-color'];
200
+ $IGItem['insta_car-dots'] = @filter_var($IGItem['insta_car-dots'], FILTER_VALIDATE_BOOLEAN);
201
+ $IGItem['insta_car-spacing'] = @filter_var($IGItem['insta_car-spacing'], FILTER_VALIDATE_BOOLEAN);
202
+
203
+ $IGItem['insta_thumb-size'] = empty($IGItem['insta_thumb-size']) ? 'medium' : $IGItem['insta_thumb-size'];
204
+ $IGItem['insta_hover-color'] = @$IGItem['insta_hover-color'];
205
+ $IGItem['insta_gal-popup'] = filter_var($IGItem['insta_gal-popup'], FILTER_VALIDATE_BOOLEAN);
206
+ $IGItem['insta_popup-caption'] = filter_var($IGItem['insta_popup-caption'], FILTER_VALIDATE_BOOLEAN);
207
+ $IGItem['insta_likes'] = @filter_var($IGItem['insta_likes'], FILTER_VALIDATE_BOOLEAN);
208
+ $IGItem['insta_comments'] = @filter_var($IGItem['insta_comments'], FILTER_VALIDATE_BOOLEAN);
209
+
210
+ // continue to results
211
+ $results = '';
212
+ $instaItems = '';
213
+ if ($IGItem['ig_select_from'] == 'username') { // get from username
214
+ if (! empty($IGItem['insta_user'])) { // valid Instagram Username
215
+ $tk = 'instagallery_user_' . $IGItem['insta_user']; // transient key
216
+ $tkart = $tk . '_artimeout'; // transient key admin request timeout
217
+ if (current_user_can('administrator') && (false === get_transient($tkart))) {
218
+
219
+ $instaItems = $igs->getUserItems($IGItem['insta_user']);
220
+ if (! empty($instaItems)) {
221
+ set_transient($tk, $instaItems, HOUR_IN_SECONDS);
222
+ set_transient($tkart, true, 5 * MINUTE_IN_SECONDS);
223
+ }
224
+ } else {
225
+ // Get any existing copy of our transient data
226
+ if (false === ($instaItems = get_transient($tk))) {
227
+ $instaItems = $igs->getUserItems($IGItem['insta_user']);
228
+ if (! empty($instaItems)) {
229
+ set_transient($tk, $instaItems, HOUR_IN_SECONDS);
230
+ }
231
+ }
232
+ }
233
+
234
+ // retry again if no results
235
+ if (empty($instaItems)) {
236
+ $instaItems = $igs->getUserItems($IGItem['insta_user']);
237
+ if (! empty($instaItems)) {
238
+ set_transient($tk, $instaItems, HOUR_IN_SECONDS);
239
+ }
240
+ }
241
+ }
242
+ } else { // continue to tag
243
+ if (! empty($IGItem['insta_tag'])) { // valid Instagram Tag;
244
+ $tk = 'instagallery_tag_' . $IGItem['insta_tag']; // transient key
245
+ $tkart = $tk . '_artimeout'; // transient key admin request timeout
246
+ if (current_user_can('administrator') && (false === get_transient($tkart))) {
247
+ $instaItems = $igs->getTagItems($IGItem['insta_tag']);
248
+ if (! empty($instaItems)) {
249
+ set_transient($tk, $instaItems, HOUR_IN_SECONDS);
250
+ set_transient($tkart, true, 5 * MINUTE_IN_SECONDS);
251
+ }
252
+ } else {
253
+ // Get any existing copy of our transient data
254
+ if (false === ($instaItems = get_transient($tk))) {
255
+ $instaItems = $igs->getTagItems($IGItem['insta_tag']);
256
+ if (! empty($instaItems)) {
257
+ set_transient($tk, $instaItems, HOUR_IN_SECONDS);
258
+ }
259
+ }
260
+ }
261
+ // retry again if no results
262
+ if (empty($instaItems)) {
263
+ $instaItems = $igs->getTagItems($IGItem['insta_tag']);
264
+ if (! empty($instaItems)) {
265
+ set_transient($tk, $instaItems, HOUR_IN_SECONDS);
266
+ }
267
+ }
268
+ }
269
+ }
270
+
271
+ if (! empty($instaItems)) {
272
+
273
+ $insta_source = ($IGItem['ig_select_from'] == 'username') ? 'user_' . $IGItem['insta_user'] : 'tag_' . $IGItem['insta_tag'];
274
+
275
+ $instaUrl = 'https://www.instagram.com/';
276
+ if ($IGItem['ig_select_from'] == 'username') {
277
+ $instaUrl .= $IGItem['insta_user'];
278
+ } else {
279
+ $instaUrl .= 'explore/tags/' . $IGItem['insta_tag'];
280
+ }
281
+
282
+ if ($IGItem['ig_display_type'] == 'gallery') {
283
+ ob_start();
284
+ // include (INSGALLERY_PATH . 'templates/gallery.php');
285
+ include insgal_template_path('gallery.php');
286
+ $results .= ob_get_clean();
287
+
288
+ // output dynamic CSS to head
289
+ $IGBSelector = '#ig-block-' . $IGItem['gid']; // Gallery block selector
290
+ $ig_dstyle = '';
291
+ if (! empty($IGItem['insta_hover-color'])) {
292
+ $ig_dstyle .= $IGBSelector . ' .ig-item.ighover a:hover:after, ' . $IGBSelector . ' .swiper-slide a:hover:after {background: ' . $IGItem['insta_hover-color'] . ';}';
293
+ }
294
+ if (! empty($IGItem['insta_instalink-bgcolor'])) {
295
+ $ig_dstyle .= $IGBSelector . ' .instagallery-actions .igact-instalink {background: ' . $IGItem['insta_instalink-bgcolor'] . ';}';
296
+ }
297
+ if (! empty($IGItem['insta_instalink-hvrcolor'])) {
298
+ $ig_dstyle .= $IGBSelector . ' .instagallery-actions .igact-instalink:hover {background: ' . $IGItem['insta_instalink-hvrcolor'] . ';}';
299
+ }
300
+ if (! empty($ig_dstyle)) {
301
+ $results .= "<script>jQuery(function(){jQuery('head').append('<style>$ig_dstyle</style>');});</script>";
302
+ }
303
+ } else if ($IGItem['ig_display_type'] == 'carousel') {
304
+ ob_start();
305
+ // include (INSGALLERY_PATH . 'templates/carousel.php');
306
+ include insgal_template_path('carousel.php');
307
+ $results .= ob_get_clean();
308
+
309
+ // output dynamic CSS to head
310
+ $IGBSelector = '#ig-block-' . $IGItem['gid']; // Gallery block selector
311
+ $ig_dstyle = '';
312
+ if (! empty($IGItem['insta_car-navarrows-color'])) {
313
+ $ig_dstyle .= $IGBSelector . ' .instacarousel .swiper-button-next svg, ' . $IGBSelector . ' .instacarousel .swiper-button-prev svg {fill: ' . $IGItem['insta_car-navarrows-color'] . ';}';
314
+ }
315
+ if (! empty($IGItem['insta_hover-color'])) {
316
+ $ig_dstyle .= $IGBSelector . ' .ig-item.ighover a:hover:after, ' . $IGBSelector . ' .swiper-slide a:hover:after {background: ' . $IGItem['insta_hover-color'] . ';}';
317
+ }
318
+ if (! empty($IGItem['insta_instalink-bgcolor'])) {
319
+ $ig_dstyle .= $IGBSelector . ' .instagallery-actions .igact-instalink {background: ' . $IGItem['insta_instalink-bgcolor'] . ';}';
320
+ }
321
+ if (! empty($IGItem['insta_instalink-hvrcolor'])) {
322
+ $ig_dstyle .= $IGBSelector . ' .instagallery-actions .igact-instalink:hover {background: ' . $IGItem['insta_instalink-hvrcolor'] . ';}';
323
+ }
324
+ if (! empty($ig_dstyle)) {
325
+ $results .= "<script>jQuery(function(){jQuery('head').append('<style>$ig_dstyle</style>');});</script>";
326
+ }
327
+ } else {
328
+ if (current_user_can('administrator')) {
329
+ $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>';
330
+ }
331
+ }
332
+ } else {
333
+ if (current_user_can('administrator')) {
334
+ $results .= '<div class="ig-no-items-msg"><p class="ig_front_msg-color"><strong>Admin Notice:</strong> unable to get results. possible reasons:</p>';
335
+ $results .= '<ul>';
336
+ $results .= '<li>' . __('Instagram account may be private or inavalid username/tagname.', 'insta-gallery') . '</li>';
337
+ $results .= '<li>' . __('network or server side issue.', 'insta-gallery') . '</li>';
338
+ $igsMsgs = $igs->getMessages();
339
+ if (! empty($igsMsgs)) {
340
+ foreach ($igsMsgs as $igsMsg) {
341
+ $results .= '<li>' . $igsMsg . '</li>';
342
+ }
343
+ }
344
+ $results .= '</ul></div>';
345
+ }
346
+ }
347
+ // echo $results;
348
+ /*
349
+ * $result = array(
350
+ * 'igsuccess' => true,
351
+ * 'result' => $results
352
+ * );
353
+ * echo json_encode($result);
354
+ * die();
355
+ */
356
+ if (isset($_REQUEST['insgal_ajax']) && ! $_REQUEST['insgal_ajax']) {
357
+ return $results;
358
+ } else {
359
+ wp_send_json_success($results);
360
+ }
361
+ }
362
363
364
app/wp-panel.php CHANGED
@@ -1,5 +1,8 @@
1
<?php
2
- /**
3
* Instagram Gallery
4
* WP admin panel plugin page
5
*/
@@ -7,18 +10,16 @@
7
// current page url
8
define('INSGALLERY_URL_ADMIN_PAGE', menu_page_url('insta_gallery', false));
9
10
-
11
-
12
$InstaGalleryItems = get_option('insta_gallery_items');
13
$ig_page_msgs = array();
14
// add/update gallery item
15
if (isset($_POST['ig-form-update'])) {
16
// filtering data
17
- $POSTDATA = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
18
$IGItem = array();
19
$IGItem['ig_select_from'] = $POSTDATA['ig_select_from'];
20
- $IGItem['insta_user'] = (string)$POSTDATA['insta_user'];
21
- $IGItem['insta_tag'] = (string)$POSTDATA['insta_tag'];
22
$IGItem['insta_limit'] = $POSTDATA['insta_limit'];
23
$IGItem['ig_display_type'] = $POSTDATA['ig_display_type'];
24
$IGItem['insta_gal-cols'] = $POSTDATA['insta_gal-cols'];
@@ -29,24 +30,26 @@ if (isset($_POST['ig-form-update'])) {
29
$IGItem['insta_instalink-bgcolor'] = sanitize_text_field(@$POSTDATA['insta_instalink-bgcolor']);
30
$IGItem['insta_instalink-hvrcolor'] = sanitize_text_field(@$POSTDATA['insta_instalink-hvrcolor']);
31
$IGItem['insta_car-slidespv'] = $POSTDATA['insta_car-slidespv'];
32
- $IGItem['insta_car-navarrows'] = @$POSTDATA['insta_car-navarrows'];
33
$IGItem['insta_car-dots'] = @$POSTDATA['insta_car-dots'];
34
$IGItem['insta_car-spacing'] = @$POSTDATA['insta_car-spacing'];
35
$IGItem['insta_thumb-size'] = @$POSTDATA['insta_thumb-size'];
36
$IGItem['insta_hover-color'] = sanitize_text_field(@$POSTDATA['insta_hover-color']);
37
$IGItem['insta_gal-popup'] = @$POSTDATA['insta_gal-popup'];
38
$IGItem['insta_likes'] = @$POSTDATA['insta_likes'];
39
$IGItem['insta_comments'] = @$POSTDATA['insta_comments'];
40
41
// removing @, # and trimming input
42
$IGItem['insta_user'] = trim($IGItem['insta_user']);
43
$IGItem['insta_tag'] = trim($IGItem['insta_tag']);
44
- if (substr($IGItem['insta_user'], 0, 1) == '@')
45
- $IGItem['insta_user'] = substr($IGItem['insta_user'], 1);
46
- if (substr($IGItem['insta_tag'], 0, 1) == '#')
47
- $IGItem['insta_tag'] = substr($IGItem['insta_tag'], 1);
48
49
-
50
if (isset($POSTDATA['igitem_id'])) {
51
$InstaGalleryItems[(int) $POSTDATA['igitem_id']] = $IGItem;
52
} else {
@@ -56,8 +59,8 @@ if (isset($_POST['ig-form-update'])) {
56
unset($InstaGalleryItems[0]);
57
}
58
}
59
- update_option('insta_gallery_items', $InstaGalleryItems);
60
- $ig_page_msgs[] = 'Gallery item updated successfully.';
61
}
62
63
// delete gallery item
@@ -65,9 +68,9 @@ if (isset($_GET['ig_item_delete'])) {
65
$item_id = (int) $_GET['ig_item_delete'];
66
if (isset($InstaGalleryItems[$item_id])) {
67
unset($InstaGalleryItems[$item_id]);
68
- update_option('insta_gallery_items', $InstaGalleryItems);
69
}
70
- $ig_page_msgs[] = 'Gallery item deleted successfully.';
71
}
72
73
?>
@@ -75,16 +78,15 @@ if (isset($_GET['ig_item_delete'])) {
75
<div class="wrap">
76
<header class="ig-page-header">
77
<img src="<?php echo INSGALLERY_URL; ?>/assets/media/icon-128x128.jpg" class="ig-logo" />
78
- <h3>Instagram Gallery:</h3>
79
- <p>easy way to display your Instagram pictures on the website.</p>
80
</header>
81
<hr />
82
<div class="ig-page-content">
83
<?php
84
if (! empty($ig_page_msgs)) {
85
foreach ($ig_page_msgs as $ig_page_msg) {
86
- echo '<div class="notice updated my-acf-notice is-dismissible ig_page_msg" ><p>' .
87
- $ig_page_msg . '</p></div>';
88
}
89
}
90
?>
1
<?php
2
+ if (! defined('ABSPATH')) {
3
+ die();
4
+ }
5
+ /*
6
* Instagram Gallery
7
* WP admin panel plugin page
8
*/
10
// current page url
11
define('INSGALLERY_URL_ADMIN_PAGE', menu_page_url('insta_gallery', false));
12
13
$InstaGalleryItems = get_option('insta_gallery_items');
14
$ig_page_msgs = array();
15
// add/update gallery item
16
if (isset($_POST['ig-form-update'])) {
17
// filtering data
18
+ $POSTDATA = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
19
$IGItem = array();
20
$IGItem['ig_select_from'] = $POSTDATA['ig_select_from'];
21
+ $IGItem['insta_user'] = (string) $POSTDATA['insta_user'];
22
+ $IGItem['insta_tag'] = (string) $POSTDATA['insta_tag'];
23
$IGItem['insta_limit'] = $POSTDATA['insta_limit'];
24
$IGItem['ig_display_type'] = $POSTDATA['ig_display_type'];
25
$IGItem['insta_gal-cols'] = $POSTDATA['insta_gal-cols'];
30
$IGItem['insta_instalink-bgcolor'] = sanitize_text_field(@$POSTDATA['insta_instalink-bgcolor']);
31
$IGItem['insta_instalink-hvrcolor'] = sanitize_text_field(@$POSTDATA['insta_instalink-hvrcolor']);
32
$IGItem['insta_car-slidespv'] = $POSTDATA['insta_car-slidespv'];
33
+ $IGItem['insta_car-autoplay'] = isset($POSTDATA['insta_car-autoplay']) ? $POSTDATA['insta_car-autoplay'] : 0;
34
+ $IGItem['insta_car-navarrows'] = @$POSTDATA['insta_car-navarrows'];
35
+ $IGItem['insta_car-navarrows-color'] = sanitize_text_field(@$POSTDATA['insta_car-navarrows-color']);
36
$IGItem['insta_car-dots'] = @$POSTDATA['insta_car-dots'];
37
$IGItem['insta_car-spacing'] = @$POSTDATA['insta_car-spacing'];
38
$IGItem['insta_thumb-size'] = @$POSTDATA['insta_thumb-size'];
39
$IGItem['insta_hover-color'] = sanitize_text_field(@$POSTDATA['insta_hover-color']);
40
$IGItem['insta_gal-popup'] = @$POSTDATA['insta_gal-popup'];
41
+ $IGItem['insta_popup-caption'] = @$POSTDATA['insta_popup-caption'];
42
$IGItem['insta_likes'] = @$POSTDATA['insta_likes'];
43
$IGItem['insta_comments'] = @$POSTDATA['insta_comments'];
44
45
// removing @, # and trimming input
46
$IGItem['insta_user'] = trim($IGItem['insta_user']);
47
$IGItem['insta_tag'] = trim($IGItem['insta_tag']);
48
+ $IGItem['insta_user'] = str_replace( '@', '', $IGItem['insta_user'] );
49
+ $IGItem['insta_user'] = str_replace( '#', '', $IGItem['insta_user'] );
50
+ $IGItem['insta_tag'] = str_replace( '@', '', $IGItem['insta_tag'] );
51
+ $IGItem['insta_tag'] = str_replace( '#', '', $IGItem['insta_tag'] );
52
53
if (isset($POSTDATA['igitem_id'])) {
54
$InstaGalleryItems[(int) $POSTDATA['igitem_id']] = $IGItem;
55
} else {
59
unset($InstaGalleryItems[0]);
60
}
61
}
62
+ update_option('insta_gallery_items', $InstaGalleryItems, false);
63
+ $ig_page_msgs[] = __('Gallery item updated successfully.', 'insta-gallery');
64
}
65
66
// delete gallery item
68
$item_id = (int) $_GET['ig_item_delete'];
69
if (isset($InstaGalleryItems[$item_id])) {
70
unset($InstaGalleryItems[$item_id]);
71
+ update_option('insta_gallery_items', $InstaGalleryItems, false);
72
}
73
+ $ig_page_msgs[] = __('Gallery item deleted successfully.', 'insta-gallery');
74
}
75
76
?>
78
<div class="wrap">
79
<header class="ig-page-header">
80
<img src="<?php echo INSGALLERY_URL; ?>/assets/media/icon-128x128.jpg" class="ig-logo" />
81
+ <h3><?php _e('Instagram Gallery','insta-gallery'); ?></h3>
82
+ <p><?php _e('easy way to display Instagram pictures on the website.','insta-gallery'); ?></p>
83
</header>
84
<hr />
85
<div class="ig-page-content">
86
<?php
87
if (! empty($ig_page_msgs)) {
88
foreach ($ig_page_msgs as $ig_page_msg) {
89
+ echo '<div class="notice updated my-acf-notice is-dismissible ig_page_msg" ><p>' . $ig_page_msg . '</p></div>';
90
}
91
}
92
?>
app/wp-widget.php ADDED
@@ -0,0 +1,96 @@
1
+ <?php
2
+ if (! defined('ABSPATH')) {
3
+ die();
4
+ }
5
+ /**
6
+ * Instagram Gallery
7
+ * WP widget
8
+ */
9
+
10
+ add_action('widgets_init', function () {
11
+ register_widget('instagal_widget');
12
+ });
13
+
14
+ class instagal_widget extends WP_Widget
15
+ {
16
+
17
+ public function __construct()
18
+ {
19
+ parent::__construct('instagal_widget', __('Instagram Gallery', 'insta-gallery'), array(
20
+ 'classname' => 'instagal-widget',
21
+ 'description' => esc_html__('Displays your Instagram Gallery', 'insta-gallery')
22
+ ));
23
+ }
24
+
25
+ public function widget($args, $instance)
26
+ {
27
+ $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
28
+ $instagal_id = empty($instance['instagal_id']) ? '' : $instance['instagal_id'];
29
+
30
+ echo $args['before_widget'];
31
+
32
+ if (! empty($title)) {
33
+ echo $args['before_title'] . wp_kses_post($title) . $args['after_title'];
34
+ }
35
+
36
+ if (! empty($instagal_id)) {
37
+ echo do_shortcode('[insta-gallery id="' . $instagal_id . '"]');
38
+ }
39
+
40
+ echo $args['after_widget'];
41
+ }
42
+
43
+ public function form($instance)
44
+ {
45
+ $instance = wp_parse_args( (array) $instance, array(
46
+ 'title' => '',
47
+ 'instagal_id' => 0,
48
+ ) );
49
+
50
+ $title = $instance['title'];
51
+ $instagal_id = $instance['instagal_id'];
52
+ $InstaGalleryItems = get_option('insta_gallery_items');
53
+ ?>
54
+ <p>
55
+ <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'insta-gallery' ); ?>: <input class="widefat"
56
+ id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text"
57
+ value="<?php echo esc_attr( $title ); ?>" /></label>
58
+ </p>
59
+
60
+ <?php if( !empty($InstaGalleryItems) && is_array($InstaGalleryItems) ): ?>
61
+ <p>
62
+ <label for="<?php echo esc_attr( $this->get_field_id( 'instagal_id' ) ); ?>"><?php esc_html_e( 'Select Instagram Gallery', 'insta-gallery' ); ?>: </label> <select
63
+ id="<?php echo esc_attr( $this->get_field_id( 'instagal_id' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'instagal_id' ) ); ?>" class="widefat">
64
+ <?php
65
+ foreach ($InstaGalleryItems as $k => $IGItem) {
66
+ $label = '';
67
+ if ($IGItem['ig_select_from'] == 'username') {
68
+ $label = __('Username', 'insta-gallery') . ' / ' . $IGItem['insta_user'];
69
+ } else {
70
+ $label = __('Tagname', 'insta-gallery') . ' / ' . $IGItem['insta_tag'];
71
+ }
72
+ ?>
73
+ <option value="<?php echo $k; ?>" <?php selected( $k, $instagal_id ) ?>><?php echo $label; ?></option>
74
+ <?php } ?>
75
+ </select>
76
+ </p>
77
+ <?php else: ?>
78
+ <p style="color: #e23565;">
79
+ <?php _e('Please add Gallery item in plugin panel, Then come back and select your Gallery to display.','insta-gallery'); ?>
80
+ </p>
81
+ <?php endif; ?>
82
+ <p style="text-align: center;" >
83
+ <a href="options-general.php?page=insta_gallery"><?php _e('Add New Gallery','insta-gallery'); ?></a>
84
+ </p>
85
+
86
+ <?php
87
+ }
88
+
89
+ public function update($new_instance, $old_instance)
90
+ {
91
+ $instance = $old_instance;
92
+ $instance['title'] = strip_tags($new_instance['title']);
93
+ $instance['instagal_id'] = trim(strip_tags($new_instance['instagal_id']));
94
+ return $instance;
95
+ }
96
+ }
assets/admin-style.css CHANGED
@@ -8,12 +8,6 @@
8
max-height: 55px;
9
}
10
11
- .ig-no-items-msg {
12
- background: #ddd;
13
- padding: 50px 30px;
14
- color: #dd2b74;
15
- font-size: 22px;
16
- }
17
18
.ig-list-buttons {
19
display: inline-block;
@@ -42,6 +36,7 @@
42
z-index: 9;
43
cursor: pointer;
44
-webkit-transition: all 0.25s linear;
45
}
46
47
.ig-list-buttons li:hover label {
@@ -58,8 +53,8 @@
58
top: 5px;
59
left: 10px;
60
z-index: 5;
61
- transition: border .25s linear;
62
-webkit-transition: border .25s linear;
63
}
64
65
.ig-list-buttons li:hover .check {