Version Description
- Important: On March 2, Instagram will stop supporting its old API which will disrupt feeds created from personal connected accounts. If you are using a personal account, you will need to reconnect the account on the Instagram Feed Settings page. Please see here for more information.
- New: Support added for the new Instagram Basic Display API.
- New: Added PHP hooks 'sbi_before_feed' and 'sbi_after_feed' for displaying HTML before and after the main Instagram feed HTML.
- New: Added settings for adding a custom header avatar and custom header bio text. Go to the "Customize" tab "Header" area to set these or use customavatar="AVATAR URL" or custombio="BIO TEXT" in the shortcode.
- Tweak: Warnings and messages displaying on the front end of sites now display at the top of the feed.
- Tweak: Header template changed to accommodate missing data if connected as a personal account to the new API.
- Tweak: Changes to feed.php, header.php, and item.php templates.
- Tweak: Added CSS to prevent some themes from adding box shadows and bottom border when hovering over the header.
- Tweak: Added code to clear page caching from Litespeed cache when clearing page caches with the plugin.
- Tweak: Header and follow button will still be displayed when number of posts is set to 0.
- Fix: Emoji in the first few characters of a caption would cause the main post image to switch to an emoji when loading more.
- Fix: Pagination for "tagged" feeds not working for certain accounts.
Download this release
Release Info
Developer | smashballoon |
Plugin | Instagram Feed |
Version | 2.2 |
Comparing to | |
See all releases |
Code changes from version 2.1.5 to 2.2
- README.txt +44 -30
- css/sb-instagram-2-2.css +819 -0
- css/sb-instagram-2-2.min.css +1 -0
- css/sb-instagram-admin.css +123 -70
- css/sb-instagram.css +76 -1
- css/sb-instagram.min.css +1 -1
- inc/admin/actions.php +354 -23
- inc/admin/main.php +422 -289
- inc/class-sb-instagram-api-connect.php +15 -13
- inc/class-sb-instagram-feed.php +57 -6
- inc/class-sb-instagram-parse.php +9 -3
- inc/class-sb-instagram-posts-manager.php +39 -1
- inc/class-sb-instagram-settings.php +132 -28
- inc/class-sb-instagram-token-refresher.php +176 -0
- inc/if-functions.php +44 -7
- instagram-feed.php +53 -3
- js/sb-instagram-2-2.js +891 -0
- js/sb-instagram-2-2.min.js +1 -0
- js/sb-instagram-admin-2-2.js +961 -0
- js/sb-instagram-admin.js +163 -67
- js/sb-instagram.js +5 -2
- js/sb-instagram.min.js +1 -1
- templates/feed.php +20 -6
- templates/footer.php +2 -2
- templates/header.php +13 -5
- templates/item.php +2 -2
README.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: smashballoon, craig-at-smash-balloon
|
|
3 |
Tags: Instagram, Instagram feed, Instagram photos, Instagram widget, Instagram gallery
|
4 |
Requires at least: 3.4
|
5 |
Tested up to: 5.3
|
6 |
-
Stable tag: 2.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -64,7 +64,7 @@ For a pop-up photo **lightbox**, to display posts by **hashtag**, show photo **c
|
|
64 |
|
65 |
1. Install the Instagram Feed plugin either via the WordPress plugin directory, or by uploading the files to your web server (in the `/wp-content/plugins/` directory).
|
66 |
2. Activate the Instagram Feed plugin through the 'Plugins' menu in WordPress.
|
67 |
-
3. Navigate to the 'Instagram Feed' settings page to
|
68 |
4. Use the shortcode `[instagram-feed]` in your page, post or widget to display your Instagram photos.
|
69 |
5. You can display multiple Instagram feeds by using shortcode options, for example: `[instagram-feed num=6 cols=3]`
|
70 |
|
@@ -80,16 +80,18 @@ Copy and paste the following shortcode directly into the page, post or widget wh
|
|
80 |
|
81 |
If you'd like to display multiple Instagram feeds then you can set different settings directly in the shortcode like so: `[instagram-feed num=9 cols=3]`
|
82 |
|
|
|
|
|
83 |
You can display as many different Instagram feeds as you like, on either the same page or on different pages, by just using the shortcode options below. For example:
|
84 |
`[instagram-feed]`
|
85 |
-
`[instagram-feed
|
86 |
-
`[instagram-feed
|
87 |
|
88 |
See the table below for a full list of available shortcode options:
|
89 |
|
90 |
= Shortcode Options =
|
91 |
* **General Options**
|
92 |
-
* **
|
93 |
* **width** - The width of your Instagram feed. Any number - Example: `[instagram-feed width=50]`
|
94 |
* **widthunit** - The unit of the width of your Instagram feed. 'px' or '%' - Example: `[instagram-feed widthunit=%]`
|
95 |
* **height** - The height of your Instagram feed. Any number - Example: `[instagram-feed height=250]`
|
@@ -109,6 +111,10 @@ See the table below for a full list of available shortcode options:
|
|
109 |
*
|
110 |
* **Header Options**
|
111 |
* **showheader** - Whether to show the Instagram feed Header. 'true' or 'false' - Example: `[instagram-feed showheader=false]`
|
|
|
|
|
|
|
|
|
112 |
* **headercolor** - The color of the Instagram feed Header text. Any hex color code - Example: `[instagram-feed headercolor=#333]`
|
113 |
*
|
114 |
* **'Load More' Button Options**
|
@@ -129,43 +135,39 @@ For more shortcode options, check out the [Pro version](http://smashballoon.com/
|
|
129 |
|
130 |
1) Once you've installed the Instagram Feed plugin click on the Instagram Feed item in your WordPress menu
|
131 |
|
132 |
-
2) Click on the large blue Instagram button to log into your Instagram account and
|
133 |
|
134 |
-
|
135 |
|
136 |
-
|
137 |
|
138 |
-
4)
|
139 |
|
140 |
-
5)
|
141 |
|
142 |
-
6)
|
143 |
|
144 |
-
7) You can
|
145 |
-
|
146 |
-
8) You can use the default WordPress 'Text' widget to display your Instagram Feed in a sidebar or other widget area.
|
147 |
|
148 |
== Frequently Asked Questions ==
|
149 |
|
150 |
= Can I display multiple Instagram feeds on my site or on the same page? =
|
151 |
|
152 |
-
Yep. You can display multiple Instagram feeds by using our built-in shortcode options, for example: `[instagram-feed
|
153 |
|
154 |
= Can I display photos from more than one Instagram account in one single feed? =
|
155 |
|
156 |
-
Yep. You can
|
157 |
|
158 |
= How do I find my Instagram Access Token and Instagram User ID =
|
159 |
|
160 |
-
We've made it super easy. Simply click on the big blue button on the Instagram Feed Settings page and log into your Instagram account. The plugin will then
|
161 |
|
162 |
= My Instagram feed isn't displaying. Why not!? =
|
163 |
|
164 |
There are a few common reasons for this:
|
165 |
|
166 |
* **Your Access Token may not be valid.** Try clicking on the blue Instagram login button on the plugin's Settings page again and copy and paste the Instagram token it gives you into the plugin's Access Token field.
|
167 |
-
* **Your Instagram account may be set to private.** Your Instagram account may be set to private. Instagram doesn't allow photos from private Instagram accounts to be displayed publicly.
|
168 |
-
* **Your User ID may not be valid**. Be sure you're not using your Instagram username instead of your User ID. You can find your Instagram User ID by using [this tool](http://www.otzberg.net/iguserid/).
|
169 |
* **The plugin's JavaScript file isn't being included in your page.** This is most likely because your WordPress theme is missing the WordPress [wp_footer](http://codex.wordpress.org/Function_Reference/wp_footer) function which is required for plugins to be able to add their JavaScript files to your page. You can fix this by opening your theme's **footer.php** file and adding the following directly before the closing </body> tag: `<?php wp_footer(); ?>`
|
170 |
* **Your website may contain a JavaScript error which is preventing JavaScript from running.** The plugin uses JavaScript to load the Instagram photos into your page and so needs JavaScript to be running in order to work. You would need to remove any existing JavaScript errors on your website for the plugin to be able to load in your feed.
|
171 |
|
@@ -193,29 +195,23 @@ You can obtain a new Instagram Access Token on the Instagram Feed Settings page
|
|
193 |
|
194 |
Occasionally the blue Instagram login button does not produce a working access token. You can try [this link](https://smashballoon.com/instagram-feed/token/?utm_source=wordpress&utm_campaign=sbi) as well.
|
195 |
|
196 |
-
2)
|
197 |
-
|
198 |
-
Please double check the Instagram User ID that you are using. Please note that your Instagram User ID is different from your Instagram username. To find your Instagram User ID simply enter your Instagram username into [this tool](http://www.otzberg.net/iguserid/).
|
199 |
-
|
200 |
-
If your Instagram User ID doesn't show any Instagram photos then it may be that your Instagram account is private and that the Instagram photos aren't able to be displayed.
|
201 |
-
|
202 |
-
3) The plugin's JavaScript file isn't being included in your page
|
203 |
|
204 |
This is most likely because your WordPress theme is missing the WordPress wp_footer function which is required for plugins to be able to add their JavaScript files to your page. You can fix this by opening your theme's footer.php file and adding the following directly before the closing </body> tag:
|
205 |
|
206 |
<?php wp_footer(); ?>
|
207 |
|
208 |
-
|
209 |
|
210 |
You find find out whether this is the case by right clicking on your page, selecting 'Inspect Element', and then clicking on the 'Console' tab, or by selecting the 'JavaScript Console' option from your browser's Developer Tools.
|
211 |
|
212 |
If a JavaScript error is occurring on your site then you'll see it listed in red along with the JavaScript file which is causing it.
|
213 |
|
214 |
-
|
215 |
|
216 |
If you are trying to display an Instagram feed that has no posts made to it, a loading symbol may be all that shows for the Instagram feed or nothing at all. Once you add an Instagram post the Instagram feed should display normally
|
217 |
|
218 |
-
|
219 |
|
220 |
You may have an error in the Instagram Feed shortcode you are using or are missing a necessary argument.
|
221 |
|
@@ -224,7 +220,7 @@ You may have an error in the Instagram Feed shortcode you are using or are missi
|
|
224 |
The below options are available on the Instagram Feed Settings page but can also be used directly in the `[instagram-feed]` shortcode to customize individual Instagram feeds on a feed-by-feed basis.
|
225 |
|
226 |
* **General Options**
|
227 |
-
* **
|
228 |
* **width** - The width of your Instagram feed. Any number - Example: `[instagram-feed width=50]`
|
229 |
* **widthunit** - The unit of the width of your Instagram feed. 'px' or '%' - Example: `[instagram-feed widthunit=%]`
|
230 |
* **height** - The height of your Instagram feed. Any number - Example: `[instagram-feed height=250]`
|
@@ -244,6 +240,10 @@ The below options are available on the Instagram Feed Settings page but can also
|
|
244 |
*
|
245 |
* **Header Options**
|
246 |
* **showheader** - Whether to show the Instagram feed Header. 'true' or 'false' - Example: `[instagram-feed showheader=false]`
|
|
|
|
|
|
|
|
|
247 |
* **headercolor** - The color of the Instagram feed Header text. Any hex color code - Example: `[instagram-feed headercolor=#333]`
|
248 |
*
|
249 |
* **'Load More' Button Options**
|
@@ -324,6 +324,20 @@ We understand that sometimes you need help, have issues or just have questions.
|
|
324 |
* Plus more customization options added all the time!
|
325 |
|
326 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
= 2.1.5 =
|
328 |
* New: Added aria-label attributes to SVGs for improved accessibility.
|
329 |
* Tweak: Changed screen reader and alt text to be more SEO friendly (change made to item.php template).
|
3 |
Tags: Instagram, Instagram feed, Instagram photos, Instagram widget, Instagram gallery
|
4 |
Requires at least: 3.4
|
5 |
Tested up to: 5.3
|
6 |
+
Stable tag: 2.2
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
64 |
|
65 |
1. Install the Instagram Feed plugin either via the WordPress plugin directory, or by uploading the files to your web server (in the `/wp-content/plugins/` directory).
|
66 |
2. Activate the Instagram Feed plugin through the 'Plugins' menu in WordPress.
|
67 |
+
3. Navigate to the 'Instagram Feed' settings page to connect your Instagram account.
|
68 |
4. Use the shortcode `[instagram-feed]` in your page, post or widget to display your Instagram photos.
|
69 |
5. You can display multiple Instagram feeds by using shortcode options, for example: `[instagram-feed num=6 cols=3]`
|
70 |
|
80 |
|
81 |
If you'd like to display multiple Instagram feeds then you can set different settings directly in the shortcode like so: `[instagram-feed num=9 cols=3]`
|
82 |
|
83 |
+
If you'd like to display feed from more than one account, connect multiple accounts on the "Configure" tab and then add the user name in the shortcode: `[instagram-feed user="ANOTHER_USER_NAME"]`
|
84 |
+
|
85 |
You can display as many different Instagram feeds as you like, on either the same page or on different pages, by just using the shortcode options below. For example:
|
86 |
`[instagram-feed]`
|
87 |
+
`[instagram-feed user="ANOTHER_USER_NAME"]`
|
88 |
+
`[instagram-feed user="ANOTHER_USER_NAME, YET_ANOTHER_USER_NAME" num=4 cols=4 showfollow=false]`
|
89 |
|
90 |
See the table below for a full list of available shortcode options:
|
91 |
|
92 |
= Shortcode Options =
|
93 |
* **General Options**
|
94 |
+
* **user** - An Instagram User Name (must have account connected) - Example: `[instagram-feed user=AN_INSTAGRAM_USER_NAME]`
|
95 |
* **width** - The width of your Instagram feed. Any number - Example: `[instagram-feed width=50]`
|
96 |
* **widthunit** - The unit of the width of your Instagram feed. 'px' or '%' - Example: `[instagram-feed widthunit=%]`
|
97 |
* **height** - The height of your Instagram feed. Any number - Example: `[instagram-feed height=250]`
|
111 |
*
|
112 |
* **Header Options**
|
113 |
* **showheader** - Whether to show the Instagram feed Header. 'true' or 'false' - Example: `[instagram-feed showheader=false]`
|
114 |
+
* **showbio** - Whether to show the account's bio in the Instagram feed Header. 'true' or 'false' - Example: `[instagram-feed showbio=false]`
|
115 |
+
* **custombio** - Custom Bio text for the Instagram feed Header - Example: `[instagram-feed custombio="My custom bio."]`
|
116 |
+
* **customavatar** - URL of a custom Avatar for the header. Example: `[instagram-feed customavatar="https://my-site.com/avatar.jpg"]`
|
117 |
+
|
118 |
* **headercolor** - The color of the Instagram feed Header text. Any hex color code - Example: `[instagram-feed headercolor=#333]`
|
119 |
*
|
120 |
* **'Load More' Button Options**
|
135 |
|
136 |
1) Once you've installed the Instagram Feed plugin click on the Instagram Feed item in your WordPress menu
|
137 |
|
138 |
+
2) Click on the large blue Instagram button to log into your Instagram account and connect your Instagram account. If you're having trouble retrieving your Instagram information from Instagram then try using the Instagram button on [this page](https://smashballoon.com/instagram-feed/token/?utm_source=wordpress&utm_campaign=sbi) instead.
|
139 |
|
140 |
+
You can also display photos from other Instagram accounts by connecting additional Instagram accounts and adding the user name in the shortcode.
|
141 |
|
142 |
+
3) Navigate to the Instagram Feed customize page to customize your Instagram feed.
|
143 |
|
144 |
+
4) Once you've customized your Instagram feed, click on the Display Your Feed tab to grab the [instagram-feed] shortcode.
|
145 |
|
146 |
+
5) Copy the Instagram Feed shortcode and paste it into any page, post or widget where you want the Instagram feed to appear.
|
147 |
|
148 |
+
6) You can paste the Instagram Feed shortcode directly into your page editor.
|
149 |
|
150 |
+
7) You can use the default WordPress 'Text' widget to display your Instagram Feed in a sidebar or other widget area.
|
|
|
|
|
151 |
|
152 |
== Frequently Asked Questions ==
|
153 |
|
154 |
= Can I display multiple Instagram feeds on my site or on the same page? =
|
155 |
|
156 |
+
Yep. You can display multiple Instagram feeds by using our built-in shortcode options, for example: `[instagram-feed user="smashballoon" cols=3]`. Be sure to connect the related Instagram account on the "Configure" tab.
|
157 |
|
158 |
= Can I display photos from more than one Instagram account in one single feed? =
|
159 |
|
160 |
+
Yep. You can add multiple user names from the connected accounts on the plugin's Settings page, or directly in the shortcode, separated by commas, like so: `[instagram-feed user="smashballoon, instagramfeed"]`.
|
161 |
|
162 |
= How do I find my Instagram Access Token and Instagram User ID =
|
163 |
|
164 |
+
We've made it super easy. Simply click on the big blue button on the Instagram Feed Settings page and log into your Instagram account. The plugin will then ask if you'd like to connect the account and start using it in a feed.
|
165 |
|
166 |
= My Instagram feed isn't displaying. Why not!? =
|
167 |
|
168 |
There are a few common reasons for this:
|
169 |
|
170 |
* **Your Access Token may not be valid.** Try clicking on the blue Instagram login button on the plugin's Settings page again and copy and paste the Instagram token it gives you into the plugin's Access Token field.
|
|
|
|
|
171 |
* **The plugin's JavaScript file isn't being included in your page.** This is most likely because your WordPress theme is missing the WordPress [wp_footer](http://codex.wordpress.org/Function_Reference/wp_footer) function which is required for plugins to be able to add their JavaScript files to your page. You can fix this by opening your theme's **footer.php** file and adding the following directly before the closing </body> tag: `<?php wp_footer(); ?>`
|
172 |
* **Your website may contain a JavaScript error which is preventing JavaScript from running.** The plugin uses JavaScript to load the Instagram photos into your page and so needs JavaScript to be running in order to work. You would need to remove any existing JavaScript errors on your website for the plugin to be able to load in your feed.
|
173 |
|
195 |
|
196 |
Occasionally the blue Instagram login button does not produce a working access token. You can try [this link](https://smashballoon.com/instagram-feed/token/?utm_source=wordpress&utm_campaign=sbi) as well.
|
197 |
|
198 |
+
2) The plugin's JavaScript file isn't being included in your page
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
|
200 |
This is most likely because your WordPress theme is missing the WordPress wp_footer function which is required for plugins to be able to add their JavaScript files to your page. You can fix this by opening your theme's footer.php file and adding the following directly before the closing </body> tag:
|
201 |
|
202 |
<?php wp_footer(); ?>
|
203 |
|
204 |
+
3) There's a JavaScript error on your site which is preventing the plugin's JavaScript file from running
|
205 |
|
206 |
You find find out whether this is the case by right clicking on your page, selecting 'Inspect Element', and then clicking on the 'Console' tab, or by selecting the 'JavaScript Console' option from your browser's Developer Tools.
|
207 |
|
208 |
If a JavaScript error is occurring on your site then you'll see it listed in red along with the JavaScript file which is causing it.
|
209 |
|
210 |
+
4) The feed you are trying to display has no Instagram posts
|
211 |
|
212 |
If you are trying to display an Instagram feed that has no posts made to it, a loading symbol may be all that shows for the Instagram feed or nothing at all. Once you add an Instagram post the Instagram feed should display normally
|
213 |
|
214 |
+
5) The shortcode you are using is incorrect
|
215 |
|
216 |
You may have an error in the Instagram Feed shortcode you are using or are missing a necessary argument.
|
217 |
|
220 |
The below options are available on the Instagram Feed Settings page but can also be used directly in the `[instagram-feed]` shortcode to customize individual Instagram feeds on a feed-by-feed basis.
|
221 |
|
222 |
* **General Options**
|
223 |
+
* **user** - An Instagram User Name (must have account connected) - Example: `[instagram-feed user=AN_INSTAGRAM_USER_NAME]`
|
224 |
* **width** - The width of your Instagram feed. Any number - Example: `[instagram-feed width=50]`
|
225 |
* **widthunit** - The unit of the width of your Instagram feed. 'px' or '%' - Example: `[instagram-feed widthunit=%]`
|
226 |
* **height** - The height of your Instagram feed. Any number - Example: `[instagram-feed height=250]`
|
240 |
*
|
241 |
* **Header Options**
|
242 |
* **showheader** - Whether to show the Instagram feed Header. 'true' or 'false' - Example: `[instagram-feed showheader=false]`
|
243 |
+
* **showbio** - Whether to show the account's bio in the Instagram feed Header. 'true' or 'false' - Example: `[instagram-feed showbio=false]`
|
244 |
+
* **custombio** - Custom Bio text for the Instagram feed Header - Example: `[instagram-feed custombio="My custom bio."]`
|
245 |
+
* **customavatar** - URL of a custom Avatar for the header. Example: `[instagram-feed customavatar="https://my-site.com/avatar.jpg"]`
|
246 |
+
|
247 |
* **headercolor** - The color of the Instagram feed Header text. Any hex color code - Example: `[instagram-feed headercolor=#333]`
|
248 |
*
|
249 |
* **'Load More' Button Options**
|
324 |
* Plus more customization options added all the time!
|
325 |
|
326 |
== Changelog ==
|
327 |
+
= 2.2 =
|
328 |
+
* Important: On March 2, Instagram will stop supporting its old API which will disrupt feeds created from personal connected accounts. If you are using a personal account, you will need to reconnect the account on the Instagram Feed Settings page. Please [see here](https://smashballoon.com/instagram-api-changes-march-2-2020/) for more information.
|
329 |
+
* New: Support added for the new Instagram Basic Display API.
|
330 |
+
* New: Added PHP hooks 'sbi_before_feed' and 'sbi_after_feed' for displaying HTML before and after the main Instagram feed HTML.
|
331 |
+
* New: Added settings for adding a custom header avatar and custom header bio text. Go to the "Customize" tab "Header" area to set these or use customavatar="AVATAR URL" or custombio="BIO TEXT" in the shortcode.
|
332 |
+
* Tweak: Warnings and messages displaying on the front end of sites now display at the top of the feed.
|
333 |
+
* Tweak: Header template changed to accommodate missing data if connected as a personal account to the new API.
|
334 |
+
* Tweak: Changes to feed.php, header.php, and item.php templates.
|
335 |
+
* Tweak: Added CSS to prevent some themes from adding box shadows and bottom border when hovering over the header.
|
336 |
+
* Tweak: Added code to clear page caching from Litespeed cache when clearing page caches with the plugin.
|
337 |
+
* Tweak: Header and follow button will still be displayed when number of posts is set to 0.
|
338 |
+
* Fix: Emoji in the first few characters of a caption would cause the main post image to switch to an emoji when loading more.
|
339 |
+
* Fix: Pagination for "tagged" feeds not working for certain accounts.
|
340 |
+
|
341 |
= 2.1.5 =
|
342 |
* New: Added aria-label attributes to SVGs for improved accessibility.
|
343 |
* Tweak: Changed screen reader and alt text to be more SEO friendly (change made to item.php template).
|
css/sb-instagram-2-2.css
ADDED
@@ -0,0 +1,819 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**************/
|
2 |
+
/*** LAYOUT ***/
|
3 |
+
/**************/
|
4 |
+
|
5 |
+
/* Feed container */
|
6 |
+
#sb_instagram {
|
7 |
+
width: 100%;
|
8 |
+
margin: 0 auto;
|
9 |
+
padding: 0;
|
10 |
+
-webkit-box-sizing: border-box;
|
11 |
+
-moz-box-sizing: border-box;
|
12 |
+
box-sizing: border-box;
|
13 |
+
}
|
14 |
+
#sb_instagram:after{
|
15 |
+
content: "";
|
16 |
+
display: table;
|
17 |
+
clear: both;
|
18 |
+
}
|
19 |
+
|
20 |
+
/*********************/
|
21 |
+
/*** STYLE OPTIONS ***/
|
22 |
+
/*********************/
|
23 |
+
#sb_instagram.sbi_fixed_height{
|
24 |
+
overflow: hidden;
|
25 |
+
overflow-y: auto;
|
26 |
+
-webkit-box-sizing: border-box;
|
27 |
+
-moz-box-sizing: border-box;
|
28 |
+
box-sizing: border-box;
|
29 |
+
}
|
30 |
+
#sb_instagram #sbi_images{
|
31 |
+
width: 100%;
|
32 |
+
float: left;
|
33 |
+
line-height: 0;
|
34 |
+
|
35 |
+
-webkit-box-sizing: border-box;
|
36 |
+
-moz-box-sizing: border-box;
|
37 |
+
box-sizing: border-box;
|
38 |
+
}
|
39 |
+
/* Remove header shadow/border */
|
40 |
+
#sb_instagram .sbi_header_link {
|
41 |
+
-webkit-box-shadow: none;
|
42 |
+
box-shadow: none;
|
43 |
+
}
|
44 |
+
#sb_instagram .sbi_header_link:hover {
|
45 |
+
border: none;
|
46 |
+
}
|
47 |
+
|
48 |
+
/* Items */
|
49 |
+
#sb_instagram #sbi_images .sbi_item{
|
50 |
+
display: -moz-inline-stack;
|
51 |
+
display: inline-block;
|
52 |
+
float: left;
|
53 |
+
vertical-align: top;
|
54 |
+
zoom: 1;
|
55 |
+
*display: inline;
|
56 |
+
|
57 |
+
max-height: 1000px;
|
58 |
+
padding: inherit !important;
|
59 |
+
margin: 0 !important;
|
60 |
+
text-decoration: none;
|
61 |
+
opacity: 1;
|
62 |
+
overflow: hidden;
|
63 |
+
|
64 |
+
-webkit-box-sizing: border-box;
|
65 |
+
-moz-box-sizing: border-box;
|
66 |
+
box-sizing: border-box;
|
67 |
+
|
68 |
+
-webkit-transition: all 0.5s ease;
|
69 |
+
-moz-transition: all 0.5s ease;
|
70 |
+
-o-transition: all 0.5s ease;
|
71 |
+
-ms-transition: all 0.5s ease;
|
72 |
+
transition: all 0.5s ease;
|
73 |
+
}
|
74 |
+
/* Transition items in */
|
75 |
+
#sb_instagram #sbi_images .sbi_item.sbi_transition{
|
76 |
+
opacity: 0;
|
77 |
+
max-height: 0;
|
78 |
+
}
|
79 |
+
|
80 |
+
/* Cols */
|
81 |
+
#sb_instagram.sbi_col_1 #sbi_images .sbi_item{ width: 100%; }
|
82 |
+
#sb_instagram.sbi_col_2 #sbi_images .sbi_item{ width: 50%; }
|
83 |
+
#sb_instagram.sbi_col_3 #sbi_images .sbi_item{ width: 33.33%; }
|
84 |
+
#sb_instagram.sbi_col_4 #sbi_images .sbi_item{ width: 25%; }
|
85 |
+
#sb_instagram.sbi_col_5 #sbi_images .sbi_item{ width: 20%; }
|
86 |
+
#sb_instagram.sbi_col_6 #sbi_images .sbi_item{ width: 16.66%; }
|
87 |
+
#sb_instagram.sbi_col_7 #sbi_images .sbi_item{ width: 14.28%; }
|
88 |
+
#sb_instagram.sbi_col_8 #sbi_images .sbi_item{ width: 12.5%; }
|
89 |
+
#sb_instagram.sbi_col_9 #sbi_images .sbi_item{ width: 11.11%; }
|
90 |
+
#sb_instagram.sbi_col_10 #sbi_images .sbi_item{ width: 10%; }
|
91 |
+
|
92 |
+
/* Disable mobile layout */
|
93 |
+
#sb_instagram.sbi_col_1.sbi_disable_mobile #sbi_images .sbi_item{ width: 100%; }
|
94 |
+
#sb_instagram.sbi_col_2.sbi_disable_mobile #sbi_images .sbi_item{ width: 50%; }
|
95 |
+
#sb_instagram.sbi_col_3.sbi_disable_mobile #sbi_images .sbi_item{ width: 33.33%; }
|
96 |
+
#sb_instagram.sbi_col_4.sbi_disable_mobile #sbi_images .sbi_item{ width: 25%; }
|
97 |
+
#sb_instagram.sbi_col_5.sbi_disable_mobile #sbi_images .sbi_item{ width: 20%; }
|
98 |
+
#sb_instagram.sbi_col_6.sbi_disable_mobile #sbi_images .sbi_item{ width: 16.66%; }
|
99 |
+
#sb_instagram.sbi_col_7.sbi_disable_mobile #sbi_images .sbi_item{ width: 14.28%; }
|
100 |
+
#sb_instagram.sbi_col_8.sbi_disable_mobile #sbi_images .sbi_item{ width: 12.5%; }
|
101 |
+
#sb_instagram.sbi_col_9.sbi_disable_mobile #sbi_images .sbi_item{ width: 11.11%; }
|
102 |
+
#sb_instagram.sbi_col_10.sbi_disable_mobile #sbi_images .sbi_item{ width: 10%; }
|
103 |
+
|
104 |
+
/* Photos */
|
105 |
+
#sb_instagram .sbi_photo_wrap{
|
106 |
+
position: relative;
|
107 |
+
}
|
108 |
+
#sb_instagram .sbi_photo{
|
109 |
+
display: block;
|
110 |
+
text-decoration: none;
|
111 |
+
}
|
112 |
+
#sb_instagram .sbi_photo img{
|
113 |
+
width: 100%;
|
114 |
+
height: auto;
|
115 |
+
}
|
116 |
+
#sb_instagram .sbi_no_js img{
|
117 |
+
display: none;
|
118 |
+
}
|
119 |
+
#sb_instagram a,
|
120 |
+
#sb_instagram a:hover,
|
121 |
+
#sb_instagram a:focus,
|
122 |
+
#sb_instagram a:active{
|
123 |
+
outline: none;
|
124 |
+
}
|
125 |
+
#sb_instagram img{
|
126 |
+
display: block;
|
127 |
+
padding: 0 !important;
|
128 |
+
margin: 0 !important;
|
129 |
+
max-width: 100% !important;
|
130 |
+
opacity: 1 !important;
|
131 |
+
}
|
132 |
+
#sb_instagram .sbi_link{
|
133 |
+
display: none;
|
134 |
+
position: absolute;
|
135 |
+
bottom: 0;
|
136 |
+
right: 0;
|
137 |
+
|
138 |
+
width: 100%;
|
139 |
+
padding: 10px 0;
|
140 |
+
background: rgba(0,0,0,0.5);
|
141 |
+
text-align: center;
|
142 |
+
color: #fff;
|
143 |
+
font-size: 12px;
|
144 |
+
line-height: 1.1;
|
145 |
+
}
|
146 |
+
#sb_instagram .sbi_link a{
|
147 |
+
padding: 0 6px;
|
148 |
+
text-decoration: none;
|
149 |
+
color: #fff;
|
150 |
+
font-size: 12px;
|
151 |
+
line-height: 1.1;
|
152 |
+
|
153 |
+
display: -moz-inline-stack;
|
154 |
+
display: inline-block;
|
155 |
+
vertical-align: top;
|
156 |
+
zoom: 1;
|
157 |
+
*display: inline;
|
158 |
+
}
|
159 |
+
#sb_instagram .sbi_link .sbi_lightbox_link{
|
160 |
+
padding-bottom: 5px;
|
161 |
+
}
|
162 |
+
#sb_instagram .sbi_link a:hover,
|
163 |
+
#sb_instagram .sbi_link a:focus{
|
164 |
+
text-decoration: underline;
|
165 |
+
}
|
166 |
+
#sb_instagram .sbi_photo_wrap:hover .sbi_link,
|
167 |
+
#sb_instagram .sbi_photo_wrap:focus .sbi_link{
|
168 |
+
display: block;
|
169 |
+
}
|
170 |
+
|
171 |
+
/* Videos */
|
172 |
+
#sb_instagram svg:not(:root).svg-inline--fa {
|
173 |
+
height: 1em;
|
174 |
+
display: inline-block;
|
175 |
+
}
|
176 |
+
|
177 |
+
#sb_instagram .sbi_type_video .sbi_playbtn,
|
178 |
+
#sb_instagram .sbi_type_carousel .sbi_playbtn,
|
179 |
+
.sbi_type_carousel .fa-clone,
|
180 |
+
#sb_instagram .sbi_type_carousel .svg-inline--fa.fa-play,
|
181 |
+
#sb_instagram .sbi_type_video .svg-inline--fa.fa-play{
|
182 |
+
display: block !important;
|
183 |
+
position: absolute;
|
184 |
+
z-index: 1;
|
185 |
+
|
186 |
+
color: #fff;
|
187 |
+
color: rgba(255,255,255,0.9);
|
188 |
+
font-style: normal !important;
|
189 |
+
text-shadow: 0 0 8px rgba(0,0,0,0.8);
|
190 |
+
}
|
191 |
+
#sb_instagram .sbi_type_video .sbi_playbtn,
|
192 |
+
#sb_instagram .sbi_type_carousel .sbi_playbtn {
|
193 |
+
z-index: 2;
|
194 |
+
top: 50%;
|
195 |
+
left: 50%;
|
196 |
+
margin-top: -24px;
|
197 |
+
margin-left: -19px;
|
198 |
+
padding: 0;
|
199 |
+
font-size: 48px;
|
200 |
+
}
|
201 |
+
#sb_instagram .sbi_type_carousel .fa-clone{
|
202 |
+
right: 12px;
|
203 |
+
top: 12px;
|
204 |
+
font-size: 24px;
|
205 |
+
text-shadow: 0 0 8px rgba(0,0,0,0.3);
|
206 |
+
}
|
207 |
+
.sbi_type_carousel svg.fa-clone,
|
208 |
+
#sb_instagram .sbi_type_video .svg-inline--fa.fa-play,
|
209 |
+
#sb_instagram .sbi_type_carousel .svg-inline--fa.fa-play{
|
210 |
+
-webkit-filter: drop-shadow( 0px 0px 2px rgba(0,0,0,.4) );
|
211 |
+
filter: drop-shadow( 0px 0px 2px rgba(0,0,0,.4) );
|
212 |
+
}
|
213 |
+
|
214 |
+
/* Loader */
|
215 |
+
#sb_instagram .sbi_loader{
|
216 |
+
width: 20px;
|
217 |
+
height: 20px;
|
218 |
+
|
219 |
+
position: relative;
|
220 |
+
top: 50%;
|
221 |
+
left: 50%;
|
222 |
+
margin: -10px 0 0 -10px;
|
223 |
+
background-color: #000;
|
224 |
+
background-color: rgba(0,0,0,0.5);
|
225 |
+
|
226 |
+
border-radius: 100%;
|
227 |
+
-webkit-animation: sbi-sk-scaleout 1.0s infinite ease-in-out;
|
228 |
+
animation: sbi-sk-scaleout 1.0s infinite ease-in-out;
|
229 |
+
}
|
230 |
+
#sb_instagram br {
|
231 |
+
display: none;
|
232 |
+
}
|
233 |
+
#sbi_load p {
|
234 |
+
display: inline;
|
235 |
+
padding: 0;
|
236 |
+
margin: 0;
|
237 |
+
}
|
238 |
+
/* Loader in button */
|
239 |
+
#sb_instagram #sbi_load .sbi_loader{
|
240 |
+
position: absolute;
|
241 |
+
margin-top: -11px;
|
242 |
+
background-color: #fff;
|
243 |
+
opacity: 1;
|
244 |
+
}
|
245 |
+
@-webkit-keyframes sbi-sk-scaleout {
|
246 |
+
0% { -webkit-transform: scale(0) }
|
247 |
+
100% {
|
248 |
+
-webkit-transform: scale(1.0);
|
249 |
+
opacity: 0;
|
250 |
+
}
|
251 |
+
}
|
252 |
+
@keyframes sbi-sk-scaleout {
|
253 |
+
0% {
|
254 |
+
-webkit-transform: scale(0);
|
255 |
+
-ms-transform: scale(0);
|
256 |
+
transform: scale(0);
|
257 |
+
} 100% {
|
258 |
+
-webkit-transform: scale(1.0);
|
259 |
+
-ms-transform: scale(1.0);
|
260 |
+
transform: scale(1.0);
|
261 |
+
opacity: 0;
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
#sb_instagram .fa-spin,
|
266 |
+
#sbi_lightbox .fa-spin{
|
267 |
+
-webkit-animation: fa-spin 2s infinite linear;
|
268 |
+
animation: fa-spin 2s infinite linear
|
269 |
+
}
|
270 |
+
|
271 |
+
#sb_instagram .fa-pulse,
|
272 |
+
#sbi_lightbox .fa-pulse{
|
273 |
+
-webkit-animation: fa-spin 1s infinite steps(8);
|
274 |
+
animation: fa-spin 1s infinite steps(8)
|
275 |
+
}
|
276 |
+
|
277 |
+
@-webkit-keyframes fa-spin {
|
278 |
+
0% {
|
279 |
+
-webkit-transform: rotate(0deg);
|
280 |
+
transform: rotate(0deg)
|
281 |
+
}
|
282 |
+
100% {
|
283 |
+
-webkit-transform: rotate(359deg);
|
284 |
+
transform: rotate(359deg)
|
285 |
+
}
|
286 |
+
}
|
287 |
+
|
288 |
+
@keyframes fa-spin {
|
289 |
+
0% {
|
290 |
+
-webkit-transform: rotate(0deg);
|
291 |
+
transform: rotate(0deg)
|
292 |
+
}
|
293 |
+
100% {
|
294 |
+
-webkit-transform: rotate(359deg);
|
295 |
+
transform: rotate(359deg)
|
296 |
+
}
|
297 |
+
}
|
298 |
+
/* Screen reader */
|
299 |
+
.sbi-screenreader{text-indent: -9999px !important;display: block !important;width: 0 !important;height: 0 !important;line-height: 0 !important;text-align: left !important; }
|
300 |
+
|
301 |
+
/* HEADER */
|
302 |
+
#sb_instagram .sb_instagram_header{
|
303 |
+
float: left;
|
304 |
+
clear: both;
|
305 |
+
margin: 0 0 15px 0;
|
306 |
+
padding: 0;
|
307 |
+
line-height: 1.2;
|
308 |
+
width: 100%;
|
309 |
+
}
|
310 |
+
#sb_instagram .sb_instagram_header a{
|
311 |
+
float: left;
|
312 |
+
display: block;
|
313 |
+
/*width: 100%;*/
|
314 |
+
min-width: 100%\9;
|
315 |
+
text-decoration: none;
|
316 |
+
transition: color 0.5s ease;
|
317 |
+
}
|
318 |
+
.sbi_no_avatar .sbi_header_img{
|
319 |
+
background: #333;
|
320 |
+
color: #fff;
|
321 |
+
width: 50px;
|
322 |
+
height: 50px;
|
323 |
+
position: relative;
|
324 |
+
}
|
325 |
+
.sbi_no_avatar .sbi_header_hashtag_icon {
|
326 |
+
display: block;
|
327 |
+
color: #fff;
|
328 |
+
opacity: .9;
|
329 |
+
-webkit-transition: background .6s linear,color .6s linear;
|
330 |
+
-moz-transition: background .6s linear,color .6s linear;
|
331 |
+
-ms-transition: background .6s linear,color .6s linear;
|
332 |
+
-o-transition: background .6s linear,color .6s linear;
|
333 |
+
transition: background .6s linear,color .6s linear
|
334 |
+
}
|
335 |
+
|
336 |
+
.sbi_no_avatar:hover .sbi_header_hashtag_icon {
|
337 |
+
display: block;
|
338 |
+
opacity: 1;
|
339 |
+
-webkit-transition: background .2s linear,color .2s linear;
|
340 |
+
-moz-transition: background .2s linear,color .2s linear;
|
341 |
+
-ms-transition: background .2s linear,color .2s linear;
|
342 |
+
-o-transition: background .2s linear,color .2s linear;
|
343 |
+
transition: background .2s linear,color .2s linear
|
344 |
+
}
|
345 |
+
/** Medium Header */
|
346 |
+
/* Only use medium & large headers on devices above 480px */
|
347 |
+
@media all and (min-width: 480px){
|
348 |
+
#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_img {
|
349 |
+
width: 80px;
|
350 |
+
height: 80px;
|
351 |
+
border-radius: 40px;
|
352 |
+
}
|
353 |
+
#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_img img {
|
354 |
+
width: 80px;
|
355 |
+
height: 80px;
|
356 |
+
border-radius: 40px;
|
357 |
+
}
|
358 |
+
#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text h3 {
|
359 |
+
font-size: 20px;
|
360 |
+
}
|
361 |
+
#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio_info,
|
362 |
+
#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio{
|
363 |
+
font-size: 14px;
|
364 |
+
}
|
365 |
+
#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text h3,
|
366 |
+
#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio_info,
|
367 |
+
#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio{
|
368 |
+
margin-left: 95px !important;
|
369 |
+
line-height: 1.4
|
370 |
+
}
|
371 |
+
#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text h3{
|
372 |
+
margin-right: -85px !important;
|
373 |
+
}
|
374 |
+
#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio_info{
|
375 |
+
margin-top: 4px !important;
|
376 |
+
}
|
377 |
+
#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text.sbi_no_bio h3{
|
378 |
+
padding-top: 20px !important;
|
379 |
+
}
|
380 |
+
/** Large Header */
|
381 |
+
#sb_instagram .sb_instagram_header.sbi_large .sbi_header_img {
|
382 |
+
width: 120px;
|
383 |
+
height: 120px;
|
384 |
+
border-radius: 60px;
|
385 |
+
}
|
386 |
+
#sb_instagram .sb_instagram_header.sbi_large .sbi_header_img img {
|
387 |
+
width: 120px;
|
388 |
+
height: 120px;
|
389 |
+
border-radius: 60px;
|
390 |
+
}
|
391 |
+
#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text h3 {
|
392 |
+
font-size: 28px;
|
393 |
+
}
|
394 |
+
#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio_info,
|
395 |
+
#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio{
|
396 |
+
font-size: 16px;
|
397 |
+
}
|
398 |
+
#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text h3,
|
399 |
+
#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio_info,
|
400 |
+
#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio{
|
401 |
+
margin-left: 140px !important;
|
402 |
+
line-height: 1.5;
|
403 |
+
}
|
404 |
+
#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text h3{
|
405 |
+
margin-right: -120px !important;
|
406 |
+
}
|
407 |
+
#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio_info{
|
408 |
+
margin-top: 12px !important;
|
409 |
+
}
|
410 |
+
#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text.sbi_no_bio h3{
|
411 |
+
padding-top: 32px !important;
|
412 |
+
}
|
413 |
+
}
|
414 |
+
|
415 |
+
/* Header profile pic */
|
416 |
+
#sb_instagram .sb_instagram_header .sbi_header_img{
|
417 |
+
float: left;
|
418 |
+
position: relative;
|
419 |
+
width: 50px;
|
420 |
+
margin: 0 0 0 -100% !important;
|
421 |
+
overflow: hidden;
|
422 |
+
|
423 |
+
-moz-border-radius: 40px;
|
424 |
+
-webkit-border-radius: 40px;
|
425 |
+
border-radius: 40px;
|
426 |
+
}
|
427 |
+
#sb_instagram .sb_instagram_header .sbi_header_img img{
|
428 |
+
float: left;
|
429 |
+
margin: 0 !important;
|
430 |
+
padding: 0 !important;
|
431 |
+
border: none !important;
|
432 |
+
|
433 |
+
-moz-border-radius: 40px;
|
434 |
+
-webkit-border-radius: 40px;
|
435 |
+
border-radius: 40px;
|
436 |
+
}
|
437 |
+
/* Profile pic hover */
|
438 |
+
/* Profile pic hover */
|
439 |
+
#sb_instagram .sb_instagram_header .sbi_header_img_hover{
|
440 |
+
opacity: 0;
|
441 |
+
position: absolute;
|
442 |
+
width: 100%;
|
443 |
+
top: 0;
|
444 |
+
bottom: 0;
|
445 |
+
left: 0;
|
446 |
+
text-align: center;
|
447 |
+
color: #fff;
|
448 |
+
background: rgba(0,0,0,0.75);
|
449 |
+
}
|
450 |
+
|
451 |
+
#sb_instagram .sb_instagram_header .sbi_header_img_hover .sbi_new_logo,
|
452 |
+
#sb_instagram .sb_instagram_header .sbi_header_hashtag_icon .sbi_new_logo{
|
453 |
+
position: absolute;
|
454 |
+
top: 50%;
|
455 |
+
left: 50%;
|
456 |
+
margin-top: -12px;
|
457 |
+
margin-left: -12px;
|
458 |
+
width: 24px;
|
459 |
+
height: 24px;
|
460 |
+
font-size: 24px;
|
461 |
+
}
|
462 |
+
#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_hashtag_icon .sbi_new_logo,
|
463 |
+
.sb_instagram_header.sbi_medium .sbi_header_hashtag_icon .sbi_new_logo{
|
464 |
+
margin-top: -18px;
|
465 |
+
margin-left: -18px;
|
466 |
+
width: 36px;
|
467 |
+
height: 36px;
|
468 |
+
font-size: 36px
|
469 |
+
}
|
470 |
+
|
471 |
+
#sb_instagram .sb_instagram_header.sbi_large .sbi_header_hashtag_icon .sbi_new_logo,
|
472 |
+
.sb_instagram_header.sbi_large .sbi_header_hashtag_icon .sbi_new_logo {
|
473 |
+
margin-top: -24px;
|
474 |
+
margin-left: -24px;
|
475 |
+
width: 48px;
|
476 |
+
height: 48px;
|
477 |
+
font-size: 48px
|
478 |
+
}
|
479 |
+
#sb_instagram .sb_instagram_header .sbi_header_img_hover i {
|
480 |
+
overflow: hidden;
|
481 |
+
background: url('../img/small-logo.png') no-repeat 0 0;
|
482 |
+
}
|
483 |
+
#sb_instagram .sb_instagram_header .sbi_header_img_hover{
|
484 |
+
z-index: 2;
|
485 |
+
transition: opacity 0.4s ease-in-out;
|
486 |
+
}
|
487 |
+
#sb_instagram .sb_instagram_header .sbi_fade_in{
|
488 |
+
opacity: 1;
|
489 |
+
transition: opacity 0.2s ease-in-out;
|
490 |
+
}
|
491 |
+
#sb_instagram .sb_instagram_header .sbi_header_img_hover{
|
492 |
+
position: absolute;
|
493 |
+
width: 100%;
|
494 |
+
top: 0;
|
495 |
+
bottom: 0;
|
496 |
+
left: 0;
|
497 |
+
text-align: center;
|
498 |
+
color: #fff;
|
499 |
+
background: rgba(0,0,0,0.75);
|
500 |
+
|
501 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
|
502 |
+
filter: alpha(opacity=0);
|
503 |
+
-moz-opacity: 0;
|
504 |
+
-khtml-opacity: 0;
|
505 |
+
opacity: 0;
|
506 |
+
border-radius: 40px;
|
507 |
+
transition: opacity 0.2s;
|
508 |
+
}
|
509 |
+
/* Fade the Instagram icon in when hovering on the header */
|
510 |
+
#sb_instagram .sb_instagram_header a:hover .sbi_header_img_hover,
|
511 |
+
#sb_instagram .sb_instagram_header a:focus .sbi_header_img_hover{
|
512 |
+
opacity: 1;
|
513 |
+
}
|
514 |
+
/* Header text */
|
515 |
+
#sb_instagram .sb_instagram_header .sbi_header_text{
|
516 |
+
float: left;
|
517 |
+
width: 100%;
|
518 |
+
padding-top: 5px;
|
519 |
+
}
|
520 |
+
#sb_instagram .sb_instagram_header a{
|
521 |
+
text-decoration: none;
|
522 |
+
}
|
523 |
+
#sb_instagram .sb_instagram_header .sbi_header_text .sbi_bio,
|
524 |
+
#sb_instagram .sb_instagram_header .sbi_header_text h3{
|
525 |
+
float: left;
|
526 |
+
clear: both;
|
527 |
+
width: auto;
|
528 |
+
margin: 0 0 0 60px !important;
|
529 |
+
padding: 0 !important;
|
530 |
+
}
|
531 |
+
#sb_instagram .sb_instagram_header h3{
|
532 |
+
font-size: 16px;
|
533 |
+
line-height: 1.3;
|
534 |
+
}
|
535 |
+
#sb_instagram .sb_instagram_header p{
|
536 |
+
font-size: 13px;
|
537 |
+
line-height: 1.3;
|
538 |
+
margin: 0;
|
539 |
+
padding: 0;
|
540 |
+
}
|
541 |
+
#sb_instagram p:empty { display: none; }
|
542 |
+
#sb_instagram .sb_instagram_header .sbi_header_text img.emoji{
|
543 |
+
margin-right: 3px !important;
|
544 |
+
}
|
545 |
+
|
546 |
+
/* No bio */
|
547 |
+
#sb_instagram .sb_instagram_header .sbi_header_text.sbi_no_bio h3{
|
548 |
+
padding-top: 9px !important;
|
549 |
+
}
|
550 |
+
#sb_instagram .sb_instagram_header .sbi_header_text.sbi_no_bio .sbi_bio_info{
|
551 |
+
clear: both;
|
552 |
+
}
|
553 |
+
|
554 |
+
|
555 |
+
/* Buttons */
|
556 |
+
#sb_instagram #sbi_load{
|
557 |
+
float: left;
|
558 |
+
clear: both;
|
559 |
+
width: 100%;
|
560 |
+
text-align: center;
|
561 |
+
}
|
562 |
+
#sb_instagram #sbi_load .fa-spinner{
|
563 |
+
display: none;
|
564 |
+
position: absolute;
|
565 |
+
top: 50%;
|
566 |
+
left: 50%;
|
567 |
+
margin: -8px 0 0 -7px;
|
568 |
+
font-size: 15px;
|
569 |
+
}
|
570 |
+
#sb_instagram #sbi_load{
|
571 |
+
opacity: 1;
|
572 |
+
transition: all 0.5s ease-in;
|
573 |
+
}
|
574 |
+
#sb_instagram .sbi_load_btn .sbi_btn_text, #sb_instagram .sbi_load_btn .sbi_loader{
|
575 |
+
opacity: 1;
|
576 |
+
transition: all 0.1s ease-in;
|
577 |
+
}
|
578 |
+
#sb_instagram .sbi_hidden{
|
579 |
+
opacity: 0 !important;
|
580 |
+
}
|
581 |
+
#sb_instagram #sbi_load .sbi_load_btn,
|
582 |
+
#sb_instagram .sbi_follow_btn a{
|
583 |
+
display: -moz-inline-stack;
|
584 |
+
display: inline-block;
|
585 |
+
vertical-align: top;
|
586 |
+
zoom: 1;
|
587 |
+
*display: inline;
|
588 |
+
|
589 |
+
padding: 7px 14px;
|
590 |
+
margin: 5px auto 0 auto;
|
591 |
+
background: #333;
|
592 |
+
color: #eee;
|
593 |
+
border: none;
|
594 |
+
color: #fff;
|
595 |
+
text-decoration: none;
|
596 |
+
font-size: 13px;
|
597 |
+
line-height: 1.5;
|
598 |
+
|
599 |
+
-moz-border-radius: 4px;
|
600 |
+
-webkit-border-radius: 4px;
|
601 |
+
border-radius: 4px;
|
602 |
+
|
603 |
+
-webkit-box-sizing: border-box;
|
604 |
+
-moz-box-sizing: border-box;
|
605 |
+
box-sizing: border-box;
|
606 |
+
}
|
607 |
+
#sb_instagram #sbi_load .sbi_load_btn {
|
608 |
+
position: relative;
|
609 |
+
}
|
610 |
+
/* Follow button */
|
611 |
+
#sb_instagram .sbi_follow_btn{
|
612 |
+
display: -moz-inline-stack;
|
613 |
+
display: inline-block;
|
614 |
+
vertical-align: top;
|
615 |
+
zoom: 1;
|
616 |
+
*display: inline;
|
617 |
+
text-align: center;
|
618 |
+
}
|
619 |
+
#sb_instagram .sbi_follow_btn.sbi_top{
|
620 |
+
display: block;
|
621 |
+
margin-bottom: 5px;
|
622 |
+
}
|
623 |
+
#sb_instagram .sbi_follow_btn a{
|
624 |
+
background: #408bd1;
|
625 |
+
color: #fff;
|
626 |
+
}
|
627 |
+
#sb_instagram .sbi_follow_btn a,
|
628 |
+
#sb_instagram .sbi_follow_btn a,
|
629 |
+
#sb_instagram #sbi_load .sbi_load_btn{
|
630 |
+
transition: all 0.1s ease-in;
|
631 |
+
}
|
632 |
+
/* Hover state for default colors */
|
633 |
+
#sb_instagram #sbi_load .sbi_load_btn:hover{
|
634 |
+
outline: none;
|
635 |
+
box-shadow: inset 0 0 20px 20px rgba(255,255,255,0.25);
|
636 |
+
}
|
637 |
+
#sb_instagram .sbi_follow_btn a:hover,
|
638 |
+
#sb_instagram .sbi_follow_btn a:focus{
|
639 |
+
outline: none;
|
640 |
+
box-shadow: inset 0 0 10px 20px #359dff;
|
641 |
+
}
|
642 |
+
/* If a custom color is applied then just use opacity for the hover effect */
|
643 |
+
#sb_instagram .sbi_follow_btn.sbi_custom a:hover,
|
644 |
+
#sb_instagram .sbi_follow_btn.sbi_custom a:focus,
|
645 |
+
#sb_instagram #sbi_load .sbi_load_btn.sbi_custom:hover{
|
646 |
+
box-shadow: inset 0 0 20px 20px rgba(255,255,255,0.15);
|
647 |
+
}
|
648 |
+
/* Active state */
|
649 |
+
#sb_instagram .sbi_follow_btn a:active,
|
650 |
+
#sb_instagram #sbi_load .sbi_load_btn:active{
|
651 |
+
box-shadow: inset 0 0 10px 20px rgba(0,0,0,0.3);
|
652 |
+
}
|
653 |
+
|
654 |
+
#sb_instagram .sbi_follow_btn .fa,
|
655 |
+
#sb_instagram .sbi_follow_btn svg{
|
656 |
+
margin-bottom: -1px;
|
657 |
+
margin-right: 7px;
|
658 |
+
font-size: 15px;
|
659 |
+
}
|
660 |
+
#sb_instagram .sbi_follow_btn svg{
|
661 |
+
vertical-align: -.125em;
|
662 |
+
}
|
663 |
+
#sb_instagram #sbi_load .sbi_follow_btn{
|
664 |
+
margin-left: 5px;
|
665 |
+
}
|
666 |
+
|
667 |
+
/* Error messages */
|
668 |
+
#sb_instagram .sb_instagram_error{
|
669 |
+
width: 100%;
|
670 |
+
text-align: center;
|
671 |
+
line-height: 1.4;
|
672 |
+
}
|
673 |
+
|
674 |
+
/* Mod only error msgs */
|
675 |
+
#sbi_mod_error{
|
676 |
+
display: none;
|
677 |
+
border: 1px solid #ddd;
|
678 |
+
background: #eee;
|
679 |
+
color: #333;
|
680 |
+
margin: 10px 0 0;
|
681 |
+
padding: 10px 15px;
|
682 |
+
font-size: 13px;
|
683 |
+
text-align: center;
|
684 |
+
clear: both;
|
685 |
+
|
686 |
+
-moz-border-radius: 4px;
|
687 |
+
-webkit-border-radius: 4px;
|
688 |
+
border-radius: 4px;
|
689 |
+
}
|
690 |
+
#sbi_mod_error br {
|
691 |
+
display: initial !important;
|
692 |
+
}
|
693 |
+
#sbi_mod_error p{
|
694 |
+
padding: 5px 0 !important;
|
695 |
+
margin: 0 !important;
|
696 |
+
line-height: 1.3 !important;
|
697 |
+
}
|
698 |
+
#sbi_mod_error ol,
|
699 |
+
#sbi_mod_error ul{
|
700 |
+
padding: 5px 0 5px 20px !important;
|
701 |
+
margin: 0 !important;
|
702 |
+
}
|
703 |
+
#sbi_mod_error li{
|
704 |
+
padding: 1px 0 !important;
|
705 |
+
margin: 0 !important;
|
706 |
+
}
|
707 |
+
#sbi_mod_error span{
|
708 |
+
font-size: 12px;
|
709 |
+
}
|
710 |
+
|
711 |
+
/* Medium */
|
712 |
+
#sb_instagram.sbi_medium .sbi_playbtn,
|
713 |
+
#sb_instagram.sbi_medium .sbi_photo_wrap .svg-inline--fa.fa-play{
|
714 |
+
margin-top: -12px;
|
715 |
+
margin-left: -9px;
|
716 |
+
font-size: 23px;
|
717 |
+
}
|
718 |
+
#sb_instagram.sbi_medium .sbi_type_carousel .sbi_photo_wrap .fa-clone{
|
719 |
+
right: 8px;
|
720 |
+
top: 8px;
|
721 |
+
font-size: 18px;
|
722 |
+
}
|
723 |
+
/* Small */
|
724 |
+
#sb_instagram.sbi_small .sbi_playbtn,
|
725 |
+
#sb_instagram.sbi_small .sbi_photo_wrap .svg-inline--fa.fa-play{
|
726 |
+
margin-top: -9px;
|
727 |
+
margin-left: -7px;
|
728 |
+
font-size: 18px;
|
729 |
+
}
|
730 |
+
#sb_instagram.sbi_small .sbi_type_carousel .sbi_photo_wrap .fa-clone{
|
731 |
+
right: 5px;
|
732 |
+
top: 5px;
|
733 |
+
font-size: 12px;
|
734 |
+
}
|
735 |
+
|
736 |
+
/* Media queries */
|
737 |
+
@media all and (max-width: 640px){
|
738 |
+
/* Make 3-6 cols into 2 col */
|
739 |
+
#sb_instagram.sbi_col_3 #sbi_images .sbi_item,
|
740 |
+
#sb_instagram.sbi_col_4 #sbi_images .sbi_item,
|
741 |
+
#sb_instagram.sbi_col_5 #sbi_images .sbi_item,
|
742 |
+
#sb_instagram.sbi_col_6 #sbi_images .sbi_item{
|
743 |
+
width: 50%;
|
744 |
+
}
|
745 |
+
/* Make 7-10 cols into 4 col */
|
746 |
+
#sb_instagram.sbi_col_7 #sbi_images .sbi_item,
|
747 |
+
#sb_instagram.sbi_col_8 #sbi_images .sbi_item,
|
748 |
+
#sb_instagram.sbi_col_9 #sbi_images .sbi_item,
|
749 |
+
#sb_instagram.sbi_col_10 #sbi_images .sbi_item{
|
750 |
+
width: 25%;
|
751 |
+
}
|
752 |
+
/* On mobile make the min-width 100% */
|
753 |
+
#sb_instagram.sbi_width_resp{
|
754 |
+
width: 100% !important;
|
755 |
+
}
|
756 |
+
}
|
757 |
+
@media all and (max-width: 480px){
|
758 |
+
/* Make all cols into 1 col */
|
759 |
+
#sb_instagram.sbi_col_3 #sbi_images .sbi_item,
|
760 |
+
#sb_instagram.sbi_col_4 #sbi_images .sbi_item,
|
761 |
+
#sb_instagram.sbi_col_5 #sbi_images .sbi_item,
|
762 |
+
#sb_instagram.sbi_col_6 #sbi_images .sbi_item,
|
763 |
+
#sb_instagram.sbi_col_7 #sbi_images .sbi_item,
|
764 |
+
#sb_instagram.sbi_col_8 #sbi_images .sbi_item,
|
765 |
+
#sb_instagram.sbi_col_9 #sbi_images .sbi_item,
|
766 |
+
#sb_instagram.sbi_col_10 #sbi_images .sbi_item{
|
767 |
+
width: 100%;
|
768 |
+
}
|
769 |
+
}
|
770 |
+
|
771 |
+
/* NO JS */
|
772 |
+
#sb_instagram.sbi_no_js #sbi_images .sbi_item .sbi_photo_wrap{
|
773 |
+
box-sizing: border-box;
|
774 |
+
position: relative;
|
775 |
+
overflow: hidden;
|
776 |
+
}
|
777 |
+
#sb_instagram.sbi_no_js #sbi_images .sbi_item .sbi_photo_wrap:before {
|
778 |
+
content: "";
|
779 |
+
display: block;
|
780 |
+
padding-top: 100%;
|
781 |
+
z-index: -300;
|
782 |
+
}
|
783 |
+
#sb_instagram.sbi_no_js #sbi_images .sbi_item .sbi_photo {
|
784 |
+
position: absolute;
|
785 |
+
top: 0;
|
786 |
+
left: 0;
|
787 |
+
bottom: 0;
|
788 |
+
right: 0;
|
789 |
+
}
|
790 |
+
#sb_instagram.sbi_no_js #sbi_images .sbi_item.sbi_transition {
|
791 |
+
opacity: 1;
|
792 |
+
max-height: 640px;
|
793 |
+
}
|
794 |
+
#sb_instagram.sbi_no_js .sbi_photo img,
|
795 |
+
#sb_instagram.sbi_no_js .sbi_load_btn{
|
796 |
+
display: none;
|
797 |
+
}
|
798 |
+
#sb_instagram #sbi_images .sbi_js_load_disabled .sbi_imgLiquid_ready.sbi_photo {
|
799 |
+
padding-bottom: 0 !important;
|
800 |
+
}
|
801 |
+
#sb_instagram #sbi_mod_error .sb_frontend_btn {
|
802 |
+
display: inline-block;
|
803 |
+
padding: 6px 10px;
|
804 |
+
background: #ddd;
|
805 |
+
background: rgba(0,0,0,.1);
|
806 |
+
text-decoration: none;
|
807 |
+
border-radius: 5px;
|
808 |
+
margin-top: 10px;
|
809 |
+
color: #444
|
810 |
+
}
|
811 |
+
|
812 |
+
#sb_instagram #sbi_mod_error .sb_frontend_btn:hover {
|
813 |
+
background: #ccc;
|
814 |
+
background: rgba(0,0,0,.15)
|
815 |
+
}
|
816 |
+
|
817 |
+
#sb_instagram #sbi_mod_error .sb_frontend_btn .fa {
|
818 |
+
margin-right: 2px
|
819 |
+
}
|
css/sb-instagram-2-2.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
#sb_instagram{width:100%;margin:0 auto;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram:after{content:"";display:table;clear:both}#sb_instagram.sbi_fixed_height{overflow:hidden;overflow-y:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram #sbi_images{width:100%;float:left;line-height:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram .sbi_header_link{-webkit-box-shadow:none;box-shadow:none}#sb_instagram .sbi_header_link:hover{border:none}#sb_instagram #sbi_images .sbi_item{display:-moz-inline-stack;display:inline-block;float:left;vertical-align:top;zoom:1;max-height:1000px;padding:inherit!important;margin:0!important;text-decoration:none;opacity:1;overflow:hidden;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;-ms-transition:all .5s ease;transition:all .5s ease}#sb_instagram #sbi_images .sbi_item.sbi_transition{opacity:0;max-height:0}#sb_instagram.sbi_col_1 #sbi_images .sbi_item{width:100%}#sb_instagram.sbi_col_2 #sbi_images .sbi_item{width:50%}#sb_instagram.sbi_col_3 #sbi_images .sbi_item{width:33.33%}#sb_instagram.sbi_col_4 #sbi_images .sbi_item{width:25%}#sb_instagram.sbi_col_5 #sbi_images .sbi_item{width:20%}#sb_instagram.sbi_col_6 #sbi_images .sbi_item{width:16.66%}#sb_instagram.sbi_col_7 #sbi_images .sbi_item{width:14.28%}#sb_instagram.sbi_col_8 #sbi_images .sbi_item{width:12.5%}#sb_instagram.sbi_col_9 #sbi_images .sbi_item{width:11.11%}#sb_instagram.sbi_col_10 #sbi_images .sbi_item{width:10%}#sb_instagram.sbi_col_1.sbi_disable_mobile #sbi_images .sbi_item{width:100%}#sb_instagram.sbi_col_2.sbi_disable_mobile #sbi_images .sbi_item{width:50%}#sb_instagram.sbi_col_3.sbi_disable_mobile #sbi_images .sbi_item{width:33.33%}#sb_instagram.sbi_col_4.sbi_disable_mobile #sbi_images .sbi_item{width:25%}#sb_instagram.sbi_col_5.sbi_disable_mobile #sbi_images .sbi_item{width:20%}#sb_instagram.sbi_col_6.sbi_disable_mobile #sbi_images .sbi_item{width:16.66%}#sb_instagram.sbi_col_7.sbi_disable_mobile #sbi_images .sbi_item{width:14.28%}#sb_instagram.sbi_col_8.sbi_disable_mobile #sbi_images .sbi_item{width:12.5%}#sb_instagram.sbi_col_9.sbi_disable_mobile #sbi_images .sbi_item{width:11.11%}#sb_instagram.sbi_col_10.sbi_disable_mobile #sbi_images .sbi_item{width:10%}#sb_instagram .sbi_photo_wrap{position:relative}#sb_instagram .sbi_photo{display:block;text-decoration:none}#sb_instagram .sbi_photo img{width:100%;height:auto}#sb_instagram .sbi_no_js img{display:none}#sb_instagram a,#sb_instagram a:active,#sb_instagram a:focus,#sb_instagram a:hover{outline:0}#sb_instagram img{display:block;padding:0!important;margin:0!important;max-width:100%!important;opacity:1!important}#sb_instagram .sbi_link{display:none;position:absolute;bottom:0;right:0;width:100%;padding:10px 0;background:rgba(0,0,0,.5);text-align:center;color:#fff;font-size:12px;line-height:1.1}#sb_instagram .sbi_link a{padding:0 6px;text-decoration:none;color:#fff;font-size:12px;line-height:1.1;display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1}#sb_instagram .sbi_link .sbi_lightbox_link{padding-bottom:5px}#sb_instagram .sbi_link a:focus,#sb_instagram .sbi_link a:hover{text-decoration:underline}#sb_instagram .sbi_photo_wrap:focus .sbi_link,#sb_instagram .sbi_photo_wrap:hover .sbi_link{display:block}#sb_instagram svg:not(:root).svg-inline--fa{height:1em;display:inline-block}#sb_instagram .sbi_type_carousel .sbi_playbtn,#sb_instagram .sbi_type_carousel .svg-inline--fa.fa-play,#sb_instagram .sbi_type_video .sbi_playbtn,#sb_instagram .sbi_type_video .svg-inline--fa.fa-play,.sbi_type_carousel .fa-clone{display:block!important;position:absolute;z-index:1;color:#fff;color:rgba(255,255,255,.9);font-style:normal!important;text-shadow:0 0 8px rgba(0,0,0,.8)}#sb_instagram .sbi_type_carousel .sbi_playbtn,#sb_instagram .sbi_type_video .sbi_playbtn{z-index:2;top:50%;left:50%;margin-top:-24px;margin-left:-19px;padding:0;font-size:48px}#sb_instagram .sbi_type_carousel .fa-clone{right:12px;top:12px;font-size:24px;text-shadow:0 0 8px rgba(0,0,0,.3)}#sb_instagram .sbi_type_carousel .svg-inline--fa.fa-play,#sb_instagram .sbi_type_video .svg-inline--fa.fa-play,.sbi_type_carousel svg.fa-clone{-webkit-filter:drop-shadow( 0 0 2px rgba(0,0,0,.4) );filter:drop-shadow( 0 0 2px rgba(0,0,0,.4) )}#sb_instagram .sbi_loader{width:20px;height:20px;position:relative;top:50%;left:50%;margin:-10px 0 0 -10px;background-color:#000;background-color:rgba(0,0,0,.5);border-radius:100%;-webkit-animation:sbi-sk-scaleout 1s infinite ease-in-out;animation:sbi-sk-scaleout 1s infinite ease-in-out}#sb_instagram br{display:none}#sbi_load p{display:inline;padding:0;margin:0}#sb_instagram #sbi_load .sbi_loader{position:absolute;margin-top:-11px;background-color:#fff;opacity:1}@-webkit-keyframes sbi-sk-scaleout{0%{-webkit-transform:scale(0)}100%{-webkit-transform:scale(1);opacity:0}}@keyframes sbi-sk-scaleout{0%{-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0)}100%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);opacity:0}}#sb_instagram .fa-spin,#sbi_lightbox .fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}#sb_instagram .fa-pulse,#sbi_lightbox .fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.sbi-screenreader{text-indent:-9999px!important;display:block!important;width:0!important;height:0!important;line-height:0!important;text-align:left!important}#sb_instagram .sb_instagram_header{float:left;clear:both;margin:0 0 15px 0;padding:0;line-height:1.2;width:100%}#sb_instagram .sb_instagram_header a{float:left;display:block;text-decoration:none;transition:color .5s ease}.sbi_no_avatar .sbi_header_img{background:#333;color:#fff;width:50px;height:50px;position:relative}.sbi_no_avatar .sbi_header_hashtag_icon{display:block;color:#fff;opacity:.9;-webkit-transition:background .6s linear,color .6s linear;-moz-transition:background .6s linear,color .6s linear;-ms-transition:background .6s linear,color .6s linear;-o-transition:background .6s linear,color .6s linear;transition:background .6s linear,color .6s linear}.sbi_no_avatar:hover .sbi_header_hashtag_icon{display:block;opacity:1;-webkit-transition:background .2s linear,color .2s linear;-moz-transition:background .2s linear,color .2s linear;-ms-transition:background .2s linear,color .2s linear;-o-transition:background .2s linear,color .2s linear;transition:background .2s linear,color .2s linear}@media all and (min-width:480px){#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_img{width:80px;height:80px;border-radius:40px}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_img img{width:80px;height:80px;border-radius:40px}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text h3{font-size:20px}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio,#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio_info{font-size:14px}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio,#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio_info,#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text h3{margin-left:95px!important;line-height:1.4}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text h3{margin-right:-85px!important}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio_info{margin-top:4px!important}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text.sbi_no_bio h3{padding-top:20px!important}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_img{width:120px;height:120px;border-radius:60px}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_img img{width:120px;height:120px;border-radius:60px}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text h3{font-size:28px}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio,#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio_info{font-size:16px}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio,#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio_info,#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text h3{margin-left:140px!important;line-height:1.5}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text h3{margin-right:-120px!important}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio_info{margin-top:12px!important}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text.sbi_no_bio h3{padding-top:32px!important}}#sb_instagram .sb_instagram_header .sbi_header_img{float:left;position:relative;width:50px;margin:0 0 0 -100%!important;overflow:hidden;-moz-border-radius:40px;-webkit-border-radius:40px;border-radius:40px}#sb_instagram .sb_instagram_header .sbi_header_img img{float:left;margin:0!important;padding:0!important;border:none!important;-moz-border-radius:40px;-webkit-border-radius:40px;border-radius:40px}#sb_instagram .sb_instagram_header .sbi_header_img_hover{opacity:0;position:absolute;width:100%;top:0;bottom:0;left:0;text-align:center;color:#fff;background:rgba(0,0,0,.75)}#sb_instagram .sb_instagram_header .sbi_header_hashtag_icon .sbi_new_logo,#sb_instagram .sb_instagram_header .sbi_header_img_hover .sbi_new_logo{position:absolute;top:50%;left:50%;margin-top:-12px;margin-left:-12px;width:24px;height:24px;font-size:24px}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_hashtag_icon .sbi_new_logo,.sb_instagram_header.sbi_medium .sbi_header_hashtag_icon .sbi_new_logo{margin-top:-18px;margin-left:-18px;width:36px;height:36px;font-size:36px}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_hashtag_icon .sbi_new_logo,.sb_instagram_header.sbi_large .sbi_header_hashtag_icon .sbi_new_logo{margin-top:-24px;margin-left:-24px;width:48px;height:48px;font-size:48px}#sb_instagram .sb_instagram_header .sbi_header_img_hover i{overflow:hidden;background:url(../img/small-logo.png) no-repeat 0 0}#sb_instagram .sb_instagram_header .sbi_header_img_hover{z-index:2;transition:opacity .4s ease-in-out}#sb_instagram .sb_instagram_header .sbi_fade_in{opacity:1;transition:opacity .2s ease-in-out}#sb_instagram .sb_instagram_header .sbi_header_img_hover{position:absolute;width:100%;top:0;bottom:0;left:0;text-align:center;color:#fff;background:rgba(0,0,0,.75);-moz-opacity:0;-khtml-opacity:0;opacity:0;border-radius:40px;transition:opacity .2s}#sb_instagram .sb_instagram_header a:focus .sbi_header_img_hover,#sb_instagram .sb_instagram_header a:hover .sbi_header_img_hover{opacity:1}#sb_instagram .sb_instagram_header .sbi_header_text{float:left;width:100%;padding-top:5px}#sb_instagram .sb_instagram_header a{text-decoration:none}#sb_instagram .sb_instagram_header .sbi_header_text .sbi_bio,#sb_instagram .sb_instagram_header .sbi_header_text h3{float:left;clear:both;width:auto;margin:0 0 0 60px!important;padding:0!important}#sb_instagram .sb_instagram_header h3{font-size:16px;line-height:1.3}#sb_instagram .sb_instagram_header p{font-size:13px;line-height:1.3;margin:0;padding:0}#sb_instagram p:empty{display:none}#sb_instagram .sb_instagram_header .sbi_header_text img.emoji{margin-right:3px!important}#sb_instagram .sb_instagram_header .sbi_header_text.sbi_no_bio h3{padding-top:9px!important}#sb_instagram .sb_instagram_header .sbi_header_text.sbi_no_bio .sbi_bio_info{clear:both}#sb_instagram #sbi_load{float:left;clear:both;width:100%;text-align:center}#sb_instagram #sbi_load .fa-spinner{display:none;position:absolute;top:50%;left:50%;margin:-8px 0 0 -7px;font-size:15px}#sb_instagram #sbi_load{opacity:1;transition:all .5s ease-in}#sb_instagram .sbi_load_btn .sbi_btn_text,#sb_instagram .sbi_load_btn .sbi_loader{opacity:1;transition:all .1s ease-in}#sb_instagram .sbi_hidden{opacity:0!important}#sb_instagram #sbi_load .sbi_load_btn,#sb_instagram .sbi_follow_btn a{display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1;padding:7px 14px;margin:5px auto 0 auto;background:#333;color:#eee;border:none;color:#fff;text-decoration:none;font-size:13px;line-height:1.5;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram #sbi_load .sbi_load_btn{position:relative}#sb_instagram .sbi_follow_btn{display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1;text-align:center}#sb_instagram .sbi_follow_btn.sbi_top{display:block;margin-bottom:5px}#sb_instagram .sbi_follow_btn a{background:#408bd1;color:#fff}#sb_instagram #sbi_load .sbi_load_btn,#sb_instagram .sbi_follow_btn a{transition:all .1s ease-in}#sb_instagram #sbi_load .sbi_load_btn:hover{outline:0;box-shadow:inset 0 0 20px 20px rgba(255,255,255,.25)}#sb_instagram .sbi_follow_btn a:focus,#sb_instagram .sbi_follow_btn a:hover{outline:0;box-shadow:inset 0 0 10px 20px #359dff}#sb_instagram #sbi_load .sbi_load_btn.sbi_custom:hover,#sb_instagram .sbi_follow_btn.sbi_custom a:focus,#sb_instagram .sbi_follow_btn.sbi_custom a:hover{box-shadow:inset 0 0 20px 20px rgba(255,255,255,.15)}#sb_instagram #sbi_load .sbi_load_btn:active,#sb_instagram .sbi_follow_btn a:active{box-shadow:inset 0 0 10px 20px rgba(0,0,0,.3)}#sb_instagram .sbi_follow_btn .fa,#sb_instagram .sbi_follow_btn svg{margin-bottom:-1px;margin-right:7px;font-size:15px}#sb_instagram .sbi_follow_btn svg{vertical-align:-.125em}#sb_instagram #sbi_load .sbi_follow_btn{margin-left:5px}#sb_instagram .sb_instagram_error{width:100%;text-align:center;line-height:1.4}#sbi_mod_error{display:none;border:1px solid #ddd;background:#eee;color:#333;margin:10px 0 0;padding:10px 15px;font-size:13px;text-align:center;clear:both;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px}#sbi_mod_error br{display:initial!important}#sbi_mod_error p{padding:5px 0!important;margin:0!important;line-height:1.3!important}#sbi_mod_error ol,#sbi_mod_error ul{padding:5px 0 5px 20px!important;margin:0!important}#sbi_mod_error li{padding:1px 0!important;margin:0!important}#sbi_mod_error span{font-size:12px}#sb_instagram.sbi_medium .sbi_photo_wrap .svg-inline--fa.fa-play,#sb_instagram.sbi_medium .sbi_playbtn{margin-top:-12px;margin-left:-9px;font-size:23px}#sb_instagram.sbi_medium .sbi_type_carousel .sbi_photo_wrap .fa-clone{right:8px;top:8px;font-size:18px}#sb_instagram.sbi_small .sbi_photo_wrap .svg-inline--fa.fa-play,#sb_instagram.sbi_small .sbi_playbtn{margin-top:-9px;margin-left:-7px;font-size:18px}#sb_instagram.sbi_small .sbi_type_carousel .sbi_photo_wrap .fa-clone{right:5px;top:5px;font-size:12px}@media all and (max-width:640px){#sb_instagram.sbi_col_3 #sbi_images .sbi_item,#sb_instagram.sbi_col_4 #sbi_images .sbi_item,#sb_instagram.sbi_col_5 #sbi_images .sbi_item,#sb_instagram.sbi_col_6 #sbi_images .sbi_item{width:50%}#sb_instagram.sbi_col_10 #sbi_images .sbi_item,#sb_instagram.sbi_col_7 #sbi_images .sbi_item,#sb_instagram.sbi_col_8 #sbi_images .sbi_item,#sb_instagram.sbi_col_9 #sbi_images .sbi_item{width:25%}#sb_instagram.sbi_width_resp{width:100%!important}}@media all and (max-width:480px){#sb_instagram.sbi_col_10 #sbi_images .sbi_item,#sb_instagram.sbi_col_3 #sbi_images .sbi_item,#sb_instagram.sbi_col_4 #sbi_images .sbi_item,#sb_instagram.sbi_col_5 #sbi_images .sbi_item,#sb_instagram.sbi_col_6 #sbi_images .sbi_item,#sb_instagram.sbi_col_7 #sbi_images .sbi_item,#sb_instagram.sbi_col_8 #sbi_images .sbi_item,#sb_instagram.sbi_col_9 #sbi_images .sbi_item{width:100%}}#sb_instagram.sbi_no_js #sbi_images .sbi_item .sbi_photo_wrap{box-sizing:border-box;position:relative;overflow:hidden}#sb_instagram.sbi_no_js #sbi_images .sbi_item .sbi_photo_wrap:before{content:"";display:block;padding-top:100%;z-index:-300}#sb_instagram.sbi_no_js #sbi_images .sbi_item .sbi_photo{position:absolute;top:0;left:0;bottom:0;right:0}#sb_instagram.sbi_no_js #sbi_images .sbi_item.sbi_transition{opacity:1;max-height:640px}#sb_instagram.sbi_no_js .sbi_load_btn,#sb_instagram.sbi_no_js .sbi_photo img{display:none}#sb_instagram #sbi_images .sbi_js_load_disabled .sbi_imgLiquid_ready.sbi_photo{padding-bottom:0!important}#sb_instagram #sbi_mod_error .sb_frontend_btn{display:inline-block;padding:6px 10px;background:#ddd;background:rgba(0,0,0,.1);text-decoration:none;border-radius:5px;margin-top:10px;color:#444}#sb_instagram #sbi_mod_error .sb_frontend_btn:hover{background:#ccc;background:rgba(0,0,0,.15)}#sb_instagram #sbi_mod_error .sb_frontend_btn .fa{margin-right:2px}
|
css/sb-instagram-admin.css
CHANGED
@@ -97,9 +97,12 @@
|
|
97 |
#sbi_admin .sbi-customize-tab-opt .sbi-success {
|
98 |
top: 5px;
|
99 |
}
|
100 |
-
#sbi_admin .sbi_note
|
|
|
101 |
font-size: 12px;
|
102 |
font-style: italic;
|
|
|
|
|
103 |
margin-left: 10px;
|
104 |
}
|
105 |
#sbi_admin table.sbi_shortcode_table{
|
@@ -528,6 +531,7 @@
|
|
528 |
margin-right: 10px;
|
529 |
}
|
530 |
/* Moderation settings */
|
|
|
531 |
#sbi_admin .sbi_mod_manual_settings{
|
532 |
float: left;
|
533 |
clear: both;
|
@@ -731,8 +735,20 @@
|
|
731 |
height: 16px;
|
732 |
line-height: 15px;
|
733 |
border-radius: 4px 0 0 4px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
734 |
}
|
735 |
-
|
|
|
|
|
736 |
position: relative;
|
737 |
padding: 3px 10px;
|
738 |
border: 1px solid #d6d6d6;
|
@@ -740,15 +756,15 @@
|
|
740 |
font-size: 12px;
|
741 |
border-radius: 0 4px 4px 0;
|
742 |
background: rgba(255,255,255,0.8);
|
743 |
-
width:
|
|
|
744 |
display: inline-block;
|
745 |
margin-left: 0;
|
746 |
min-height: 1px;
|
747 |
line-height: 1.4;
|
748 |
}
|
749 |
#sbi_admin .sbi_ca_accesstoken a.sbi_ca_token_shortcode{
|
750 |
-
margin
|
751 |
-
margin: 8px;
|
752 |
padding: 6px;
|
753 |
height: auto;
|
754 |
line-height: 1;
|
@@ -791,17 +807,21 @@
|
|
791 |
#sbi_admin .sbi_manually_connect_wrap{
|
792 |
padding-top: 5px;
|
793 |
}
|
794 |
-
#sbi_admin .sbi_user_feed_account_wrap:first-child
|
|
|
795 |
padding-top: 5px;
|
796 |
}
|
797 |
-
#sbi_admin .sbi_user_feed_account_wrap:last-child
|
|
|
798 |
padding-bottom: 6px;
|
799 |
}
|
800 |
-
#sbi_admin .sbi_user_feed_account_wrap
|
|
|
801 |
padding-bottom: 5px;
|
802 |
padding-left: 2px;
|
803 |
}
|
804 |
-
#sbi_admin .sbi_user_feed_account_wrap span
|
|
|
805 |
font-size: 13px;
|
806 |
}
|
807 |
#sbi_admin .sbi_manual_account_id_toggle label{
|
@@ -823,6 +843,9 @@
|
|
823 |
#sbi_admin .sbi_ca_info{
|
824 |
overflow: hidden;
|
825 |
}
|
|
|
|
|
|
|
826 |
#sbi_admin .sbi_ca_show_token{
|
827 |
display: inline-block;
|
828 |
padding: 10px 5px 0px 5px;
|
@@ -860,10 +883,8 @@
|
|
860 |
#sbi_admin .sbi_delete_account .sbi_remove_text{
|
861 |
display: none;
|
862 |
}
|
863 |
-
#sbi_admin .
|
864 |
-
|
865 |
-
}
|
866 |
-
#sbi_admin .sbi_ca_token{
|
867 |
border-left: 1px solid #d6d6d6;
|
868 |
border-radius: 4px;
|
869 |
}
|
@@ -877,46 +898,6 @@
|
|
877 |
width: 70%;
|
878 |
}
|
879 |
}
|
880 |
-
/*#sbi_admin .sbi_remove_from_user_feed{
|
881 |
-
background: #71ad26;
|
882 |
-
color: #fff;
|
883 |
-
border: none;
|
884 |
-
box-shadow: none;
|
885 |
-
}*/
|
886 |
-
#sbi_admin .sbi_ca_info{
|
887 |
-
overflow: hidden;
|
888 |
-
}
|
889 |
-
#sbi_admin .sbi_ca_show_token{
|
890 |
-
display: inline-block;
|
891 |
-
padding: 10px 5px 0px 5px;
|
892 |
-
margin: 0;
|
893 |
-
font-size: 12px;
|
894 |
-
vertical-align: top;
|
895 |
-
}
|
896 |
-
#sbi_admin .sbi_ca_shortcode{
|
897 |
-
display: none;
|
898 |
-
padding: 0;
|
899 |
-
width: 100%;
|
900 |
-
float: left;
|
901 |
-
clear: both;
|
902 |
-
margin: 10px 0 0 0;
|
903 |
-
}
|
904 |
-
#sbi_admin .sbi_ca_shortcode p{
|
905 |
-
padding-bottom: 10px;
|
906 |
-
font-size: 13px;
|
907 |
-
}
|
908 |
-
#sbi_admin .sbi_ca_shortcode code{
|
909 |
-
margin-top: 5px;
|
910 |
-
display: inline-block;
|
911 |
-
}
|
912 |
-
#sbi_admin .sbi_user_feed_ids_wrap .sbi_ca_avatar{
|
913 |
-
width: 20px;
|
914 |
-
height: 20px;
|
915 |
-
position: relative;
|
916 |
-
top: 5px;
|
917 |
-
margin-right: 8px;
|
918 |
-
border-radius: 4px;
|
919 |
-
}
|
920 |
|
921 |
#sbi_admin .sbi_col {
|
922 |
float: left;
|
@@ -936,19 +917,6 @@
|
|
936 |
margin: 5px 2px 0 0;
|
937 |
}
|
938 |
|
939 |
-
|
940 |
-
@media all and (max-width: 1200px){
|
941 |
-
#sbi_admin .sbi_delete_account .sbi_remove_text{
|
942 |
-
display: none;
|
943 |
-
}
|
944 |
-
#sbi_admin .sbi_ca_token_label{
|
945 |
-
display: none;
|
946 |
-
}
|
947 |
-
#sbi_admin .sbi_ca_token{
|
948 |
-
border-left: 1px solid #d6d6d6;
|
949 |
-
border-radius: 4px;
|
950 |
-
}
|
951 |
-
}
|
952 |
@media all and (max-width: 800px){
|
953 |
#sbi_admin .sbi_col.sbi_one {
|
954 |
width: 25%;
|
@@ -1061,7 +1029,6 @@
|
|
1061 |
padding: 3px 0;
|
1062 |
width: 90%;
|
1063 |
margin: 0 auto;
|
1064 |
-
text-align: center;
|
1065 |
}
|
1066 |
#sbi_admin .sbi_login_button_row label{
|
1067 |
top: -2px;
|
@@ -1170,19 +1137,32 @@
|
|
1170 |
.form-table .sb_layout_type:first-child {
|
1171 |
margin-left: 0;
|
1172 |
}
|
1173 |
-
|
|
|
|
|
1174 |
margin-bottom: 20px;
|
1175 |
}
|
1176 |
-
.sb_instagram_layout_setting:last-child
|
|
|
1177 |
margin-bottom: 0;
|
1178 |
}
|
1179 |
-
.sb_instagram_layout_setting label
|
|
|
1180 |
display: inline-block;
|
1181 |
font-weight: bold;
|
1182 |
font-size: 14px;
|
1183 |
padding-bottom: 5px;
|
1184 |
padding-right: 5px;
|
1185 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1186 |
|
1187 |
/* Layout settings */
|
1188 |
#sbi_admin .sb_layout_options_wrap{
|
@@ -1415,4 +1395,77 @@
|
|
1415 |
}
|
1416 |
#sbi_admin #twitter-widget-0 {
|
1417 |
width: 65px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1418 |
}
|
97 |
#sbi_admin .sbi-customize-tab-opt .sbi-success {
|
98 |
top: 5px;
|
99 |
}
|
100 |
+
#sbi_admin .sbi_note,
|
101 |
+
#sbi_admin .sbi_aside{
|
102 |
font-size: 12px;
|
103 |
font-style: italic;
|
104 |
+
}
|
105 |
+
#sbi_admin .sbi_note{
|
106 |
margin-left: 10px;
|
107 |
}
|
108 |
#sbi_admin table.sbi_shortcode_table{
|
531 |
margin-right: 10px;
|
532 |
}
|
533 |
/* Moderation settings */
|
534 |
+
#sbi_admin .sb_instagram_box,
|
535 |
#sbi_admin .sbi_mod_manual_settings{
|
536 |
float: left;
|
537 |
clear: both;
|
735 |
height: 16px;
|
736 |
line-height: 15px;
|
737 |
border-radius: 4px 0 0 4px;
|
738 |
+
min-width: 80px;
|
739 |
+
margin-bottom: 2px;
|
740 |
+
}
|
741 |
+
#sbi_admin .sbi_permissions_desc,
|
742 |
+
#sbi_admin .sbi_ca_token,
|
743 |
+
#sbi_admin .sbi_ca_user_id {
|
744 |
+
padding: 3px 10px;
|
745 |
+
}
|
746 |
+
#sbi_admin .sbi_permissions_desc{
|
747 |
+
font-size: 13px;
|
748 |
}
|
749 |
+
|
750 |
+
#sbi_admin .sbi_ca_token,
|
751 |
+
#sbi_admin .sbi_ca_user_id{
|
752 |
position: relative;
|
753 |
padding: 3px 10px;
|
754 |
border: 1px solid #d6d6d6;
|
756 |
font-size: 12px;
|
757 |
border-radius: 0 4px 4px 0;
|
758 |
background: rgba(255,255,255,0.8);
|
759 |
+
min-width: 400px;
|
760 |
+
width: 75%;
|
761 |
display: inline-block;
|
762 |
margin-left: 0;
|
763 |
min-height: 1px;
|
764 |
line-height: 1.4;
|
765 |
}
|
766 |
#sbi_admin .sbi_ca_accesstoken a.sbi_ca_token_shortcode{
|
767 |
+
margin: 0 8px 8px;
|
|
|
768 |
padding: 6px;
|
769 |
height: auto;
|
770 |
line-height: 1;
|
807 |
#sbi_admin .sbi_manually_connect_wrap{
|
808 |
padding-top: 5px;
|
809 |
}
|
810 |
+
#sbi_admin .sbi_user_feed_account_wrap:first-child,
|
811 |
+
#sbi_admin .sbi_tagged_feed_account_wrap:first-child{
|
812 |
padding-top: 5px;
|
813 |
}
|
814 |
+
#sbi_admin .sbi_user_feed_account_wrap:last-child,
|
815 |
+
#sbi_admin .sbi_tagged_feed_account_wrap:last-child{
|
816 |
padding-bottom: 6px;
|
817 |
}
|
818 |
+
#sbi_admin .sbi_user_feed_account_wrap,
|
819 |
+
#sbi_admin .sbi_tagged_feed_account_wrap{
|
820 |
padding-bottom: 5px;
|
821 |
padding-left: 2px;
|
822 |
}
|
823 |
+
#sbi_admin .sbi_user_feed_account_wrap span,
|
824 |
+
#sbi_admin .sbi_tagged_feed_account_wrap span{
|
825 |
font-size: 13px;
|
826 |
}
|
827 |
#sbi_admin .sbi_manual_account_id_toggle label{
|
843 |
#sbi_admin .sbi_ca_info{
|
844 |
overflow: hidden;
|
845 |
}
|
846 |
+
#sbi_admin .sbi_ca_show_token .fa {
|
847 |
+
margin-right: 0;
|
848 |
+
}
|
849 |
#sbi_admin .sbi_ca_show_token{
|
850 |
display: inline-block;
|
851 |
padding: 10px 5px 0px 5px;
|
883 |
#sbi_admin .sbi_delete_account .sbi_remove_text{
|
884 |
display: none;
|
885 |
}
|
886 |
+
#sbi_admin .sbi_ca_token,
|
887 |
+
#sbi_admin .sbi_ca_user_id{
|
|
|
|
|
888 |
border-left: 1px solid #d6d6d6;
|
889 |
border-radius: 4px;
|
890 |
}
|
898 |
width: 70%;
|
899 |
}
|
900 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
901 |
|
902 |
#sbi_admin .sbi_col {
|
903 |
float: left;
|
917 |
margin: 5px 2px 0 0;
|
918 |
}
|
919 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
920 |
@media all and (max-width: 800px){
|
921 |
#sbi_admin .sbi_col.sbi_one {
|
922 |
width: 25%;
|
1029 |
padding: 3px 0;
|
1030 |
width: 90%;
|
1031 |
margin: 0 auto;
|
|
|
1032 |
}
|
1033 |
#sbi_admin .sbi_login_button_row label{
|
1034 |
top: -2px;
|
1137 |
.form-table .sb_layout_type:first-child {
|
1138 |
margin-left: 0;
|
1139 |
}
|
1140 |
+
|
1141 |
+
.sb_instagram_layout_setting,
|
1142 |
+
.sb_instagram_box_setting{
|
1143 |
margin-bottom: 20px;
|
1144 |
}
|
1145 |
+
.sb_instagram_layout_setting:last-child,
|
1146 |
+
.sb_instagram_box_setting:last-child {
|
1147 |
margin-bottom: 0;
|
1148 |
}
|
1149 |
+
.sb_instagram_layout_setting label,
|
1150 |
+
.sb_instagram_box_setting label {
|
1151 |
display: inline-block;
|
1152 |
font-weight: bold;
|
1153 |
font-size: 14px;
|
1154 |
padding-bottom: 5px;
|
1155 |
padding-right: 5px;
|
1156 |
}
|
1157 |
+
.sb_instagram_box_setting textarea {
|
1158 |
+
width: 100%;
|
1159 |
+
}
|
1160 |
+
#sbi_admin .sb_layout_options_wrap .sbi_shortcode,
|
1161 |
+
#sbi_admin .sb_instagram_box_setting .sbi_shortcode{
|
1162 |
+
position: relative;
|
1163 |
+
float: none;
|
1164 |
+
top: -4px
|
1165 |
+
}
|
1166 |
|
1167 |
/* Layout settings */
|
1168 |
#sbi_admin .sb_layout_options_wrap{
|
1395 |
}
|
1396 |
#sbi_admin #twitter-widget-0 {
|
1397 |
width: 65px !important;
|
1398 |
+
}
|
1399 |
+
|
1400 |
+
/* Placeholder styles */
|
1401 |
+
#sbi_admin .sbi_ca_new_or_updated .sbi_ca_info:before {
|
1402 |
+
content: 'Successfully connected';
|
1403 |
+
padding: 5px 10px;
|
1404 |
+
margin: 0px 0 12px 0;
|
1405 |
+
background: #d3dec1;
|
1406 |
+
display: inline-block;
|
1407 |
+
border-radius: 5px;
|
1408 |
+
font-size: 13px;
|
1409 |
+
color: #2e4506;
|
1410 |
+
border: 1px solid #a9b594;
|
1411 |
+
}
|
1412 |
+
|
1413 |
+
#sbi_admin .sbi_deprecated {
|
1414 |
+
padding: 2px 2px 2px 10px;
|
1415 |
+
margin: 0px 0 12px 0;
|
1416 |
+
background: #f3dcda;
|
1417 |
+
display: inline-block;
|
1418 |
+
border-radius: 5px;
|
1419 |
+
font-size: 13px;
|
1420 |
+
color: #ad4040;
|
1421 |
+
border: 1px solid #e9c5c2;
|
1422 |
+
}
|
1423 |
+
|
1424 |
+
#sbi_admin .sbi_deprecated .fa{
|
1425 |
+
margin-right: 5px;
|
1426 |
+
font-size: 14px;
|
1427 |
+
}
|
1428 |
+
#sbi_admin .sbi_reconnect {
|
1429 |
+
font-size: 12px;
|
1430 |
+
background: #d65b5c;
|
1431 |
+
color: #fff;
|
1432 |
+
padding: 0px 8px;
|
1433 |
+
min-height: 23px;
|
1434 |
+
border: none;
|
1435 |
+
margin-left: 5px;
|
1436 |
+
height: 23px;
|
1437 |
+
line-height: 19px;
|
1438 |
+
text-shadow: none;
|
1439 |
+
box-shadow: none;
|
1440 |
+
}
|
1441 |
+
#sbi_admin .sbi_reconnect:hover{
|
1442 |
+
background: #c44b4c;
|
1443 |
+
}
|
1444 |
+
|
1445 |
+
.sbi-welcome .sbi-notice {
|
1446 |
+
clear: both;
|
1447 |
+
width: 96%;
|
1448 |
+
margin: 10px 0 20px 0;
|
1449 |
+
background: #F7E6E6;
|
1450 |
+
padding: 0 1.5%;
|
1451 |
+
border: 1px solid #BA7B7B;
|
1452 |
+
color: #592626;
|
1453 |
+
|
1454 |
+
-moz-border-radius: 3px;
|
1455 |
+
-webkit-border-radius: 3px;
|
1456 |
+
border-radius: 3px;
|
1457 |
+
}
|
1458 |
+
|
1459 |
+
/* Basic Display Update */
|
1460 |
+
#sbi_admin .sbi_tooltip_link.sbi_tooltip_under {
|
1461 |
+
margin-left: 0;
|
1462 |
+
}
|
1463 |
+
.sbi_tooltip_under_text {
|
1464 |
+
padding: 10px 15px !important;
|
1465 |
+
}
|
1466 |
+
.sb_instagram_box_setting textarea {
|
1467 |
+
width: 100%;
|
1468 |
+
}
|
1469 |
+
#sbi_admin .sbi_ca_show_token .fa {
|
1470 |
+
margin-right: 0;
|
1471 |
}
|
css/sb-instagram.css
CHANGED
@@ -36,6 +36,14 @@
|
|
36 |
-moz-box-sizing: border-box;
|
37 |
box-sizing: border-box;
|
38 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
/* Items */
|
41 |
#sb_instagram #sbi_images .sbi_item{
|
@@ -307,6 +315,33 @@
|
|
307 |
text-decoration: none;
|
308 |
transition: color 0.5s ease;
|
309 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
/** Medium Header */
|
311 |
/* Only use medium & large headers on devices above 480px */
|
312 |
@media all and (min-width: 480px){
|
@@ -413,7 +448,8 @@
|
|
413 |
background: rgba(0,0,0,0.75);
|
414 |
}
|
415 |
|
416 |
-
#sb_instagram .sb_instagram_header .sbi_header_img_hover .sbi_new_logo
|
|
|
417 |
position: absolute;
|
418 |
top: 50%;
|
419 |
left: 50%;
|
@@ -423,6 +459,23 @@
|
|
423 |
height: 24px;
|
424 |
font-size: 24px;
|
425 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
426 |
#sb_instagram .sb_instagram_header .sbi_header_img_hover i {
|
427 |
overflow: hidden;
|
428 |
background: url('../img/small-logo.png') no-repeat 0 0;
|
@@ -634,6 +687,9 @@
|
|
634 |
-webkit-border-radius: 4px;
|
635 |
border-radius: 4px;
|
636 |
}
|
|
|
|
|
|
|
637 |
#sbi_mod_error p{
|
638 |
padding: 5px 0 !important;
|
639 |
margin: 0 !important;
|
@@ -742,3 +798,22 @@
|
|
742 |
#sb_instagram #sbi_images .sbi_js_load_disabled .sbi_imgLiquid_ready.sbi_photo {
|
743 |
padding-bottom: 0 !important;
|
744 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
-moz-box-sizing: border-box;
|
37 |
box-sizing: border-box;
|
38 |
}
|
39 |
+
/* Remove header shadow/border */
|
40 |
+
#sb_instagram .sbi_header_link {
|
41 |
+
-webkit-box-shadow: none;
|
42 |
+
box-shadow: none;
|
43 |
+
}
|
44 |
+
#sb_instagram .sbi_header_link:hover {
|
45 |
+
border: none;
|
46 |
+
}
|
47 |
|
48 |
/* Items */
|
49 |
#sb_instagram #sbi_images .sbi_item{
|
315 |
text-decoration: none;
|
316 |
transition: color 0.5s ease;
|
317 |
}
|
318 |
+
.sbi_no_avatar .sbi_header_img{
|
319 |
+
background: #333;
|
320 |
+
color: #fff;
|
321 |
+
width: 50px;
|
322 |
+
height: 50px;
|
323 |
+
position: relative;
|
324 |
+
}
|
325 |
+
.sbi_no_avatar .sbi_header_hashtag_icon {
|
326 |
+
display: block;
|
327 |
+
color: #fff;
|
328 |
+
opacity: .9;
|
329 |
+
-webkit-transition: background .6s linear,color .6s linear;
|
330 |
+
-moz-transition: background .6s linear,color .6s linear;
|
331 |
+
-ms-transition: background .6s linear,color .6s linear;
|
332 |
+
-o-transition: background .6s linear,color .6s linear;
|
333 |
+
transition: background .6s linear,color .6s linear
|
334 |
+
}
|
335 |
+
|
336 |
+
.sbi_no_avatar:hover .sbi_header_hashtag_icon {
|
337 |
+
display: block;
|
338 |
+
opacity: 1;
|
339 |
+
-webkit-transition: background .2s linear,color .2s linear;
|
340 |
+
-moz-transition: background .2s linear,color .2s linear;
|
341 |
+
-ms-transition: background .2s linear,color .2s linear;
|
342 |
+
-o-transition: background .2s linear,color .2s linear;
|
343 |
+
transition: background .2s linear,color .2s linear
|
344 |
+
}
|
345 |
/** Medium Header */
|
346 |
/* Only use medium & large headers on devices above 480px */
|
347 |
@media all and (min-width: 480px){
|
448 |
background: rgba(0,0,0,0.75);
|
449 |
}
|
450 |
|
451 |
+
#sb_instagram .sb_instagram_header .sbi_header_img_hover .sbi_new_logo,
|
452 |
+
#sb_instagram .sb_instagram_header .sbi_header_hashtag_icon .sbi_new_logo{
|
453 |
position: absolute;
|
454 |
top: 50%;
|
455 |
left: 50%;
|
459 |
height: 24px;
|
460 |
font-size: 24px;
|
461 |
}
|
462 |
+
#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_hashtag_icon .sbi_new_logo,
|
463 |
+
.sb_instagram_header.sbi_medium .sbi_header_hashtag_icon .sbi_new_logo{
|
464 |
+
margin-top: -18px;
|
465 |
+
margin-left: -18px;
|
466 |
+
width: 36px;
|
467 |
+
height: 36px;
|
468 |
+
font-size: 36px
|
469 |
+
}
|
470 |
+
|
471 |
+
#sb_instagram .sb_instagram_header.sbi_large .sbi_header_hashtag_icon .sbi_new_logo,
|
472 |
+
.sb_instagram_header.sbi_large .sbi_header_hashtag_icon .sbi_new_logo {
|
473 |
+
margin-top: -24px;
|
474 |
+
margin-left: -24px;
|
475 |
+
width: 48px;
|
476 |
+
height: 48px;
|
477 |
+
font-size: 48px
|
478 |
+
}
|
479 |
#sb_instagram .sb_instagram_header .sbi_header_img_hover i {
|
480 |
overflow: hidden;
|
481 |
background: url('../img/small-logo.png') no-repeat 0 0;
|
687 |
-webkit-border-radius: 4px;
|
688 |
border-radius: 4px;
|
689 |
}
|
690 |
+
#sbi_mod_error br {
|
691 |
+
display: initial !important;
|
692 |
+
}
|
693 |
#sbi_mod_error p{
|
694 |
padding: 5px 0 !important;
|
695 |
margin: 0 !important;
|
798 |
#sb_instagram #sbi_images .sbi_js_load_disabled .sbi_imgLiquid_ready.sbi_photo {
|
799 |
padding-bottom: 0 !important;
|
800 |
}
|
801 |
+
#sb_instagram #sbi_mod_error .sb_frontend_btn {
|
802 |
+
display: inline-block;
|
803 |
+
padding: 6px 10px;
|
804 |
+
background: #ddd;
|
805 |
+
background: rgba(0,0,0,.1);
|
806 |
+
text-decoration: none;
|
807 |
+
border-radius: 5px;
|
808 |
+
margin-top: 10px;
|
809 |
+
color: #444
|
810 |
+
}
|
811 |
+
|
812 |
+
#sb_instagram #sbi_mod_error .sb_frontend_btn:hover {
|
813 |
+
background: #ccc;
|
814 |
+
background: rgba(0,0,0,.15)
|
815 |
+
}
|
816 |
+
|
817 |
+
#sb_instagram #sbi_mod_error .sb_frontend_btn .fa {
|
818 |
+
margin-right: 2px
|
819 |
+
}
|
css/sb-instagram.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#sb_instagram{width:100%;margin:0 auto;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram:after{content:"";display:table;clear:both}#sb_instagram.sbi_fixed_height{overflow:hidden;overflow-y:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram #sbi_images{width:100%;float:left;line-height:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram #sbi_images .sbi_item{display:-moz-inline-stack;display:inline-block;float:left;vertical-align:top;zoom:1;max-height:1000px;padding:inherit!important;margin:0!important;text-decoration:none;opacity:1;overflow:hidden;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;-ms-transition:all .5s ease;transition:all .5s ease}#sb_instagram #sbi_images .sbi_item.sbi_transition{opacity:0;max-height:0}#sb_instagram.sbi_col_1 #sbi_images .sbi_item{width:100%}#sb_instagram.sbi_col_2 #sbi_images .sbi_item{width:50%}#sb_instagram.sbi_col_3 #sbi_images .sbi_item{width:33.33%}#sb_instagram.sbi_col_4 #sbi_images .sbi_item{width:25%}#sb_instagram.sbi_col_5 #sbi_images .sbi_item{width:20%}#sb_instagram.sbi_col_6 #sbi_images .sbi_item{width:16.66%}#sb_instagram.sbi_col_7 #sbi_images .sbi_item{width:14.28%}#sb_instagram.sbi_col_8 #sbi_images .sbi_item{width:12.5%}#sb_instagram.sbi_col_9 #sbi_images .sbi_item{width:11.11%}#sb_instagram.sbi_col_10 #sbi_images .sbi_item{width:10%}#sb_instagram.sbi_col_1.sbi_disable_mobile #sbi_images .sbi_item{width:100%}#sb_instagram.sbi_col_2.sbi_disable_mobile #sbi_images .sbi_item{width:50%}#sb_instagram.sbi_col_3.sbi_disable_mobile #sbi_images .sbi_item{width:33.33%}#sb_instagram.sbi_col_4.sbi_disable_mobile #sbi_images .sbi_item{width:25%}#sb_instagram.sbi_col_5.sbi_disable_mobile #sbi_images .sbi_item{width:20%}#sb_instagram.sbi_col_6.sbi_disable_mobile #sbi_images .sbi_item{width:16.66%}#sb_instagram.sbi_col_7.sbi_disable_mobile #sbi_images .sbi_item{width:14.28%}#sb_instagram.sbi_col_8.sbi_disable_mobile #sbi_images .sbi_item{width:12.5%}#sb_instagram.sbi_col_9.sbi_disable_mobile #sbi_images .sbi_item{width:11.11%}#sb_instagram.sbi_col_10.sbi_disable_mobile #sbi_images .sbi_item{width:10%}#sb_instagram .sbi_photo_wrap{position:relative}#sb_instagram .sbi_photo{display:block;text-decoration:none}#sb_instagram .sbi_photo img{width:100%;height:auto}#sb_instagram .sbi_no_js img{display:none}#sb_instagram a,#sb_instagram a:active,#sb_instagram a:focus,#sb_instagram a:hover{outline:0}#sb_instagram img{display:block;padding:0!important;margin:0!important;max-width:100%!important;opacity:1!important}#sb_instagram .sbi_link{display:none;position:absolute;bottom:0;right:0;width:100%;padding:10px 0;background:rgba(0,0,0,.5);text-align:center;color:#fff;font-size:12px;line-height:1.1}#sb_instagram .sbi_link a{padding:0 6px;text-decoration:none;color:#fff;font-size:12px;line-height:1.1;display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1}#sb_instagram .sbi_link .sbi_lightbox_link{padding-bottom:5px}#sb_instagram .sbi_link a:focus,#sb_instagram .sbi_link a:hover{text-decoration:underline}#sb_instagram .sbi_photo_wrap:focus .sbi_link,#sb_instagram .sbi_photo_wrap:hover .sbi_link{display:block}#sb_instagram svg:not(:root).svg-inline--fa{height:1em;display:inline-block}#sb_instagram .sbi_type_carousel .sbi_playbtn,#sb_instagram .sbi_type_carousel .svg-inline--fa.fa-play,#sb_instagram .sbi_type_video .sbi_playbtn,#sb_instagram .sbi_type_video .svg-inline--fa.fa-play,.sbi_type_carousel .fa-clone{display:block!important;position:absolute;z-index:1;color:#fff;color:rgba(255,255,255,.9);font-style:normal!important;text-shadow:0 0 8px rgba(0,0,0,.8)}#sb_instagram .sbi_type_carousel .sbi_playbtn,#sb_instagram .sbi_type_video .sbi_playbtn{z-index:2;top:50%;left:50%;margin-top:-24px;margin-left:-19px;padding:0;font-size:48px}#sb_instagram .sbi_type_carousel .fa-clone{right:12px;top:12px;font-size:24px;text-shadow:0 0 8px rgba(0,0,0,.3)}#sb_instagram .sbi_type_carousel .svg-inline--fa.fa-play,#sb_instagram .sbi_type_video .svg-inline--fa.fa-play,.sbi_type_carousel svg.fa-clone{-webkit-filter:drop-shadow( 0 0 2px rgba(0,0,0,.4) );filter:drop-shadow( 0 0 2px rgba(0,0,0,.4) )}#sb_instagram .sbi_loader{width:20px;height:20px;position:relative;top:50%;left:50%;margin:-10px 0 0 -10px;background-color:#000;background-color:rgba(0,0,0,.5);border-radius:100%;-webkit-animation:sbi-sk-scaleout 1s infinite ease-in-out;animation:sbi-sk-scaleout 1s infinite ease-in-out}#sb_instagram br{display:none}#sbi_load p{display:inline;padding:0;margin:0}#sb_instagram #sbi_load .sbi_loader{position:absolute;margin-top:-11px;background-color:#fff;opacity:1}@-webkit-keyframes sbi-sk-scaleout{0%{-webkit-transform:scale(0)}100%{-webkit-transform:scale(1);opacity:0}}@keyframes sbi-sk-scaleout{0%{-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0)}100%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);opacity:0}}#sb_instagram .fa-spin,#sbi_lightbox .fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}#sb_instagram .fa-pulse,#sbi_lightbox .fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.sbi-screenreader{text-indent:-9999px!important;display:block!important;width:0!important;height:0!important;line-height:0!important;text-align:left!important}#sb_instagram .sb_instagram_header{float:left;clear:both;margin:0 0 15px 0;padding:0;line-height:1.2;width:100%}#sb_instagram .sb_instagram_header a{float:left;display:block;text-decoration:none;transition:color .5s ease}@media all and (min-width:480px){#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_img{width:80px;height:80px;border-radius:40px}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_img img{width:80px;height:80px;border-radius:40px}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text h3{font-size:20px}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio,#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio_info{font-size:14px}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio,#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio_info,#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text h3{margin-left:95px!important;line-height:1.4}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text h3{margin-right:-85px!important}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio_info{margin-top:4px!important}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text.sbi_no_bio h3{padding-top:20px!important}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_img{width:120px;height:120px;border-radius:60px}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_img img{width:120px;height:120px;border-radius:60px}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text h3{font-size:28px}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio,#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio_info{font-size:16px}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio,#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio_info,#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text h3{margin-left:140px!important;line-height:1.5}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text h3{margin-right:-120px!important}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio_info{margin-top:12px!important}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text.sbi_no_bio h3{padding-top:32px!important}}#sb_instagram .sb_instagram_header .sbi_header_img{float:left;position:relative;width:50px;margin:0 0 0 -100%!important;overflow:hidden;-moz-border-radius:40px;-webkit-border-radius:40px;border-radius:40px}#sb_instagram .sb_instagram_header .sbi_header_img img{float:left;margin:0!important;padding:0!important;border:none!important;-moz-border-radius:40px;-webkit-border-radius:40px;border-radius:40px}#sb_instagram .sb_instagram_header .sbi_header_img_hover{opacity:0;position:absolute;width:100%;top:0;bottom:0;left:0;text-align:center;color:#fff;background:rgba(0,0,0,.75)}#sb_instagram .sb_instagram_header .sbi_header_img_hover .sbi_new_logo{position:absolute;top:50%;left:50%;margin-top:-12px;margin-left:-12px;width:24px;height:24px;font-size:24px}#sb_instagram .sb_instagram_header .sbi_header_img_hover i{overflow:hidden;background:url(../img/small-logo.png) no-repeat 0 0}#sb_instagram .sb_instagram_header .sbi_header_img_hover{z-index:2;transition:opacity .4s ease-in-out}#sb_instagram .sb_instagram_header .sbi_fade_in{opacity:1;transition:opacity .2s ease-in-out}#sb_instagram .sb_instagram_header .sbi_header_img_hover{position:absolute;width:100%;top:0;bottom:0;left:0;text-align:center;color:#fff;background:rgba(0,0,0,.75);-moz-opacity:0;-khtml-opacity:0;opacity:0;border-radius:40px;transition:opacity .2s}#sb_instagram .sb_instagram_header a:focus .sbi_header_img_hover,#sb_instagram .sb_instagram_header a:hover .sbi_header_img_hover{opacity:1}#sb_instagram .sb_instagram_header .sbi_header_text{float:left;width:100%;padding-top:5px}#sb_instagram .sb_instagram_header a{text-decoration:none}#sb_instagram .sb_instagram_header .sbi_header_text .sbi_bio,#sb_instagram .sb_instagram_header .sbi_header_text h3{float:left;clear:both;width:auto;margin:0 0 0 60px!important;padding:0!important}#sb_instagram .sb_instagram_header h3{font-size:16px;line-height:1.3}#sb_instagram .sb_instagram_header p{font-size:13px;line-height:1.3;margin:0;padding:0}#sb_instagram p:empty{display:none}#sb_instagram .sb_instagram_header .sbi_header_text img.emoji{margin-right:3px!important}#sb_instagram .sb_instagram_header .sbi_header_text.sbi_no_bio h3{padding-top:9px!important}#sb_instagram .sb_instagram_header .sbi_header_text.sbi_no_bio .sbi_bio_info{clear:both}#sb_instagram #sbi_load{float:left;clear:both;width:100%;text-align:center}#sb_instagram #sbi_load .fa-spinner{display:none;position:absolute;top:50%;left:50%;margin:-8px 0 0 -7px;font-size:15px}#sb_instagram #sbi_load{opacity:1;transition:all .5s ease-in}#sb_instagram .sbi_load_btn .sbi_btn_text,#sb_instagram .sbi_load_btn .sbi_loader{opacity:1;transition:all .1s ease-in}#sb_instagram .sbi_hidden{opacity:0!important}#sb_instagram #sbi_load .sbi_load_btn,#sb_instagram .sbi_follow_btn a{display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1;padding:7px 14px;margin:5px auto 0 auto;background:#333;color:#eee;border:none;color:#fff;text-decoration:none;font-size:13px;line-height:1.5;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram #sbi_load .sbi_load_btn{position:relative}#sb_instagram .sbi_follow_btn{display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1;text-align:center}#sb_instagram .sbi_follow_btn.sbi_top{display:block;margin-bottom:5px}#sb_instagram .sbi_follow_btn a{background:#408bd1;color:#fff}#sb_instagram #sbi_load .sbi_load_btn,#sb_instagram .sbi_follow_btn a{transition:all .1s ease-in}#sb_instagram #sbi_load .sbi_load_btn:hover{outline:0;box-shadow:inset 0 0 20px 20px rgba(255,255,255,.25)}#sb_instagram .sbi_follow_btn a:focus,#sb_instagram .sbi_follow_btn a:hover{outline:0;box-shadow:inset 0 0 10px 20px #359dff}#sb_instagram #sbi_load .sbi_load_btn.sbi_custom:hover,#sb_instagram .sbi_follow_btn.sbi_custom a:focus,#sb_instagram .sbi_follow_btn.sbi_custom a:hover{box-shadow:inset 0 0 20px 20px rgba(255,255,255,.15)}#sb_instagram #sbi_load .sbi_load_btn:active,#sb_instagram .sbi_follow_btn a:active{box-shadow:inset 0 0 10px 20px rgba(0,0,0,.3)}#sb_instagram .sbi_follow_btn .fa,#sb_instagram .sbi_follow_btn svg{margin-bottom:-1px;margin-right:7px;font-size:15px}#sb_instagram .sbi_follow_btn svg{vertical-align:-.125em}#sb_instagram #sbi_load .sbi_follow_btn{margin-left:5px}#sb_instagram .sb_instagram_error{width:100%;text-align:center;line-height:1.4}#sbi_mod_error{display:none;border:1px solid #ddd;background:#eee;color:#333;margin:10px 0 0;padding:10px 15px;font-size:13px;text-align:center;clear:both;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px}#sbi_mod_error p{padding:5px 0!important;margin:0!important;line-height:1.3!important}#sbi_mod_error ol,#sbi_mod_error ul{padding:5px 0 5px 20px!important;margin:0!important}#sbi_mod_error li{padding:1px 0!important;margin:0!important}#sbi_mod_error span{font-size:12px}#sb_instagram.sbi_medium .sbi_photo_wrap .svg-inline--fa.fa-play,#sb_instagram.sbi_medium .sbi_playbtn{margin-top:-12px;margin-left:-9px;font-size:23px}#sb_instagram.sbi_medium .sbi_type_carousel .sbi_photo_wrap .fa-clone{right:8px;top:8px;font-size:18px}#sb_instagram.sbi_small .sbi_photo_wrap .svg-inline--fa.fa-play,#sb_instagram.sbi_small .sbi_playbtn{margin-top:-9px;margin-left:-7px;font-size:18px}#sb_instagram.sbi_small .sbi_type_carousel .sbi_photo_wrap .fa-clone{right:5px;top:5px;font-size:12px}@media all and (max-width:640px){#sb_instagram.sbi_col_3 #sbi_images .sbi_item,#sb_instagram.sbi_col_4 #sbi_images .sbi_item,#sb_instagram.sbi_col_5 #sbi_images .sbi_item,#sb_instagram.sbi_col_6 #sbi_images .sbi_item{width:50%}#sb_instagram.sbi_col_10 #sbi_images .sbi_item,#sb_instagram.sbi_col_7 #sbi_images .sbi_item,#sb_instagram.sbi_col_8 #sbi_images .sbi_item,#sb_instagram.sbi_col_9 #sbi_images .sbi_item{width:25%}#sb_instagram.sbi_width_resp{width:100%!important}}@media all and (max-width:480px){#sb_instagram.sbi_col_10 #sbi_images .sbi_item,#sb_instagram.sbi_col_3 #sbi_images .sbi_item,#sb_instagram.sbi_col_4 #sbi_images .sbi_item,#sb_instagram.sbi_col_5 #sbi_images .sbi_item,#sb_instagram.sbi_col_6 #sbi_images .sbi_item,#sb_instagram.sbi_col_7 #sbi_images .sbi_item,#sb_instagram.sbi_col_8 #sbi_images .sbi_item,#sb_instagram.sbi_col_9 #sbi_images .sbi_item{width:100%}}#sb_instagram.sbi_no_js #sbi_images .sbi_item .sbi_photo_wrap{box-sizing:border-box;position:relative;overflow:hidden}#sb_instagram.sbi_no_js #sbi_images .sbi_item .sbi_photo_wrap:before{content:"";display:block;padding-top:100%;z-index:-300}#sb_instagram.sbi_no_js #sbi_images .sbi_item .sbi_photo{position:absolute;top:0;left:0;bottom:0;right:0}#sb_instagram.sbi_no_js #sbi_images .sbi_item.sbi_transition{opacity:1;max-height:640px}#sb_instagram.sbi_no_js .sbi_load_btn,#sb_instagram.sbi_no_js .sbi_photo img{display:none}#sb_instagram #sbi_images .sbi_js_load_disabled .sbi_imgLiquid_ready.sbi_photo{padding-bottom:0!important}
|
1 |
+
#sb_instagram{width:100%;margin:0 auto;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram:after{content:"";display:table;clear:both}#sb_instagram.sbi_fixed_height{overflow:hidden;overflow-y:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram #sbi_images{width:100%;float:left;line-height:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram .sbi_header_link{-webkit-box-shadow:none;box-shadow:none}#sb_instagram .sbi_header_link:hover{border:none}#sb_instagram #sbi_images .sbi_item{display:-moz-inline-stack;display:inline-block;float:left;vertical-align:top;zoom:1;max-height:1000px;padding:inherit!important;margin:0!important;text-decoration:none;opacity:1;overflow:hidden;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;-ms-transition:all .5s ease;transition:all .5s ease}#sb_instagram #sbi_images .sbi_item.sbi_transition{opacity:0;max-height:0}#sb_instagram.sbi_col_1 #sbi_images .sbi_item{width:100%}#sb_instagram.sbi_col_2 #sbi_images .sbi_item{width:50%}#sb_instagram.sbi_col_3 #sbi_images .sbi_item{width:33.33%}#sb_instagram.sbi_col_4 #sbi_images .sbi_item{width:25%}#sb_instagram.sbi_col_5 #sbi_images .sbi_item{width:20%}#sb_instagram.sbi_col_6 #sbi_images .sbi_item{width:16.66%}#sb_instagram.sbi_col_7 #sbi_images .sbi_item{width:14.28%}#sb_instagram.sbi_col_8 #sbi_images .sbi_item{width:12.5%}#sb_instagram.sbi_col_9 #sbi_images .sbi_item{width:11.11%}#sb_instagram.sbi_col_10 #sbi_images .sbi_item{width:10%}#sb_instagram.sbi_col_1.sbi_disable_mobile #sbi_images .sbi_item{width:100%}#sb_instagram.sbi_col_2.sbi_disable_mobile #sbi_images .sbi_item{width:50%}#sb_instagram.sbi_col_3.sbi_disable_mobile #sbi_images .sbi_item{width:33.33%}#sb_instagram.sbi_col_4.sbi_disable_mobile #sbi_images .sbi_item{width:25%}#sb_instagram.sbi_col_5.sbi_disable_mobile #sbi_images .sbi_item{width:20%}#sb_instagram.sbi_col_6.sbi_disable_mobile #sbi_images .sbi_item{width:16.66%}#sb_instagram.sbi_col_7.sbi_disable_mobile #sbi_images .sbi_item{width:14.28%}#sb_instagram.sbi_col_8.sbi_disable_mobile #sbi_images .sbi_item{width:12.5%}#sb_instagram.sbi_col_9.sbi_disable_mobile #sbi_images .sbi_item{width:11.11%}#sb_instagram.sbi_col_10.sbi_disable_mobile #sbi_images .sbi_item{width:10%}#sb_instagram .sbi_photo_wrap{position:relative}#sb_instagram .sbi_photo{display:block;text-decoration:none}#sb_instagram .sbi_photo img{width:100%;height:auto}#sb_instagram .sbi_no_js img{display:none}#sb_instagram a,#sb_instagram a:active,#sb_instagram a:focus,#sb_instagram a:hover{outline:0}#sb_instagram img{display:block;padding:0!important;margin:0!important;max-width:100%!important;opacity:1!important}#sb_instagram .sbi_link{display:none;position:absolute;bottom:0;right:0;width:100%;padding:10px 0;background:rgba(0,0,0,.5);text-align:center;color:#fff;font-size:12px;line-height:1.1}#sb_instagram .sbi_link a{padding:0 6px;text-decoration:none;color:#fff;font-size:12px;line-height:1.1;display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1}#sb_instagram .sbi_link .sbi_lightbox_link{padding-bottom:5px}#sb_instagram .sbi_link a:focus,#sb_instagram .sbi_link a:hover{text-decoration:underline}#sb_instagram .sbi_photo_wrap:focus .sbi_link,#sb_instagram .sbi_photo_wrap:hover .sbi_link{display:block}#sb_instagram svg:not(:root).svg-inline--fa{height:1em;display:inline-block}#sb_instagram .sbi_type_carousel .sbi_playbtn,#sb_instagram .sbi_type_carousel .svg-inline--fa.fa-play,#sb_instagram .sbi_type_video .sbi_playbtn,#sb_instagram .sbi_type_video .svg-inline--fa.fa-play,.sbi_type_carousel .fa-clone{display:block!important;position:absolute;z-index:1;color:#fff;color:rgba(255,255,255,.9);font-style:normal!important;text-shadow:0 0 8px rgba(0,0,0,.8)}#sb_instagram .sbi_type_carousel .sbi_playbtn,#sb_instagram .sbi_type_video .sbi_playbtn{z-index:2;top:50%;left:50%;margin-top:-24px;margin-left:-19px;padding:0;font-size:48px}#sb_instagram .sbi_type_carousel .fa-clone{right:12px;top:12px;font-size:24px;text-shadow:0 0 8px rgba(0,0,0,.3)}#sb_instagram .sbi_type_carousel .svg-inline--fa.fa-play,#sb_instagram .sbi_type_video .svg-inline--fa.fa-play,.sbi_type_carousel svg.fa-clone{-webkit-filter:drop-shadow( 0 0 2px rgba(0,0,0,.4) );filter:drop-shadow( 0 0 2px rgba(0,0,0,.4) )}#sb_instagram .sbi_loader{width:20px;height:20px;position:relative;top:50%;left:50%;margin:-10px 0 0 -10px;background-color:#000;background-color:rgba(0,0,0,.5);border-radius:100%;-webkit-animation:sbi-sk-scaleout 1s infinite ease-in-out;animation:sbi-sk-scaleout 1s infinite ease-in-out}#sb_instagram br{display:none}#sbi_load p{display:inline;padding:0;margin:0}#sb_instagram #sbi_load .sbi_loader{position:absolute;margin-top:-11px;background-color:#fff;opacity:1}@-webkit-keyframes sbi-sk-scaleout{0%{-webkit-transform:scale(0)}100%{-webkit-transform:scale(1);opacity:0}}@keyframes sbi-sk-scaleout{0%{-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0)}100%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);opacity:0}}#sb_instagram .fa-spin,#sbi_lightbox .fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}#sb_instagram .fa-pulse,#sbi_lightbox .fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.sbi-screenreader{text-indent:-9999px!important;display:block!important;width:0!important;height:0!important;line-height:0!important;text-align:left!important}#sb_instagram .sb_instagram_header{float:left;clear:both;margin:0 0 15px 0;padding:0;line-height:1.2;width:100%}#sb_instagram .sb_instagram_header a{float:left;display:block;text-decoration:none;transition:color .5s ease}.sbi_no_avatar .sbi_header_img{background:#333;color:#fff;width:50px;height:50px;position:relative}.sbi_no_avatar .sbi_header_hashtag_icon{display:block;color:#fff;opacity:.9;-webkit-transition:background .6s linear,color .6s linear;-moz-transition:background .6s linear,color .6s linear;-ms-transition:background .6s linear,color .6s linear;-o-transition:background .6s linear,color .6s linear;transition:background .6s linear,color .6s linear}.sbi_no_avatar:hover .sbi_header_hashtag_icon{display:block;opacity:1;-webkit-transition:background .2s linear,color .2s linear;-moz-transition:background .2s linear,color .2s linear;-ms-transition:background .2s linear,color .2s linear;-o-transition:background .2s linear,color .2s linear;transition:background .2s linear,color .2s linear}@media all and (min-width:480px){#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_img{width:80px;height:80px;border-radius:40px}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_img img{width:80px;height:80px;border-radius:40px}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text h3{font-size:20px}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio,#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio_info{font-size:14px}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio,#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio_info,#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text h3{margin-left:95px!important;line-height:1.4}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text h3{margin-right:-85px!important}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text .sbi_bio_info{margin-top:4px!important}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_text.sbi_no_bio h3{padding-top:20px!important}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_img{width:120px;height:120px;border-radius:60px}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_img img{width:120px;height:120px;border-radius:60px}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text h3{font-size:28px}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio,#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio_info{font-size:16px}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio,#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio_info,#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text h3{margin-left:140px!important;line-height:1.5}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text h3{margin-right:-120px!important}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text .sbi_bio_info{margin-top:12px!important}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_text.sbi_no_bio h3{padding-top:32px!important}}#sb_instagram .sb_instagram_header .sbi_header_img{float:left;position:relative;width:50px;margin:0 0 0 -100%!important;overflow:hidden;-moz-border-radius:40px;-webkit-border-radius:40px;border-radius:40px}#sb_instagram .sb_instagram_header .sbi_header_img img{float:left;margin:0!important;padding:0!important;border:none!important;-moz-border-radius:40px;-webkit-border-radius:40px;border-radius:40px}#sb_instagram .sb_instagram_header .sbi_header_img_hover{opacity:0;position:absolute;width:100%;top:0;bottom:0;left:0;text-align:center;color:#fff;background:rgba(0,0,0,.75)}#sb_instagram .sb_instagram_header .sbi_header_hashtag_icon .sbi_new_logo,#sb_instagram .sb_instagram_header .sbi_header_img_hover .sbi_new_logo{position:absolute;top:50%;left:50%;margin-top:-12px;margin-left:-12px;width:24px;height:24px;font-size:24px}#sb_instagram .sb_instagram_header.sbi_medium .sbi_header_hashtag_icon .sbi_new_logo,.sb_instagram_header.sbi_medium .sbi_header_hashtag_icon .sbi_new_logo{margin-top:-18px;margin-left:-18px;width:36px;height:36px;font-size:36px}#sb_instagram .sb_instagram_header.sbi_large .sbi_header_hashtag_icon .sbi_new_logo,.sb_instagram_header.sbi_large .sbi_header_hashtag_icon .sbi_new_logo{margin-top:-24px;margin-left:-24px;width:48px;height:48px;font-size:48px}#sb_instagram .sb_instagram_header .sbi_header_img_hover i{overflow:hidden;background:url(../img/small-logo.png) no-repeat 0 0}#sb_instagram .sb_instagram_header .sbi_header_img_hover{z-index:2;transition:opacity .4s ease-in-out}#sb_instagram .sb_instagram_header .sbi_fade_in{opacity:1;transition:opacity .2s ease-in-out}#sb_instagram .sb_instagram_header .sbi_header_img_hover{position:absolute;width:100%;top:0;bottom:0;left:0;text-align:center;color:#fff;background:rgba(0,0,0,.75);-moz-opacity:0;-khtml-opacity:0;opacity:0;border-radius:40px;transition:opacity .2s}#sb_instagram .sb_instagram_header a:focus .sbi_header_img_hover,#sb_instagram .sb_instagram_header a:hover .sbi_header_img_hover{opacity:1}#sb_instagram .sb_instagram_header .sbi_header_text{float:left;width:100%;padding-top:5px}#sb_instagram .sb_instagram_header a{text-decoration:none}#sb_instagram .sb_instagram_header .sbi_header_text .sbi_bio,#sb_instagram .sb_instagram_header .sbi_header_text h3{float:left;clear:both;width:auto;margin:0 0 0 60px!important;padding:0!important}#sb_instagram .sb_instagram_header h3{font-size:16px;line-height:1.3}#sb_instagram .sb_instagram_header p{font-size:13px;line-height:1.3;margin:0;padding:0}#sb_instagram p:empty{display:none}#sb_instagram .sb_instagram_header .sbi_header_text img.emoji{margin-right:3px!important}#sb_instagram .sb_instagram_header .sbi_header_text.sbi_no_bio h3{padding-top:9px!important}#sb_instagram .sb_instagram_header .sbi_header_text.sbi_no_bio .sbi_bio_info{clear:both}#sb_instagram #sbi_load{float:left;clear:both;width:100%;text-align:center}#sb_instagram #sbi_load .fa-spinner{display:none;position:absolute;top:50%;left:50%;margin:-8px 0 0 -7px;font-size:15px}#sb_instagram #sbi_load{opacity:1;transition:all .5s ease-in}#sb_instagram .sbi_load_btn .sbi_btn_text,#sb_instagram .sbi_load_btn .sbi_loader{opacity:1;transition:all .1s ease-in}#sb_instagram .sbi_hidden{opacity:0!important}#sb_instagram #sbi_load .sbi_load_btn,#sb_instagram .sbi_follow_btn a{display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1;padding:7px 14px;margin:5px auto 0 auto;background:#333;color:#eee;border:none;color:#fff;text-decoration:none;font-size:13px;line-height:1.5;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram #sbi_load .sbi_load_btn{position:relative}#sb_instagram .sbi_follow_btn{display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1;text-align:center}#sb_instagram .sbi_follow_btn.sbi_top{display:block;margin-bottom:5px}#sb_instagram .sbi_follow_btn a{background:#408bd1;color:#fff}#sb_instagram #sbi_load .sbi_load_btn,#sb_instagram .sbi_follow_btn a{transition:all .1s ease-in}#sb_instagram #sbi_load .sbi_load_btn:hover{outline:0;box-shadow:inset 0 0 20px 20px rgba(255,255,255,.25)}#sb_instagram .sbi_follow_btn a:focus,#sb_instagram .sbi_follow_btn a:hover{outline:0;box-shadow:inset 0 0 10px 20px #359dff}#sb_instagram #sbi_load .sbi_load_btn.sbi_custom:hover,#sb_instagram .sbi_follow_btn.sbi_custom a:focus,#sb_instagram .sbi_follow_btn.sbi_custom a:hover{box-shadow:inset 0 0 20px 20px rgba(255,255,255,.15)}#sb_instagram #sbi_load .sbi_load_btn:active,#sb_instagram .sbi_follow_btn a:active{box-shadow:inset 0 0 10px 20px rgba(0,0,0,.3)}#sb_instagram .sbi_follow_btn .fa,#sb_instagram .sbi_follow_btn svg{margin-bottom:-1px;margin-right:7px;font-size:15px}#sb_instagram .sbi_follow_btn svg{vertical-align:-.125em}#sb_instagram #sbi_load .sbi_follow_btn{margin-left:5px}#sb_instagram .sb_instagram_error{width:100%;text-align:center;line-height:1.4}#sbi_mod_error{display:none;border:1px solid #ddd;background:#eee;color:#333;margin:10px 0 0;padding:10px 15px;font-size:13px;text-align:center;clear:both;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px}#sbi_mod_error br{display:initial!important}#sbi_mod_error p{padding:5px 0!important;margin:0!important;line-height:1.3!important}#sbi_mod_error ol,#sbi_mod_error ul{padding:5px 0 5px 20px!important;margin:0!important}#sbi_mod_error li{padding:1px 0!important;margin:0!important}#sbi_mod_error span{font-size:12px}#sb_instagram.sbi_medium .sbi_photo_wrap .svg-inline--fa.fa-play,#sb_instagram.sbi_medium .sbi_playbtn{margin-top:-12px;margin-left:-9px;font-size:23px}#sb_instagram.sbi_medium .sbi_type_carousel .sbi_photo_wrap .fa-clone{right:8px;top:8px;font-size:18px}#sb_instagram.sbi_small .sbi_photo_wrap .svg-inline--fa.fa-play,#sb_instagram.sbi_small .sbi_playbtn{margin-top:-9px;margin-left:-7px;font-size:18px}#sb_instagram.sbi_small .sbi_type_carousel .sbi_photo_wrap .fa-clone{right:5px;top:5px;font-size:12px}@media all and (max-width:640px){#sb_instagram.sbi_col_3 #sbi_images .sbi_item,#sb_instagram.sbi_col_4 #sbi_images .sbi_item,#sb_instagram.sbi_col_5 #sbi_images .sbi_item,#sb_instagram.sbi_col_6 #sbi_images .sbi_item{width:50%}#sb_instagram.sbi_col_10 #sbi_images .sbi_item,#sb_instagram.sbi_col_7 #sbi_images .sbi_item,#sb_instagram.sbi_col_8 #sbi_images .sbi_item,#sb_instagram.sbi_col_9 #sbi_images .sbi_item{width:25%}#sb_instagram.sbi_width_resp{width:100%!important}}@media all and (max-width:480px){#sb_instagram.sbi_col_10 #sbi_images .sbi_item,#sb_instagram.sbi_col_3 #sbi_images .sbi_item,#sb_instagram.sbi_col_4 #sbi_images .sbi_item,#sb_instagram.sbi_col_5 #sbi_images .sbi_item,#sb_instagram.sbi_col_6 #sbi_images .sbi_item,#sb_instagram.sbi_col_7 #sbi_images .sbi_item,#sb_instagram.sbi_col_8 #sbi_images .sbi_item,#sb_instagram.sbi_col_9 #sbi_images .sbi_item{width:100%}}#sb_instagram.sbi_no_js #sbi_images .sbi_item .sbi_photo_wrap{box-sizing:border-box;position:relative;overflow:hidden}#sb_instagram.sbi_no_js #sbi_images .sbi_item .sbi_photo_wrap:before{content:"";display:block;padding-top:100%;z-index:-300}#sb_instagram.sbi_no_js #sbi_images .sbi_item .sbi_photo{position:absolute;top:0;left:0;bottom:0;right:0}#sb_instagram.sbi_no_js #sbi_images .sbi_item.sbi_transition{opacity:1;max-height:640px}#sb_instagram.sbi_no_js .sbi_load_btn,#sb_instagram.sbi_no_js .sbi_photo img{display:none}#sb_instagram #sbi_images .sbi_js_load_disabled .sbi_imgLiquid_ready.sbi_photo{padding-bottom:0!important}#sb_instagram #sbi_mod_error .sb_frontend_btn{display:inline-block;padding:6px 10px;background:#ddd;background:rgba(0,0,0,.1);text-decoration:none;border-radius:5px;margin-top:10px;color:#444}#sb_instagram #sbi_mod_error .sb_frontend_btn:hover{background:#ccc;background:rgba(0,0,0,.15)}#sb_instagram #sbi_mod_error .sb_frontend_btn .fa{margin-right:2px}
|
inc/admin/actions.php
CHANGED
@@ -21,7 +21,7 @@ function sb_instagram_admin_style() {
|
|
21 |
add_action( 'admin_enqueue_scripts', 'sb_instagram_admin_style' );
|
22 |
|
23 |
function sb_instagram_admin_scripts() {
|
24 |
-
wp_enqueue_script( 'sb_instagram_admin_js', SBI_PLUGIN_URL . 'js/sb-instagram-admin.js', array(), SBIVER );
|
25 |
wp_localize_script( 'sb_instagram_admin_js', 'sbiA', array(
|
26 |
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
27 |
'sbi_nonce' => wp_create_nonce( 'sbi_nonce' )
|
@@ -192,6 +192,8 @@ function sbi_connect_business_accounts() {
|
|
192 |
} else {
|
193 |
$connected_accounts[ $user_id ]['local_avatar'] = false;
|
194 |
}
|
|
|
|
|
195 |
}
|
196 |
|
197 |
$options['connected_accounts'] = $connected_accounts;
|
@@ -239,21 +241,106 @@ function sbi_test_token() {
|
|
239 |
|
240 |
$test_connection_data = sbi_account_data_for_token( $access_token );
|
241 |
} else if (! empty( $account_id ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
$url = 'https://graph.facebook.com/'.$account_id.'?fields=biography,id,username,website,followers_count,media_count,profile_picture_url,name&access_token='.sbi_maybe_clean( $access_token );
|
243 |
$json = json_decode( sbi_business_account_request( $url, array( 'access_token' => $access_token ) ), true );
|
244 |
-
|
245 |
-
|
246 |
-
$
|
247 |
'access_token' => $access_token,
|
248 |
-
'
|
249 |
-
'
|
250 |
-
'type' => 'business',
|
251 |
-
'is_valid' => true,
|
252 |
-
'last_checked' => time(),
|
253 |
-
'profile_picture' => $json['profile_picture_url']
|
254 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
}
|
256 |
|
|
|
|
|
257 |
delete_transient( SBI_USE_BACKUP_PREFIX . 'sbi_' . $json['id'] );
|
258 |
|
259 |
}
|
@@ -386,20 +473,13 @@ function sbi_account_data_for_token( $access_token ) {
|
|
386 |
} elseif ( isset( $data->error_type ) && $data->error_type === 'OAuthRateLimitException' ) {
|
387 |
$return['error_message'] = 'This account\'s access token is currently over the rate limit. Try removing this access token from all feeds and wait an hour before reconnecting.';
|
388 |
} else {
|
389 |
-
|
390 |
-
$return['error_message'] = '';
|
391 |
-
|
392 |
-
if ( isset( $result->errors ) ) {
|
393 |
-
foreach ( $result->errors as $key => $item ) {
|
394 |
-
$return['error_message'] .= ' '.$key . ' - ' . $item[0] . ' |';
|
395 |
-
}
|
396 |
-
}
|
397 |
-
} elseif ( isset( $data->error_message ) ) {
|
398 |
-
$return['error_message'] = $data->error_message;
|
399 |
-
}
|
400 |
-
|
401 |
}
|
402 |
|
|
|
|
|
|
|
|
|
403 |
return $return;
|
404 |
}
|
405 |
|
@@ -408,7 +488,13 @@ function sbi_get_connected_accounts_data( $sb_instagram_at ) {
|
|
408 |
$return = array();
|
409 |
$return['connected_accounts'] = isset( $sbi_options['connected_accounts'] ) ? $sbi_options['connected_accounts'] : array();
|
410 |
|
411 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
412 |
$tokens = explode(',', $sb_instagram_at );
|
413 |
$user_ids = array();
|
414 |
|
@@ -441,6 +527,151 @@ function sbi_get_connected_accounts_data( $sb_instagram_at ) {
|
|
441 |
return $return;
|
442 |
}
|
443 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
function sbi_business_account_request( $url, $account, $remove_access_token = true ) {
|
445 |
$args = array(
|
446 |
'timeout' => 60,
|
@@ -468,6 +699,13 @@ function sbi_after_connection() {
|
|
468 |
}
|
469 |
add_action( 'wp_ajax_sbi_after_connection', 'sbi_after_connection' );
|
470 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
471 |
function sbi_clear_backups() {
|
472 |
$nonce = isset( $_POST['sbi_nonce'] ) ? sanitize_text_field( $_POST['sbi_nonce'] ) : '';
|
473 |
|
@@ -568,6 +806,99 @@ function sbi_maybe_add_ajax_test_error() {
|
|
568 |
}
|
569 |
add_action( 'admin_init', 'sbi_maybe_add_ajax_test_error' );
|
570 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
571 |
function sbi_get_current_time() {
|
572 |
$current_time = time();
|
573 |
|
21 |
add_action( 'admin_enqueue_scripts', 'sb_instagram_admin_style' );
|
22 |
|
23 |
function sb_instagram_admin_scripts() {
|
24 |
+
wp_enqueue_script( 'sb_instagram_admin_js', SBI_PLUGIN_URL . 'js/sb-instagram-admin-2-2.js', array(), SBIVER );
|
25 |
wp_localize_script( 'sb_instagram_admin_js', 'sbiA', array(
|
26 |
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
27 |
'sbi_nonce' => wp_create_nonce( 'sbi_nonce' )
|
192 |
} else {
|
193 |
$connected_accounts[ $user_id ]['local_avatar'] = false;
|
194 |
}
|
195 |
+
|
196 |
+
delete_transient( SBI_USE_BACKUP_PREFIX . 'sbi_' . $user_id );
|
197 |
}
|
198 |
|
199 |
$options['connected_accounts'] = $connected_accounts;
|
241 |
|
242 |
$test_connection_data = sbi_account_data_for_token( $access_token );
|
243 |
} else if (! empty( $account_id ) ) {
|
244 |
+
|
245 |
+
if ( sbi_code_check( $access_token ) ) {
|
246 |
+
$data = array(
|
247 |
+
'access_token' => $access_token,
|
248 |
+
'user_id' => $account_id,
|
249 |
+
'type' => 'basic'
|
250 |
+
);
|
251 |
+
$basic_account_attempt = new SB_Instagram_API_Connect( $data, 'header', array() );
|
252 |
+
$basic_account_attempt->connect();
|
253 |
+
|
254 |
+
if ( !$basic_account_attempt->is_wp_error() && ! $basic_account_attempt->is_instagram_error() ) {
|
255 |
+
$new_data = $basic_account_attempt->get_data();
|
256 |
+
|
257 |
+
$basic_account_access_token_connect = new SB_Instagram_API_Connect( $data, 'access_token', array() );
|
258 |
+
$basic_account_access_token_connect->connect();
|
259 |
+
if ( !$basic_account_access_token_connect->is_wp_error() && ! $basic_account_access_token_connect->is_instagram_error() ) {
|
260 |
+
|
261 |
+
$token_data = $basic_account_access_token_connect->get_data();
|
262 |
+
$expires_in = $token_data['expires_in'];
|
263 |
+
$expires_timestamp = time() + $expires_in;
|
264 |
+
|
265 |
+
$new_connected_account = array(
|
266 |
+
'access_token' => $access_token,
|
267 |
+
'account_type' => $new_data['account_type'],
|
268 |
+
'user_id' => $new_data['id'],
|
269 |
+
'username' => $new_data['username'],
|
270 |
+
'expires_timestamp' => $expires_timestamp,
|
271 |
+
'type' => 'basic'
|
272 |
+
);
|
273 |
+
|
274 |
+
$updated_options = sbi_connect_basic_account( $new_connected_account );
|
275 |
+
|
276 |
+
echo wp_json_encode( $updated_options['connected_accounts'][ $new_data['id'] ] );
|
277 |
+
die();
|
278 |
+
|
279 |
+
}
|
280 |
+
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
$url = 'https://graph.facebook.com/'.$account_id.'?fields=biography,id,username,website,followers_count,media_count,profile_picture_url,name&access_token='.sbi_maybe_clean( $access_token );
|
285 |
$json = json_decode( sbi_business_account_request( $url, array( 'access_token' => $access_token ) ), true );
|
286 |
+
|
287 |
+
if ( isset( $json['error'] ) && $json['error']['type'] === 'OAuthException' ) {
|
288 |
+
$data = array(
|
289 |
'access_token' => $access_token,
|
290 |
+
'user_id' => $account_id,
|
291 |
+
'type' => 'basic'
|
|
|
|
|
|
|
|
|
292 |
);
|
293 |
+
$basic_account_attempt = new SB_Instagram_API_Connect( $data, 'header', array() );
|
294 |
+
$basic_account_attempt->connect();
|
295 |
+
|
296 |
+
if ( !$basic_account_attempt->is_wp_error() && ! $basic_account_attempt->is_instagram_error() ) {
|
297 |
+
$new_data = $basic_account_attempt->get_data();
|
298 |
+
|
299 |
+
$basic_account_access_token_connect = new SB_Instagram_API_Connect( $data, 'access_token', array() );
|
300 |
+
$basic_account_access_token_connect->connect();
|
301 |
+
if ( !$basic_account_access_token_connect->is_wp_error() && ! $basic_account_access_token_connect->is_instagram_error() ) {
|
302 |
+
|
303 |
+
$token_data = $basic_account_access_token_connect->get_data();
|
304 |
+
$expires_in = $token_data['expires_in'];
|
305 |
+
$expires_timestamp = time() + $expires_in;
|
306 |
+
|
307 |
+
$new_connected_account = array(
|
308 |
+
'access_token' => $access_token,
|
309 |
+
'account_type' => $new_data['account_type'],
|
310 |
+
'user_id' => $new_data['id'],
|
311 |
+
'username' => $new_data['username'],
|
312 |
+
'expires_timestamp' => $expires_timestamp,
|
313 |
+
'type' => 'basic'
|
314 |
+
);
|
315 |
+
|
316 |
+
$updated_options = sbi_connect_basic_account( $new_connected_account );
|
317 |
+
|
318 |
+
echo wp_json_encode( $updated_options['connected_accounts'][ $new_data['id'] ] );
|
319 |
+
die();
|
320 |
+
|
321 |
+
}
|
322 |
+
|
323 |
+
}
|
324 |
+
|
325 |
+
die();
|
326 |
+
|
327 |
+
} else {
|
328 |
+
if ( isset( $json['id'] ) ) {
|
329 |
+
$new_user_id = $json['id'];
|
330 |
+
$test_connection_data = array(
|
331 |
+
'access_token' => $access_token,
|
332 |
+
'id' => $json['id'],
|
333 |
+
'username' => $json['username'],
|
334 |
+
'type' => 'business',
|
335 |
+
'is_valid' => true,
|
336 |
+
'last_checked' => time(),
|
337 |
+
'profile_picture' => $json['profile_picture_url']
|
338 |
+
);
|
339 |
+
}
|
340 |
}
|
341 |
|
342 |
+
|
343 |
+
|
344 |
delete_transient( SBI_USE_BACKUP_PREFIX . 'sbi_' . $json['id'] );
|
345 |
|
346 |
}
|
473 |
} elseif ( isset( $data->error_type ) && $data->error_type === 'OAuthRateLimitException' ) {
|
474 |
$return['error_message'] = 'This account\'s access token is currently over the rate limit. Try removing this access token from all feeds and wait an hour before reconnecting.';
|
475 |
} else {
|
476 |
+
$return = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
477 |
}
|
478 |
|
479 |
+
$sbi_options = get_option( 'sb_instagram_settings', array() );
|
480 |
+
$sbi_options['sb_instagram_at'] = '';
|
481 |
+
update_option( 'sb_instagram_settings', $sbi_options );
|
482 |
+
|
483 |
return $return;
|
484 |
}
|
485 |
|
488 |
$return = array();
|
489 |
$return['connected_accounts'] = isset( $sbi_options['connected_accounts'] ) ? $sbi_options['connected_accounts'] : array();
|
490 |
|
491 |
+
if ( ! empty( $return['connected_accounts'] ) ) {
|
492 |
+
$return['access_token'] = '';
|
493 |
+
} else {
|
494 |
+
$return['access_token'] = $sb_instagram_at;
|
495 |
+
}
|
496 |
+
|
497 |
+
if ( ! sbi_is_after_deprecation_deadline() && empty( $connected_accounts ) && ! empty( $sb_instagram_at ) ) {
|
498 |
$tokens = explode(',', $sb_instagram_at );
|
499 |
$user_ids = array();
|
500 |
|
527 |
return $return;
|
528 |
}
|
529 |
|
530 |
+
function sbi_connect_basic_account( $new_account_details ) {
|
531 |
+
|
532 |
+
$options = sbi_get_database_settings();
|
533 |
+
$connected_accounts = isset( $options['connected_accounts'] ) ? $options['connected_accounts'] : array();
|
534 |
+
|
535 |
+
$accounts_to_save = array();
|
536 |
+
$old_account_user_id = '';
|
537 |
+
$ids_to_save = array();
|
538 |
+
$user_ids = is_array( $options[ 'sb_instagram_user_id' ] ) ? $options[ 'sb_instagram_user_id' ] : explode( ',', str_replace( ' ', '', $options[ 'sb_instagram_user_id' ] ) );
|
539 |
+
|
540 |
+
$profile_picture = '';
|
541 |
+
|
542 |
+
// do not connect as a basic display account if already connected as a business account
|
543 |
+
if ( isset( $connected_accounts[ $new_account_details['user_id'] ] )
|
544 |
+
&& isset( $connected_accounts[ $new_account_details['user_id'] ]['type'] )
|
545 |
+
&& $connected_accounts[ $new_account_details['user_id'] ]['type'] === 'business' ) {
|
546 |
+
return $options;
|
547 |
+
}
|
548 |
+
|
549 |
+
foreach ( $connected_accounts as $account ) {
|
550 |
+
$account_type = isset( $account['type'] ) ? $account['type'] : 'personal';
|
551 |
+
if ( ($account['username'] !== $new_account_details['username'])
|
552 |
+
|| $account_type === 'business' ) {
|
553 |
+
$accounts_to_save[ $account['user_id'] ] = $account;
|
554 |
+
} else {
|
555 |
+
$old_account_user_id = $account['user_id'];
|
556 |
+
$profile_picture = isset( $account['profile_picture'] ) ? $account['profile_picture'] : '';
|
557 |
+
}
|
558 |
+
}
|
559 |
+
|
560 |
+
foreach ( $user_ids as $id ) {
|
561 |
+
if ( $id === $old_account_user_id ) {
|
562 |
+
$ids_to_save[] = $new_account_details['user_id'];
|
563 |
+
} else {
|
564 |
+
$ids_to_save[] = $id;
|
565 |
+
}
|
566 |
+
}
|
567 |
+
|
568 |
+
$accounts_to_save[ $new_account_details['user_id'] ] = array(
|
569 |
+
'access_token' => sbi_fixer( $new_account_details['access_token'] ),
|
570 |
+
'user_id' => $new_account_details['user_id'],
|
571 |
+
'username' => $new_account_details['username'],
|
572 |
+
'is_valid' => true,
|
573 |
+
'last_checked' => time(),
|
574 |
+
'expires_timestamp' => $new_account_details['expires_timestamp'],
|
575 |
+
'profile_picture' => $profile_picture,
|
576 |
+
'account_type' => strtolower( $new_account_details['account_type'] ),
|
577 |
+
'type' => 'basic',
|
578 |
+
);
|
579 |
+
|
580 |
+
if ( ! empty( $old_account_user_id ) && $old_account_user_id !== $new_account_details['user_id'] ) {
|
581 |
+
$accounts_to_save[ $new_account_details['user_id'] ]['old_user_id'] = $old_account_user_id;
|
582 |
+
|
583 |
+
// get last saved header data
|
584 |
+
$fuzzy_matches = sbi_fuzzy_matching_header_data( $old_account_user_id );
|
585 |
+
if ( ! empty( $fuzzy_matches[0] ) ) {
|
586 |
+
$header_data = sbi_find_matching_data_from_results( $fuzzy_matches, $old_account_user_id );
|
587 |
+
$bio = SB_Instagram_Parse::get_bio( $header_data );
|
588 |
+
$accounts_to_save[ $new_account_details['user_id'] ]['bio'] = $bio;
|
589 |
+
}
|
590 |
+
|
591 |
+
}
|
592 |
+
|
593 |
+
if ( ! empty( $profile_picture ) && !$options['sb_instagram_disable_resize'] ) {
|
594 |
+
if ( sbi_create_local_avatar( $new_account_details['username'], $profile_picture ) ) {
|
595 |
+
$accounts_to_save[ $new_account_details['user_id'] ]['local_avatar'] = true;
|
596 |
+
}
|
597 |
+
} else {
|
598 |
+
$accounts_to_save[ $new_account_details['user_id'] ]['local_avatar'] = false;
|
599 |
+
}
|
600 |
+
|
601 |
+
delete_transient( SBI_USE_BACKUP_PREFIX . 'sbi_' . $new_account_details['user_id'] );
|
602 |
+
|
603 |
+
$options['connected_accounts'] = $accounts_to_save;
|
604 |
+
$options['sb_instagram_user_id'] = $ids_to_save;
|
605 |
+
|
606 |
+
update_option( 'sb_instagram_settings', $options );
|
607 |
+
return $options;
|
608 |
+
}
|
609 |
+
|
610 |
+
function sbi_fuzzy_matching_header_data( $user_id ) {
|
611 |
+
|
612 |
+
if ( empty( $user_id ) || strlen( $user_id ) < 4 ) {
|
613 |
+
return array();
|
614 |
+
}
|
615 |
+
global $wpdb;
|
616 |
+
$escaped_id = esc_sql( $user_id );
|
617 |
+
|
618 |
+
$values = $wpdb->get_results( "
|
619 |
+
SELECT option_value
|
620 |
+
FROM $wpdb->options
|
621 |
+
WHERE option_name LIKE ('%!sbi\_header\_".$escaped_id."%')
|
622 |
+
LIMIT 10", ARRAY_A );
|
623 |
+
|
624 |
+
$regular_values = $wpdb->get_results( "
|
625 |
+
SELECT option_value
|
626 |
+
FROM $wpdb->options
|
627 |
+
WHERE option_name LIKE ('%sbi\_header\_".$escaped_id."%')
|
628 |
+
LIMIT 10", ARRAY_A );
|
629 |
+
|
630 |
+
$values = array_merge( $values, $regular_values );
|
631 |
+
|
632 |
+
return $values;
|
633 |
+
}
|
634 |
+
|
635 |
+
function sbi_find_matching_data_from_results( $results, $user_id ) {
|
636 |
+
|
637 |
+
$match = array();
|
638 |
+
|
639 |
+
$i = 0;
|
640 |
+
|
641 |
+
while( empty( $match ) && isset( $results[ $i ] ) ) {
|
642 |
+
if ( ! empty( $results[ $i ] ) ) {
|
643 |
+
$header_data = json_decode( $results[ $i ]['option_value'], true );
|
644 |
+
if ( isset( $header_data['id'] ) && (string)$header_data['id'] === (string)$user_id ) {
|
645 |
+
$match = $header_data;
|
646 |
+
}
|
647 |
+
}
|
648 |
+
$i++;
|
649 |
+
}
|
650 |
+
|
651 |
+
return $match;
|
652 |
+
}
|
653 |
+
|
654 |
+
function sbi_matches_existing_personal( $new_account_details ) {
|
655 |
+
|
656 |
+
$options = sbi_get_database_settings();
|
657 |
+
$connected_accounts = isset( $options['connected_accounts'] ) ? $options['connected_accounts'] : array();
|
658 |
+
|
659 |
+
$matches_one_account = false;
|
660 |
+
$accounts_to_save = array();
|
661 |
+
foreach ( $connected_accounts as $account ) {
|
662 |
+
$account_type = isset( $account['type'] ) ? $account['type'] : 'personal';
|
663 |
+
if ( ($account_type === 'personal' || $account_type === 'basic')
|
664 |
+
&& $account['username'] == $new_account_details['username'] ) {
|
665 |
+
$matches_one_account = true;
|
666 |
+
|
667 |
+
|
668 |
+
}
|
669 |
+
}
|
670 |
+
|
671 |
+
return $matches_one_account;
|
672 |
+
|
673 |
+
}
|
674 |
+
|
675 |
function sbi_business_account_request( $url, $account, $remove_access_token = true ) {
|
676 |
$args = array(
|
677 |
'timeout' => 60,
|
699 |
}
|
700 |
add_action( 'wp_ajax_sbi_after_connection', 'sbi_after_connection' );
|
701 |
|
702 |
+
function sbi_account_type_display( $type ) {
|
703 |
+
if ( $type === 'basic' ) {
|
704 |
+
return 'personal (new API)';
|
705 |
+
}
|
706 |
+
return $type;
|
707 |
+
}
|
708 |
+
|
709 |
function sbi_clear_backups() {
|
710 |
$nonce = isset( $_POST['sbi_nonce'] ) ? sanitize_text_field( $_POST['sbi_nonce'] ) : '';
|
711 |
|
806 |
}
|
807 |
add_action( 'admin_init', 'sbi_maybe_add_ajax_test_error' );
|
808 |
|
809 |
+
function sbi_get_user_names_of_personal_accounts_not_also_already_updated() {
|
810 |
+
$sbi_options = get_option( 'sb_instagram_settings', array() );
|
811 |
+
$users_in_personal_accounts = array();
|
812 |
+
$non_personal_account_users = array();
|
813 |
+
|
814 |
+
$connected_accounts = isset( $sbi_options['connected_accounts'] ) ? $sbi_options['connected_accounts'] : array();
|
815 |
+
|
816 |
+
if ( ! empty( $connected_accounts ) ) {
|
817 |
+
|
818 |
+
foreach ( $connected_accounts as $account ) {
|
819 |
+
$account_type = isset( $account['type'] ) ? $account['type'] : 'personal';
|
820 |
+
|
821 |
+
if ( $account_type === 'personal' ) {
|
822 |
+
$users_in_personal_accounts[] = $account['username'];
|
823 |
+
} else {
|
824 |
+
$non_personal_account_users[] = $account['username'];
|
825 |
+
}
|
826 |
+
|
827 |
+
}
|
828 |
+
|
829 |
+
if ( ! empty( $users_in_personal_accounts ) ) {
|
830 |
+
$user_accounts_that_need_updating = array();
|
831 |
+
foreach ( $users_in_personal_accounts as $personal_user ) {
|
832 |
+
if ( ! in_array( $personal_user, $non_personal_account_users, true ) && $personal_user !== '' ) {
|
833 |
+
$user_accounts_that_need_updating[] = $personal_user;
|
834 |
+
}
|
835 |
+
}
|
836 |
+
|
837 |
+
return $user_accounts_that_need_updating;
|
838 |
+
}
|
839 |
+
} elseif ( empty( $connected_accounts ) && ! empty( $sbi_options['sb_instagram_at'] ) ) {
|
840 |
+
return array( 'your Instagram feed');
|
841 |
+
}
|
842 |
+
|
843 |
+
return array();
|
844 |
+
}
|
845 |
+
|
846 |
+
function sbi_reconnect_accounts_notice() {
|
847 |
+
if( ! current_user_can( 'manage_options' ) ) return;
|
848 |
+
|
849 |
+
$should_show_link = ! isset( $_GET['page'] ) || $_GET['page'] !== 'sb-instagram-feed';
|
850 |
+
$personal_accounts_that_need_updating = sbi_get_user_names_of_personal_accounts_not_also_already_updated();
|
851 |
+
if ( empty( $personal_accounts_that_need_updating ) ) {
|
852 |
+
return;
|
853 |
+
} else {
|
854 |
+
$total = count( $personal_accounts_that_need_updating );
|
855 |
+
if ( $total > 1 ) {
|
856 |
+
$user_string = '';
|
857 |
+
$i = 0;
|
858 |
+
|
859 |
+
foreach ( $personal_accounts_that_need_updating as $username ) {
|
860 |
+
if ( ($i + 1) === $total ) {
|
861 |
+
$user_string .= ' and ' . $username;
|
862 |
+
} else {
|
863 |
+
if ( $i !== 0 ) {
|
864 |
+
$user_string .= ', ' . $username;
|
865 |
+
} else {
|
866 |
+
$user_string .= $username;
|
867 |
+
}
|
868 |
+
}
|
869 |
+
$i++;
|
870 |
+
}
|
871 |
+
} else {
|
872 |
+
$user_string = $personal_accounts_that_need_updating[0];
|
873 |
+
}
|
874 |
+
|
875 |
+
if ( sbi_is_after_deprecation_deadline() ) {
|
876 |
+
$notice_class = 'notice-error';
|
877 |
+
$error = '<p><b>' . sprintf( __( 'Error: Instagram Feed plugin - account for %s needs to be reconnected.', 'instagram-feed' ), '<em>'.$user_string.'</em>' ) . '</b><br>' . __( 'Due to recent Instagram platform changes some Instagram accounts will need to be reconnected in the plugin in order for them to continue updating.', 'instagram-feed' );
|
878 |
+
} else {
|
879 |
+
$notice_class = 'notice-warning';
|
880 |
+
$error = '<p><b>' . sprintf( __( 'Warning: Instagram Feed plugin - account for %s needs to be reconnected.', 'instagram-feed' ), '<em>'.$user_string.'</em>' ) . '</b><br>' . __( 'Due to Instagram platform changes on March 2, 2020, some Instagram accounts will need to be reconnected in the plugin to avoid disruption to your feeds.', 'instagram-feed' );
|
881 |
+
}
|
882 |
+
if( !$should_show_link ) $error .= __( ' Use the big blue button below to reconnect your account.', 'instagram-feed' );
|
883 |
+
}
|
884 |
+
$url = admin_url( '?page=sb-instagram-feed' );
|
885 |
+
|
886 |
+
?>
|
887 |
+
<div class="notice <?php echo $notice_class; ?> is-dismissible">
|
888 |
+
<?php echo $error; ?>
|
889 |
+
<p>
|
890 |
+
<?php if ( $should_show_link ) : ?>
|
891 |
+
<a href="<?php echo $url; ?>" class="button-primary" style="margin-right:10px;"><i class="fa fa-instagram" aria-hidden="true"></i> Reconnect on Settings Page</a>
|
892 |
+
<?php endif; ?>
|
893 |
+
<a href="https://smashballoon.com/instagram-api-changes-march-2-2020/" target="_blank" rel="noopener">See more details</a>
|
894 |
+
</p>
|
895 |
+
</div>
|
896 |
+
|
897 |
+
<?php
|
898 |
+
|
899 |
+
}
|
900 |
+
add_action( 'admin_notices', 'sbi_reconnect_accounts_notice' );
|
901 |
+
|
902 |
function sbi_get_current_time() {
|
903 |
$current_time = time();
|
904 |
|
inc/admin/main.php
CHANGED
@@ -68,6 +68,8 @@ function sb_instagram_settings_page() {
|
|
68 |
'sb_instagram_show_header' => true,
|
69 |
'sb_instagram_header_size' => 'small',
|
70 |
'sb_instagram_header_color' => '',
|
|
|
|
|
71 |
//Follow button
|
72 |
'sb_instagram_show_follow_btn' => true,
|
73 |
'sb_instagram_folow_btn_background' => '',
|
@@ -86,7 +88,6 @@ function sb_instagram_settings_page() {
|
|
86 |
'sb_instagram_minnum' => 0,
|
87 |
'disable_js_image_loading' => false,
|
88 |
'enqueue_js_in_head' => false,
|
89 |
-
'enqueue_css_in_shortcode' => false,
|
90 |
'sb_instagram_disable_mob_swipe' => false,
|
91 |
'sbi_font_method' => 'svg',
|
92 |
'sb_instagram_disable_awesome' => false,
|
@@ -136,6 +137,8 @@ function sb_instagram_settings_page() {
|
|
136 |
$sb_instagram_show_header = $options[ 'sb_instagram_show_header' ];
|
137 |
$sb_instagram_header_size = $options[ 'sb_instagram_header_size' ];
|
138 |
$sb_instagram_show_bio = isset( $options[ 'sb_instagram_show_bio' ] ) ? $options[ 'sb_instagram_show_bio' ] : true;
|
|
|
|
|
139 |
$sb_instagram_header_color = $options[ 'sb_instagram_header_color' ];
|
140 |
//Follow button
|
141 |
$sb_instagram_show_follow_btn = $options[ 'sb_instagram_show_follow_btn' ];
|
@@ -273,6 +276,8 @@ function sb_instagram_settings_page() {
|
|
273 |
//Header
|
274 |
isset($_POST[ 'sb_instagram_show_header' ]) ? $sb_instagram_show_header = sanitize_text_field( $_POST[ 'sb_instagram_show_header' ] ) : $sb_instagram_show_header = '';
|
275 |
isset($_POST[ 'sb_instagram_show_bio' ]) ? $sb_instagram_show_bio = sanitize_text_field( $_POST[ 'sb_instagram_show_bio' ] ) : $sb_instagram_show_bio = '';
|
|
|
|
|
276 |
if (isset($_POST[ 'sb_instagram_header_size' ]) ) $sb_instagram_header_size = $_POST[ 'sb_instagram_header_size' ];
|
277 |
|
278 |
$sb_instagram_header_color = sanitize_text_field( $_POST[ 'sb_instagram_header_color' ] );
|
@@ -319,6 +324,10 @@ function sb_instagram_settings_page() {
|
|
319 |
$options[ 'sb_instagram_show_header' ] = $sb_instagram_show_header;
|
320 |
$options[ 'sb_instagram_header_size' ] = $sb_instagram_header_size;
|
321 |
$options[ 'sb_instagram_show_bio' ] = $sb_instagram_show_bio;
|
|
|
|
|
|
|
|
|
322 |
$options[ 'sb_instagram_header_color' ] = $sb_instagram_header_color;
|
323 |
//Follow button
|
324 |
$options[ 'sb_instagram_show_follow_btn' ] = $sb_instagram_show_follow_btn;
|
@@ -410,8 +419,210 @@ function sb_instagram_settings_page() {
|
|
410 |
<div id="header">
|
411 |
<h1><?php _e( 'Instagram Feed', 'instagram-feed' ); ?></h1>
|
412 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
|
414 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
415 |
<input type="hidden" name="<?php echo $sb_instagram_settings_hidden_field; ?>" value="Y">
|
416 |
<?php wp_nonce_field( 'sb_instagram_saving_settings', 'sb_instagram_settings_nonce' ); ?>
|
417 |
|
@@ -431,132 +642,137 @@ function sb_instagram_settings_page() {
|
|
431 |
<h3><?php _e( 'Configure', 'instagram-feed' ); ?></h3>
|
432 |
|
433 |
<div id="sbi_config">
|
434 |
-
<a data-
|
|
|
435 |
data-old-api="https://instagram.com/oauth/authorize/?client_id=3a81a9fa2a064751b8c31385b91cc25c&scope=basic&redirect_uri=https://smashballoon.com/instagram-feed/instagram-token-plugin/?return_uri=<?php echo admin_url('admin.php?page=sb-instagram-feed'); ?>&response_type=token&state=<?php echo admin_url('admin.php?page-sb-instagram-feed'); ?>&hl=en"
|
436 |
href="https://instagram.com/oauth/authorize/?client_id=3a81a9fa2a064751b8c31385b91cc25c&scope=basic&redirect_uri=https://smashballoon.com/instagram-feed/instagram-token-plugin/?return_uri=<?php echo admin_url('admin.php?page=sb-instagram-feed'); ?>&response_type=token&state=<?php echo admin_url('admin.php?page-sb-instagram-feed'); ?>&hl=en" class="sbi_admin_btn"><i class="fa fa-user-plus" aria-hidden="true" style="font-size: 20px;"></i> <?php _e('Connect an Instagram Account', 'instagram-feed' ); ?></a>
|
437 |
|
438 |
-
<!--<a href="https://instagram.com/oauth/authorize/?client_id=3a81a9fa2a064751b8c31385b91cc25c&scope=basic
|
439 |
-->
|
440 |
<a href="https://smashballoon.com/instagram-feed/token/" target="_blank" style="position: relative; top: 14px; left: 15px;"><?php _e('Button not working?', 'instagram-feed'); ?></a>
|
441 |
</div>
|
442 |
|
443 |
<!-- Old Access Token -->
|
444 |
<input name="sb_instagram_at" id="sb_instagram_at" type="hidden" value="<?php echo esc_attr( $sb_instagram_at ); ?>" size="80" maxlength="100" placeholder="Click button above to get your Access Token" />
|
445 |
-
<?php
|
446 |
-
|
447 |
-
$returned_data = sbi_get_connected_accounts_data( $sb_instagram_at );
|
448 |
-
$connected_accounts = $returned_data['connected_accounts'];
|
449 |
-
$user_feeds_returned = isset( $returned_data['user_ids'] ) ? $returned_data['user_ids'] : false;
|
450 |
-
if ( $user_feeds_returned ) {
|
451 |
-
$user_feed_ids = $user_feeds_returned;
|
452 |
-
} else {
|
453 |
-
$user_feed_ids = ! is_array( $sb_instagram_user_id ) ? explode( ',', $sb_instagram_user_id ) : $sb_instagram_user_id;
|
454 |
-
}
|
455 |
-
$expired_tokens = get_option( 'sb_expired_tokens', array() );
|
456 |
-
?>
|
457 |
|
458 |
<tr valign="top">
|
459 |
<th scope="row"><label><?php _e( 'Instagram Accounts', 'instagram-feed' ); ?></label><span style="font-weight:normal; font-style:italic; font-size: 12px; display: block;"><?php _e('Use the button above to connect an Instagram account', 'instagram-feed'); ?></span></th>
|
460 |
<td class="sbi_connected_accounts_wrap">
|
461 |
<?php if ( empty( $connected_accounts ) ) : ?>
|
462 |
<p class="sbi_no_accounts"><?php _e( 'No Instagram accounts connected. Click the button above to connect an account.', 'instagram-feed' ); ?></p><br />
|
463 |
-
<?php else:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
464 |
<?php foreach ( $connected_accounts as $account ) :
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
|
|
|
|
|
|
|
|
491 |
}
|
492 |
|
493 |
-
|
494 |
-
|
495 |
-
$in_user_feed = in_array( $account['user_id'], $user_feed_ids, true );
|
496 |
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
<div class="
|
501 |
-
<span
|
502 |
</div>
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
</div>
|
513 |
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
<a href="JavaScript:void(0);" class="sbi_remove_from_user_feed button-primary"><i class="fa fa-minus-circle" aria-hidden="true"></i><?php _e( 'Remove from Primary Feed', 'instagram-feed' ); ?></a>
|
519 |
-
<?php endif; ?>
|
520 |
-
<a class="sbi_ca_token_shortcode button-secondary" href="JavaScript:void(0);"><i class="fa fa-chevron-circle-right" aria-hidden="true"></i><?php _e( 'Add to another Feed', 'instagram-feed' ); ?></a>
|
521 |
-
<p class="sbi_ca_show_token"><input type="checkbox" id="sbi_ca_show_token_<?php echo esc_attr( $account['user_id'] ); ?>" /><label for="sbi_ca_show_token_<?php echo esc_attr( $account['user_id'] ); ?>"><?php _e('Show Access Token', 'instagram-feed'); ?></label></p>
|
522 |
|
523 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
|
525 |
-
|
526 |
|
527 |
-
|
528 |
-
<?php if ( !empty( $account['username'] ) ) : ?>
|
529 |
-
<code>[instagram-feed user="<?php echo esc_html( $account['username'] ); ?>"]</code>
|
530 |
-
<?php else : ?>
|
531 |
-
<code>[instagram-feed accesstoken="<?php echo $account['access_token']; ?>"]</code>
|
532 |
-
<?php endif; ?>
|
533 |
-
</p>
|
534 |
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
|
|
541 |
|
542 |
-
|
543 |
-
|
|
|
|
|
|
|
|
|
544 |
|
545 |
-
<
|
546 |
-
|
547 |
-
</div>
|
548 |
|
|
|
|
|
|
|
549 |
</div>
|
550 |
|
551 |
</div>
|
552 |
|
553 |
-
|
|
|
|
|
554 |
<?php endif; ?>
|
555 |
<a href="JavaScript:void(0);" class="sbi_manually_connect button-secondary"><?php _e( 'Manually Connect an Account', 'instagram-feed' ); ?></a>
|
556 |
<div class="sbi_manually_connect_wrap">
|
557 |
-
<input name="sb_manual_at" id="sb_manual_at" type="text" value="" style="margin-top: 4px; padding: 5px 9px; margin-left: 0px;" size="64" minlength="15" maxlength="200" placeholder="Enter a valid Instagram Access Token" /><span class='sbi_business_profile_tag'><?php _e('Business
|
558 |
<div class="sbi_manual_account_id_toggle">
|
559 |
-
<label><?php _e('Please enter the User ID for this
|
560 |
<input name="sb_manual_account_id" id="sb_manual_account_id" type="text" value="" style="margin-top: 4px; padding: 5px 9px; margin-left: 0px;" size="40" minlength="5" maxlength="100" placeholder="Eg: 15641403491391489" />
|
561 |
</div>
|
562 |
<p class="sbi_submit" style="display: inline-block;"><input type="sbi_submit" name="submit" id="sbi_manual_submit" class="button button-primary" style="text-align: center; padding: 0;" value="<?php _e('Connect This Account', 'instagram-feed' );?>"></p>
|
@@ -564,137 +780,6 @@ function sb_instagram_settings_page() {
|
|
564 |
</td>
|
565 |
</tr>
|
566 |
|
567 |
-
|
568 |
-
<?php if( isset($_GET['access_token']) && isset($_GET['graph_api']) && empty($_POST) ) { ?>
|
569 |
-
<?php
|
570 |
-
$access_token = sbi_maybe_clean(urldecode(sanitize_text_field($_GET['access_token'])));
|
571 |
-
$url = 'https://graph.facebook.com/me/accounts?fields=instagram_business_account,access_token&limit=500&access_token='.$access_token;
|
572 |
-
$args = array(
|
573 |
-
'timeout' => 60,
|
574 |
-
'sslverify' => false
|
575 |
-
);
|
576 |
-
$result = wp_remote_get( $url, $args );
|
577 |
-
$pages_data = '{}';
|
578 |
-
if ( ! is_wp_error( $result ) ) {
|
579 |
-
$pages_data = $result['body'];
|
580 |
-
} else {
|
581 |
-
$page_error = $result;
|
582 |
-
}
|
583 |
-
|
584 |
-
$pages_data_arr = json_decode($pages_data);
|
585 |
-
$num_accounts = 0;
|
586 |
-
if(isset($pages_data_arr)){
|
587 |
-
$num_accounts = is_array( $pages_data_arr->data ) ? count( $pages_data_arr->data ) : 0;
|
588 |
-
}
|
589 |
-
?>
|
590 |
-
<div id="sbi_config_info" class="sb_list_businesses sbi_num_businesses_<?php echo $num_accounts; ?>">
|
591 |
-
<div class="sbi_config_modal">
|
592 |
-
<div class="sbi-managed-pages">
|
593 |
-
<?php if ( isset( $page_error ) && isset( $page_error->errors ) ) {
|
594 |
-
foreach ($page_error->errors as $key => $item) {
|
595 |
-
echo '<div class="sbi_user_id_error" style="display:block;"><strong>Connection Error: </strong>' . $key . ': ' . $item[0] . '</div>';
|
596 |
-
}
|
597 |
-
}
|
598 |
-
?>
|
599 |
-
<?php if( empty($pages_data_arr->data) ) : ?>
|
600 |
-
<span id="sbi-bus-account-error">
|
601 |
-
<p style="margin-top: 5px;"><b style="font-size: 16px">Couldn't find Business Profile</b><br />
|
602 |
-
Uh oh. It looks like this Facebook account is not currently connected to an Instagram Business profile. Please check that you are logged into the <a href="https://www.facebook.com/" target="_blank">Facebook account</a> in this browser which is associated with your Instagram Business Profile.</p>
|
603 |
-
<p><b style="font-size: 16px">Why do I need a Business Profile?</b><br />
|
604 |
-
A Business Profile is not required. If you want to display a regular User feed then you can do this by selecting to connect a Personal account instead. For directions on how to convert your Personal profile into a Business profile please <a href="https://smashballoon.com/instagram-business-profiles" target="_blank">see here</a>.</p>
|
605 |
-
</span>
|
606 |
-
|
607 |
-
<?php elseif ( $num_accounts === 0 ): ?>
|
608 |
-
<span id="sbi-bus-account-error">
|
609 |
-
<p style="margin-top: 5px;"><b style="font-size: 16px">Couldn't find Business Profile</b><br />
|
610 |
-
Uh oh. It looks like this Facebook account is not currently connected to an Instagram Business profile. Please check that you are logged into the <a href="https://www.facebook.com/" target="_blank">Facebook account</a> in this browser which is associated with your Instagram Business Profile.</p>
|
611 |
-
<p>If you are, in fact, logged-in to the correct account please make sure you have Instagram accounts connected with your Facebook account by following <a href="https://smashballoon.com/reconnecting-an-instagram-business-profile/" target="_blank">this FAQ</a></p>
|
612 |
-
</span>
|
613 |
-
<?php else: ?>
|
614 |
-
<p class="sbi-managed-page-intro"><b style="font-size: 16px;">Instagram Business profiles for this account</b></p>
|
615 |
-
<?php if ( $num_accounts > 1 ) : ?>
|
616 |
-
<div class="sbi-managed-page-select-all"><input type="checkbox" id="sbi-select-all" class="sbi-select-all"><label for="sbi-select-all">Select All</label></div>
|
617 |
-
<?php endif; ?>
|
618 |
-
<div class="sbi-scrollable-accounts">
|
619 |
-
|
620 |
-
<?php foreach ( $pages_data_arr->data as $page => $page_data ) : ?>
|
621 |
-
|
622 |
-
<?php if( isset( $page_data->instagram_business_account ) ) :
|
623 |
-
|
624 |
-
$instagram_business_id = $page_data->instagram_business_account->id;
|
625 |
-
|
626 |
-
$page_access_token = isset( $page_data->access_token ) ? $page_data->access_token : '';
|
627 |
-
|
628 |
-
//Make another request to get page info
|
629 |
-
$instagram_account_url = 'https://graph.facebook.com/'.$instagram_business_id.'?fields=name,username,profile_picture_url&access_token='.$access_token;
|
630 |
-
|
631 |
-
$args = array(
|
632 |
-
'timeout' => 60,
|
633 |
-
'sslverify' => false
|
634 |
-
);
|
635 |
-
$result = wp_remote_get( $instagram_account_url, $args );
|
636 |
-
$instagram_account_info = '{}';
|
637 |
-
if ( ! is_wp_error( $result ) ) {
|
638 |
-
$instagram_account_info = $result['body'];
|
639 |
-
} else {
|
640 |
-
$page_error = $result;
|
641 |
-
}
|
642 |
-
|
643 |
-
$instagram_account_data = json_decode($instagram_account_info);
|
644 |
-
|
645 |
-
$instagram_biz_img = isset( $instagram_account_data->profile_picture_url ) ? $instagram_account_data->profile_picture_url : false;
|
646 |
-
$selected_class = $instagram_business_id == $sb_instagram_user_id ? ' sbi-page-selected' : '';
|
647 |
-
|
648 |
-
?>
|
649 |
-
<?php if ( isset( $page_error ) && isset( $page_error->errors ) ) :
|
650 |
-
foreach ($page_error->errors as $key => $item) {
|
651 |
-
echo '<div class="sbi_user_id_error" style="display:block;"><strong>Connection Error: </strong>' . $key . ': ' . $item[0] . '</div>';
|
652 |
-
}
|
653 |
-
else : ?>
|
654 |
-
<div class="sbi-managed-page<?php echo $selected_class; ?>" data-page-token="<?php echo esc_attr( $page_access_token ); ?>" data-token="<?php echo esc_attr( $access_token ); ?>" data-page-id="<?php echo esc_attr( $instagram_business_id ); ?>">
|
655 |
-
<div class="sbi-add-checkbox">
|
656 |
-
<input id="sbi-<?php echo esc_attr( $instagram_business_id ); ?>" type="checkbox" name="sbi_managed_pages[]" value="<?php echo esc_attr( $instagram_account_info ); ?>">
|
657 |
-
</div>
|
658 |
-
<div class="sbi-managed-page-details">
|
659 |
-
<label for="sbi-<?php echo esc_attr( $instagram_business_id ); ?>"><img class="sbi-page-avatar" border="0" height="50" width="50" src="<?php echo esc_url( $instagram_biz_img ); ?>"><b style="font-size: 16px;"><?php echo esc_html( $instagram_account_data->name ); ?></b>
|
660 |
-
<br />@<?php echo esc_html( $instagram_account_data->username); ?><span style="font-size: 11px; margin-left: 5px;">(<?php echo esc_html( $instagram_business_id ); ?>)</span></label>
|
661 |
-
</div>
|
662 |
-
</div>
|
663 |
-
<?php endif; ?>
|
664 |
-
|
665 |
-
<?php endif; ?>
|
666 |
-
|
667 |
-
<?php endforeach; ?>
|
668 |
-
|
669 |
-
</div> <!-- end scrollable -->
|
670 |
-
<a href="JavaScript:void(0);" id="sbi-connect-business-accounts" class="button button-primary" disabled="disabled" style="margin-top: 20px;">Connect Accounts</a>
|
671 |
-
|
672 |
-
<?php endif; ?>
|
673 |
-
|
674 |
-
<a href="JavaScript:void(0);" class="sbi_modal_close"><i class="fa fa-times"></i></a>
|
675 |
-
</div>
|
676 |
-
</div>
|
677 |
-
</div>
|
678 |
-
<?php } ?>
|
679 |
-
|
680 |
-
<?php //Display connected page
|
681 |
-
if (isset( $sbi_connected_page ) && strpos($sbi_connected_page, ':') !== false) {
|
682 |
-
|
683 |
-
$sbi_connected_page_pieces = explode(":", $sbi_connected_page);
|
684 |
-
$sbi_connected_page_id = $sbi_connected_page_pieces[0];
|
685 |
-
$sbi_connected_page_name = $sbi_connected_page_pieces[1];
|
686 |
-
$sbi_connected_page_image = $sbi_connected_page_pieces[2];
|
687 |
-
|
688 |
-
echo ' ';
|
689 |
-
echo '<p style="font-weight: bold; margin-bottom: 5px;">Connected Business Profile:</p>';
|
690 |
-
echo '<div class="sbi-managed-page sbi-no-select">';
|
691 |
-
echo '<p><img class="sbi-page-avatar" border="0" height="50" width="50" src="'.$sbi_connected_page_image.'"><b>'.$sbi_connected_page_name.'</b> ('.$sbi_connected_page_id.')</p>';
|
692 |
-
echo '</div>';
|
693 |
-
}
|
694 |
-
|
695 |
-
$sb_instagram_type = 'user';
|
696 |
-
?>
|
697 |
-
|
698 |
<tr valign="top" class="sbi_feed_type">
|
699 |
<th scope="row"><label><?php _e('Show Photos From:', 'instagram-feed'); ?></label><code class="sbi_shortcode"> type
|
700 |
Eg: type=user id=12986477
|
@@ -1344,6 +1429,33 @@ function sb_instagram_settings_page() {
|
|
1344 |
<?php $sb_instagram_show_bio = isset( $sb_instagram_show_bio ) ? $sb_instagram_show_bio : true; ?>
|
1345 |
<input type="checkbox" name="sb_instagram_show_bio" id="sb_instagram_show_bio" <?php if($sb_instagram_show_bio == true) echo 'checked="checked"' ?> />
|
1346 |
<span class="sbi_note"><?php _e("Only applies for Instagram accounts with bios", 'instagram-feed'); ?></span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1347 |
</td>
|
1348 |
</tr>
|
1349 |
<tr valign="top">
|
@@ -1905,8 +2017,8 @@ function sb_instagram_settings_page() {
|
|
1905 |
<tr class="sbi_table_header"><td colspan=3><?php _e("Configure Options", 'instagram-feed'); ?></td></tr>
|
1906 |
<tr class="sbi_pro">
|
1907 |
<td>type</td>
|
1908 |
-
<td><?php _e("Display photos from a User ID (user)<br />Display posts from a Hashtag (hashtag)", 'instagram-feed'); ?></td>
|
1909 |
-
<td><code>[instagram-feed type=user]</code><br /><code>[instagram-feed type=hashtag]</code></td>
|
1910 |
</tr>
|
1911 |
<tr>
|
1912 |
<td>user</td>
|
@@ -1915,9 +2027,14 @@ function sb_instagram_settings_page() {
|
|
1915 |
</tr>
|
1916 |
<tr class="sbi_pro">
|
1917 |
<td>hashtag</td>
|
1918 |
-
<td><?php _e('Any hashtag. Separate multiple
|
1919 |
<td><code>[instagram-feed hashtag="#awesome"]</code></td>
|
1920 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
1921 |
|
1922 |
<tr class="sbi_table_header"><td colspan=3><?php _e("Customize Options", 'instagram-feed'); ?></td></tr>
|
1923 |
<tr>
|
@@ -2118,6 +2235,16 @@ function sb_instagram_settings_page() {
|
|
2118 |
<td><?php _e("Display the bio in the header. Options:", 'instagram-feed'); ?> 'true' or 'false'</td>
|
2119 |
<td><code>[instagram-feed showbio=true]</code></td>
|
2120 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2121 |
<tr>
|
2122 |
<td>headersize</td>
|
2123 |
<td><?php _e("Size of the header including small, medium and large. Options:", 'instagram-feed'); ?> small, medium, or large.</td>
|
@@ -2334,75 +2461,70 @@ foreach ( $plugins as $plugin_path => $plugin ) {
|
|
2334 |
## PLUGIN SETTINGS: ##
|
2335 |
sb_instagram_plugin_type => Instagram Feed Free
|
2336 |
<?php
|
|
|
2337 |
foreach( $sbi_options as $key => $val ) {
|
2338 |
-
if (
|
2339 |
-
|
2340 |
-
|
2341 |
-
|
2342 |
-
|
|
|
|
|
|
|
|
|
2343 |
}
|
2344 |
-
} else {
|
2345 |
-
echo esc_html( "$key => $item" ) . "\n";
|
2346 |
}
|
|
|
|
|
2347 |
}
|
2348 |
-
} else {
|
2349 |
-
echo esc_html( "$key => $val" ) . "\n";
|
2350 |
}
|
2351 |
-
}
|
2352 |
-
?>
|
2353 |
|
2354 |
-
##CACHES: ##
|
2355 |
-
<?php global $wpdb;
|
2356 |
-
$table_name = esc_sql( $wpdb->prefix . "options" );
|
2357 |
-
$result = $wpdb->get_results( "
|
2358 |
-
SELECT *
|
2359 |
-
FROM $table_name
|
2360 |
-
WHERE `option_name` LIKE ('%\_transient\_sbi\_%')
|
2361 |
-
LIMIT 1;
|
2362 |
-
", ARRAY_A );
|
2363 |
-
if ( is_array($result) && count($result) > 0 ) {
|
2364 |
-
echo 'Most recent cache: ' . substr( $result[0]['option_value'], 0, 400 ) . "\n";
|
2365 |
-
} else {
|
2366 |
-
echo 'No feed caches found' . "\n";
|
2367 |
}
|
2368 |
?>
|
2369 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2370 |
## API RESPONSE: ##
|
2371 |
<?php
|
2372 |
-
$
|
2373 |
-
$
|
2374 |
-
$first_con_business_account = array();
|
2375 |
-
|
2376 |
-
if ( ! empty( $con_accounts ) ) {
|
2377 |
-
foreach ( $con_accounts as $account ) {
|
2378 |
-
$account_type = isset( $account['type'] ) && $account['type'] === 'business' ? 'business' : 'personal';
|
2379 |
-
if ( empty( $first_con_business_account ) && $account_type === 'business' ) {
|
2380 |
-
$first_con_business_account = $account;
|
2381 |
-
} elseif ( empty( $first_con_personal_account ) && $account_type === 'personal' ) {
|
2382 |
-
$first_con_personal_account = $account;
|
2383 |
-
}
|
2384 |
-
}
|
2385 |
|
2386 |
-
|
2387 |
-
|
2388 |
-
if ( ! empty( $first_con_personal_account ) ) {
|
2389 |
-
echo '*PERSONAL ACCOUNT*';
|
2390 |
echo "\n";
|
2391 |
-
$connection = new SB_Instagram_API_Connect( $
|
2392 |
$connection->connect();
|
2393 |
if ( ! $connection->is_wp_error() && ! $connection->is_instagram_error() ) {
|
2394 |
foreach ( $connection->get_data() as $key => $item ) {
|
2395 |
if ( is_array ( $item ) ) {
|
2396 |
-
|
2397 |
-
|
2398 |
-
|
2399 |
} else {
|
2400 |
echo $key . ' => ' . esc_html( $item ) . "\n";
|
2401 |
}
|
2402 |
}
|
2403 |
} else {
|
2404 |
if ( $connection->is_wp_error() ) {
|
2405 |
-
|
2406 |
if ( isset( $response ) && isset( $response->errors ) ) {
|
2407 |
foreach ( $response->errors as $key => $item ) {
|
2408 |
echo $key . ' => ' . $item[0] . "\n";
|
@@ -2415,7 +2537,7 @@ if ( ! empty( $first_con_personal_account ) ) {
|
|
2415 |
}
|
2416 |
echo "\n";
|
2417 |
} else {
|
2418 |
-
|
2419 |
echo "\n";
|
2420 |
}
|
2421 |
if ( ! empty( $first_con_business_account ) ) {
|
@@ -2424,15 +2546,15 @@ if ( ! empty( $first_con_business_account ) ) {
|
|
2424 |
$connection = new SB_Instagram_API_Connect( $first_con_business_account, 'header' );
|
2425 |
$connection->connect();
|
2426 |
if ( ! $connection->is_wp_error() && ! $connection->is_instagram_error() ) {
|
2427 |
-
|
2428 |
-
|
2429 |
-
|
2430 |
-
|
2431 |
-
|
2432 |
-
|
2433 |
-
|
2434 |
-
|
2435 |
-
|
2436 |
} else {
|
2437 |
if ( $connection->is_wp_error() ) {
|
2438 |
$response = $connection->get_wp_error();
|
@@ -2446,18 +2568,17 @@ if ( ! empty( $first_con_business_account ) ) {
|
|
2446 |
var_export( $error );
|
2447 |
}
|
2448 |
}
|
2449 |
-
echo "\n";
|
2450 |
} else {
|
2451 |
echo 'no connected business accounts';
|
2452 |
-
echo "\n";
|
2453 |
} ?>
|
|
|
2454 |
## Cron Events: ##
|
2455 |
<?php
|
2456 |
$cron = _get_cron_array();
|
2457 |
foreach ( $cron as $key => $data ) {
|
2458 |
$is_target = false;
|
2459 |
foreach ( $data as $key2 => $val ) {
|
2460 |
-
if ( strpos( $key2, 'sbi' ) !== false ) {
|
2461 |
$is_target = true;
|
2462 |
echo $key2;
|
2463 |
echo "\n";
|
@@ -2479,6 +2600,14 @@ if ( ! empty( $cron_report ) ) {
|
|
2479 |
echo "\n";
|
2480 |
?>
|
2481 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2482 |
## Resizing: ##
|
2483 |
<?php $upload = wp_upload_dir();
|
2484 |
$upload_dir = $upload['basedir'];
|
@@ -2501,8 +2630,9 @@ $feeds_posts_table_name = esc_sql( $wpdb->prefix . SBI_INSTAGRAM_FEEDS_POSTS );
|
|
2501 |
if ( $wpdb->get_var( "show tables like '$feeds_posts_table_name'" ) != $feeds_posts_table_name ) {
|
2502 |
echo 'no feeds posts table';
|
2503 |
echo "\n";
|
|
|
2504 |
} else {
|
2505 |
-
$last_result = $wpdb->get_results( "SELECT * FROM $feeds_posts_table_name LIMIT 1;" );
|
2506 |
if ( is_array( $last_result ) && isset( $last_result[0] ) ) {
|
2507 |
echo '*FEEDS POSTS TABLE*';
|
2508 |
echo "\n";
|
@@ -2510,7 +2640,7 @@ if ( $wpdb->get_var( "show tables like '$feeds_posts_table_name'" ) != $feeds_po
|
|
2510 |
foreach ( $last_result as $column ) {
|
2511 |
|
2512 |
foreach ( $column as $key => $value ) {
|
2513 |
-
echo $key . '
|
2514 |
}
|
2515 |
}
|
2516 |
|
@@ -2526,14 +2656,16 @@ if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) {
|
|
2526 |
echo "\n";
|
2527 |
|
2528 |
} else {
|
2529 |
-
|
|
|
|
|
2530 |
if ( is_array( $last_result ) && isset( $last_result[0] ) ) {
|
2531 |
echo '*POSTS TABLE*';
|
2532 |
echo "\n";
|
2533 |
foreach ( $last_result as $column ) {
|
2534 |
|
2535 |
foreach ( $column as $key => $value ) {
|
2536 |
-
echo $key . '
|
2537 |
}
|
2538 |
}
|
2539 |
|
@@ -2542,6 +2674,7 @@ if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) {
|
|
2542 |
echo "\n";
|
2543 |
}
|
2544 |
}
|
|
|
2545 |
?>
|
2546 |
|
2547 |
## Error Log: ##
|
@@ -2556,7 +2689,7 @@ endif;
|
|
2556 |
$ajax_statuses = $sb_instagram_posts_manager->get_ajax_status();
|
2557 |
if ( ! $ajax_statuses['successful'] ) {
|
2558 |
## AJAX Status ##
|
2559 |
-
echo 'test not successful';
|
2560 |
}
|
2561 |
?>
|
2562 |
</textarea>
|
68 |
'sb_instagram_show_header' => true,
|
69 |
'sb_instagram_header_size' => 'small',
|
70 |
'sb_instagram_header_color' => '',
|
71 |
+
'sb_instagram_custom_bio' => '',
|
72 |
+
'sb_instagram_custom_avatar' => '',
|
73 |
//Follow button
|
74 |
'sb_instagram_show_follow_btn' => true,
|
75 |
'sb_instagram_folow_btn_background' => '',
|
88 |
'sb_instagram_minnum' => 0,
|
89 |
'disable_js_image_loading' => false,
|
90 |
'enqueue_js_in_head' => false,
|
|
|
91 |
'sb_instagram_disable_mob_swipe' => false,
|
92 |
'sbi_font_method' => 'svg',
|
93 |
'sb_instagram_disable_awesome' => false,
|
137 |
$sb_instagram_show_header = $options[ 'sb_instagram_show_header' ];
|
138 |
$sb_instagram_header_size = $options[ 'sb_instagram_header_size' ];
|
139 |
$sb_instagram_show_bio = isset( $options[ 'sb_instagram_show_bio' ] ) ? $options[ 'sb_instagram_show_bio' ] : true;
|
140 |
+
$sb_instagram_custom_bio = $options[ 'sb_instagram_custom_bio' ];
|
141 |
+
$sb_instagram_custom_avatar = $options[ 'sb_instagram_custom_avatar' ];
|
142 |
$sb_instagram_header_color = $options[ 'sb_instagram_header_color' ];
|
143 |
//Follow button
|
144 |
$sb_instagram_show_follow_btn = $options[ 'sb_instagram_show_follow_btn' ];
|
276 |
//Header
|
277 |
isset($_POST[ 'sb_instagram_show_header' ]) ? $sb_instagram_show_header = sanitize_text_field( $_POST[ 'sb_instagram_show_header' ] ) : $sb_instagram_show_header = '';
|
278 |
isset($_POST[ 'sb_instagram_show_bio' ]) ? $sb_instagram_show_bio = sanitize_text_field( $_POST[ 'sb_instagram_show_bio' ] ) : $sb_instagram_show_bio = '';
|
279 |
+
isset($_POST[ 'sb_instagram_custom_bio' ]) ? $sb_instagram_custom_bio = sanitize_textarea_field( $_POST[ 'sb_instagram_custom_bio' ] ) : $sb_instagram_custom_bio = '';
|
280 |
+
isset($_POST[ 'sb_instagram_custom_avatar' ]) ? $sb_instagram_custom_avatar = sanitize_text_field( $_POST[ 'sb_instagram_custom_avatar' ] ) : $sb_instagram_custom_avatar = '';
|
281 |
if (isset($_POST[ 'sb_instagram_header_size' ]) ) $sb_instagram_header_size = $_POST[ 'sb_instagram_header_size' ];
|
282 |
|
283 |
$sb_instagram_header_color = sanitize_text_field( $_POST[ 'sb_instagram_header_color' ] );
|
324 |
$options[ 'sb_instagram_show_header' ] = $sb_instagram_show_header;
|
325 |
$options[ 'sb_instagram_header_size' ] = $sb_instagram_header_size;
|
326 |
$options[ 'sb_instagram_show_bio' ] = $sb_instagram_show_bio;
|
327 |
+
$options[ 'sb_instagram_custom_bio' ] = $sb_instagram_custom_bio;
|
328 |
+
$options[ 'sb_instagram_custom_avatar' ] = $sb_instagram_custom_avatar;
|
329 |
+
$options[ 'sb_instagram_custom_bio' ] = $sb_instagram_custom_bio;
|
330 |
+
$options[ 'sb_instagram_custom_avatar' ] = $sb_instagram_custom_avatar;
|
331 |
$options[ 'sb_instagram_header_color' ] = $sb_instagram_header_color;
|
332 |
//Follow button
|
333 |
$options[ 'sb_instagram_show_follow_btn' ] = $sb_instagram_show_follow_btn;
|
419 |
<div id="header">
|
420 |
<h1><?php _e( 'Instagram Feed', 'instagram-feed' ); ?></h1>
|
421 |
</div>
|
422 |
+
<?php
|
423 |
+
$sb_instagram_type = 'user';
|
424 |
+
$returned_data = sbi_get_connected_accounts_data( $sb_instagram_at );
|
425 |
+
$sb_instagram_at = $returned_data['access_token'];
|
426 |
+
$connected_accounts = $returned_data['connected_accounts'];
|
427 |
+
$user_feeds_returned = isset( $returned_data['user_ids'] ) ? $returned_data['user_ids'] : false;
|
428 |
+
if ( $user_feeds_returned ) {
|
429 |
+
$user_feed_ids = $user_feeds_returned;
|
430 |
+
} else {
|
431 |
+
$user_feed_ids = ! is_array( $sb_instagram_user_id ) ? explode( ',', $sb_instagram_user_id ) : $sb_instagram_user_id;
|
432 |
+
}
|
433 |
+
|
434 |
+
$new_user_name = false;
|
435 |
+
|
436 |
+
|
437 |
+
|
438 |
+
|
439 |
+
if( isset($_GET['access_token']) && isset($_GET['graph_api']) && empty($_POST) ) { ?>
|
440 |
+
<?php
|
441 |
+
$access_token = sbi_maybe_clean(urldecode($_GET['access_token']));
|
442 |
+
//
|
443 |
+
$url = 'https://graph.facebook.com/me/accounts?fields=instagram_business_account,access_token&limit=500&access_token='.$access_token;
|
444 |
+
$args = array(
|
445 |
+
'timeout' => 60,
|
446 |
+
'sslverify' => false
|
447 |
+
);
|
448 |
+
$result = wp_remote_get( $url, $args );
|
449 |
+
$pages_data = '{}';
|
450 |
+
if ( ! is_wp_error( $result ) ) {
|
451 |
+
$pages_data = $result['body'];
|
452 |
+
} else {
|
453 |
+
$page_error = $result;
|
454 |
+
}
|
455 |
+
|
456 |
+
$pages_data_arr = json_decode($pages_data);
|
457 |
+
$num_accounts = 0;
|
458 |
+
if(isset($pages_data_arr)){
|
459 |
+
$num_accounts = is_array( $pages_data_arr->data ) ? count( $pages_data_arr->data ) : 0;
|
460 |
+
}
|
461 |
+
?>
|
462 |
+
<div id="sbi_config_info" class="sb_list_businesses sbi_num_businesses_<?php echo $num_accounts; ?>">
|
463 |
+
<div class="sbi_config_modal">
|
464 |
+
<div class="sbi-managed-pages">
|
465 |
+
<?php if ( isset( $page_error ) && isset( $page_error->errors ) ) {
|
466 |
+
foreach ($page_error->errors as $key => $item) {
|
467 |
+
echo '<div class="sbi_user_id_error" style="display:block;"><strong>Connection Error: </strong>' . $key . ': ' . $item[0] . '</div>';
|
468 |
+
}
|
469 |
+
}
|
470 |
+
?>
|
471 |
+
<?php if( empty($pages_data_arr->data) ) : ?>
|
472 |
+
<span id="sbi-bus-account-error">
|
473 |
+
<p style="margin-top: 5px;"><b style="font-size: 16px">Couldn't find Business Profile</b><br />
|
474 |
+
Uh oh. It looks like this Facebook account is not currently connected to an Instagram Business profile. Please check that you are logged into the <a href="https://www.facebook.com/" target="_blank">Facebook account</a> in this browser which is associated with your Instagram Business Profile.</p>
|
475 |
+
<p><b style="font-size: 16px">Why do I need a Business Profile?</b><br />
|
476 |
+
A Business Profile is only required if you are displaying a Hashtag feed. If you want to display a regular User feed then you can do this by selecting to connect a Personal account instead. For directions on how to convert your Personal profile into a Business profile please <a href="https://smashballoon.com/instagram-business-profiles" target="_blank">see here</a>.</p>
|
477 |
+
</span>
|
478 |
+
|
479 |
+
<?php elseif ( $num_accounts === 0 ): ?>
|
480 |
+
<span id="sbi-bus-account-error">
|
481 |
+
<p style="margin-top: 5px;"><b style="font-size: 16px">Couldn't find Business Profile</b><br />
|
482 |
+
Uh oh. It looks like this Facebook account is not currently connected to an Instagram Business profile. Please check that you are logged into the <a href="https://www.facebook.com/" target="_blank">Facebook account</a> in this browser which is associated with your Instagram Business Profile.</p>
|
483 |
+
<p>If you are, in fact, logged-in to the correct account please make sure you have Instagram accounts connected with your Facebook account by following <a href="https://smashballoon.com/reconnecting-an-instagram-business-profile/" target="_blank">this FAQ</a></p>
|
484 |
+
</span>
|
485 |
+
<?php else: ?>
|
486 |
+
<p class="sbi-managed-page-intro"><b style="font-size: 16px;">Instagram Business profiles for this account</b><br /><i style="color: #666;">Note: In order to display a Hashtag feed you first need to select a Business profile below.</i></p>
|
487 |
+
<?php if ( $num_accounts > 1 ) : ?>
|
488 |
+
<div class="sbi-managed-page-select-all"><input type="checkbox" id="sbi-select-all" class="sbi-select-all"><label for="sbi-select-all">Select All</label></div>
|
489 |
+
<?php endif; ?>
|
490 |
+
<div class="sbi-scrollable-accounts">
|
491 |
+
|
492 |
+
<?php foreach ( $pages_data_arr->data as $page => $page_data ) : ?>
|
493 |
+
|
494 |
+
<?php if( isset( $page_data->instagram_business_account ) ) :
|
495 |
+
|
496 |
+
$instagram_business_id = $page_data->instagram_business_account->id;
|
497 |
+
|
498 |
+
$page_access_token = isset( $page_data->access_token ) ? $page_data->access_token : '';
|
499 |
+
|
500 |
+
//Make another request to get page info
|
501 |
+
$instagram_account_url = 'https://graph.facebook.com/'.$instagram_business_id.'?fields=name,username,profile_picture_url&access_token='.$access_token;
|
502 |
+
|
503 |
+
$args = array(
|
504 |
+
'timeout' => 60,
|
505 |
+
'sslverify' => false
|
506 |
+
);
|
507 |
+
$result = wp_remote_get( $instagram_account_url, $args );
|
508 |
+
$instagram_account_info = '{}';
|
509 |
+
if ( ! is_wp_error( $result ) ) {
|
510 |
+
$instagram_account_info = $result['body'];
|
511 |
+
} else {
|
512 |
+
$page_error = $result;
|
513 |
+
}
|
514 |
+
|
515 |
+
$instagram_account_data = json_decode($instagram_account_info);
|
516 |
+
|
517 |
+
$instagram_biz_img = isset( $instagram_account_data->profile_picture_url ) ? $instagram_account_data->profile_picture_url : false;
|
518 |
+
$selected_class = $instagram_business_id == $sb_instagram_user_id ? ' sbi-page-selected' : '';
|
519 |
+
|
520 |
+
?>
|
521 |
+
<?php if ( isset( $page_error ) && isset( $page_error->errors ) ) :
|
522 |
+
foreach ($page_error->errors as $key => $item) {
|
523 |
+
echo '<div class="sbi_user_id_error" style="display:block;"><strong>Connection Error: </strong>' . $key . ': ' . $item[0] . '</div>';
|
524 |
+
}
|
525 |
+
else : ?>
|
526 |
+
<div class="sbi-managed-page<?php echo $selected_class; ?>" data-page-token="<?php echo esc_attr( $page_access_token ); ?>" data-token="<?php echo esc_attr( $access_token ); ?>" data-page-id="<?php echo esc_attr( $instagram_business_id ); ?>">
|
527 |
+
<div class="sbi-add-checkbox">
|
528 |
+
<input id="sbi-<?php echo esc_attr( $instagram_business_id ); ?>" type="checkbox" name="sbi_managed_pages[]" value="<?php echo esc_attr( $instagram_account_info ); ?>">
|
529 |
+
</div>
|
530 |
+
<div class="sbi-managed-page-details">
|
531 |
+
<label for="sbi-<?php echo esc_attr( $instagram_business_id ); ?>"><img class="sbi-page-avatar" border="0" height="50" width="50" src="<?php echo esc_url( $instagram_biz_img ); ?>"><b style="font-size: 16px;"><?php echo esc_html( $instagram_account_data->name ); ?></b>
|
532 |
+
<br />@<?php echo esc_html( $instagram_account_data->username); ?><span style="font-size: 11px; margin-left: 5px;">(<?php echo esc_html( $instagram_business_id ); ?>)</span></label>
|
533 |
+
</div>
|
534 |
+
</div>
|
535 |
+
<?php endif; ?>
|
536 |
+
|
537 |
+
<?php endif; ?>
|
538 |
+
|
539 |
+
<?php endforeach; ?>
|
540 |
+
|
541 |
+
</div> <!-- end scrollable -->
|
542 |
+
<a href="JavaScript:void(0);" id="sbi-connect-business-accounts" class="button button-primary" disabled="disabled" style="margin-top: 20px;">Connect Accounts</a>
|
543 |
+
|
544 |
+
<?php endif; ?>
|
545 |
+
|
546 |
+
<a href="JavaScript:void(0);" class="sbi_modal_close"><i class="fa fa-times"></i></a>
|
547 |
+
</div>
|
548 |
+
</div>
|
549 |
+
</div>
|
550 |
+
<?php } elseif ( isset( $_GET['access_token'] ) && isset( $_GET['account_type'] ) && empty( $_POST ) ) {
|
551 |
+
$access_token = sanitize_text_field( $_GET['access_token'] );
|
552 |
+
$account_type = sanitize_text_field( $_GET['account_type'] );
|
553 |
+
$user_id = sanitize_text_field( $_GET['id'] );
|
554 |
+
$user_name = sanitize_text_field( $_GET['username'] );
|
555 |
+
$expires_in = (int)$_GET['expires_in'];
|
556 |
+
$expires_timestamp = time() + $expires_in;
|
557 |
+
|
558 |
+
$new_account_details = array(
|
559 |
+
'access_token' => $access_token,
|
560 |
+
'account_type' => $account_type,
|
561 |
+
'user_id' => $user_id,
|
562 |
+
'username' => $user_name,
|
563 |
+
'expires_timestamp' => $expires_timestamp,
|
564 |
+
'type' => 'basic'
|
565 |
+
);
|
566 |
+
|
567 |
|
568 |
+
$matches_existing_personal = sbi_matches_existing_personal( $new_account_details );
|
569 |
+
$button_text = $matches_existing_personal ? __( 'Update This Account', 'instagram-feed' ) : __( 'Connect This Account', 'instagram-feed' );
|
570 |
+
|
571 |
+
$account_json = wp_json_encode( $new_account_details );
|
572 |
+
|
573 |
+
$already_connected_as_business_account = (isset( $connected_accounts[ $user_id ] ) && $connected_accounts[ $user_id ]['type'] === 'business');
|
574 |
+
|
575 |
+
?>
|
576 |
+
|
577 |
+
<div id="sbi_config_info" class="sb_get_token">
|
578 |
+
<div class="sbi_config_modal">
|
579 |
+
<div class="sbi_ca_username"><strong><?php echo esc_html( $user_name ); ?></strong></div>
|
580 |
+
<form action="<?php echo admin_url( 'admin.php?page=sb-instagram-feed' ); ?>" method="post">
|
581 |
+
<p class="sbi_submit">
|
582 |
+
<?php if ( $already_connected_as_business_account ) :
|
583 |
+
_e( 'The Instagram account you are logged into is already connected as a "business" account. Remove the business account if you\'d like to connect as a basic account instead (not recommended).', 'instagram-feed' );
|
584 |
+
?>
|
585 |
+
<?php else : ?>
|
586 |
+
<input type="submit" name="sbi_submit" id="sbi_connect_account" class="button button-primary" value="<?php echo esc_html( $button_text ); ?>">
|
587 |
+
<?php endif; ?>
|
588 |
+
<input type="hidden" name="sbi_account_json" value="<?php echo esc_attr( $account_json ) ; ?>">
|
589 |
+
<input type="hidden" name="sbi_connect_username" value="<?php echo esc_attr( $user_name ); ?>">
|
590 |
+
<a href="JavaScript:void(0);" class="button button-secondary" id="sbi_switch_accounts"><?php esc_html_e( 'Switch Accounts', 'instagram-feed' ); ?></a>
|
591 |
+
</p>
|
592 |
+
</form>
|
593 |
+
<a href="JavaScript:void(0);"><i class="sbi_modal_close fa fa-times"></i></a>
|
594 |
+
</div>
|
595 |
+
</div>
|
596 |
+
<?php
|
597 |
+
} elseif ( isset( $_POST['sbi_connect_username'] ) ) {
|
598 |
+
|
599 |
+
$new_user_name = sanitize_text_field( $_POST['sbi_connect_username'] );
|
600 |
+
$new_account_details = json_decode( stripslashes( $_POST['sbi_account_json'] ), true );
|
601 |
+
array_map( 'sanitize_text_field', $new_account_details );
|
602 |
+
|
603 |
+
$updated_options = sbi_connect_basic_account( $new_account_details );
|
604 |
+
$connected_accounts = $updated_options['connected_accounts'];
|
605 |
+
$user_feed_ids = $updated_options['sb_instagram_user_id'];
|
606 |
+
}?>
|
607 |
+
|
608 |
+
<?php //Display connected page
|
609 |
+
if (isset( $sbi_connected_page ) && strpos($sbi_connected_page, ':') !== false) {
|
610 |
+
|
611 |
+
$sbi_connected_page_pieces = explode(":", $sbi_connected_page);
|
612 |
+
$sbi_connected_page_id = $sbi_connected_page_pieces[0];
|
613 |
+
$sbi_connected_page_name = $sbi_connected_page_pieces[1];
|
614 |
+
$sbi_connected_page_image = $sbi_connected_page_pieces[2];
|
615 |
+
|
616 |
+
echo ' ';
|
617 |
+
echo '<p style="font-weight: bold; margin-bottom: 5px;">Connected Business Profile:</p>';
|
618 |
+
echo '<div class="sbi-managed-page sbi-no-select">';
|
619 |
+
echo '<p><img class="sbi-page-avatar" border="0" height="50" width="50" src="'.$sbi_connected_page_image.'"><b>'.$sbi_connected_page_name.'</b> ('.$sbi_connected_page_id.')</p>';
|
620 |
+
echo '</div>';
|
621 |
+
}
|
622 |
+
|
623 |
+
?>
|
624 |
+
|
625 |
+
<form name="form1" method="post" action="">
|
626 |
<input type="hidden" name="<?php echo $sb_instagram_settings_hidden_field; ?>" value="Y">
|
627 |
<?php wp_nonce_field( 'sb_instagram_saving_settings', 'sb_instagram_settings_nonce' ); ?>
|
628 |
|
642 |
<h3><?php _e( 'Configure', 'instagram-feed' ); ?></h3>
|
643 |
|
644 |
<div id="sbi_config">
|
645 |
+
<a data-personal-basic-api="https://api.instagram.com/oauth/authorize?app_id=423965861585747&redirect_uri=https://api.smashballoon.com/instagram-basic-display-redirect.php&response_type=code&scope=user_profile,user_media&state=<?php echo admin_url('admin.php?page=sb-instagram-feed'); ?>"
|
646 |
+
data-new-api="https://www.facebook.com/dialog/oauth?client_id=254638078422287&redirect_uri=https://api.smashballoon.com/instagram-graph-api-redirect.php&scope=manage_pages,instagram_basic,instagram_manage_insights,instagram_manage_comments&state=<?php echo admin_url('admin.php?page=sb-instagram-feed'); ?>"
|
647 |
data-old-api="https://instagram.com/oauth/authorize/?client_id=3a81a9fa2a064751b8c31385b91cc25c&scope=basic&redirect_uri=https://smashballoon.com/instagram-feed/instagram-token-plugin/?return_uri=<?php echo admin_url('admin.php?page=sb-instagram-feed'); ?>&response_type=token&state=<?php echo admin_url('admin.php?page-sb-instagram-feed'); ?>&hl=en"
|
648 |
href="https://instagram.com/oauth/authorize/?client_id=3a81a9fa2a064751b8c31385b91cc25c&scope=basic&redirect_uri=https://smashballoon.com/instagram-feed/instagram-token-plugin/?return_uri=<?php echo admin_url('admin.php?page=sb-instagram-feed'); ?>&response_type=token&state=<?php echo admin_url('admin.php?page-sb-instagram-feed'); ?>&hl=en" class="sbi_admin_btn"><i class="fa fa-user-plus" aria-hidden="true" style="font-size: 20px;"></i> <?php _e('Connect an Instagram Account', 'instagram-feed' ); ?></a>
|
649 |
|
650 |
+
<!--<a href="https://instagram.com/oauth/authorize/?client_id=3a81a9fa2a064751b8c31385b91cc25c&scope=basic&redirect_uri=https://smashballoon.com/instagram-feed/instagram-token-plugin/?return_uri=<?php echo admin_url('admin.php?page=sb-instagram-feed'); ?>&response_type=token&state=<?php echo admin_url('admin.php?page-sb-instagram-feed'); ?>" class="sbi_admin_btn"><i class="fa fa-user-plus" aria-hidden="true" style="font-size: 20px;"></i> <?php _e('Connect an Instagram Account', 'instagram-feed' ); ?></a>
|
651 |
-->
|
652 |
<a href="https://smashballoon.com/instagram-feed/token/" target="_blank" style="position: relative; top: 14px; left: 15px;"><?php _e('Button not working?', 'instagram-feed'); ?></a>
|
653 |
</div>
|
654 |
|
655 |
<!-- Old Access Token -->
|
656 |
<input name="sb_instagram_at" id="sb_instagram_at" type="hidden" value="<?php echo esc_attr( $sb_instagram_at ); ?>" size="80" maxlength="100" placeholder="Click button above to get your Access Token" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
657 |
|
658 |
<tr valign="top">
|
659 |
<th scope="row"><label><?php _e( 'Instagram Accounts', 'instagram-feed' ); ?></label><span style="font-weight:normal; font-style:italic; font-size: 12px; display: block;"><?php _e('Use the button above to connect an Instagram account', 'instagram-feed'); ?></span></th>
|
660 |
<td class="sbi_connected_accounts_wrap">
|
661 |
<?php if ( empty( $connected_accounts ) ) : ?>
|
662 |
<p class="sbi_no_accounts"><?php _e( 'No Instagram accounts connected. Click the button above to connect an account.', 'instagram-feed' ); ?></p><br />
|
663 |
+
<?php else:
|
664 |
+
if ( sbi_is_after_deprecation_deadline() ) {
|
665 |
+
$deprecated_connected_account_message = __( '<b>Action Needed:</b> Reconnect this account to allow feed to update.', 'instagram-feed' );
|
666 |
+
} else {
|
667 |
+
$deprecated_connected_account_message = __( '<b>Action Needed:</b> Reconnect this account before March 2, 2020 to avoid disruption with this feed.', 'instagram-feed' );
|
668 |
+
}
|
669 |
+
|
670 |
+
$accounts_that_need_updating = sbi_get_user_names_of_personal_accounts_not_also_already_updated();
|
671 |
+
?>
|
672 |
<?php foreach ( $connected_accounts as $account ) :
|
673 |
+
$username = $account['username'] ? $account['username'] : $account['user_id'];
|
674 |
+
if ( isset( $account['local_avatar'] ) && $account['local_avatar'] && isset( $options['sb_instagram_favor_local'] ) && $options['sb_instagram_favor_local' ] === 'on' ) {
|
675 |
+
$upload = wp_upload_dir();
|
676 |
+
$resized_url = trailingslashit( $upload['baseurl'] ) . trailingslashit( SBI_UPLOADS_NAME );
|
677 |
+
$profile_picture = '<img class="sbi_ca_avatar" src="'.$resized_url . $account['username'].'.jpg" />'; //Could add placeholder avatar image
|
678 |
+
} else {
|
679 |
+
$profile_picture = $account['profile_picture'] ? '<img class="sbi_ca_avatar" src="'.$account['profile_picture'].'" />' : ''; //Could add placeholder avatar image
|
680 |
+
}
|
681 |
+
|
682 |
+
$is_invalid_class = ! $account['is_valid'] ? ' sbi_account_invalid' : '';
|
683 |
+
$in_user_feed = in_array( $account['user_id'], $user_feed_ids, true );
|
684 |
+
$account_type = isset( $account['type'] ) ? $account['type'] : 'personal';
|
685 |
+
$use_tagged = isset( $account['use_tagged'] ) && $account['use_tagged'] == '1';
|
686 |
+
|
687 |
+
if ( empty( $profile_picture ) && $account_type === 'personal' ) {
|
688 |
+
$account_update = sbi_account_data_for_token( $account['access_token'] );
|
689 |
+
if ( isset( $account['is_valid'] ) ) {
|
690 |
+
$split = explode( '.', $account['access_token'] );
|
691 |
+
$connected_accounts[ $split[0] ] = array(
|
692 |
+
'access_token' => $account['access_token'],
|
693 |
+
'user_id' => $split[0],
|
694 |
+
'username' => $account_update['username'],
|
695 |
+
'is_valid' => true,
|
696 |
+
'last_checked' => time(),
|
697 |
+
'profile_picture' => $account_update['profile_picture']
|
698 |
+
);
|
699 |
+
|
700 |
+
$sbi_options = get_option( 'sb_instagram_settings', array() );
|
701 |
+
$sbi_options['connected_accounts'] = $connected_accounts;
|
702 |
+
update_option( 'sb_instagram_settings', $sbi_options );
|
703 |
}
|
704 |
|
705 |
+
}
|
706 |
+
$updated_or_new_account_class = $new_user_name === $username && $account_type !== 'business' ? ' sbi_ca_new_or_updated' : '';
|
|
|
707 |
|
708 |
+
?>
|
709 |
+
<div class="sbi_connected_account<?php echo $is_invalid_class . $updated_or_new_account_class; ?><?php if ( $in_user_feed ) echo ' sbi_account_active' ?> sbi_account_type_<?php echo $account_type; ?>" id="sbi_connected_account_<?php esc_attr_e( $account['user_id'] ); ?>" data-accesstoken="<?php esc_attr_e( $account['access_token'] ); ?>" data-userid="<?php esc_attr_e( $account['user_id'] ); ?>" data-username="<?php esc_attr_e( $account['username'] ); ?>" data-type="<?php esc_attr_e( $account_type ); ?>" data-permissions="<?php if ( $use_tagged ) echo 'tagged'; ?>">
|
710 |
+
<?php if ( $account_type === 'personal' && in_array( $username, $accounts_that_need_updating, true ) ) : ?>
|
711 |
+
<div class="sbi_deprecated">
|
712 |
+
<span><i class="fa fa-exclamation-circle" aria-hidden="true"></i><?php echo $deprecated_connected_account_message; ?> <button class="sbi_reconnect button-primary">Reconnect</button></span>
|
713 |
</div>
|
714 |
+
<?php endif; ?>
|
715 |
+
<div class="sbi_ca_alert">
|
716 |
+
<span><?php _e( 'The Access Token for this account is expired or invalid. Click the button above to attempt to renew it.', 'instagram-feed' ) ?></span>
|
717 |
+
</div>
|
718 |
+
<div class="sbi_ca_info">
|
719 |
|
720 |
+
<div class="sbi_ca_delete">
|
721 |
+
<a href="JavaScript:void(0);" class="sbi_delete_account"><i class="fa fa-times"></i><span class="sbi_remove_text"><?php _e( 'Remove', 'instagram-feed' ); ?></span></a>
|
722 |
+
</div>
|
|
|
723 |
|
724 |
+
<div class="sbi_ca_username">
|
725 |
+
<?php echo $profile_picture; ?>
|
726 |
+
<strong><?php echo $username; ?><span><?php echo sbi_account_type_display( $account_type ); ?></span></strong>
|
727 |
+
</div>
|
|
|
|
|
|
|
|
|
728 |
|
729 |
+
<div class="sbi_ca_actions">
|
730 |
+
<?php if ( ! $in_user_feed ) : ?>
|
731 |
+
<a href="JavaScript:void(0);" class="sbi_use_in_user_feed button-primary"><i class="fa fa-plus-circle" aria-hidden="true"></i><?php _e( 'Add to Primary Feed', 'instagram-feed' ); ?></a>
|
732 |
+
<?php else : ?>
|
733 |
+
<a href="JavaScript:void(0);" class="sbi_remove_from_user_feed button-primary"><i class="fa fa-minus-circle" aria-hidden="true"></i><?php _e( 'Remove from Primary Feed', 'instagram-feed' ); ?></a>
|
734 |
+
<?php endif; ?>
|
735 |
+
<a class="sbi_ca_token_shortcode button-secondary" href="JavaScript:void(0);"><i class="fa fa-chevron-circle-right" aria-hidden="true"></i><?php _e( 'Add to another Feed', 'instagram-feed' ); ?></a>
|
736 |
+
<a class="sbi_ca_show_token button-secondary" href="JavaScript:void(0);" title="<?php _e('Show access token and account info', 'instagram-feed'); ?>"><i class="fa fa-cog"></i></a>
|
737 |
|
738 |
+
</div>
|
739 |
|
740 |
+
<div class="sbi_ca_shortcode">
|
|
|
|
|
|
|
|
|
|
|
|
|
741 |
|
742 |
+
<p><?php _e('Copy and paste this shortcode into your page or widget area', 'instagram-feed'); ?>:<br>
|
743 |
+
<?php if ( !empty( $account['username'] ) ) : ?>
|
744 |
+
<code>[instagram-feed user="<?php echo $account['username']; ?>"]</code>
|
745 |
+
<?php else : ?>
|
746 |
+
<code>[instagram-feed accesstoken="<?php echo $account['access_token']; ?>"]</code>
|
747 |
+
<?php endif; ?>
|
748 |
+
</p>
|
749 |
|
750 |
+
<p><?php _e('To add multiple users in the same feed, simply separate them using commas', 'instagram-feed'); ?>:<br>
|
751 |
+
<?php if ( !empty( $account['username'] ) ) : ?>
|
752 |
+
<code>[instagram-feed user="<?php echo $account['username']; ?>, a_second_user, a_third_user"]</code>
|
753 |
+
<?php else : ?>
|
754 |
+
<code>[instagram-feed accesstoken="<?php echo $account['access_token']; ?>, another_access_token"]</code>
|
755 |
+
<?php endif; ?>
|
756 |
|
757 |
+
<p><?php echo sprintf( __('Click on the %s tab to learn more about shortcodes', 'instagram-feed'), '<a href="?page=sb-instagram-feed&tab=display" target="_blank">'. __( 'Display Your Feed', 'instagram-feed' ) . '</a>' ); ?></p>
|
758 |
+
</div>
|
|
|
759 |
|
760 |
+
<div class="sbi_ca_accesstoken">
|
761 |
+
<span class="sbi_ca_token_label"><?php _e('Access Token', 'instagram-feed');?>:</span><input type="text" class="sbi_ca_token" value="<?php echo $account['access_token']; ?>" readonly="readonly" onclick="this.focus();this.select()" title="<?php _e('To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac).', 'instagram-feed');?>"><br>
|
762 |
+
<span class="sbi_ca_token_label"><?php _e('User ID', 'instagram-feed');?>:</span><input type="text" class="sbi_ca_user_id" value="<?php echo $account['user_id']; ?>" readonly="readonly" onclick="this.focus();this.select()" title="<?php _e('To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac).', 'instagram-feed');?>"><br>
|
763 |
</div>
|
764 |
|
765 |
</div>
|
766 |
|
767 |
+
</div>
|
768 |
+
|
769 |
+
<?php endforeach; ?>
|
770 |
<?php endif; ?>
|
771 |
<a href="JavaScript:void(0);" class="sbi_manually_connect button-secondary"><?php _e( 'Manually Connect an Account', 'instagram-feed' ); ?></a>
|
772 |
<div class="sbi_manually_connect_wrap">
|
773 |
+
<input name="sb_manual_at" id="sb_manual_at" type="text" value="" style="margin-top: 4px; padding: 5px 9px; margin-left: 0px;" size="64" minlength="15" maxlength="200" placeholder="Enter a valid Instagram Access Token" /><span class='sbi_business_profile_tag'><?php _e('Business or Basic Display', 'instagram-feed');?></span>
|
774 |
<div class="sbi_manual_account_id_toggle">
|
775 |
+
<label><?php _e('Please enter the User ID for this Profile:', 'instagram-feed');?></label>
|
776 |
<input name="sb_manual_account_id" id="sb_manual_account_id" type="text" value="" style="margin-top: 4px; padding: 5px 9px; margin-left: 0px;" size="40" minlength="5" maxlength="100" placeholder="Eg: 15641403491391489" />
|
777 |
</div>
|
778 |
<p class="sbi_submit" style="display: inline-block;"><input type="sbi_submit" name="submit" id="sbi_manual_submit" class="button button-primary" style="text-align: center; padding: 0;" value="<?php _e('Connect This Account', 'instagram-feed' );?>"></p>
|
780 |
</td>
|
781 |
</tr>
|
782 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
783 |
<tr valign="top" class="sbi_feed_type">
|
784 |
<th scope="row"><label><?php _e('Show Photos From:', 'instagram-feed'); ?></label><code class="sbi_shortcode"> type
|
785 |
Eg: type=user id=12986477
|
1429 |
<?php $sb_instagram_show_bio = isset( $sb_instagram_show_bio ) ? $sb_instagram_show_bio : true; ?>
|
1430 |
<input type="checkbox" name="sb_instagram_show_bio" id="sb_instagram_show_bio" <?php if($sb_instagram_show_bio == true) echo 'checked="checked"' ?> />
|
1431 |
<span class="sbi_note"><?php _e("Only applies for Instagram accounts with bios", 'instagram-feed'); ?></span>
|
1432 |
+
<div class="sb_instagram_box" style="display: block;">
|
1433 |
+
<div class="sb_instagram_box_setting" style="display: block;">
|
1434 |
+
<label style="padding-bottom: 0;"><?php _e("Add Custom Bio Text", 'instagram-feed'); ?></label><code class="sbi_shortcode" style="margin-top: 5px;"> custombio
|
1435 |
+
Eg: custombio="My custom bio."</code>
|
1436 |
+
<br>
|
1437 |
+
<span class="sbi_aside" style="padding-bottom: 5px; display: block;"><?php _e("Use your own custom bio text in the feed header. Bio text is automatically retrieved from Instagram for Business accounts.", 'instagram-feed'); ?></span>
|
1438 |
+
|
1439 |
+
<textarea type="text" name="sb_instagram_custom_bio" id="sb_instagram_custom_bio" ><?php echo esc_textarea( stripslashes( $sb_instagram_custom_bio ) ); ?></textarea>
|
1440 |
+
<a class="sbi_tooltip_link sbi_tooltip_under" href="JavaScript:void(0);"><?php _e("Why is my bio not displaying automatically?", 'instagram-feed'); ?></a>
|
1441 |
+
<p class="sbi_tooltip" style="padding: 10px 0 0 0; width: 99%;"><?php echo sprintf( __("Instagram is deprecating their old API for Personal accounts on March 2, 2020. The plugin supports their new API, however, their new API does not yet include the bio text for Personal accounts. If you require this feature then it is available if you convert your Instagram account from a Personal to a Business account by following %s. Note: If you previously had a Personal account connected then the plugin has saved the avatar for that feed and will continue to use it automatically.", 'instagram-feed'), '<a href="https://smashballoon.com/instagram-business-profiles/" target="_blank">these directions</a>' ); ?></p>
|
1442 |
+
</div>
|
1443 |
+
</div>
|
1444 |
+
|
1445 |
+
</td>
|
1446 |
+
</tr>
|
1447 |
+
|
1448 |
+
<tr valign="top">
|
1449 |
+
<th scope="row"><label><?php _e("Use Custom Avatar", 'instagram-feed'); ?></label><code class="sbi_shortcode"> customavatar
|
1450 |
+
Eg: customavatar="https://my-website.com/avatar.jpg"</code></th>
|
1451 |
+
<td>
|
1452 |
+
<input type="text" name="sb_instagram_custom_avatar" class="large-text" id="sb_instagram_custom_avatar" value="<?php echo esc_attr( stripslashes( $sb_instagram_custom_avatar ) ); ?>" placeholder="https://example.com/avatar.jpg" />
|
1453 |
+
<span class="sbi_aside"><?php _e("Avatar is automatically retrieved from Instagram for Business accounts", 'instagram-feed'); ?></span>
|
1454 |
+
<br>
|
1455 |
+
<a class="sbi_tooltip_link sbi_tooltip_under" href="JavaScript:void(0);"><?php _e("Why is my avatar not displaying automatically?", 'instagram-feed'); ?></a>
|
1456 |
+
|
1457 |
+
<p class="sbi_tooltip sbi_tooltip_under_text" style="padding: 10px 0 0 0;"><?php echo sprintf( __("Instagram is deprecating their old API for Personal accounts on March 2, 2020. The plugin supports their new API, however, their new API does not yet include the avatar image for Personal accounts. If you require this feature then it is available if you convert your Instagram account from a Personal to a Business account by following %s. Note: If you previously had a Personal account connected then the plugin has saved the bio text for that feed and will continue to use it automatically.", 'instagram-feed'), '<a href="https://smashballoon.com/instagram-business-profiles/" target="_blank">these directions</a>' ); ?></p>
|
1458 |
+
|
1459 |
</td>
|
1460 |
</tr>
|
1461 |
<tr valign="top">
|
2017 |
<tr class="sbi_table_header"><td colspan=3><?php _e("Configure Options", 'instagram-feed'); ?></td></tr>
|
2018 |
<tr class="sbi_pro">
|
2019 |
<td>type</td>
|
2020 |
+
<td><?php _e("Display photos from a User ID (user)<br />Display posts from a Hashtag (hashtag)", 'instagram-feed'); ?><br /><?php _e("Display photos that the account was tagged in (tagged)", 'instagram-feed'); ?></td>
|
2021 |
+
<td><code>[instagram-feed type=user]</code><br /><code>[instagram-feed type=hashtag]</code><br /><code>[instagram-feed type=tagged]</code></td>
|
2022 |
</tr>
|
2023 |
<tr>
|
2024 |
<td>user</td>
|
2027 |
</tr>
|
2028 |
<tr class="sbi_pro">
|
2029 |
<td>hashtag</td>
|
2030 |
+
<td><?php _e('Any hashtag. Separate multiple hashtags by commas.', 'instagram-feed'); ?></td>
|
2031 |
<td><code>[instagram-feed hashtag="#awesome"]</code></td>
|
2032 |
</tr>
|
2033 |
+
<tr class="sbi_pro">
|
2034 |
+
<td>tagged</td>
|
2035 |
+
<td><?php _e('Your Instagram User Name. Separate multiple users by commas.', 'instagram-feed'); ?></td>
|
2036 |
+
<td><code>[instagram-feed tagged="smashballoon"]</code></td>
|
2037 |
+
</tr>
|
2038 |
|
2039 |
<tr class="sbi_table_header"><td colspan=3><?php _e("Customize Options", 'instagram-feed'); ?></td></tr>
|
2040 |
<tr>
|
2235 |
<td><?php _e("Display the bio in the header. Options:", 'instagram-feed'); ?> 'true' or 'false'</td>
|
2236 |
<td><code>[instagram-feed showbio=true]</code></td>
|
2237 |
</tr>
|
2238 |
+
<tr>
|
2239 |
+
<td>custombio</td>
|
2240 |
+
<td><?php _e("Display a custom bio in the header", 'instagram-feed'); ?></td>
|
2241 |
+
<td><code>[instagram-feed custombio="My custom bio."]</code></td>
|
2242 |
+
</tr>
|
2243 |
+
<tr>
|
2244 |
+
<td>customavatar</td>
|
2245 |
+
<td><?php _e("Display a custom avatar in the header. Enter the full URL of an image file.", 'instagram-feed'); ?></td>
|
2246 |
+
<td><code>[instagram-feed customavatar="https://example.com/avatar.jpg"]</code></td>
|
2247 |
+
</tr>
|
2248 |
<tr>
|
2249 |
<td>headersize</td>
|
2250 |
<td><?php _e("Size of the header including small, medium and large. Options:", 'instagram-feed'); ?> small, medium, or large.</td>
|
2461 |
## PLUGIN SETTINGS: ##
|
2462 |
sb_instagram_plugin_type => Instagram Feed Free
|
2463 |
<?php
|
2464 |
+
global $wpdb;
|
2465 |
foreach( $sbi_options as $key => $val ) {
|
2466 |
+
if ( $key !== 'connected_accounts' ) {
|
2467 |
+
if ( is_array( $val ) ) {
|
2468 |
+
foreach ( $val as $item ) {
|
2469 |
+
if ( is_array( $item ) ) {
|
2470 |
+
foreach ( $item as $key2 => $val2 ) {
|
2471 |
+
echo "$key2 => $val2\n";
|
2472 |
+
}
|
2473 |
+
} else {
|
2474 |
+
echo "$key => $item\n";
|
2475 |
}
|
|
|
|
|
2476 |
}
|
2477 |
+
} else {
|
2478 |
+
echo "$key => $val\n";
|
2479 |
}
|
|
|
|
|
2480 |
}
|
|
|
|
|
2481 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2482 |
}
|
2483 |
?>
|
2484 |
|
2485 |
+
## CONNECTED ACCOUNTS: ##<?php echo "\n";
|
2486 |
+
$con_accounts = isset( $sbi_options['connected_accounts'] ) ? $sbi_options['connected_accounts'] : array();
|
2487 |
+
$business_accounts = array();
|
2488 |
+
$basic_accounts = array();
|
2489 |
+
if ( ! empty( $con_accounts ) ) {
|
2490 |
+
foreach ( $con_accounts as $account ) {
|
2491 |
+
$type = isset( $account['type'] ) ? $account['type'] : 'personal';
|
2492 |
+
|
2493 |
+
if ( $type === 'business' ) {
|
2494 |
+
$business_accounts[] = $account;
|
2495 |
+
} elseif ( $type === 'basic' ) {
|
2496 |
+
$basic_accounts[] = $account;
|
2497 |
+
}
|
2498 |
+
echo '*' . $account['user_id'] . '*' . "\n";
|
2499 |
+
var_export( $account );
|
2500 |
+
echo "\n";
|
2501 |
+
}
|
2502 |
+
}
|
2503 |
+
?>
|
2504 |
+
|
2505 |
## API RESPONSE: ##
|
2506 |
<?php
|
2507 |
+
$first_con_basic_account = isset( $basic_accounts[0] ) ? $basic_accounts[0] : array();
|
2508 |
+
$first_con_business_account = isset( $business_accounts[0] ) ? $business_accounts[0] : array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2509 |
|
2510 |
+
if ( ! empty( $first_con_basic_account ) ) {
|
2511 |
+
echo '*BASIC ACCOUNT*';
|
|
|
|
|
2512 |
echo "\n";
|
2513 |
+
$connection = new SB_Instagram_API_Connect( $first_con_basic_account, 'header' );
|
2514 |
$connection->connect();
|
2515 |
if ( ! $connection->is_wp_error() && ! $connection->is_instagram_error() ) {
|
2516 |
foreach ( $connection->get_data() as $key => $item ) {
|
2517 |
if ( is_array ( $item ) ) {
|
2518 |
+
foreach ( $item as $key2 => $item2 ) {
|
2519 |
+
echo $key2 . ' => ' . esc_html( $item2 ) . "\n";
|
2520 |
+
}
|
2521 |
} else {
|
2522 |
echo $key . ' => ' . esc_html( $item ) . "\n";
|
2523 |
}
|
2524 |
}
|
2525 |
} else {
|
2526 |
if ( $connection->is_wp_error() ) {
|
2527 |
+
$response = $connection->get_wp_error();
|
2528 |
if ( isset( $response ) && isset( $response->errors ) ) {
|
2529 |
foreach ( $response->errors as $key => $item ) {
|
2530 |
echo $key . ' => ' . $item[0] . "\n";
|
2537 |
}
|
2538 |
echo "\n";
|
2539 |
} else {
|
2540 |
+
echo 'no connected basic accounts';
|
2541 |
echo "\n";
|
2542 |
}
|
2543 |
if ( ! empty( $first_con_business_account ) ) {
|
2546 |
$connection = new SB_Instagram_API_Connect( $first_con_business_account, 'header' );
|
2547 |
$connection->connect();
|
2548 |
if ( ! $connection->is_wp_error() && ! $connection->is_instagram_error() ) {
|
2549 |
+
foreach ( $connection->get_data() as $key => $item ) {
|
2550 |
+
if ( is_array ( $item ) ) {
|
2551 |
+
foreach ( $item as $key2 => $item2 ) {
|
2552 |
+
echo $key2 . ' => ' . esc_html( $item2 ) . "\n";
|
2553 |
+
}
|
2554 |
+
} else {
|
2555 |
+
echo $key . ' => ' . esc_html( $item ) . "\n";
|
2556 |
+
}
|
2557 |
+
}
|
2558 |
} else {
|
2559 |
if ( $connection->is_wp_error() ) {
|
2560 |
$response = $connection->get_wp_error();
|
2568 |
var_export( $error );
|
2569 |
}
|
2570 |
}
|
|
|
2571 |
} else {
|
2572 |
echo 'no connected business accounts';
|
|
|
2573 |
} ?>
|
2574 |
+
|
2575 |
## Cron Events: ##
|
2576 |
<?php
|
2577 |
$cron = _get_cron_array();
|
2578 |
foreach ( $cron as $key => $data ) {
|
2579 |
$is_target = false;
|
2580 |
foreach ( $data as $key2 => $val ) {
|
2581 |
+
if ( strpos( $key2, 'sbi' ) !== false || strpos( $key2, 'sb_instagram' ) !== false ) {
|
2582 |
$is_target = true;
|
2583 |
echo $key2;
|
2584 |
echo "\n";
|
2600 |
echo "\n";
|
2601 |
?>
|
2602 |
|
2603 |
+
## Access Token Refresh: ##
|
2604 |
+
<?php $cron_report = get_option( 'sbi_refresh_report', array() );
|
2605 |
+
if ( ! empty( $cron_report ) ) {
|
2606 |
+
var_export( $cron_report );
|
2607 |
+
}
|
2608 |
+
echo "\n";
|
2609 |
+
?>
|
2610 |
+
|
2611 |
## Resizing: ##
|
2612 |
<?php $upload = wp_upload_dir();
|
2613 |
$upload_dir = $upload['basedir'];
|
2630 |
if ( $wpdb->get_var( "show tables like '$feeds_posts_table_name'" ) != $feeds_posts_table_name ) {
|
2631 |
echo 'no feeds posts table';
|
2632 |
echo "\n";
|
2633 |
+
|
2634 |
} else {
|
2635 |
+
$last_result = $wpdb->get_results( "SELECT * FROM $feeds_posts_table_name ORDER BY id DESC LIMIT 1;" );
|
2636 |
if ( is_array( $last_result ) && isset( $last_result[0] ) ) {
|
2637 |
echo '*FEEDS POSTS TABLE*';
|
2638 |
echo "\n";
|
2640 |
foreach ( $last_result as $column ) {
|
2641 |
|
2642 |
foreach ( $column as $key => $value ) {
|
2643 |
+
echo $key . ': ' . esc_html( $value ) . "\n";;
|
2644 |
}
|
2645 |
}
|
2646 |
|
2656 |
echo "\n";
|
2657 |
|
2658 |
} else {
|
2659 |
+
|
2660 |
+
|
2661 |
+
$last_result = $wpdb->get_results( "SELECT * FROM $table_name ORDER BY id DESC LIMIT 1;" );
|
2662 |
if ( is_array( $last_result ) && isset( $last_result[0] ) ) {
|
2663 |
echo '*POSTS TABLE*';
|
2664 |
echo "\n";
|
2665 |
foreach ( $last_result as $column ) {
|
2666 |
|
2667 |
foreach ( $column as $key => $value ) {
|
2668 |
+
echo $key . ': ' . esc_html( $value ) . "\n";;
|
2669 |
}
|
2670 |
}
|
2671 |
|
2674 |
echo "\n";
|
2675 |
}
|
2676 |
}
|
2677 |
+
|
2678 |
?>
|
2679 |
|
2680 |
## Error Log: ##
|
2689 |
$ajax_statuses = $sb_instagram_posts_manager->get_ajax_status();
|
2690 |
if ( ! $ajax_statuses['successful'] ) {
|
2691 |
## AJAX Status ##
|
2692 |
+
echo 'test not successful';
|
2693 |
}
|
2694 |
?>
|
2695 |
</textarea>
|
inc/class-sb-instagram-api-connect.php
CHANGED
@@ -240,17 +240,9 @@ class SB_Instagram_API_Connect
|
|
240 |
$options['connected_accounts'] = $connected_accounts;
|
241 |
|
242 |
update_option( 'sb_instagram_settings', $options );
|
243 |
-
$date_format = get_option( 'date_format' );
|
244 |
-
$time_format = get_option( 'time_format' );
|
245 |
-
if ( $date_format && $time_format ) {
|
246 |
-
$date_time_format = $date_format . ' ' . $time_format;
|
247 |
-
} else {
|
248 |
-
$date_time_format = 'F j, Y g:i a';
|
249 |
-
}
|
250 |
-
$error = '<p><b>' . sprintf( __( 'Error: Hashtag limit of 30 unique hashtags per week has been reached.', 'instagram-feed' ), $user_name ) . ' ' . sprintf( __( 'Feed may not display until %s.', 'instagram-feed' ), date_i18n( $date_time_format, $hashtag_refresh_time ) ) . '</b>';
|
251 |
-
$error .= '<p>' . __( 'If you need to display more than 30 hashtag feeds on your site, consider connecting an additional business account from a separate Instagram and Facebook account.', 'instagram-feed' );
|
252 |
|
253 |
-
$sb_instagram_posts_manager
|
|
|
254 |
|
255 |
} elseif ( (int)$response['error']['code'] === 10 ) {
|
256 |
$user_name = $error_connected_account['username'];
|
@@ -262,8 +254,8 @@ class SB_Instagram_API_Connect
|
|
262 |
|
263 |
} else if ( $response['error']['type'] === 'OAuthException' ) {
|
264 |
if ( $response['error']['code'] === 24 ) {
|
265 |
-
$error = '<p><b>' . __( 'Error:
|
266 |
-
$error .= '<p>' .
|
267 |
|
268 |
$sb_instagram_posts_manager->add_frontend_error( 'hashtag_error', $error );
|
269 |
} else {
|
@@ -345,12 +337,22 @@ class SB_Instagram_API_Connect
|
|
345 |
* @param array $params additional params related to the request
|
346 |
*
|
347 |
* @since 2.0/5.0
|
|
|
348 |
*/
|
349 |
protected function set_url( $connected_account, $endpoint_slug, $params ) {
|
350 |
$account_type = isset( $connected_account['type'] ) ? $connected_account['type'] : 'personal';
|
351 |
$num = ! empty( $params['num'] ) ? (int)$params['num'] : 33;
|
352 |
|
353 |
-
if ( $account_type === '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
if ( $endpoint_slug === 'header' ) {
|
355 |
$url = 'https://api.instagram.com/v1/users/' . $connected_account['user_id'] . '?access_token=' . sbi_maybe_clean( $connected_account['access_token'] );
|
356 |
} else {
|
240 |
$options['connected_accounts'] = $connected_accounts;
|
241 |
|
242 |
update_option( 'sb_instagram_settings', $options );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
|
244 |
+
global $sb_instagram_posts_manager;
|
245 |
+
$sb_instagram_posts_manager->add_error( 'error_18', array( 'Too many hashtags', $response['error']['error_user_msg'] ) );
|
246 |
|
247 |
} elseif ( (int)$response['error']['code'] === 10 ) {
|
248 |
$user_name = $error_connected_account['username'];
|
254 |
|
255 |
} else if ( $response['error']['type'] === 'OAuthException' ) {
|
256 |
if ( $response['error']['code'] === 24 ) {
|
257 |
+
$error = '<p><b>' . __( 'Error: Cannot retrieve posts for this hashtag.', 'instagram-feed' ) .'</b>';
|
258 |
+
$error .= '<p>' . $response['error']['error_user_msg'];
|
259 |
|
260 |
$sb_instagram_posts_manager->add_frontend_error( 'hashtag_error', $error );
|
261 |
} else {
|
337 |
* @param array $params additional params related to the request
|
338 |
*
|
339 |
* @since 2.0/5.0
|
340 |
+
* @since 2.2/5.3 added endpoints for the basic display API
|
341 |
*/
|
342 |
protected function set_url( $connected_account, $endpoint_slug, $params ) {
|
343 |
$account_type = isset( $connected_account['type'] ) ? $connected_account['type'] : 'personal';
|
344 |
$num = ! empty( $params['num'] ) ? (int)$params['num'] : 33;
|
345 |
|
346 |
+
if ( $account_type === 'basic' ) {
|
347 |
+
if ( $endpoint_slug === 'access_token' ) {
|
348 |
+
$url = 'https://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&&access_token=' . sbi_maybe_clean( $connected_account['access_token'] );
|
349 |
+
} elseif ( $endpoint_slug === 'header' ) {
|
350 |
+
$url = 'https://graph.instagram.com/me?fields=id,username,media_count,account_type&access_token=' . sbi_maybe_clean( $connected_account['access_token'] );
|
351 |
+
} else {
|
352 |
+
$num = min( $num, 200 );
|
353 |
+
$url = 'https://graph.instagram.com/' . $connected_account['user_id'] . '/media?fields=media_url,thumbnail_url,caption,id,media_type,timestamp,username,comments_count,like_count,permalink,children{media_url,id,media_type,timestamp,permalink,thumbnail_url}&limit='.$num.'&access_token=' . sbi_maybe_clean( $connected_account['access_token'] );
|
354 |
+
}
|
355 |
+
} elseif ( $account_type === 'personal' ) {
|
356 |
if ( $endpoint_slug === 'header' ) {
|
357 |
$url = 'https://api.instagram.com/v1/users/' . $connected_account['user_id'] . '?access_token=' . sbi_maybe_clean( $connected_account['access_token'] );
|
358 |
} else {
|
inc/class-sb-instagram-feed.php
CHANGED
@@ -445,6 +445,16 @@ class SB_Instagram_Feed
|
|
445 |
return $return;
|
446 |
}
|
447 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
public static function update_last_requested( $array_of_ids ) {
|
449 |
if ( empty( $array_of_ids ) ) {
|
450 |
return;
|
@@ -522,6 +532,8 @@ class SB_Instagram_Feed
|
|
522 |
* @since 2.0/5.1 added logic to make a second attempt at an API connection
|
523 |
* @since 2.0/5.1.2 remote posts only retrieved if API requests are not
|
524 |
* delayed, terms shuffled if there are more than 5
|
|
|
|
|
525 |
*/
|
526 |
public function add_remote_posts( $settings, $feed_types_and_terms, $connected_accounts_for_feed ) {
|
527 |
$new_post_sets = array();
|
@@ -560,17 +572,42 @@ class SB_Instagram_Feed
|
|
560 |
|
561 |
if ( ! $api_requests_delayed
|
562 |
&& (! isset( $next_pages[ $term . '_' . $type ] ) || $next_pages[ $term . '_' . $type ] !== false) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
if ( ! empty( $next_pages[ $term . '_' . $type ] ) ) {
|
564 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
565 |
} else {
|
566 |
$connection = $this->make_api_connection( $connected_account_for_term, $type, $params );
|
567 |
}
|
568 |
$this->add_report( 'api call made for ' . $term . ' - ' . $type );
|
569 |
|
570 |
-
$
|
|
|
|
|
571 |
$this->num_api_calls++;
|
572 |
|
573 |
-
if ( ! $connection->is_wp_error() && ! $connection->is_instagram_error() ) {
|
574 |
$one_successful_connection = true;
|
575 |
|
576 |
$data = $connection->get_data();
|
@@ -656,8 +693,9 @@ class SB_Instagram_Feed
|
|
656 |
$next_pages[ $term . '_' . $type ] = false;
|
657 |
}
|
658 |
} else {
|
|
|
659 |
|
660 |
-
|
661 |
SB_Instagram_API_Connect::handle_wp_remote_get_error( $connection->get_wp_error() );
|
662 |
} else {
|
663 |
SB_Instagram_API_Connect::handle_instagram_error( $connection->get_data(), $connected_accounts_for_feed[ $term ], $type );
|
@@ -722,12 +760,17 @@ class SB_Instagram_Feed
|
|
722 |
* feed types and terms
|
723 |
*
|
724 |
* @since 2.0/5.0
|
|
|
|
|
725 |
*/
|
726 |
public function set_remote_header_data( $settings, $feed_types_and_terms, $connected_accounts_for_feed ) {
|
727 |
$first_user = $this->get_first_user( $feed_types_and_terms );
|
728 |
$this->header_data = false;
|
|
|
|
|
|
|
729 |
|
730 |
-
if ( isset( $connected_accounts_for_feed[ $first_user ] ) ) {
|
731 |
$connection = new SB_Instagram_API_Connect( $connected_accounts_for_feed[ $first_user ], 'header', array() );
|
732 |
|
733 |
$connection->connect();
|
@@ -742,6 +785,11 @@ class SB_Instagram_Feed
|
|
742 |
$full_file_name = $resized_url . $this->header_data['username'] . '.jpg';
|
743 |
$this->header_data['local_avatar'] = $full_file_name;
|
744 |
}
|
|
|
|
|
|
|
|
|
|
|
745 |
} else {
|
746 |
if ( $connection->is_wp_error() ) {
|
747 |
SB_Instagram_API_Connect::handle_wp_remote_get_error( $connection->get_wp_error() );
|
@@ -856,6 +904,9 @@ class SB_Instagram_Feed
|
|
856 |
* @since 2.0/5.0
|
857 |
*/
|
858 |
public function should_use_pagination( $settings, $offset = 0 ) {
|
|
|
|
|
|
|
859 |
$posts_available = count( $this->post_data ) - ($offset + $settings['num']);
|
860 |
$show_loadmore_button_by_settings = ($settings['showbutton'] == 'on' || $settings['showbutton'] == 'true' || $settings['showbutton'] == true ) && $settings['showbutton'] !== 'false';
|
861 |
|
@@ -906,7 +957,7 @@ class SB_Instagram_Feed
|
|
906 |
public function get_the_feed_html( $settings, $atts, $feed_types_and_terms, $connected_accounts_for_feed ) {
|
907 |
global $sb_instagram_posts_manager;
|
908 |
|
909 |
-
if ( empty( $this->post_data ) && ! empty( $connected_accounts_for_feed ) ) {
|
910 |
$this->handle_no_posts_found( $settings, $feed_types_and_terms );
|
911 |
}
|
912 |
$posts = array_slice( $this->post_data, 0, $settings['minnum'] );
|
445 |
return $return;
|
446 |
}
|
447 |
|
448 |
+
/**
|
449 |
+
* The plugin tracks when a post was last requested so only the most
|
450 |
+
* recently displayed posts are kept in the database.
|
451 |
+
* This function updates the timestamp for a set of posts
|
452 |
+
* on the page.
|
453 |
+
*
|
454 |
+
* @param $array_of_ids
|
455 |
+
*
|
456 |
+
* @since 2.0/5.0
|
457 |
+
*/
|
458 |
public static function update_last_requested( $array_of_ids ) {
|
459 |
if ( empty( $array_of_ids ) ) {
|
460 |
return;
|
532 |
* @since 2.0/5.1 added logic to make a second attempt at an API connection
|
533 |
* @since 2.0/5.1.2 remote posts only retrieved if API requests are not
|
534 |
* delayed, terms shuffled if there are more than 5
|
535 |
+
* @since 2.2/5.3 added logic to refresh the access token for basic display
|
536 |
+
* accounts if needed before using it in an API request
|
537 |
*/
|
538 |
public function add_remote_posts( $settings, $feed_types_and_terms, $connected_accounts_for_feed ) {
|
539 |
$new_post_sets = array();
|
572 |
|
573 |
if ( ! $api_requests_delayed
|
574 |
&& (! isset( $next_pages[ $term . '_' . $type ] ) || $next_pages[ $term . '_' . $type ] !== false) ) {
|
575 |
+
|
576 |
+
$account_type = isset( $connected_account_for_term['type'] ) ? $connected_account_for_term['type'] : 'personal';
|
577 |
+
$skip_connection = false;
|
578 |
+
|
579 |
+
// basic account access tokens need to be refreshed every 60 days
|
580 |
+
// normally done using WP Cron but can be done here as a fail safe
|
581 |
+
if ( $account_type === 'basic' ) {
|
582 |
+
if ( SB_Instagram_Token_Refresher::refresh_time_has_passed_threshold( $connected_account_for_term )
|
583 |
+
&& SB_Instagram_Token_Refresher::minimum_time_interval_since_last_attempt_has_passed( $connected_account_for_term ) ) {
|
584 |
+
$refresher = new SB_Instagram_Token_Refresher( $connected_account_for_term );
|
585 |
+
$refresher->attempt_token_refresh();
|
586 |
+
$this->add_report( 'trying to refresh token ' . $term . '_' . $type );
|
587 |
+
}
|
588 |
+
} elseif( $account_type === 'personal' && sbi_is_after_deprecation_deadline() ) {
|
589 |
+
$skip_connection = true;
|
590 |
+
}
|
591 |
+
|
592 |
if ( ! empty( $next_pages[ $term . '_' . $type ] ) ) {
|
593 |
+
$next_page_term = $next_pages[ $term . '_' . $type ];
|
594 |
+
if ( strpos( $next_page_term, 'https://' ) !== false ) {
|
595 |
+
$connection = $this->make_api_connection( $next_page_term );
|
596 |
+
} else {
|
597 |
+
$params['cursor'] = $next_page_term;
|
598 |
+
$connection = $this->make_api_connection( $connected_account_for_term, $type, $params );
|
599 |
+
}
|
600 |
} else {
|
601 |
$connection = $this->make_api_connection( $connected_account_for_term, $type, $params );
|
602 |
}
|
603 |
$this->add_report( 'api call made for ' . $term . ' - ' . $type );
|
604 |
|
605 |
+
if ( ! $skip_connection ) {
|
606 |
+
$connection->connect();
|
607 |
+
}
|
608 |
$this->num_api_calls++;
|
609 |
|
610 |
+
if ( ! $skip_connection && ! $connection->is_wp_error() && ! $connection->is_instagram_error() ) {
|
611 |
$one_successful_connection = true;
|
612 |
|
613 |
$data = $connection->get_data();
|
693 |
$next_pages[ $term . '_' . $type ] = false;
|
694 |
}
|
695 |
} else {
|
696 |
+
if ( $skip_connection ) {
|
697 |
|
698 |
+
} elseif ( $connection->is_wp_error() ) {
|
699 |
SB_Instagram_API_Connect::handle_wp_remote_get_error( $connection->get_wp_error() );
|
700 |
} else {
|
701 |
SB_Instagram_API_Connect::handle_instagram_error( $connection->get_data(), $connected_accounts_for_feed[ $term ], $type );
|
760 |
* feed types and terms
|
761 |
*
|
762 |
* @since 2.0/5.0
|
763 |
+
* @since 2.2/5.3 added logic to append bio data from the related
|
764 |
+
* connected account if not available in the API response
|
765 |
*/
|
766 |
public function set_remote_header_data( $settings, $feed_types_and_terms, $connected_accounts_for_feed ) {
|
767 |
$first_user = $this->get_first_user( $feed_types_and_terms );
|
768 |
$this->header_data = false;
|
769 |
+
global $sb_instagram_posts_manager;
|
770 |
+
|
771 |
+
$api_requests_delayed = $sb_instagram_posts_manager->are_current_api_request_delays( $connected_accounts_for_feed[ $first_user ]['user_id'] );
|
772 |
|
773 |
+
if ( isset( $connected_accounts_for_feed[ $first_user ] ) && ! $api_requests_delayed ) {
|
774 |
$connection = new SB_Instagram_API_Connect( $connected_accounts_for_feed[ $first_user ], 'header', array() );
|
775 |
|
776 |
$connection->connect();
|
785 |
$full_file_name = $resized_url . $this->header_data['username'] . '.jpg';
|
786 |
$this->header_data['local_avatar'] = $full_file_name;
|
787 |
}
|
788 |
+
if ( empty( $this->header_data['bio'] )
|
789 |
+
&& isset( $connected_accounts_for_feed[ $first_user ]['bio'] ) ) {
|
790 |
+
|
791 |
+
$this->header_data['bio'] = $connected_accounts_for_feed[ $first_user ]['bio'];
|
792 |
+
}
|
793 |
} else {
|
794 |
if ( $connection->is_wp_error() ) {
|
795 |
SB_Instagram_API_Connect::handle_wp_remote_get_error( $connection->get_wp_error() );
|
904 |
* @since 2.0/5.0
|
905 |
*/
|
906 |
public function should_use_pagination( $settings, $offset = 0 ) {
|
907 |
+
if ( $settings['minnum'] < 1 ) {
|
908 |
+
return false;
|
909 |
+
}
|
910 |
$posts_available = count( $this->post_data ) - ($offset + $settings['num']);
|
911 |
$show_loadmore_button_by_settings = ($settings['showbutton'] == 'on' || $settings['showbutton'] == 'true' || $settings['showbutton'] == true ) && $settings['showbutton'] !== 'false';
|
912 |
|
957 |
public function get_the_feed_html( $settings, $atts, $feed_types_and_terms, $connected_accounts_for_feed ) {
|
958 |
global $sb_instagram_posts_manager;
|
959 |
|
960 |
+
if ( empty( $this->post_data ) && ! empty( $connected_accounts_for_feed ) && $settings['minnum'] < 0 ) {
|
961 |
$this->handle_no_posts_found( $settings, $feed_types_and_terms );
|
962 |
}
|
963 |
$posts = array_slice( $this->post_data, 0, $settings['minnum'] );
|
inc/class-sb-instagram-parse.php
CHANGED
@@ -229,9 +229,12 @@ class SB_Instagram_Parse
|
|
229 |
* @return string
|
230 |
*
|
231 |
* @since 2.0/5.0
|
|
|
232 |
*/
|
233 |
public static function get_avatar( $header_data, $settings = array( 'favor_local' => false ) ) {
|
234 |
-
if (
|
|
|
|
|
235 |
return $header_data['local_avatar'];
|
236 |
} else {
|
237 |
if ( isset( $header_data['profile_picture'] ) ) {
|
@@ -274,9 +277,12 @@ class SB_Instagram_Parse
|
|
274 |
* @return string
|
275 |
*
|
276 |
* @since 2.0.1/5.0
|
|
|
277 |
*/
|
278 |
-
public static function get_bio( $header_data ) {
|
279 |
-
if (
|
|
|
|
|
280 |
return $header_data['data']['bio'];
|
281 |
} elseif ( isset( $header_data['bio'] ) ){
|
282 |
return $header_data['bio'];
|
229 |
* @return string
|
230 |
*
|
231 |
* @since 2.0/5.0
|
232 |
+
* @since 2.2/5.3 added support for a custom avatar in settings
|
233 |
*/
|
234 |
public static function get_avatar( $header_data, $settings = array( 'favor_local' => false ) ) {
|
235 |
+
if ( ! empty( $settings['customavatar'] ) ) {
|
236 |
+
return $settings['customavatar'];
|
237 |
+
} elseif ( ! empty( $header_data['local_avatar'] ) ) {
|
238 |
return $header_data['local_avatar'];
|
239 |
} else {
|
240 |
if ( isset( $header_data['profile_picture'] ) ) {
|
277 |
* @return string
|
278 |
*
|
279 |
* @since 2.0.1/5.0
|
280 |
+
* @since 2.2/5.3 added support for a custom bio in settings
|
281 |
*/
|
282 |
+
public static function get_bio( $header_data, $settings = array() ) {
|
283 |
+
if ( ! empty( $settings['custombio'] ) ) {
|
284 |
+
return $settings['custombio'];
|
285 |
+
} elseif ( isset( $header_data['data']['bio'] ) ) {
|
286 |
return $header_data['data']['bio'];
|
287 |
} elseif ( isset( $header_data['bio'] ) ){
|
288 |
return $header_data['bio'];
|
inc/class-sb-instagram-posts-manager.php
CHANGED
@@ -342,12 +342,21 @@ class SB_Instagram_Posts_Manager
|
|
342 |
$this->frontend_errors[ $type ] = $message;
|
343 |
}
|
344 |
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
/**
|
346 |
* @return array
|
347 |
*
|
348 |
* @since 2.0/5.0
|
349 |
*/
|
350 |
public function get_frontend_errors() {
|
|
|
|
|
|
|
351 |
return $this->frontend_errors;
|
352 |
}
|
353 |
|
@@ -364,6 +373,16 @@ class SB_Instagram_Posts_Manager
|
|
364 |
|
365 |
}
|
366 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
/**
|
368 |
* @since 2.0/5.1.2
|
369 |
*/
|
@@ -382,7 +401,8 @@ class SB_Instagram_Posts_Manager
|
|
382 |
$is_delay = (get_transient( SBI_USE_BACKUP_PREFIX . 'sbi_delay_requests' ) !== false);
|
383 |
|
384 |
if ( $is_delay ) {
|
385 |
-
$
|
|
|
386 |
$errors = $this->get_errors();
|
387 |
if ( ! empty( $errors ) && current_user_can( 'manage_options' ) ) {
|
388 |
if ( isset( $errors['api'] ) ) {
|
@@ -394,6 +414,24 @@ class SB_Instagram_Posts_Manager
|
|
394 |
$error .= '<p>' . __( 'There may be an issue with the Instagram access token that you are using. Your server might also be unable to connect to Instagram at this time.', 'instagram-feed' ) . '</p>';
|
395 |
}
|
396 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
$this->add_frontend_error( 'api_delay', $error );
|
398 |
|
399 |
}
|
342 |
$this->frontend_errors[ $type ] = $message;
|
343 |
}
|
344 |
|
345 |
+
public function remove_frontend_error( $type ) {
|
346 |
+
if ( isset( $this->frontend_errors[ $type ] ) ) {
|
347 |
+
unset( $this->frontend_errors[ $type ] );
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
/**
|
352 |
* @return array
|
353 |
*
|
354 |
* @since 2.0/5.0
|
355 |
*/
|
356 |
public function get_frontend_errors() {
|
357 |
+
if ( isset( $this->frontend_errors['api_delay'] ) ) {
|
358 |
+
return array( 'api_delay' => $this->frontend_errors['api_delay'] );
|
359 |
+
}
|
360 |
return $this->frontend_errors;
|
361 |
}
|
362 |
|
373 |
|
374 |
}
|
375 |
|
376 |
+
public function clear_hashtag_errors() {
|
377 |
+
$errors = $this->get_errors();
|
378 |
+
|
379 |
+
foreach ( $errors as $error_key => $message ) {
|
380 |
+
if ( strpos( $error_key, 'ig_no_posts_for_' ) !== false || strpos( $error_key, 'error_18' ) !== false ) {
|
381 |
+
$this->remove_error( $error_key );
|
382 |
+
}
|
383 |
+
}
|
384 |
+
}
|
385 |
+
|
386 |
/**
|
387 |
* @since 2.0/5.1.2
|
388 |
*/
|
401 |
$is_delay = (get_transient( SBI_USE_BACKUP_PREFIX . 'sbi_delay_requests' ) !== false);
|
402 |
|
403 |
if ( $is_delay ) {
|
404 |
+
$this->reset_frontend_errors();
|
405 |
+
$error = '<p><b>' . sprintf( __( 'Error: API requests are being delayed.', 'instagram-feed' ) ) . ' ' . __( 'New posts will not be retrieved for at least 5 minutes.', 'instagram-feed' ) . '</b></p>';
|
406 |
$errors = $this->get_errors();
|
407 |
if ( ! empty( $errors ) && current_user_can( 'manage_options' ) ) {
|
408 |
if ( isset( $errors['api'] ) ) {
|
414 |
$error .= '<p>' . __( 'There may be an issue with the Instagram access token that you are using. Your server might also be unable to connect to Instagram at this time.', 'instagram-feed' ) . '</p>';
|
415 |
}
|
416 |
|
417 |
+
foreach ( $errors as $error_key => $message ) {
|
418 |
+
if ( strpos( $error_key, 'ig_no_posts_for_' ) !== false ) {
|
419 |
+
if ( (int)$message[0] < (time() - 12 * 60 * 60) ) {
|
420 |
+
$this->remove_error( $error_key );
|
421 |
+
} else {
|
422 |
+
$error .= '<p>' . $message[1] . '</p>';
|
423 |
+
}
|
424 |
+
} elseif ( strpos( $error_key, 'error_18' ) !== false ) {
|
425 |
+
if ( (int)$message[0] < (time() - 24 * 60 * 60) ) {
|
426 |
+
$this->remove_error( $error_key );
|
427 |
+
} else {
|
428 |
+
$error .= '<p>' . $message[1] . '</p>';
|
429 |
+
}
|
430 |
+
}
|
431 |
+
}
|
432 |
+
|
433 |
+
$error .= '<p>' . __( 'Click <a href="https://smashballoon.com/instagram-feed/docs/errors/">here</a> to troubleshoot.', 'instagram-feed' ) . '</p>';
|
434 |
+
|
435 |
$this->add_frontend_error( 'api_delay', $error );
|
436 |
|
437 |
}
|
inc/class-sb-instagram-settings.php
CHANGED
@@ -94,6 +94,8 @@ class SB_Instagram_Settings {
|
|
94 |
'showheader' => isset( $db['sb_instagram_show_header'] ) ? $db['sb_instagram_show_header'] : '',
|
95 |
'headersize' => isset( $db['sb_instagram_header_size'] ) ? $db['sb_instagram_header_size'] : '',
|
96 |
'showbio' => isset( $db['sb_instagram_show_bio'] ) ? $db['sb_instagram_show_bio'] : '',
|
|
|
|
|
97 |
'headercolor' => isset( $db['sb_instagram_header_color'] ) ? $db['sb_instagram_header_color'] : '',
|
98 |
'class' => '',
|
99 |
'ajaxtheme' => isset( $db['sb_instagram_ajax_theme'] ) ? $db['sb_instagram_ajax_theme'] : '',
|
@@ -332,8 +334,30 @@ class SB_Instagram_Settings {
|
|
332 |
'users' => array()
|
333 |
);
|
334 |
$usernames_included = array();
|
|
|
|
|
|
|
|
|
335 |
|
336 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
$access_tokens = explode( ',', str_replace( ' ', '', $this->atts['accesstoken'] ) );
|
338 |
|
339 |
foreach ( $access_tokens as $access_token ) {
|
@@ -352,28 +376,40 @@ class SB_Instagram_Settings {
|
|
352 |
$user_array = is_array( $this->settings['user'] ) ? $this->settings['user'] : explode( ',', str_replace( ' ', '', $this->settings['user'] ) );
|
353 |
foreach ( $user_array as $user ) {
|
354 |
$user_found = false;
|
|
|
|
|
|
|
|
|
355 |
if ( isset( $this->connected_accounts[ $user ] ) ) {
|
356 |
if ( ! in_array( $this->connected_accounts[ $user ]['username'], $usernames_included, true ) ) {
|
357 |
-
$
|
358 |
'term' => $this->connected_accounts[ $user ]['user_id'],
|
359 |
'params' => array()
|
360 |
);
|
361 |
$connected_accounts_in_feed[ $this->connected_accounts[ $user ]['user_id'] ] = $this->connected_accounts[ $user ];
|
362 |
$usernames_included[] = $this->connected_accounts[ $user ]['username'];
|
|
|
|
|
|
|
|
|
|
|
363 |
}
|
364 |
-
}
|
365 |
|
|
|
366 |
foreach ( $this->connected_accounts as $connected_account ) {
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
|
|
371 |
'term' => $user,
|
372 |
'params' => array()
|
373 |
);
|
374 |
$connected_accounts_in_feed[ $user ] = $connected_account;
|
|
|
375 |
} else {
|
376 |
-
$
|
377 |
'term' => $connected_account['user_id'],
|
378 |
'params' => array()
|
379 |
);
|
@@ -384,13 +420,21 @@ class SB_Instagram_Settings {
|
|
384 |
}
|
385 |
}
|
386 |
}
|
|
|
387 |
|
388 |
-
|
389 |
-
|
|
|
390 |
|
391 |
-
|
392 |
-
|
393 |
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
}
|
395 |
|
396 |
}
|
@@ -400,61 +444,90 @@ class SB_Instagram_Settings {
|
|
400 |
|
401 |
foreach ( $user_id_array as $user ) {
|
402 |
$user_found = false;
|
|
|
|
|
|
|
403 |
|
404 |
if ( isset( $this->connected_accounts[ $user ] ) ) {
|
405 |
if ( ! in_array( $this->connected_accounts[ $user ]['username'], $usernames_included, true ) ) {
|
406 |
-
$
|
407 |
'term' => $this->connected_accounts[ $user ]['user_id'],
|
408 |
'params' => array()
|
409 |
);
|
410 |
$connected_accounts_in_feed[ $this->connected_accounts[ $user ]['user_id'] ] = $this->connected_accounts[ $user ];
|
411 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
412 |
}
|
413 |
|
414 |
-
}
|
|
|
|
|
415 |
|
416 |
foreach ( $this->connected_accounts as $connected_account ) {
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
|
|
|
|
|
|
421 |
'term' => $user,
|
422 |
'params' => array()
|
423 |
);
|
424 |
$connected_accounts_in_feed[ $user ] = $connected_account;
|
|
|
425 |
} else {
|
426 |
-
$
|
427 |
'term' => $connected_account['user_id'],
|
428 |
'params' => array()
|
429 |
);
|
430 |
$connected_accounts_in_feed[ $connected_account['user_id'] ] = $connected_account;
|
431 |
}
|
432 |
-
|
433 |
-
|
|
|
|
|
434 |
}
|
435 |
}
|
436 |
}
|
437 |
|
438 |
-
|
439 |
-
|
|
|
|
|
|
|
440 |
|
441 |
-
|
442 |
-
|
443 |
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
}
|
445 |
|
446 |
}
|
447 |
|
448 |
} else {
|
449 |
foreach ( $this->connected_accounts as $connected_account ) {
|
|
|
|
|
450 |
if ( empty( $feed_type_and_terms['users'] ) ) {
|
451 |
-
if (
|
452 |
$feed_type_and_terms['users'][] = array(
|
453 |
'term' => $connected_account['username'],
|
454 |
'params' => array()
|
455 |
);
|
456 |
$connected_accounts_in_feed[ $connected_account['username'] ] = $connected_account;
|
457 |
-
}
|
458 |
$feed_type_and_terms['users'][] = array(
|
459 |
'term' => $connected_account['user_id'],
|
460 |
'params' => array()
|
@@ -466,6 +539,37 @@ class SB_Instagram_Settings {
|
|
466 |
}
|
467 |
}
|
468 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
469 |
$this->connected_accounts_in_feed = $connected_accounts_in_feed;
|
470 |
$this->feed_type_and_terms = $feed_type_and_terms;
|
471 |
}
|
94 |
'showheader' => isset( $db['sb_instagram_show_header'] ) ? $db['sb_instagram_show_header'] : '',
|
95 |
'headersize' => isset( $db['sb_instagram_header_size'] ) ? $db['sb_instagram_header_size'] : '',
|
96 |
'showbio' => isset( $db['sb_instagram_show_bio'] ) ? $db['sb_instagram_show_bio'] : '',
|
97 |
+
'custombio' => isset($db[ 'sb_instagram_custom_bio' ]) ? $db[ 'sb_instagram_custom_bio' ] : '',
|
98 |
+
'customavatar' => isset($db[ 'sb_instagram_custom_avatar' ]) ? $db[ 'sb_instagram_custom_avatar' ] : '',
|
99 |
'headercolor' => isset( $db['sb_instagram_header_color'] ) ? $db['sb_instagram_header_color'] : '',
|
100 |
'class' => '',
|
101 |
'ajaxtheme' => isset( $db['sb_instagram_ajax_theme'] ) ? $db['sb_instagram_ajax_theme'] : '',
|
334 |
'users' => array()
|
335 |
);
|
336 |
$usernames_included = array();
|
337 |
+
$is_after_deprecation_deadline = sbi_is_after_deprecation_deadline();
|
338 |
+
$is_using_access_token_in_shortcode = ! empty( $this->atts['accesstoken'] ) && strpos( $this->atts['accesstoken'], '.' ) !== false;
|
339 |
+
$users_connected_to_old_api_only = array();
|
340 |
+
$settings_link = '<a href="'.get_admin_url().'?page=sb-instagram-feed" target="_blank">' . __( 'plugin Settings page', 'instagram-feed' ) . '</a>';
|
341 |
|
342 |
+
// if using an access token in the shortcode and after the deadline, try to use a connected account by collecting the user IDs
|
343 |
+
if ( $is_after_deprecation_deadline && $is_using_access_token_in_shortcode ) {
|
344 |
+
$error = '<p><b>' . __( 'Error: Cannot add access token directly to the shortcode.', 'instagram-feed' ) . '</b><br>' . sprintf( __( 'Due to recent Instagram platform changes, it\'s no longer possible to create a feed by adding the access token to the shortcode. Remove the access token from the shortcode and connect an account on the %s instead.', 'instagram-feed' ), $settings_link );
|
345 |
+
|
346 |
+
$sb_instagram_posts_manager->add_frontend_error( 'deprecation_warning', $error );
|
347 |
+
|
348 |
+
$this->settings['id'] = array();
|
349 |
+
$access_tokens = explode( ',', str_replace( ' ', '', $this->atts['accesstoken'] ) );
|
350 |
+
|
351 |
+
foreach ( $access_tokens as $access_token ) {
|
352 |
+
$split_token = explode( '.', $access_token );
|
353 |
+
$this->settings['id'][] = $split_token[0];
|
354 |
+
}
|
355 |
+
}
|
356 |
+
|
357 |
+
if ( ! $is_after_deprecation_deadline && $is_using_access_token_in_shortcode ) {
|
358 |
+
$error = '<p><b>' . __( 'Warning: Cannot add access token directly to the shortcode.', 'instagram-feed' ) . '</b><br>' . sprintf( __( 'Due to upcoming Instagram platform changes on March 2, 2020, it will no longer be possible for feeds to use access tokens directly in the shortcode. Remove the access token from the shortcode and connect an account on the %s instead.', 'instagram-feed' ), $settings_link );
|
359 |
+
|
360 |
+
$sb_instagram_posts_manager->add_frontend_error( 'deprecation_warning', $error );
|
361 |
$access_tokens = explode( ',', str_replace( ' ', '', $this->atts['accesstoken'] ) );
|
362 |
|
363 |
foreach ( $access_tokens as $access_token ) {
|
376 |
$user_array = is_array( $this->settings['user'] ) ? $this->settings['user'] : explode( ',', str_replace( ' ', '', $this->settings['user'] ) );
|
377 |
foreach ( $user_array as $user ) {
|
378 |
$user_found = false;
|
379 |
+
$user_for_deprecated_personal_account_only_found = false;
|
380 |
+
$term_for_this_user = array();
|
381 |
+
$username_to_match = $user;
|
382 |
+
|
383 |
if ( isset( $this->connected_accounts[ $user ] ) ) {
|
384 |
if ( ! in_array( $this->connected_accounts[ $user ]['username'], $usernames_included, true ) ) {
|
385 |
+
$term_for_this_user = array(
|
386 |
'term' => $this->connected_accounts[ $user ]['user_id'],
|
387 |
'params' => array()
|
388 |
);
|
389 |
$connected_accounts_in_feed[ $this->connected_accounts[ $user ]['user_id'] ] = $this->connected_accounts[ $user ];
|
390 |
$usernames_included[] = $this->connected_accounts[ $user ]['username'];
|
391 |
+
$username_to_match = $this->connected_accounts[ $user ]['username'];
|
392 |
+
$user_found = true;
|
393 |
+
if ( ! isset( $this->connected_accounts[ $user ]['type'] ) || $this->connected_accounts[ $user ]['type'] === 'personal' ) {
|
394 |
+
$user_for_deprecated_personal_account_only_found = true;
|
395 |
+
}
|
396 |
}
|
397 |
+
}
|
398 |
|
399 |
+
if ( ! $user_found || $user_for_deprecated_personal_account_only_found ) {
|
400 |
foreach ( $this->connected_accounts as $connected_account ) {
|
401 |
+
$account_type = isset( $connected_account['type'] ) ? $connected_account['type'] : 'personal';
|
402 |
+
if ( strtolower( $username_to_match ) === strtolower( $connected_account['username'] ) ) {
|
403 |
+
if ( $user_for_deprecated_personal_account_only_found || ! in_array( $connected_account['username'], $usernames_included, true ) ) {
|
404 |
+
if ( $account_type !== 'personal' ) {
|
405 |
+
$term_for_this_user = array(
|
406 |
'term' => $user,
|
407 |
'params' => array()
|
408 |
);
|
409 |
$connected_accounts_in_feed[ $user ] = $connected_account;
|
410 |
+
$user_for_deprecated_personal_account_only_found = false;
|
411 |
} else {
|
412 |
+
$term_for_this_user = array(
|
413 |
'term' => $connected_account['user_id'],
|
414 |
'params' => array()
|
415 |
);
|
420 |
}
|
421 |
}
|
422 |
}
|
423 |
+
}
|
424 |
|
425 |
+
if ( ! empty( $term_for_this_user ) ) {
|
426 |
+
$feed_type_and_terms['users'][] = $term_for_this_user;
|
427 |
+
}
|
428 |
|
429 |
+
if ( ! $user_found ) {
|
430 |
+
$error = '<p><b>' . sprintf( __( 'Error: There is no connected account for the user %s.', 'instagram-feed' ), $user ) . ' ' . __( 'Feed will not update.', 'instagram-feed' ) . '</b>';
|
431 |
|
432 |
+
$sb_instagram_posts_manager->add_frontend_error( 'no_connection_' . $user, $error );
|
433 |
+
}
|
434 |
+
|
435 |
+
if ( $user_for_deprecated_personal_account_only_found
|
436 |
+
&& ! in_array( $user, $users_connected_to_old_api_only, true ) ) {
|
437 |
+
$users_connected_to_old_api_only[] = $connected_accounts_in_feed[ $user ]['username'];
|
438 |
}
|
439 |
|
440 |
}
|
444 |
|
445 |
foreach ( $user_id_array as $user ) {
|
446 |
$user_found = false;
|
447 |
+
$user_for_deprecated_personal_account_only_found = false;
|
448 |
+
$term_for_this_user = array();
|
449 |
+
$username_to_match = '';
|
450 |
|
451 |
if ( isset( $this->connected_accounts[ $user ] ) ) {
|
452 |
if ( ! in_array( $this->connected_accounts[ $user ]['username'], $usernames_included, true ) ) {
|
453 |
+
$term_for_this_user = array(
|
454 |
'term' => $this->connected_accounts[ $user ]['user_id'],
|
455 |
'params' => array()
|
456 |
);
|
457 |
$connected_accounts_in_feed[ $this->connected_accounts[ $user ]['user_id'] ] = $this->connected_accounts[ $user ];
|
458 |
+
if ( ! in_array( $this->connected_accounts[ $user ]['username'], $usernames_included, true ) ) {
|
459 |
+
$usernames_included[] = $this->connected_accounts[ $user ]['username'];
|
460 |
+
}
|
461 |
+
$username_to_match = $this->connected_accounts[ $user ]['username'];
|
462 |
+
$user_found = true;
|
463 |
+
if ( ! isset( $this->connected_accounts[ $user ]['type'] ) || $this->connected_accounts[ $user ]['type'] === 'personal' ) {
|
464 |
+
$user_for_deprecated_personal_account_only_found = true;
|
465 |
+
}
|
466 |
}
|
467 |
|
468 |
+
}
|
469 |
+
|
470 |
+
if ( ! $user_found || $user_for_deprecated_personal_account_only_found ) {
|
471 |
|
472 |
foreach ( $this->connected_accounts as $connected_account ) {
|
473 |
+
$account_type = isset( $connected_account['type'] ) ? $connected_account['type'] : 'personal';
|
474 |
+
$old_id_matches = ($account_type === 'basic' && isset( $connected_account['old_user_id'] ) && (string)$connected_account['old_user_id'] === (string)$user);
|
475 |
+
if ( $old_id_matches
|
476 |
+
|| (strtolower( $username_to_match ) === strtolower( $connected_account['username'] )) ) {
|
477 |
+
if ( $user_for_deprecated_personal_account_only_found || ! in_array( $connected_account['username'], $usernames_included, true ) ) {
|
478 |
+
if ( $account_type !== 'personal' ) {
|
479 |
+
$term_for_this_user = array(
|
480 |
'term' => $user,
|
481 |
'params' => array()
|
482 |
);
|
483 |
$connected_accounts_in_feed[ $user ] = $connected_account;
|
484 |
+
$user_for_deprecated_personal_account_only_found = false;
|
485 |
} else {
|
486 |
+
$term_for_this_user = array(
|
487 |
'term' => $connected_account['user_id'],
|
488 |
'params' => array()
|
489 |
);
|
490 |
$connected_accounts_in_feed[ $connected_account['user_id'] ] = $connected_account;
|
491 |
}
|
492 |
+
if ( ! in_array( $connected_account['username'], $usernames_included, true ) ) {
|
493 |
+
$usernames_included[] = $connected_account['username'];
|
494 |
+
}
|
495 |
+
$user_found = true;
|
496 |
}
|
497 |
}
|
498 |
}
|
499 |
|
500 |
+
}
|
501 |
+
|
502 |
+
if ( ! empty( $term_for_this_user ) ) {
|
503 |
+
$feed_type_and_terms['users'][] = $term_for_this_user;
|
504 |
+
}
|
505 |
|
506 |
+
if ( ! $user_found ) {
|
507 |
+
$error = '<p><b>' . sprintf( __( 'Error: There is no connected account for the user %s', 'instagram-feed' ), $user ) . ' ' . __( 'Feed will not update.', 'instagram-feed' ) . '</b>';
|
508 |
|
509 |
+
$sb_instagram_posts_manager->add_frontend_error( 'no_connection_' . $user, $error );
|
510 |
+
}
|
511 |
+
|
512 |
+
if ( $user_for_deprecated_personal_account_only_found
|
513 |
+
&& ! in_array( $user, $users_connected_to_old_api_only, true ) ) {
|
514 |
+
$users_connected_to_old_api_only[] = $connected_accounts_in_feed[ $user ]['username'];
|
515 |
}
|
516 |
|
517 |
}
|
518 |
|
519 |
} else {
|
520 |
foreach ( $this->connected_accounts as $connected_account ) {
|
521 |
+
$account_type = isset( $connected_account['type'] ) ? $connected_account['type'] : 'personal';
|
522 |
+
|
523 |
if ( empty( $feed_type_and_terms['users'] ) ) {
|
524 |
+
if ( $account_type !== 'personal' ) {
|
525 |
$feed_type_and_terms['users'][] = array(
|
526 |
'term' => $connected_account['username'],
|
527 |
'params' => array()
|
528 |
);
|
529 |
$connected_accounts_in_feed[ $connected_account['username'] ] = $connected_account;
|
530 |
+
} elseif ( ! $is_after_deprecation_deadline ) {
|
531 |
$feed_type_and_terms['users'][] = array(
|
532 |
'term' => $connected_account['user_id'],
|
533 |
'params' => array()
|
539 |
}
|
540 |
}
|
541 |
|
542 |
+
if ( ! empty( $users_connected_to_old_api_only ) ) {
|
543 |
+
$total = count( $users_connected_to_old_api_only );
|
544 |
+
if ( $total > 1 ) {
|
545 |
+
$user_string = '';
|
546 |
+
$i = 0;
|
547 |
+
|
548 |
+
foreach ( $users_connected_to_old_api_only as $username ) {
|
549 |
+
if ( ($i + 1) === $total ) {
|
550 |
+
$user_string .= ' and ' . $username;
|
551 |
+
} else {
|
552 |
+
if ( $i !== 0 ) {
|
553 |
+
$user_string .= ', ' . $username;
|
554 |
+
} else {
|
555 |
+
$user_string .= $username;
|
556 |
+
}
|
557 |
+
}
|
558 |
+
$i++;
|
559 |
+
}
|
560 |
+
} else {
|
561 |
+
$user_string = $users_connected_to_old_api_only[0];
|
562 |
+
}
|
563 |
+
|
564 |
+
if ( $is_after_deprecation_deadline ) {
|
565 |
+
$error = '<p><b>' . sprintf( __( 'Error: The account for %s needs to be reconnected.', 'instagram-feed' ), '<em>'.$user_string.'</em>' ) . '</b><br>' . __( 'Due to recent Instagram platform changes this Instagram account needs to be reconnected in order to continue updating.', 'instagram-feed' ) . '<a href="'.get_admin_url().'?page=sb-instagram-feed" class="sb_frontend_btn"><i class="fa fa-cog" aria-hidden="true"></i> ' . __( 'Reconnect on plugin Settings page', 'instagram-feed' ) . '</a>';
|
566 |
+
} else {
|
567 |
+
$error = '<p><b>' . sprintf( __( 'Warning: The account for %s needs to be reconnected.', 'instagram-feed' ), '<em>'.$user_string.'</em>' ) . '</b><br>' . __( 'Due to Instagram platform changes on March 2, 2020, this Instagram account needs to be reconnected to allow the feed to continue updating.', 'instagram-feed' ) . '<a href="'.get_admin_url().'?page=sb-instagram-feed" class="sb_frontend_btn"><i class="fa fa-cog" aria-hidden="true"></i> ' . __( 'Reconnect on plugin Settings page', 'instagram-feed' ) . '</a>';
|
568 |
+
}
|
569 |
+
|
570 |
+
$sb_instagram_posts_manager->add_frontend_error( 'deprecation_warning', $error );
|
571 |
+
}
|
572 |
+
|
573 |
$this->connected_accounts_in_feed = $connected_accounts_in_feed;
|
574 |
$this->feed_type_and_terms = $feed_type_and_terms;
|
575 |
}
|
inc/class-sb-instagram-token-refresher.php
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class SB_Instagram_Token_Refresher
|
4 |
+
*
|
5 |
+
* Various methods for efficiently refreshing basic display access
|
6 |
+
* tokens which expire every 60 days if not refreshed.
|
7 |
+
*
|
8 |
+
* @since 2.2/5.3
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
die( '-1' );
|
13 |
+
}
|
14 |
+
|
15 |
+
class SB_Instagram_Token_Refresher
|
16 |
+
{
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var array
|
20 |
+
*/
|
21 |
+
private $connected_account;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var array
|
25 |
+
*/
|
26 |
+
private $report;
|
27 |
+
|
28 |
+
public function __construct( $connected_account ) {
|
29 |
+
$this->connected_account = $connected_account;
|
30 |
+
$this->report = array();
|
31 |
+
}
|
32 |
+
|
33 |
+
public function get_report() {
|
34 |
+
return $this->report;
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* The plugin will attempt to refresh the token well
|
39 |
+
* before it expires. This function determines if the
|
40 |
+
* minimum amount of time has passed before the token
|
41 |
+
* can be refreshed
|
42 |
+
*
|
43 |
+
* @param $connected_account
|
44 |
+
*
|
45 |
+
* @return bool
|
46 |
+
*/
|
47 |
+
public static function refresh_time_has_passed_threshold( $connected_account ) {
|
48 |
+
$expiration_timestamp = isset( $connected_account['expires_timestamp'] ) ? $connected_account['expires_timestamp'] : time();
|
49 |
+
$current_time = sbi_get_current_timestamp();
|
50 |
+
|
51 |
+
$refresh_threshold = $expiration_timestamp - SBI_REFRESH_THRESHOLD_OFFSET;
|
52 |
+
|
53 |
+
if ( $refresh_threshold < $current_time ) {
|
54 |
+
return true;
|
55 |
+
}
|
56 |
+
return false;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Instagram will automatically reject API calls if
|
61 |
+
* done too frequently. This method returns true if
|
62 |
+
* there has been a minimum amount of time since the last
|
63 |
+
* API connection was attemplted
|
64 |
+
*
|
65 |
+
* @param $connected_account
|
66 |
+
*
|
67 |
+
* @return bool
|
68 |
+
*/
|
69 |
+
public static function minimum_time_interval_since_last_attempt_has_passed( $connected_account ) {
|
70 |
+
$last_attempt = isset( $connected_account['last_refresh_attempt'] ) ? (int)$connected_account['last_refresh_attempt'] : 0;
|
71 |
+
$current_time = sbi_get_current_timestamp();
|
72 |
+
|
73 |
+
if ( $current_time > $last_attempt + SBI_MINIMUM_INTERVAL ) {
|
74 |
+
return true;
|
75 |
+
}
|
76 |
+
return false;
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Returns true if the minimum time has passed since the last
|
81 |
+
* successfull access token refresh and the minimum time has passed
|
82 |
+
* since the last attempt.
|
83 |
+
*
|
84 |
+
* @return bool
|
85 |
+
*/
|
86 |
+
public function should_attempt_refresh() {
|
87 |
+
if ( SB_Instagram_Token_Refresher::refresh_time_has_passed_threshold( $this->connected_account ) ) {
|
88 |
+
|
89 |
+
if ( SB_Instagram_Token_Refresher::minimum_time_interval_since_last_attempt_has_passed( $this->connected_account ) ) {
|
90 |
+
$this->report['should_do_update'] = true;
|
91 |
+
$this->report['reason'] = '';
|
92 |
+
return true;
|
93 |
+
} else {
|
94 |
+
$this->report['should_do_update'] = false;
|
95 |
+
$this->report['reason'] = 'has not been enough time since last attempt';
|
96 |
+
}
|
97 |
+
|
98 |
+
} else {
|
99 |
+
$this->report['should_do_update'] = false;
|
100 |
+
$this->report['reason'] = 'token expiration date not close enough';
|
101 |
+
}
|
102 |
+
|
103 |
+
return false;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Attempts to refresh the token by connecting to the
|
108 |
+
* Instagram API. Logs information about the error if unsuccessful.
|
109 |
+
*
|
110 |
+
* @return bool
|
111 |
+
*/
|
112 |
+
public function attempt_token_refresh() {
|
113 |
+
$this->update_last_attempt_timestamp();
|
114 |
+
|
115 |
+
$connection = new SB_Instagram_API_Connect( $this->connected_account, 'access_token', array() );
|
116 |
+
|
117 |
+
$connection->connect();
|
118 |
+
|
119 |
+
if ( ! $connection->is_wp_error() && ! $connection->is_instagram_error() ) {
|
120 |
+
$access_token_data = $connection->get_data();
|
121 |
+
|
122 |
+
if ( ! empty( $access_token_data ) ) {
|
123 |
+
$this->report['did_update'] = true;
|
124 |
+
$this->add_renewal_data( $access_token_data );
|
125 |
+
|
126 |
+
return true;
|
127 |
+
} else {
|
128 |
+
$this->report['did_update'] = false;
|
129 |
+
$this->report['reason'] = 'successful connection but no data returned';
|
130 |
+
}
|
131 |
+
} else {
|
132 |
+
$this->report['did_update'] = false;
|
133 |
+
$this->report['reason'] = 'could not connect to Instagram';
|
134 |
+
$this->report['error_log'] = $connection;
|
135 |
+
}
|
136 |
+
|
137 |
+
return false;
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Updates data related to when the last attempt was made to refresh
|
142 |
+
* the access token for a connected account and saves it in the database.
|
143 |
+
*/
|
144 |
+
public function update_last_attempt_timestamp() {
|
145 |
+
$options = get_option( 'sb_instagram_settings', array() );
|
146 |
+
$connected_accounts = isset( $options['connected_accounts'] ) ? $options['connected_accounts'] : array();
|
147 |
+
|
148 |
+
$connected_accounts[ $this->connected_account['user_id'] ]['last_refresh_attempt'] = time();
|
149 |
+
|
150 |
+
$options['connected_accounts'] = $connected_accounts;
|
151 |
+
|
152 |
+
update_option( 'sb_instagram_settings', $options );
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Updates data related to the renewed access token
|
157 |
+
* for a connected account and saves it in the database.
|
158 |
+
*
|
159 |
+
* @param $token_data
|
160 |
+
*/
|
161 |
+
private function add_renewal_data( $token_data ) {
|
162 |
+
$options = get_option( 'sb_instagram_settings', array() );
|
163 |
+
$connected_accounts = isset( $options['connected_accounts'] ) ? $options['connected_accounts'] : array();
|
164 |
+
|
165 |
+
$expires_in = $token_data['expires_in'];
|
166 |
+
$expires_timestamp = sbi_get_current_timestamp() + $expires_in;
|
167 |
+
|
168 |
+
$connected_accounts[ $this->connected_account['user_id'] ]['expires_timestamp'] = $expires_timestamp;
|
169 |
+
$connected_accounts[ $this->connected_account['user_id'] ]['access_token'] = $token_data['access_token'];
|
170 |
+
|
171 |
+
$options['connected_accounts'] = $connected_accounts;
|
172 |
+
|
173 |
+
update_option( 'sb_instagram_settings', $options );
|
174 |
+
}
|
175 |
+
|
176 |
+
}
|
inc/if-functions.php
CHANGED
@@ -117,9 +117,13 @@ function display_instagram( $atts = array() ) {
|
|
117 |
$instagram_feed->maybe_set_header_data_from_backup();
|
118 |
}
|
119 |
|
|
|
120 |
// if need a header
|
121 |
-
if ( $instagram_feed->need_header( $settings, $feed_type_and_terms )
|
122 |
-
if ( $
|
|
|
|
|
|
|
123 |
$instagram_feed->add_report( 'background header caching used' );
|
124 |
$instagram_feed->set_header_data_from_cache();
|
125 |
} elseif ( $instagram_feed->regular_header_cache_exists() ) {
|
@@ -129,7 +133,6 @@ function display_instagram( $atts = array() ) {
|
|
129 |
} else {
|
130 |
$instagram_feed->add_report( 'no header cache exists' );
|
131 |
$instagram_feed->set_remote_header_data( $settings, $feed_type_and_terms, $instagram_feed_settings->get_connected_accounts_in_feed() );
|
132 |
-
|
133 |
$instagram_feed->cache_header_data( $instagram_feed_settings->get_cache_time_in_seconds(), $settings['backup_cache_enabled'] );
|
134 |
}
|
135 |
} else {
|
@@ -654,7 +657,7 @@ add_action( 'sbi_feed_update', 'sbi_cron_updater' );
|
|
654 |
*/
|
655 |
function sbi_maybe_clean( $maybe_dirty ) {
|
656 |
if ( substr_count ( $maybe_dirty , '.' ) < 3 ) {
|
657 |
-
return $maybe_dirty;
|
658 |
}
|
659 |
|
660 |
$parts = explode( '.', trim( $maybe_dirty ) );
|
@@ -697,6 +700,21 @@ function sbi_date_sort( $a, $b ) {
|
|
697 |
}
|
698 |
}
|
699 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
700 |
/**
|
701 |
* @param $a
|
702 |
* @param $b
|
@@ -755,6 +773,20 @@ function sbi_get_utc_offset() {
|
|
755 |
return get_option( 'gmt_offset', 0 ) * HOUR_IN_SECONDS;
|
756 |
}
|
757 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
758 |
/**
|
759 |
* Used to clear caches when transients aren't working
|
760 |
* properly
|
@@ -825,6 +857,11 @@ function sb_instagram_clear_page_caches() {
|
|
825 |
/* Clear autoptimize */
|
826 |
autoptimizeCache::clearall();
|
827 |
}
|
|
|
|
|
|
|
|
|
|
|
828 |
}
|
829 |
|
830 |
/**
|
@@ -837,7 +874,7 @@ function sb_instagram_scripts_enqueue() {
|
|
837 |
//Options to pass to JS file
|
838 |
$sb_instagram_settings = get_option( 'sb_instagram_settings' );
|
839 |
|
840 |
-
$js_file = 'js/sb-instagram-2-
|
841 |
if ( isset( $_GET['sbi_debug'] ) ) {
|
842 |
$js_file = 'js/sb-instagram.js';
|
843 |
}
|
@@ -849,9 +886,9 @@ function sb_instagram_scripts_enqueue() {
|
|
849 |
}
|
850 |
|
851 |
if ( isset( $sb_instagram_settings['enqueue_css_in_shortcode'] ) && $sb_instagram_settings['enqueue_css_in_shortcode'] ) {
|
852 |
-
wp_register_style( 'sb_instagram_styles', trailingslashit( SBI_PLUGIN_URL ) . 'css/sb-instagram-2-
|
853 |
} else {
|
854 |
-
wp_enqueue_style( 'sb_instagram_styles', trailingslashit( SBI_PLUGIN_URL ) . 'css/sb-instagram-2-
|
855 |
}
|
856 |
|
857 |
$font_method = isset( $sb_instagram_settings['sbi_font_method'] ) ? $sb_instagram_settings['sbi_font_method'] : 'svg';
|
117 |
$instagram_feed->maybe_set_header_data_from_backup();
|
118 |
}
|
119 |
|
120 |
+
|
121 |
// if need a header
|
122 |
+
if ( $instagram_feed->need_header( $settings, $feed_type_and_terms ) ) {
|
123 |
+
if ( $instagram_feed->should_use_backup() && $settings['minnum'] > 0 ) {
|
124 |
+
$instagram_feed->add_report( 'trying to set header from backup' );
|
125 |
+
$header_cache_success = $instagram_feed->maybe_set_header_data_from_backup();
|
126 |
+
} elseif ( $database_settings['sbi_caching_type'] === 'background' ) {
|
127 |
$instagram_feed->add_report( 'background header caching used' );
|
128 |
$instagram_feed->set_header_data_from_cache();
|
129 |
} elseif ( $instagram_feed->regular_header_cache_exists() ) {
|
133 |
} else {
|
134 |
$instagram_feed->add_report( 'no header cache exists' );
|
135 |
$instagram_feed->set_remote_header_data( $settings, $feed_type_and_terms, $instagram_feed_settings->get_connected_accounts_in_feed() );
|
|
|
136 |
$instagram_feed->cache_header_data( $instagram_feed_settings->get_cache_time_in_seconds(), $settings['backup_cache_enabled'] );
|
137 |
}
|
138 |
} else {
|
657 |
*/
|
658 |
function sbi_maybe_clean( $maybe_dirty ) {
|
659 |
if ( substr_count ( $maybe_dirty , '.' ) < 3 ) {
|
660 |
+
return str_replace( '634hgdf83hjdj2', '', $maybe_dirty );
|
661 |
}
|
662 |
|
663 |
$parts = explode( '.', trim( $maybe_dirty ) );
|
700 |
}
|
701 |
}
|
702 |
|
703 |
+
function sbi_code_check( $code ) {
|
704 |
+
if ( strpos( $code, '634hgdf83hjdj2') !== false ) {
|
705 |
+
return true;
|
706 |
+
}
|
707 |
+
return false;
|
708 |
+
}
|
709 |
+
|
710 |
+
function sbi_fixer( $code ) {
|
711 |
+
if ( strpos( $code, '634hgdf83hjdj2') !== false ) {
|
712 |
+
return $code;
|
713 |
+
} else {
|
714 |
+
return substr_replace( $code , '634hgdf83hjdj2', 15, 0 );
|
715 |
+
}
|
716 |
+
}
|
717 |
+
|
718 |
/**
|
719 |
* @param $a
|
720 |
* @param $b
|
773 |
return get_option( 'gmt_offset', 0 ) * HOUR_IN_SECONDS;
|
774 |
}
|
775 |
|
776 |
+
function sbi_get_current_timestamp() {
|
777 |
+
$current_time = time();
|
778 |
+
|
779 |
+
//$current_time = strtotime( 'November 25, 2022' ) + 1;
|
780 |
+
|
781 |
+
return $current_time;
|
782 |
+
}
|
783 |
+
|
784 |
+
function sbi_is_after_deprecation_deadline() {
|
785 |
+
$current_time = sbi_get_current_timestamp();
|
786 |
+
|
787 |
+
return $current_time > strtotime( 'March 3, 2020' );
|
788 |
+
}
|
789 |
+
|
790 |
/**
|
791 |
* Used to clear caches when transients aren't working
|
792 |
* properly
|
857 |
/* Clear autoptimize */
|
858 |
autoptimizeCache::clearall();
|
859 |
}
|
860 |
+
|
861 |
+
// Litespeed Cache
|
862 |
+
if ( method_exists( 'LiteSpeed_Cache_API', 'purge' ) ) {
|
863 |
+
LiteSpeed_Cache_API::purge( 'esi.instagram-feed' );
|
864 |
+
}
|
865 |
}
|
866 |
|
867 |
/**
|
874 |
//Options to pass to JS file
|
875 |
$sb_instagram_settings = get_option( 'sb_instagram_settings' );
|
876 |
|
877 |
+
$js_file = 'js/sb-instagram-2-2.min.js';
|
878 |
if ( isset( $_GET['sbi_debug'] ) ) {
|
879 |
$js_file = 'js/sb-instagram.js';
|
880 |
}
|
886 |
}
|
887 |
|
888 |
if ( isset( $sb_instagram_settings['enqueue_css_in_shortcode'] ) && $sb_instagram_settings['enqueue_css_in_shortcode'] ) {
|
889 |
+
wp_register_style( 'sb_instagram_styles', trailingslashit( SBI_PLUGIN_URL ) . 'css/sb-instagram-2-2.min.css', array(), SBIVER );
|
890 |
} else {
|
891 |
+
wp_enqueue_style( 'sb_instagram_styles', trailingslashit( SBI_PLUGIN_URL ) . 'css/sb-instagram-2-2.min.css', array(), SBIVER );
|
892 |
}
|
893 |
|
894 |
$font_method = isset( $sb_instagram_settings['sbi_font_method'] ) ? $sb_instagram_settings['sbi_font_method'] : 'svg';
|
instagram-feed.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Smash Balloon Instagram Feed
|
4 |
Plugin URI: https://smashballoon.com/instagram-feed
|
5 |
Description: Display beautifully clean, customizable, and responsive Instagram feeds.
|
6 |
-
Version: 2.
|
7 |
Author: Smash Balloon
|
8 |
Author URI: https://smashballoon.com/
|
9 |
License: GPLv2 or later
|
@@ -23,11 +23,11 @@ along with this program; if not, write to the Free Software
|
|
23 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
24 |
*/
|
25 |
if ( ! defined( 'SBIVER' ) ) {
|
26 |
-
define( 'SBIVER', '2.
|
27 |
}
|
28 |
// Db version.
|
29 |
if ( ! defined( 'SBI_DBVERSION' ) ) {
|
30 |
-
define( 'SBI_DBVERSION', '1.
|
31 |
}
|
32 |
|
33 |
// Upload folder name for local image files for posts
|
@@ -42,6 +42,12 @@ if ( ! defined( 'SBI_INSTAGRAM_POSTS_TYPE' ) ) {
|
|
42 |
if ( ! defined( 'SBI_INSTAGRAM_FEEDS_POSTS' ) ) {
|
43 |
define( 'SBI_INSTAGRAM_FEEDS_POSTS', 'sbi_instagram_feeds_posts' );
|
44 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
47 |
if ( function_exists( 'sb_instagram_feed_init' ) ) {
|
@@ -96,6 +102,7 @@ if ( function_exists( 'sb_instagram_feed_init' ) ) {
|
|
96 |
require_once trailingslashit( SBI_PLUGIN_DIR ) . 'inc/class-sb-instagram-post-set.php';
|
97 |
require_once trailingslashit( SBI_PLUGIN_DIR ) . 'inc/class-sb-instagram-posts-manager.php';
|
98 |
require_once trailingslashit( SBI_PLUGIN_DIR ) . 'inc/class-sb-instagram-settings.php';
|
|
|
99 |
|
100 |
if ( is_admin() ) {
|
101 |
require_once trailingslashit( SBI_PLUGIN_DIR ) . 'inc/admin/actions.php';
|
@@ -146,6 +153,9 @@ if ( function_exists( 'sb_instagram_feed_init' ) ) {
|
|
146 |
if ( ! wp_next_scheduled( 'sb_instagram_cron_job' ) ) {
|
147 |
wp_schedule_event( time(), 'twicedaily', 'sb_instagram_cron_job' );
|
148 |
}
|
|
|
|
|
|
|
149 |
|
150 |
$sbi_settings = get_option( 'sb_instagram_settings', array() );
|
151 |
if ( isset( $sbi_settings['sbi_caching_type'] ) && $sbi_settings['sbi_caching_type'] === 'background' ) {
|
@@ -219,6 +229,7 @@ if ( function_exists( 'sb_instagram_feed_init' ) ) {
|
|
219 |
*/
|
220 |
function sb_instagram_deactivate() {
|
221 |
wp_clear_scheduled_hook( 'sb_instagram_cron_job' );
|
|
|
222 |
wp_clear_scheduled_hook( 'sbi_feed_update' );
|
223 |
}
|
224 |
|
@@ -435,6 +446,14 @@ if ( function_exists( 'sb_instagram_feed_init' ) ) {
|
|
435 |
update_option( 'sbi_db_version', SBI_DBVERSION );
|
436 |
}
|
437 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
438 |
}
|
439 |
|
440 |
add_action( 'wp_loaded', 'sbi_check_for_db_updates' );
|
@@ -584,4 +603,35 @@ if ( function_exists( 'sb_instagram_feed_init' ) ) {
|
|
584 |
}
|
585 |
|
586 |
add_action( 'plugins_loaded', 'sbi_text_domain' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
587 |
}
|
3 |
Plugin Name: Smash Balloon Instagram Feed
|
4 |
Plugin URI: https://smashballoon.com/instagram-feed
|
5 |
Description: Display beautifully clean, customizable, and responsive Instagram feeds.
|
6 |
+
Version: 2.2
|
7 |
Author: Smash Balloon
|
8 |
Author URI: https://smashballoon.com/
|
9 |
License: GPLv2 or later
|
23 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
24 |
*/
|
25 |
if ( ! defined( 'SBIVER' ) ) {
|
26 |
+
define( 'SBIVER', '2.2' );
|
27 |
}
|
28 |
// Db version.
|
29 |
if ( ! defined( 'SBI_DBVERSION' ) ) {
|
30 |
+
define( 'SBI_DBVERSION', '1.4' );
|
31 |
}
|
32 |
|
33 |
// Upload folder name for local image files for posts
|
42 |
if ( ! defined( 'SBI_INSTAGRAM_FEEDS_POSTS' ) ) {
|
43 |
define( 'SBI_INSTAGRAM_FEEDS_POSTS', 'sbi_instagram_feeds_posts' );
|
44 |
}
|
45 |
+
if ( ! defined( 'SBI_REFRESH_THRESHOLD_OFFSET' ) ) {
|
46 |
+
define( 'SBI_REFRESH_THRESHOLD_OFFSET', 40 * 86400 );
|
47 |
+
}
|
48 |
+
if ( ! defined( 'SBI_MINIMUM_INTERVAL' ) ) {
|
49 |
+
define( 'SBI_MINIMUM_INTERVAL', 600 );
|
50 |
+
}
|
51 |
|
52 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
53 |
if ( function_exists( 'sb_instagram_feed_init' ) ) {
|
102 |
require_once trailingslashit( SBI_PLUGIN_DIR ) . 'inc/class-sb-instagram-post-set.php';
|
103 |
require_once trailingslashit( SBI_PLUGIN_DIR ) . 'inc/class-sb-instagram-posts-manager.php';
|
104 |
require_once trailingslashit( SBI_PLUGIN_DIR ) . 'inc/class-sb-instagram-settings.php';
|
105 |
+
require_once trailingslashit( SBI_PLUGIN_DIR ) . 'inc/class-sb-instagram-token-refresher.php';
|
106 |
|
107 |
if ( is_admin() ) {
|
108 |
require_once trailingslashit( SBI_PLUGIN_DIR ) . 'inc/admin/actions.php';
|
153 |
if ( ! wp_next_scheduled( 'sb_instagram_cron_job' ) ) {
|
154 |
wp_schedule_event( time(), 'twicedaily', 'sb_instagram_cron_job' );
|
155 |
}
|
156 |
+
if ( ! wp_next_scheduled( 'sb_instagram_twicedaily' ) ) {
|
157 |
+
wp_schedule_event( time(), 'twicedaily', 'sb_instagram_twicedaily' );
|
158 |
+
}
|
159 |
|
160 |
$sbi_settings = get_option( 'sb_instagram_settings', array() );
|
161 |
if ( isset( $sbi_settings['sbi_caching_type'] ) && $sbi_settings['sbi_caching_type'] === 'background' ) {
|
229 |
*/
|
230 |
function sb_instagram_deactivate() {
|
231 |
wp_clear_scheduled_hook( 'sb_instagram_cron_job' );
|
232 |
+
wp_clear_scheduled_hook( 'sb_instagram_twicedaily' );
|
233 |
wp_clear_scheduled_hook( 'sbi_feed_update' );
|
234 |
}
|
235 |
|
446 |
update_option( 'sbi_db_version', SBI_DBVERSION );
|
447 |
}
|
448 |
|
449 |
+
if ( (float) $db_ver < 1.4 ) {
|
450 |
+
if ( ! wp_next_scheduled( 'sb_instagram_twicedaily' ) ) {
|
451 |
+
wp_schedule_event( time(), 'twicedaily', 'sb_instagram_twicedaily' );
|
452 |
+
}
|
453 |
+
|
454 |
+
update_option( 'sbi_db_version', SBI_DBVERSION );
|
455 |
+
}
|
456 |
+
|
457 |
}
|
458 |
|
459 |
add_action( 'wp_loaded', 'sbi_check_for_db_updates' );
|
603 |
}
|
604 |
|
605 |
add_action( 'plugins_loaded', 'sbi_text_domain' );
|
606 |
+
|
607 |
+
function sbi_do_token_refreshes() {
|
608 |
+
$options = get_option( 'sb_instagram_settings', array() );
|
609 |
+
$connected_accounts = isset( $options['connected_accounts'] ) ? $options['connected_accounts'] : array();
|
610 |
+
|
611 |
+
if ( is_array( $connected_accounts ) && ! empty( $connected_accounts ) ) {
|
612 |
+
require_once trailingslashit( SBI_PLUGIN_DIR ) . 'inc/class-sb-instagram-token-refresher.php';
|
613 |
+
|
614 |
+
$report = array(
|
615 |
+
'notes' => array(
|
616 |
+
'time_ran' => date( 'Y-m-d H:i:s' )
|
617 |
+
)
|
618 |
+
);
|
619 |
+
foreach ( $connected_accounts as $connected_account ) {
|
620 |
+
$is_basic = (isset( $connected_account['type'] ) && $connected_account['type'] === 'basic');
|
621 |
+
|
622 |
+
if ( $is_basic ) {
|
623 |
+
$refresher = new SB_Instagram_Token_Refresher( $connected_account );
|
624 |
+
if ( $refresher->should_attempt_refresh() ) {
|
625 |
+
$refresher->attempt_token_refresh();
|
626 |
+
}
|
627 |
+
|
628 |
+
$report[ $connected_account['user_id'] ] = $refresher->get_report();
|
629 |
+
}
|
630 |
+
}
|
631 |
+
|
632 |
+
update_option( 'sbi_refresh_report', $report, false );
|
633 |
+
}
|
634 |
+
|
635 |
+
}
|
636 |
+
add_action( 'sb_instagram_twicedaily', 'sbi_do_token_refreshes' );
|
637 |
}
|
js/sb-instagram-2-2.js
ADDED
@@ -0,0 +1,891 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var sbi_js_exists = (typeof sbi_js_exists !== 'undefined') ? true : false;
|
2 |
+
if(!sbi_js_exists) {
|
3 |
+
(function($){
|
4 |
+
|
5 |
+
function sbiAddImgLiquid() {
|
6 |
+
/*! imgLiquid v0.9.944 / 03-05-2013 https://github.com/karacas/imgLiquid */
|
7 |
+
var sbi_imgLiquid = sbi_imgLiquid || {VER: "0.9.944"};
|
8 |
+
sbi_imgLiquid.bgs_Available = !1, sbi_imgLiquid.bgs_CheckRunned = !1, function (i) {
|
9 |
+
function t() {
|
10 |
+
if (!sbi_imgLiquid.bgs_CheckRunned) {
|
11 |
+
sbi_imgLiquid.bgs_CheckRunned = !0;
|
12 |
+
var t = i('<span style="background-size:cover" />');
|
13 |
+
i("body").append(t), !function () {
|
14 |
+
var i = t[0];
|
15 |
+
if (i && window.getComputedStyle) {
|
16 |
+
var e = window.getComputedStyle(i, null);
|
17 |
+
e && e.backgroundSize && (sbi_imgLiquid.bgs_Available = "cover" === e.backgroundSize)
|
18 |
+
}
|
19 |
+
}(), t.remove()
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
i.fn.extend({
|
24 |
+
sbi_imgLiquid: function (e) {
|
25 |
+
this.defaults = {
|
26 |
+
fill: !0,
|
27 |
+
verticalAlign: "center",
|
28 |
+
horizontalAlign: "center",
|
29 |
+
useBackgroundSize: !0,
|
30 |
+
useDataHtmlAttr: !0,
|
31 |
+
responsive: !0,
|
32 |
+
delay: 0,
|
33 |
+
fadeInTime: 0,
|
34 |
+
removeBoxBackground: !0,
|
35 |
+
hardPixels: !0,
|
36 |
+
responsiveCheckTime: 500,
|
37 |
+
timecheckvisibility: 500,
|
38 |
+
onStart: null,
|
39 |
+
onFinish: null,
|
40 |
+
onItemStart: null,
|
41 |
+
onItemFinish: null,
|
42 |
+
onItemError: null
|
43 |
+
}, t();
|
44 |
+
var a = this;
|
45 |
+
return this.options = e, this.settings = i.extend({}, this.defaults, this.options), this.settings.onStart && this.settings.onStart(), this.each(function (t) {
|
46 |
+
function e() {
|
47 |
+
-1 === u.css("background-image").indexOf(encodeURI(c.attr("src"))) && u.css({"background-image": 'url("' + encodeURI(c.attr("src")) + '")'}), u.css({
|
48 |
+
"background-size": g.fill ? "cover" : "contain",
|
49 |
+
"background-position": (g.horizontalAlign + " " + g.verticalAlign).toLowerCase(),
|
50 |
+
"background-repeat": "no-repeat"
|
51 |
+
}), i("a:first", u).css({
|
52 |
+
display: "block",
|
53 |
+
width: "100%",
|
54 |
+
height: "100%"
|
55 |
+
}), i("img", u).css({display: "none"}), g.onItemFinish && g.onItemFinish(t, u, c), u.addClass("sbi_imgLiquid_bgSize"), u.addClass("sbi_imgLiquid_ready"), l()
|
56 |
+
}
|
57 |
+
|
58 |
+
function o() {
|
59 |
+
function e() {
|
60 |
+
c.data("sbi_imgLiquid_error") || c.data("sbi_imgLiquid_loaded") || c.data("sbi_imgLiquid_oldProcessed") || (u.is(":visible") && c[0].complete && c[0].width > 0 && c[0].height > 0 ? (c.data("sbi_imgLiquid_loaded", !0), setTimeout(r, t * g.delay)) : setTimeout(e, g.timecheckvisibility))
|
61 |
+
}
|
62 |
+
|
63 |
+
if (c.data("oldSrc") && c.data("oldSrc") !== c.attr("src")) {
|
64 |
+
var a = c.clone().removeAttr("style");
|
65 |
+
return a.data("sbi_imgLiquid_settings", c.data("sbi_imgLiquid_settings")), c.parent().prepend(a), c.remove(), c = a, c[0].width = 0, void setTimeout(o, 10)
|
66 |
+
}
|
67 |
+
return c.data("sbi_imgLiquid_oldProcessed") ? void r() : (c.data("sbi_imgLiquid_oldProcessed", !1), c.data("oldSrc", c.attr("src")), i("img:not(:first)", u).css("display", "none"), u.css({overflow: "hidden"}), c.fadeTo(0, 0).removeAttr("width").removeAttr("height").css({
|
68 |
+
visibility: "visible",
|
69 |
+
"max-width": "none",
|
70 |
+
"max-height": "none",
|
71 |
+
width: "auto",
|
72 |
+
height: "auto",
|
73 |
+
display: "block"
|
74 |
+
}), c.on("error", n), c[0].onerror = n, e(), void d())
|
75 |
+
}
|
76 |
+
|
77 |
+
function d() {
|
78 |
+
(g.responsive || c.data("sbi_imgLiquid_oldProcessed")) && c.data("sbi_imgLiquid_settings") && (g = c.data("sbi_imgLiquid_settings"), u.actualSize = u.get(0).offsetWidth + u.get(0).offsetHeight / 1e4, u.sizeOld && u.actualSize !== u.sizeOld && r(), u.sizeOld = u.actualSize, setTimeout(d, g.responsiveCheckTime))
|
79 |
+
}
|
80 |
+
|
81 |
+
function n() {
|
82 |
+
c.data("sbi_imgLiquid_error", !0), u.addClass("sbi_imgLiquid_error"), g.onItemError && g.onItemError(t, u, c), l()
|
83 |
+
}
|
84 |
+
|
85 |
+
function s() {
|
86 |
+
var i = {};
|
87 |
+
if (a.settings.useDataHtmlAttr) {
|
88 |
+
var t = u.attr("data-sbi_imgLiquid-fill"),
|
89 |
+
e = u.attr("data-sbi_imgLiquid-horizontalAlign"),
|
90 |
+
o = u.attr("data-sbi_imgLiquid-verticalAlign");
|
91 |
+
("true" === t || "false" === t) && (i.fill = Boolean("true" === t)), void 0 === e || "left" !== e && "center" !== e && "right" !== e && -1 === e.indexOf("%") || (i.horizontalAlign = e), void 0 === o || "top" !== o && "bottom" !== o && "center" !== o && -1 === o.indexOf("%") || (i.verticalAlign = o)
|
92 |
+
}
|
93 |
+
return sbi_imgLiquid.isIE && a.settings.ieFadeInDisabled && (i.fadeInTime = 0), i
|
94 |
+
}
|
95 |
+
|
96 |
+
function r() {
|
97 |
+
var i, e, a, o, d, n, s, r, m = 0, h = 0, f = u.width(), v = u.height();
|
98 |
+
void 0 === c.data("owidth") && c.data("owidth", c[0].width), void 0 === c.data("oheight") && c.data("oheight", c[0].height), g.fill === f / v >= c.data("owidth") / c.data("oheight") ? (i = "100%", e = "auto", a = Math.floor(f), o = Math.floor(f * (c.data("oheight") / c.data("owidth")))) : (i = "auto", e = "100%", a = Math.floor(v * (c.data("owidth") / c.data("oheight"))), o = Math.floor(v)), d = g.horizontalAlign.toLowerCase(), s = f - a, "left" === d && (h = 0), "center" === d && (h = .5 * s), "right" === d && (h = s), -1 !== d.indexOf("%") && (d = parseInt(d.replace("%", ""), 10), d > 0 && (h = s * d * .01)), n = g.verticalAlign.toLowerCase(), r = v - o, "left" === n && (m = 0), "center" === n && (m = .5 * r), "bottom" === n && (m = r), -1 !== n.indexOf("%") && (n = parseInt(n.replace("%", ""), 10), n > 0 && (m = r * n * .01)), g.hardPixels && (i = a, e = o), c.css({
|
99 |
+
width: i,
|
100 |
+
height: e,
|
101 |
+
"margin-left": Math.floor(h),
|
102 |
+
"margin-top": Math.floor(m)
|
103 |
+
}), c.data("sbi_imgLiquid_oldProcessed") || (c.fadeTo(g.fadeInTime, 1), c.data("sbi_imgLiquid_oldProcessed", !0), g.removeBoxBackground && u.css("background-image", "none"), u.addClass("sbi_imgLiquid_nobgSize"), u.addClass("sbi_imgLiquid_ready")), g.onItemFinish && g.onItemFinish(t, u, c), l()
|
104 |
+
}
|
105 |
+
|
106 |
+
function l() {
|
107 |
+
t === a.length - 1 && a.settings.onFinish && a.settings.onFinish()
|
108 |
+
}
|
109 |
+
|
110 |
+
var g = a.settings, u = i(this), c = i("img:first", u);
|
111 |
+
return c.length ? (c.data("sbi_imgLiquid_settings") ? (u.removeClass("sbi_imgLiquid_error").removeClass("sbi_imgLiquid_ready"), g = i.extend({}, c.data("sbi_imgLiquid_settings"), a.options)) : g = i.extend({}, a.settings, s()), c.data("sbi_imgLiquid_settings", g), g.onItemStart && g.onItemStart(t, u, c), void (sbi_imgLiquid.bgs_Available && g.useBackgroundSize ? e() : o())) : void n()
|
112 |
+
})
|
113 |
+
}
|
114 |
+
})
|
115 |
+
}(jQuery);
|
116 |
+
|
117 |
+
// Use imagefill to set the images as backgrounds so they can be square
|
118 |
+
!function () {
|
119 |
+
var css = sbi_imgLiquid.injectCss,
|
120 |
+
head = document.getElementsByTagName('head')[0],
|
121 |
+
style = document.createElement('style');
|
122 |
+
style.type = 'text/css';
|
123 |
+
if (style.styleSheet) {
|
124 |
+
style.styleSheet.cssText = css;
|
125 |
+
} else {
|
126 |
+
style.appendChild(document.createTextNode(css));
|
127 |
+
}
|
128 |
+
head.appendChild(style);
|
129 |
+
}();
|
130 |
+
}
|
131 |
+
|
132 |
+
function sbiAddVisibilityListener() {
|
133 |
+
/* Detect when element becomes visible. Used for when the feed is initially hidden, in a tab for example. https://github.com/shaunbowe/jquery.visibilityChanged */
|
134 |
+
!function (i) {
|
135 |
+
var n = {
|
136 |
+
callback: function () {
|
137 |
+
}, runOnLoad: !0, frequency: 100, sbiPreviousVisibility: null
|
138 |
+
}, c = {};
|
139 |
+
c.sbiCheckVisibility = function (i, n) {
|
140 |
+
if (jQuery.contains(document, i[0])) {
|
141 |
+
var e = n.sbiPreviousVisibility, t = i.is(":visible");
|
142 |
+
n.sbiPreviousVisibility = t, null == e ? n.runOnLoad && n.callback(i, t) : e !== t && n.callback(i, t), setTimeout(function () {
|
143 |
+
c.sbiCheckVisibility(i, n)
|
144 |
+
}, n.frequency)
|
145 |
+
}
|
146 |
+
}, i.fn.sbiVisibilityChanged = function (e) {
|
147 |
+
var t = i.extend({}, n, e);
|
148 |
+
return this.each(function () {
|
149 |
+
c.sbiCheckVisibility(i(this), t)
|
150 |
+
})
|
151 |
+
}
|
152 |
+
}(jQuery);
|
153 |
+
}
|
154 |
+
|
155 |
+
function Sbi() {
|
156 |
+
this.feeds = {};
|
157 |
+
this.options = sb_instagram_js_options;
|
158 |
+
}
|
159 |
+
|
160 |
+
Sbi.prototype = {
|
161 |
+
createPage: function (createFeeds, createFeedsArgs) {
|
162 |
+
if (typeof window.sbiajaxurl === 'undefined' || window.sbiajaxurl.indexOf(window.location.hostname) === -1) {
|
163 |
+
window.sbiajaxurl = location.protocol + '//'+ window.location.hostname + '/wp-admin/admin-ajax.php';
|
164 |
+
}
|
165 |
+
|
166 |
+
$('.sbi_no_js_error_message').remove();
|
167 |
+
$('.sbi_no_js').removeClass('sbi_no_js');
|
168 |
+
createFeeds(createFeedsArgs);
|
169 |
+
},
|
170 |
+
createFeeds: function (args) {
|
171 |
+
args.whenFeedsCreated(
|
172 |
+
$('.sbi').each(function (index) {
|
173 |
+
$(this).attr('data-sbi-index', index + 1);
|
174 |
+
var $self = $(this),
|
175 |
+
flags = typeof $self.attr('data-sbi-flags') !== 'undefined' ? $self.attr('data-sbi-flags').split(',') : [],
|
176 |
+
general = typeof $self.attr('data-options') !== 'undefined' ? JSON.parse($self.attr('data-options')) : {};
|
177 |
+
if (flags.indexOf('testAjax') > -1) {
|
178 |
+
window.sbi.triggeredTest = true;
|
179 |
+
var submitData = {
|
180 |
+
'action' : 'sbi_on_ajax_test_trigger'
|
181 |
+
},
|
182 |
+
onSuccess = function(data) {
|
183 |
+
console.log('did test');
|
184 |
+
};
|
185 |
+
sbiAjax(submitData,onSuccess)
|
186 |
+
}
|
187 |
+
var feedOptions = {
|
188 |
+
cols : $self.attr('data-cols'),
|
189 |
+
colsmobile : $self.attr('data-colsmobile') !== 'same' ? $self.attr('data-colsmobile') : $self.attr('data-cols'),
|
190 |
+
num : $self.attr('data-num'),
|
191 |
+
imgRes : $self.attr('data-res'),
|
192 |
+
feedID : $self.attr('data-feedid'),
|
193 |
+
shortCodeAtts : $self.attr('data-shortcode-atts'),
|
194 |
+
resizingEnabled : (flags.indexOf('resizeDisable') === -1),
|
195 |
+
imageLoadEnabled : (flags.indexOf('imageLoadDisable') === -1),
|
196 |
+
debugEnabled : (flags.indexOf('debug') > -1),
|
197 |
+
favorLocal : (flags.indexOf('favorLocal') > -1),
|
198 |
+
ajaxPostLoad : (flags.indexOf('ajaxPostLoad') > -1),
|
199 |
+
autoMinRes : 1,
|
200 |
+
general : general
|
201 |
+
};
|
202 |
+
|
203 |
+
window.sbi.feeds[index] = sbiGetNewFeed(this, index, feedOptions);
|
204 |
+
window.sbi.feeds[index].setResizedImages();
|
205 |
+
window.sbi.feeds[index].init();
|
206 |
+
|
207 |
+
var evt = jQuery.Event('sbiafterfeedcreate');
|
208 |
+
evt.feed = window.sbi.feeds[index];
|
209 |
+
jQuery(window).trigger(evt);
|
210 |
+
|
211 |
+
})
|
212 |
+
);
|
213 |
+
},
|
214 |
+
afterFeedsCreated: function () {
|
215 |
+
// enable header hover action
|
216 |
+
$('.sb_instagram_header').each(function () {
|
217 |
+
var $thisHeader = $(this);
|
218 |
+
$thisHeader.find('.sbi_header_link').hover(function () {
|
219 |
+
$thisHeader.find('.sbi_header_img_hover').addClass('sbi_fade_in');
|
220 |
+
}, function () {
|
221 |
+
$thisHeader.find('.sbi_header_img_hover').removeClass('sbi_fade_in');
|
222 |
+
});
|
223 |
+
});
|
224 |
+
|
225 |
+
},
|
226 |
+
encodeHTML: function(raw) {
|
227 |
+
// make sure passed variable is defined
|
228 |
+
if (typeof raw === 'undefined') {
|
229 |
+
return '';
|
230 |
+
}
|
231 |
+
// replace greater than and less than symbols with html entity to disallow html in comments
|
232 |
+
var encoded = raw.replace(/(>)/g,'>'),
|
233 |
+
encoded = encoded.replace(/(<)/g,'<');
|
234 |
+
encoded = encoded.replace(/(<br\/>)/g,'<br>');
|
235 |
+
encoded = encoded.replace(/(<br>)/g,'<br>');
|
236 |
+
|
237 |
+
return encoded;
|
238 |
+
},
|
239 |
+
urlDetect: function(text) {
|
240 |
+
var urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g;
|
241 |
+
return text.match(urlRegex);
|
242 |
+
}
|
243 |
+
};
|
244 |
+
|
245 |
+
function SbiFeed(el, index, settings) {
|
246 |
+
this.el = el;
|
247 |
+
this.index = index;
|
248 |
+
this.settings = settings;
|
249 |
+
this.minImageWidth = 0;
|
250 |
+
this.imageResolution = 150;
|
251 |
+
this.resizedImages = {};
|
252 |
+
this.needsResizing = [];
|
253 |
+
this.outOfPages = false;
|
254 |
+
this.isInitialized = false;
|
255 |
+
}
|
256 |
+
|
257 |
+
SbiFeed.prototype = {
|
258 |
+
init: function() {
|
259 |
+
var feed = this;
|
260 |
+
if ($(this.el).find('#sbi_mod_error').length) {
|
261 |
+
$(this.el).prepend($(this.el).find('#sbi_mod_error'));
|
262 |
+
}
|
263 |
+
if (this.settings.ajaxPostLoad) {
|
264 |
+
this.getNewPostSet();
|
265 |
+
} else {
|
266 |
+
this.afterInitialImagesLoaded();
|
267 |
+
//Only check the width once the resize event is over
|
268 |
+
}
|
269 |
+
var sbi_delay = (function () {
|
270 |
+
var sbi_timer = 0;
|
271 |
+
return function (sbi_callback, sbi_ms) {
|
272 |
+
clearTimeout(sbi_timer);
|
273 |
+
sbi_timer = setTimeout(sbi_callback, sbi_ms);
|
274 |
+
};
|
275 |
+
})();
|
276 |
+
jQuery(window).resize(function () {
|
277 |
+
sbi_delay(function () {
|
278 |
+
feed.afterResize();
|
279 |
+
}, 500);
|
280 |
+
});
|
281 |
+
|
282 |
+
},
|
283 |
+
initLayout: function() {
|
284 |
+
|
285 |
+
},
|
286 |
+
afterInitialImagesLoaded: function() {
|
287 |
+
this.initLayout();
|
288 |
+
this.loadMoreButtonInit();
|
289 |
+
this.hideExtraImagesForWidth();
|
290 |
+
this.beforeNewImagesRevealed();
|
291 |
+
this.revealNewImages();
|
292 |
+
this.afterNewImagesRevealed();
|
293 |
+
},
|
294 |
+
afterResize: function() {
|
295 |
+
this.setImageHeight();
|
296 |
+
this.setImageResolution();
|
297 |
+
this.maybeRaiseImageResolution();
|
298 |
+
this.setImageSizeClass();
|
299 |
+
},
|
300 |
+
afterLoadMoreClicked: function($button) {
|
301 |
+
$button.find('.sbi_loader').removeClass('sbi_hidden');
|
302 |
+
$button.find('.sbi_btn_text').addClass('sbi_hidden');
|
303 |
+
$button.closest('.sbi').find('.sbi_num_diff_hide').addClass('sbi_transition').removeClass('sbi_num_diff_hide');
|
304 |
+
},
|
305 |
+
afterNewImagesLoaded: function() {
|
306 |
+
var $self = $(this.el),
|
307 |
+
feed = this;
|
308 |
+
this.beforeNewImagesRevealed();
|
309 |
+
this.revealNewImages();
|
310 |
+
this.afterNewImagesRevealed();
|
311 |
+
setTimeout(function () {
|
312 |
+
//Hide the loader in the load more button
|
313 |
+
$self.find('.sbi_loader').addClass('sbi_hidden');
|
314 |
+
$self.find('.sbi_btn_text').removeClass('sbi_hidden');
|
315 |
+
feed.maybeRaiseImageResolution();
|
316 |
+
}, 500);
|
317 |
+
},
|
318 |
+
beforeNewImagesRevealed: function() {
|
319 |
+
this.setImageHeight();
|
320 |
+
this.maybeRaiseImageResolution(true);
|
321 |
+
this.setImageSizeClass();
|
322 |
+
},
|
323 |
+
revealNewImages: function() {
|
324 |
+
var $self = $(this.el),
|
325 |
+
feed = this;
|
326 |
+
|
327 |
+
$self.find('.sbi-screenreader').each(function() {
|
328 |
+
$(this).find('img').remove();
|
329 |
+
});
|
330 |
+
|
331 |
+
// Call Custom JS if it exists
|
332 |
+
if (typeof sbi_custom_js == 'function') setTimeout(function(){ sbi_custom_js(); }, 100);
|
333 |
+
|
334 |
+
this.applyImageLiquid();
|
335 |
+
$self.find('.sbi_item').each(function (index) {
|
336 |
+
var $self = jQuery(this);
|
337 |
+
|
338 |
+
//Photo links
|
339 |
+
//If lightbox is disabled
|
340 |
+
$self.find('.sbi_photo').hover(function () {
|
341 |
+
jQuery(this).fadeTo(200, 0.85);
|
342 |
+
}, function () {
|
343 |
+
jQuery(this).stop().fadeTo(500, 1);
|
344 |
+
});
|
345 |
+
|
346 |
+
}); //End .sbi_item each
|
347 |
+
|
348 |
+
//Remove the new class after 500ms, once the sorting is done
|
349 |
+
setTimeout(function () {
|
350 |
+
jQuery('#sbi_images .sbi_item.sbi_new').removeClass('sbi_new');
|
351 |
+
//Loop through items and remove class to reveal them
|
352 |
+
var time = 10;
|
353 |
+
$self.find('.sbi_transition').each(function() {
|
354 |
+
var $sbi_item_transition_el = jQuery(this);
|
355 |
+
|
356 |
+
setTimeout( function(){
|
357 |
+
$sbi_item_transition_el.removeClass('sbi_transition');
|
358 |
+
}, time);
|
359 |
+
time += 10;
|
360 |
+
});
|
361 |
+
}, 500);
|
362 |
+
},
|
363 |
+
afterNewImagesRevealed: function() {
|
364 |
+
this.listenForVisibilityChange();
|
365 |
+
this.sendNeedsResizingToServer();
|
366 |
+
if (!this.settings.imageLoadEnabled) {
|
367 |
+
$('.sbi_no_resraise').removeClass('sbi_no_resraise');
|
368 |
+
}
|
369 |
+
|
370 |
+
var evt = $.Event('sbiafterimagesloaded');
|
371 |
+
evt.el = $(this.el);
|
372 |
+
$(window).trigger(evt);
|
373 |
+
},
|
374 |
+
setResizedImages: function () {
|
375 |
+
if ($(this.el).find('.sbi_resized_image_data').length
|
376 |
+
&& typeof $(this.el).find('.sbi_resized_image_data').attr('data-resized') !== 'undefined'
|
377 |
+
&& $(this.el).find('.sbi_resized_image_data').attr('data-resized').indexOf('{"') === 0) {
|
378 |
+
this.resizedImages = JSON.parse($(this.el).find('.sbi_resized_image_data').attr('data-resized'));
|
379 |
+
$(this.el).find('.sbi_resized_image_data').remove();
|
380 |
+
}
|
381 |
+
},
|
382 |
+
sendNeedsResizingToServer: function() {
|
383 |
+
var feed = this;
|
384 |
+
if (feed.needsResizing.length > 0 && feed.settings.resizingEnabled) {
|
385 |
+
var itemOffset = $(this.el).find('.sbi_item').length;
|
386 |
+
|
387 |
+
var submitData = {
|
388 |
+
action: 'sbi_resized_images_submit',
|
389 |
+
needs_resizing: feed.needsResizing,
|
390 |
+
offset: itemOffset,
|
391 |
+
feed_id: feed.settings.feedID,
|
392 |
+
atts: feed.settings.shortCodeAtts,
|
393 |
+
};
|
394 |
+
var onSuccess = function(data) {
|
395 |
+
if (data.trim().indexOf('{') === 0) {
|
396 |
+
var response = JSON.parse(data);
|
397 |
+
if (feed.settings.debugEnabled) {
|
398 |
+
console.log(response);
|
399 |
+
}
|
400 |
+
}
|
401 |
+
};
|
402 |
+
sbiAjax(submitData,onSuccess);
|
403 |
+
}
|
404 |
+
},
|
405 |
+
loadMoreButtonInit: function () {
|
406 |
+
var $self = $(this.el),
|
407 |
+
feed = this;
|
408 |
+
$self.find('#sbi_load .sbi_load_btn').off().on('click', function () {
|
409 |
+
|
410 |
+
feed.afterLoadMoreClicked(jQuery(this));
|
411 |
+
feed.getNewPostSet();
|
412 |
+
|
413 |
+
}); //End click event
|
414 |
+
},
|
415 |
+
getNewPostSet: function () {
|
416 |
+
var $self = $(this.el),
|
417 |
+
feed = this;
|
418 |
+
var itemOffset = $self.find('.sbi_item').length,
|
419 |
+
submitData = {
|
420 |
+
action: 'sbi_load_more_clicked',
|
421 |
+
offset: itemOffset,
|
422 |
+
feed_id: feed.settings.feedID,
|
423 |
+
atts: feed.settings.shortCodeAtts,
|
424 |
+
current_resolution: feed.imageResolution
|
425 |
+
};
|
426 |
+
var onSuccess = function (data) {
|
427 |
+
if (data.trim().indexOf('{') === 0) {
|
428 |
+
var response = JSON.parse(data);
|
429 |
+
if (feed.settings.debugEnabled) {
|
430 |
+
console.log(response);
|
431 |
+
}
|
432 |
+
feed.appendNewPosts(response.html);
|
433 |
+
feed.addResizedImages(response.resizedImages);
|
434 |
+
if (feed.settings.ajaxPostLoad) {
|
435 |
+
feed.settings.ajaxPostLoad = false;
|
436 |
+
feed.afterInitialImagesLoaded();
|
437 |
+
} else {
|
438 |
+
feed.afterNewImagesLoaded();
|
439 |
+
}
|
440 |
+
|
441 |
+
if (!response.feedStatus.shouldPaginate) {
|
442 |
+
feed.outOfPages = true;
|
443 |
+
$self.find('.sbi_load_btn').hide();
|
444 |
+
} else {
|
445 |
+
feed.outOfPages = false;
|
446 |
+
}
|
447 |
+
$('.sbi_no_js').removeClass('sbi_no_js');
|
448 |
+
}
|
449 |
+
|
450 |
+
};
|
451 |
+
sbiAjax(submitData, onSuccess);
|
452 |
+
},
|
453 |
+
appendNewPosts: function (newPostsHtml) {
|
454 |
+
var $self = $(this.el),
|
455 |
+
feed = this;
|
456 |
+
if ($self.find('#sbi_images .sbi_item').length) {
|
457 |
+
$self.find('#sbi_images .sbi_item').last().after(newPostsHtml);
|
458 |
+
} else {
|
459 |
+
$self.find('#sbi_images').append(newPostsHtml);
|
460 |
+
}
|
461 |
+
},
|
462 |
+
addResizedImages: function (resizedImagesToAdd) {
|
463 |
+
for (var imageID in resizedImagesToAdd) {
|
464 |
+
this.resizedImages[imageID] = resizedImagesToAdd[imageID];
|
465 |
+
}
|
466 |
+
},
|
467 |
+
setImageHeight: function() {
|
468 |
+
var $self = $(this.el);
|
469 |
+
|
470 |
+
var sbi_photo_width = $self.find('.sbi_photo').eq(0).innerWidth();
|
471 |
+
|
472 |
+
//Figure out number of columns for either desktop or mobile
|
473 |
+
var sbi_num_cols = this.getColumnCount();
|
474 |
+
|
475 |
+
//Figure out what the width should be using the number of cols
|
476 |
+
//Figure out what the width should be using the number of cols
|
477 |
+
var imagesPadding = $self.find('#sbi_images').innerWidth() - $self.find('#sbi_images').width(),
|
478 |
+
imagepadding = imagesPadding / 2;
|
479 |
+
sbi_photo_width_manual = ( $self.find('#sbi_images').width() / sbi_num_cols ) - imagesPadding;
|
480 |
+
//If the width is less than it should be then set it manually
|
481 |
+
//if( sbi_photo_width <= (sbi_photo_width_manual) ) sbi_photo_width = sbi_photo_width_manual;
|
482 |
+
|
483 |
+
$self.find('.sbi_photo').css('height', sbi_photo_width);
|
484 |
+
|
485 |
+
//Set the position of the carousel arrows
|
486 |
+
if ($self.find('.sbi-owl-nav').length) {
|
487 |
+
setTimeout(function(){
|
488 |
+
//If there's 2 rows then adjust position
|
489 |
+
var sbi_ratio = 2;
|
490 |
+
if( $self.find('.sbi_owl2row-item').length ) sbi_ratio = 1;
|
491 |
+
|
492 |
+
var sbi_arrows_top = ($self.find('.sbi_photo').eq(0).innerWidth()/sbi_ratio);
|
493 |
+
sbi_arrows_top += parseInt(imagepadding)*(2+(2-sbi_ratio));
|
494 |
+
$self.find('.sbi-owl-nav div').css('top', sbi_arrows_top);
|
495 |
+
}, 100);
|
496 |
+
}
|
497 |
+
|
498 |
+
},
|
499 |
+
maybeRaiseSingleImageResolution: function ($item, index, forceChange) {
|
500 |
+
var feed = this,
|
501 |
+
imgSrcSet = feed.getImageUrls($item),
|
502 |
+
currentUrl = $item.find('.sbi_photo img').attr('src'),
|
503 |
+
currentRes = 150,
|
504 |
+
imagEl = $item.find('img').get(0),
|
505 |
+
aspectRatio = currentUrl === window.sbi.options.placeholder ? 1 : imagEl.naturalWidth/imagEl.naturalHeight,
|
506 |
+
forceChange = typeof forceChange !== 'undefined' ? forceChange : false;
|
507 |
+
|
508 |
+
if ($item.hasClass('sbi_no_resraise') || $item.hasClass('sbi_had_error') || ($item.find('.sbi_link_area').length && $item.find('.sbi_link_area').hasClass('sbi_had_error'))) {
|
509 |
+
return;
|
510 |
+
}
|
511 |
+
|
512 |
+
$.each(imgSrcSet, function (index, value) {
|
513 |
+
if (value === currentUrl) {
|
514 |
+
currentRes = parseInt(index);
|
515 |
+
// If the image has already been changed to an existing real source, don't force the change
|
516 |
+
forceChange = false;
|
517 |
+
}
|
518 |
+
});
|
519 |
+
//Image res
|
520 |
+
var newRes = 640;
|
521 |
+
switch (feed.settings.imgRes) {
|
522 |
+
case 'thumb':
|
523 |
+
newRes = 150;
|
524 |
+
break;
|
525 |
+
case 'medium':
|
526 |
+
newRes = 320;
|
527 |
+
break;
|
528 |
+
case 'full':
|
529 |
+
newRes = 640;
|
530 |
+
break;
|
531 |
+
default:
|
532 |
+
var minImageWidth = Math.max(feed.settings.autoMinRes,$item.find('.sbi_photo').innerWidth()),
|
533 |
+
thisImageReplace = feed.getBestResolutionForAuto(minImageWidth, aspectRatio, $item);
|
534 |
+
switch (thisImageReplace) {
|
535 |
+
case 320:
|
536 |
+
newRes = 320;
|
537 |
+
break;
|
538 |
+
case 150:
|
539 |
+
newRes = 150;
|
540 |
+
break;
|
541 |
+
}
|
542 |
+
break;
|
543 |
+
}
|
544 |
+
|
545 |
+
if (newRes > currentRes || currentUrl === window.sbi.options.placeholder || forceChange) {
|
546 |
+
if (feed.settings.debugEnabled) {
|
547 |
+
var reason = currentUrl === window.sbi.options.placeholder ? 'was placeholder' : 'too small';
|
548 |
+
console.log('rais res for ' + currentUrl, reason);
|
549 |
+
}
|
550 |
+
var newUrl = imgSrcSet[newRes].split("?ig_cache_key")[0];
|
551 |
+
$item.find('.sbi_photo img').attr('src', newUrl);
|
552 |
+
$item.find('.sbi_photo').css('background-image', 'url("' + newUrl + '")');
|
553 |
+
currentRes = newRes;
|
554 |
+
|
555 |
+
if (feed.settings.imgRes === 'auto') {
|
556 |
+
var checked = false;
|
557 |
+
$item.find('.sbi_photo img').on('load', function () {
|
558 |
+
|
559 |
+
var $this_image = $(this);
|
560 |
+
var newAspectRatio = ($this_image.get(0).naturalWidth / $this_image.get(0).naturalHeight);
|
561 |
+
|
562 |
+
if ($this_image.get(0).naturalWidth !== 1000 && newAspectRatio > aspectRatio && !checked) {
|
563 |
+
if (feed.settings.debugEnabled) {
|
564 |
+
console.log('rais res again for aspect ratio change ' + currentUrl);
|
565 |
+
}
|
566 |
+
checked = true;
|
567 |
+
minImageWidth = $item.find('.sbi_photo').innerWidth();
|
568 |
+
thisImageReplace = feed.getBestResolutionForAuto(minImageWidth, newAspectRatio, $item);
|
569 |
+
newRes = 640;
|
570 |
+
|
571 |
+
switch (thisImageReplace) {
|
572 |
+
case 320:
|
573 |
+
newRes = 320;
|
574 |
+
break;
|
575 |
+
case 150:
|
576 |
+
newRes = 150;
|
577 |
+
break;
|
578 |
+
}
|
579 |
+
|
580 |
+
if (newRes > currentRes) {
|
581 |
+
newUrl = imgSrcSet[newRes].split("?ig_cache_key")[0];
|
582 |
+
$this_image.attr('src', newUrl);
|
583 |
+
$this_image.closest('.sbi_photo').css('background-image', 'url("' + newUrl + '")');
|
584 |
+
}
|
585 |
+
if (feed.layout === 'masonry' || feed.layout === 'highlight') {
|
586 |
+
$(feed.el).find('#sbi_images').smashotope(feed.isotopeArgs);
|
587 |
+
setTimeout(function() {
|
588 |
+
$(feed.el).find('#sbi_images').smashotope(feed.isotopeArgs);
|
589 |
+
},500)
|
590 |
+
}
|
591 |
+
} else {
|
592 |
+
if (feed.settings.debugEnabled) {
|
593 |
+
var reason = checked ? 'already checked' : 'no aspect ratio change';
|
594 |
+
console.log('not raising res for replacement ' + currentUrl, reason);
|
595 |
+
}
|
596 |
+
}
|
597 |
+
});
|
598 |
+
}
|
599 |
+
|
600 |
+
|
601 |
+
}
|
602 |
+
|
603 |
+
$item.find('img').on('error', function () {
|
604 |
+
if (!$(this).hasClass('sbi_img_error')) {
|
605 |
+
$(this).addClass('sbi_img_error');
|
606 |
+
var sourceFromAPI = ($(this).attr('src').indexOf('media?size=') > -1 || $(this).attr('src').indexOf('cdninstagram') > -1 || $(this).attr('src').indexOf('fbcdn') > -1)
|
607 |
+
|
608 |
+
if (!sourceFromAPI) {
|
609 |
+
|
610 |
+
if ($(this).closest('.sbi_photo').attr('data-img-src-set') !== 'undefined') {
|
611 |
+
var srcSet = JSON.parse($(this).closest('.sbi_photo').attr('data-img-src-set').replace(/\\\//g, '/'));
|
612 |
+
if (typeof srcSet.d !== 'undefined') {
|
613 |
+
$(this).attr('src', srcSet.d);
|
614 |
+
$(this).closest('.sbi_photo').css('background-image', 'url(' + srcSet.d + ')');
|
615 |
+
$(this).closest('.sbi_item').addClass('sbi_had_error').find('.sbi_link_area').attr('href', srcSet[640]).addClass('sbi_had_error');
|
616 |
+
}
|
617 |
+
}
|
618 |
+
} else {
|
619 |
+
feed.settings.favorLocal = true;
|
620 |
+
var srcSet = feed.getImageUrls($(this).closest('.sbi_item'));
|
621 |
+
if (typeof srcSet[640] !== 'undefined') {
|
622 |
+
$(this).attr('src', srcSet[640]);
|
623 |
+
$(this).closest('.sbi_photo').css('background-image', 'url(' + srcSet[640] + ')');
|
624 |
+
$(this).closest('.sbi_item').addClass('sbi_had_error').find('.sbi_link_area').attr('href', srcSet[640]).addClass('sbi_had_error');
|
625 |
+
}
|
626 |
+
}
|
627 |
+
setTimeout(function() {
|
628 |
+
feed.afterResize();
|
629 |
+
}, 1500)
|
630 |
+
} else {
|
631 |
+
console.log('unfixed error ' + $(this).attr('src'));
|
632 |
+
}
|
633 |
+
});
|
634 |
+
},
|
635 |
+
maybeRaiseImageResolution: function (justNew) {
|
636 |
+
var feed = this,
|
637 |
+
itemsSelector = typeof justNew !== 'undefined' && justNew === true ? '.sbi_item.sbi_new' : '.sbi_item',
|
638 |
+
forceChange = !feed.isInitialized ? true : false;
|
639 |
+
$(feed.el).find(itemsSelector).each(function (index) {
|
640 |
+
if (!$(this).hasClass('sbi_num_diff_hide')
|
641 |
+
&& $(this).find('.sbi_photo').length
|
642 |
+
&& typeof $(this).find('.sbi_photo').attr('data-img-src-set') !== 'undefined') {
|
643 |
+
feed.maybeRaiseSingleImageResolution($(this),index,forceChange);
|
644 |
+
}
|
645 |
+
}); //End .sbi_item each
|
646 |
+
feed.isInitialized = true;
|
647 |
+
},
|
648 |
+
getBestResolutionForAuto: function(colWidth, aspectRatio, $item) {
|
649 |
+
if (isNaN(aspectRatio) || aspectRatio < 1) {
|
650 |
+
aspectRatio = 1;
|
651 |
+
}
|
652 |
+
var bestWidth = colWidth * aspectRatio,
|
653 |
+
bestWidthRounded = Math.ceil(bestWidth / 10) * 10,
|
654 |
+
customSizes = [150, 320, 640];
|
655 |
+
|
656 |
+
if ($item.hasClass('sbi_highlighted')) {
|
657 |
+
bestWidthRounded = bestWidthRounded *2;
|
658 |
+
}
|
659 |
+
|
660 |
+
if (customSizes.indexOf(parseInt(bestWidthRounded)) === -1) {
|
661 |
+
var done = false;
|
662 |
+
$.each(customSizes, function (index, item) {
|
663 |
+
if (item > parseInt(bestWidthRounded) && !done) {
|
664 |
+
bestWidthRounded = item;
|
665 |
+
|
666 |
+
done = true;
|
667 |
+
}
|
668 |
+
});
|
669 |
+
}
|
670 |
+
|
671 |
+
return bestWidthRounded;
|
672 |
+
},
|
673 |
+
hideExtraImagesForWidth: function() {
|
674 |
+
if (this.layout === 'carousel') {
|
675 |
+
return;
|
676 |
+
}
|
677 |
+
var $self = $(this.el),
|
678 |
+
num = typeof $self.attr('data-num') !== 'undefined' && $self.attr('data-num') !== '' ? parseInt($self.attr('data-num')) : 1,
|
679 |
+
nummobile = typeof $self.attr('data-nummobile') !== 'undefined' && $self.attr('data-nummobile') !== '' ? parseInt($self.attr('data-nummobile')) : num;
|
680 |
+
|
681 |
+
if ($(window).width() < 480) {
|
682 |
+
if (nummobile < $self.find('.sbi_item').length) {
|
683 |
+
$self.find('.sbi_item').slice(nummobile - $self.find('.sbi_item').length).addClass('sbi_num_diff_hide');
|
684 |
+
}
|
685 |
+
} else {
|
686 |
+
if (num < $self.find('.sbi_item').length) {
|
687 |
+
$self.find('.sbi_item').slice(num - $self.find('.sbi_item').length).addClass('sbi_num_diff_hide');
|
688 |
+
}
|
689 |
+
}
|
690 |
+
},
|
691 |
+
setImageSizeClass: function () {
|
692 |
+
var $self = $(this.el);
|
693 |
+
$self.removeClass('sbi_small sbi_medium');
|
694 |
+
var feedWidth = $self.innerWidth(),
|
695 |
+
photoPadding = parseInt(($self.find('#sbi_images').outerWidth() - $self.find('#sbi_images').width())) / 2,
|
696 |
+
cols = this.getColumnCount(),
|
697 |
+
feedWidthSansPadding = feedWidth - (photoPadding * (cols+2)),
|
698 |
+
colWidth = (feedWidthSansPadding / cols);
|
699 |
+
if (colWidth > 120 && colWidth < 240) {
|
700 |
+
$self.addClass('sbi_medium');
|
701 |
+
} else if (colWidth <= 120) {
|
702 |
+
$self.addClass('sbi_small');
|
703 |
+
}
|
704 |
+
},
|
705 |
+
setMinImageWidth: function () {
|
706 |
+
if ($(this.el).find('.sbi_item .sbi_photo').first().length) {
|
707 |
+
this.minImageWidth = $(this.el).find('.sbi_item .sbi_photo').first().innerWidth();
|
708 |
+
} else {
|
709 |
+
this.minImageWidth = 150;
|
710 |
+
}
|
711 |
+
},
|
712 |
+
setImageResolution: function () {
|
713 |
+
if (this.settings.imgRes === 'auto') {
|
714 |
+
this.imageResolution = 'auto';
|
715 |
+
} else {
|
716 |
+
switch (this.settings.imgRes) {
|
717 |
+
case 'thumb':
|
718 |
+
this.imageResolution = 150;
|
719 |
+
break;
|
720 |
+
case 'medium':
|
721 |
+
this.imageResolution = 320;
|
722 |
+
break;
|
723 |
+
default:
|
724 |
+
this.imageResolution = 640;
|
725 |
+
}
|
726 |
+
}
|
727 |
+
},
|
728 |
+
getImageUrls: function ($item) {
|
729 |
+
var srcSet = JSON.parse($item.find('.sbi_photo').attr('data-img-src-set').replace(/\\\//g, '/')),
|
730 |
+
id = $item.attr('id').replace('sbi_', '');
|
731 |
+
if (typeof this.resizedImages[id] !== 'undefined'
|
732 |
+
&& this.resizedImages[id] !== 'video'
|
733 |
+
&& this.resizedImages[id] !== 'pending'
|
734 |
+
&& this.resizedImages[id].id !== 'error'
|
735 |
+
&& this.resizedImages[id].id !== 'video'
|
736 |
+
&& this.resizedImages[id].id !== 'pending') {
|
737 |
+
|
738 |
+
if (typeof this.resizedImages[id]['sizes'] !== 'undefined') {
|
739 |
+
var foundSizes = [];
|
740 |
+
if (typeof this.resizedImages[id]['sizes']['full'] !== 'undefined') {
|
741 |
+
srcSet[640] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'full.jpg';
|
742 |
+
foundSizes.push(640);
|
743 |
+
}
|
744 |
+
if (typeof this.resizedImages[id]['sizes']['low'] !== 'undefined') {
|
745 |
+
srcSet[320] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'low.jpg';
|
746 |
+
foundSizes.push(320);
|
747 |
+
}
|
748 |
+
if (typeof this.resizedImages[id]['sizes']['thumb'] !== 'undefined') {
|
749 |
+
foundSizes.push(150);
|
750 |
+
srcSet[150] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'thumb.jpg';
|
751 |
+
}
|
752 |
+
if (this.settings.favorLocal) {
|
753 |
+
if (foundSizes.indexOf(640) === -1) {
|
754 |
+
if (foundSizes.indexOf(320) > -1) {
|
755 |
+
srcSet[640] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'low.jpg';
|
756 |
+
}
|
757 |
+
}
|
758 |
+
if (foundSizes.indexOf(320) === -1) {
|
759 |
+
if (foundSizes.indexOf(640) > -1) {
|
760 |
+
srcSet[320] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'full.jpg';
|
761 |
+
} else if (foundSizes.indexOf(150) > -1) {
|
762 |
+
srcSet[320] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'thumb.jpg';
|
763 |
+
}
|
764 |
+
}
|
765 |
+
if (foundSizes.indexOf(150) === -1) {
|
766 |
+
if (foundSizes.indexOf(320) > -1) {
|
767 |
+
srcSet[150] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'low.jpg';
|
768 |
+
} else if (foundSizes.indexOf(640) > -1) {
|
769 |
+
srcSet[150] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'full.jpg';
|
770 |
+
}
|
771 |
+
}
|
772 |
+
}
|
773 |
+
}
|
774 |
+
} else if (typeof this.resizedImages[id] === 'undefined'
|
775 |
+
|| (typeof this.resizedImages[id]['id'] !== 'undefined' && this.resizedImages[id]['id'] !== 'pending' && this.resizedImages[id]['id'] !== 'error')) {
|
776 |
+
this.addToNeedsResizing(id);
|
777 |
+
}
|
778 |
+
|
779 |
+
return srcSet;
|
780 |
+
},
|
781 |
+
getAvatarUrl: function (username,favorType) {
|
782 |
+
if (username === '') {
|
783 |
+
return '';
|
784 |
+
}
|
785 |
+
|
786 |
+
var availableAvatars = this.settings.general.avatars,
|
787 |
+
favorType = typeof favorType !== 'undefined' ? favorType : 'local';
|
788 |
+
|
789 |
+
if (favorType === 'local') {
|
790 |
+
if (typeof availableAvatars['LCL'+username] !== 'undefined' && parseInt(availableAvatars['LCL'+username]) === 1) {
|
791 |
+
return sb_instagram_js_options.resized_url + username + '.jpg';
|
792 |
+
} else if (typeof availableAvatars[username] !== 'undefined') {
|
793 |
+
return availableAvatars[username];
|
794 |
+
} else {
|
795 |
+
return '';
|
796 |
+
}
|
797 |
+
} else {
|
798 |
+
if (typeof availableAvatars[username] !== 'undefined') {
|
799 |
+
return availableAvatars[username];
|
800 |
+
} else if (typeof availableAvatars['LCL'+username] !== 'undefined' && parseInt(availableAvatars['LCL'+username]) === 1) {
|
801 |
+
return sb_instagram_js_options.resized_url + username + '.jpg';
|
802 |
+
} else {
|
803 |
+
return '';
|
804 |
+
}
|
805 |
+
}
|
806 |
+
},
|
807 |
+
addToNeedsResizing: function (id) {
|
808 |
+
if (this.needsResizing.indexOf(id) === -1) {
|
809 |
+
this.needsResizing.push(id);
|
810 |
+
}
|
811 |
+
},
|
812 |
+
applyImageLiquid: function () {
|
813 |
+
var $self = $(this.el),
|
814 |
+
feed = this;
|
815 |
+
sbiAddImgLiquid();
|
816 |
+
if (typeof $self.find(".sbi_photo").sbi_imgLiquid == 'function') {
|
817 |
+
$self.find(".sbi_photo").sbi_imgLiquid({fill: true});
|
818 |
+
}
|
819 |
+
},
|
820 |
+
listenForVisibilityChange: function() {
|
821 |
+
var feed = this;
|
822 |
+
sbiAddVisibilityListener();
|
823 |
+
if (typeof $(this.el).filter(':hidden').sbiVisibilityChanged == 'function') {
|
824 |
+
//If the feed is initially hidden (in a tab for example) then check for when it becomes visible and set then set the height
|
825 |
+
$(this.el).filter(':hidden').sbiVisibilityChanged({
|
826 |
+
callback: function (element, visible) {
|
827 |
+
feed.afterResize();
|
828 |
+
},
|
829 |
+
runOnLoad: false
|
830 |
+
});
|
831 |
+
}
|
832 |
+
},
|
833 |
+
getColumnCount: function() {
|
834 |
+
var $self = $(this.el),
|
835 |
+
cols = this.settings.cols,
|
836 |
+
colsmobile = this.settings.colsmobile,
|
837 |
+
returnCols = cols;
|
838 |
+
|
839 |
+
sbiWindowWidth = window.innerWidth;
|
840 |
+
|
841 |
+
if ($self.hasClass('sbi_mob_col_auto')) {
|
842 |
+
if (sbiWindowWidth < 640 && (parseInt(cols) > 2 && parseInt(cols) < 7)) returnCols = 2;
|
843 |
+
if (sbiWindowWidth < 640 && (parseInt(cols) > 6 && parseInt(cols) < 11)) returnCols = 4;
|
844 |
+
if (sbiWindowWidth <= 480 && parseInt(cols) > 2) returnCols = 1;
|
845 |
+
} else if (sbiWindowWidth <= 480) {
|
846 |
+
returnCols = colsmobile;
|
847 |
+
}
|
848 |
+
|
849 |
+
return parseInt(returnCols);
|
850 |
+
}
|
851 |
+
};
|
852 |
+
|
853 |
+
window.sbi_init = function() {
|
854 |
+
window.sbi = new Sbi();
|
855 |
+
window.sbi.createPage( window.sbi.createFeeds, {whenFeedsCreated: window.sbi.afterFeedsCreated});
|
856 |
+
};
|
857 |
+
|
858 |
+
function sbiGetNewFeed(feed,index,feedOptions) {
|
859 |
+
return new SbiFeed(feed,index,feedOptions);
|
860 |
+
}
|
861 |
+
|
862 |
+
function sbiAjax(submitData,onSuccess) {
|
863 |
+
$.ajax({
|
864 |
+
url: sbiajaxurl,
|
865 |
+
type: 'post',
|
866 |
+
data: submitData,
|
867 |
+
success: onSuccess
|
868 |
+
});
|
869 |
+
}
|
870 |
+
|
871 |
+
})(jQuery);
|
872 |
+
|
873 |
+
jQuery(document).ready(function($) {
|
874 |
+
if (typeof window.sb_instagram_js_options === 'undefined') {
|
875 |
+
window.sb_instagram_js_options = {
|
876 |
+
font_method: "svg",
|
877 |
+
resized_url: location.protocol + '//' + window.location.hostname + "/wp-content/uploads/sb-instagram-feed-images/",
|
878 |
+
placeholder: location.protocol + '//' + window.location.hostname + "/wp-content/plugins/instagram-feed/img/placeholder.png"
|
879 |
+
};
|
880 |
+
}
|
881 |
+
if (typeof window.sb_instagram_js_options.resized_url !== 'undefined' && window.sb_instagram_js_options.resized_url.indexOf(location.protocol) === -1) {
|
882 |
+
if (location.protocol === 'http:') {
|
883 |
+
window.sb_instagram_js_options.resized_url = window.sb_instagram_js_options.resized_url.replace('https:','http:');
|
884 |
+
} else {
|
885 |
+
window.sb_instagram_js_options.resized_url = window.sb_instagram_js_options.resized_url.replace('http:','https:');
|
886 |
+
}
|
887 |
+
}
|
888 |
+
sbi_init();
|
889 |
+
});
|
890 |
+
|
891 |
+
} // if sbi_js_exists
|
js/sb-instagram-2-2.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
var sbi_js_exists=void 0!==sbi_js_exists;sbi_js_exists||(!function(i){function e(){var i,e,s,t=t||{VER:"0.9.944"};t.bgs_Available=!1,t.bgs_CheckRunned=!1,function(i){i.fn.extend({sbi_imgLiquid:function(e){this.defaults={fill:!0,verticalAlign:"center",horizontalAlign:"center",useBackgroundSize:!0,useDataHtmlAttr:!0,responsive:!0,delay:0,fadeInTime:0,removeBoxBackground:!0,hardPixels:!0,responsiveCheckTime:500,timecheckvisibility:500,onStart:null,onFinish:null,onItemStart:null,onItemFinish:null,onItemError:null},function(){if(!t.bgs_CheckRunned){t.bgs_CheckRunned=!0;var e=i('<span style="background-size:cover" />');i("body").append(e),function(){var i=e[0];if(i&&window.getComputedStyle){var s=window.getComputedStyle(i,null);s&&s.backgroundSize&&(t.bgs_Available="cover"===s.backgroundSize)}}(),e.remove()}}();var s=this;return this.options=e,this.settings=i.extend({},this.defaults,this.options),this.settings.onStart&&this.settings.onStart(),this.each(function(e){function a(){(r.responsive||h.data("sbi_imgLiquid_oldProcessed"))&&h.data("sbi_imgLiquid_settings")&&(r=h.data("sbi_imgLiquid_settings"),l.actualSize=l.get(0).offsetWidth+l.get(0).offsetHeight/1e4,l.sizeOld&&l.actualSize!==l.sizeOld&&o(),l.sizeOld=l.actualSize,setTimeout(a,r.responsiveCheckTime))}function n(){h.data("sbi_imgLiquid_error",!0),l.addClass("sbi_imgLiquid_error"),r.onItemError&&r.onItemError(e,l,h),d()}function o(){var i,s,t,a,n,o,g,u,m=0,_=0,f=l.width(),c=l.height();void 0===h.data("owidth")&&h.data("owidth",h[0].width),void 0===h.data("oheight")&&h.data("oheight",h[0].height),r.fill===f/c>=h.data("owidth")/h.data("oheight")?(i="100%",s="auto",t=Math.floor(f),a=Math.floor(f*(h.data("oheight")/h.data("owidth")))):(i="auto",s="100%",t=Math.floor(c*(h.data("owidth")/h.data("oheight"))),a=Math.floor(c)),g=f-t,"left"===(n=r.horizontalAlign.toLowerCase())&&(_=0),"center"===n&&(_=.5*g),"right"===n&&(_=g),-1!==n.indexOf("%")&&((n=parseInt(n.replace("%",""),10))>0&&(_=g*n*.01)),u=c-a,"left"===(o=r.verticalAlign.toLowerCase())&&(m=0),"center"===o&&(m=.5*u),"bottom"===o&&(m=u),-1!==o.indexOf("%")&&((o=parseInt(o.replace("%",""),10))>0&&(m=u*o*.01)),r.hardPixels&&(i=t,s=a),h.css({width:i,height:s,"margin-left":Math.floor(_),"margin-top":Math.floor(m)}),h.data("sbi_imgLiquid_oldProcessed")||(h.fadeTo(r.fadeInTime,1),h.data("sbi_imgLiquid_oldProcessed",!0),r.removeBoxBackground&&l.css("background-image","none"),l.addClass("sbi_imgLiquid_nobgSize"),l.addClass("sbi_imgLiquid_ready")),r.onItemFinish&&r.onItemFinish(e,l,h),d()}function d(){e===s.length-1&&s.settings.onFinish&&s.settings.onFinish()}var r=s.settings,l=i(this),h=i("img:first",l);return h.length?(h.data("sbi_imgLiquid_settings")?(l.removeClass("sbi_imgLiquid_error").removeClass("sbi_imgLiquid_ready"),r=i.extend({},h.data("sbi_imgLiquid_settings"),s.options)):r=i.extend({},s.settings,function(){var i={};if(s.settings.useDataHtmlAttr){var e=l.attr("data-sbi_imgLiquid-fill"),a=l.attr("data-sbi_imgLiquid-horizontalAlign"),n=l.attr("data-sbi_imgLiquid-verticalAlign");("true"===e||"false"===e)&&(i.fill=Boolean("true"===e)),void 0===a||"left"!==a&&"center"!==a&&"right"!==a&&-1===a.indexOf("%")||(i.horizontalAlign=a),void 0===n||"top"!==n&&"bottom"!==n&&"center"!==n&&-1===n.indexOf("%")||(i.verticalAlign=n)}return t.isIE&&s.settings.ieFadeInDisabled&&(i.fadeInTime=0),i}()),h.data("sbi_imgLiquid_settings",r),r.onItemStart&&r.onItemStart(e,l,h),void(t.bgs_Available&&r.useBackgroundSize?(-1===l.css("background-image").indexOf(encodeURI(h.attr("src")))&&l.css({"background-image":'url("'+encodeURI(h.attr("src"))+'")'}),l.css({"background-size":r.fill?"cover":"contain","background-position":(r.horizontalAlign+" "+r.verticalAlign).toLowerCase(),"background-repeat":"no-repeat"}),i("a:first",l).css({display:"block",width:"100%",height:"100%"}),i("img",l).css({display:"none"}),r.onItemFinish&&r.onItemFinish(e,l,h),l.addClass("sbi_imgLiquid_bgSize"),l.addClass("sbi_imgLiquid_ready"),d()):function s(){if(h.data("oldSrc")&&h.data("oldSrc")!==h.attr("src")){var t=h.clone().removeAttr("style");return t.data("sbi_imgLiquid_settings",h.data("sbi_imgLiquid_settings")),h.parent().prepend(t),h.remove(),(h=t)[0].width=0,void setTimeout(s,10)}return h.data("sbi_imgLiquid_oldProcessed")?void o():(h.data("sbi_imgLiquid_oldProcessed",!1),h.data("oldSrc",h.attr("src")),i("img:not(:first)",l).css("display","none"),l.css({overflow:"hidden"}),h.fadeTo(0,0).removeAttr("width").removeAttr("height").css({visibility:"visible","max-width":"none","max-height":"none",width:"auto",height:"auto",display:"block"}),h.on("error",n),h[0].onerror=n,function i(){h.data("sbi_imgLiquid_error")||h.data("sbi_imgLiquid_loaded")||h.data("sbi_imgLiquid_oldProcessed")||(l.is(":visible")&&h[0].complete&&h[0].width>0&&h[0].height>0?(h.data("sbi_imgLiquid_loaded",!0),setTimeout(o,e*r.delay)):setTimeout(i,r.timecheckvisibility))}(),void a())}())):void n()})}})}(jQuery),i=t.injectCss,e=document.getElementsByTagName("head")[0],(s=document.createElement("style")).type="text/css",s.styleSheet?s.styleSheet.cssText=i:s.appendChild(document.createTextNode(i)),e.appendChild(s)}function s(){this.feeds={},this.options=sb_instagram_js_options}function t(i,e,s){this.el=i,this.index=e,this.settings=s,this.minImageWidth=0,this.imageResolution=150,this.resizedImages={},this.needsResizing=[],this.outOfPages=!1,this.isInitialized=!1}function a(e,s){i.ajax({url:sbiajaxurl,type:"post",data:e,success:s})}s.prototype={createPage:function(e,s){void 0!==window.sbiajaxurl&&-1!==window.sbiajaxurl.indexOf(window.location.hostname)||(window.sbiajaxurl=location.protocol+"//"+window.location.hostname+"/wp-admin/admin-ajax.php"),i(".sbi_no_js_error_message").remove(),i(".sbi_no_js").removeClass("sbi_no_js"),e(s)},createFeeds:function(e){e.whenFeedsCreated(i(".sbi").each(function(e){i(this).attr("data-sbi-index",e+1);var s=i(this),n=void 0!==s.attr("data-sbi-flags")?s.attr("data-sbi-flags").split(","):[],o=void 0!==s.attr("data-options")?JSON.parse(s.attr("data-options")):{};if(n.indexOf("testAjax")>-1){window.sbi.triggeredTest=!0;a({action:"sbi_on_ajax_test_trigger"},function(i){console.log("did test")})}var d={cols:s.attr("data-cols"),colsmobile:"same"!==s.attr("data-colsmobile")?s.attr("data-colsmobile"):s.attr("data-cols"),num:s.attr("data-num"),imgRes:s.attr("data-res"),feedID:s.attr("data-feedid"),shortCodeAtts:s.attr("data-shortcode-atts"),resizingEnabled:-1===n.indexOf("resizeDisable"),imageLoadEnabled:-1===n.indexOf("imageLoadDisable"),debugEnabled:n.indexOf("debug")>-1,favorLocal:n.indexOf("favorLocal")>-1,ajaxPostLoad:n.indexOf("ajaxPostLoad")>-1,autoMinRes:1,general:o};window.sbi.feeds[e]=function(i,e,s){return new t(i,e,s)}(this,e,d),window.sbi.feeds[e].setResizedImages(),window.sbi.feeds[e].init();var r=jQuery.Event("sbiafterfeedcreate");r.feed=window.sbi.feeds[e],jQuery(window).trigger(r)}))},afterFeedsCreated:function(){i(".sb_instagram_header").each(function(){var e=i(this);e.find(".sbi_header_link").hover(function(){e.find(".sbi_header_img_hover").addClass("sbi_fade_in")},function(){e.find(".sbi_header_img_hover").removeClass("sbi_fade_in")})})},encodeHTML:function(i){return void 0===i?"":i.replace(/(>)/g,">").replace(/(<)/g,"<").replace(/(<br\/>)/g,"<br>").replace(/(<br>)/g,"<br>")},urlDetect:function(i){return i.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/g)}},t.prototype={init:function(){var e=this;i(this.el).find("#sbi_mod_error").length&&i(this.el).prepend(i(this.el).find("#sbi_mod_error")),this.settings.ajaxPostLoad?this.getNewPostSet():this.afterInitialImagesLoaded();var s,t=(s=0,function(i,e){clearTimeout(s),s=setTimeout(i,e)});jQuery(window).resize(function(){t(function(){e.afterResize()},500)})},initLayout:function(){},afterInitialImagesLoaded:function(){this.initLayout(),this.loadMoreButtonInit(),this.hideExtraImagesForWidth(),this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed()},afterResize:function(){this.setImageHeight(),this.setImageResolution(),this.maybeRaiseImageResolution(),this.setImageSizeClass()},afterLoadMoreClicked:function(i){i.find(".sbi_loader").removeClass("sbi_hidden"),i.find(".sbi_btn_text").addClass("sbi_hidden"),i.closest(".sbi").find(".sbi_num_diff_hide").addClass("sbi_transition").removeClass("sbi_num_diff_hide")},afterNewImagesLoaded:function(){var e=i(this.el),s=this;this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed(),setTimeout(function(){e.find(".sbi_loader").addClass("sbi_hidden"),e.find(".sbi_btn_text").removeClass("sbi_hidden"),s.maybeRaiseImageResolution()},500)},beforeNewImagesRevealed:function(){this.setImageHeight(),this.maybeRaiseImageResolution(!0),this.setImageSizeClass()},revealNewImages:function(){var e=i(this.el);e.find(".sbi-screenreader").each(function(){i(this).find("img").remove()}),"function"==typeof sbi_custom_js&&setTimeout(function(){sbi_custom_js()},100),this.applyImageLiquid(),e.find(".sbi_item").each(function(i){jQuery(this).find(".sbi_photo").hover(function(){jQuery(this).fadeTo(200,.85)},function(){jQuery(this).stop().fadeTo(500,1)})}),setTimeout(function(){jQuery("#sbi_images .sbi_item.sbi_new").removeClass("sbi_new");var i=10;e.find(".sbi_transition").each(function(){var e=jQuery(this);setTimeout(function(){e.removeClass("sbi_transition")},i),i+=10})},500)},afterNewImagesRevealed:function(){this.listenForVisibilityChange(),this.sendNeedsResizingToServer(),this.settings.imageLoadEnabled||i(".sbi_no_resraise").removeClass("sbi_no_resraise");var e=i.Event("sbiafterimagesloaded");e.el=i(this.el),i(window).trigger(e)},setResizedImages:function(){i(this.el).find(".sbi_resized_image_data").length&&void 0!==i(this.el).find(".sbi_resized_image_data").attr("data-resized")&&0===i(this.el).find(".sbi_resized_image_data").attr("data-resized").indexOf('{"')&&(this.resizedImages=JSON.parse(i(this.el).find(".sbi_resized_image_data").attr("data-resized")),i(this.el).find(".sbi_resized_image_data").remove())},sendNeedsResizingToServer:function(){var e=this;if(e.needsResizing.length>0&&e.settings.resizingEnabled){var s=i(this.el).find(".sbi_item").length;a({action:"sbi_resized_images_submit",needs_resizing:e.needsResizing,offset:s,feed_id:e.settings.feedID,atts:e.settings.shortCodeAtts},function(i){if(0===i.trim().indexOf("{")){var s=JSON.parse(i);e.settings.debugEnabled&&console.log(s)}})}},loadMoreButtonInit:function(){var e=i(this.el),s=this;e.find("#sbi_load .sbi_load_btn").off().on("click",function(){s.afterLoadMoreClicked(jQuery(this)),s.getNewPostSet()})},getNewPostSet:function(){var e=i(this.el),s=this;a({action:"sbi_load_more_clicked",offset:e.find(".sbi_item").length,feed_id:s.settings.feedID,atts:s.settings.shortCodeAtts,current_resolution:s.imageResolution},function(t){if(0===t.trim().indexOf("{")){var a=JSON.parse(t);s.settings.debugEnabled&&console.log(a),s.appendNewPosts(a.html),s.addResizedImages(a.resizedImages),s.settings.ajaxPostLoad?(s.settings.ajaxPostLoad=!1,s.afterInitialImagesLoaded()):s.afterNewImagesLoaded(),a.feedStatus.shouldPaginate?s.outOfPages=!1:(s.outOfPages=!0,e.find(".sbi_load_btn").hide()),i(".sbi_no_js").removeClass("sbi_no_js")}})},appendNewPosts:function(e){var s=i(this.el);s.find("#sbi_images .sbi_item").length?s.find("#sbi_images .sbi_item").last().after(e):s.find("#sbi_images").append(e)},addResizedImages:function(i){for(var e in i)this.resizedImages[e]=i[e]},setImageHeight:function(){var e=i(this.el),s=e.find(".sbi_photo").eq(0).innerWidth(),t=this.getColumnCount(),a=e.find("#sbi_images").innerWidth()-e.find("#sbi_images").width(),n=a/2;sbi_photo_width_manual=e.find("#sbi_images").width()/t-a,e.find(".sbi_photo").css("height",s),e.find(".sbi-owl-nav").length&&setTimeout(function(){var i=2;e.find(".sbi_owl2row-item").length&&(i=1);var s=e.find(".sbi_photo").eq(0).innerWidth()/i;s+=parseInt(n)*(2-i+2),e.find(".sbi-owl-nav div").css("top",s)},100)},maybeRaiseSingleImageResolution:function(e,s,t){var a=this,n=a.getImageUrls(e),o=e.find(".sbi_photo img").attr("src"),d=150,r=e.find("img").get(0),l=o===window.sbi.options.placeholder?1:r.naturalWidth/r.naturalHeight;t=void 0!==t&&t;if(!(e.hasClass("sbi_no_resraise")||e.hasClass("sbi_had_error")||e.find(".sbi_link_area").length&&e.find(".sbi_link_area").hasClass("sbi_had_error"))){i.each(n,function(i,e){e===o&&(d=parseInt(i),t=!1)});var h=640;switch(a.settings.imgRes){case"thumb":h=150;break;case"medium":h=320;break;case"full":h=640;break;default:var g=Math.max(a.settings.autoMinRes,e.find(".sbi_photo").innerWidth()),u=a.getBestResolutionForAuto(g,l,e);switch(u){case 320:h=320;break;case 150:h=150}}if(h>d||o===window.sbi.options.placeholder||t){if(a.settings.debugEnabled){var m=o===window.sbi.options.placeholder?"was placeholder":"too small";console.log("rais res for "+o,m)}var _=n[h].split("?ig_cache_key")[0];if(e.find(".sbi_photo img").attr("src",_),e.find(".sbi_photo").css("background-image",'url("'+_+'")'),d=h,"auto"===a.settings.imgRes){var f=!1;e.find(".sbi_photo img").on("load",function(){var s=i(this),t=s.get(0).naturalWidth/s.get(0).naturalHeight;if(1e3!==s.get(0).naturalWidth&&t>l&&!f){switch(a.settings.debugEnabled&&console.log("rais res again for aspect ratio change "+o),f=!0,g=e.find(".sbi_photo").innerWidth(),u=a.getBestResolutionForAuto(g,t,e),h=640,u){case 320:h=320;break;case 150:h=150}h>d&&(_=n[h].split("?ig_cache_key")[0],s.attr("src",_),s.closest(".sbi_photo").css("background-image",'url("'+_+'")')),"masonry"!==a.layout&&"highlight"!==a.layout||(i(a.el).find("#sbi_images").smashotope(a.isotopeArgs),setTimeout(function(){i(a.el).find("#sbi_images").smashotope(a.isotopeArgs)},500))}else if(a.settings.debugEnabled){var r=f?"already checked":"no aspect ratio change";console.log("not raising res for replacement "+o,r)}})}}e.find("img").on("error",function(){if(i(this).hasClass("sbi_img_error"))console.log("unfixed error "+i(this).attr("src"));else{var e;if(i(this).addClass("sbi_img_error"),i(this).attr("src").indexOf("media?size=")>-1||i(this).attr("src").indexOf("cdninstagram")>-1||i(this).attr("src").indexOf("fbcdn")>-1)a.settings.favorLocal=!0,void 0!==(e=a.getImageUrls(i(this).closest(".sbi_item")))[640]&&(i(this).attr("src",e[640]),i(this).closest(".sbi_photo").css("background-image","url("+e[640]+")"),i(this).closest(".sbi_item").addClass("sbi_had_error").find(".sbi_link_area").attr("href",e[640]).addClass("sbi_had_error"));else if("undefined"!==i(this).closest(".sbi_photo").attr("data-img-src-set"))void 0!==(e=JSON.parse(i(this).closest(".sbi_photo").attr("data-img-src-set").replace(/\\\//g,"/"))).d&&(i(this).attr("src",e.d),i(this).closest(".sbi_photo").css("background-image","url("+e.d+")"),i(this).closest(".sbi_item").addClass("sbi_had_error").find(".sbi_link_area").attr("href",e[640]).addClass("sbi_had_error"));setTimeout(function(){a.afterResize()},1500)}})}},maybeRaiseImageResolution:function(e){var s=this,t=void 0!==e&&!0===e?".sbi_item.sbi_new":".sbi_item",a=!s.isInitialized;i(s.el).find(t).each(function(e){!i(this).hasClass("sbi_num_diff_hide")&&i(this).find(".sbi_photo").length&&void 0!==i(this).find(".sbi_photo").attr("data-img-src-set")&&s.maybeRaiseSingleImageResolution(i(this),e,a)}),s.isInitialized=!0},getBestResolutionForAuto:function(e,s,t){(isNaN(s)||s<1)&&(s=1);var a=e*s,n=10*Math.ceil(a/10),o=[150,320,640];if(t.hasClass("sbi_highlighted")&&(n*=2),-1===o.indexOf(parseInt(n))){var d=!1;i.each(o,function(i,e){e>parseInt(n)&&!d&&(n=e,d=!0)})}return n},hideExtraImagesForWidth:function(){if("carousel"!==this.layout){var e=i(this.el),s=void 0!==e.attr("data-num")&&""!==e.attr("data-num")?parseInt(e.attr("data-num")):1,t=void 0!==e.attr("data-nummobile")&&""!==e.attr("data-nummobile")?parseInt(e.attr("data-nummobile")):s;i(window).width()<480?t<e.find(".sbi_item").length&&e.find(".sbi_item").slice(t-e.find(".sbi_item").length).addClass("sbi_num_diff_hide"):s<e.find(".sbi_item").length&&e.find(".sbi_item").slice(s-e.find(".sbi_item").length).addClass("sbi_num_diff_hide")}},setImageSizeClass:function(){var e=i(this.el);e.removeClass("sbi_small sbi_medium");var s=e.innerWidth(),t=parseInt(e.find("#sbi_images").outerWidth()-e.find("#sbi_images").width())/2,a=this.getColumnCount(),n=(s-t*(a+2))/a;n>120&&n<240?e.addClass("sbi_medium"):n<=120&&e.addClass("sbi_small")},setMinImageWidth:function(){i(this.el).find(".sbi_item .sbi_photo").first().length?this.minImageWidth=i(this.el).find(".sbi_item .sbi_photo").first().innerWidth():this.minImageWidth=150},setImageResolution:function(){if("auto"===this.settings.imgRes)this.imageResolution="auto";else switch(this.settings.imgRes){case"thumb":this.imageResolution=150;break;case"medium":this.imageResolution=320;break;default:this.imageResolution=640}},getImageUrls:function(i){var e=JSON.parse(i.find(".sbi_photo").attr("data-img-src-set").replace(/\\\//g,"/")),s=i.attr("id").replace("sbi_","");if(void 0!==this.resizedImages[s]&&"video"!==this.resizedImages[s]&&"pending"!==this.resizedImages[s]&&"error"!==this.resizedImages[s].id&&"video"!==this.resizedImages[s].id&&"pending"!==this.resizedImages[s].id){if(void 0!==this.resizedImages[s].sizes){var t=[];void 0!==this.resizedImages[s].sizes.full&&(e[640]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"full.jpg",t.push(640)),void 0!==this.resizedImages[s].sizes.low&&(e[320]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"low.jpg",t.push(320)),void 0!==this.resizedImages[s].sizes.thumb&&(t.push(150),e[150]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"thumb.jpg"),this.settings.favorLocal&&(-1===t.indexOf(640)&&t.indexOf(320)>-1&&(e[640]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"low.jpg"),-1===t.indexOf(320)&&(t.indexOf(640)>-1?e[320]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"full.jpg":t.indexOf(150)>-1&&(e[320]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"thumb.jpg")),-1===t.indexOf(150)&&(t.indexOf(320)>-1?e[150]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"low.jpg":t.indexOf(640)>-1&&(e[150]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"full.jpg")))}}else(void 0===this.resizedImages[s]||void 0!==this.resizedImages[s].id&&"pending"!==this.resizedImages[s].id&&"error"!==this.resizedImages[s].id)&&this.addToNeedsResizing(s);return e},getAvatarUrl:function(i,e){if(""===i)return"";var s=this.settings.general.avatars;return"local"===(e=void 0!==e?e:"local")?void 0!==s["LCL"+i]&&1===parseInt(s["LCL"+i])?sb_instagram_js_options.resized_url+i+".jpg":void 0!==s[i]?s[i]:"":void 0!==s[i]?s[i]:void 0!==s["LCL"+i]&&1===parseInt(s["LCL"+i])?sb_instagram_js_options.resized_url+i+".jpg":""},addToNeedsResizing:function(i){-1===this.needsResizing.indexOf(i)&&this.needsResizing.push(i)},applyImageLiquid:function(){var s=i(this.el);e(),"function"==typeof s.find(".sbi_photo").sbi_imgLiquid&&s.find(".sbi_photo").sbi_imgLiquid({fill:!0})},listenForVisibilityChange:function(){var e,s,t,a=this;e=jQuery,s={callback:function(){},runOnLoad:!0,frequency:100,sbiPreviousVisibility:null},t={sbiCheckVisibility:function(i,e){if(jQuery.contains(document,i[0])){var s=e.sbiPreviousVisibility,a=i.is(":visible");e.sbiPreviousVisibility=a,null==s?e.runOnLoad&&e.callback(i,a):s!==a&&e.callback(i,a),setTimeout(function(){t.sbiCheckVisibility(i,e)},e.frequency)}}},e.fn.sbiVisibilityChanged=function(i){var a=e.extend({},s,i);return this.each(function(){t.sbiCheckVisibility(e(this),a)})},"function"==typeof i(this.el).filter(":hidden").sbiVisibilityChanged&&i(this.el).filter(":hidden").sbiVisibilityChanged({callback:function(i,e){a.afterResize()},runOnLoad:!1})},getColumnCount:function(){var e=i(this.el),s=this.settings.cols,t=this.settings.colsmobile,a=s;return sbiWindowWidth=window.innerWidth,e.hasClass("sbi_mob_col_auto")?(sbiWindowWidth<640&&parseInt(s)>2&&parseInt(s)<7&&(a=2),sbiWindowWidth<640&&parseInt(s)>6&&parseInt(s)<11&&(a=4),sbiWindowWidth<=480&&parseInt(s)>2&&(a=1)):sbiWindowWidth<=480&&(a=t),parseInt(a)}},window.sbi_init=function(){window.sbi=new s,window.sbi.createPage(window.sbi.createFeeds,{whenFeedsCreated:window.sbi.afterFeedsCreated})}}(jQuery),jQuery(document).ready(function(i){void 0===window.sb_instagram_js_options&&(window.sb_instagram_js_options={font_method:"svg",resized_url:location.protocol+"//"+window.location.hostname+"/wp-content/uploads/sb-instagram-feed-images/",placeholder:location.protocol+"//"+window.location.hostname+"/wp-content/plugins/instagram-feed/img/placeholder.png"}),void 0!==window.sb_instagram_js_options.resized_url&&-1===window.sb_instagram_js_options.resized_url.indexOf(location.protocol)&&("http:"===location.protocol?window.sb_instagram_js_options.resized_url=window.sb_instagram_js_options.resized_url.replace("http:","https:"):window.sb_instagram_js_options.resized_url=window.sb_instagram_js_options.resized_url.replace("https:","http:")),sbi_init()}));
|
js/sb-instagram-admin-2-2.js
ADDED
@@ -0,0 +1,961 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($) {
|
2 |
+
|
3 |
+
/* NEW API CODE */
|
4 |
+
$('.sbi_admin_btn, .sbi_reconnect').click(function(event) {
|
5 |
+
event.preventDefault();
|
6 |
+
|
7 |
+
var today = new Date(),
|
8 |
+
march = new Date('March 3, 2020 00:00:00'),
|
9 |
+
oldApiURL = $(this).attr('data-old-api'),
|
10 |
+
oldApiLink = '';
|
11 |
+
if (today.getTime() < march.getTime()) {
|
12 |
+
oldApiLink = 'To connect using the legacy API, <a href="'+oldApiURL+'">click here</a> (expires on March 2, 2020).';
|
13 |
+
}
|
14 |
+
|
15 |
+
var personalBasicApiURL = $('#sbi_config .sbi_admin_btn').attr('data-personal-basic-api'),
|
16 |
+
newApiURL = $('#sbi_config .sbi_admin_btn').attr('data-new-api');
|
17 |
+
$('#sbi_config').append('<div id="sbi_config_info" class="sb_get_token">' +
|
18 |
+
'<div class="sbi_config_modal">' +
|
19 |
+
'<p>Are you connecting a Personal or Business Instagram Profile?</p>' +
|
20 |
+
'<div class="sbi_login_button_row">' +
|
21 |
+
'<input type="radio" id="sbi_basic_login" name="sbi_login_type" value="basic" checked>' +
|
22 |
+
'<label for="sbi_basic_login"><b>Personal</b> <a href="JavaScript:void(0);" class="sbi_tooltip_link"><i class="fa fa-question-circle"></i></a><div class="sbi_tooltip">Used for displaying user feeds from a "Personal" Instagram account. ' +
|
23 |
+
oldApiLink +
|
24 |
+
'</div></div>' +
|
25 |
+
'<div class="sbi_login_button_row">' +
|
26 |
+
'<input type="radio" id="sbi_business_login" name="sbi_login_type" value="business">' +
|
27 |
+
|
28 |
+
'<label for="sbi_business_login"><b>Business</b> </label> <a href="JavaScript:void(0);" class="sbi_tooltip_link"><i class="fa fa-question-circle"></i></a><div class="sbi_tooltip">Used for displaying a user feed from a "Business" or "Creator" Instagram account. A Business or Creator account is required for displaying automatic avatar/bio display in the header. See <a href="https://smashballoon.com/instagram-business-profiles" target="_blank">this FAQ</a> for more info.</div>' +
|
29 |
+
'</div>' +
|
30 |
+
|
31 |
+
'<div class="sbi_login_button_row"><a href="JavaScript:void(0);" class="sbi_tooltip_link" style="font-size: 12px;">I\'m not sure</a><div class="sbi_tooltip" style="display: none;"><p style="margin-top: 0;">The "Personal" option can display feeds from either a Personal or Business/Creator account.</p><p style="margin-bottom: 0;"">Connecting as a Business account will allow your avatar and bio in feed headers to update automatically. If needed, you can convert a Personal account into a Business account by following the directions <a href="https://smashballoon.com/instagram-business-profiles" target="_blank">here</a>.</p></div></div>' +
|
32 |
+
|
33 |
+
'<a href="'+personalBasicApiURL+'" class="sbi_admin_btn">Connect</a>' +
|
34 |
+
'<a href="JavaScript:void(0);"><i class="sbi_modal_close fa fa-times"></i></a>' +
|
35 |
+
'</div>' +
|
36 |
+
'</div>');
|
37 |
+
|
38 |
+
$('.sbi_modal_close').on('click', function(){
|
39 |
+
$('#sbi_config_info').remove();
|
40 |
+
});
|
41 |
+
|
42 |
+
$('input[name=sbi_login_type]').change(function() {
|
43 |
+
if ($('input[name=sbi_login_type]:checked').val() === 'business') {
|
44 |
+
$('a.sbi_admin_btn').attr('href',newApiURL);
|
45 |
+
} else {
|
46 |
+
$('a.sbi_admin_btn').attr('href',personalBasicApiURL);
|
47 |
+
}
|
48 |
+
});
|
49 |
+
});
|
50 |
+
|
51 |
+
if ($('.sbi_config_modal .sbi-managed-pages').length) {
|
52 |
+
$('#sbi_config').append($('#sbi_config_info'));
|
53 |
+
}
|
54 |
+
|
55 |
+
$('#sbi-select-all').change(function() {
|
56 |
+
var status = $(this).is(':checked');
|
57 |
+
$('.sbi-add-checkbox input').each(function() {
|
58 |
+
$(this).attr('checked',status);
|
59 |
+
});
|
60 |
+
if($('.sbi-add-checkbox input:checked').length) {
|
61 |
+
$('#sbi-connect-business-accounts').removeAttr('disabled');
|
62 |
+
} else {
|
63 |
+
$('#sbi-connect-business-accounts').attr('disabled',true);
|
64 |
+
}
|
65 |
+
});
|
66 |
+
|
67 |
+
$('.sbi-add-checkbox input').change(function() {
|
68 |
+
if($('.sbi-add-checkbox input:checked').length) {
|
69 |
+
$('#sbi-connect-business-accounts').removeAttr('disabled');
|
70 |
+
} else {
|
71 |
+
$('#sbi-connect-business-accounts').attr('disabled',true);
|
72 |
+
}
|
73 |
+
});
|
74 |
+
|
75 |
+
$('#sbi-connect-business-accounts').click(function(event) {
|
76 |
+
if(typeof $(this).attr('disabled') === 'undefined') {
|
77 |
+
event.preventDefault();
|
78 |
+
var accounts = {};
|
79 |
+
$('.sbi-add-checkbox input').each(function(index) {
|
80 |
+
if ($(this).is(':checked')) {
|
81 |
+
var jsonSubmit = JSON.parse($(this).val());
|
82 |
+
jsonSubmit.access_token = $(this).closest('.sbi-managed-page').attr('data-token');
|
83 |
+
jsonSubmit.page_access_token = $(this).closest('.sbi-managed-page').attr('data-page-token');
|
84 |
+
accounts[index] = jsonSubmit;
|
85 |
+
}
|
86 |
+
});
|
87 |
+
|
88 |
+
$('.sbi_connected_accounts_wrap,#sbi_config_info').fadeTo("slow" , 0.5);
|
89 |
+
jQuery.ajax({
|
90 |
+
url: sbiA.ajax_url,
|
91 |
+
type: 'post',
|
92 |
+
data: {
|
93 |
+
action: 'sbi_connect_business_accounts',
|
94 |
+
accounts: JSON.stringify(accounts),
|
95 |
+
sbi_nonce: sbiA.sbi_nonce
|
96 |
+
},
|
97 |
+
success: function (data) {
|
98 |
+
if (data.trim().indexOf('{') === 0) {
|
99 |
+
var connectedAccounts = JSON.parse(data);
|
100 |
+
$('.sbi_connected_accounts_wrap').fadeTo("slow" , 1);
|
101 |
+
$('#sbi_config_info').remove();
|
102 |
+
$.each(connectedAccounts,function(index,savedToken) {
|
103 |
+
console.log(savedToken);
|
104 |
+
sbiAfterUpdateToken(savedToken,false);
|
105 |
+
|
106 |
+
});
|
107 |
+
}
|
108 |
+
|
109 |
+
}
|
110 |
+
});
|
111 |
+
}
|
112 |
+
|
113 |
+
});
|
114 |
+
|
115 |
+
$('.sbi_modal_close').on('click', function(){
|
116 |
+
$('#sbi_config_info').remove();
|
117 |
+
});
|
118 |
+
/* NEW API CODE */
|
119 |
+
//Autofill the token and id
|
120 |
+
var hash = window.location.hash,
|
121 |
+
token = hash.substring(14),
|
122 |
+
id = token.split('.')[0];
|
123 |
+
|
124 |
+
if (token.length > 40 && $('.sbi_admin_btn').length) {
|
125 |
+
$('.sbi_admin_btn').css('opacity','.5').after('<div class="spinner" style="visibility: visible; position: relative;float: left;margin-top: 15px;"></div>');
|
126 |
+
jQuery.ajax({
|
127 |
+
url: sbiA.ajax_url,
|
128 |
+
type: 'post',
|
129 |
+
data: {
|
130 |
+
action: 'sbi_after_connection',
|
131 |
+
access_token: token,
|
132 |
+
},
|
133 |
+
success: function (data) {
|
134 |
+
if (data.indexOf('{') === 0) {
|
135 |
+
var accountInfo = JSON.parse(data);
|
136 |
+
if (typeof accountInfo.error_message === 'undefined') {
|
137 |
+
accountInfo.token = token;
|
138 |
+
|
139 |
+
$('.sbi_admin_btn').css('opacity','1');
|
140 |
+
$('#sbi_config').find('.spinner').remove();
|
141 |
+
if (!$('.sbi_connected_account ').length) {
|
142 |
+
$('.sbi_no_accounts').remove();
|
143 |
+
sbSaveToken(token,true);
|
144 |
+
} else {
|
145 |
+
var buttonText = 'Connect This Account';
|
146 |
+
// if the account is connected, offer to update in case information has changed.
|
147 |
+
if ($('#sbi_connected_account_'+id).length) {
|
148 |
+
buttonText = 'Update This Account';
|
149 |
+
}
|
150 |
+
$('#sbi_config').append('<div id="sbi_config_info" class="sb_get_token">' +
|
151 |
+
'<div class="sbi_config_modal">' +
|
152 |
+
'<img class="sbi_ca_avatar" src="'+accountInfo.profile_picture+'" />' +
|
153 |
+
'<div class="sbi_ca_username"><strong>'+accountInfo.username+'</strong></div>' +
|
154 |
+
'<p class="sbi_submit"><input type="submit" name="sbi_submit" id="sbi_connect_account" class="button button-primary" value="'+buttonText+'">' +
|
155 |
+
'<a href="JavaScript:void(0);" class="button button-secondary" id="sbi_switch_accounts">Switch Accounts</a></p>' +
|
156 |
+
'<a href="JavaScript:void(0);"><i class="sbi_modal_close fa fa-times"></i></a>' +
|
157 |
+
'</div>' +
|
158 |
+
'</div>');
|
159 |
+
|
160 |
+
$('#sbi_connect_account').click(function(event) {
|
161 |
+
event.preventDefault();
|
162 |
+
$('#sbi_config_info').fadeOut(200);
|
163 |
+
sbSaveToken(token,false);
|
164 |
+
});
|
165 |
+
|
166 |
+
sbiSwitchAccounts();
|
167 |
+
}
|
168 |
+
} else {
|
169 |
+
$('.sbi_admin_btn').css('opacity','1');
|
170 |
+
$('#sbi_config').find('.spinner').remove();
|
171 |
+
var message = accountInfo.error_message;
|
172 |
+
|
173 |
+
$('#sbi_config').append('<div id="sbi_config_info" class="sb_get_token">' +
|
174 |
+
'<div class="sbi_config_modal">' +
|
175 |
+
'<p>'+message+'</p>' +
|
176 |
+
'<p class="sbi_submit"><a href="JavaScript:void(0);" class="button button-secondary" id="sbi_switch_accounts">Switch Accounts</a></p>' +
|
177 |
+
'<a href="JavaScript:void(0);"><i class="sbi_modal_close fa fa-times"></i></a>' +
|
178 |
+
'</div>' +
|
179 |
+
'</div>');
|
180 |
+
|
181 |
+
sbiSwitchAccounts();
|
182 |
+
}
|
183 |
+
|
184 |
+
} else {
|
185 |
+
$('.sbi_admin_btn').css('opacity','1');
|
186 |
+
$('#sbi_config').find('.spinner').remove();
|
187 |
+
var message = 'There was an error connecting your account';
|
188 |
+
|
189 |
+
$('#sbi_config').append('<div id="sbi_config_info" class="sb_get_token">' +
|
190 |
+
'<div class="sbi_config_modal">' +
|
191 |
+
'<p>'+message+'</p>' +
|
192 |
+
'<p class="sbi_submit"><a href="JavaScript:void(0);" class="button button-secondary" id="sbi_switch_accounts">Switch Accounts</a></p>' +
|
193 |
+
'<a href="JavaScript:void(0);"><i class="sbi_modal_close fa fa-times"></i></a>' +
|
194 |
+
'</div>' +
|
195 |
+
'</div>');
|
196 |
+
|
197 |
+
sbiSwitchAccounts();
|
198 |
+
}
|
199 |
+
|
200 |
+
}
|
201 |
+
});
|
202 |
+
|
203 |
+
window.location.hash = '';
|
204 |
+
}
|
205 |
+
function sbiSwitchAccounts(){
|
206 |
+
$('#sbi_switch_accounts').on('click', function(){
|
207 |
+
//Log user out of Instagram by hitting the logout URL in an iframe
|
208 |
+
$('body').append('<iframe style="display: none;" src="https://www.instagram.com/accounts/logout"></iframe>');
|
209 |
+
|
210 |
+
$(this).text('Please wait...').after('<div class="spinner" style="visibility: visible; float: none; margin: -3px 0 0 3px;"></div>');
|
211 |
+
|
212 |
+
//Wait a couple seconds for the logout to occur, then connect a new account
|
213 |
+
setTimeout(function(){
|
214 |
+
window.location.href = $('.sbi_admin_btn').attr('href');
|
215 |
+
}, 2000);
|
216 |
+
});
|
217 |
+
|
218 |
+
$('.sbi_modal_close').on('click', function(){
|
219 |
+
$('#sbi_config_info').remove();
|
220 |
+
});
|
221 |
+
}
|
222 |
+
if ($('#sbi_switch_accounts').length) {
|
223 |
+
$('.sbi_admin_btn').attr('href',$('#sbi_config .sbi_admin_btn').attr('data-personal-basic-api'));
|
224 |
+
sbiSwitchAccounts();
|
225 |
+
}
|
226 |
+
|
227 |
+
function sbiAfterUpdateToken(savedToken,saveID){
|
228 |
+
if (saveID) {
|
229 |
+
sbSaveID(savedToken.user_id);
|
230 |
+
$('.sbi_user_feed_ids_wrap').prepend(
|
231 |
+
'<div id="sbi_user_feed_id_'+savedToken.user_id+'" class="sbi_user_feed_account_wrap">'+
|
232 |
+
'<strong>'+savedToken.username+'</strong> <span>('+savedToken.user_id+')</span>' +
|
233 |
+
'<input type="hidden" name="sb_instagram_user_id[]" value="'+savedToken.user_id+'">' +
|
234 |
+
'</div>'
|
235 |
+
);
|
236 |
+
}
|
237 |
+
if (typeof savedToken.old_user_id !== 'undefined' && $('#sbi_connected_account_'+savedToken.old_user_id).length) {
|
238 |
+
|
239 |
+
if ($('#sbi_user_feed_id_'+savedToken.old_user_id).length) {
|
240 |
+
$('.sbi_user_feed_ids_wrap').prepend(
|
241 |
+
'<div id="sbi_user_feed_id_'+savedToken.user_id+'" class="sbi_user_feed_account_wrap">'+
|
242 |
+
'<strong>'+savedToken.username+'</strong> <span>('+savedToken.user_id+')</span>' +
|
243 |
+
'<input type="hidden" name="sb_instagram_user_id[]" value="'+savedToken.user_id+'">' +
|
244 |
+
'</div>'
|
245 |
+
);
|
246 |
+
$('#sbi_user_feed_id_'+savedToken.old_user_id).remove();
|
247 |
+
|
248 |
+
saveID = true;
|
249 |
+
}
|
250 |
+
|
251 |
+
$('#sbi_connected_account_'+savedToken.old_user_id).remove();
|
252 |
+
}
|
253 |
+
if ($('#sbi_connected_account_'+savedToken.user_id).length) {
|
254 |
+
if (savedToken.is_valid) {
|
255 |
+
$('#sbi_connected_account_'+savedToken.user_id).addClass('sbi_account_updated');
|
256 |
+
} else {
|
257 |
+
$('#sbi_connected_account_'+savedToken.user_id).addClass('sbi_account_invalid');
|
258 |
+
}
|
259 |
+
$('#sbi_connected_account_'+savedToken.user_id).attr('data-accesstoken',savedToken.access_token);
|
260 |
+
if (typeof savedToken.use_tagged !== 'undefined' && savedToken.use_tagged == '1') {
|
261 |
+
$('#sbi_connected_account_'+savedToken.user_id).attr('data-permissions','tagged');
|
262 |
+
$('#sbi_connected_account_'+savedToken.user_id).find('.sbi_permissions_desc').text('All');
|
263 |
+
}
|
264 |
+
|
265 |
+
if (! $('#sbi_connected_account_'+savedToken.user_id + ' .sbi_ca_avatar').length) {
|
266 |
+
if (savedToken.profile_picture !== '') {
|
267 |
+
$('#sbi_connected_account_'+savedToken.user_id + ' .sbi_ca_username').prepend('<img class="sbi_ca_avatar" src="'+savedToken.profile_picture+'">');
|
268 |
+
}
|
269 |
+
}
|
270 |
+
$('#sbi_connected_account_'+savedToken.user_id + ' .sbi_ca_username').find('span').text(sbiAccountType(savedToken.type));
|
271 |
+
|
272 |
+
$('#sbi_connected_account_'+savedToken.user_id).find('.sbi_ca_accesstoken .sbi_ca_token').text(savedToken.access_token);
|
273 |
+
$('#sbi_connected_account_'+savedToken.user_id).find('.sbi_tooltip code').text('[instagram-feed accesstoken="'+savedToken.access_token+'"]');
|
274 |
+
|
275 |
+
} else {
|
276 |
+
//Check which kind of account it is
|
277 |
+
if(typeof savedToken.type !== 'undefined'){
|
278 |
+
var accountType = savedToken.type;
|
279 |
+
$('.sbi_hashtag_feed_issue').removeClass('sbi_hashtag_feed_issue').find('.sbi_hashtag_feed_issue_note').hide();
|
280 |
+
} else {
|
281 |
+
var accountType = 'personal';
|
282 |
+
}
|
283 |
+
|
284 |
+
var avatarHTML = '';
|
285 |
+
if (savedToken.profile_picture !== '') {
|
286 |
+
avatarHTML = '<img class="sbi_ca_avatar" src="'+savedToken.profile_picture+'" />';
|
287 |
+
}
|
288 |
+
|
289 |
+
//Add the account HTML to the page
|
290 |
+
var removeOrSaveHTML = saveID ? '<a href="JavaScript:void(0);" class="sbi_remove_from_user_feed button-primary"><i class="fa fa-minus-circle" aria-hidden="true"></i>Remove from Primary Feed</a>' : '<a href="JavaScript:void(0);" class="sbi_use_in_user_feed button-primary"><i class="fa fa-plus-circle" aria-hidden="true"></i>Add to Primary Feed</a>',
|
291 |
+
statusClass = saveID ? 'sbi_account_active' : 'sbi_account_updated',
|
292 |
+
html = '<div class="sbi_connected_account '+statusClass+' sbi-init-click-remove" id="sbi_connected_account_'+savedToken.user_id+'" data-accesstoken="'+savedToken.access_token+'" data-userid="'+savedToken.user_id+'" data-username="'+savedToken.username+'">'+
|
293 |
+
'<div class="sbi_ca_info">'+
|
294 |
+
|
295 |
+
'<div class="sbi_ca_delete">'+
|
296 |
+
'<a href="JavaScript:void(0);" class="sbi_delete_account"><i class="fa fa-times"></i><span class="sbi_remove_text">Remove</span></a>'+
|
297 |
+
'</div>'+
|
298 |
+
|
299 |
+
'<div class="sbi_ca_username">'+
|
300 |
+
avatarHTML+
|
301 |
+
'<strong>'+savedToken.username+'<span>'+sbiAccountType(accountType)+'</span></strong>'+
|
302 |
+
'</div>'+
|
303 |
+
|
304 |
+
'<div class="sbi_ca_actions">'+
|
305 |
+
removeOrSaveHTML +
|
306 |
+
'<a class="sbi_ca_token_shortcode button-secondary" href="JavaScript:void(0);"><i class="fa fa-chevron-circle-right" aria-hidden="true"></i>Add to another Feed</a>'+
|
307 |
+
'<a class="sbi_ca_show_token button-secondary" href="JavaScript:void(0);" title="Show access token and account info"><i class="fa fa-cog"></i></a>'+
|
308 |
+
'</div>'+
|
309 |
+
|
310 |
+
'<div class="sbi_ca_shortcode">'+
|
311 |
+
'<p>Copy and paste this shortcode into your page or widget area:<br>'+
|
312 |
+
'<code>[instagram-feed user="'+savedToken.username+'"]</code>'+
|
313 |
+
'</p>'+
|
314 |
+
'<p>To add multiple users in the same feed, simply separate them using commas:<br>'+
|
315 |
+
'<code>[instagram-feed user="'+savedToken.username+', a_second_user, a_third_user"]</code>'+
|
316 |
+
'<p>Click on the <a href="?page=sb-instagram-feed&tab=display" target="_blank">Display Your Feed</a> tab to learn more about shortcodes</p>'+
|
317 |
+
'</div>'+
|
318 |
+
|
319 |
+
'<div class="sbi_ca_accesstoken">' +
|
320 |
+
'<span class="sbi_ca_token_label">Access Token:</span><input type="text" class="sbi_ca_token" value="'+savedToken.access_token+'" readonly="readonly" onclick="this.focus();this.select()" title="To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)."><br>' +
|
321 |
+
'<span class="sbi_ca_token_label">User ID:</span><input type="text" class="sbi_ca_user_id" value="'+savedToken.user_id+'" readonly="readonly" onclick="this.focus();this.select()" title="To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)."><br>' +
|
322 |
+
'<span class="sbi_ca_token_label">Permissions:</span><span class="sbi_permissions_desc">All</span>' +
|
323 |
+
'</div>' +
|
324 |
+
|
325 |
+
'</div>'+
|
326 |
+
'</div>';
|
327 |
+
$('.sbi_connected_accounts_wrap').prepend(html);
|
328 |
+
var $clickRemove = $('.sbi-init-click-remove');
|
329 |
+
sbiInitClickRemove($clickRemove.find('.sbi_delete_account'));
|
330 |
+
if ($clickRemove.find('.sbi_remove_from_user_feed').length ) {
|
331 |
+
$clickRemove.find('.sbi_remove_from_user_feed').off();
|
332 |
+
sbiInitUserRemove($clickRemove.find('.sbi_remove_from_user_feed'));
|
333 |
+
} else {
|
334 |
+
$clickRemove.find('.sbi_use_in_user_feed').off();
|
335 |
+
sbiInitUserAdd($clickRemove.find('.sbi_use_in_user_feed'));
|
336 |
+
}
|
337 |
+
$clickRemove.removeClass('sbi-init-click-remove');
|
338 |
+
}
|
339 |
+
}
|
340 |
+
|
341 |
+
function sbSaveToken(token,saveID) {
|
342 |
+
$('.sbi_connected_accounts_wrap').fadeTo("slow" , 0.5);
|
343 |
+
jQuery.ajax({
|
344 |
+
url: sbiA.ajax_url,
|
345 |
+
type: 'post',
|
346 |
+
data: {
|
347 |
+
action: 'sbi_auto_save_tokens',
|
348 |
+
access_token: token,
|
349 |
+
just_tokens: true,
|
350 |
+
sbi_nonce: sbiA.sbi_nonce
|
351 |
+
},
|
352 |
+
success: function (data) {
|
353 |
+
var savedToken = JSON.parse(data);
|
354 |
+
$('.sbi_connected_accounts_wrap').fadeTo("slow" , 1);
|
355 |
+
sbiAfterUpdateToken(savedToken,saveID);
|
356 |
+
}
|
357 |
+
});
|
358 |
+
}
|
359 |
+
|
360 |
+
function sbiAccountType(accountType) {
|
361 |
+
if (accountType === 'basic') {
|
362 |
+
return 'personal (new API)';
|
363 |
+
}
|
364 |
+
return accountType;
|
365 |
+
}
|
366 |
+
|
367 |
+
function sbSaveID(ID) {
|
368 |
+
jQuery.ajax({
|
369 |
+
url: sbiA.ajax_url,
|
370 |
+
type: 'post',
|
371 |
+
data: {
|
372 |
+
action: 'sbi_auto_save_id',
|
373 |
+
id: ID,
|
374 |
+
just_tokens: true,
|
375 |
+
sbi_nonce: sbiA.sbi_nonce
|
376 |
+
},
|
377 |
+
success: function (data) {
|
378 |
+
}
|
379 |
+
});
|
380 |
+
}
|
381 |
+
|
382 |
+
// connect accounts
|
383 |
+
//sbi-bus-account-error
|
384 |
+
if (window.location.hash && window.location.hash === '#test') {
|
385 |
+
window.location.hash = '';
|
386 |
+
$('#sbi-bus-account-error').html('<p style="margin-top: 5px;"><b style="font-size: 16px">Couldn\'t connect an account with this access token</b><br />' +
|
387 |
+
'Please check to make sure that the token you entered is correct.</p>')
|
388 |
+
}
|
389 |
+
|
390 |
+
$('.sbi_manually_connect_wrap').hide();
|
391 |
+
$('.sbi_manually_connect').click(function(event) {
|
392 |
+
event.preventDefault();
|
393 |
+
if ( $('.sbi_manually_connect_wrap').is(':visible') ) {
|
394 |
+
$('.sbi_manually_connect_wrap').slideUp(200);
|
395 |
+
} else {
|
396 |
+
$('.sbi_manually_connect_wrap').slideDown(200);
|
397 |
+
$('#sb_manual_at').focus();
|
398 |
+
}
|
399 |
+
});
|
400 |
+
|
401 |
+
$('#sb_manual_at').on('input',function() {
|
402 |
+
sbiToggleManualAccountIDInput();
|
403 |
+
});
|
404 |
+
if ($('#sb_manual_at').length){
|
405 |
+
sbiToggleManualAccountIDInput();
|
406 |
+
}
|
407 |
+
|
408 |
+
function sbiIsBusinessToken() {
|
409 |
+
return ($('#sb_manual_at').val().trim().length > 125);
|
410 |
+
}
|
411 |
+
|
412 |
+
function sbiToggleManualAccountIDInput() {
|
413 |
+
if (sbiIsBusinessToken()) {
|
414 |
+
$('.sbi_manual_account_id_toggle').slideDown();
|
415 |
+
$('.sbi_business_profile_tag').css('display', 'inline-block');
|
416 |
+
} else {
|
417 |
+
$('.sbi_manual_account_id_toggle').slideUp();
|
418 |
+
}
|
419 |
+
}
|
420 |
+
|
421 |
+
var $body = $('body');
|
422 |
+
$body.on('click', '.sbi_test_token, .sbi_ca_token_shortcode', function (event) {
|
423 |
+
event.preventDefault();
|
424 |
+
var $clicked = $(event.target),
|
425 |
+
accessToken = $clicked.closest('.sbi_connected_account').attr('data-accesstoken'),
|
426 |
+
action = false,
|
427 |
+
atParts = accessToken.split('.'),
|
428 |
+
username = $clicked.closest('.sbi_connected_account').attr('data-username'),
|
429 |
+
accountID = $clicked.closest('.sbi_connected_account').attr('data-userid');
|
430 |
+
if ($clicked.hasClass('sbi_ca_token_shortcode')) {
|
431 |
+
jQuery(this).closest('.sbi_ca_info').find('.sbi_ca_shortcode').slideToggle(200);
|
432 |
+
} //
|
433 |
+
|
434 |
+
});
|
435 |
+
|
436 |
+
$('.sbi_delete_account').each(function() {
|
437 |
+
sbiInitClickRemove($(this));
|
438 |
+
});
|
439 |
+
|
440 |
+
function sbiInitClickRemove(el) {
|
441 |
+
el.click(function() {
|
442 |
+
if (!$(this).closest('.sbi_connected_accounts_wrap').hasClass('sbi-waiting')) {
|
443 |
+
$(this).closest('.sbi_connected_accounts_wrap').addClass('sbi-waiting');
|
444 |
+
var accessToken = $(this).closest('.sbi_connected_account').attr('data-accesstoken'),
|
445 |
+
action = false,
|
446 |
+
atParts = accessToken.split('.'),
|
447 |
+
username = $(this).closest('.sbi_connected_account').attr('data-username'),
|
448 |
+
accountID = $(this).closest('.sbi_connected_account').attr('data-userid');
|
449 |
+
|
450 |
+
if (window.confirm("Delete this connected account?")) {
|
451 |
+
action = 'sbi_delete_account';
|
452 |
+
$('#sbi_user_feed_id_' + accountID).remove();
|
453 |
+
$('#sbi_tagged_feed_id_' + accountID).remove();
|
454 |
+
$('#sbi_connected_account_' + accountID).append('<div class="spinner" style="margin-top: -10px;visibility: visible;top: 50%;position: absolute;right: 50%;"></div>').find('.sbi_ca_info').css('opacity','.5');
|
455 |
+
|
456 |
+
jQuery.ajax({
|
457 |
+
url: sbiA.ajax_url,
|
458 |
+
type: 'post',
|
459 |
+
data: {
|
460 |
+
action: action,
|
461 |
+
account_id: accountID,
|
462 |
+
sbi_nonce: sbiA.sbi_nonce
|
463 |
+
},
|
464 |
+
success: function (data) {
|
465 |
+
$('.sbi-waiting').removeClass('sbi-waiting');
|
466 |
+
$('#sbi_connected_account_' + accountID).fadeOut(300, function() { $(this).remove(); });
|
467 |
+
}
|
468 |
+
});
|
469 |
+
} else {
|
470 |
+
$('.sbi-waiting').removeClass('sbi-waiting');
|
471 |
+
}
|
472 |
+
}
|
473 |
+
|
474 |
+
});
|
475 |
+
}
|
476 |
+
|
477 |
+
$('.sbi_remove_from_user_feed').each(function() {
|
478 |
+
sbiInitUserRemove($(this));
|
479 |
+
});
|
480 |
+
|
481 |
+
function sbiInitUserRemove(el,targetClass) {
|
482 |
+
el.click(function(event) {
|
483 |
+
event.preventDefault();
|
484 |
+
targetClass = $('input[name=sb_instagram_type]:checked').val();
|
485 |
+
|
486 |
+
var $clicked = $(this),
|
487 |
+
accountID = $clicked.closest('.sbi_connected_account').attr('data-userid');
|
488 |
+
|
489 |
+
$('#sbi_'+targetClass+'_feed_id_'+accountID).remove();
|
490 |
+
|
491 |
+
sbiConAccountsAddRemoveUpdater();
|
492 |
+
});
|
493 |
+
}
|
494 |
+
|
495 |
+
|
496 |
+
|
497 |
+
$('.sbi_use_in_user_feed').each(function() {
|
498 |
+
sbiInitUserAdd($(this), 'user');
|
499 |
+
});
|
500 |
+
|
501 |
+
function sbiInitUserAdd(el,targetClass) {
|
502 |
+
el.click(function(event) {
|
503 |
+
targetClass = $('input[name=sb_instagram_type]:checked').val();
|
504 |
+
event.preventDefault();
|
505 |
+
var $clicked = $(this),
|
506 |
+
$closest = $clicked.closest('.sbi_connected_account'),
|
507 |
+
username = $clicked.closest('.sbi_connected_account').attr('data-username'),
|
508 |
+
accountID = $clicked.closest('.sbi_connected_account').attr('data-userid');
|
509 |
+
|
510 |
+
var name = '<strong>'+accountID+'</strong>';
|
511 |
+
if (username !== '') {
|
512 |
+
name = '<strong>'+username+'</strong> <span>('+accountID+')</span>';
|
513 |
+
}
|
514 |
+
$('.sbi_'+targetClass+'_feed_ids_wrap').prepend(
|
515 |
+
'<div id="sbi_'+targetClass+'_feed_id_'+accountID+'" class="sbi_'+targetClass+'_feed_account_wrap">'+
|
516 |
+
name +
|
517 |
+
'<input type="hidden" name="sb_instagram_'+targetClass+'_id[]" value="'+accountID+'">' +
|
518 |
+
'</div>'
|
519 |
+
);
|
520 |
+
$('.sbi_no_accounts').hide();
|
521 |
+
sbiConAccountsAddRemoveUpdater();
|
522 |
+
});
|
523 |
+
}
|
524 |
+
|
525 |
+
function sbiConAccountsAddRemoveUpdater() {
|
526 |
+
var targetClass = $('input[name=sb_instagram_type]:checked').val();
|
527 |
+
|
528 |
+
var isSelected = [];
|
529 |
+
$('.sbi_'+targetClass+'_feed_account_wrap').find('input').each(function() {
|
530 |
+
isSelected.push($(this).val());
|
531 |
+
});
|
532 |
+
|
533 |
+
$('.sbi_connected_account').each(function() {
|
534 |
+
var username = $(this).attr('data-username'),
|
535 |
+
accountID = $(this).attr('data-userid'),
|
536 |
+
type = $(this).attr('data-type'),
|
537 |
+
permissions = $(this).attr('data-permissions'),
|
538 |
+
$addRemoveButton = $(this).find('.sbi_ca_actions .button-primary').first();
|
539 |
+
$(this).removeClass('sbi_account_updated');
|
540 |
+
$addRemoveButton.removeAttr('disabled');
|
541 |
+
|
542 |
+
if (targetClass === 'tagged' && (type === 'personal' || permissions !== 'tagged')) {
|
543 |
+
$addRemoveButton.show();
|
544 |
+
if (type === 'personal') {
|
545 |
+
$addRemoveButton.html('Tagged Feeds Not Supported');
|
546 |
+
} else {
|
547 |
+
$addRemoveButton.html('Reconnect Account');
|
548 |
+
}
|
549 |
+
$addRemoveButton.attr('disabled',true).addClass('sbi_remove_from_user_feed').removeClass('sbi_use_in_user_feed');
|
550 |
+
$(this).removeClass('sbi_account_active');
|
551 |
+
} else if (targetClass === 'hashtag') {
|
552 |
+
$addRemoveButton.hide();
|
553 |
+
$addRemoveButton.attr('disabled',true).addClass('sbi_remove_from_user_feed').removeClass('sbi_use_in_user_feed');
|
554 |
+
$(this).removeClass('sbi_account_active');
|
555 |
+
} else {
|
556 |
+
$addRemoveButton.show();
|
557 |
+
if (isSelected.indexOf(accountID) > -1) {
|
558 |
+
$addRemoveButton.html('<i class="fa fa-minus-circle" aria-hidden="true" style="margin-right: 5px;"></i>Remove from Primary Feed');
|
559 |
+
$addRemoveButton.addClass('sbi_remove_from_user_feed').removeClass('sbi_use_in_user_feed');
|
560 |
+
$(this).addClass('sbi_account_active');
|
561 |
+
} else {
|
562 |
+
$addRemoveButton.html('<i class="fa fa-plus-circle" aria-hidden="true"></i>Add to Primary Feed');
|
563 |
+
$addRemoveButton.removeClass('sbi_remove_from_user_feed');
|
564 |
+
$addRemoveButton.addClass('sbi_use_in_user_feed');
|
565 |
+
$(this).removeClass('sbi_account_active');
|
566 |
+
}
|
567 |
+
}
|
568 |
+
|
569 |
+
|
570 |
+
if ($(this).find('.sbi_remove_from_user_feed').length ) {
|
571 |
+
$(this).find('.sbi_remove_from_user_feed').off();
|
572 |
+
sbiInitUserRemove($(this).find('.sbi_remove_from_user_feed'));
|
573 |
+
} else {
|
574 |
+
$(this).find('.sbi_use_in_user_feed').off();
|
575 |
+
sbiInitUserAdd($(this).find('.sbi_use_in_user_feed'),'user');
|
576 |
+
}
|
577 |
+
|
578 |
+
});
|
579 |
+
}sbiConAccountsAddRemoveUpdater();
|
580 |
+
|
581 |
+
$('input[name=sb_instagram_type]').change(sbiConAccountsAddRemoveUpdater);
|
582 |
+
|
583 |
+
|
584 |
+
|
585 |
+
$body.on('click', '.sbi_ca_show_token', function(event) {
|
586 |
+
jQuery(this).closest('.sbi_ca_info').find('.sbi_ca_accesstoken').slideToggle(200);
|
587 |
+
});
|
588 |
+
|
589 |
+
$('#sbi_manual_submit').click(function(event) {
|
590 |
+
event.preventDefault();
|
591 |
+
var $self = $(this);
|
592 |
+
var accessToken = $('#sb_manual_at').val(),
|
593 |
+
error = false;
|
594 |
+
if (sbiIsBusinessToken() && $('.sbi_manual_account_id_toggle').find('input').val().length < 3) {
|
595 |
+
error = true;
|
596 |
+
if (!$('.sbi_manually_connect_wrap').find('.sbi_user_id_error').length) {
|
597 |
+
$('.sbi_manually_connect_wrap').show().prepend('<div class="sbi_user_id_error" style="display:block;">Please enter a valid User ID for this Business account.</div>');
|
598 |
+
}
|
599 |
+
} else {
|
600 |
+
error = false;
|
601 |
+
}
|
602 |
+
if (accessToken.length < 15) {
|
603 |
+
if (!$('.sbi_manually_connect_wrap').find('.sbi_user_id_error').length) {
|
604 |
+
$('.sbi_manually_connect_wrap').show().prepend('<div class="sbi_user_id_error" style="display:block;">Please enter a valid access token</div>');
|
605 |
+
}
|
606 |
+
} else if (! error) {
|
607 |
+
$(this).attr('disabled',true);
|
608 |
+
$(this).closest('.sbi_manually_connect_wrap').fadeOut();
|
609 |
+
$('.sbi_connected_accounts_wrap').fadeTo("slow" , 0.5).find('.sbi_user_id_error').remove();
|
610 |
+
|
611 |
+
jQuery.ajax({
|
612 |
+
url: sbiA.ajax_url,
|
613 |
+
type: 'post',
|
614 |
+
data: {
|
615 |
+
action: 'sbi_test_token',
|
616 |
+
access_token: accessToken,
|
617 |
+
account_id : $('.sbi_manual_account_id_toggle').find('input').val().trim(),
|
618 |
+
sbi_nonce: sbiA.sbi_nonce
|
619 |
+
},
|
620 |
+
success: function (data) {
|
621 |
+
$('.sbi_connected_accounts_wrap').fadeTo("slow" , 1);
|
622 |
+
$self.removeAttr('disabled');
|
623 |
+
if ( data.indexOf('{') > -1) {
|
624 |
+
var savedToken = JSON.parse(data);
|
625 |
+
if (typeof savedToken.url !== 'undefined') {
|
626 |
+
window.location.href = savedToken.url;
|
627 |
+
} else {
|
628 |
+
$(this).closest('.sbi_manually_connect_wrap').fadeOut();
|
629 |
+
$('#sb_manual_at, .sbi_manual_account_id_toggle input').val('');
|
630 |
+
sbiAfterUpdateToken(savedToken,false);
|
631 |
+
}
|
632 |
+
|
633 |
+
} else {
|
634 |
+
$('.sbi_manually_connect_wrap').show().prepend('<div class="sbi_user_id_error" style="display:block;">'+data+'</div>');
|
635 |
+
}
|
636 |
+
|
637 |
+
}
|
638 |
+
});
|
639 |
+
}
|
640 |
+
|
641 |
+
});
|
642 |
+
|
643 |
+
//sbi_reset_resized
|
644 |
+
// clear resized
|
645 |
+
var $sbiClearResizedButton = $('#sbi_reset_resized');
|
646 |
+
|
647 |
+
$sbiClearResizedButton.click(function(event) {
|
648 |
+
event.preventDefault();
|
649 |
+
|
650 |
+
jQuery('#sbi-clear-cache-success').remove();
|
651 |
+
jQuery(this).prop("disabled",true);
|
652 |
+
|
653 |
+
$.ajax({
|
654 |
+
url : sbiA.ajax_url,
|
655 |
+
type : 'post',
|
656 |
+
data : {
|
657 |
+
action : 'sbi_reset_resized'
|
658 |
+
},
|
659 |
+
success : function(data) {
|
660 |
+
$sbiClearResizedButton.prop('disabled',false);
|
661 |
+
if(data=='1') {
|
662 |
+
$sbiClearResizedButton.after('<i id="sbi-clear-cache-success" class="fa fa-check-circle sbi-success"></i>');
|
663 |
+
} else {
|
664 |
+
$sbiClearResizedButton.after('<span>error</span>');
|
665 |
+
}
|
666 |
+
}
|
667 |
+
}); // ajax call
|
668 |
+
}); // clear_comment_cache click
|
669 |
+
|
670 |
+
//Caching options
|
671 |
+
if( jQuery('#sbi_caching_type_page').is(':checked') ) {
|
672 |
+
jQuery('.sbi-caching-cron-options').hide();
|
673 |
+
jQuery('.sbi-caching-page-options').show();
|
674 |
+
} else {
|
675 |
+
jQuery('.sbi-caching-page-options').hide();
|
676 |
+
jQuery('.sbi-caching-cron-options').show();
|
677 |
+
}
|
678 |
+
|
679 |
+
$('input[type=radio][name=sbi_caching_type]').change(function() {
|
680 |
+
if (this.value == 'page') {
|
681 |
+
jQuery('.sbi-caching-cron-options').slideUp();
|
682 |
+
jQuery('.sbi-caching-page-options').slideDown();
|
683 |
+
}
|
684 |
+
else if (this.value == 'background') {
|
685 |
+
jQuery('.sbi-caching-page-options').slideUp();
|
686 |
+
jQuery('.sbi-caching-cron-options').slideDown();
|
687 |
+
}
|
688 |
+
});
|
689 |
+
|
690 |
+
|
691 |
+
//Should we show the caching time settings?
|
692 |
+
var sbi_cache_cron_interval = jQuery('#sbi_cache_cron_interval').val(),
|
693 |
+
$sbi_caching_time_settings = jQuery('#sbi-caching-time-settings');
|
694 |
+
|
695 |
+
//Should we show anything initially?
|
696 |
+
if(sbi_cache_cron_interval == '30mins' || sbi_cache_cron_interval == '1hour') $sbi_caching_time_settings.hide();
|
697 |
+
|
698 |
+
jQuery('#sbi_cache_cron_interval').change(function(){
|
699 |
+
sbi_cache_cron_interval = jQuery('#sbi_cache_cron_interval').val();
|
700 |
+
|
701 |
+
if(sbi_cache_cron_interval == '30mins' || sbi_cache_cron_interval == '1hour'){
|
702 |
+
$sbi_caching_time_settings.hide();
|
703 |
+
} else {
|
704 |
+
$sbi_caching_time_settings.show();
|
705 |
+
}
|
706 |
+
});
|
707 |
+
sbi_cache_cron_interval = jQuery('#sbi_cache_cron_interval').val();
|
708 |
+
|
709 |
+
if(sbi_cache_cron_interval == '30mins' || sbi_cache_cron_interval == '1hour'){
|
710 |
+
$sbi_caching_time_settings.hide();
|
711 |
+
} else {
|
712 |
+
$sbi_caching_time_settings.show();
|
713 |
+
}
|
714 |
+
|
715 |
+
|
716 |
+
//clear backup caches
|
717 |
+
jQuery('#sbi_clear_backups').click(function(event) {
|
718 |
+
jQuery('.sbi-success').remove();
|
719 |
+
event.preventDefault();
|
720 |
+
jQuery.ajax({
|
721 |
+
url: sbiA.ajax_url,
|
722 |
+
type: 'post',
|
723 |
+
data: {
|
724 |
+
action: 'sbi_clear_backups',
|
725 |
+
access_token: token,
|
726 |
+
sbi_nonce : sbiA.sbi_nonce,
|
727 |
+
just_tokens: true
|
728 |
+
},
|
729 |
+
success: function (data) {
|
730 |
+
jQuery('#sbi_clear_backups').after('<span class="sbi-success"><i class="fa fa-check-circle"></i></span>');
|
731 |
+
}
|
732 |
+
});
|
733 |
+
});
|
734 |
+
|
735 |
+
//sbi_reset_log
|
736 |
+
var $sbiClearLog = $('#sbi_reset_log');
|
737 |
+
|
738 |
+
$sbiClearLog.click(function(event) {
|
739 |
+
event.preventDefault();
|
740 |
+
|
741 |
+
jQuery('#sbi-clear-cache-success').remove();
|
742 |
+
jQuery(this).prop("disabled",true);
|
743 |
+
|
744 |
+
$.ajax({
|
745 |
+
url : sbiA.ajax_url,
|
746 |
+
type : 'post',
|
747 |
+
data : {
|
748 |
+
action : 'sbi_reset_log'
|
749 |
+
},
|
750 |
+
success : function(data) {
|
751 |
+
$sbiClearLog.prop('disabled',false);
|
752 |
+
if(data=='1') {
|
753 |
+
$sbiClearLog.after('<i id="sbi-clear-cache-success" class="fa fa-check-circle sbi-success"></i>');
|
754 |
+
} else {
|
755 |
+
$sbiClearLog.after('<span>error</span>');
|
756 |
+
}
|
757 |
+
}
|
758 |
+
}); // ajax call
|
759 |
+
}); // clear_comment_cache click
|
760 |
+
|
761 |
+
//Tooltips
|
762 |
+
jQuery('#sbi_admin').on('click', '.sbi_tooltip_link, .sbi_type_tooltip_link', function(){
|
763 |
+
if( jQuery(this).hasClass('sbi_type_tooltip_link') ){
|
764 |
+
jQuery(this).closest('.sbi_row').children('.sbi_tooltip').slideToggle();
|
765 |
+
} else {
|
766 |
+
jQuery(this).siblings('.sbi_tooltip').slideToggle();
|
767 |
+
}
|
768 |
+
});
|
769 |
+
|
770 |
+
//Shortcode labels
|
771 |
+
jQuery('#sbi_admin label').click(function(){
|
772 |
+
var $sbi_shortcode = jQuery(this).siblings('.sbi_shortcode');
|
773 |
+
if($sbi_shortcode.is(':visible')){
|
774 |
+
jQuery(this).siblings('.sbi_shortcode').css('display','none');
|
775 |
+
} else {
|
776 |
+
jQuery(this).siblings('.sbi_shortcode').css('display','block');
|
777 |
+
}
|
778 |
+
});
|
779 |
+
jQuery('#sbi_admin label').hover(function(){
|
780 |
+
if( jQuery(this).siblings('.sbi_shortcode').length > 0 ){
|
781 |
+
jQuery(this).attr('title', 'Click for shortcode option').append('<code class="sbi_shortcode_symbol">[]</code>');
|
782 |
+
}
|
783 |
+
}, function(){
|
784 |
+
jQuery(this).find('.sbi_shortcode_symbol').remove();
|
785 |
+
});
|
786 |
+
|
787 |
+
|
788 |
+
jQuery('#sbi_admin .sbi_lock').hover(function(){
|
789 |
+
jQuery(this).siblings('.sbi_pro_tooltip').show();
|
790 |
+
}, function(){
|
791 |
+
jQuery('.sbi_pro_tooltip').hide();
|
792 |
+
});
|
793 |
+
|
794 |
+
|
795 |
+
|
796 |
+
|
797 |
+
//Add the color picker
|
798 |
+
if( jQuery('.sbi_colorpick').length > 0 ) jQuery('.sbi_colorpick').wpColorPicker();
|
799 |
+
|
800 |
+
//Check User ID is numeric
|
801 |
+
jQuery("#sb_instagram_user_id").change(function() {
|
802 |
+
|
803 |
+
var sbi_user_id = jQuery('#sb_instagram_user_id').val(),
|
804 |
+
$sbi_user_id_error = $(this).closest('td').find('.sbi_user_id_error'),
|
805 |
+
$sbi_other_user_error = $(this).closest('td').find('.sbi_other_user_error');
|
806 |
+
|
807 |
+
if (sbi_user_id.match(/[^0-9, _.-]/)) {
|
808 |
+
$sbi_user_id_error.fadeIn();
|
809 |
+
} else {
|
810 |
+
$sbi_user_id_error.fadeOut();
|
811 |
+
}
|
812 |
+
|
813 |
+
//Check whether an ID from another account is being used
|
814 |
+
sbi_check_other_user_id(sbi_user_id, $sbi_other_user_error);
|
815 |
+
|
816 |
+
});
|
817 |
+
function sbi_check_other_user_id(sbi_user_id, $sbi_other_user_error){
|
818 |
+
if (jQuery('#sb_instagram_at').length && jQuery('#sb_instagram_at').val() !== '' && sbi_user_id.length) {
|
819 |
+
if(jQuery('#sb_instagram_at').val().indexOf(sbi_user_id) == -1 ){
|
820 |
+
$sbi_other_user_error.fadeIn();
|
821 |
+
} else {
|
822 |
+
$sbi_other_user_error.fadeOut();
|
823 |
+
}
|
824 |
+
}
|
825 |
+
}
|
826 |
+
//Check initially when settings load
|
827 |
+
sbi_check_other_user_id( jQuery('#sb_instagram_user_id').val(), $('td').find('.sbi_other_user_error') );
|
828 |
+
|
829 |
+
//Mobile width
|
830 |
+
var sb_instagram_feed_width = jQuery('#sbi_admin #sb_instagram_width').val(),
|
831 |
+
sb_instagram_width_unit = jQuery('#sbi_admin #sb_instagram_width_unit').val(),
|
832 |
+
$sb_instagram_width_options = jQuery('#sbi_admin #sb_instagram_width_options');
|
833 |
+
|
834 |
+
if (typeof sb_instagram_feed_width !== 'undefined') {
|
835 |
+
|
836 |
+
//Show initially if a width is set
|
837 |
+
if( (sb_instagram_feed_width.length > 1 && sb_instagram_width_unit == 'px') || (sb_instagram_feed_width !== '100' && sb_instagram_width_unit == '%') ) $sb_instagram_width_options.show();
|
838 |
+
|
839 |
+
jQuery('#sbi_admin #sb_instagram_width, #sbi_admin #sb_instagram_width_unit').change(function(){
|
840 |
+
sb_instagram_feed_width = jQuery('#sbi_admin #sb_instagram_width').val();
|
841 |
+
sb_instagram_width_unit = jQuery('#sbi_admin #sb_instagram_width_unit').val();
|
842 |
+
|
843 |
+
if( sb_instagram_feed_width.length < 2 || (sb_instagram_feed_width == '100' && sb_instagram_width_unit == '%') ) {
|
844 |
+
$sb_instagram_width_options.slideUp();
|
845 |
+
} else {
|
846 |
+
$sb_instagram_width_options.slideDown();
|
847 |
+
}
|
848 |
+
});
|
849 |
+
|
850 |
+
}
|
851 |
+
|
852 |
+
//Scroll to hash for quick links
|
853 |
+
jQuery('#sbi_admin a').click(function() {
|
854 |
+
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
|
855 |
+
var target = jQuery(this.hash);
|
856 |
+
target = target.length ? target : this.hash.slice(1);
|
857 |
+
if (target.length) {
|
858 |
+
jQuery('html,body').animate({
|
859 |
+
scrollTop: target.offset().top
|
860 |
+
}, 500);
|
861 |
+
return false;
|
862 |
+
}
|
863 |
+
}
|
864 |
+
});
|
865 |
+
|
866 |
+
//Support tab show video
|
867 |
+
jQuery('#sbi-play-support-video').on('click', function(e){
|
868 |
+
e.preventDefault();
|
869 |
+
jQuery('#sbi-support-video').show().attr('src', jQuery('#sbi-support-video').attr('src')+'&autoplay=1' );
|
870 |
+
});
|
871 |
+
|
872 |
+
jQuery('#sbi_admin .sbi-show-pro').on('click', function(){
|
873 |
+
jQuery(this).parent().next('.sbi-pro-options').toggle();
|
874 |
+
});
|
875 |
+
|
876 |
+
/* Pro 3.0 JS */
|
877 |
+
function sbiUpdateLayoutTypeOptionsDisplay() {
|
878 |
+
setTimeout(function(){
|
879 |
+
jQuery('.sb_instagram_layout_settings').hide();
|
880 |
+
jQuery('.sb_instagram_layout_settings.sbi_layout_type_'+jQuery('.sb_layout_type:checked').val()).show();
|
881 |
+
}, 1);
|
882 |
+
}
|
883 |
+
jQuery('.sb_layout_type').change(sbiUpdateLayoutTypeOptionsDisplay);
|
884 |
+
|
885 |
+
jQuery('.sbi_close_options').on('click', function(){
|
886 |
+
jQuery('.sb_instagram_layout_settings').hide();
|
887 |
+
});
|
888 |
+
|
889 |
+
function sbiUpdateHighlightOptionsDisplay() {
|
890 |
+
jQuery('.sb_instagram_highlight_sub_options').hide();
|
891 |
+
var selected = jQuery('#sb_instagram_highlight_type').val();
|
892 |
+
|
893 |
+
if (selected === 'pattern') {
|
894 |
+
jQuery('.sb_instagram_highlight_pattern').show();
|
895 |
+
} else if (selected === 'id') {
|
896 |
+
jQuery('.sb_instagram_highlight_ids').show();
|
897 |
+
} else {
|
898 |
+
jQuery('.sb_instagram_highlight_hashtag').show();
|
899 |
+
}
|
900 |
+
|
901 |
+
}
|
902 |
+
sbiUpdateHighlightOptionsDisplay();
|
903 |
+
jQuery('#sb_instagram_highlight_type').change(sbiUpdateHighlightOptionsDisplay);
|
904 |
+
|
905 |
+
//Open/close the expandable option sections
|
906 |
+
jQuery('.sbi-expandable-options').hide();
|
907 |
+
jQuery('.sbi-expand-button a').on('click', function(e){
|
908 |
+
e.preventDefault();
|
909 |
+
var $self = jQuery(this);
|
910 |
+
$self.parent().next('.sbi-expandable-options').toggle();
|
911 |
+
if( $self.text().indexOf('Show') !== -1 ){
|
912 |
+
$self.text( $self.text().replace('Show', 'Hide') );
|
913 |
+
} else {
|
914 |
+
$self.text( $self.text().replace('Hide', 'Show') );
|
915 |
+
}
|
916 |
+
});
|
917 |
+
|
918 |
+
//Selecting a post layout
|
919 |
+
jQuery('.sbi_layout_cell').click(function(){
|
920 |
+
var $self = jQuery(this);
|
921 |
+
$('.sb_layout_type').trigger('change');
|
922 |
+
$self.addClass('sbi_layout_selected').find('.sb_layout_type').attr('checked', 'checked');
|
923 |
+
$self.siblings().removeClass('sbi_layout_selected');
|
924 |
+
});
|
925 |
+
|
926 |
+
setTimeout( function() {
|
927 |
+
jQuery('.notice-dismiss').click(function() {
|
928 |
+
if (jQuery(this).closest('.sbi-admin-notice').length) {
|
929 |
+
|
930 |
+
if (jQuery(this).closest('.sbi-admin-notice').find('.sbi-admin-error').length) {
|
931 |
+
|
932 |
+
var exemptErrorType = jQuery(this).closest('.sbi-admin-notice').find('.sbi-admin-error').attr('data-sbi-type');
|
933 |
+
|
934 |
+
if (exemptErrorType === 'ajax') {
|
935 |
+
jQuery.ajax({
|
936 |
+
url: sbiA.ajax_url,
|
937 |
+
type: 'post',
|
938 |
+
data: {
|
939 |
+
action : 'sbi_on_ajax_test_trigger',
|
940 |
+
sbi_nonce: sbiA.sbi_nonce
|
941 |
+
},
|
942 |
+
success: function (data) {
|
943 |
+
}
|
944 |
+
});
|
945 |
+
}
|
946 |
+
}
|
947 |
+
}
|
948 |
+
});
|
949 |
+
},1500);
|
950 |
+
|
951 |
+
//Load the admin share widgets
|
952 |
+
jQuery('#sbi_admin_show_share_links').on('click', function(){
|
953 |
+
jQuery(this).fadeOut();
|
954 |
+
if( jQuery('#sbi_admin_share_links iframe').length == 0 ) jQuery('#sbi_admin_share_links').html('<a href="https://twitter.com/share" class="twitter-share-button" data-url="https://wordpress.org/plugins/instagram-feed/" data-text="Display beautifully clean, customizable, and responsive Instagram feeds from multiple accounts" data-via="smashballoon" data-dnt="true">Tweet</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?"http":"https";if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document, "script", "twitter-wjs");</script> <style type="text/css"> #twitter-widget-0{float: left; width: 82px !important;}.IN-widget{margin-right: 20px;}</style> <div id="fb-root" style="display: none;"></div><script>(function(d, s, id){var js, fjs=d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js=d.createElement(s); js.id=id; js.src="//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.0"; fjs.parentNode.insertBefore(js, fjs);}(document, "script", "facebook-jssdk"));</script> <div class="fb-like" data-href="https://wordpress.org/plugins/instagram-feed/" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true" style="display: block; float: left; margin-right: 5px;"></div><script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US </script> <script type="IN/Share" data-url="https://wordpress.org/plugins/instagram-feed/"></script></div>');
|
955 |
+
|
956 |
+
setTimeout(function(){
|
957 |
+
jQuery('#sbi_admin_share_links').addClass('sbi_show');
|
958 |
+
}, 500);
|
959 |
+
});
|
960 |
+
|
961 |
+
});
|
js/sb-instagram-admin.js
CHANGED
@@ -1,27 +1,36 @@
|
|
1 |
jQuery(document).ready(function($) {
|
2 |
|
3 |
/* NEW API CODE */
|
4 |
-
$('.sbi_admin_btn').click(function(event) {
|
5 |
event.preventDefault();
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
$('#sbi_config').append('<div id="sbi_config_info" class="sb_get_token">' +
|
9 |
'<div class="sbi_config_modal">' +
|
10 |
'<p>Are you connecting a Personal or Business Instagram Profile?</p>' +
|
11 |
-
|
12 |
'<div class="sbi_login_button_row">' +
|
13 |
-
'<input type="radio" id="
|
14 |
-
'<label for="
|
15 |
-
|
|
|
16 |
'<div class="sbi_login_button_row">' +
|
17 |
'<input type="radio" id="sbi_business_login" name="sbi_login_type" value="business">' +
|
18 |
-
|
19 |
-
'</div>' +
|
20 |
-
'<div class="sbi_login_button_row">' +
|
21 |
-
'<a href="JavaScript:void(0);" class="sbi_tooltip_link" style="margin-left: 0; font-size: 12px;">I\'m not sure</a><div class="sbi_tooltip">If you are unsure then select the "Personal" option, as this can be used to connect both Personal and Business profiles.</div>' +
|
22 |
'</div>' +
|
23 |
|
24 |
-
'<a href="
|
|
|
|
|
25 |
'<a href="JavaScript:void(0);"><i class="sbi_modal_close fa fa-times"></i></a>' +
|
26 |
'</div>' +
|
27 |
'</div>');
|
@@ -34,7 +43,7 @@ jQuery(document).ready(function($) {
|
|
34 |
if ($('input[name=sbi_login_type]:checked').val() === 'business') {
|
35 |
$('a.sbi_admin_btn').attr('href',newApiURL);
|
36 |
} else {
|
37 |
-
$('a.sbi_admin_btn').attr('href',
|
38 |
}
|
39 |
});
|
40 |
});
|
@@ -91,6 +100,7 @@ jQuery(document).ready(function($) {
|
|
91 |
$('.sbi_connected_accounts_wrap').fadeTo("slow" , 1);
|
92 |
$('#sbi_config_info').remove();
|
93 |
$.each(connectedAccounts,function(index,savedToken) {
|
|
|
94 |
sbiAfterUpdateToken(savedToken,false);
|
95 |
|
96 |
});
|
@@ -190,25 +200,28 @@ jQuery(document).ready(function($) {
|
|
190 |
}
|
191 |
});
|
192 |
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
|
|
197 |
|
198 |
-
|
199 |
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
$('.sbi_modal_close').on('click', function(){
|
207 |
-
$('#sbi_config_info').remove();
|
208 |
-
});
|
209 |
-
}
|
210 |
|
211 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
}
|
213 |
|
214 |
function sbiAfterUpdateToken(savedToken,saveID){
|
@@ -221,6 +234,22 @@ jQuery(document).ready(function($) {
|
|
221 |
'</div>'
|
222 |
);
|
223 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
if ($('#sbi_connected_account_'+savedToken.user_id).length) {
|
225 |
if (savedToken.is_valid) {
|
226 |
$('#sbi_connected_account_'+savedToken.user_id).addClass('sbi_account_updated');
|
@@ -228,9 +257,21 @@ jQuery(document).ready(function($) {
|
|
228 |
$('#sbi_connected_account_'+savedToken.user_id).addClass('sbi_account_invalid');
|
229 |
}
|
230 |
$('#sbi_connected_account_'+savedToken.user_id).attr('data-accesstoken',savedToken.access_token);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
$('#sbi_connected_account_'+savedToken.user_id).find('.sbi_ca_accesstoken .sbi_ca_token').text(savedToken.access_token);
|
232 |
$('#sbi_connected_account_'+savedToken.user_id).find('.sbi_tooltip code').text('[instagram-feed accesstoken="'+savedToken.access_token+'"]');
|
233 |
-
|
234 |
} else {
|
235 |
//Check which kind of account it is
|
236 |
if(typeof savedToken.type !== 'undefined'){
|
@@ -240,6 +281,11 @@ jQuery(document).ready(function($) {
|
|
240 |
var accountType = 'personal';
|
241 |
}
|
242 |
|
|
|
|
|
|
|
|
|
|
|
243 |
//Add the account HTML to the page
|
244 |
var removeOrSaveHTML = saveID ? '<a href="JavaScript:void(0);" class="sbi_remove_from_user_feed button-primary"><i class="fa fa-minus-circle" aria-hidden="true"></i>Remove from Primary Feed</a>' : '<a href="JavaScript:void(0);" class="sbi_use_in_user_feed button-primary"><i class="fa fa-plus-circle" aria-hidden="true"></i>Add to Primary Feed</a>',
|
245 |
statusClass = saveID ? 'sbi_account_active' : 'sbi_account_updated',
|
@@ -251,14 +297,14 @@ jQuery(document).ready(function($) {
|
|
251 |
'</div>'+
|
252 |
|
253 |
'<div class="sbi_ca_username">'+
|
254 |
-
|
255 |
-
'<strong>'+savedToken.username+'<span>'+accountType+'</span></strong>'+
|
256 |
'</div>'+
|
257 |
|
258 |
'<div class="sbi_ca_actions">'+
|
259 |
removeOrSaveHTML +
|
260 |
'<a class="sbi_ca_token_shortcode button-secondary" href="JavaScript:void(0);"><i class="fa fa-chevron-circle-right" aria-hidden="true"></i>Add to another Feed</a>'+
|
261 |
-
'<
|
262 |
'</div>'+
|
263 |
|
264 |
'<div class="sbi_ca_shortcode">'+
|
@@ -271,7 +317,9 @@ jQuery(document).ready(function($) {
|
|
271 |
'</div>'+
|
272 |
|
273 |
'<div class="sbi_ca_accesstoken">' +
|
274 |
-
'<span class="sbi_ca_token_label">Access Token:</span><input type="text" class="sbi_ca_token" value="'+savedToken.access_token+'" readonly="readonly" onclick="this.focus();this.select()" title="To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac).">' +
|
|
|
|
|
275 |
'</div>' +
|
276 |
|
277 |
'</div>'+
|
@@ -309,6 +357,13 @@ jQuery(document).ready(function($) {
|
|
309 |
});
|
310 |
}
|
311 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
function sbSaveID(ID) {
|
313 |
jQuery.ajax({
|
314 |
url: sbiA.ajax_url,
|
@@ -351,7 +406,7 @@ jQuery(document).ready(function($) {
|
|
351 |
}
|
352 |
|
353 |
function sbiIsBusinessToken() {
|
354 |
-
return ($('#sb_manual_at').val().trim().length >
|
355 |
}
|
356 |
|
357 |
function sbiToggleManualAccountIDInput() {
|
@@ -395,6 +450,7 @@ jQuery(document).ready(function($) {
|
|
395 |
if (window.confirm("Delete this connected account?")) {
|
396 |
action = 'sbi_delete_account';
|
397 |
$('#sbi_user_feed_id_' + accountID).remove();
|
|
|
398 |
$('#sbi_connected_account_' + accountID).append('<div class="spinner" style="margin-top: -10px;visibility: visible;top: 50%;position: absolute;right: 50%;"></div>').find('.sbi_ca_info').css('opacity','.5');
|
399 |
|
400 |
jQuery.ajax({
|
@@ -422,71 +478,111 @@ jQuery(document).ready(function($) {
|
|
422 |
sbiInitUserRemove($(this));
|
423 |
});
|
424 |
|
425 |
-
function sbiInitUserRemove(el) {
|
426 |
el.click(function(event) {
|
427 |
event.preventDefault();
|
|
|
|
|
428 |
var $clicked = $(this),
|
429 |
-
$closest = $clicked.closest('.sbi_connected_account'),
|
430 |
-
username = $clicked.closest('.sbi_connected_account').attr('data-username'),
|
431 |
accountID = $clicked.closest('.sbi_connected_account').attr('data-userid');
|
432 |
|
433 |
-
$
|
434 |
-
|
435 |
-
|
436 |
-
$clicked.html('<i class="fa fa-plus-circle" aria-hidden="true"></i>Add to Primary Feed');
|
437 |
-
$('#sbi_user_feed_id_'+accountID).remove();
|
438 |
-
if ($closest.find('.sbi_remove_from_user_feed').length ) {
|
439 |
-
$closest.find('.sbi_remove_from_user_feed').off();
|
440 |
-
sbiInitUserRemove($closest.find('.sbi_remove_from_user_feed'));
|
441 |
-
} else {
|
442 |
-
$closest.find('.sbi_use_in_user_feed').off();
|
443 |
-
sbiInitUserAdd($closest.find('.sbi_use_in_user_feed'));
|
444 |
-
}
|
445 |
});
|
446 |
}
|
447 |
|
448 |
|
449 |
|
450 |
$('.sbi_use_in_user_feed').each(function() {
|
451 |
-
sbiInitUserAdd($(this));
|
452 |
});
|
453 |
|
454 |
-
function sbiInitUserAdd(el) {
|
455 |
el.click(function(event) {
|
|
|
456 |
event.preventDefault();
|
457 |
var $clicked = $(this),
|
458 |
$closest = $clicked.closest('.sbi_connected_account'),
|
459 |
username = $clicked.closest('.sbi_connected_account').attr('data-username'),
|
460 |
accountID = $clicked.closest('.sbi_connected_account').attr('data-userid');
|
461 |
|
462 |
-
$clicked.removeClass('sbi_use_in_user_feed');
|
463 |
-
$clicked.addClass('sbi_remove_from_user_feed');
|
464 |
-
$clicked.closest('.sbi_connected_account').removeClass('sbi_account_updated');
|
465 |
-
$clicked.closest('.sbi_connected_account').addClass('sbi_account_active');
|
466 |
-
$clicked.html('<i class="fa fa-minus-circle" aria-hidden="true" style="margin-right: 5px;"></i>Remove from Primary Feed');
|
467 |
var name = '<strong>'+accountID+'</strong>';
|
468 |
if (username !== '') {
|
469 |
name = '<strong>'+username+'</strong> <span>('+accountID+')</span>';
|
470 |
}
|
471 |
-
$('.
|
472 |
-
'<div id="
|
473 |
name +
|
474 |
-
'<input type="hidden" name="
|
475 |
'</div>'
|
476 |
);
|
477 |
$('.sbi_no_accounts').hide();
|
478 |
-
|
479 |
-
|
480 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
481 |
} else {
|
482 |
-
$
|
483 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
484 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
});
|
486 |
-
}
|
|
|
|
|
|
|
487 |
|
488 |
|
489 |
-
$body.on('
|
490 |
jQuery(this).closest('.sbi_ca_info').find('.sbi_ca_accesstoken').slideToggle(200);
|
491 |
});
|
492 |
|
1 |
jQuery(document).ready(function($) {
|
2 |
|
3 |
/* NEW API CODE */
|
4 |
+
$('.sbi_admin_btn, .sbi_reconnect').click(function(event) {
|
5 |
event.preventDefault();
|
6 |
+
|
7 |
+
var today = new Date(),
|
8 |
+
march = new Date('March 3, 2020 00:00:00'),
|
9 |
+
oldApiURL = $(this).attr('data-old-api'),
|
10 |
+
oldApiLink = '';
|
11 |
+
if (today.getTime() < march.getTime()) {
|
12 |
+
oldApiLink = 'To connect using the legacy API, <a href="'+oldApiURL+'">click here</a> (expires on March 2, 2020).';
|
13 |
+
}
|
14 |
+
|
15 |
+
var personalBasicApiURL = $('#sbi_config .sbi_admin_btn').attr('data-personal-basic-api'),
|
16 |
+
newApiURL = $('#sbi_config .sbi_admin_btn').attr('data-new-api');
|
17 |
$('#sbi_config').append('<div id="sbi_config_info" class="sb_get_token">' +
|
18 |
'<div class="sbi_config_modal">' +
|
19 |
'<p>Are you connecting a Personal or Business Instagram Profile?</p>' +
|
|
|
20 |
'<div class="sbi_login_button_row">' +
|
21 |
+
'<input type="radio" id="sbi_basic_login" name="sbi_login_type" value="basic" checked>' +
|
22 |
+
'<label for="sbi_basic_login"><b>Personal</b> <a href="JavaScript:void(0);" class="sbi_tooltip_link"><i class="fa fa-question-circle"></i></a><div class="sbi_tooltip">Used for displaying user feeds from a "Personal" Instagram account. ' +
|
23 |
+
oldApiLink +
|
24 |
+
'</div></div>' +
|
25 |
'<div class="sbi_login_button_row">' +
|
26 |
'<input type="radio" id="sbi_business_login" name="sbi_login_type" value="business">' +
|
27 |
+
|
28 |
+
'<label for="sbi_business_login"><b>Business</b> </label> <a href="JavaScript:void(0);" class="sbi_tooltip_link"><i class="fa fa-question-circle"></i></a><div class="sbi_tooltip">Used for displaying a user feed from a "Business" or "Creator" Instagram account. A Business or Creator account is required for displaying automatic avatar/bio display in the header. See <a href="https://smashballoon.com/instagram-business-profiles" target="_blank">this FAQ</a> for more info.</div>' +
|
|
|
|
|
29 |
'</div>' +
|
30 |
|
31 |
+
'<div class="sbi_login_button_row"><a href="JavaScript:void(0);" class="sbi_tooltip_link" style="font-size: 12px;">I\'m not sure</a><div class="sbi_tooltip" style="display: none;"><p style="margin-top: 0;">The "Personal" option can display feeds from either a Personal or Business/Creator account.</p><p style="margin-bottom: 0;"">Connecting as a Business account will allow your avatar and bio in feed headers to update automatically. If needed, you can convert a Personal account into a Business account by following the directions <a href="https://smashballoon.com/instagram-business-profiles" target="_blank">here</a>.</p></div></div>' +
|
32 |
+
|
33 |
+
'<a href="'+personalBasicApiURL+'" class="sbi_admin_btn">Connect</a>' +
|
34 |
'<a href="JavaScript:void(0);"><i class="sbi_modal_close fa fa-times"></i></a>' +
|
35 |
'</div>' +
|
36 |
'</div>');
|
43 |
if ($('input[name=sbi_login_type]:checked').val() === 'business') {
|
44 |
$('a.sbi_admin_btn').attr('href',newApiURL);
|
45 |
} else {
|
46 |
+
$('a.sbi_admin_btn').attr('href',personalBasicApiURL);
|
47 |
}
|
48 |
});
|
49 |
});
|
100 |
$('.sbi_connected_accounts_wrap').fadeTo("slow" , 1);
|
101 |
$('#sbi_config_info').remove();
|
102 |
$.each(connectedAccounts,function(index,savedToken) {
|
103 |
+
console.log(savedToken);
|
104 |
sbiAfterUpdateToken(savedToken,false);
|
105 |
|
106 |
});
|
200 |
}
|
201 |
});
|
202 |
|
203 |
+
window.location.hash = '';
|
204 |
+
}
|
205 |
+
function sbiSwitchAccounts(){
|
206 |
+
$('#sbi_switch_accounts').on('click', function(){
|
207 |
+
//Log user out of Instagram by hitting the logout URL in an iframe
|
208 |
+
$('body').append('<iframe style="display: none;" src="https://www.instagram.com/accounts/logout"></iframe>');
|
209 |
|
210 |
+
$(this).text('Please wait...').after('<div class="spinner" style="visibility: visible; float: none; margin: -3px 0 0 3px;"></div>');
|
211 |
|
212 |
+
//Wait a couple seconds for the logout to occur, then connect a new account
|
213 |
+
setTimeout(function(){
|
214 |
+
window.location.href = $('.sbi_admin_btn').attr('href');
|
215 |
+
}, 2000);
|
216 |
+
});
|
|
|
|
|
|
|
|
|
|
|
217 |
|
218 |
+
$('.sbi_modal_close').on('click', function(){
|
219 |
+
$('#sbi_config_info').remove();
|
220 |
+
});
|
221 |
+
}
|
222 |
+
if ($('#sbi_switch_accounts').length) {
|
223 |
+
$('.sbi_admin_btn').attr('href',$('#sbi_config .sbi_admin_btn').attr('data-personal-basic-api'));
|
224 |
+
sbiSwitchAccounts();
|
225 |
}
|
226 |
|
227 |
function sbiAfterUpdateToken(savedToken,saveID){
|
234 |
'</div>'
|
235 |
);
|
236 |
}
|
237 |
+
if (typeof savedToken.old_user_id !== 'undefined' && $('#sbi_connected_account_'+savedToken.old_user_id).length) {
|
238 |
+
|
239 |
+
if ($('#sbi_user_feed_id_'+savedToken.old_user_id).length) {
|
240 |
+
$('.sbi_user_feed_ids_wrap').prepend(
|
241 |
+
'<div id="sbi_user_feed_id_'+savedToken.user_id+'" class="sbi_user_feed_account_wrap">'+
|
242 |
+
'<strong>'+savedToken.username+'</strong> <span>('+savedToken.user_id+')</span>' +
|
243 |
+
'<input type="hidden" name="sb_instagram_user_id[]" value="'+savedToken.user_id+'">' +
|
244 |
+
'</div>'
|
245 |
+
);
|
246 |
+
$('#sbi_user_feed_id_'+savedToken.old_user_id).remove();
|
247 |
+
|
248 |
+
saveID = true;
|
249 |
+
}
|
250 |
+
|
251 |
+
$('#sbi_connected_account_'+savedToken.old_user_id).remove();
|
252 |
+
}
|
253 |
if ($('#sbi_connected_account_'+savedToken.user_id).length) {
|
254 |
if (savedToken.is_valid) {
|
255 |
$('#sbi_connected_account_'+savedToken.user_id).addClass('sbi_account_updated');
|
257 |
$('#sbi_connected_account_'+savedToken.user_id).addClass('sbi_account_invalid');
|
258 |
}
|
259 |
$('#sbi_connected_account_'+savedToken.user_id).attr('data-accesstoken',savedToken.access_token);
|
260 |
+
if (typeof savedToken.use_tagged !== 'undefined' && savedToken.use_tagged == '1') {
|
261 |
+
$('#sbi_connected_account_'+savedToken.user_id).attr('data-permissions','tagged');
|
262 |
+
$('#sbi_connected_account_'+savedToken.user_id).find('.sbi_permissions_desc').text('All');
|
263 |
+
}
|
264 |
+
|
265 |
+
if (! $('#sbi_connected_account_'+savedToken.user_id + ' .sbi_ca_avatar').length) {
|
266 |
+
if (savedToken.profile_picture !== '') {
|
267 |
+
$('#sbi_connected_account_'+savedToken.user_id + ' .sbi_ca_username').prepend('<img class="sbi_ca_avatar" src="'+savedToken.profile_picture+'">');
|
268 |
+
}
|
269 |
+
}
|
270 |
+
$('#sbi_connected_account_'+savedToken.user_id + ' .sbi_ca_username').find('span').text(sbiAccountType(savedToken.type));
|
271 |
+
|
272 |
$('#sbi_connected_account_'+savedToken.user_id).find('.sbi_ca_accesstoken .sbi_ca_token').text(savedToken.access_token);
|
273 |
$('#sbi_connected_account_'+savedToken.user_id).find('.sbi_tooltip code').text('[instagram-feed accesstoken="'+savedToken.access_token+'"]');
|
274 |
+
|
275 |
} else {
|
276 |
//Check which kind of account it is
|
277 |
if(typeof savedToken.type !== 'undefined'){
|
281 |
var accountType = 'personal';
|
282 |
}
|
283 |
|
284 |
+
var avatarHTML = '';
|
285 |
+
if (savedToken.profile_picture !== '') {
|
286 |
+
avatarHTML = '<img class="sbi_ca_avatar" src="'+savedToken.profile_picture+'" />';
|
287 |
+
}
|
288 |
+
|
289 |
//Add the account HTML to the page
|
290 |
var removeOrSaveHTML = saveID ? '<a href="JavaScript:void(0);" class="sbi_remove_from_user_feed button-primary"><i class="fa fa-minus-circle" aria-hidden="true"></i>Remove from Primary Feed</a>' : '<a href="JavaScript:void(0);" class="sbi_use_in_user_feed button-primary"><i class="fa fa-plus-circle" aria-hidden="true"></i>Add to Primary Feed</a>',
|
291 |
statusClass = saveID ? 'sbi_account_active' : 'sbi_account_updated',
|
297 |
'</div>'+
|
298 |
|
299 |
'<div class="sbi_ca_username">'+
|
300 |
+
avatarHTML+
|
301 |
+
'<strong>'+savedToken.username+'<span>'+sbiAccountType(accountType)+'</span></strong>'+
|
302 |
'</div>'+
|
303 |
|
304 |
'<div class="sbi_ca_actions">'+
|
305 |
removeOrSaveHTML +
|
306 |
'<a class="sbi_ca_token_shortcode button-secondary" href="JavaScript:void(0);"><i class="fa fa-chevron-circle-right" aria-hidden="true"></i>Add to another Feed</a>'+
|
307 |
+
'<a class="sbi_ca_show_token button-secondary" href="JavaScript:void(0);" title="Show access token and account info"><i class="fa fa-cog"></i></a>'+
|
308 |
'</div>'+
|
309 |
|
310 |
'<div class="sbi_ca_shortcode">'+
|
317 |
'</div>'+
|
318 |
|
319 |
'<div class="sbi_ca_accesstoken">' +
|
320 |
+
'<span class="sbi_ca_token_label">Access Token:</span><input type="text" class="sbi_ca_token" value="'+savedToken.access_token+'" readonly="readonly" onclick="this.focus();this.select()" title="To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)."><br>' +
|
321 |
+
'<span class="sbi_ca_token_label">User ID:</span><input type="text" class="sbi_ca_user_id" value="'+savedToken.user_id+'" readonly="readonly" onclick="this.focus();this.select()" title="To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)."><br>' +
|
322 |
+
'<span class="sbi_ca_token_label">Permissions:</span><span class="sbi_permissions_desc">All</span>' +
|
323 |
'</div>' +
|
324 |
|
325 |
'</div>'+
|
357 |
});
|
358 |
}
|
359 |
|
360 |
+
function sbiAccountType(accountType) {
|
361 |
+
if (accountType === 'basic') {
|
362 |
+
return 'personal (new API)';
|
363 |
+
}
|
364 |
+
return accountType;
|
365 |
+
}
|
366 |
+
|
367 |
function sbSaveID(ID) {
|
368 |
jQuery.ajax({
|
369 |
url: sbiA.ajax_url,
|
406 |
}
|
407 |
|
408 |
function sbiIsBusinessToken() {
|
409 |
+
return ($('#sb_manual_at').val().trim().length > 125);
|
410 |
}
|
411 |
|
412 |
function sbiToggleManualAccountIDInput() {
|
450 |
if (window.confirm("Delete this connected account?")) {
|
451 |
action = 'sbi_delete_account';
|
452 |
$('#sbi_user_feed_id_' + accountID).remove();
|
453 |
+
$('#sbi_tagged_feed_id_' + accountID).remove();
|
454 |
$('#sbi_connected_account_' + accountID).append('<div class="spinner" style="margin-top: -10px;visibility: visible;top: 50%;position: absolute;right: 50%;"></div>').find('.sbi_ca_info').css('opacity','.5');
|
455 |
|
456 |
jQuery.ajax({
|
478 |
sbiInitUserRemove($(this));
|
479 |
});
|
480 |
|
481 |
+
function sbiInitUserRemove(el,targetClass) {
|
482 |
el.click(function(event) {
|
483 |
event.preventDefault();
|
484 |
+
targetClass = $('input[name=sb_instagram_type]:checked').val();
|
485 |
+
|
486 |
var $clicked = $(this),
|
|
|
|
|
487 |
accountID = $clicked.closest('.sbi_connected_account').attr('data-userid');
|
488 |
|
489 |
+
$('#sbi_'+targetClass+'_feed_id_'+accountID).remove();
|
490 |
+
|
491 |
+
sbiConAccountsAddRemoveUpdater();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
492 |
});
|
493 |
}
|
494 |
|
495 |
|
496 |
|
497 |
$('.sbi_use_in_user_feed').each(function() {
|
498 |
+
sbiInitUserAdd($(this), 'user');
|
499 |
});
|
500 |
|
501 |
+
function sbiInitUserAdd(el,targetClass) {
|
502 |
el.click(function(event) {
|
503 |
+
targetClass = $('input[name=sb_instagram_type]:checked').val();
|
504 |
event.preventDefault();
|
505 |
var $clicked = $(this),
|
506 |
$closest = $clicked.closest('.sbi_connected_account'),
|
507 |
username = $clicked.closest('.sbi_connected_account').attr('data-username'),
|
508 |
accountID = $clicked.closest('.sbi_connected_account').attr('data-userid');
|
509 |
|
|
|
|
|
|
|
|
|
|
|
510 |
var name = '<strong>'+accountID+'</strong>';
|
511 |
if (username !== '') {
|
512 |
name = '<strong>'+username+'</strong> <span>('+accountID+')</span>';
|
513 |
}
|
514 |
+
$('.sbi_'+targetClass+'_feed_ids_wrap').prepend(
|
515 |
+
'<div id="sbi_'+targetClass+'_feed_id_'+accountID+'" class="sbi_'+targetClass+'_feed_account_wrap">'+
|
516 |
name +
|
517 |
+
'<input type="hidden" name="sb_instagram_'+targetClass+'_id[]" value="'+accountID+'">' +
|
518 |
'</div>'
|
519 |
);
|
520 |
$('.sbi_no_accounts').hide();
|
521 |
+
sbiConAccountsAddRemoveUpdater();
|
522 |
+
});
|
523 |
+
}
|
524 |
+
|
525 |
+
function sbiConAccountsAddRemoveUpdater() {
|
526 |
+
var targetClass = $('input[name=sb_instagram_type]:checked').val();
|
527 |
+
|
528 |
+
var isSelected = [];
|
529 |
+
$('.sbi_'+targetClass+'_feed_account_wrap').find('input').each(function() {
|
530 |
+
isSelected.push($(this).val());
|
531 |
+
});
|
532 |
+
|
533 |
+
$('.sbi_connected_account').each(function() {
|
534 |
+
var username = $(this).attr('data-username'),
|
535 |
+
accountID = $(this).attr('data-userid'),
|
536 |
+
type = $(this).attr('data-type'),
|
537 |
+
permissions = $(this).attr('data-permissions'),
|
538 |
+
$addRemoveButton = $(this).find('.sbi_ca_actions .button-primary').first();
|
539 |
+
$(this).removeClass('sbi_account_updated');
|
540 |
+
$addRemoveButton.removeAttr('disabled');
|
541 |
+
|
542 |
+
if (targetClass === 'tagged' && (type === 'personal' || permissions !== 'tagged')) {
|
543 |
+
$addRemoveButton.show();
|
544 |
+
if (type === 'personal') {
|
545 |
+
$addRemoveButton.html('Tagged Feeds Not Supported');
|
546 |
+
} else {
|
547 |
+
$addRemoveButton.html('Reconnect Account');
|
548 |
+
}
|
549 |
+
$addRemoveButton.attr('disabled',true).addClass('sbi_remove_from_user_feed').removeClass('sbi_use_in_user_feed');
|
550 |
+
$(this).removeClass('sbi_account_active');
|
551 |
+
} else if (targetClass === 'hashtag') {
|
552 |
+
$addRemoveButton.hide();
|
553 |
+
$addRemoveButton.attr('disabled',true).addClass('sbi_remove_from_user_feed').removeClass('sbi_use_in_user_feed');
|
554 |
+
$(this).removeClass('sbi_account_active');
|
555 |
} else {
|
556 |
+
$addRemoveButton.show();
|
557 |
+
if (isSelected.indexOf(accountID) > -1) {
|
558 |
+
$addRemoveButton.html('<i class="fa fa-minus-circle" aria-hidden="true" style="margin-right: 5px;"></i>Remove from Primary Feed');
|
559 |
+
$addRemoveButton.addClass('sbi_remove_from_user_feed').removeClass('sbi_use_in_user_feed');
|
560 |
+
$(this).addClass('sbi_account_active');
|
561 |
+
} else {
|
562 |
+
$addRemoveButton.html('<i class="fa fa-plus-circle" aria-hidden="true"></i>Add to Primary Feed');
|
563 |
+
$addRemoveButton.removeClass('sbi_remove_from_user_feed');
|
564 |
+
$addRemoveButton.addClass('sbi_use_in_user_feed');
|
565 |
+
$(this).removeClass('sbi_account_active');
|
566 |
+
}
|
567 |
}
|
568 |
+
|
569 |
+
|
570 |
+
if ($(this).find('.sbi_remove_from_user_feed').length ) {
|
571 |
+
$(this).find('.sbi_remove_from_user_feed').off();
|
572 |
+
sbiInitUserRemove($(this).find('.sbi_remove_from_user_feed'));
|
573 |
+
} else {
|
574 |
+
$(this).find('.sbi_use_in_user_feed').off();
|
575 |
+
sbiInitUserAdd($(this).find('.sbi_use_in_user_feed'),'user');
|
576 |
+
}
|
577 |
+
|
578 |
});
|
579 |
+
}sbiConAccountsAddRemoveUpdater();
|
580 |
+
|
581 |
+
$('input[name=sb_instagram_type]').change(sbiConAccountsAddRemoveUpdater);
|
582 |
+
|
583 |
|
584 |
|
585 |
+
$body.on('click', '.sbi_ca_show_token', function(event) {
|
586 |
jQuery(this).closest('.sbi_ca_info').find('.sbi_ca_accesstoken').slideToggle(200);
|
587 |
});
|
588 |
|
js/sb-instagram.js
CHANGED
@@ -257,6 +257,9 @@ if(!sbi_js_exists) {
|
|
257 |
SbiFeed.prototype = {
|
258 |
init: function() {
|
259 |
var feed = this;
|
|
|
|
|
|
|
260 |
if (this.settings.ajaxPostLoad) {
|
261 |
this.getNewPostSet();
|
262 |
} else {
|
@@ -873,9 +876,9 @@ if(!sbi_js_exists) {
|
|
873 |
}
|
874 |
if (typeof window.sb_instagram_js_options.resized_url !== 'undefined' && window.sb_instagram_js_options.resized_url.indexOf(location.protocol) === -1) {
|
875 |
if (location.protocol === 'http:') {
|
876 |
-
window.sb_instagram_js_options.resized_url = window.sb_instagram_js_options.resized_url.replace('http:','https:');
|
877 |
-
} else {
|
878 |
window.sb_instagram_js_options.resized_url = window.sb_instagram_js_options.resized_url.replace('https:','http:');
|
|
|
|
|
879 |
}
|
880 |
}
|
881 |
sbi_init();
|
257 |
SbiFeed.prototype = {
|
258 |
init: function() {
|
259 |
var feed = this;
|
260 |
+
if ($(this.el).find('#sbi_mod_error').length) {
|
261 |
+
$(this.el).prepend($(this.el).find('#sbi_mod_error'));
|
262 |
+
}
|
263 |
if (this.settings.ajaxPostLoad) {
|
264 |
this.getNewPostSet();
|
265 |
} else {
|
876 |
}
|
877 |
if (typeof window.sb_instagram_js_options.resized_url !== 'undefined' && window.sb_instagram_js_options.resized_url.indexOf(location.protocol) === -1) {
|
878 |
if (location.protocol === 'http:') {
|
|
|
|
|
879 |
window.sb_instagram_js_options.resized_url = window.sb_instagram_js_options.resized_url.replace('https:','http:');
|
880 |
+
} else {
|
881 |
+
window.sb_instagram_js_options.resized_url = window.sb_instagram_js_options.resized_url.replace('http:','https:');
|
882 |
}
|
883 |
}
|
884 |
sbi_init();
|
js/sb-instagram.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var sbi_js_exists=void 0!==sbi_js_exists;sbi_js_exists||(!function(i){function e(){var i,e,s,t=t||{VER:"0.9.944"};t.bgs_Available=!1,t.bgs_CheckRunned=!1,function(i){i.fn.extend({sbi_imgLiquid:function(e){this.defaults={fill:!0,verticalAlign:"center",horizontalAlign:"center",useBackgroundSize:!0,useDataHtmlAttr:!0,responsive:!0,delay:0,fadeInTime:0,removeBoxBackground:!0,hardPixels:!0,responsiveCheckTime:500,timecheckvisibility:500,onStart:null,onFinish:null,onItemStart:null,onItemFinish:null,onItemError:null},function(){if(!t.bgs_CheckRunned){t.bgs_CheckRunned=!0;var e=i('<span style="background-size:cover" />');i("body").append(e),function(){var i=e[0];if(i&&window.getComputedStyle){var s=window.getComputedStyle(i,null);s&&s.backgroundSize&&(t.bgs_Available="cover"===s.backgroundSize)}}(),e.remove()}}();var s=this;return this.options=e,this.settings=i.extend({},this.defaults,this.options),this.settings.onStart&&this.settings.onStart(),this.each(function(e){function a(){(r.responsive||g.data("sbi_imgLiquid_oldProcessed"))&&g.data("sbi_imgLiquid_settings")&&(r=g.data("sbi_imgLiquid_settings"),l.actualSize=l.get(0).offsetWidth+l.get(0).offsetHeight/1e4,l.sizeOld&&l.actualSize!==l.sizeOld&&o(),l.sizeOld=l.actualSize,setTimeout(a,r.responsiveCheckTime))}function n(){g.data("sbi_imgLiquid_error",!0),l.addClass("sbi_imgLiquid_error"),r.onItemError&&r.onItemError(e,l,g),d()}function o(){var i,s,t,a,n,o,h,u,m=0,_=0,c=l.width(),f=l.height();void 0===g.data("owidth")&&g.data("owidth",g[0].width),void 0===g.data("oheight")&&g.data("oheight",g[0].height),r.fill===c/f>=g.data("owidth")/g.data("oheight")?(i="100%",s="auto",t=Math.floor(c),a=Math.floor(c*(g.data("oheight")/g.data("owidth")))):(i="auto",s="100%",t=Math.floor(f*(g.data("owidth")/g.data("oheight"))),a=Math.floor(f)),h=c-t,"left"===(n=r.horizontalAlign.toLowerCase())&&(_=0),"center"===n&&(_=.5*h),"right"===n&&(_=h),-1!==n.indexOf("%")&&((n=parseInt(n.replace("%",""),10))>0&&(_=h*n*.01)),u=f-a,"left"===(o=r.verticalAlign.toLowerCase())&&(m=0),"center"===o&&(m=.5*u),"bottom"===o&&(m=u),-1!==o.indexOf("%")&&((o=parseInt(o.replace("%",""),10))>0&&(m=u*o*.01)),r.hardPixels&&(i=t,s=a),g.css({width:i,height:s,"margin-left":Math.floor(_),"margin-top":Math.floor(m)}),g.data("sbi_imgLiquid_oldProcessed")||(g.fadeTo(r.fadeInTime,1),g.data("sbi_imgLiquid_oldProcessed",!0),r.removeBoxBackground&&l.css("background-image","none"),l.addClass("sbi_imgLiquid_nobgSize"),l.addClass("sbi_imgLiquid_ready")),r.onItemFinish&&r.onItemFinish(e,l,g),d()}function d(){e===s.length-1&&s.settings.onFinish&&s.settings.onFinish()}var r=s.settings,l=i(this),g=i("img:first",l);return g.length?(g.data("sbi_imgLiquid_settings")?(l.removeClass("sbi_imgLiquid_error").removeClass("sbi_imgLiquid_ready"),r=i.extend({},g.data("sbi_imgLiquid_settings"),s.options)):r=i.extend({},s.settings,function(){var i={};if(s.settings.useDataHtmlAttr){var e=l.attr("data-sbi_imgLiquid-fill"),a=l.attr("data-sbi_imgLiquid-horizontalAlign"),n=l.attr("data-sbi_imgLiquid-verticalAlign");("true"===e||"false"===e)&&(i.fill=Boolean("true"===e)),void 0===a||"left"!==a&&"center"!==a&&"right"!==a&&-1===a.indexOf("%")||(i.horizontalAlign=a),void 0===n||"top"!==n&&"bottom"!==n&&"center"!==n&&-1===n.indexOf("%")||(i.verticalAlign=n)}return t.isIE&&s.settings.ieFadeInDisabled&&(i.fadeInTime=0),i}()),g.data("sbi_imgLiquid_settings",r),r.onItemStart&&r.onItemStart(e,l,g),void(t.bgs_Available&&r.useBackgroundSize?(-1===l.css("background-image").indexOf(encodeURI(g.attr("src")))&&l.css({"background-image":'url("'+encodeURI(g.attr("src"))+'")'}),l.css({"background-size":r.fill?"cover":"contain","background-position":(r.horizontalAlign+" "+r.verticalAlign).toLowerCase(),"background-repeat":"no-repeat"}),i("a:first",l).css({display:"block",width:"100%",height:"100%"}),i("img",l).css({display:"none"}),r.onItemFinish&&r.onItemFinish(e,l,g),l.addClass("sbi_imgLiquid_bgSize"),l.addClass("sbi_imgLiquid_ready"),d()):function s(){if(g.data("oldSrc")&&g.data("oldSrc")!==g.attr("src")){var t=g.clone().removeAttr("style");return t.data("sbi_imgLiquid_settings",g.data("sbi_imgLiquid_settings")),g.parent().prepend(t),g.remove(),(g=t)[0].width=0,void setTimeout(s,10)}return g.data("sbi_imgLiquid_oldProcessed")?void o():(g.data("sbi_imgLiquid_oldProcessed",!1),g.data("oldSrc",g.attr("src")),i("img:not(:first)",l).css("display","none"),l.css({overflow:"hidden"}),g.fadeTo(0,0).removeAttr("width").removeAttr("height").css({visibility:"visible","max-width":"none","max-height":"none",width:"auto",height:"auto",display:"block"}),g.on("error",n),g[0].onerror=n,function i(){g.data("sbi_imgLiquid_error")||g.data("sbi_imgLiquid_loaded")||g.data("sbi_imgLiquid_oldProcessed")||(l.is(":visible")&&g[0].complete&&g[0].width>0&&g[0].height>0?(g.data("sbi_imgLiquid_loaded",!0),setTimeout(o,e*r.delay)):setTimeout(i,r.timecheckvisibility))}(),void a())}())):void n()})}})}(jQuery),i=t.injectCss,e=document.getElementsByTagName("head")[0],(s=document.createElement("style")).type="text/css",s.styleSheet?s.styleSheet.cssText=i:s.appendChild(document.createTextNode(i)),e.appendChild(s)}function s(){this.feeds={},this.options=sb_instagram_js_options}function t(i,e,s){this.el=i,this.index=e,this.settings=s,this.minImageWidth=0,this.imageResolution=150,this.resizedImages={},this.needsResizing=[],this.outOfPages=!1,this.isInitialized=!1}function a(e,s){i.ajax({url:sbiajaxurl,type:"post",data:e,success:s})}s.prototype={createPage:function(e,s){void 0!==window.sbiajaxurl&&-1!==window.sbiajaxurl.indexOf(window.location.hostname)||(window.sbiajaxurl=location.protocol+"//"+window.location.hostname+"/wp-admin/admin-ajax.php"),i(".sbi_no_js_error_message").remove(),i(".sbi_no_js").removeClass("sbi_no_js"),e(s)},createFeeds:function(e){e.whenFeedsCreated(i(".sbi").each(function(e){i(this).attr("data-sbi-index",e+1);var s=i(this),n=void 0!==s.attr("data-sbi-flags")?s.attr("data-sbi-flags").split(","):[],o=void 0!==s.attr("data-options")?JSON.parse(s.attr("data-options")):{};if(n.indexOf("testAjax")>-1){window.sbi.triggeredTest=!0;a({action:"sbi_on_ajax_test_trigger"},function(i){console.log("did test")})}var d={cols:s.attr("data-cols"),colsmobile:"same"!==s.attr("data-colsmobile")?s.attr("data-colsmobile"):s.attr("data-cols"),num:s.attr("data-num"),imgRes:s.attr("data-res"),feedID:s.attr("data-feedid"),shortCodeAtts:s.attr("data-shortcode-atts"),resizingEnabled:-1===n.indexOf("resizeDisable"),imageLoadEnabled:-1===n.indexOf("imageLoadDisable"),debugEnabled:n.indexOf("debug")>-1,favorLocal:n.indexOf("favorLocal")>-1,ajaxPostLoad:n.indexOf("ajaxPostLoad")>-1,autoMinRes:1,general:o};window.sbi.feeds[e]=function(i,e,s){return new t(i,e,s)}(this,e,d),window.sbi.feeds[e].setResizedImages(),window.sbi.feeds[e].init();var r=jQuery.Event("sbiafterfeedcreate");r.feed=window.sbi.feeds[e],jQuery(window).trigger(r)}))},afterFeedsCreated:function(){i(".sb_instagram_header").each(function(){var e=i(this);e.find(".sbi_header_link").hover(function(){e.find(".sbi_header_img_hover").addClass("sbi_fade_in")},function(){e.find(".sbi_header_img_hover").removeClass("sbi_fade_in")})})},encodeHTML:function(i){return void 0===i?"":i.replace(/(>)/g,">").replace(/(<)/g,"<").replace(/(<br\/>)/g,"<br>").replace(/(<br>)/g,"<br>")},urlDetect:function(i){return i.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/g)}},t.prototype={init:function(){var i=this;this.settings.ajaxPostLoad?this.getNewPostSet():this.afterInitialImagesLoaded();var e,s=(e=0,function(i,s){clearTimeout(e),e=setTimeout(i,s)});jQuery(window).resize(function(){s(function(){i.afterResize()},500)})},initLayout:function(){},afterInitialImagesLoaded:function(){this.initLayout(),this.loadMoreButtonInit(),this.hideExtraImagesForWidth(),this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed()},afterResize:function(){this.setImageHeight(),this.setImageResolution(),this.maybeRaiseImageResolution(),this.setImageSizeClass()},afterLoadMoreClicked:function(i){i.find(".sbi_loader").removeClass("sbi_hidden"),i.find(".sbi_btn_text").addClass("sbi_hidden"),i.closest(".sbi").find(".sbi_num_diff_hide").addClass("sbi_transition").removeClass("sbi_num_diff_hide")},afterNewImagesLoaded:function(){var e=i(this.el),s=this;this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed(),setTimeout(function(){e.find(".sbi_loader").addClass("sbi_hidden"),e.find(".sbi_btn_text").removeClass("sbi_hidden"),s.maybeRaiseImageResolution()},500)},beforeNewImagesRevealed:function(){this.setImageHeight(),this.maybeRaiseImageResolution(!0),this.setImageSizeClass()},revealNewImages:function(){var e=i(this.el);"function"==typeof sbi_custom_js&&setTimeout(function(){sbi_custom_js()},100),this.applyImageLiquid(),e.find(".sbi_item").each(function(i){jQuery(this).find(".sbi_photo").hover(function(){jQuery(this).fadeTo(200,.85)},function(){jQuery(this).stop().fadeTo(500,1)})}),setTimeout(function(){jQuery("#sbi_images .sbi_item.sbi_new").removeClass("sbi_new");var i=10;e.find(".sbi_transition").each(function(){var e=jQuery(this);setTimeout(function(){e.removeClass("sbi_transition")},i),i+=10})},500)},afterNewImagesRevealed:function(){this.listenForVisibilityChange(),this.sendNeedsResizingToServer(),this.settings.imageLoadEnabled||i(".sbi_no_resraise").removeClass("sbi_no_resraise");var e=i.Event("sbiafterimagesloaded");e.el=i(this.el),i(window).trigger(e)},setResizedImages:function(){i(this.el).find(".sbi_resized_image_data").length&&void 0!==i(this.el).find(".sbi_resized_image_data").attr("data-resized")&&0===i(this.el).find(".sbi_resized_image_data").attr("data-resized").indexOf('{"')&&(this.resizedImages=JSON.parse(i(this.el).find(".sbi_resized_image_data").attr("data-resized")),i(this.el).find(".sbi_resized_image_data").remove())},sendNeedsResizingToServer:function(){var e=this;if(e.needsResizing.length>0&&e.settings.resizingEnabled){var s=i(this.el).find(".sbi_item").length;a({action:"sbi_resized_images_submit",needs_resizing:e.needsResizing,offset:s,feed_id:e.settings.feedID,atts:e.settings.shortCodeAtts},function(i){if(0===i.trim().indexOf("{")){var s=JSON.parse(i);e.settings.debugEnabled&&console.log(s)}})}},loadMoreButtonInit:function(){var e=i(this.el),s=this;e.find("#sbi_load .sbi_load_btn").off().on("click",function(){s.afterLoadMoreClicked(jQuery(this)),s.getNewPostSet()})},getNewPostSet:function(){var e=i(this.el),s=this;a({action:"sbi_load_more_clicked",offset:e.find(".sbi_item").length,feed_id:s.settings.feedID,atts:s.settings.shortCodeAtts,current_resolution:s.imageResolution},function(t){if(0===t.trim().indexOf("{")){var a=JSON.parse(t);s.settings.debugEnabled&&console.log(a),s.appendNewPosts(a.html),s.addResizedImages(a.resizedImages),s.settings.ajaxPostLoad?(s.settings.ajaxPostLoad=!1,s.afterInitialImagesLoaded()):s.afterNewImagesLoaded(),a.feedStatus.shouldPaginate?s.outOfPages=!1:(s.outOfPages=!0,e.find(".sbi_load_btn").hide()),i(".sbi_no_js").removeClass("sbi_no_js")}})},appendNewPosts:function(e){var s=i(this.el);s.find("#sbi_images .sbi_item").length?s.find("#sbi_images .sbi_item").last().after(e):s.find("#sbi_images").append(e)},addResizedImages:function(i){for(var e in i)this.resizedImages[e]=i[e]},setImageHeight:function(){var e=i(this.el),s=e.find(".sbi_photo").eq(0).innerWidth(),t=this.getColumnCount(),a=e.find("#sbi_images").innerWidth()-e.find("#sbi_images").width(),n=a/2;sbi_photo_width_manual=e.find("#sbi_images").width()/t-a,e.find(".sbi_photo").css("height",s),e.find(".sbi-owl-nav").length&&setTimeout(function(){var i=2;e.find(".sbi_owl2row-item").length&&(i=1);var s=e.find(".sbi_photo").eq(0).innerWidth()/i;s+=parseInt(n)*(2-i+2),e.find(".sbi-owl-nav div").css("top",s)},100)},maybeRaiseSingleImageResolution:function(e,s,t){var a=this,n=a.getImageUrls(e),o=e.find(".sbi_photo img").attr("src"),d=150,r=e.find("img").get(0),l=o===window.sbi.options.placeholder?1:r.naturalWidth/r.naturalHeight;t=void 0!==t&&t;if(!(e.hasClass("sbi_no_resraise")||e.hasClass("sbi_had_error")||e.find(".sbi_link_area").length&&e.find(".sbi_link_area").hasClass("sbi_had_error"))){i.each(n,function(i,e){e===o&&(d=parseInt(i),t=!1)});var g=640;switch(a.settings.imgRes){case"thumb":g=150;break;case"medium":g=320;break;case"full":g=640;break;default:var h=Math.max(a.settings.autoMinRes,e.find(".sbi_photo").innerWidth()),u=a.getBestResolutionForAuto(h,l,e);switch(u){case 320:g=320;break;case 150:g=150}}if(g>d||o===window.sbi.options.placeholder||t){if(a.settings.debugEnabled){var m=o===window.sbi.options.placeholder?"was placeholder":"too small";console.log("rais res for "+o,m)}var _=n[g].split("?ig_cache_key")[0];if(e.find(".sbi_photo img").attr("src",_),e.find(".sbi_photo").css("background-image",'url("'+_+'")'),d=g,"auto"===a.settings.imgRes){var c=!1;e.find(".sbi_photo img").on("load",function(){var s=i(this),t=s.get(0).naturalWidth/s.get(0).naturalHeight;if(1e3!==s.get(0).naturalWidth&&t>l&&!c){switch(a.settings.debugEnabled&&console.log("rais res again for aspect ratio change "+o),c=!0,h=e.find(".sbi_photo").innerWidth(),u=a.getBestResolutionForAuto(h,t,e),g=640,u){case 320:g=320;break;case 150:g=150}g>d&&(_=n[g].split("?ig_cache_key")[0],s.attr("src",_),s.closest(".sbi_photo").css("background-image",'url("'+_+'")')),"masonry"!==a.layout&&"highlight"!==a.layout||(i(a.el).find("#sbi_images").smashotope(a.isotopeArgs),setTimeout(function(){i(a.el).find("#sbi_images").smashotope(a.isotopeArgs)},500))}else if(a.settings.debugEnabled){var r=c?"already checked":"no aspect ratio change";console.log("not raising res for replacement "+o,r)}})}}e.find("img").on("error",function(){if(i(this).hasClass("sbi_img_error"))console.log("unfixed error "+i(this).attr("src"));else{var e;if(i(this).addClass("sbi_img_error"),i(this).attr("src").indexOf("media?size=")>-1||i(this).attr("src").indexOf("cdninstagram")>-1||i(this).attr("src").indexOf("fbcdn")>-1)a.settings.favorLocal=!0,void 0!==(e=a.getImageUrls(i(this).closest(".sbi_item")))[640]&&(i(this).attr("src",e[640]),i(this).closest(".sbi_photo").css("background-image","url("+e[640]+")"),i(this).closest(".sbi_item").addClass("sbi_had_error").find(".sbi_link_area").attr("href",e[640]).addClass("sbi_had_error"));else if("undefined"!==i(this).closest(".sbi_photo").attr("data-img-src-set"))void 0!==(e=JSON.parse(i(this).closest(".sbi_photo").attr("data-img-src-set").replace(/\\\//g,"/"))).d&&(i(this).attr("src",e.d),i(this).closest(".sbi_photo").css("background-image","url("+e.d+")"),i(this).closest(".sbi_item").addClass("sbi_had_error").find(".sbi_link_area").attr("href",e[640]).addClass("sbi_had_error"));setTimeout(function(){a.afterResize()},1500)}})}},maybeRaiseImageResolution:function(e){var s=this,t=void 0!==e&&!0===e?".sbi_item.sbi_new":".sbi_item",a=!s.isInitialized;i(s.el).find(t).each(function(e){!i(this).hasClass("sbi_num_diff_hide")&&i(this).find(".sbi_photo").length&&void 0!==i(this).find(".sbi_photo").attr("data-img-src-set")&&s.maybeRaiseSingleImageResolution(i(this),e,a)}),s.isInitialized=!0},getBestResolutionForAuto:function(e,s,t){(isNaN(s)||s<1)&&(s=1);var a=e*s,n=10*Math.ceil(a/10),o=[150,320,640];if(t.hasClass("sbi_highlighted")&&(n*=2),-1===o.indexOf(parseInt(n))){var d=!1;i.each(o,function(i,e){e>parseInt(n)&&!d&&(n=e,d=!0)})}return n},hideExtraImagesForWidth:function(){if("carousel"!==this.layout){var e=i(this.el),s=void 0!==e.attr("data-num")&&""!==e.attr("data-num")?parseInt(e.attr("data-num")):1,t=void 0!==e.attr("data-nummobile")&&""!==e.attr("data-nummobile")?parseInt(e.attr("data-nummobile")):s;i(window).width()<480?t<e.find(".sbi_item").length&&e.find(".sbi_item").slice(t-e.find(".sbi_item").length).addClass("sbi_num_diff_hide"):s<e.find(".sbi_item").length&&e.find(".sbi_item").slice(s-e.find(".sbi_item").length).addClass("sbi_num_diff_hide")}},setImageSizeClass:function(){var e=i(this.el);e.removeClass("sbi_small sbi_medium");var s=e.innerWidth(),t=parseInt(e.find("#sbi_images").outerWidth()-e.find("#sbi_images").width())/2,a=this.getColumnCount(),n=(s-t*(a+2))/a;n>120&&n<240?e.addClass("sbi_medium"):n<=120&&e.addClass("sbi_small")},setMinImageWidth:function(){i(this.el).find(".sbi_item .sbi_photo").first().length?this.minImageWidth=i(this.el).find(".sbi_item .sbi_photo").first().innerWidth():this.minImageWidth=150},setImageResolution:function(){if("auto"===this.settings.imgRes)this.imageResolution="auto";else switch(this.settings.imgRes){case"thumb":this.imageResolution=150;break;case"medium":this.imageResolution=320;break;default:this.imageResolution=640}},getImageUrls:function(i){var e=JSON.parse(i.find(".sbi_photo").attr("data-img-src-set").replace(/\\\//g,"/")),s=i.attr("id").replace("sbi_","");if(void 0!==this.resizedImages[s]&&"video"!==this.resizedImages[s]&&"pending"!==this.resizedImages[s]&&"error"!==this.resizedImages[s].id&&"video"!==this.resizedImages[s].id&&"pending"!==this.resizedImages[s].id){if(void 0!==this.resizedImages[s].sizes){var t=[];void 0!==this.resizedImages[s].sizes.full&&(e[640]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"full.jpg",t.push(640)),void 0!==this.resizedImages[s].sizes.low&&(e[320]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"low.jpg",t.push(320)),void 0!==this.resizedImages[s].sizes.thumb&&(t.push(150),e[150]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"thumb.jpg"),this.settings.favorLocal&&(-1===t.indexOf(640)&&t.indexOf(320)>-1&&(e[640]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"low.jpg"),-1===t.indexOf(320)&&(t.indexOf(640)>-1?e[320]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"full.jpg":t.indexOf(150)>-1&&(e[320]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"thumb.jpg")),-1===t.indexOf(150)&&(t.indexOf(320)>-1?e[150]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"low.jpg":t.indexOf(640)>-1&&(e[150]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"full.jpg")))}}else(void 0===this.resizedImages[s]||void 0!==this.resizedImages[s].id&&"pending"!==this.resizedImages[s].id&&"error"!==this.resizedImages[s].id)&&this.addToNeedsResizing(s);return e},getAvatarUrl:function(i,e){if(""===i)return"";var s=this.settings.general.avatars;return"local"===(e=void 0!==e?e:"local")?void 0!==s["LCL"+i]&&1===parseInt(s["LCL"+i])?sb_instagram_js_options.resized_url+i+".jpg":void 0!==s[i]?s[i]:"":void 0!==s[i]?s[i]:void 0!==s["LCL"+i]&&1===parseInt(s["LCL"+i])?sb_instagram_js_options.resized_url+i+".jpg":""},addToNeedsResizing:function(i){-1===this.needsResizing.indexOf(i)&&this.needsResizing.push(i)},applyImageLiquid:function(){var s=i(this.el);e(),"function"==typeof s.find(".sbi_photo").sbi_imgLiquid&&s.find(".sbi_photo").sbi_imgLiquid({fill:!0})},listenForVisibilityChange:function(){var e,s,t,a=this;e=jQuery,s={callback:function(){},runOnLoad:!0,frequency:100,sbiPreviousVisibility:null},t={sbiCheckVisibility:function(i,e){if(jQuery.contains(document,i[0])){var s=e.sbiPreviousVisibility,a=i.is(":visible");e.sbiPreviousVisibility=a,null==s?e.runOnLoad&&e.callback(i,a):s!==a&&e.callback(i,a),setTimeout(function(){t.sbiCheckVisibility(i,e)},e.frequency)}}},e.fn.sbiVisibilityChanged=function(i){var a=e.extend({},s,i);return this.each(function(){t.sbiCheckVisibility(e(this),a)})},"function"==typeof i(this.el).filter(":hidden").sbiVisibilityChanged&&i(this.el).filter(":hidden").sbiVisibilityChanged({callback:function(i,e){a.afterResize()},runOnLoad:!1})},getColumnCount:function(){var e=i(this.el),s=this.settings.cols,t=this.settings.colsmobile,a=s;return sbiWindowWidth=window.innerWidth,e.hasClass("sbi_mob_col_auto")?(sbiWindowWidth<640&&parseInt(s)>2&&parseInt(s)<7&&(a=2),sbiWindowWidth<640&&parseInt(s)>6&&parseInt(s)<11&&(a=4),sbiWindowWidth<=480&&parseInt(s)>2&&(a=1)):sbiWindowWidth<=480&&(a=t),parseInt(a)}},window.sbi_init=function(){window.sbi=new s,window.sbi.createPage(window.sbi.createFeeds,{whenFeedsCreated:window.sbi.afterFeedsCreated})}}(jQuery),jQuery(document).ready(function(i){void 0===window.sb_instagram_js_options&&(window.sb_instagram_js_options={font_method:"svg",resized_url:location.protocol+"//"+window.location.hostname+"/wp-content/uploads/sb-instagram-feed-images/",placeholder:location.protocol+"//"+window.location.hostname+"/wp-content/plugins/instagram-feed/img/placeholder.png"}),void 0!==window.sb_instagram_js_options.resized_url&&-1===window.sb_instagram_js_options.resized_url.indexOf(location.protocol)&&("http:"===location.protocol?window.sb_instagram_js_options.resized_url=window.sb_instagram_js_options.resized_url.replace("http:","https:"):window.sb_instagram_js_options.resized_url=window.sb_instagram_js_options.resized_url.replace("https:","http:")),sbi_init()}));
|
1 |
+
var sbi_js_exists=void 0!==sbi_js_exists;sbi_js_exists||(!function(i){function e(){var i,e,s,t=t||{VER:"0.9.944"};t.bgs_Available=!1,t.bgs_CheckRunned=!1,function(i){i.fn.extend({sbi_imgLiquid:function(e){this.defaults={fill:!0,verticalAlign:"center",horizontalAlign:"center",useBackgroundSize:!0,useDataHtmlAttr:!0,responsive:!0,delay:0,fadeInTime:0,removeBoxBackground:!0,hardPixels:!0,responsiveCheckTime:500,timecheckvisibility:500,onStart:null,onFinish:null,onItemStart:null,onItemFinish:null,onItemError:null},function(){if(!t.bgs_CheckRunned){t.bgs_CheckRunned=!0;var e=i('<span style="background-size:cover" />');i("body").append(e),function(){var i=e[0];if(i&&window.getComputedStyle){var s=window.getComputedStyle(i,null);s&&s.backgroundSize&&(t.bgs_Available="cover"===s.backgroundSize)}}(),e.remove()}}();var s=this;return this.options=e,this.settings=i.extend({},this.defaults,this.options),this.settings.onStart&&this.settings.onStart(),this.each(function(e){function a(){(r.responsive||h.data("sbi_imgLiquid_oldProcessed"))&&h.data("sbi_imgLiquid_settings")&&(r=h.data("sbi_imgLiquid_settings"),l.actualSize=l.get(0).offsetWidth+l.get(0).offsetHeight/1e4,l.sizeOld&&l.actualSize!==l.sizeOld&&o(),l.sizeOld=l.actualSize,setTimeout(a,r.responsiveCheckTime))}function n(){h.data("sbi_imgLiquid_error",!0),l.addClass("sbi_imgLiquid_error"),r.onItemError&&r.onItemError(e,l,h),d()}function o(){var i,s,t,a,n,o,g,u,m=0,_=0,f=l.width(),c=l.height();void 0===h.data("owidth")&&h.data("owidth",h[0].width),void 0===h.data("oheight")&&h.data("oheight",h[0].height),r.fill===f/c>=h.data("owidth")/h.data("oheight")?(i="100%",s="auto",t=Math.floor(f),a=Math.floor(f*(h.data("oheight")/h.data("owidth")))):(i="auto",s="100%",t=Math.floor(c*(h.data("owidth")/h.data("oheight"))),a=Math.floor(c)),g=f-t,"left"===(n=r.horizontalAlign.toLowerCase())&&(_=0),"center"===n&&(_=.5*g),"right"===n&&(_=g),-1!==n.indexOf("%")&&((n=parseInt(n.replace("%",""),10))>0&&(_=g*n*.01)),u=c-a,"left"===(o=r.verticalAlign.toLowerCase())&&(m=0),"center"===o&&(m=.5*u),"bottom"===o&&(m=u),-1!==o.indexOf("%")&&((o=parseInt(o.replace("%",""),10))>0&&(m=u*o*.01)),r.hardPixels&&(i=t,s=a),h.css({width:i,height:s,"margin-left":Math.floor(_),"margin-top":Math.floor(m)}),h.data("sbi_imgLiquid_oldProcessed")||(h.fadeTo(r.fadeInTime,1),h.data("sbi_imgLiquid_oldProcessed",!0),r.removeBoxBackground&&l.css("background-image","none"),l.addClass("sbi_imgLiquid_nobgSize"),l.addClass("sbi_imgLiquid_ready")),r.onItemFinish&&r.onItemFinish(e,l,h),d()}function d(){e===s.length-1&&s.settings.onFinish&&s.settings.onFinish()}var r=s.settings,l=i(this),h=i("img:first",l);return h.length?(h.data("sbi_imgLiquid_settings")?(l.removeClass("sbi_imgLiquid_error").removeClass("sbi_imgLiquid_ready"),r=i.extend({},h.data("sbi_imgLiquid_settings"),s.options)):r=i.extend({},s.settings,function(){var i={};if(s.settings.useDataHtmlAttr){var e=l.attr("data-sbi_imgLiquid-fill"),a=l.attr("data-sbi_imgLiquid-horizontalAlign"),n=l.attr("data-sbi_imgLiquid-verticalAlign");("true"===e||"false"===e)&&(i.fill=Boolean("true"===e)),void 0===a||"left"!==a&&"center"!==a&&"right"!==a&&-1===a.indexOf("%")||(i.horizontalAlign=a),void 0===n||"top"!==n&&"bottom"!==n&&"center"!==n&&-1===n.indexOf("%")||(i.verticalAlign=n)}return t.isIE&&s.settings.ieFadeInDisabled&&(i.fadeInTime=0),i}()),h.data("sbi_imgLiquid_settings",r),r.onItemStart&&r.onItemStart(e,l,h),void(t.bgs_Available&&r.useBackgroundSize?(-1===l.css("background-image").indexOf(encodeURI(h.attr("src")))&&l.css({"background-image":'url("'+encodeURI(h.attr("src"))+'")'}),l.css({"background-size":r.fill?"cover":"contain","background-position":(r.horizontalAlign+" "+r.verticalAlign).toLowerCase(),"background-repeat":"no-repeat"}),i("a:first",l).css({display:"block",width:"100%",height:"100%"}),i("img",l).css({display:"none"}),r.onItemFinish&&r.onItemFinish(e,l,h),l.addClass("sbi_imgLiquid_bgSize"),l.addClass("sbi_imgLiquid_ready"),d()):function s(){if(h.data("oldSrc")&&h.data("oldSrc")!==h.attr("src")){var t=h.clone().removeAttr("style");return t.data("sbi_imgLiquid_settings",h.data("sbi_imgLiquid_settings")),h.parent().prepend(t),h.remove(),(h=t)[0].width=0,void setTimeout(s,10)}return h.data("sbi_imgLiquid_oldProcessed")?void o():(h.data("sbi_imgLiquid_oldProcessed",!1),h.data("oldSrc",h.attr("src")),i("img:not(:first)",l).css("display","none"),l.css({overflow:"hidden"}),h.fadeTo(0,0).removeAttr("width").removeAttr("height").css({visibility:"visible","max-width":"none","max-height":"none",width:"auto",height:"auto",display:"block"}),h.on("error",n),h[0].onerror=n,function i(){h.data("sbi_imgLiquid_error")||h.data("sbi_imgLiquid_loaded")||h.data("sbi_imgLiquid_oldProcessed")||(l.is(":visible")&&h[0].complete&&h[0].width>0&&h[0].height>0?(h.data("sbi_imgLiquid_loaded",!0),setTimeout(o,e*r.delay)):setTimeout(i,r.timecheckvisibility))}(),void a())}())):void n()})}})}(jQuery),i=t.injectCss,e=document.getElementsByTagName("head")[0],(s=document.createElement("style")).type="text/css",s.styleSheet?s.styleSheet.cssText=i:s.appendChild(document.createTextNode(i)),e.appendChild(s)}function s(){this.feeds={},this.options=sb_instagram_js_options}function t(i,e,s){this.el=i,this.index=e,this.settings=s,this.minImageWidth=0,this.imageResolution=150,this.resizedImages={},this.needsResizing=[],this.outOfPages=!1,this.isInitialized=!1}function a(e,s){i.ajax({url:sbiajaxurl,type:"post",data:e,success:s})}s.prototype={createPage:function(e,s){void 0!==window.sbiajaxurl&&-1!==window.sbiajaxurl.indexOf(window.location.hostname)||(window.sbiajaxurl=location.protocol+"//"+window.location.hostname+"/wp-admin/admin-ajax.php"),i(".sbi_no_js_error_message").remove(),i(".sbi_no_js").removeClass("sbi_no_js"),e(s)},createFeeds:function(e){e.whenFeedsCreated(i(".sbi").each(function(e){i(this).attr("data-sbi-index",e+1);var s=i(this),n=void 0!==s.attr("data-sbi-flags")?s.attr("data-sbi-flags").split(","):[],o=void 0!==s.attr("data-options")?JSON.parse(s.attr("data-options")):{};if(n.indexOf("testAjax")>-1){window.sbi.triggeredTest=!0;a({action:"sbi_on_ajax_test_trigger"},function(i){console.log("did test")})}var d={cols:s.attr("data-cols"),colsmobile:"same"!==s.attr("data-colsmobile")?s.attr("data-colsmobile"):s.attr("data-cols"),num:s.attr("data-num"),imgRes:s.attr("data-res"),feedID:s.attr("data-feedid"),shortCodeAtts:s.attr("data-shortcode-atts"),resizingEnabled:-1===n.indexOf("resizeDisable"),imageLoadEnabled:-1===n.indexOf("imageLoadDisable"),debugEnabled:n.indexOf("debug")>-1,favorLocal:n.indexOf("favorLocal")>-1,ajaxPostLoad:n.indexOf("ajaxPostLoad")>-1,autoMinRes:1,general:o};window.sbi.feeds[e]=function(i,e,s){return new t(i,e,s)}(this,e,d),window.sbi.feeds[e].setResizedImages(),window.sbi.feeds[e].init();var r=jQuery.Event("sbiafterfeedcreate");r.feed=window.sbi.feeds[e],jQuery(window).trigger(r)}))},afterFeedsCreated:function(){i(".sb_instagram_header").each(function(){var e=i(this);e.find(".sbi_header_link").hover(function(){e.find(".sbi_header_img_hover").addClass("sbi_fade_in")},function(){e.find(".sbi_header_img_hover").removeClass("sbi_fade_in")})})},encodeHTML:function(i){return void 0===i?"":i.replace(/(>)/g,">").replace(/(<)/g,"<").replace(/(<br\/>)/g,"<br>").replace(/(<br>)/g,"<br>")},urlDetect:function(i){return i.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/g)}},t.prototype={init:function(){var e=this;i(this.el).find("#sbi_mod_error").length&&i(this.el).prepend(i(this.el).find("#sbi_mod_error")),this.settings.ajaxPostLoad?this.getNewPostSet():this.afterInitialImagesLoaded();var s,t=(s=0,function(i,e){clearTimeout(s),s=setTimeout(i,e)});jQuery(window).resize(function(){t(function(){e.afterResize()},500)})},initLayout:function(){},afterInitialImagesLoaded:function(){this.initLayout(),this.loadMoreButtonInit(),this.hideExtraImagesForWidth(),this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed()},afterResize:function(){this.setImageHeight(),this.setImageResolution(),this.maybeRaiseImageResolution(),this.setImageSizeClass()},afterLoadMoreClicked:function(i){i.find(".sbi_loader").removeClass("sbi_hidden"),i.find(".sbi_btn_text").addClass("sbi_hidden"),i.closest(".sbi").find(".sbi_num_diff_hide").addClass("sbi_transition").removeClass("sbi_num_diff_hide")},afterNewImagesLoaded:function(){var e=i(this.el),s=this;this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed(),setTimeout(function(){e.find(".sbi_loader").addClass("sbi_hidden"),e.find(".sbi_btn_text").removeClass("sbi_hidden"),s.maybeRaiseImageResolution()},500)},beforeNewImagesRevealed:function(){this.setImageHeight(),this.maybeRaiseImageResolution(!0),this.setImageSizeClass()},revealNewImages:function(){var e=i(this.el);e.find(".sbi-screenreader").each(function(){i(this).find("img").remove()}),"function"==typeof sbi_custom_js&&setTimeout(function(){sbi_custom_js()},100),this.applyImageLiquid(),e.find(".sbi_item").each(function(i){jQuery(this).find(".sbi_photo").hover(function(){jQuery(this).fadeTo(200,.85)},function(){jQuery(this).stop().fadeTo(500,1)})}),setTimeout(function(){jQuery("#sbi_images .sbi_item.sbi_new").removeClass("sbi_new");var i=10;e.find(".sbi_transition").each(function(){var e=jQuery(this);setTimeout(function(){e.removeClass("sbi_transition")},i),i+=10})},500)},afterNewImagesRevealed:function(){this.listenForVisibilityChange(),this.sendNeedsResizingToServer(),this.settings.imageLoadEnabled||i(".sbi_no_resraise").removeClass("sbi_no_resraise");var e=i.Event("sbiafterimagesloaded");e.el=i(this.el),i(window).trigger(e)},setResizedImages:function(){i(this.el).find(".sbi_resized_image_data").length&&void 0!==i(this.el).find(".sbi_resized_image_data").attr("data-resized")&&0===i(this.el).find(".sbi_resized_image_data").attr("data-resized").indexOf('{"')&&(this.resizedImages=JSON.parse(i(this.el).find(".sbi_resized_image_data").attr("data-resized")),i(this.el).find(".sbi_resized_image_data").remove())},sendNeedsResizingToServer:function(){var e=this;if(e.needsResizing.length>0&&e.settings.resizingEnabled){var s=i(this.el).find(".sbi_item").length;a({action:"sbi_resized_images_submit",needs_resizing:e.needsResizing,offset:s,feed_id:e.settings.feedID,atts:e.settings.shortCodeAtts},function(i){if(0===i.trim().indexOf("{")){var s=JSON.parse(i);e.settings.debugEnabled&&console.log(s)}})}},loadMoreButtonInit:function(){var e=i(this.el),s=this;e.find("#sbi_load .sbi_load_btn").off().on("click",function(){s.afterLoadMoreClicked(jQuery(this)),s.getNewPostSet()})},getNewPostSet:function(){var e=i(this.el),s=this;a({action:"sbi_load_more_clicked",offset:e.find(".sbi_item").length,feed_id:s.settings.feedID,atts:s.settings.shortCodeAtts,current_resolution:s.imageResolution},function(t){if(0===t.trim().indexOf("{")){var a=JSON.parse(t);s.settings.debugEnabled&&console.log(a),s.appendNewPosts(a.html),s.addResizedImages(a.resizedImages),s.settings.ajaxPostLoad?(s.settings.ajaxPostLoad=!1,s.afterInitialImagesLoaded()):s.afterNewImagesLoaded(),a.feedStatus.shouldPaginate?s.outOfPages=!1:(s.outOfPages=!0,e.find(".sbi_load_btn").hide()),i(".sbi_no_js").removeClass("sbi_no_js")}})},appendNewPosts:function(e){var s=i(this.el);s.find("#sbi_images .sbi_item").length?s.find("#sbi_images .sbi_item").last().after(e):s.find("#sbi_images").append(e)},addResizedImages:function(i){for(var e in i)this.resizedImages[e]=i[e]},setImageHeight:function(){var e=i(this.el),s=e.find(".sbi_photo").eq(0).innerWidth(),t=this.getColumnCount(),a=e.find("#sbi_images").innerWidth()-e.find("#sbi_images").width(),n=a/2;sbi_photo_width_manual=e.find("#sbi_images").width()/t-a,e.find(".sbi_photo").css("height",s),e.find(".sbi-owl-nav").length&&setTimeout(function(){var i=2;e.find(".sbi_owl2row-item").length&&(i=1);var s=e.find(".sbi_photo").eq(0).innerWidth()/i;s+=parseInt(n)*(2-i+2),e.find(".sbi-owl-nav div").css("top",s)},100)},maybeRaiseSingleImageResolution:function(e,s,t){var a=this,n=a.getImageUrls(e),o=e.find(".sbi_photo img").attr("src"),d=150,r=e.find("img").get(0),l=o===window.sbi.options.placeholder?1:r.naturalWidth/r.naturalHeight;t=void 0!==t&&t;if(!(e.hasClass("sbi_no_resraise")||e.hasClass("sbi_had_error")||e.find(".sbi_link_area").length&&e.find(".sbi_link_area").hasClass("sbi_had_error"))){i.each(n,function(i,e){e===o&&(d=parseInt(i),t=!1)});var h=640;switch(a.settings.imgRes){case"thumb":h=150;break;case"medium":h=320;break;case"full":h=640;break;default:var g=Math.max(a.settings.autoMinRes,e.find(".sbi_photo").innerWidth()),u=a.getBestResolutionForAuto(g,l,e);switch(u){case 320:h=320;break;case 150:h=150}}if(h>d||o===window.sbi.options.placeholder||t){if(a.settings.debugEnabled){var m=o===window.sbi.options.placeholder?"was placeholder":"too small";console.log("rais res for "+o,m)}var _=n[h].split("?ig_cache_key")[0];if(e.find(".sbi_photo img").attr("src",_),e.find(".sbi_photo").css("background-image",'url("'+_+'")'),d=h,"auto"===a.settings.imgRes){var f=!1;e.find(".sbi_photo img").on("load",function(){var s=i(this),t=s.get(0).naturalWidth/s.get(0).naturalHeight;if(1e3!==s.get(0).naturalWidth&&t>l&&!f){switch(a.settings.debugEnabled&&console.log("rais res again for aspect ratio change "+o),f=!0,g=e.find(".sbi_photo").innerWidth(),u=a.getBestResolutionForAuto(g,t,e),h=640,u){case 320:h=320;break;case 150:h=150}h>d&&(_=n[h].split("?ig_cache_key")[0],s.attr("src",_),s.closest(".sbi_photo").css("background-image",'url("'+_+'")')),"masonry"!==a.layout&&"highlight"!==a.layout||(i(a.el).find("#sbi_images").smashotope(a.isotopeArgs),setTimeout(function(){i(a.el).find("#sbi_images").smashotope(a.isotopeArgs)},500))}else if(a.settings.debugEnabled){var r=f?"already checked":"no aspect ratio change";console.log("not raising res for replacement "+o,r)}})}}e.find("img").on("error",function(){if(i(this).hasClass("sbi_img_error"))console.log("unfixed error "+i(this).attr("src"));else{var e;if(i(this).addClass("sbi_img_error"),i(this).attr("src").indexOf("media?size=")>-1||i(this).attr("src").indexOf("cdninstagram")>-1||i(this).attr("src").indexOf("fbcdn")>-1)a.settings.favorLocal=!0,void 0!==(e=a.getImageUrls(i(this).closest(".sbi_item")))[640]&&(i(this).attr("src",e[640]),i(this).closest(".sbi_photo").css("background-image","url("+e[640]+")"),i(this).closest(".sbi_item").addClass("sbi_had_error").find(".sbi_link_area").attr("href",e[640]).addClass("sbi_had_error"));else if("undefined"!==i(this).closest(".sbi_photo").attr("data-img-src-set"))void 0!==(e=JSON.parse(i(this).closest(".sbi_photo").attr("data-img-src-set").replace(/\\\//g,"/"))).d&&(i(this).attr("src",e.d),i(this).closest(".sbi_photo").css("background-image","url("+e.d+")"),i(this).closest(".sbi_item").addClass("sbi_had_error").find(".sbi_link_area").attr("href",e[640]).addClass("sbi_had_error"));setTimeout(function(){a.afterResize()},1500)}})}},maybeRaiseImageResolution:function(e){var s=this,t=void 0!==e&&!0===e?".sbi_item.sbi_new":".sbi_item",a=!s.isInitialized;i(s.el).find(t).each(function(e){!i(this).hasClass("sbi_num_diff_hide")&&i(this).find(".sbi_photo").length&&void 0!==i(this).find(".sbi_photo").attr("data-img-src-set")&&s.maybeRaiseSingleImageResolution(i(this),e,a)}),s.isInitialized=!0},getBestResolutionForAuto:function(e,s,t){(isNaN(s)||s<1)&&(s=1);var a=e*s,n=10*Math.ceil(a/10),o=[150,320,640];if(t.hasClass("sbi_highlighted")&&(n*=2),-1===o.indexOf(parseInt(n))){var d=!1;i.each(o,function(i,e){e>parseInt(n)&&!d&&(n=e,d=!0)})}return n},hideExtraImagesForWidth:function(){if("carousel"!==this.layout){var e=i(this.el),s=void 0!==e.attr("data-num")&&""!==e.attr("data-num")?parseInt(e.attr("data-num")):1,t=void 0!==e.attr("data-nummobile")&&""!==e.attr("data-nummobile")?parseInt(e.attr("data-nummobile")):s;i(window).width()<480?t<e.find(".sbi_item").length&&e.find(".sbi_item").slice(t-e.find(".sbi_item").length).addClass("sbi_num_diff_hide"):s<e.find(".sbi_item").length&&e.find(".sbi_item").slice(s-e.find(".sbi_item").length).addClass("sbi_num_diff_hide")}},setImageSizeClass:function(){var e=i(this.el);e.removeClass("sbi_small sbi_medium");var s=e.innerWidth(),t=parseInt(e.find("#sbi_images").outerWidth()-e.find("#sbi_images").width())/2,a=this.getColumnCount(),n=(s-t*(a+2))/a;n>120&&n<240?e.addClass("sbi_medium"):n<=120&&e.addClass("sbi_small")},setMinImageWidth:function(){i(this.el).find(".sbi_item .sbi_photo").first().length?this.minImageWidth=i(this.el).find(".sbi_item .sbi_photo").first().innerWidth():this.minImageWidth=150},setImageResolution:function(){if("auto"===this.settings.imgRes)this.imageResolution="auto";else switch(this.settings.imgRes){case"thumb":this.imageResolution=150;break;case"medium":this.imageResolution=320;break;default:this.imageResolution=640}},getImageUrls:function(i){var e=JSON.parse(i.find(".sbi_photo").attr("data-img-src-set").replace(/\\\//g,"/")),s=i.attr("id").replace("sbi_","");if(void 0!==this.resizedImages[s]&&"video"!==this.resizedImages[s]&&"pending"!==this.resizedImages[s]&&"error"!==this.resizedImages[s].id&&"video"!==this.resizedImages[s].id&&"pending"!==this.resizedImages[s].id){if(void 0!==this.resizedImages[s].sizes){var t=[];void 0!==this.resizedImages[s].sizes.full&&(e[640]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"full.jpg",t.push(640)),void 0!==this.resizedImages[s].sizes.low&&(e[320]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"low.jpg",t.push(320)),void 0!==this.resizedImages[s].sizes.thumb&&(t.push(150),e[150]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"thumb.jpg"),this.settings.favorLocal&&(-1===t.indexOf(640)&&t.indexOf(320)>-1&&(e[640]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"low.jpg"),-1===t.indexOf(320)&&(t.indexOf(640)>-1?e[320]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"full.jpg":t.indexOf(150)>-1&&(e[320]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"thumb.jpg")),-1===t.indexOf(150)&&(t.indexOf(320)>-1?e[150]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"low.jpg":t.indexOf(640)>-1&&(e[150]=sb_instagram_js_options.resized_url+this.resizedImages[s].id+"full.jpg")))}}else(void 0===this.resizedImages[s]||void 0!==this.resizedImages[s].id&&"pending"!==this.resizedImages[s].id&&"error"!==this.resizedImages[s].id)&&this.addToNeedsResizing(s);return e},getAvatarUrl:function(i,e){if(""===i)return"";var s=this.settings.general.avatars;return"local"===(e=void 0!==e?e:"local")?void 0!==s["LCL"+i]&&1===parseInt(s["LCL"+i])?sb_instagram_js_options.resized_url+i+".jpg":void 0!==s[i]?s[i]:"":void 0!==s[i]?s[i]:void 0!==s["LCL"+i]&&1===parseInt(s["LCL"+i])?sb_instagram_js_options.resized_url+i+".jpg":""},addToNeedsResizing:function(i){-1===this.needsResizing.indexOf(i)&&this.needsResizing.push(i)},applyImageLiquid:function(){var s=i(this.el);e(),"function"==typeof s.find(".sbi_photo").sbi_imgLiquid&&s.find(".sbi_photo").sbi_imgLiquid({fill:!0})},listenForVisibilityChange:function(){var e,s,t,a=this;e=jQuery,s={callback:function(){},runOnLoad:!0,frequency:100,sbiPreviousVisibility:null},t={sbiCheckVisibility:function(i,e){if(jQuery.contains(document,i[0])){var s=e.sbiPreviousVisibility,a=i.is(":visible");e.sbiPreviousVisibility=a,null==s?e.runOnLoad&&e.callback(i,a):s!==a&&e.callback(i,a),setTimeout(function(){t.sbiCheckVisibility(i,e)},e.frequency)}}},e.fn.sbiVisibilityChanged=function(i){var a=e.extend({},s,i);return this.each(function(){t.sbiCheckVisibility(e(this),a)})},"function"==typeof i(this.el).filter(":hidden").sbiVisibilityChanged&&i(this.el).filter(":hidden").sbiVisibilityChanged({callback:function(i,e){a.afterResize()},runOnLoad:!1})},getColumnCount:function(){var e=i(this.el),s=this.settings.cols,t=this.settings.colsmobile,a=s;return sbiWindowWidth=window.innerWidth,e.hasClass("sbi_mob_col_auto")?(sbiWindowWidth<640&&parseInt(s)>2&&parseInt(s)<7&&(a=2),sbiWindowWidth<640&&parseInt(s)>6&&parseInt(s)<11&&(a=4),sbiWindowWidth<=480&&parseInt(s)>2&&(a=1)):sbiWindowWidth<=480&&(a=t),parseInt(a)}},window.sbi_init=function(){window.sbi=new s,window.sbi.createPage(window.sbi.createFeeds,{whenFeedsCreated:window.sbi.afterFeedsCreated})}}(jQuery),jQuery(document).ready(function(i){void 0===window.sb_instagram_js_options&&(window.sb_instagram_js_options={font_method:"svg",resized_url:location.protocol+"//"+window.location.hostname+"/wp-content/uploads/sb-instagram-feed-images/",placeholder:location.protocol+"//"+window.location.hostname+"/wp-content/plugins/instagram-feed/img/placeholder.png"}),void 0!==window.sb_instagram_js_options.resized_url&&-1===window.sb_instagram_js_options.resized_url.indexOf(location.protocol)&&("http:"===location.protocol?window.sb_instagram_js_options.resized_url=window.sb_instagram_js_options.resized_url.replace("http:","https:"):window.sb_instagram_js_options.resized_url=window.sb_instagram_js_options.resized_url.replace("https:","http:")),sbi_init()}));
|
templates/feed.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
* Creates the wrapping HTML and adds settings as attributes
|
5 |
*
|
6 |
-
* @version 2.
|
7 |
*
|
8 |
*/
|
9 |
// Don't load directly
|
@@ -17,14 +17,26 @@ $cols_setting = $settings['cols'];
|
|
17 |
$num_setting = $settings['num'];
|
18 |
$icon_type = $settings['font_method'];
|
19 |
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
include sbi_get_feed_template_part( 'header', $settings );
|
22 |
}
|
23 |
?>
|
24 |
|
25 |
<div id="sb_instagram" class="sbi sbi_col_<?php echo esc_attr( $cols_setting ); ?> <?php echo esc_attr( $additional_classes ); ?>"<?php echo $feed_styles; ?> data-feedid="<?php echo esc_attr( $feed_id ); ?>" data-res="<?php echo esc_attr( $image_resolution_setting ); ?>" data-cols="<?php echo esc_attr( $cols_setting ); ?>" data-num="<?php echo esc_attr( $num_setting ); ?>" data-shortcode-atts="<?php echo esc_attr( $shortcode_atts ); ?>" <?php echo $other_atts; ?>>
|
26 |
<?php
|
27 |
-
if (
|
28 |
include sbi_get_feed_template_part( 'header', $settings );
|
29 |
}
|
30 |
?>
|
@@ -37,7 +49,7 @@ if ( $settings['showheader'] && ! empty( $posts ) && $settings['headeroutside']
|
|
37 |
?>
|
38 |
</div>
|
39 |
|
40 |
-
<?php
|
41 |
|
42 |
<?php
|
43 |
/**
|
@@ -50,4 +62,6 @@ if ( $settings['showheader'] && ! empty( $posts ) && $settings['headeroutside']
|
|
50 |
* @since 2.1/5.2
|
51 |
*/
|
52 |
do_action( 'sbi_before_feed_end', $this, $feed_id ); ?>
|
53 |
-
</div>
|
|
|
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Smash Balloon Instagram Feed Main Template
|
4 |
* Creates the wrapping HTML and adds settings as attributes
|
5 |
*
|
6 |
+
* @version 2.2 Instagram Feed by Smash Balloon
|
7 |
*
|
8 |
*/
|
9 |
// Don't load directly
|
17 |
$num_setting = $settings['num'];
|
18 |
$icon_type = $settings['font_method'];
|
19 |
|
20 |
+
/**
|
21 |
+
* Add HTML or execute code before the feed displays.
|
22 |
+
* sbi_after_feed works the same way but executes
|
23 |
+
* after the feed
|
24 |
+
*
|
25 |
+
* @param array $posts Instagram posts in feed
|
26 |
+
* @param array $settings settings specific to this feed
|
27 |
+
*
|
28 |
+
* @since 2.2
|
29 |
+
*/
|
30 |
+
do_action( 'sbi_before_feed', $posts, $settings );
|
31 |
+
|
32 |
+
if ( ! empty( $header_data ) && $settings['showheader'] && $settings['headeroutside'] ) {
|
33 |
include sbi_get_feed_template_part( 'header', $settings );
|
34 |
}
|
35 |
?>
|
36 |
|
37 |
<div id="sb_instagram" class="sbi sbi_col_<?php echo esc_attr( $cols_setting ); ?> <?php echo esc_attr( $additional_classes ); ?>"<?php echo $feed_styles; ?> data-feedid="<?php echo esc_attr( $feed_id ); ?>" data-res="<?php echo esc_attr( $image_resolution_setting ); ?>" data-cols="<?php echo esc_attr( $cols_setting ); ?>" data-num="<?php echo esc_attr( $num_setting ); ?>" data-shortcode-atts="<?php echo esc_attr( $shortcode_atts ); ?>" <?php echo $other_atts; ?>>
|
38 |
<?php
|
39 |
+
if ( ! empty( $header_data ) && $settings['showheader'] && !$settings['headeroutside'] ) {
|
40 |
include sbi_get_feed_template_part( 'header', $settings );
|
41 |
}
|
42 |
?>
|
49 |
?>
|
50 |
</div>
|
51 |
|
52 |
+
<?php include sbi_get_feed_template_part( 'footer', $settings ); ?>
|
53 |
|
54 |
<?php
|
55 |
/**
|
62 |
* @since 2.1/5.2
|
63 |
*/
|
64 |
do_action( 'sbi_before_feed_end', $this, $feed_id ); ?>
|
65 |
+
</div>
|
66 |
+
|
67 |
+
<?php do_action( 'sbi_after_feed', $posts, $settings );?>
|
templates/footer.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
* Adds pagination and html for errors and resized images
|
5 |
*
|
6 |
-
* @version 2.
|
7 |
*
|
8 |
*/
|
9 |
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Smash Balloon Instagram Feed Footer Template
|
4 |
* Adds pagination and html for errors and resized images
|
5 |
*
|
6 |
+
* @version 2.2 Instagram Feed by Smash Balloon
|
7 |
*
|
8 |
*/
|
9 |
|
templates/header.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
* Adds account information and an avatar to the top of the feed
|
5 |
*
|
6 |
-
* @version 2.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -20,11 +20,12 @@ $name = SB_Instagram_Parse::get_name( $header_data );
|
|
20 |
$header_text_color_style = SB_Instagram_Display_Elements::get_header_text_color_styles( $settings ); // style="color: #517fa4;" already escaped
|
21 |
$size_class = SB_Instagram_Display_Elements::get_header_size_class( $settings );
|
22 |
|
23 |
-
$bio = SB_Instagram_Parse::get_bio( $header_data );
|
24 |
$should_show_bio = $settings['showbio'] && $bio !== '';
|
25 |
$bio_class = ! $should_show_bio ? ' sbi_no_bio' : '';
|
|
|
26 |
?>
|
27 |
-
<div class="sb_instagram_header <?php echo esc_attr( $size_class ); ?>" style="<?php echo $header_padding . $header_margin; ?>padding-bottom: 0;">
|
28 |
<a href="https://www.instagram.com/<?php echo urlencode( $username ); ?>" target="_blank" rel="noopener" title="@<?php echo esc_attr( $username ); ?>" class="sbi_header_link">
|
29 |
<div class="sbi_header_text<?php echo esc_attr( $bio_class ); ?>">
|
30 |
<h3 <?php echo $header_text_color_style; ?>><?php echo esc_html( $username ); ?></h3>
|
@@ -32,9 +33,16 @@ $bio_class = ! $should_show_bio ? ' sbi_no_bio' : '';
|
|
32 |
<p class="sbi_bio" <?php echo $header_text_color_style; ?>><?php echo str_replace( '<br />', '<br>', esc_html( nl2br( $bio ) ) ); ?></p>
|
33 |
<?php endif; ?>
|
34 |
</div>
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
36 |
<div class="sbi_header_img_hover"><?php echo SB_Instagram_Display_Elements::get_icon( 'newlogo', $icon_type ); ?></div>
|
37 |
<img src="<?php echo esc_url( $avatar ); ?>" alt="<?php echo esc_attr( $name ); ?>" width="50" height="50">
|
38 |
</div>
|
|
|
|
|
39 |
</a>
|
40 |
</div>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Smash Balloon Instagram Feed Header Template
|
4 |
* Adds account information and an avatar to the top of the feed
|
5 |
*
|
6 |
+
* @version 2.2 Instagram Feed by Smash Balloon
|
7 |
*
|
8 |
*/
|
9 |
|
20 |
$header_text_color_style = SB_Instagram_Display_Elements::get_header_text_color_styles( $settings ); // style="color: #517fa4;" already escaped
|
21 |
$size_class = SB_Instagram_Display_Elements::get_header_size_class( $settings );
|
22 |
|
23 |
+
$bio = SB_Instagram_Parse::get_bio( $header_data, $settings );
|
24 |
$should_show_bio = $settings['showbio'] && $bio !== '';
|
25 |
$bio_class = ! $should_show_bio ? ' sbi_no_bio' : '';
|
26 |
+
$avatar_class = $avatar !== '' ? '' : ' sbi_no_avatar';
|
27 |
?>
|
28 |
+
<div class="sb_instagram_header <?php echo esc_attr( $size_class ) . esc_attr( $avatar_class ); ?>" style="<?php echo $header_padding . $header_margin; ?>padding-bottom: 0;">
|
29 |
<a href="https://www.instagram.com/<?php echo urlencode( $username ); ?>" target="_blank" rel="noopener" title="@<?php echo esc_attr( $username ); ?>" class="sbi_header_link">
|
30 |
<div class="sbi_header_text<?php echo esc_attr( $bio_class ); ?>">
|
31 |
<h3 <?php echo $header_text_color_style; ?>><?php echo esc_html( $username ); ?></h3>
|
33 |
<p class="sbi_bio" <?php echo $header_text_color_style; ?>><?php echo str_replace( '<br />', '<br>', esc_html( nl2br( $bio ) ) ); ?></p>
|
34 |
<?php endif; ?>
|
35 |
</div>
|
36 |
+
<?php if ( $avatar === '' ) : ?>
|
37 |
+
<div class="sbi_header_img">
|
38 |
+
<div class="sbi_header_hashtag_icon"><?php echo SB_Instagram_Display_Elements::get_icon( 'newlogo', $icon_type ); ?></div>
|
39 |
+
</div>
|
40 |
+
<?php else: ?>
|
41 |
+
<div class="sbi_header_img" data-avatar-url="<?php echo esc_attr( $avatar ); ?>">
|
42 |
<div class="sbi_header_img_hover"><?php echo SB_Instagram_Display_Elements::get_icon( 'newlogo', $icon_type ); ?></div>
|
43 |
<img src="<?php echo esc_url( $avatar ); ?>" alt="<?php echo esc_attr( $name ); ?>" width="50" height="50">
|
44 |
</div>
|
45 |
+
<?php endif; ?>
|
46 |
+
|
47 |
</a>
|
48 |
</div>
|
templates/item.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
* Adds an image, link, and other data for each post in the feed
|
5 |
*
|
6 |
-
* @version 2.
|
7 |
*
|
8 |
*/
|
9 |
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Smash Balloon Instagram Feed Item Template
|
4 |
* Adds an image, link, and other data for each post in the feed
|
5 |
*
|
6 |
+
* @version 2.2 Instagram Feed by Smash Balloon
|
7 |
*
|
8 |
*/
|
9 |
|