Version Description
Download this release
Release Info
Developer | smashballoon |
Plugin | Instagram Feed |
Version | 1.0 |
Comparing to | |
See all releases |
Version 1.0
- README.txt +62 -0
- css/sb-instagram-admin.css +93 -0
- css/sb-instagram.css +101 -0
- gpl-2.0.txt +339 -0
- img/small-logo.png +0 -0
- instagram-feed-admin.php +278 -0
- instagram-feed.php +157 -0
- js/sb-instagram-admin.js +20 -0
- js/sb-instagram.js +56 -0
README.txt
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Instagram Feed ===
|
2 |
+
Contributors: smashballoon
|
3 |
+
Tags: Instagram, Instagram feed, Instagram photos
|
4 |
+
Requires at least: 3.0
|
5 |
+
Tested up to: 3.9.1
|
6 |
+
Stable tag: 1.0
|
7 |
+
License: GPLv2 or later
|
8 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
+
|
10 |
+
Add a beautifully clean, customizable, and responsive Instagram feed to your website
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
Display the Instagram photo feed of any non-private Instagram account.
|
15 |
+
|
16 |
+
= Features =
|
17 |
+
* Super simple to set up
|
18 |
+
* Completely responsive and mobile ready
|
19 |
+
* Display multiple Instagram feeds on the same page or on different pages throughout your site
|
20 |
+
* Customize the width, height, number of columns, image size, background color, image spacing and more!
|
21 |
+
|
22 |
+
Lots more features coming soon!
|
23 |
+
|
24 |
+
Credit to [Instafeed.js](https://github.com/stevenschobert/instafeed.js).
|
25 |
+
|
26 |
+
== Installation ==
|
27 |
+
|
28 |
+
1. Install the Instagram plugin either via the WordPress plugin directory, or by uploading the files to your web server (in the `/wp-content/plugins/` directory).
|
29 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
30 |
+
3. Navigate to the 'Instagram Feed' settings page to configure your Instagram feed.
|
31 |
+
4. Use the shortcode `[instagram-feed]` in your page, post or widget to display your photos.
|
32 |
+
5. You can display multiple Instagram feeds by using shortcode options, for example: `[instagram-feed id=1234567 cols=3 width=50%]`
|
33 |
+
|
34 |
+
== Frequently Asked Questions ==
|
35 |
+
|
36 |
+
= Can I display multiple Instagram feeds on my site? =
|
37 |
+
|
38 |
+
Yep. You can display multiple Instagram feeds by using shortcode options, for example: `[instagram-feed id=1234567 cols=3 width=50%]`.
|
39 |
+
|
40 |
+
Nope. The Access Token used in the plugin is a "read only" token, which means that it could never be used maliciously to manipulate your Instagram account.
|
41 |
+
|
42 |
+
= How do I find my Instagram Access Token and User ID =
|
43 |
+
|
44 |
+
We've made it super easy. Simply click on the big blue button on the Instagram plugins Settings page and log into your Instagram account. The plugin will then retrieve and display both your Access Token and User ID.
|
45 |
+
|
46 |
+
You can also display photos from other peoples Instagram accounts. To find their User ID you can use [this tool](http://jelled.com/instagram/lookup-user-id).
|
47 |
+
|
48 |
+
= Are there any security issues with using an Access Token on my site? =
|
49 |
+
|
50 |
+
Nope. The Access Token used in the plugin is a "read only" token, which means that it could never be used maliciously to manipulate your Instagram account.
|
51 |
+
|
52 |
+
== Screenshots ==
|
53 |
+
|
54 |
+
1. Display your Instagram photos in multiple columns and with a scrollbar if desired.
|
55 |
+
2. Customize the number of columns, colors and size of the feed.
|
56 |
+
3. An example of two columns with no space between photos.
|
57 |
+
4. The Instagram Settings page. Super simple to set up and customize.
|
58 |
+
|
59 |
+
== Changelog ==
|
60 |
+
|
61 |
+
= 1.0 =
|
62 |
+
* Launch!
|
css/sb-instagram-admin.css
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#sbi_admin{
|
2 |
+
overflow: hidden;
|
3 |
+
}
|
4 |
+
#sbi_admin .sbi_tooltip{
|
5 |
+
display: none;
|
6 |
+
|
7 |
+
padding: 10px 15px;
|
8 |
+
margin: 10px 0;
|
9 |
+
font-size: 13px;
|
10 |
+
background: #f9f9f9;
|
11 |
+
background: rgba(255,255,255,0.8);
|
12 |
+
|
13 |
+
-moz-border-radius: 8px;
|
14 |
+
-webkit-border-radius: 8px;
|
15 |
+
border-radius: 8px;
|
16 |
+
}
|
17 |
+
#sbi_admin .sbi_more_info p{
|
18 |
+
font-size: 13px;
|
19 |
+
}
|
20 |
+
#sbi_admin .sbi_tooltip ul{
|
21 |
+
margin-top: 0;
|
22 |
+
margin-bottom: 0;
|
23 |
+
}
|
24 |
+
#sbi_admin .sbi_tooltip li{
|
25 |
+
padding: 4px 0;
|
26 |
+
}
|
27 |
+
#sbi_admin .sbi_tooltip_link,
|
28 |
+
#sbi_admin .sbi_external_link{
|
29 |
+
font-size: 13px;
|
30 |
+
margin-left: 10px;
|
31 |
+
}
|
32 |
+
#sbi_admin hr{
|
33 |
+
border: none;
|
34 |
+
margin: 25px 0;
|
35 |
+
border-bottom: 1px solid #ccc;
|
36 |
+
}
|
37 |
+
/* Instagram btn */
|
38 |
+
#sbi_admin .sbi_admin_btn{
|
39 |
+
display: block;
|
40 |
+
float: left;
|
41 |
+
clear: both;
|
42 |
+
padding: 0 21px 0 126px;
|
43 |
+
height: 47px;
|
44 |
+
line-height: 47px;
|
45 |
+
|
46 |
+
background: #386793 url('../img/small-logo.png') no-repeat 16px 11px;
|
47 |
+
background: -moz-linear-gradient(top, #3f6a91 0%, #2e6191 100%) url('../img/small-logo.png') no-repeat 16px 11px;
|
48 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#3f6a91), color-stop(100%,#2e6191)) url('../img/small-logo.png') no-repeat 16px 11px;
|
49 |
+
background: -webkit-linear-gradient(top, #3f6a91 0%,#2e6191 100%) url('../img/small-logo.png') no-repeat 16px 11px;
|
50 |
+
background: -o-linear-gradient(top, #3f6a91 0%,#2e6191 100%) url('../img/small-logo.png') no-repeat 16px 11px;
|
51 |
+
background: -ms-linear-gradient(top, #3f6a91 0%,#2e6191 100%) url('../img/small-logo.png') no-repeat 16px 11px;
|
52 |
+
background: linear-gradient(to bottom, #3f6a91 0%,#2e6191 100%) url('../img/small-logo.png') no-repeat 16px 11px;
|
53 |
+
|
54 |
+
color: #e9eef3;
|
55 |
+
text-decoration: none;
|
56 |
+
|
57 |
+
-moz-border-radius: 5px;
|
58 |
+
-webkit-border-radius: 5px;
|
59 |
+
border-radius: 5px;
|
60 |
+
}
|
61 |
+
#sbi_admin .sbi_admin_btn:hover{
|
62 |
+
background-color: #487aa9;
|
63 |
+
color: #fff;
|
64 |
+
}
|
65 |
+
|
66 |
+
/* Config info */
|
67 |
+
#sbi_config{
|
68 |
+
float: left;
|
69 |
+
width: 100%;
|
70 |
+
margin-bottom: 10px;
|
71 |
+
}
|
72 |
+
#sbi_config_info{
|
73 |
+
float: left;
|
74 |
+
clear: both;
|
75 |
+
padding: 5px 15px;
|
76 |
+
margin: 10px 0 0 0;
|
77 |
+
|
78 |
+
background: #fff;
|
79 |
+
border: 1px solid #ddd;
|
80 |
+
|
81 |
+
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
|
82 |
+
box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
|
83 |
+
|
84 |
+
-moz-border-radius: 2px;
|
85 |
+
-webkit-border-radius: 2px;
|
86 |
+
border-radius: 2px;
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
/* Add Facebook dashicon to CFF admin menu */
|
91 |
+
#toplevel_page_instagram .toplevel_page_instagram .wp-menu-image:before{
|
92 |
+
content: "\f306";
|
93 |
+
}
|
css/sb-instagram.css
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**************/
|
2 |
+
/*** LAYOUT ***/
|
3 |
+
/**************/
|
4 |
+
|
5 |
+
/* Feed container */
|
6 |
+
#sb_instagram {
|
7 |
+
float: left;
|
8 |
+
width: 100%;
|
9 |
+
max-width: 612px;
|
10 |
+
margin: 0 auto;
|
11 |
+
padding: 0;
|
12 |
+
-webkit-box-sizing: border-box;
|
13 |
+
-moz-box-sizing: border-box;
|
14 |
+
box-sizing: border-box;
|
15 |
+
}
|
16 |
+
#sb_instagram:after{
|
17 |
+
content: "";
|
18 |
+
display: table;
|
19 |
+
clear: both;
|
20 |
+
}
|
21 |
+
|
22 |
+
/*********************/
|
23 |
+
/*** STYLE OPTIONS ***/
|
24 |
+
/*********************/
|
25 |
+
#sb_instagram.sbi_fixed_height{
|
26 |
+
overflow: hidden;
|
27 |
+
overflow-y: auto;
|
28 |
+
-webkit-box-sizing: border-box;
|
29 |
+
-moz-box-sizing: border-box;
|
30 |
+
box-sizing: border-box;
|
31 |
+
}
|
32 |
+
#sb_instagram #sbi_images{
|
33 |
+
width: 100%;
|
34 |
+
float: left;
|
35 |
+
|
36 |
+
-webkit-box-sizing: border-box;
|
37 |
+
-moz-box-sizing: border-box;
|
38 |
+
box-sizing: border-box;
|
39 |
+
}
|
40 |
+
#sb_instagram #sbi_images a{
|
41 |
+
float: left;
|
42 |
+
padding: inherit !important;
|
43 |
+
margin: 0 !important;
|
44 |
+
|
45 |
+
-webkit-box-sizing: border-box;
|
46 |
+
-moz-box-sizing: border-box;
|
47 |
+
box-sizing: border-box;
|
48 |
+
}
|
49 |
+
#sb_instagram img{
|
50 |
+
float: left;
|
51 |
+
padding: 0 !important;
|
52 |
+
margin: 0 !important;
|
53 |
+
}
|
54 |
+
|
55 |
+
/* Cols */
|
56 |
+
#sb_instagram.sbi_col_1 #sbi_images a{ width: 100%; }
|
57 |
+
#sb_instagram.sbi_col_2 #sbi_images a{ width: 50%; }
|
58 |
+
#sb_instagram.sbi_col_3 #sbi_images a{ width: 33.33%; }
|
59 |
+
#sb_instagram.sbi_col_4 #sbi_images a{ width: 25%; }
|
60 |
+
#sb_instagram.sbi_col_5 #sbi_images a{ width: 20%; }
|
61 |
+
#sb_instagram.sbi_col_6 #sbi_images a{ width: 16.66%; }
|
62 |
+
#sb_instagram.sbi_col_7 #sbi_images a{ width: 14.28%; }
|
63 |
+
#sb_instagram.sbi_col_8 #sbi_images a{ width: 12.5%; }
|
64 |
+
#sb_instagram.sbi_col_9 #sbi_images a{ width: 11.11%; }
|
65 |
+
#sb_instagram.sbi_col_10 #sbi_images a{ width: 10%; }
|
66 |
+
|
67 |
+
/* Button */
|
68 |
+
#sb_instagram #sbi_load{
|
69 |
+
display: none;
|
70 |
+
float: left;
|
71 |
+
clear: both;
|
72 |
+
width: 100%;
|
73 |
+
text-align: center;
|
74 |
+
}
|
75 |
+
#sb_instagram #sbi_load a{
|
76 |
+
display: -moz-inline-stack;
|
77 |
+
display: inline-block;
|
78 |
+
vertical-align: top;
|
79 |
+
zoom: 1;
|
80 |
+
*display: inline;
|
81 |
+
|
82 |
+
padding: 4px 14px;
|
83 |
+
margin: 0 auto;
|
84 |
+
background: #333;
|
85 |
+
color: #eee;
|
86 |
+
border: none;
|
87 |
+
color: #fff;
|
88 |
+
text-decoration: none;
|
89 |
+
font-size: 13px;
|
90 |
+
|
91 |
+
-moz-border-radius: 4px;
|
92 |
+
-webkit-border-radius: 4px;
|
93 |
+
border-radius: 4px;
|
94 |
+
|
95 |
+
-webkit-box-sizing: border-box;
|
96 |
+
-moz-box-sizing: border-box;
|
97 |
+
box-sizing: border-box;
|
98 |
+
}
|
99 |
+
#sb_instagram #sbi_load a:hover{
|
100 |
+
background: #666;
|
101 |
+
}
|
gpl-2.0.txt
ADDED
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6 |
+
Everyone is permitted to copy and distribute verbatim copies
|
7 |
+
of this license document, but changing it is not allowed.
|
8 |
+
|
9 |
+
Preamble
|
10 |
+
|
11 |
+
The licenses for most software are designed to take away your
|
12 |
+
freedom to share and change it. By contrast, the GNU General Public
|
13 |
+
License is intended to guarantee your freedom to share and change free
|
14 |
+
software--to make sure the software is free for all its users. This
|
15 |
+
General Public License applies to most of the Free Software
|
16 |
+
Foundation's software and to any other program whose authors commit to
|
17 |
+
using it. (Some other Free Software Foundation software is covered by
|
18 |
+
the GNU Lesser General Public License instead.) You can apply it to
|
19 |
+
your programs, too.
|
20 |
+
|
21 |
+
When we speak of free software, we are referring to freedom, not
|
22 |
+
price. Our General Public Licenses are designed to make sure that you
|
23 |
+
have the freedom to distribute copies of free software (and charge for
|
24 |
+
this service if you wish), that you receive source code or can get it
|
25 |
+
if you want it, that you can change the software or use pieces of it
|
26 |
+
in new free programs; and that you know you can do these things.
|
27 |
+
|
28 |
+
To protect your rights, we need to make restrictions that forbid
|
29 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
+
These restrictions translate to certain responsibilities for you if you
|
31 |
+
distribute copies of the software, or if you modify it.
|
32 |
+
|
33 |
+
For example, if you distribute copies of such a program, whether
|
34 |
+
gratis or for a fee, you must give the recipients all the rights that
|
35 |
+
you have. You must make sure that they, too, receive or can get the
|
36 |
+
source code. And you must show them these terms so they know their
|
37 |
+
rights.
|
38 |
+
|
39 |
+
We protect your rights with two steps: (1) copyright the software, and
|
40 |
+
(2) offer you this license which gives you legal permission to copy,
|
41 |
+
distribute and/or modify the software.
|
42 |
+
|
43 |
+
Also, for each author's protection and ours, we want to make certain
|
44 |
+
that everyone understands that there is no warranty for this free
|
45 |
+
software. If the software is modified by someone else and passed on, we
|
46 |
+
want its recipients to know that what they have is not the original, so
|
47 |
+
that any problems introduced by others will not reflect on the original
|
48 |
+
authors' reputations.
|
49 |
+
|
50 |
+
Finally, any free program is threatened constantly by software
|
51 |
+
patents. We wish to avoid the danger that redistributors of a free
|
52 |
+
program will individually obtain patent licenses, in effect making the
|
53 |
+
program proprietary. To prevent this, we have made it clear that any
|
54 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
GNU GENERAL PUBLIC LICENSE
|
60 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
+
|
62 |
+
0. This License applies to any program or other work which contains
|
63 |
+
a notice placed by the copyright holder saying it may be distributed
|
64 |
+
under the terms of this General Public License. The "Program", below,
|
65 |
+
refers to any such program or work, and a "work based on the Program"
|
66 |
+
means either the Program or any derivative work under copyright law:
|
67 |
+
that is to say, a work containing the Program or a portion of it,
|
68 |
+
either verbatim or with modifications and/or translated into another
|
69 |
+
language. (Hereinafter, translation is included without limitation in
|
70 |
+
the term "modification".) Each licensee is addressed as "you".
|
71 |
+
|
72 |
+
Activities other than copying, distribution and modification are not
|
73 |
+
covered by this License; they are outside its scope. The act of
|
74 |
+
running the Program is not restricted, and the output from the Program
|
75 |
+
is covered only if its contents constitute a work based on the
|
76 |
+
Program (independent of having been made by running the Program).
|
77 |
+
Whether that is true depends on what the Program does.
|
78 |
+
|
79 |
+
1. You may copy and distribute verbatim copies of the Program's
|
80 |
+
source code as you receive it, in any medium, provided that you
|
81 |
+
conspicuously and appropriately publish on each copy an appropriate
|
82 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
+
notices that refer to this License and to the absence of any warranty;
|
84 |
+
and give any other recipients of the Program a copy of this License
|
85 |
+
along with the Program.
|
86 |
+
|
87 |
+
You may charge a fee for the physical act of transferring a copy, and
|
88 |
+
you may at your option offer warranty protection in exchange for a fee.
|
89 |
+
|
90 |
+
2. You may modify your copy or copies of the Program or any portion
|
91 |
+
of it, thus forming a work based on the Program, and copy and
|
92 |
+
distribute such modifications or work under the terms of Section 1
|
93 |
+
above, provided that you also meet all of these conditions:
|
94 |
+
|
95 |
+
a) You must cause the modified files to carry prominent notices
|
96 |
+
stating that you changed the files and the date of any change.
|
97 |
+
|
98 |
+
b) You must cause any work that you distribute or publish, that in
|
99 |
+
whole or in part contains or is derived from the Program or any
|
100 |
+
part thereof, to be licensed as a whole at no charge to all third
|
101 |
+
parties under the terms of this License.
|
102 |
+
|
103 |
+
c) If the modified program normally reads commands interactively
|
104 |
+
when run, you must cause it, when started running for such
|
105 |
+
interactive use in the most ordinary way, to print or display an
|
106 |
+
announcement including an appropriate copyright notice and a
|
107 |
+
notice that there is no warranty (or else, saying that you provide
|
108 |
+
a warranty) and that users may redistribute the program under
|
109 |
+
these conditions, and telling the user how to view a copy of this
|
110 |
+
License. (Exception: if the Program itself is interactive but
|
111 |
+
does not normally print such an announcement, your work based on
|
112 |
+
the Program is not required to print an announcement.)
|
113 |
+
|
114 |
+
These requirements apply to the modified work as a whole. If
|
115 |
+
identifiable sections of that work are not derived from the Program,
|
116 |
+
and can be reasonably considered independent and separate works in
|
117 |
+
themselves, then this License, and its terms, do not apply to those
|
118 |
+
sections when you distribute them as separate works. But when you
|
119 |
+
distribute the same sections as part of a whole which is a work based
|
120 |
+
on the Program, the distribution of the whole must be on the terms of
|
121 |
+
this License, whose permissions for other licensees extend to the
|
122 |
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
+
|
124 |
+
Thus, it is not the intent of this section to claim rights or contest
|
125 |
+
your rights to work written entirely by you; rather, the intent is to
|
126 |
+
exercise the right to control the distribution of derivative or
|
127 |
+
collective works based on the Program.
|
128 |
+
|
129 |
+
In addition, mere aggregation of another work not based on the Program
|
130 |
+
with the Program (or with a work based on the Program) on a volume of
|
131 |
+
a storage or distribution medium does not bring the other work under
|
132 |
+
the scope of this License.
|
133 |
+
|
134 |
+
3. You may copy and distribute the Program (or a work based on it,
|
135 |
+
under Section 2) in object code or executable form under the terms of
|
136 |
+
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
+
|
138 |
+
a) Accompany it with the complete corresponding machine-readable
|
139 |
+
source code, which must be distributed under the terms of Sections
|
140 |
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
+
|
142 |
+
b) Accompany it with a written offer, valid for at least three
|
143 |
+
years, to give any third party, for a charge no more than your
|
144 |
+
cost of physically performing source distribution, a complete
|
145 |
+
machine-readable copy of the corresponding source code, to be
|
146 |
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
+
customarily used for software interchange; or,
|
148 |
+
|
149 |
+
c) Accompany it with the information you received as to the offer
|
150 |
+
to distribute corresponding source code. (This alternative is
|
151 |
+
allowed only for noncommercial distribution and only if you
|
152 |
+
received the program in object code or executable form with such
|
153 |
+
an offer, in accord with Subsection b above.)
|
154 |
+
|
155 |
+
The source code for a work means the preferred form of the work for
|
156 |
+
making modifications to it. For an executable work, complete source
|
157 |
+
code means all the source code for all modules it contains, plus any
|
158 |
+
associated interface definition files, plus the scripts used to
|
159 |
+
control compilation and installation of the executable. However, as a
|
160 |
+
special exception, the source code distributed need not include
|
161 |
+
anything that is normally distributed (in either source or binary
|
162 |
+
form) with the major components (compiler, kernel, and so on) of the
|
163 |
+
operating system on which the executable runs, unless that component
|
164 |
+
itself accompanies the executable.
|
165 |
+
|
166 |
+
If distribution of executable or object code is made by offering
|
167 |
+
access to copy from a designated place, then offering equivalent
|
168 |
+
access to copy the source code from the same place counts as
|
169 |
+
distribution of the source code, even though third parties are not
|
170 |
+
compelled to copy the source along with the object code.
|
171 |
+
|
172 |
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
+
except as expressly provided under this License. Any attempt
|
174 |
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
+
void, and will automatically terminate your rights under this License.
|
176 |
+
However, parties who have received copies, or rights, from you under
|
177 |
+
this License will not have their licenses terminated so long as such
|
178 |
+
parties remain in full compliance.
|
179 |
+
|
180 |
+
5. You are not required to accept this License, since you have not
|
181 |
+
signed it. However, nothing else grants you permission to modify or
|
182 |
+
distribute the Program or its derivative works. These actions are
|
183 |
+
prohibited by law if you do not accept this License. Therefore, by
|
184 |
+
modifying or distributing the Program (or any work based on the
|
185 |
+
Program), you indicate your acceptance of this License to do so, and
|
186 |
+
all its terms and conditions for copying, distributing or modifying
|
187 |
+
the Program or works based on it.
|
188 |
+
|
189 |
+
6. Each time you redistribute the Program (or any work based on the
|
190 |
+
Program), the recipient automatically receives a license from the
|
191 |
+
original licensor to copy, distribute or modify the Program subject to
|
192 |
+
these terms and conditions. You may not impose any further
|
193 |
+
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
+
You are not responsible for enforcing compliance by third parties to
|
195 |
+
this License.
|
196 |
+
|
197 |
+
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
+
infringement or for any other reason (not limited to patent issues),
|
199 |
+
conditions are imposed on you (whether by court order, agreement or
|
200 |
+
otherwise) that contradict the conditions of this License, they do not
|
201 |
+
excuse you from the conditions of this License. If you cannot
|
202 |
+
distribute so as to satisfy simultaneously your obligations under this
|
203 |
+
License and any other pertinent obligations, then as a consequence you
|
204 |
+
may not distribute the Program at all. For example, if a patent
|
205 |
+
license would not permit royalty-free redistribution of the Program by
|
206 |
+
all those who receive copies directly or indirectly through you, then
|
207 |
+
the only way you could satisfy both it and this License would be to
|
208 |
+
refrain entirely from distribution of the Program.
|
209 |
+
|
210 |
+
If any portion of this section is held invalid or unenforceable under
|
211 |
+
any particular circumstance, the balance of the section is intended to
|
212 |
+
apply and the section as a whole is intended to apply in other
|
213 |
+
circumstances.
|
214 |
+
|
215 |
+
It is not the purpose of this section to induce you to infringe any
|
216 |
+
patents or other property right claims or to contest validity of any
|
217 |
+
such claims; this section has the sole purpose of protecting the
|
218 |
+
integrity of the free software distribution system, which is
|
219 |
+
implemented by public license practices. Many people have made
|
220 |
+
generous contributions to the wide range of software distributed
|
221 |
+
through that system in reliance on consistent application of that
|
222 |
+
system; it is up to the author/donor to decide if he or she is willing
|
223 |
+
to distribute software through any other system and a licensee cannot
|
224 |
+
impose that choice.
|
225 |
+
|
226 |
+
This section is intended to make thoroughly clear what is believed to
|
227 |
+
be a consequence of the rest of this License.
|
228 |
+
|
229 |
+
8. If the distribution and/or use of the Program is restricted in
|
230 |
+
certain countries either by patents or by copyrighted interfaces, the
|
231 |
+
original copyright holder who places the Program under this License
|
232 |
+
may add an explicit geographical distribution limitation excluding
|
233 |
+
those countries, so that distribution is permitted only in or among
|
234 |
+
countries not thus excluded. In such case, this License incorporates
|
235 |
+
the limitation as if written in the body of this License.
|
236 |
+
|
237 |
+
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
+
of the General Public License from time to time. Such new versions will
|
239 |
+
be similar in spirit to the present version, but may differ in detail to
|
240 |
+
address new problems or concerns.
|
241 |
+
|
242 |
+
Each version is given a distinguishing version number. If the Program
|
243 |
+
specifies a version number of this License which applies to it and "any
|
244 |
+
later version", you have the option of following the terms and conditions
|
245 |
+
either of that version or of any later version published by the Free
|
246 |
+
Software Foundation. If the Program does not specify a version number of
|
247 |
+
this License, you may choose any version ever published by the Free Software
|
248 |
+
Foundation.
|
249 |
+
|
250 |
+
10. If you wish to incorporate parts of the Program into other free
|
251 |
+
programs whose distribution conditions are different, write to the author
|
252 |
+
to ask for permission. For software which is copyrighted by the Free
|
253 |
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
+
make exceptions for this. Our decision will be guided by the two goals
|
255 |
+
of preserving the free status of all derivatives of our free software and
|
256 |
+
of promoting the sharing and reuse of software generally.
|
257 |
+
|
258 |
+
NO WARRANTY
|
259 |
+
|
260 |
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
+
REPAIR OR CORRECTION.
|
269 |
+
|
270 |
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
+
POSSIBILITY OF SUCH DAMAGES.
|
279 |
+
|
280 |
+
END OF TERMS AND CONDITIONS
|
281 |
+
|
282 |
+
How to Apply These Terms to Your New Programs
|
283 |
+
|
284 |
+
If you develop a new program, and you want it to be of the greatest
|
285 |
+
possible use to the public, the best way to achieve this is to make it
|
286 |
+
free software which everyone can redistribute and change under these terms.
|
287 |
+
|
288 |
+
To do so, attach the following notices to the program. It is safest
|
289 |
+
to attach them to the start of each source file to most effectively
|
290 |
+
convey the exclusion of warranty; and each file should have at least
|
291 |
+
the "copyright" line and a pointer to where the full notice is found.
|
292 |
+
|
293 |
+
<one line to give the program's name and a brief idea of what it does.>
|
294 |
+
Copyright (C) <year> <name of author>
|
295 |
+
|
296 |
+
This program is free software; you can redistribute it and/or modify
|
297 |
+
it under the terms of the GNU General Public License as published by
|
298 |
+
the Free Software Foundation; either version 2 of the License, or
|
299 |
+
(at your option) any later version.
|
300 |
+
|
301 |
+
This program is distributed in the hope that it will be useful,
|
302 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
+
GNU General Public License for more details.
|
305 |
+
|
306 |
+
You should have received a copy of the GNU General Public License along
|
307 |
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
308 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309 |
+
|
310 |
+
Also add information on how to contact you by electronic and paper mail.
|
311 |
+
|
312 |
+
If the program is interactive, make it output a short notice like this
|
313 |
+
when it starts in an interactive mode:
|
314 |
+
|
315 |
+
Gnomovision version 69, Copyright (C) year name of author
|
316 |
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317 |
+
This is free software, and you are welcome to redistribute it
|
318 |
+
under certain conditions; type `show c' for details.
|
319 |
+
|
320 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
321 |
+
parts of the General Public License. Of course, the commands you use may
|
322 |
+
be called something other than `show w' and `show c'; they could even be
|
323 |
+
mouse-clicks or menu items--whatever suits your program.
|
324 |
+
|
325 |
+
You should also get your employer (if you work as a programmer) or your
|
326 |
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
327 |
+
necessary. Here is a sample; alter the names:
|
328 |
+
|
329 |
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330 |
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331 |
+
|
332 |
+
<signature of Ty Coon>, 1 April 1989
|
333 |
+
Ty Coon, President of Vice
|
334 |
+
|
335 |
+
This General Public License does not permit incorporating your program into
|
336 |
+
proprietary programs. If your program is a subroutine library, you may
|
337 |
+
consider it more useful to permit linking proprietary applications with the
|
338 |
+
library. If this is what you want to do, use the GNU Lesser General
|
339 |
+
Public License instead of this License.
|
img/small-logo.png
ADDED
Binary file
|
instagram-feed-admin.php
ADDED
@@ -0,0 +1,278 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function sb_instagram_menu() {
|
4 |
+
add_menu_page(
|
5 |
+
'Instagram Feed',
|
6 |
+
'Instagram Feed',
|
7 |
+
'manage_options',
|
8 |
+
'instagram',
|
9 |
+
'sb_instagram_settings_page'
|
10 |
+
);
|
11 |
+
add_submenu_page(
|
12 |
+
'instagram',
|
13 |
+
'Settings',
|
14 |
+
'Settings',
|
15 |
+
'manage_options',
|
16 |
+
'instagram',
|
17 |
+
'sb_instagram_settings_page'
|
18 |
+
);
|
19 |
+
}
|
20 |
+
add_action('admin_menu', 'sb_instagram_menu');
|
21 |
+
|
22 |
+
|
23 |
+
function sb_instagram_settings_page() {
|
24 |
+
|
25 |
+
//Hidden fields
|
26 |
+
$sb_instagram_settings_hidden_field = 'sb_instagram_settings_hidden_field';
|
27 |
+
|
28 |
+
//Declare defaults
|
29 |
+
$sb_instagram_settings_defaults = array(
|
30 |
+
'sb_instagram_at' => '',
|
31 |
+
'sb_instagram_user_id' => '',
|
32 |
+
'sb_instagram_width' => '100',
|
33 |
+
'sb_instagram_width_unit' => '%',
|
34 |
+
'sb_instagram_height' => '',
|
35 |
+
'sb_instagram_height_unit' => '',
|
36 |
+
'sb_instagram_cols' => '',
|
37 |
+
'sb_instagram_image_padding' => '',
|
38 |
+
'sb_instagram_image_padding_unit' => '',
|
39 |
+
// 'sb_instagram_sort' => '',
|
40 |
+
'sb_instagram_background' => '',
|
41 |
+
'sb_instagram_btn_background' => '',
|
42 |
+
'sb_instagram_btn_text_color' => '',
|
43 |
+
'sb_instagram_image_res' => 'full'
|
44 |
+
);
|
45 |
+
//Save defaults in an array
|
46 |
+
$options = wp_parse_args(get_option('sb_instagram_settings'), $sb_instagram_settings_defaults);
|
47 |
+
add_option( 'sb_instagram_settings', $options );
|
48 |
+
|
49 |
+
//Set the page variables
|
50 |
+
$sb_instagram_at = $options[ 'sb_instagram_at' ];
|
51 |
+
$sb_instagram_user_id = $options[ 'sb_instagram_user_id' ];
|
52 |
+
$sb_instagram_width = $options[ 'sb_instagram_width' ];
|
53 |
+
$sb_instagram_width_unit = $options[ 'sb_instagram_width_unit' ];
|
54 |
+
$sb_instagram_height = $options[ 'sb_instagram_height' ];
|
55 |
+
$sb_instagram_height_unit = $options[ 'sb_instagram_height_unit' ];
|
56 |
+
$sb_instagram_cols = $options[ 'sb_instagram_cols' ];
|
57 |
+
$sb_instagram_image_padding = $options[ 'sb_instagram_image_padding' ];
|
58 |
+
$sb_instagram_image_padding_unit = $options[ 'sb_instagram_image_padding_unit' ];
|
59 |
+
// $sb_instagram_sort = $options[ 'sb_instagram_sort' ];
|
60 |
+
$sb_instagram_background = $options[ 'sb_instagram_background' ];
|
61 |
+
$sb_instagram_btn_background = $options[ 'sb_instagram_btn_background' ];
|
62 |
+
$sb_instagram_btn_text_color = $options[ 'sb_instagram_btn_text_color' ];
|
63 |
+
$sb_instagram_image_res = $options[ 'sb_instagram_image_res' ];
|
64 |
+
|
65 |
+
// See if the user has posted us some information. If they did, this hidden field will be set to 'Y'.
|
66 |
+
if( isset($_POST[ $sb_instagram_settings_hidden_field ]) && $_POST[ $sb_instagram_settings_hidden_field ] == 'Y' ) {
|
67 |
+
|
68 |
+
$sb_instagram_at = $_POST[ 'sb_instagram_at' ];
|
69 |
+
$sb_instagram_user_id = $_POST[ 'sb_instagram_user_id' ];
|
70 |
+
$sb_instagram_width = $_POST[ 'sb_instagram_width' ];
|
71 |
+
$sb_instagram_width_unit = $_POST[ 'sb_instagram_width_unit' ];
|
72 |
+
$sb_instagram_height = $_POST[ 'sb_instagram_height' ];
|
73 |
+
$sb_instagram_height_unit = $_POST[ 'sb_instagram_height_unit' ];
|
74 |
+
$sb_instagram_cols = $_POST[ 'sb_instagram_cols' ];
|
75 |
+
$sb_instagram_image_padding = $_POST[ 'sb_instagram_image_padding' ];
|
76 |
+
$sb_instagram_image_padding_unit = $_POST[ 'sb_instagram_image_padding_unit' ];
|
77 |
+
// $sb_instagram_sort = $_POST[ 'sb_instagram_sort' ];
|
78 |
+
$sb_instagram_background = $_POST[ 'sb_instagram_background' ];
|
79 |
+
$sb_instagram_btn_background = $_POST[ 'sb_instagram_btn_background' ];
|
80 |
+
$sb_instagram_btn_text_color = $_POST[ 'sb_instagram_btn_text_color' ];
|
81 |
+
$sb_instagram_image_res = $_POST[ 'sb_instagram_image_res' ];
|
82 |
+
|
83 |
+
$options[ 'sb_instagram_at' ] = $sb_instagram_at;
|
84 |
+
$options[ 'sb_instagram_user_id' ] = $sb_instagram_user_id;
|
85 |
+
$options[ 'sb_instagram_width' ] = $sb_instagram_width;
|
86 |
+
$options[ 'sb_instagram_width_unit' ] = $sb_instagram_width_unit;
|
87 |
+
$options[ 'sb_instagram_height' ] = $sb_instagram_height;
|
88 |
+
$options[ 'sb_instagram_height_unit' ] = $sb_instagram_height_unit;
|
89 |
+
$options[ 'sb_instagram_cols' ] = $sb_instagram_cols;
|
90 |
+
$options[ 'sb_instagram_image_padding' ] = $sb_instagram_image_padding;
|
91 |
+
$options[ 'sb_instagram_image_padding_unit' ] = $sb_instagram_image_padding_unit;
|
92 |
+
// $options[ 'sb_instagram_sort' ] = $sb_instagram_sort;
|
93 |
+
$options[ 'sb_instagram_background' ] = $sb_instagram_background;
|
94 |
+
$options[ 'sb_instagram_btn_background' ] = $sb_instagram_btn_background;
|
95 |
+
$options[ 'sb_instagram_btn_text_color' ] = $sb_instagram_btn_text_color;
|
96 |
+
$options[ 'sb_instagram_image_res' ] = $sb_instagram_image_res;
|
97 |
+
|
98 |
+
update_option( 'sb_instagram_settings', $options );
|
99 |
+
|
100 |
+
?>
|
101 |
+
<div class="updated"><p><strong><?php _e('Settings saved.', 'custom-facebook-feed' ); ?></strong></p></div>
|
102 |
+
<?php } ?>
|
103 |
+
|
104 |
+
<div id="sbi_admin" class="wrap">
|
105 |
+
<div id="header">
|
106 |
+
<h2><?php _e('Instagram Feed Settings'); ?></h2>
|
107 |
+
</div>
|
108 |
+
<form name="form1" method="post" action="">
|
109 |
+
<input type="hidden" name="<?php echo $sb_instagram_settings_hidden_field; ?>" value="Y">
|
110 |
+
|
111 |
+
<table class="form-table">
|
112 |
+
<tbody>
|
113 |
+
<h3><?php _e('Step 1: Configure'); ?></h3>
|
114 |
+
|
115 |
+
<div id="sbi_config">
|
116 |
+
<a href="https://instagram.com/oauth/authorize/?client_id=cf0499d7ff07458493920704ae44cf30&redirect_uri=http://smashballoon.com/instagram-feed/token/?return_uri=<?php echo admin_url('admin.php?page=instagram'); ?>&response_type=token" class="sbi_admin_btn"><?php _e('Log in and get my Access Token and User ID'); ?></a>
|
117 |
+
</div>
|
118 |
+
|
119 |
+
|
120 |
+
<tr valign="top">
|
121 |
+
<th scope="row"><label><?php _e('Access Token'); ?></label></th>
|
122 |
+
<td>
|
123 |
+
<input name="sb_instagram_at" id="sb_instagram_at" type="text" value="<?php esc_attr_e( $sb_instagram_at ); ?>" size="50" />
|
124 |
+
<a class="sbi_tooltip_link" href="JavaScript:void(0);"><?php _e("What is this?"); ?></a>
|
125 |
+
<p class="sbi_tooltip"><?php _e("In order to display your photos you need an Access Token from Instagram. To get yours, simply click the button above and log into Instagram."); ?>.</p>
|
126 |
+
</td>
|
127 |
+
</tr>
|
128 |
+
<tr valign="top">
|
129 |
+
<th scope="row"><label><?php _e('User ID'); ?></label></th>
|
130 |
+
<td>
|
131 |
+
<input name="sb_instagram_user_id" id="sb_instagram_user_id" type="text" value="<?php esc_attr_e( $sb_instagram_user_id ); ?>" size="25" />
|
132 |
+
<a class="sbi_tooltip_link" href="JavaScript:void(0);"><?php _e("What is this?"); ?></a>
|
133 |
+
<p class="sbi_tooltip"><?php _e("This is the ID of the Instagram account you want to display photos from. To get your ID simply click on the button above and log into Instagram.<br /><br />You can also display photos from other peoples Instagram accounts. To find their User ID you can use <a href='http://jelled.com/instagram/lookup-user-id' target='_blank'>this tool</a>."); ?></p>
|
134 |
+
</td>
|
135 |
+
</tr>
|
136 |
+
</tbody>
|
137 |
+
</table>
|
138 |
+
|
139 |
+
<hr />
|
140 |
+
|
141 |
+
<table class="form-table">
|
142 |
+
<tbody>
|
143 |
+
<h3><?php _e('Step 2: Customize'); ?></h3>
|
144 |
+
<tr valign="top">
|
145 |
+
<th scope="row"><label><?php _e('Width of Feed'); ?></label></th>
|
146 |
+
<td>
|
147 |
+
<input name="sb_instagram_width" type="text" value="<?php esc_attr_e( $sb_instagram_width ); ?>" size="4" />
|
148 |
+
<select name="sb_instagram_width_unit">
|
149 |
+
<option value="px" <?php if($sb_instagram_width_unit == "px") echo 'selected="selected"' ?> ><?php _e('px'); ?></option>
|
150 |
+
<option value="%" <?php if($sb_instagram_width_unit == "%") echo 'selected="selected"' ?> ><?php _e('%'); ?></option>
|
151 |
+
</select>
|
152 |
+
</td>
|
153 |
+
</tr>
|
154 |
+
<tr valign="top">
|
155 |
+
<th scope="row"><label><?php _e('Height of Feed'); ?></label></th>
|
156 |
+
<td>
|
157 |
+
<input name="sb_instagram_height" type="text" value="<?php esc_attr_e( $sb_instagram_height ); ?>" size="4" />
|
158 |
+
<select name="sb_instagram_height_unit">
|
159 |
+
<option value="px" <?php if($sb_instagram_height_unit == "px") echo 'selected="selected"' ?> ><?php _e('px'); ?></option>
|
160 |
+
<option value="%" <?php if($sb_instagram_height_unit == "%") echo 'selected="selected"' ?> ><?php _e('%'); ?></option>
|
161 |
+
</select>
|
162 |
+
</td>
|
163 |
+
</tr>
|
164 |
+
<tr valign="top">
|
165 |
+
<th scope="row"><label><?php _e('Number of Columns'); ?></label></th>
|
166 |
+
<td>
|
167 |
+
|
168 |
+
<select name="sb_instagram_cols">
|
169 |
+
<option value="1" <?php if($sb_instagram_cols == "1") echo 'selected="selected"' ?> ><?php _e('1'); ?></option>
|
170 |
+
<option value="2" <?php if($sb_instagram_cols == "2") echo 'selected="selected"' ?> ><?php _e('2'); ?></option>
|
171 |
+
<option value="3" <?php if($sb_instagram_cols == "3") echo 'selected="selected"' ?> ><?php _e('3'); ?></option>
|
172 |
+
<option value="4" <?php if($sb_instagram_cols == "4") echo 'selected="selected"' ?> ><?php _e('4'); ?></option>
|
173 |
+
<option value="5" <?php if($sb_instagram_cols == "5") echo 'selected="selected"' ?> ><?php _e('5'); ?></option>
|
174 |
+
<option value="6" <?php if($sb_instagram_cols == "6") echo 'selected="selected"' ?> ><?php _e('6'); ?></option>
|
175 |
+
<option value="7" <?php if($sb_instagram_cols == "7") echo 'selected="selected"' ?> ><?php _e('7'); ?></option>
|
176 |
+
<option value="8" <?php if($sb_instagram_cols == "8") echo 'selected="selected"' ?> ><?php _e('8'); ?></option>
|
177 |
+
<option value="9" <?php if($sb_instagram_cols == "9") echo 'selected="selected"' ?> ><?php _e('9'); ?></option>
|
178 |
+
<option value="10" <?php if($sb_instagram_cols == "10") echo 'selected="selected"' ?> ><?php _e('10'); ?></option>
|
179 |
+
</select>
|
180 |
+
|
181 |
+
</td>
|
182 |
+
</tr>
|
183 |
+
<tr valign="top">
|
184 |
+
<th scope="row"><label><?php _e('Image Resolution'); ?></label></th>
|
185 |
+
<td>
|
186 |
+
|
187 |
+
<select name="sb_instagram_image_res">
|
188 |
+
<option value="full" <?php if($sb_instagram_image_res == "full") echo 'selected="selected"' ?> ><?php _e('Full size (612x612)'); ?></option>
|
189 |
+
<option value="medium" <?php if($sb_instagram_image_res == "medium") echo 'selected="selected"' ?> ><?php _e('Medium (306x306)'); ?></option>
|
190 |
+
<option value="thumb" <?php if($sb_instagram_image_res == "thumb") echo 'selected="selected"' ?> ><?php _e('Thumbnail (150x150)'); ?></option>
|
191 |
+
</select>
|
192 |
+
|
193 |
+
</td>
|
194 |
+
</tr>
|
195 |
+
<tr valign="top">
|
196 |
+
<th scope="row"><label><?php _e('Padding around Images'); ?></label></th>
|
197 |
+
<td>
|
198 |
+
<input name="sb_instagram_image_padding" type="text" value="<?php esc_attr_e( $sb_instagram_image_padding ); ?>" size="4" />
|
199 |
+
<select name="sb_instagram_image_padding_unit">
|
200 |
+
<option value="px" <?php if($sb_instagram_image_padding_unit == "px") echo 'selected="selected"' ?> ><?php _e('px'); ?></option>
|
201 |
+
<option value="%" <?php if($sb_instagram_image_padding_unit == "%") echo 'selected="selected"' ?> ><?php _e('%'); ?></option>
|
202 |
+
</select>
|
203 |
+
</td>
|
204 |
+
</tr>
|
205 |
+
<!-- <tr valign="top">
|
206 |
+
<th scope="row"><label><?php _e('Sort Images By'); ?></label></th>
|
207 |
+
<td>
|
208 |
+
<select name="sb_instagram_sort">
|
209 |
+
<option value="none" <?php if($sb_instagram_sort == "none") echo 'selected="selected"' ?> ><?php _e('None'); ?></option>
|
210 |
+
<option value="most-recent" <?php if($sb_instagram_sort == "most-recent") echo 'selected="selected"' ?> ><?php _e('Newest to Oldest'); ?></option>
|
211 |
+
<option value="least-recent" <?php if($sb_instagram_sort == "least-recent") echo 'selected="selected"' ?> ><?php _e('Oldest to newest'); ?></option>
|
212 |
+
<option value="most-liked" <?php if($sb_instagram_sort == "most-liked") echo 'selected="selected"' ?> ><?php _e('Most liked first'); ?></option>
|
213 |
+
<option value="least-liked" <?php if($sb_instagram_sort == "least-liked") echo 'selected="selected"' ?> ><?php _e('Least liked first'); ?></option>
|
214 |
+
<option value="most-commented" <?php if($sb_instagram_sort == "most-commented") echo 'selected="selected"' ?> ><?php _e('Most commented first'); ?></option>
|
215 |
+
<option value="least-commented" <?php if($sb_instagram_sort == "least-commented") echo 'selected="selected"' ?> ><?php _e('Least commented first'); ?></option>
|
216 |
+
<option value="random" <?php if($sb_instagram_sort == "random") echo 'selected="selected"' ?> ><?php _e('Random'); ?></option>
|
217 |
+
</select>
|
218 |
+
</td>
|
219 |
+
</tr> -->
|
220 |
+
<tr valign="top">
|
221 |
+
<th scope="row"><label><?php _e('Background Color'); ?></label></th>
|
222 |
+
<td>
|
223 |
+
<input name="sb_instagram_background" type="text" value="<?php esc_attr_e( $sb_instagram_background ); ?>" class="sbi_colorpick" />
|
224 |
+
</td>
|
225 |
+
</tr>
|
226 |
+
<tr valign="top">
|
227 |
+
<th scope="row"><label><?php _e('Button Background Color'); ?></label></th>
|
228 |
+
<td>
|
229 |
+
<input name="sb_instagram_btn_background" type="text" value="<?php esc_attr_e( $sb_instagram_btn_background ); ?>" class="sbi_colorpick" />
|
230 |
+
</td>
|
231 |
+
</tr>
|
232 |
+
<tr valign="top">
|
233 |
+
<th scope="row"><label><?php _e('Button Text Color'); ?></label></th>
|
234 |
+
<td>
|
235 |
+
<input name="sb_instagram_btn_text_color" type="text" value="<?php esc_attr_e( $sb_instagram_btn_text_color ); ?>" class="sbi_colorpick" />
|
236 |
+
</td>
|
237 |
+
</tr>
|
238 |
+
|
239 |
+
</tbody>
|
240 |
+
</table>
|
241 |
+
|
242 |
+
<?php submit_button(); ?>
|
243 |
+
|
244 |
+
</form>
|
245 |
+
</div> <!-- end #admin -->
|
246 |
+
|
247 |
+
<?php
|
248 |
+
}
|
249 |
+
|
250 |
+
function sb_instagram_admin_style() {
|
251 |
+
wp_register_style( 'sb_instagram_admin_css', plugin_dir_url( __FILE__ ) . 'css/sb-instagram-admin.css', false, '1.0.0' );
|
252 |
+
wp_enqueue_style( 'sb_instagram_admin_css' );
|
253 |
+
wp_enqueue_style( 'wp-color-picker' );
|
254 |
+
}
|
255 |
+
add_action( 'admin_enqueue_scripts', 'sb_instagram_admin_style' );
|
256 |
+
|
257 |
+
function sb_instagram_admin_scripts() {
|
258 |
+
wp_enqueue_script( 'sb_instagram_admin_js', plugin_dir_url( __FILE__ ) . 'js/sb-instagram-admin.js' );
|
259 |
+
if( !wp_script_is('jquery-ui-draggable') ) {
|
260 |
+
wp_enqueue_script(
|
261 |
+
array(
|
262 |
+
'jquery',
|
263 |
+
'jquery-ui-core',
|
264 |
+
'jquery-ui-draggable'
|
265 |
+
)
|
266 |
+
);
|
267 |
+
}
|
268 |
+
wp_enqueue_script(
|
269 |
+
array(
|
270 |
+
'hoverIntent',
|
271 |
+
'wp-color-picker'
|
272 |
+
)
|
273 |
+
);
|
274 |
+
}
|
275 |
+
add_action( 'admin_enqueue_scripts', 'sb_instagram_admin_scripts' );
|
276 |
+
|
277 |
+
|
278 |
+
?>
|
instagram-feed.php
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Instagram Feed
|
4 |
+
Plugin URI: http://smashballoon.com/instagram-feed
|
5 |
+
Description: Add a simple customizable Instagram feed to your website
|
6 |
+
Version: 1.0
|
7 |
+
Author: Smash Balloon
|
8 |
+
Author URI: http://smashballoon.com/
|
9 |
+
License: GPLv2 or later
|
10 |
+
|
11 |
+
Copyright 2014 Smash Balloon LLC (email : hey@smashballoon.com)
|
12 |
+
This program is free software; you can redistribute it and/or modify
|
13 |
+
it under the terms of the GNU General Public License as published by
|
14 |
+
the Free Software Foundation; either version 2 of the License, or
|
15 |
+
(at your option) any later version.
|
16 |
+
This program is distributed in the hope that it will be useful,
|
17 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
+
GNU General Public License for more details.
|
20 |
+
You should have received a copy of the GNU General Public License
|
21 |
+
along with this program; if not, write to the Free Software
|
22 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
23 |
+
*/
|
24 |
+
|
25 |
+
//Include admin
|
26 |
+
include dirname( __FILE__ ) .'/instagram-feed-admin.php';
|
27 |
+
|
28 |
+
// Add shortcodes
|
29 |
+
add_shortcode('instagram-feed', 'display_instagram');
|
30 |
+
function display_instagram($atts, $content = null) {
|
31 |
+
|
32 |
+
|
33 |
+
/******************* SHORTCODE OPTIONS ********************/
|
34 |
+
|
35 |
+
$options = get_option('sb_instagram_settings');
|
36 |
+
|
37 |
+
//Pass in shortcode attrbutes
|
38 |
+
$atts = shortcode_atts(
|
39 |
+
array(
|
40 |
+
'id' => $options[ 'sb_instagram_user_id' ],
|
41 |
+
'width' => $options[ 'sb_instagram_width' ],
|
42 |
+
'widthunit' => $options[ 'sb_instagram_width_unit' ],
|
43 |
+
'height' => $options[ 'sb_instagram_height' ],
|
44 |
+
'heightunit' => $options[ 'sb_instagram_height_unit' ],
|
45 |
+
'cols' => $options[ 'sb_instagram_cols' ],
|
46 |
+
'imagepadding' => $options[ 'sb_instagram_image_padding' ],
|
47 |
+
'imagepaddingunit' => $options[ 'sb_instagram_image_padding_unit' ],
|
48 |
+
'background' => $options[ 'sb_instagram_background' ],
|
49 |
+
'buttoncolor' => $options[ 'sb_instagram_btn_background' ],
|
50 |
+
'buttontextcolor' => $options[ 'sb_instagram_btn_text_color' ],
|
51 |
+
'imageres' => $options[ 'sb_instagram_image_res' ]
|
52 |
+
), $atts);
|
53 |
+
|
54 |
+
|
55 |
+
/******************* VARS ********************/
|
56 |
+
|
57 |
+
//User ID
|
58 |
+
$sb_instagram_user_id = trim($atts['id']);
|
59 |
+
|
60 |
+
//Container styles
|
61 |
+
$sb_instagram_width = $atts['width'];
|
62 |
+
$sb_instagram_width_unit = $atts['widthunit'];
|
63 |
+
$sb_instagram_height = $atts['height'];
|
64 |
+
$sb_instagram_height_unit = $atts['heightunit'];
|
65 |
+
$sb_instagram_image_padding = $atts['imagepadding'];
|
66 |
+
$sb_instagram_image_padding_unit = $atts['imagepaddingunit'];
|
67 |
+
$sb_instagram_background = $atts['background'];
|
68 |
+
|
69 |
+
$sb_instagram_styles = 'style="';
|
70 |
+
if ( !empty($sb_instagram_width) ) $sb_instagram_styles .= 'width:' . $sb_instagram_width . $sb_instagram_width_unit .'; ';
|
71 |
+
if ( !empty($sb_instagram_height) && $sb_instagram_height != '0' ) $sb_instagram_styles .= 'height:' . $sb_instagram_height . $sb_instagram_height_unit .'; ';
|
72 |
+
if ( !empty($sb_instagram_background) ) $sb_instagram_styles .= 'background-color: ' . $sb_instagram_background . '; ';
|
73 |
+
if ( !empty($sb_instagram_image_padding) ) $sb_instagram_styles .= 'padding-bottom: ' . (2*intval($sb_instagram_image_padding)).$sb_instagram_image_padding_unit . '; ';
|
74 |
+
$sb_instagram_styles .= '"';
|
75 |
+
|
76 |
+
//Load more button styles
|
77 |
+
$sb_instagram_btn_background = $atts['buttoncolor'];
|
78 |
+
$sb_instagram_btn_text_color = $atts['buttontextcolor'];
|
79 |
+
|
80 |
+
$sb_instagram_button_styles = 'style="';
|
81 |
+
if ( !empty($sb_instagram_btn_background) ) $sb_instagram_button_styles .= 'background: '.$sb_instagram_btn_background.'; ';
|
82 |
+
if ( !empty($sb_instagram_btn_text_color) ) $sb_instagram_button_styles .= 'color: '.$sb_instagram_btn_text_color.';';
|
83 |
+
$sb_instagram_button_styles .= '"';
|
84 |
+
|
85 |
+
//Layout options
|
86 |
+
$sb_instagram_cols = $atts['cols'];
|
87 |
+
|
88 |
+
|
89 |
+
/******************* CONTENT ********************/
|
90 |
+
|
91 |
+
$sb_instagram_content = '<div id="sb_instagram" class="sbi ';
|
92 |
+
if ( !empty($sb_instagram_height) ) $sb_instagram_content .= 'sbi_fixed_height ';
|
93 |
+
$sb_instagram_content .= 'sbi_col_' . trim($sb_instagram_cols);
|
94 |
+
$sb_instagram_content .= '" '.$sb_instagram_styles;
|
95 |
+
|
96 |
+
//Dats attrs
|
97 |
+
$sb_instagram_content .= 'data-id="' . $sb_instagram_user_id . '"';
|
98 |
+
$sb_instagram_content .= 'data-res="' . trim($atts['imageres']) . '"';
|
99 |
+
|
100 |
+
$sb_instagram_content .= '><div id="sbi_images" style="padding: '.$sb_instagram_image_padding . $sb_instagram_image_padding_unit .';">';
|
101 |
+
|
102 |
+
//Error messages
|
103 |
+
if( empty($sb_instagram_user_id) || !isset($sb_instagram_user_id) ) $sb_instagram_content .= '<p>Please enter a User ID either on the Instagram plugins Settings page or directly in the shortcode, like so: [instagram id=1234567]</p>';
|
104 |
+
if( empty($options[ 'sb_instagram_at' ]) || !isset($options[ 'sb_instagram_at' ]) ) $sb_instagram_content .= '<p>Please enter an Access Token on the Instagram plugins Settings page</p>';
|
105 |
+
|
106 |
+
$sb_instagram_content .= '</div>
|
107 |
+
<div id="sbi_load"><a href="javascript:void(0);" '.$sb_instagram_button_styles.'>Load More...</a></div>
|
108 |
+
</div>';
|
109 |
+
|
110 |
+
//Return our feed HTML to display
|
111 |
+
return $sb_instagram_content;
|
112 |
+
|
113 |
+
}
|
114 |
+
|
115 |
+
|
116 |
+
#############################
|
117 |
+
|
118 |
+
//Enqueue stylesheet
|
119 |
+
add_action( 'wp_enqueue_scripts', 'sb_instagram_styles_enqueue' );
|
120 |
+
function sb_instagram_styles_enqueue() {
|
121 |
+
wp_register_style( 'sb_instagram_styles', plugins_url('css/sb-instagram.css', __FILE__) );
|
122 |
+
wp_enqueue_style( 'sb_instagram_styles' );
|
123 |
+
}
|
124 |
+
|
125 |
+
//Enqueue scripts
|
126 |
+
add_action( 'wp_enqueue_scripts', 'sb_instagram_scripts_enqueue' );
|
127 |
+
function sb_instagram_scripts_enqueue() {
|
128 |
+
//Register the script to make it available
|
129 |
+
wp_register_script( 'sb_instagram_scripts', plugins_url( '/js/sb-instagram.js' , __FILE__ ), array('jquery'), '1.8', true );
|
130 |
+
|
131 |
+
//Options to pass to JS file
|
132 |
+
$sb_instagram_settings = get_option('sb_instagram_settings');
|
133 |
+
$data = array(
|
134 |
+
'sb_instagram_at' => trim($sb_instagram_settings['sb_instagram_at'])
|
135 |
+
// 'sb_instagram_user_id' => trim($sb_instagram_settings['sb_instagram_user_id'])
|
136 |
+
);
|
137 |
+
|
138 |
+
//Enqueue it to load it onto the page
|
139 |
+
wp_enqueue_script('sb_instagram_scripts');
|
140 |
+
|
141 |
+
//Pass option to JS file
|
142 |
+
wp_localize_script('sb_instagram_scripts', 'sb_instagram_js_options', $data);
|
143 |
+
}
|
144 |
+
|
145 |
+
//Uninstall
|
146 |
+
function sb_instagram_uninstall()
|
147 |
+
{
|
148 |
+
if ( ! current_user_can( 'activate_plugins' ) )
|
149 |
+
return;
|
150 |
+
//Settings
|
151 |
+
delete_option( 'sb_instagram_settings' );
|
152 |
+
}
|
153 |
+
register_uninstall_hook( __FILE__, 'sb_instagram_uninstall' );
|
154 |
+
|
155 |
+
|
156 |
+
// error_reporting(~0);
|
157 |
+
?>
|
js/sb-instagram-admin.js
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($) {
|
2 |
+
|
3 |
+
//Autofill the token and id
|
4 |
+
var hash = window.location.hash,
|
5 |
+
token = hash.substring(14),
|
6 |
+
id = token.split('.')[0];
|
7 |
+
//If there's a hash then autofill the token and id
|
8 |
+
if(hash){
|
9 |
+
$('#sbi_config').append('<div id="sbi_config_info"><p><b>Access Token: </b><input type="text" size=50 readonly value="'+token+'"></p><p><b>User ID: </b><input type="text" size=10 readonly value="'+id+'"></p><p>Copy and paste these into the fields below, or use a different Access Token and User ID if you wish.</p></div>');
|
10 |
+
}
|
11 |
+
|
12 |
+
//Tooltips
|
13 |
+
jQuery('#sbi_admin .sbi_tooltip_link').click(function(){
|
14 |
+
jQuery(this).closest('tr').find('.sbi_tooltip').slideToggle();
|
15 |
+
});
|
16 |
+
|
17 |
+
//Add the color picker
|
18 |
+
if( jQuery('.sbi_colorpick').length > 0 ) jQuery('.sbi_colorpick').wpColorPicker();
|
19 |
+
|
20 |
+
});
|
js/sb-instagram.js
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($){
|
2 |
+
|
3 |
+
(function(){var e,t;e=function(){function e(e,t){var n,r;this.options={target:"instafeed",get:"popular",resolution:"thumbnail",sortBy:"none",links:!0,mock:!1,useHttp:!1};if(typeof e=="object")for(n in e)r=e[n],this.options[n]=r;this.context=t!=null?t:this,this.unique=this._genKey()}return e.prototype.hasNext=function(){return typeof this.context.nextUrl=="string"&&this.context.nextUrl.length>0},e.prototype.next=function(){return this.hasNext()?this.run(this.context.nextUrl):!1},e.prototype.run=function(t){var n,r,i;if(typeof this.options.clientId!="string"&&typeof this.options.accessToken!="string")throw new Error("Missing clientId or accessToken.");if(typeof this.options.accessToken!="string"&&typeof this.options.clientId!="string")throw new Error("Missing clientId or accessToken.");return this.options.before!=null&&typeof this.options.before=="function"&&this.options.before.call(this),typeof document!="undefined"&&document!==null&&(i=document.createElement("script"),i.id="instafeed-fetcher",i.src=t||this._buildUrl(),n=document.getElementsByTagName("head"),n[0].appendChild(i),r="instafeedCache"+this.unique,window[r]=new e(this.options,this),window[r].unique=this.unique),!0},e.prototype.parse=function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S;if(typeof e!="object"){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,"Invalid JSON data"),!1;throw new Error("Invalid JSON response")}if(e.meta.code!==200){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,e.meta.error_message),!1;throw new Error("Error from Instagram: "+e.meta.error_message)}if(e.data.length===0){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,"No images were returned from Instagram"),!1;throw new Error("No images were returned from Instagram")}this.options.success!=null&&typeof this.options.success=="function"&&this.options.success.call(this,e),this.context.nextUrl="",e.pagination!=null&&(this.context.nextUrl=e.pagination.next_url);if(this.options.sortBy!=="none"){this.options.sortBy==="random"?d=["","random"]:d=this.options.sortBy.split("-"),p=d[0]==="least"?!0:!1;switch(d[1]){case"random":e.data.sort(function(){return.5-Math.random()});break;case"recent":e.data=this._sortBy(e.data,"created_time",p);break;case"liked":e.data=this._sortBy(e.data,"likes.count",p);break;case"commented":e.data=this._sortBy(e.data,"comments.count",p);break;default:throw new Error("Invalid option for sortBy: '"+this.options.sortBy+"'.")}}if(typeof document!="undefined"&&document!==null&&this.options.mock===!1){a=e.data,this.options.limit!=null&&a.length>this.options.limit&&(a=a.slice(0,this.options.limit+1||9e9)),n=document.createDocumentFragment(),this.options.filter!=null&&typeof this.options.filter=="function"&&(a=this._filter(a,this.options.filter));if(this.options.template!=null&&typeof this.options.template=="string"){i="",o="",l="",v=document.createElement("div");for(m=0,b=a.length;m<b;m++)s=a[m],u=s.images[this.options.resolution].url,this.options.useHttp||(u=u.replace("http://","//")),o=this._makeTemplate(this.options.template,{model:s,id:s.id,link:s.link,image:u,caption:this._getObjectProperty(s,"caption.text"),likes:s.likes.count,comments:s.comments.count,location:this._getObjectProperty(s,"location.name")}),i+=o;v.innerHTML=i,S=[].slice.call(v.childNodes);for(g=0,w=S.length;g<w;g++)h=S[g],n.appendChild(h)}else for(y=0,E=a.length;y<E;y++)s=a[y],f=document.createElement("img"),u=s.images[this.options.resolution].url,this.options.useHttp||(u=u.replace("http://","//")),f.src=u,this.options.links===!0?(t=document.createElement("a"),t.href=s.link,t.appendChild(f),n.appendChild(t)):n.appendChild(f);this.options.target.append(n),r=document.getElementsByTagName("head")[0],r.removeChild(document.getElementById("instafeed-fetcher")),c="instafeedCache"+this.unique,window[c]=void 0;try{delete window[c]}catch(x){}}return this.options.after!=null&&typeof this.options.after=="function"&&this.options.after.call(this),!0},e.prototype._buildUrl=function(){var e,t,n;e="https://api.instagram.com/v1";switch(this.options.get){case"popular":t="media/popular";break;case"tagged":if(typeof this.options.tagName!="string")throw new Error("No tag name specified. Use the 'tagName' option.");t="tags/"+this.options.tagName+"/media/recent";break;case"location":if(typeof this.options.locationId!="number")throw new Error("No location specified. Use the 'locationId' option.");t="locations/"+this.options.locationId+"/media/recent";break;case"user":if(typeof this.options.userId!="number")throw new Error("No user specified. Use the 'userId' option.");if(typeof this.options.accessToken!="string")throw new Error("No access token. Use the 'accessToken' option.");t="users/"+this.options.userId+"/media/recent";break;default:throw new Error("Invalid option for get: '"+this.options.get+"'.")}return n=""+e+"/"+t,this.options.accessToken!=null?n+="?access_token="+this.options.accessToken:n+="?client_id="+this.options.clientId,this.options.limit!=null&&(n+="&count="+this.options.limit),n+="&callback=instafeedCache"+this.unique+".parse",n},e.prototype._genKey=function(){var e;return e=function(){return((1+Math.random())*65536|0).toString(16).substring(1)},""+e()+e()+e()+e()},e.prototype._makeTemplate=function(e,t){var n,r,i,s,o;r=/(?:\{{2})([\w\[\]\.]+)(?:\}{2})/,n=e;while(r.test(n))i=n.match(r)[1],s=(o=this._getObjectProperty(t,i))!=null?o:"",n=n.replace(r,""+s);return n},e.prototype._getObjectProperty=function(e,t){var n,r;t=t.replace(/\[(\w+)\]/g,".$1"),r=t.split(".");while(r.length){n=r.shift();if(!(e!=null&&n in e))return null;e=e[n]}return e},e.prototype._sortBy=function(e,t,n){var r;return r=function(e,r){var i,s;return i=this._getObjectProperty(e,t),s=this._getObjectProperty(r,t),n?i>s?1:-1:i<s?1:-1},e.sort(r.bind(this)),e},e.prototype._filter=function(e,t){var n,r,i,s,o;n=[],i=function(e){if(t(e))return n.push(e)};for(s=0,o=e.length;s<o;s++)r=e[s],i(r);return n},e}(),t=typeof exports!="undefined"&&exports!==null?exports:window,t.instagramfeed=e}).call(this);
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
$('#sb_instagram.sbi').each(function(){
|
9 |
+
|
10 |
+
var $self = $(this),
|
11 |
+
$target = $self.find('#sbi_images'),
|
12 |
+
$loadBtn = $self.find("#sbi_load"),
|
13 |
+
imgres = 'standard_resolution';
|
14 |
+
|
15 |
+
switch( this.getAttribute('data-res') ) {
|
16 |
+
case 'thumb':
|
17 |
+
imgres = 'thumbnail';
|
18 |
+
break;
|
19 |
+
case 'medium':
|
20 |
+
imgres = 'low_resolution';
|
21 |
+
break;
|
22 |
+
default:
|
23 |
+
imgres = 'standard_resolution';
|
24 |
+
}
|
25 |
+
|
26 |
+
var userFeed = new instagramfeed({
|
27 |
+
target: $target,
|
28 |
+
get: "user",
|
29 |
+
resolution: imgres,
|
30 |
+
// Template option breaks in IE8 and below
|
31 |
+
// template: '<a href="{{link}}" target="_blank"><img src="{{image}}" /></a><p>{{caption}}<br />{{comments}}<br />{{likes}}<br />{{location}}<br />{{id}}</p>',
|
32 |
+
userId: parseInt( this.getAttribute('data-id') ),
|
33 |
+
accessToken: sb_instagram_js_options.sb_instagram_at,
|
34 |
+
after: function() {
|
35 |
+
if (this.hasNext()) {
|
36 |
+
$loadBtn.show();
|
37 |
+
} else {
|
38 |
+
$self.css('padding-bottom', 0);
|
39 |
+
}
|
40 |
+
}
|
41 |
+
});
|
42 |
+
|
43 |
+
$loadBtn.find('a').on("click", function() {
|
44 |
+
userFeed.next();
|
45 |
+
});
|
46 |
+
|
47 |
+
userFeed.run();
|
48 |
+
|
49 |
+
//Add target blank to content loaded in via ajax
|
50 |
+
$(document).on('click', 'a', function(e){
|
51 |
+
$(this).attr('target','_blank');
|
52 |
+
});
|
53 |
+
|
54 |
+
});
|
55 |
+
|
56 |
+
})(jQuery);
|