Feeds for YouTube (YouTube video, channel, and gallery plugin) - Version 1.0

Version Description

Download this release

Release Info

Developer smashballoon
Plugin Icon 128x128 Feeds for YouTube (YouTube video, channel, and gallery plugin)
Version 1.0
Comparing to
See all releases

Version 1.0

Files changed (53) hide show
  1. README.txt +152 -0
  2. css/admin.css +701 -0
  3. css/sb-youtube.css +1230 -0
  4. css/sb-youtube.min.css +1 -0
  5. css/sby-notices.css +89 -0
  6. img/balloon.png +0 -0
  7. img/close.png +0 -0
  8. img/gallery.png +0 -0
  9. img/grid.png +0 -0
  10. img/lightbox-placeholder.png +0 -0
  11. img/list.png +0 -0
  12. img/next.png +0 -0
  13. img/placeholder.png +0 -0
  14. img/prev.png +0 -0
  15. img/sby-icon-offer.png +0 -0
  16. img/sby-icon.png +0 -0
  17. img/smash-balloon-logo-small.png +0 -0
  18. inc/admin/admin-functions.php +708 -0
  19. inc/admin/class-sbspf-admin.php +849 -0
  20. inc/admin/class-sby-admin.php +448 -0
  21. inc/admin/templates/configure.php +44 -0
  22. inc/admin/templates/connected-accounts.php +42 -0
  23. inc/admin/templates/customize.php +12 -0
  24. inc/admin/templates/display.php +37 -0
  25. inc/admin/templates/main.php +64 -0
  26. inc/admin/templates/single-connected-account.php +46 -0
  27. inc/admin/templates/support.php +102 -0
  28. inc/class-sby-api-connect.php +194 -0
  29. inc/class-sby-cron-update.php +212 -0
  30. inc/class-sby-display-elements.php +398 -0
  31. inc/class-sby-feed.php +1191 -0
  32. inc/class-sby-parse.php +227 -0
  33. inc/class-sby-posts-manager.php +345 -0
  34. inc/class-sby-settings.php +326 -0
  35. inc/class-sby-vars.php +36 -0
  36. inc/class-sby-wp-post.php +84 -0
  37. inc/sby-functions.php +736 -0
  38. inc/widget.php +63 -0
  39. js/admin.js +520 -0
  40. js/sb-youtube.js +1158 -0
  41. js/sb-youtube.min.js +1 -0
  42. languages/youtube-feed-de_DE.mo +0 -0
  43. languages/youtube-feed-de_DE.po +875 -0
  44. languages/youtube-feed-fr_FR.mo +0 -0
  45. languages/youtube-feed-fr_FR.po +875 -0
  46. languages/youtube-feed.pot +875 -0
  47. templates/feed.php +49 -0
  48. templates/footer.php +32 -0
  49. templates/header.php +29 -0
  50. templates/item.php +44 -0
  51. templates/player.php +26 -0
  52. uninstall.php +97 -0
  53. youtube-feed.php +490 -0
README.txt ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Feeds for YouTube ===
2
+ Author: Smash Balloon
3
+ Contributors: smashballoon, craig-at-smash-balloon
4
+ Support Website: http://smashballoon/youtube-feed/
5
+ Tags: YouTube, YouTube feed, YouTube widget, YouTube channel, YouTube gallery
6
+ Requires at least: 3.4
7
+ Tested up to: 5.3
8
+ Stable tag: 1.0
9
+ License: GPLv2 or later
10
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
+
12
+ The Feeds for YouTube plugin allows you to display completely customizable YouTube feeds from any channel.
13
+
14
+ == Description ==
15
+ Display **completely customizable** YouTube feeds on your website. Match the look and feel of your site with tons of customization options!
16
+
17
+ ### YouTube Feed Features
18
+ * **Completely Customizable** YouTube feeds - by default inherits your theme's styles
19
+ * **Completely responsive and mobile optimized** - your YouTube feeds look great on any screen size
20
+ * Display videos from any YouTube channel in a list, gallery, or grid layout
21
+ * Display **multiple feeds** from different YouTube channels on multiple pages or widgets
22
+ * Post caching means that your YouTube feed loads **lightning fast** and minimizes YouTube API requests
23
+ * **Infinitely load more** of your YouTube videos with the 'Load More' button
24
+ * Built-in easy to use "YouTube Feed" Widget
25
+ * Fully internationalized and translatable into any language
26
+ * Display a beautiful header at the top of your YouTube channel feed
27
+ * Enter your own custom CSS or JavaScript for even deeper customization
28
+
29
+ For simple step-by-step directions on how to set up the Feeds for YouTube plugin please refer to our [setup guide](http://smashballoon.com/youtube-feed/free/?utm_source=wordpress&utm_campaign=sby 'Feeds for YouTube setup guide').
30
+
31
+ ### Benefits
32
+ * **Increase social engagement** between you and your YouTube subscribers
33
+ * **Save time** by using the Feeds for YouTube plugin to generate dynamic, search engine crawlable content on your website
34
+ * **Get more subscribers** by displaying your YouTube videos directly on your site
35
+ * Display your YouTube channel content **your way** to perfectly match your website's style
36
+ * The plugin is **updated regularly** with new features, bug-fixes and YouTube API changes
37
+ * Support is quick, effective, and always happy to help
38
+ * We're dedicated to providing the **most customizable**, **robust** and **well supported** YouTube feed plugin in the world!
39
+
40
+ ### Feedback or Support
41
+ Customer support is a huge deal to us. We pride ourselves on always providing quick, effective, and courteous support to all of our users. If you're having an issue with our YouTube pluginthen just let us know and we'll be there to help as soon as possible. You can either open a ticket on the support forum on [WordPress.org](https://wordpress.org/support/plugin/feeds-for-youtube/ "YouTube Feed Free support forum"), or directly on [our website](https://smashballoon.com/youtube-feed/support/ "YouTube Feed website support form").
42
+
43
+ If you like the plugin then please consider leaving a review, as it really helps to support the plugin. If you have an issue then please allow us to help you fix it before leaving a review. Just [let us know](https://smashballoon.com/youtube-feed/support/?utm_source=wordpress&utm_campaign=sby 'Feeds for YouTube Support') what the problem is and we'll get back to you right away.
44
+
45
+ ### Pro Version (Feeds for YouTube Pro)
46
+ We plan on releasing a [Pro version](http://smashballoon.com/youtube-feed/?utm_source=wordpress&utm_campaign=sby 'Feeds for YouTube Pro') which includes some awesome additional features to help you display your YouTube content in even more powerful ways:
47
+
48
+ * Display videos from your YouTube **favorites list**
49
+ * Integrate the **YouTube Live API** to show live streaming YouTube videos on your site.
50
+ * Display a YouTube gallery in a carousel slider
51
+ * Allow **filtering** of YouTube videos using keywords in the description or title
52
+ * Fully functional **search endpoint** for display YouTube videos from a search result
53
+ * **Combine multiple YouTube feeds** into one
54
+ * Customizable **actions when YouTube video completes** like displaying a link to a product page for example, or displaying thumbnails of your other videos.
55
+ * Download video data into a **custom post type** to allow visitors to browse and view YouTube videos on your website.
56
+
57
+ ### How to use the "Feeds for YouTube" plugin
58
+
59
+ One of our main priorities has always been to make our plugins as easy as possible to setup and use. Once you've installed the "Feeds for YouTube" plugin there are only a few steps to get up and running:
60
+
61
+ * 1) Click the "Log in to YouTube and connect an account" button on the "Feeds for YouTube" plugin settings page. This will prompt you to log into your Google account to authorize the plugin.
62
+ * 2) Once you've connected your account, save the plugin settings.
63
+ * 3) Then simply copy and paste the `[youtube-feed]` shortcode onto any page, post, or widget where you want your YouTube feed to be displayed.
64
+
65
+ That's it! You can then customize the feed as needed using the settings on the plugin "Customize" page.
66
+
67
+ For full step-by-step setup directions with screenshots, see [here](https://smashballoon.com/youtube-feed/free/ "YouTube Feed Free Setup Doc").
68
+
69
+ ### Who's behind this YouTube plugin?
70
+
71
+ We're Smash Balloon; a fun-loving WordPress plugin development company birthed into existence in early 2013. We specialize in creating plugins that are not only intuitive and simple to use, but also designed to integrate seamlessly into your website and allow you to display your social media content in powerful and unique ways. Over 1 million awesome people have decided to actively use our free plugins, which is an incredible honor that we don't take lightly. This compels us to try to provide the quickest and most effective customer support that we can, blowing users away with the best customer service they've ever experienced.
72
+
73
+ To find out more about the team, see [here](https://smashballoon.com/about/ "Team Smash Balloon").
74
+
75
+ == Installation ==
76
+ 1. Install the Feeds for YouTube plugin either via the WordPress plugin directory, or by uploading the files to your web server (in the /wp-content/plugins/ directory).
77
+ 2. Activate the plugin through the 'Plugins' menu in WordPress.
78
+ 3. Navigate to the 'Feeds for YouTube' settings page to configure your YouTube gallery.
79
+ 4. Use the shortcode [youtube-feed] in your page, post or widget to display your YouTube feed.
80
+ 5. You can display multiple YouTube channels with different configurations by specifying the necessary parameters directly in the shortcode: [youtube-feed channel=smashballoon].
81
+
82
+ For simple step-by-step directions on how to set up the Feeds for YouTube plugin please refer to our [setup guide](http://smashballoon.com/youtube-feed/free/?utm_source=wordpress&utm_campaign=sby 'Feeds for YouTube setup guide').
83
+
84
+ = Setting up the Free Feeds for YouTube WordPress Plugin =
85
+
86
+ The Feeds for YouTube plugin is brand new and so we're currently working on improving our documentation for it. If you have an issue or question please submit a support ticket and we'll get back to you as soon as we can.
87
+
88
+ 1) Once you've installed the "Feeds for YouTube" plugin click on the "Feeds for YouTube" item in your WordPress menu
89
+
90
+ 2) Click on the large blue YouTube login button to get your YouTube Access Token and YouTube Refresh Token. Note; if you have your own YouTube Developer Project set up then you can enter your YouTube API key by enabling the checkbox below the YouTube login button.
91
+
92
+ 3) Authorize the Feeds for YouTube plugin to read data about your YouTube videos and YouTube channel.
93
+
94
+ 4) YouTube sends back your YouTube Access Token and YouTube Refresh Token which are then automatically saved by the Feeds for YouTube plugin. This information is required in order to connect to the YouTube API.
95
+
96
+ 5) Enter a YouTube channel name to display videos from.
97
+
98
+ 6) Navigate to the Customize and Style pages to customize your YouTube feed.
99
+
100
+ 7) Once you've customized your YouTube feed, click on the "Display Your Feed" tab for directions on how to display your YouTube feed (or multiple YouTube feeds).
101
+
102
+ 8) Copy the [youtube-feed] shortcode and paste it into any page, post or widget where you want the YouTube feed to appear.
103
+
104
+ 9) You can paste the [youtube-feed] shortcode directly into your page editor.
105
+
106
+ 10) You can use the default WordPress 'Text' widget to display your Feeds for YouTube in a sidebar or other widget area.
107
+
108
+ 11) View your website to see your YouTube feed(s) in all their glory!
109
+
110
+ == Frequently Asked Questions ==
111
+
112
+ = Can I display multiple YouTube feeds on my site or on the same page? =
113
+
114
+ Yep. You can display multiple YouTube feeds by using our built-in shortcode options, for example: `[youtube-feed channel="smashballoon" num=3]`.
115
+
116
+ = How do I embed a YouTube gallery directly into a WordPress page template? =
117
+
118
+ You can embed your YouTube gallery directly into a template file by using the WordPress [do_shortcode](http://codex.wordpress.org/Function_Reference/do_shortcode) function: `<?php echo do_shortcode('[youtube-feed]'); ?>`.
119
+
120
+ = Will Feeds for YouTube work with W3 Total Cache or other caching plugins? =
121
+
122
+ The Feeds for YouTube plugin should work in compatibility with most, if not all, caching plugins, but you may need to tweak the settings in order to allow the YouTube feed to update successfully and display your latest posts. If you are experiencing problems with your YouTube feed not updating then try disabling either 'Page Caching' or 'Object Caching' in W3 Total Cache (or any other similar caching plugin) to see whether that fixes the problem and the YouTube feed displays and updates successfully.
123
+
124
+ = Can I change whether the YouTube video autoplays or plays on click =
125
+
126
+ Yep, just use the following setting: Feeds for YouTube > Customize > Video Experience > When does video play? You can then set the YouTube video to play when clicked or to autoplay.
127
+
128
+ = How can I change the layout of my YouTube video feed? =
129
+
130
+ This free plugin has several layout options built into it. Use the settings in the following location to display your YouTube videos in a list, grid, or gallery layout: Feeds for YouTube > Customize > Layout. You can also change the spacing/padding between the YouTube videos by using the "Spacing between videos" setting in this same section.
131
+
132
+ = Can I select how many YouTube videos should be displayed in the feed? =
133
+
134
+ Yep, you can choose to display between 1-50 YouTube videos in your feed by using the following setting: Feeds for YouTube > Customize > Layout > Number of Videos. The plugin also contains a "Load More" button to allow you to infinitely load more YouTube videos into your feed.
135
+
136
+ = How often will the plugin check YouTube for new content? =
137
+
138
+ The short answer is; as often as you'd like! Use the "Check for new posts" setting on the "Feeds for YouTube" settings page to set the plugin to check YouTube for new YouTube videos as often as you'd like. The recommended setting is once per hour.
139
+
140
+ == Screenshots ==
141
+
142
+ 1. By default the plugin inherits styles from your theme
143
+ 2. Display multiple YouTube feeds and customize each one
144
+ 3. When using the "grid" layout, YouTube videos open and play in a lightbox
145
+ 4. Feeds for YouTube Settings pages
146
+ 5. Built in customization settings make customizing your YouTube feed easy
147
+ 6. Use handy shortcode options to customize individual YouTube feeds
148
+ 7. To display a YouTube feed just copy and paste the [youtube-feed] shortcode into a widget or page
149
+
150
+ == Changelog ==
151
+ = 1.0 =
152
+ * Launched the Feeds for YouTube plugin!
css/admin.css ADDED
@@ -0,0 +1,701 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #sbspf_admin h2{
2
+ padding: 15px 0 0 0;
3
+ clear: both;
4
+ }
5
+ #sbspf_admin hr {
6
+ border: none;
7
+ margin: 15px 0;
8
+ border-bottom: 1px solid #ccc;
9
+ }
10
+ #sbspf_admin .sbspf_spinner {
11
+ float: none;
12
+ }
13
+ #sbspf_admin .sbspf_success {
14
+ display: inline-block;
15
+ position: relative;
16
+ margin: 4px 12px 0;
17
+ }
18
+ #sbspf_admin .sbspf_success svg {
19
+ vertical-align: bottom;
20
+ width: 16px;
21
+ color: #7ad03a;
22
+ }
23
+
24
+ /* Tooltips */
25
+ #sbspf_admin .sbspf_tooltip {
26
+ display: none;
27
+ }
28
+ #sbspf_admin .sbspf_tooltip_link {
29
+ font-size: 13px;
30
+ margin-left: 10px;
31
+ }
32
+ #sbspf_admin .sbspf_tooltip_link svg,
33
+ #sbspf_admin .sbspf_layouts svg,
34
+ .sbspf_small_svg {
35
+ width: 13px;
36
+ }
37
+ #sbspf_admin .sbspf_more_info{
38
+ clear: both;
39
+ padding: 10px 15px;
40
+ margin: 10px 0;
41
+ font-size: 13px;
42
+ background: #f9f9f9;
43
+ background: rgba(255,255,255,0.8);
44
+ -moz-border-radius: 8px;
45
+ -webkit-border-radius: 8px;
46
+ border-radius: 8px;
47
+ }
48
+ #sbspf_admin .postbox .sbspf_more_info{
49
+ background: #eee;
50
+ background: rgba(0,0,0,0.05);
51
+ }
52
+ #sbspf_admin .sbspf_more_info p{
53
+ font-size: 13px;
54
+ }
55
+ #sbspf_admin .sbspf_tooltip_link {
56
+ vertical-align: top;
57
+ }
58
+ #sbspf_admin .sbspf_tooltip_link svg {
59
+ vertical-align: bottom;
60
+ }
61
+ #sbspf_admin .sbspf-highlight{
62
+ background: #ffed51;
63
+ font-weight: bold;
64
+ color: black;
65
+ }
66
+
67
+ /* Quick Start */
68
+ #sbspf_admin .sbspf-quick-start{
69
+ display: block;
70
+ float: left;
71
+ clear: both;
72
+ min-width: 808px;
73
+ margin: 15px 0 0 0;
74
+ padding: 15px 20px;
75
+
76
+ border: 1px solid #ccc;
77
+ background: #eee;
78
+ background: rgba(255,255,255,0.5);
79
+
80
+ -moz-border-radius: 5px;
81
+ -webkit-border-radius: 5px;
82
+ border-radius: 5px;
83
+ }
84
+ #sbspf_admin .sbspf-quick-start h3,
85
+ #sbspf_admin .sbspf-quick-start p{
86
+ margin: 0;
87
+ padding: 5px 0;
88
+ }
89
+ #sbspf_admin .sbspf-success{
90
+ font-size: 14px;
91
+ }
92
+ #sbspf_admin .sbspf-footnote{
93
+ width: 100%;
94
+ float: left;
95
+ clear: both;
96
+ padding: 20px 0 0 0;
97
+ border-top: 1px solid #ccc;
98
+ margin: 20px 0 0 0;
99
+ }
100
+ #sbspf_have_own_tokens {
101
+ margin: 1px 6px 0 0;
102
+ }
103
+ #sbspf_width_options {
104
+ margin-top: 8px;
105
+ }
106
+ /* Pro Notice */
107
+ #sbspf_admin .sbspf-pro-notice,
108
+ #sbspf_admin .sbspf-pro-notice img{
109
+ display: block;
110
+ float: left;
111
+ clear: both;
112
+ margin: 20px 0 0 0;
113
+ overflow: hidden;
114
+
115
+ -moz-border-radius: 4px;
116
+ -webkit-border-radius: 4px;
117
+ border-radius: 4px;
118
+
119
+ -moz-transition: all 0.5s ease-in-out;
120
+ -webkit-transition: all 0.5s ease-in-out;
121
+ -o-transition: all 0.5s ease-in-out;
122
+ transition: all 0.5s ease-in-out;
123
+ }
124
+ #sbspf_admin .sbspf-pro-notice img{
125
+ margin: 0;
126
+ }
127
+ #sbspf_admin .sbspf-pro-notice:hover{
128
+ opacity: 0.95;
129
+
130
+ -moz-transition: all 0.1s ease-in-out;
131
+ -webkit-transition: all 0.1s ease-in-out;
132
+ -o-transition: all 0.1s ease-in-out;
133
+ transition: all 0.1s ease-in-out;
134
+ }
135
+
136
+ /* General Formatting */
137
+ #sbspf_admin .sbspf_note {
138
+ font-size: 12px;
139
+ font-style: italic;
140
+ margin-left: 5px;
141
+ }
142
+ #sbspf_admin .sbspf_shortcode {
143
+ position: absolute;
144
+ z-index: 10;
145
+ font-size: 11px;
146
+ float: left;
147
+ width: auto;
148
+ white-space: pre-line;
149
+ line-height: 1.4;
150
+ max-width: 195px;
151
+ }
152
+ .sbspf_size_4 {
153
+ max-width: 60px;
154
+ }
155
+ #sbspf_admin td textarea {
156
+ width: 100%;
157
+ max-width: 700px;
158
+ }
159
+ /* Types */
160
+ #sbspf_admin .sbspf_row{
161
+ width: 100%;
162
+ float: left;
163
+ clear: both;
164
+ margin-bottom: 5px;
165
+ }
166
+ #sbspf_admin .sbspf_col{
167
+ float: left;
168
+ }
169
+ #sbspf_admin .sbspf_col.sbspf_one{
170
+ width: 138px;
171
+ }
172
+ #sbspf_admin .sbspf_col.sbspf_two{
173
+ width: 73%;
174
+ }
175
+ #sbspf_admin .sbspf_row input[type=radio]{
176
+ margin: 5px 2px 0 0;
177
+ }
178
+ #sbspf_admin .sbspf_radio_label {
179
+ padding-top: 4px;
180
+ display: -moz-inline-stack;
181
+ display: inline-block;
182
+ vertical-align: top;
183
+ zoom: 1;
184
+ *display: inline;
185
+ }
186
+
187
+ /* Log In Get Access Token Button */
188
+ #sbspf_admin #sbspf_get_token{
189
+ display: block;
190
+ float: left;
191
+ clear: both;
192
+ padding: 0 21px;
193
+ height: 47px;
194
+ line-height: 47px;
195
+ font-size: 14px;
196
+
197
+ background: #386793;
198
+
199
+ color: #e9eef3;
200
+ text-decoration: none;
201
+
202
+ -moz-border-radius: 5px;
203
+ -webkit-border-radius: 5px;
204
+ border-radius: 5px;
205
+
206
+ -moz-transition: all 0.5s ease-in-out;
207
+ -webkit-transition: all 0.5s ease-in-out;
208
+ -o-transition: all 0.5s ease-in-out;
209
+ transition: all 0.5s ease-in-out;
210
+ }
211
+
212
+ /* Connected Accounts */
213
+ #sbspf_get_token svg {
214
+ width: 29px;
215
+ margin-right: 10px;
216
+ position: relative;
217
+ top: 7px;
218
+ }
219
+ #sbspf_admin .sbspf_connected_account {
220
+ position: relative;
221
+ box-sizing: border-box;
222
+ padding: 10px 35px 10px 10px;
223
+ border-radius: 5px;
224
+ background: #fff;
225
+ margin-bottom: 5px;
226
+ overflow: hidden;
227
+ clear: both;
228
+ border: 1px solid #ddd;
229
+ }
230
+ #sbspf_admin .sbspf_connected_account .sbspf_ca_accesstoken input {
231
+ min-height: auto;
232
+ line-height: 1;
233
+ }
234
+ #sbspf_admin .sbspf_ca_user_id{
235
+ width: 275px;
236
+ }
237
+ #sbspf_admin .sbspf_ca_refresh_token {
238
+ width: 510px;
239
+ }
240
+ #sbspf_admin .sbspf_connected_account svg {
241
+ vertical-align: bottom;
242
+ }
243
+ #sbspf_admin .sbspf_ca_username {
244
+ line-height: 1.4;
245
+ margin-left: 15px;
246
+ float: left;
247
+ font-size: 18px;
248
+ }
249
+ #sbspf_admin .sbspf_connected_account .sbspf_ca_avatar{
250
+ margin-right: 15px;
251
+ }
252
+ #sbspf_admin .sbspf_connected_account .sbspf_ca_username {
253
+ margin-left: 0;
254
+ margin-right: 15px;
255
+ }
256
+ #sbspf_admin .sbspf_connected_account .sbspf_ca_username strong{
257
+ float: left;
258
+ }
259
+ #sbspf_admin .sbspf_connected_account .sbspf_ca_username span{
260
+ font-size: 10px;
261
+ font-weight: normal;
262
+ text-transform: uppercase;
263
+ padding: 0;
264
+ margin: 0;
265
+ display: block;
266
+ }
267
+
268
+ #sbspf_admin .sbspf_ca_actions {
269
+ display: inline-block;
270
+ }
271
+ #sbspf_admin .sbspf_ca_actions .fa,
272
+ #sbspf_admin .sbspf_ca_actions svg{
273
+ margin-right: 5px;
274
+ }
275
+ #sbspf_admin .sbspf_ca_actions a.button-primary,
276
+ #sbspf_admin .sbspf_ca_actions a.button-secondary,
277
+ #sbspf_admin .sbspf_ca_accesstoken a.sbspf_ca_token_shortcode {
278
+ font-size: 12px;
279
+ padding: 6px;
280
+ height: auto;
281
+ line-height: 1;
282
+ margin: 7px 5px 0 0;
283
+ vertical-align: top;
284
+ }
285
+ #sbspf_admin .sbspf_ca_at_is_valid {
286
+ margin-top: 10px;
287
+ display: none;
288
+ }
289
+
290
+ @-webkit-keyframes sbspf_flash {
291
+ 0% {
292
+ background-color: #cae2a5;
293
+ opacity:1;
294
+ border: 1px solid #b2ce88;
295
+ }
296
+ 100% {
297
+ background-color: #fff;
298
+ }
299
+ }
300
+ #sbspf_admin .sbspf_account_updated{
301
+ border: 1px solid #ddd;
302
+ background: #fff;
303
+
304
+ -webkit-animation-name: sbspf_flash;
305
+ -webkit-animation-duration: 700ms;
306
+ -webkit-animation-iteration-count: 1;
307
+ -webkit-animation-timing-function: linear;
308
+ -moz-animation-name: sbspf_flash;
309
+ -moz-animation-duration: 700ms;
310
+ -moz-animation-iteration-count: 1;
311
+ -moz-animation-timing-function: linear;
312
+ }
313
+
314
+ #sbspf_admin .sbspf_account_active{
315
+ border: 1px solid #b2ce88;
316
+ background: #ecf2e3;
317
+ }
318
+
319
+ #sbspf_admin .sbspf_ca_alert {
320
+ display: none;
321
+ }
322
+ #sbspf_admin .sbspf_account_invalid .sbspf_ca_alert {
323
+ display: block;
324
+ }
325
+ #sbspf_admin .sbspf_ca_avatar{
326
+ float: left;
327
+ width: 40px;
328
+ height: 40px;
329
+ border-radius: 5px;
330
+ }
331
+ #sbspf_admin .sbspf_ca_accesstoken{
332
+ display: none;
333
+ width: 100%;
334
+ float: left;
335
+ clear: both;
336
+ margin-top: 10px;
337
+ }
338
+ #sbspf_admin .sbspf_ca_token_label{
339
+ display: inline-block;
340
+ position: relative;
341
+ background: #f9f9f9;
342
+ color: #555;
343
+ padding: 3px 5px;
344
+ font-size: 12px;
345
+ border: 1px solid #d6d6d6;
346
+ height: 16px;
347
+ line-height: 15px;
348
+ border-radius: 4px 0 0 4px;
349
+ min-width: 80px;
350
+ margin-bottom: 2px;
351
+ }
352
+ #sbspf_admin .sbspf_permissions_desc,
353
+ #sbspf_admin .sbspf_ca_token,
354
+ #sbspf_admin .sbspf_ca_refresh_token,
355
+ #sbspf_admin .sbspf_ca_user_id {
356
+ padding: 3px 10px;
357
+ }
358
+
359
+ #sbspf_admin .sbspf_ca_token,
360
+ #sbspf_admin .sbspf_ca_user_id,
361
+ #sbspf_admin .sbspf_ca_refresh_token{
362
+ position: relative;
363
+ top: 1px;
364
+ border: 1px solid #d6d6d6;
365
+ border-left: none;
366
+ font-size: 13px;
367
+ border-radius: 0 4px 4px 0;
368
+ background: rgba(255,255,255,0.8);
369
+ display: inline-block;
370
+ margin-left: 0;
371
+ }
372
+ #sbspf_admin .sbspf_ca_token {
373
+ width: 510px;
374
+ }
375
+ #sbspf_admin .sbspf_ca_accesstoken a.sbspf_ca_token_shortcode{
376
+ margin: 0 8px 8px;
377
+ padding: 6px;
378
+ height: auto;
379
+ line-height: 1;
380
+ }
381
+
382
+ #sbspf_admin .sbspf_delete_account{
383
+ position: absolute;
384
+ right: 10px;
385
+ top: 10px;
386
+
387
+ padding: 5px 10px;
388
+ background: rgba(0,0,0,0.05);
389
+ color: #666;
390
+ border-radius: 50px;
391
+ text-decoration: none;
392
+ font-size: 12px;
393
+ }
394
+ #sbspf_admin .sbspf_delete_account:hover,
395
+ #sbspf_admin .sbspf_delete_account:focus{
396
+ background: #333;
397
+ color: #ddd;
398
+ }
399
+ #sbspf_admin .sbspf_ca_delete a {
400
+ display: block;
401
+ height: 13px;
402
+ padding: 5px 6px;
403
+ }
404
+ #sbspf_admin .sbspf_ca_delete svg {
405
+ height: 12px;
406
+ line-height: 1;
407
+ padding-bottom: 2px;
408
+ }
409
+ #sbspf_admin .sbspf_delete_account .sbspf_remove_text{
410
+ margin-left: 5px;
411
+ }
412
+
413
+ .sbspf_connected_accounts_wrap{
414
+ vertical-align: top;
415
+ }
416
+ #sbspf_admin .sbspf_no_accounts{
417
+ display: inline-block;
418
+ padding: 4px 15px;
419
+ border-radius: 8px;
420
+ background: rgba(255,255,255,0.8);
421
+ margin-bottom: 3px;
422
+ }
423
+ #sbspf_admin #sbspf_manual_submit:active{
424
+ vertical-align: unset;
425
+ }
426
+ #sbspf_admin .sbspf_manually_connect_wrap{
427
+ padding-top: 5px;
428
+ }
429
+ #sbspf_admin .sbspf_user_feed_account_wrap:first-child,
430
+ #sbspf_admin .sbspf_tagged_feed_account_wrap:first-child{
431
+ padding-top: 5px;
432
+ }
433
+ #sbspf_admin .sbspf_user_feed_account_wrap:last-child,
434
+ #sbspf_admin .sbspf_tagged_feed_account_wrap:last-child{
435
+ padding-bottom: 6px;
436
+ }
437
+ #sbspf_admin .sbspf_user_feed_account_wrap,
438
+ #sbspf_admin .sbspf_tagged_feed_account_wrap{
439
+ padding-bottom: 5px;
440
+ padding-left: 2px;
441
+ }
442
+ #sbspf_admin .sbspf_user_feed_account_wrap span,
443
+ #sbspf_admin .sbspf_tagged_feed_account_wrap span{
444
+ font-size: 13px;
445
+ }
446
+ #sbspf_admin .sbspf_manual_account_id_toggle label{
447
+ display: block;
448
+ margin: 10px 0 0 0;
449
+ font-size: 13px;
450
+ }
451
+ #sbspf_admin .sbspf_business_profile_tag{
452
+ display: none;
453
+ padding: 8px 10px;
454
+ background: rgba(0,0,0,0.05);
455
+ border-radius: 0 5px 5px 0;
456
+ margin: 0 0 0 -2px;
457
+ font-size: 13px;
458
+ height: 15px;
459
+ line-height: 15px;
460
+ box-shadow: inset 0 0 1px rgba(0,0,0,.5);
461
+ }
462
+ #sbspf_admin .sbspf_ca_info{
463
+ overflow: hidden;
464
+ }
465
+ #sbspf_admin .sbspf_ca_show_token .fa,
466
+ #sbspf_admin .sbspf_ca_show_token svg{
467
+ margin-right: 0;
468
+ }
469
+ #sbspf_admin .sbspf_ca_show_token{
470
+ display: inline-block;
471
+ padding: 10px 5px 0px 5px;
472
+ margin: 0;
473
+ font-size: 12px;
474
+ vertical-align: top;
475
+ }
476
+ #sbspf_admin .sbspf_ca_shortcode{
477
+ display: none;
478
+ padding: 0;
479
+ width: 100%;
480
+ float: left;
481
+ clear: both;
482
+ margin: 10px 0 0 0;
483
+ }
484
+ #sbspf_admin .sbspf_ca_shortcode p{
485
+ padding-bottom: 10px;
486
+ font-size: 13px;
487
+ }
488
+ #sbspf_admin .sbspf_ca_shortcode code{
489
+ margin-top: 5px;
490
+ display: inline-block;
491
+ }
492
+ #sbspf_admin .sbspf_user_feed_ids_wrap .sbspf_ca_avatar{
493
+ width: 20px;
494
+ height: 20px;
495
+ position: relative;
496
+ top: 5px;
497
+ margin-right: 8px;
498
+ border-radius: 4px;
499
+ }
500
+
501
+
502
+ @media all and (max-width: 1200px){
503
+ #sbspf_admin .sbspf_delete_account .sbspf_remove_text{
504
+ display: none;
505
+ }
506
+ #sbspf_admin .sbspf_ca_token,
507
+ #sbspf_admin .sbspf_ca_user_id{
508
+ border-left: 1px solid #d6d6d6;
509
+ border-radius: 4px;
510
+ }
511
+ }
512
+ @media all and (max-width: 800px){
513
+ #sbspf_admin .sbspf_col.sbspf_one {
514
+ width: 25%;
515
+ margin-right: 5%;
516
+ }
517
+ #sbspf_admin .sbspf_col.sbspf_two{
518
+ width: 70%;
519
+ }
520
+ }
521
+
522
+ /* Configure */
523
+ #sbspf_config {
524
+ float: left;
525
+ width: 100%;
526
+ clear: both;
527
+ margin: 10px 0 10px 0;
528
+ }
529
+ #sbspf_config .sbspf_not_working {
530
+ position: relative;
531
+ top: 14px;
532
+ left: 15px;
533
+ }
534
+ /* Caching settings */
535
+ #sbspf_admin #sbspf-caching-time-settings{
536
+ display: inline-block;
537
+ }
538
+ #sbspf_admin .sbspf-caching-cron-options .submit{
539
+ display: inline-block;
540
+ margin: 0;
541
+ padding: 0;
542
+ }
543
+ #sbspf_admin .sbspf-caching-sched-notice{
544
+ font-size: 11px;
545
+ display: block;
546
+ width: 100%;
547
+ }
548
+ #sbspf_admin .sbspf-caching-sched-notice span{
549
+ color: green;
550
+ background: #e5eae1;
551
+ padding: 5px 10px;
552
+ border-radius: 5px;
553
+ border: 1px solid #ccd3c6;
554
+ display: inline-block;
555
+ }
556
+ #sbspf_admin .sbspf_cron_cache_opts .sbspf_row{
557
+ padding: 3px 0;
558
+ }
559
+ #sbspf_admin .sbspf_cron_cache_opts .sbspf_row label {
560
+ display: inline-block;
561
+ margin: 5px 2px 0 0;
562
+ }
563
+
564
+ /* Layout */
565
+ .form-table .sbspf_layout_type {
566
+ display: inline-block;
567
+ margin-left: 20px;
568
+ }
569
+ .form-table .sbspf_layout_type:first-child {
570
+ margin-left: 0;
571
+ }
572
+ .sbspf_layout_setting,
573
+ .sbspf_box_setting{
574
+ margin-bottom: 20px;
575
+ }
576
+ .sbspf_layout_setting:last-child,
577
+ .sbspf_box_setting:last-child {
578
+ margin-bottom: 0;
579
+ }
580
+ .sbspf_layout_setting label,
581
+ .sbspf_box_setting label {
582
+ display: inline-block;
583
+ font-weight: bold;
584
+ font-size: 14px;
585
+ padding-bottom: 5px;
586
+ padding-right: 5px;
587
+ }
588
+ #sbspf_admin .sbspf_layout_options_wrap .sbspf_shortcode_symbol{
589
+ bottom: 4px;
590
+ right: -20px;
591
+ }
592
+ #sbspf_admin .sbspf_layout_options_wrap .sbspf_shortcode,
593
+ #sbspf_admin .sbspf_box_setting .sbspf_shortcode{
594
+ position: relative;
595
+ float: none;
596
+ top: -4px
597
+ }
598
+ .sbspf_layout_cell {
599
+ padding: 0;
600
+ display: inline-block;
601
+ float: left;
602
+ width: 155px;
603
+ padding: 15px 15px 10px 15px;
604
+ margin-right: 10px;
605
+ background: #f6f6f6;
606
+ border: 1px solid #ddd;
607
+ -moz-border-radius: 5px;
608
+ -webkit-border-radius: 5px;
609
+ border-radius: 5px;
610
+ vertical-align: top;
611
+ }
612
+ .sbspf_layout_cell:nth-child(4) {
613
+ margin-right: 0;
614
+ }
615
+ @media all and (max-width: 1200px){
616
+ .sbspf_layout_cell{
617
+ width: 21%;
618
+ padding: 1%;
619
+ margin-right: 1%;
620
+ }
621
+ }
622
+ @media all and (max-width: 480px){
623
+ .sbspf_layout_cell{
624
+ width: 98%;
625
+ padding: 1%;
626
+ margin: 5px 0;
627
+ }
628
+ }
629
+ .sbspf_label {
630
+ font-size: 16px;
631
+ font-weight: bold;
632
+ padding-left: 2px;
633
+ }
634
+ .sbspf_layout_cell:hover,
635
+ .sbspf_layout_cell:focus{
636
+ background: #fcfcfc;
637
+ cursor: pointer;
638
+ }
639
+ .sbspf_layout_cell.sbspf_layout_selected{
640
+ background: #f7faf1;
641
+ border: 1px solid #7ad03a;
642
+ }
643
+ .sbspf_layout_cell h3{
644
+ font-size: 15px;
645
+ margin-top: 0;
646
+ }
647
+ .sbspf_layout_cell img{
648
+ width: 100%;
649
+ border: 1px solid #ddd;
650
+ margin-top: 5px;
651
+ }
652
+ #sbspf_admin .sbspf_layout_settings{
653
+ float: left;
654
+ clear: both;
655
+ width: 96%;
656
+ max-width: 700px;
657
+
658
+ padding: 20px 2%;
659
+ margin: 10px 0;
660
+ font-size: 13px;
661
+ background: #f9f9f9;
662
+ background: rgba(255,255,255,0.8);
663
+
664
+ -moz-border-radius: 8px;
665
+ -webkit-border-radius: 8px;
666
+ border-radius: 8px;
667
+ }
668
+ .sbspf_layout_setting {
669
+ clear:left;
670
+ margin-bottom: 10px;
671
+ }
672
+ #sbspf_admin .sbspf_layout_options_wrap .sbspf-tooltip{
673
+ width: 98%;
674
+ padding: 10px 1%;
675
+ background: #eee;
676
+ background: rgba(0,0,0,0.05);
677
+ }
678
+ #sbspf_admin .sbspf_layout_mobile_layout_setting {
679
+ width: auto;
680
+ }
681
+
682
+ /* Display Tab */
683
+ #sbspf_admin table.sbspf_shortcode_table{
684
+ border-collapse: collapse;
685
+ }
686
+ #sbspf_admin table.sbspf_shortcode_table th,
687
+ #sbspf_admin table.sbspf_shortcode_table td{
688
+ border: 1px solid #999;
689
+ padding: 0.5rem;
690
+ text-align: left;
691
+ }
692
+ #sbspf_admin table.sbspf_shortcode_table th{
693
+ background: rgba(0,0,0,0.1);
694
+ }
695
+ #sbspf_admin table.sbspf_shortcode_table td{
696
+ background: rgba(255,255,255,0.5);
697
+ }
698
+ #sbspf_admin .sbspf_table_header{
699
+ background: #ddd;
700
+ font-weight: bold;
701
+ }
css/sb-youtube.css ADDED
@@ -0,0 +1,1230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**************/
2
+ /*** LAYOUT ***/
3
+ /**************/
4
+
5
+ /* Feed container */
6
+ [id^=sb_youtube_].sb_youtube {
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
+ [id^=sb_youtube_].sb_youtube:after{
15
+ content: "";
16
+ display: table;
17
+ clear: both;
18
+ }
19
+
20
+ /*********************/
21
+ /*** STYLE OPTIONS ***/
22
+ /*********************/
23
+ [id^=sb_youtube_].sb_youtube.sby_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
+ [id^=sb_youtube_].sb_youtube .sby_items_wrap{
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
+
40
+ /* Items */
41
+ [id^=sb_youtube_].sb_youtube .sby_items_wrap .sby_item,
42
+ [id^=sb_youtube_].sb_youtube .sby_player_outer_wrap .sby_video_thumbnail_wrap,
43
+ [id^=sb_youtube_].sb_youtube .sby_player_wrap{
44
+ display: -moz-inline-stack;
45
+ display: inline-block;
46
+ vertical-align: top;
47
+ zoom: 1;
48
+ *display: inline;
49
+
50
+ max-height: 1000px;
51
+ padding: inherit !important;
52
+ text-decoration: none;
53
+ opacity: 1;
54
+ overflow: hidden;
55
+
56
+ -webkit-box-sizing: border-box;
57
+ -moz-box-sizing: border-box;
58
+ box-sizing: border-box;
59
+
60
+ -webkit-transition: all 0.5s ease;
61
+ -moz-transition: all 0.5s ease;
62
+ -o-transition: all 0.5s ease;
63
+ -ms-transition: all 0.5s ease;
64
+ transition: all 0.5s ease;
65
+ }
66
+ [id^=sb_youtube_].sb_youtube .sby_items_wrap .sby_item.sby_no_margin {
67
+ margin: 0 !important;
68
+ }
69
+ [id^=sb_youtube_].sb_youtube .sby_items_wrap .sby_item {
70
+ float: left;
71
+ }
72
+ /* Transition items in */
73
+ [id^=sb_youtube_].sb_youtube .sby_items_wrap .sby_item.sby_transition{
74
+ opacity: 0;
75
+ max-height: 0;
76
+ }
77
+
78
+ /* Cols */
79
+ [id^=sb_youtube_].sb_youtube.sby_col_0 .sby_items_wrap .sby_item{ width: 100%; }
80
+ [id^=sb_youtube_].sb_youtube.sby_col_1 .sby_items_wrap .sby_item{ width: 100%; }
81
+ [id^=sb_youtube_].sb_youtube.sby_col_2 .sby_items_wrap .sby_item{ width: 50%; }
82
+ [id^=sb_youtube_].sb_youtube.sby_col_3 .sby_items_wrap .sby_item{ width: 33.33%; }
83
+ [id^=sb_youtube_].sb_youtube.sby_col_4 .sby_items_wrap .sby_item{ width: 25%; }
84
+ [id^=sb_youtube_].sb_youtube.sby_col_5 .sby_items_wrap .sby_item{ width: 20%; }
85
+ [id^=sb_youtube_].sb_youtube.sby_col_6 .sby_items_wrap .sby_item{ width: 16.66%; }
86
+ [id^=sb_youtube_].sb_youtube.sby_col_7 .sby_items_wrap .sby_item{ width: 14.28%; }
87
+ [id^=sb_youtube_].sb_youtube.sby_col_8 .sby_items_wrap .sby_item{ width: 12.5%; }
88
+ [id^=sb_youtube_].sb_youtube.sby_col_9 .sby_items_wrap .sby_item{ width: 11.11%; }
89
+ [id^=sb_youtube_].sb_youtube.sby_col_10 .sby_items_wrap .sby_item{ width: 10%; }
90
+
91
+ /* Disable mobile layout */
92
+ /*
93
+ [id^=sb_youtube_].sb_youtube.sby_col_1.sby_disable_mobile .sby_items_wrap .sby_item{ width: 100%; }
94
+ [id^=sb_youtube_].sb_youtube.sby_col_2.sby_disable_mobile .sby_items_wrap .sby_item{ width: 50%; }
95
+ [id^=sb_youtube_].sb_youtube.sby_col_3.sby_disable_mobile .sby_items_wrap .sby_item{ width: 33.33%; }
96
+ [id^=sb_youtube_].sb_youtube.sby_col_4.sby_disable_mobile .sby_items_wrap .sby_item{ width: 25%; }
97
+ [id^=sb_youtube_].sb_youtube.sby_col_5.sby_disable_mobile .sby_items_wrap .sby_item{ width: 20%; }
98
+ [id^=sb_youtube_].sb_youtube.sby_col_6.sby_disable_mobile .sby_items_wrap .sby_item{ width: 16.66%; }
99
+ [id^=sb_youtube_].sb_youtube.sby_col_7.sby_disable_mobile .sby_items_wrap .sby_item{ width: 14.28%; }
100
+ [id^=sb_youtube_].sb_youtube.sby_col_8.sby_disable_mobile .sby_items_wrap .sby_item{ width: 12.5%; }
101
+ [id^=sb_youtube_].sb_youtube.sby_col_9.sby_disable_mobile .sby_items_wrap .sby_item{ width: 11.11%; }
102
+ [id^=sb_youtube_].sb_youtube.sby_col_10.sby_disable_mobile .sby_items_wrap .sby_item{ width: 10%; }
103
+ */
104
+ /* Photos */
105
+ .sby-screenreader{text-indent: -9999px !important;display: block !important;width: 0 !important;height: 0 !important;line-height: 0 !important;}
106
+ [id^=sb_youtube_].sb_youtube .sby_video_thumbnail_wrap,
107
+ [id^=sb_youtube_].sb_youtube .sby_player_outer_wrap {
108
+ width: 100%;
109
+ position: relative;
110
+ float: left;
111
+ }
112
+ [id^=sb_youtube_].sb_youtube .sby_video_thumbnail{
113
+ display: block;
114
+ position: relative;
115
+ text-decoration: none;
116
+ line-height: 0;
117
+ z-index: 5;
118
+ }
119
+ [id^=sb_youtube_].sb_youtube .sby_video_thumbnail img{
120
+ width: 100%;
121
+ height: auto;
122
+ border-radius: 0;
123
+ }
124
+ [id^=sb_youtube_].sb_youtube .sby_link{
125
+ display: none;
126
+ position: absolute;
127
+ z-index: 1;
128
+ top: 0;
129
+ right: 0;
130
+ bottom: 0;
131
+ left: 0;
132
+
133
+ width: 100%;
134
+ padding: 0;
135
+ background: #333;
136
+ background: rgba(0,0,0,0.6);
137
+ text-align: center;
138
+ color: #fff;
139
+ font-size: 12px;
140
+ line-height: 1.1;
141
+ overflow: hidden;
142
+ }
143
+ [id^=sb_youtube_].sb_youtube .sby_link.sby_default p,
144
+ [id^=sb_youtube_].sb_youtube .sby_link.sby_default span,
145
+ [id^=sb_youtube_].sb_youtube .sby_link.sby_default a{
146
+ text-shadow: 0px 0px 10px #000;
147
+ }
148
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_username a,
149
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_youtube_link,
150
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_hover_bottom,
151
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_playbtn,
152
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_lightbox_link,
153
+ [id^=sb_youtube_].sb_youtube .sby_link .svg-inline--fa.fa-play{
154
+ filter: alpha(opacity=90);
155
+ opacity: 0.9;
156
+ }
157
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_username a:hover,
158
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_youtube_link:hover,
159
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_playbtn:hover,
160
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_lightbox_link:hover,
161
+ [id^=sb_youtube_].sb_youtube .sby_link .svg-inline--fa.fa-play:hover{
162
+ filter: alpha(opacity=100);
163
+ opacity: 1;
164
+ }
165
+ [id^=sb_youtube_].sb_youtube .sby_link_area{
166
+ position: absolute;
167
+ top: 0;
168
+ right: 0;
169
+ bottom: 0;
170
+ left: 0;
171
+ z-index: 1;
172
+ }
173
+
174
+ [id^=sb_youtube_].sb_youtube .sby_link a{
175
+ padding: 0;
176
+ text-decoration: none;
177
+ color: #ddd;
178
+ color: rgba(255,255,255,0.7);
179
+ line-height: 1.1;
180
+ background: none;
181
+
182
+ display: -moz-inline-stack;
183
+ display: inline-block;
184
+ vertical-align: top;
185
+ zoom: 1;
186
+ *display: inline;
187
+ }
188
+ [id^=sb_youtube_].sb_youtube .sby_link a:hover,
189
+ [id^=sb_youtube_].sb_youtube .sby_link a:active{
190
+ color: #fff;
191
+ }
192
+
193
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_lightbox_link{
194
+ display: block;
195
+ /*display: none;*/
196
+ position: absolute;
197
+ z-index: 2;
198
+ top: 50%;
199
+ left: 50%;
200
+
201
+ margin-top: -24px;
202
+ margin-left: -21px;
203
+ padding: 0;
204
+ font-size: 49px;
205
+ font-style: normal !important;
206
+ }
207
+ [id^=sb_youtube_].sb_youtube .sby_type_video .sby_lightbox_link,
208
+ [id^=sb_youtube_].sb_youtube .sby_carousel_vid_first .sby_lightbox_link{
209
+ display: none;
210
+ }
211
+
212
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_youtube_link{
213
+ /*float: right;*/
214
+ font-size: 30px;
215
+ position: absolute;
216
+ z-index: 100;
217
+ bottom: 0;
218
+ right: 2px;
219
+ padding: 8px;
220
+ }
221
+ [id^=sb_youtube_].sb_youtube .sby_link a:hover,
222
+ [id^=sb_youtube_].sb_youtube .sby_link a:focus{
223
+ text-decoration: underline;
224
+ }
225
+
226
+ /* Player */
227
+ [id^=sb_youtube_].sb_youtube .sby_player_wrap {
228
+ z-index: 1;
229
+ width: 100% !important;
230
+ height: 100% !important;
231
+ position: absolute;
232
+ top: 0;
233
+ left: 0;
234
+ }
235
+ [id^=sb_youtube_].sb_youtube .sby_player_wrap iframe {
236
+ width: 100% !important;
237
+ height: 100% !important;
238
+ }
239
+
240
+ /* Use CSS for lightbox fade instead of JS */
241
+ [id^=sb_youtube_].sb_youtube .sby_thumbail_hover {
242
+ opacity: 0;
243
+ display: block;
244
+ position: absolute;
245
+ top: 0;
246
+ right: 0;
247
+ bottom: 0;
248
+ left: 0;
249
+ z-index: 10;
250
+ color: #fff;
251
+ background: #333;
252
+ background: rgba(0,0,0,.6);
253
+ transition: opacity .6s ease-in-out;
254
+ -moz-transition: opacity .6s ease-in-out;
255
+ -webkit-transition: opacity .6s ease-in-out;
256
+ }
257
+ [id^=sb_youtube_].sb_youtube.sby_layout_list .sby_thumbail_hover {
258
+ display: none;
259
+ }
260
+ .sby_video_title {
261
+ display: inline-block;
262
+ height: 100%;
263
+ padding: 10px;
264
+ overflow: hidden;
265
+ font-size: 13px;
266
+ line-height: 1.2;
267
+ }
268
+ [id^=sb_youtube_].sb_youtube .sby_video_thumbnail:hover .sby_thumbail_hover {
269
+ opacity: 1;
270
+ display: block;
271
+ transition: opacity .2s ease-in-out;
272
+ -moz-transition: opacity .2s ease-in-out;
273
+ -webkit-transition: opacity .2s ease-in-out;
274
+ }
275
+ [id^=sb_youtube_].sb_youtube.sby_layout_list .sby_video_thumbnail:hover .sby_thumbail_hover {
276
+ opacity: 0;
277
+ display: none;
278
+ transition: none;
279
+ -moz-transition: none;
280
+ -webkit-transition: none;
281
+ }
282
+
283
+ /* Loader */
284
+ [id^=sb_youtube_].sb_youtube .sby_loader{
285
+ width: 20px;
286
+ height: 20px;
287
+
288
+ position: relative;
289
+ top: 50%;
290
+ left: 50%;
291
+ margin: -10px 0 0 -10px;
292
+ background-color: #000;
293
+ background-color: rgba(0,0,0,0.5);
294
+
295
+ border-radius: 100%;
296
+ -webkit-animation: sby-sk-scaleout 1.0s infinite ease-in-out;
297
+ animation: sby-sk-scaleout 1.0s infinite ease-in-out;
298
+ }
299
+ [id^=sb_youtube_].sb_youtube br {
300
+ display: none;
301
+ }
302
+ .sby_footer p {
303
+ display: inline;
304
+ padding: 0;
305
+ margin: 0;
306
+ }
307
+ /* Loader in button */
308
+ [id^=sb_youtube_].sb_youtube .sby_footer .sby_loader,
309
+ [id^=sb_youtube_].sb_youtube .sby_item .sby_loader,
310
+ [id^=sb_youtube_].sb_youtube .sby_player_outer_wrap .sby_loader{
311
+ position: absolute;
312
+ margin-top: -11px;
313
+ background-color: #fff;
314
+ }
315
+ [id^=sb_youtube_].sb_youtube .sby_item.sby_player_loading,
316
+ [id^=sb_youtube_].sb_youtube .sby_player_outer_wrap.sby_player_loading {
317
+ opacity: .8;
318
+ }
319
+ @-webkit-keyframes sby-sk-scaleout {
320
+ 0% { -webkit-transform: scale(0) }
321
+ 100% {
322
+ -webkit-transform: scale(1.0);
323
+ opacity: 0;
324
+ }
325
+ }
326
+ @keyframes sby-sk-scaleout {
327
+ 0% {
328
+ -webkit-transform: scale(0);
329
+ -ms-transform: scale(0);
330
+ transform: scale(0);
331
+ } 100% {
332
+ -webkit-transform: scale(1.0);
333
+ -ms-transform: scale(1.0);
334
+ transform: scale(1.0);
335
+ opacity: 0;
336
+ }
337
+ }
338
+
339
+ [id^=sb_youtube_].sb_youtube .fa-spin,
340
+ #sby_lightbox .fa-spin{
341
+ -webkit-animation: fa-spin 2s infinite linear;
342
+ animation: fa-spin 2s infinite linear
343
+ }
344
+
345
+ [id^=sb_youtube_].sb_youtube .fa-pulse,
346
+ #sby_lightbox .fa-pulse{
347
+ -webkit-animation: fa-spin 1s infinite steps(8);
348
+ animation: fa-spin 1s infinite steps(8)
349
+ }
350
+
351
+ @-webkit-keyframes fa-spin {
352
+ 0% {
353
+ -webkit-transform: rotate(0deg);
354
+ transform: rotate(0deg)
355
+ }
356
+ 100% {
357
+ -webkit-transform: rotate(359deg);
358
+ transform: rotate(359deg)
359
+ }
360
+ }
361
+
362
+ @keyframes fa-spin {
363
+ 0% {
364
+ -webkit-transform: rotate(0deg);
365
+ transform: rotate(0deg)
366
+ }
367
+ 100% {
368
+ -webkit-transform: rotate(359deg);
369
+ transform: rotate(359deg)
370
+ }
371
+ }
372
+
373
+ /* HEADER */
374
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header{
375
+ float: left;
376
+ clear: both;
377
+ margin: 0 0 15px 0;
378
+ padding: 0;
379
+ line-height: 1.2;
380
+ width: 100%;
381
+ }
382
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header a{
383
+ float: left;
384
+ display: block;
385
+ /*width: 100%;*/
386
+ min-width: 100%\9;
387
+ text-decoration: none;
388
+ transition: color 0.5s ease;
389
+ }
390
+ /** Medium Header */
391
+ /* Only use medium & large headers on devices above 480px */
392
+ @media all and (min-width: 480px){
393
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_img {
394
+ width: 80px;
395
+ height: 80px;
396
+ border-radius: 40px;
397
+ }
398
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_img img {
399
+ width: 80px;
400
+ height: 80px;
401
+ border-radius: 40px;
402
+ }
403
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text h3 {
404
+ font-size: 20px;
405
+ }
406
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text .sby_bio_info,
407
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text .sby_bio{
408
+ font-size: 14px;
409
+ }
410
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text h3,
411
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text .sby_bio_info,
412
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text .sby_bio{
413
+ margin-left: 95px !important;
414
+ line-height: 1.4
415
+ }
416
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text h3{
417
+ margin-right: -85px !important;
418
+ }
419
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text .sby_bio_info{
420
+ margin-top: 4px !important;
421
+ }
422
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text.sby_no_bio h3{
423
+ padding-top: 20px !important;
424
+ }
425
+ /** Large Header */
426
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_img {
427
+ width: 120px;
428
+ height: 120px;
429
+ border-radius: 60px;
430
+ }
431
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_img img {
432
+ width: 120px;
433
+ height: 120px;
434
+ border-radius: 60px;
435
+ }
436
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text h3 {
437
+ font-size: 28px;
438
+ }
439
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text .sby_bio_info,
440
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text .sby_bio{
441
+ font-size: 16px;
442
+ }
443
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text h3,
444
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text .sby_bio_info,
445
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text .sby_bio{
446
+ margin-left: 140px !important;
447
+ line-height: 1.5;
448
+ }
449
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text h3{
450
+ margin-right: -120px !important;
451
+ }
452
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text .sby_bio_info{
453
+ margin-top: 12px !important;
454
+ }
455
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text.sby_no_bio h3{
456
+ padding-top: 32px !important;
457
+ }
458
+ }
459
+
460
+ /* Header profile pic */
461
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img{
462
+ float: left;
463
+ position: relative;
464
+ width: 50px;
465
+ margin: 0 0 0 -100% !important;
466
+ overflow: hidden;
467
+
468
+ -moz-border-radius: 40px;
469
+ -webkit-border-radius: 40px;
470
+ border-radius: 40px;
471
+ }
472
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img img{
473
+ float: left;
474
+ margin: 0 !important;
475
+ padding: 0 !important;
476
+ border: none !important;
477
+
478
+ -moz-border-radius: 40px;
479
+ -webkit-border-radius: 40px;
480
+ border-radius: 40px;
481
+ }
482
+ /* Profile pic hover */
483
+ /* Profile pic hover */
484
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img_hover{
485
+ opacity: 0;
486
+ position: absolute;
487
+ width: 100%;
488
+ top: 0;
489
+ bottom: 0;
490
+ left: 0;
491
+ text-align: center;
492
+ color: #fff;
493
+ background: rgba(0,0,0,0.75);
494
+ }
495
+
496
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img_hover .sby_new_logo{
497
+ position: absolute;
498
+ top: 50%;
499
+ left: 50%;
500
+ margin-top: -12px;
501
+ margin-left: -12px;
502
+ width: 24px;
503
+ height: 24px;
504
+ font-size: 24px;
505
+ }
506
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img_hover i {
507
+ overflow: hidden;
508
+ background: url('../img/small-logo.png') no-repeat 0 0;
509
+ }
510
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img_hover{
511
+ z-index: 2;
512
+ transition: opacity 0.4s ease-in-out;
513
+ }
514
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_fade_in{
515
+ opacity: 1;
516
+ transition: opacity 0.2s ease-in-out;
517
+ }
518
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img_hover{
519
+ position: absolute;
520
+ width: 100%;
521
+ top: 0;
522
+ bottom: 0;
523
+ left: 0;
524
+ text-align: center;
525
+ color: #fff;
526
+ background: rgba(0,0,0,0.75);
527
+
528
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
529
+ filter: alpha(opacity=0);
530
+ -moz-opacity: 0;
531
+ -khtml-opacity: 0;
532
+ opacity: 0;
533
+ border-radius: 40px;
534
+ transition: opacity 0.2s;
535
+ }
536
+ /* Fade the Youtube icon in when hovering on the header */
537
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header a:hover .sby_header_img_hover,
538
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header a:focus .sby_header_img_hover{
539
+ opacity: 1;
540
+ }
541
+ /* Header text */
542
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text{
543
+ float: left;
544
+ width: 100%;
545
+ padding-top: 5px;
546
+ }
547
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header a{
548
+ text-decoration: none;
549
+ }
550
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text .sby_bio,
551
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text h3{
552
+ float: left;
553
+ clear: both;
554
+ width: auto;
555
+ margin: 0 0 0 60px !important;
556
+ padding: 0 !important;
557
+ }
558
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header h3{
559
+ font-size: 16px;
560
+ line-height: 1.3;
561
+ }
562
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header p{
563
+ font-size: 13px;
564
+ line-height: 1.3;
565
+ margin: 0;
566
+ padding: 0;
567
+ }
568
+ [id^=sb_youtube_].sb_youtube p:empty { display: none; }
569
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text img.emoji{
570
+ margin-right: 3px !important;
571
+ }
572
+
573
+ /* No bio */
574
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text.sby_no_bio h3{
575
+ padding-top: 9px !important;
576
+ }
577
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text.sby_no_bio .sby_bio_info{
578
+ clear: both;
579
+ }
580
+
581
+ /* Buttons */
582
+ [id^=sb_youtube_].sb_youtube .sby_footer{
583
+ float: left;
584
+ clear: both;
585
+ width: 100%;
586
+ text-align: center;
587
+ }
588
+ [id^=sb_youtube_].sb_youtube .sby_footer .fa-spinner{
589
+ display: none;
590
+ position: absolute;
591
+ top: 50%;
592
+ left: 50%;
593
+ margin: -8px 0 0 -7px;
594
+ font-size: 15px;
595
+ }
596
+ [id^=sb_youtube_].sb_youtube .sby_footer{
597
+ opacity: 1;
598
+ transition: all 0.5s ease-in;
599
+ }
600
+ [id^=sb_youtube_].sb_youtube .sby_load_btn .sby_btn_text, [id^=sb_youtube_].sb_youtube .sby_load_btn .sby_loader{
601
+ opacity: 1;
602
+ transition: all 0.1s ease-in;
603
+ }
604
+ [id^=sb_youtube_].sb_youtube .sby_hidden{
605
+ opacity: 0 !important;
606
+ }
607
+ [id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn,
608
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn a{
609
+ display: -moz-inline-stack;
610
+ display: inline-block;
611
+ vertical-align: top;
612
+ zoom: 1;
613
+ *display: inline;
614
+
615
+ padding: 7px 14px;
616
+ margin: 5px auto 0 auto;
617
+ background: #333;
618
+ color: #eee;
619
+ border: none;
620
+ color: #fff;
621
+ text-decoration: none;
622
+ font-size: 13px;
623
+ line-height: 1.5;
624
+
625
+ -moz-border-radius: 4px;
626
+ -webkit-border-radius: 4px;
627
+ border-radius: 4px;
628
+
629
+ -webkit-box-sizing: border-box;
630
+ -moz-box-sizing: border-box;
631
+ box-sizing: border-box;
632
+ }
633
+ [id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn {
634
+ position: relative;
635
+ }
636
+ /* Follow button */
637
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn{
638
+ display: -moz-inline-stack;
639
+ display: inline-block;
640
+ vertical-align: top;
641
+ zoom: 1;
642
+ *display: inline;
643
+ text-align: center;
644
+ }
645
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn.sby_top{
646
+ display: block;
647
+ margin-bottom: 5px;
648
+ }
649
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn a{
650
+ background: #408bd1;
651
+ color: #fff;
652
+ }
653
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn a,
654
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn a,
655
+ [id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn{
656
+ transition: all 0.1s ease-in;
657
+ }
658
+ /* Hover state for default colors */
659
+ [id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn:hover{
660
+ outline: none;
661
+ box-shadow: inset 0 0 20px 20px rgba(255,255,255,0.25);
662
+ }
663
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn a:hover,
664
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn a:focus{
665
+ outline: none;
666
+ box-shadow: inset 0 0 10px 20px #359dff;
667
+ }
668
+ /* If a custom color is applied then just use opacity for the hover effect */
669
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn.sby_custom a:hover,
670
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn.sby_custom a:focus,
671
+ [id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn.sby_custom:hover{
672
+ box-shadow: inset 0 0 20px 20px rgba(255,255,255,0.15);
673
+ }
674
+ /* Active state */
675
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn a:active,
676
+ [id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn:active{
677
+ box-shadow: inset 0 0 10px 20px rgba(0,0,0,0.3);
678
+ }
679
+
680
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn .fa,
681
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn svg{
682
+ margin-bottom: -1px;
683
+ margin-right: 7px;
684
+ font-size: 15px;
685
+ }
686
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn svg{
687
+ vertical-align: -.125em;
688
+ }
689
+ [id^=sb_youtube_].sb_youtube .sby_footer .sby_follow_btn{
690
+ margin-left: 5px;
691
+ }
692
+
693
+ /* Media queries */
694
+ @media all and (max-width: 640px){
695
+ /* Make 3-6 cols into 2 col */
696
+ [id^=sb_youtube_].sb_youtube.sby_col_3.sby_mob_col_auto .sby_items_wrap .sby_item,
697
+ [id^=sb_youtube_].sb_youtube.sby_col_4.sby_mob_col_auto .sby_items_wrap .sby_item,
698
+ [id^=sb_youtube_].sb_youtube.sby_col_5.sby_mob_col_auto .sby_items_wrap .sby_item,
699
+ [id^=sb_youtube_].sb_youtube.sby_col_6.sby_mob_col_auto .sby_items_wrap .sby_item{
700
+ width: 50%;
701
+ }
702
+ /* Make 7-10 cols into 4 col */
703
+ [id^=sb_youtube_].sb_youtube.sby_col_7 .sby_items_wrap .sby_item,
704
+ [id^=sb_youtube_].sb_youtube.sby_col_8 .sby_items_wrap .sby_item,
705
+ [id^=sb_youtube_].sb_youtube.sby_col_9 .sby_items_wrap .sby_item,
706
+ [id^=sb_youtube_].sb_youtube.sby_col_10 .sby_items_wrap .sby_item,
707
+ [id^=sb_youtube_].sb_youtube.sby_col_7.sby_mob_col_auto .sby_items_wrap .sby_item,
708
+ [id^=sb_youtube_].sb_youtube.sby_col_8.sby_mob_col_auto .sby_items_wrap .sby_item,
709
+ [id^=sb_youtube_].sb_youtube.sby_col_9.sby_mob_col_auto .sby_items_wrap .sby_item,
710
+ [id^=sb_youtube_].sb_youtube.sby_col_10.sby_mob_col_auto .sby_items_wrap .sby_item{
711
+ width: 25%;
712
+ }
713
+ [id^=sb_youtube_].sb_youtube.sby_col_2 .sby_items_wrap .sby_item{ width: 50%; }
714
+ [id^=sb_youtube_].sb_youtube.sby_col_3 .sby_items_wrap .sby_item{ width: 33.33%; }
715
+ [id^=sb_youtube_].sb_youtube.sby_col_4 .sby_items_wrap .sby_item{ width: 25%; }
716
+ [id^=sb_youtube_].sb_youtube.sby_col_5 .sby_items_wrap .sby_item{ width: 20%; }
717
+ [id^=sb_youtube_].sb_youtube.sby_col_6 .sby_items_wrap .sby_item{ width: 16.66%; }
718
+ [id^=sb_youtube_].sb_youtube.sby_col_7 .sby_items_wrap .sby_item{ width: 14.28%; }
719
+ [id^=sb_youtube_].sb_youtube.sby_col_8 .sby_items_wrap .sby_item{ width: 12.5%; }
720
+ [id^=sb_youtube_].sb_youtube.sby_col_9 .sby_items_wrap .sby_item{ width: 11.11%; }
721
+ [id^=sb_youtube_].sb_youtube.sby_col_10 .sby_items_wrap .sby_item{ width: 10%; }
722
+ /* On mobile make the min-width 100% */
723
+ [id^=sb_youtube_].sb_youtube.sby_width_resp{
724
+ width: 100% !important;
725
+ }
726
+ }
727
+ @media all and (max-width: 480px){
728
+ /* Make all cols into 1 col */
729
+ [id^=sb_youtube_].sb_youtube.sby_col_3.sby_mob_col_auto .sby_items_wrap .sby_item,
730
+ [id^=sb_youtube_].sb_youtube.sby_col_4.sby_mob_col_auto .sby_items_wrap .sby_item,
731
+ [id^=sb_youtube_].sb_youtube.sby_col_5.sby_mob_col_auto .sby_items_wrap .sby_item,
732
+ [id^=sb_youtube_].sb_youtube.sby_col_6.sby_mob_col_auto .sby_items_wrap .sby_item,
733
+ [id^=sb_youtube_].sb_youtube.sby_col_7.sby_mob_col_auto .sby_items_wrap .sby_item,
734
+ [id^=sb_youtube_].sb_youtube.sby_col_8.sby_mob_col_auto .sby_items_wrap .sby_item,
735
+ [id^=sb_youtube_].sb_youtube.sby_col_9.sby_mob_col_auto .sby_items_wrap .sby_item,
736
+ [id^=sb_youtube_].sb_youtube.sby_col_10.sby_mob_col_auto .sby_items_wrap .sby_item,
737
+ [id^=sb_youtube_].sb_youtube.sby_mob_col_1 .sby_items_wrap .sby_item{
738
+ width: 100%;
739
+ }
740
+ [id^=sb_youtube_].sb_youtube.sby_mob_col_2 .sby_items_wrap .sby_item{ width: 50%; }
741
+ [id^=sb_youtube_].sb_youtube.sby_mob_col_3 .sby_items_wrap .sby_item{ width: 33.33%; }
742
+ [id^=sb_youtube_].sb_youtube.sby_mob_col_4 .sby_items_wrap .sby_item{ width: 25%; }
743
+ [id^=sb_youtube_].sb_youtube.sby_mob_col_5 .sby_items_wrap .sby_item{ width: 20%; }
744
+ [id^=sb_youtube_].sb_youtube.sby_mob_col_6 .sby_items_wrap .sby_item{ width: 16.66%; }
745
+ [id^=sb_youtube_].sb_youtube.sby_mob_col_7 .sby_items_wrap .sby_item{ width: 14.28%; }
746
+ }
747
+
748
+ /* --- Lightbox --- */
749
+
750
+ .sby_lightboxOverlay {
751
+ position: absolute;
752
+ top: 0;
753
+ left: 0;
754
+ z-index: 9999;
755
+ background-color: black;
756
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
757
+ opacity: 0.9;
758
+ display: none;
759
+ }
760
+ .sby_lightbox {
761
+ position: absolute;
762
+ left: 0;
763
+ width: 100%;
764
+ z-index: 10000;
765
+ text-align: center;
766
+ line-height: 0;
767
+ font-weight: normal;
768
+ }
769
+ .sby_lightbox .sby_lb-image {
770
+ display: block;
771
+ height: auto;
772
+ max-width: inherit;
773
+ -webkit-border-radius: 3px;
774
+ -moz-border-radius: 3px;
775
+ -ms-border-radius: 3px;
776
+ -o-border-radius: 3px;
777
+ border-radius: 3px;
778
+ }
779
+ .sby_lightbox a:hover,
780
+ .sby_lightbox a:focus,
781
+ .sby_lightbox a:active{
782
+ outline: none;
783
+ }
784
+ .sby_lightbox a img {
785
+ border: none;
786
+ }
787
+ .sby_lb-outerContainer {
788
+ position: relative;
789
+ background-color: #000;
790
+ *zoom: 1;
791
+ width: 250px;
792
+ height: 250px;
793
+ margin: 0 auto 5px auto;
794
+ -webkit-border-radius: 3px;
795
+ -moz-border-radius: 3px;
796
+ -ms-border-radius: 3px;
797
+ -o-border-radius: 3px;
798
+ border-radius: 3px;
799
+ }
800
+ .sby_lb-outerContainer:after {
801
+ content: "";
802
+ display: table;
803
+ clear: both;
804
+ }
805
+ .sby_lb-container {
806
+ position: relative;
807
+ padding: 4px;
808
+ top: 0;
809
+ left: 0;
810
+ width: 100%;
811
+ height: 100%;
812
+ bottom: 0;
813
+ right: 0;
814
+ overflow: hidden;
815
+
816
+ -webkit-border-radius: 3px;
817
+ -moz-border-radius: 3px;
818
+ -ms-border-radius: 3px;
819
+ -o-border-radius: 3px;
820
+ border-radius: 3px;
821
+ }
822
+ .sby_lb-loader {
823
+ position: absolute;
824
+ top: 43%;
825
+ left: 0;
826
+ height: 25%;
827
+ width: 100%;
828
+ text-align: center;
829
+ line-height: 0;
830
+ }
831
+ .sby_lb-cancel {
832
+ display: block;
833
+ width: 32px;
834
+ height: 32px;
835
+ margin: 0 auto;
836
+ background-color: #666;
837
+ background-color: rgba(255,255,255,0.5);
838
+
839
+ border-radius: 100%;
840
+ -webkit-animation: ctf-sk-scaleout 1.0s infinite ease-in-out;
841
+ animation: ctf-sk-scaleout 1.0s infinite ease-in-out;
842
+ }
843
+
844
+
845
+ .sby_lb-nav {
846
+ /*position: absolute;*/
847
+ top: 0;
848
+ left: 0;
849
+ /*height: 100%;*/
850
+ width: 100%;
851
+ z-index: 10;
852
+ /*pointer-events: none;*/
853
+ }
854
+ .sby_lb-container > .nav {
855
+ left: 0;
856
+ }
857
+ .sby_lb-nav a {
858
+ position: absolute;
859
+ z-index: 100;
860
+ top: 0;
861
+ height: 90%;
862
+ outline: none;
863
+ }
864
+ .sby_lb-prev, .sby_lb-next {
865
+ height: 100%;
866
+ cursor: pointer;
867
+ display: block;
868
+ }
869
+ .sby_lb-nav a.sby_lb-prev {
870
+ width: 30%;
871
+ left: 0;
872
+ float: left;
873
+ background: url(../img/prev.png) left 52% no-repeat;
874
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
875
+ opacity: 0;
876
+ -webkit-transition: opacity 0.6s;
877
+ -moz-transition: opacity 0.6s;
878
+ -o-transition: opacity 0.6s;
879
+ transition: opacity 0.6s;
880
+ }
881
+ .ctf-audio-iframe .sby_lb-nav a.sby_lb-prev{
882
+ max-width: 100px;
883
+ height: 80%;
884
+ margin-top: 10%;
885
+ background: url(../img/prev.png) left 0 top 35% no-repeat;
886
+ }
887
+ .sby_lb-nav a.sby_lb-prev:hover {
888
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
889
+ opacity: 1;
890
+ }
891
+ .sby_lb-nav a.sby_lb-next {
892
+ width: 30%;
893
+ right: 0;
894
+ float: right;
895
+ background: url(../img/next.png) right 52% no-repeat;
896
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
897
+ opacity: 0;
898
+ -webkit-transition: opacity 0.6s;
899
+ -moz-transition: opacity 0.6s;
900
+ -o-transition: opacity 0.6s;
901
+ transition: opacity 0.6s;
902
+ }
903
+ .sby_lb-nav a.sby_lb-next:hover {
904
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
905
+ opacity: 1;
906
+ }
907
+ .sby_lb-dataContainer {
908
+ margin: 0 auto;
909
+ padding-top: 5px;
910
+ *zoom: 1;
911
+ width: 100%;
912
+ font-family: "Open Sans", Helvetica, Arial, sans-serif;
913
+
914
+ -moz-border-radius-bottomleft: 4px;
915
+ -webkit-border-bottom-left-radius: 4px;
916
+ border-bottom-left-radius: 4px;
917
+ -moz-border-radius-bottomright: 4px;
918
+ -webkit-border-bottom-right-radius: 4px;
919
+ border-bottom-right-radius: 4px;
920
+ }
921
+ .sby_lb-dataContainer:after {
922
+ content: "";
923
+ display: table;
924
+ clear: both;
925
+ }
926
+ .sby_lb-data {
927
+ padding: 0 4px;
928
+ color: #ccc;
929
+ }
930
+ .sby_lb-data .sby_lb-details {
931
+ width: 85%;
932
+ float: left;
933
+ text-align: left;
934
+ line-height: 1.1;
935
+ }
936
+ .sby_lb-data .sby_lb-caption {
937
+ float: left;
938
+ font-size: 13px;
939
+ font-weight: normal;
940
+ line-height: 1.3;
941
+ padding-bottom: 3px;
942
+ color: #ccc;
943
+
944
+ word-wrap: break-word;
945
+ -webkit-hyphens: auto;
946
+ -moz-hyphens: auto;
947
+ hyphens: auto;
948
+ }
949
+ .sby_lb-data .sby_lb-caption a,
950
+ .sby_lb-data .sby_lb-caption .ctf-screename-sep{
951
+ color: #ccc;
952
+ font-weight: bold;
953
+ text-decoration: none;
954
+ }
955
+ .sby_lb-data .sby_lb-caption a:hover{
956
+ color: #fff;
957
+ text-decoration: underline;
958
+ }
959
+ .sby_lb-data .sby_lb-caption .sby_lightbox_username{
960
+ float: left;
961
+ width: 100%;
962
+ color: #ccc;
963
+ padding-bottom: 0;
964
+ display: block;
965
+ margin: 0 0 5px 0;
966
+ }
967
+ .sby_lb-data .sby_lb-caption .sby_lightbox_username{
968
+ color: #ccc;
969
+ }
970
+ .sby_lb-data .sby_lb-caption .sby_lightbox_username:hover p{
971
+ color: #fff;
972
+ text-decoration: underline;
973
+ }
974
+ .sby_lightbox .sby_lightbox_username img {
975
+ float: left;
976
+ border: none;
977
+ width: 48px;
978
+ height: 48px;
979
+ margin-right: 10px;
980
+ background: #666;
981
+
982
+ -moz-border-radius: 5px;
983
+ -webkit-border-radius: 5px;
984
+ border-radius: 5px;
985
+ }
986
+ .sby_lightbox_username p{
987
+ float: left;
988
+ margin: 0;
989
+ padding: 0;
990
+ color: #ccc;
991
+ line-height: 32px;
992
+ font-weight: bold;
993
+ font-size: 13px;
994
+ text-align: left;
995
+ }
996
+
997
+ .sby_lb-data .ctf-caption-text{
998
+ width: 100%;
999
+ margin-left: 58px;
1000
+ padding-top: 3px;
1001
+ }
1002
+ .sby_lb-data .sby_lb-caption .ctf-tweet-date,
1003
+ .sby_lb-data .sby_lb-caption .ctf-author-screenname{
1004
+ font-weight: normal;
1005
+ }
1006
+ .sby_lb-data .sby_lb-info{
1007
+ width: 100%;
1008
+ float: left;
1009
+ clear: both;
1010
+ }
1011
+ .sby_lb-data .sby_lb-number {
1012
+ display: block;
1013
+ float: left;
1014
+ clear: both;
1015
+ padding: 5px 0 15px 0;
1016
+ font-size: 12px;
1017
+ color: #999999;
1018
+ }
1019
+ .sby_lb-data .sby_lb-close {
1020
+ display: block;
1021
+ float: right;
1022
+ width: 30px;
1023
+ height: 30px;
1024
+ background: url(../img/close.png) top right no-repeat;
1025
+ text-align: right;
1026
+ outline: none;
1027
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70);
1028
+ opacity: 0.7;
1029
+ -webkit-transition: opacity 0.2s;
1030
+ -moz-transition: opacity 0.2s;
1031
+ -o-transition: opacity 0.2s;
1032
+ transition: opacity 0.2s;
1033
+ }
1034
+ .sby_lb-data .sby_lb-close:hover {
1035
+ cursor: pointer;
1036
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
1037
+ opacity: 1;
1038
+ }
1039
+
1040
+ /* Lightbox video - must go after lighbox CSS */
1041
+ /* Leave a gap at the bottom of the nav for video controls */
1042
+ .sby_lb-nav {
1043
+ height: auto;
1044
+ }
1045
+ /* Remove 4px padding from lightbox container so video lines up */
1046
+ .sby_lb-container{
1047
+ padding: 0;
1048
+ }
1049
+ .sby_lb-container iframe {
1050
+ position: absolute;
1051
+ top: 0;
1052
+ left:0;
1053
+ width: 100%;
1054
+ height: 100%;
1055
+ z-index: 1;
1056
+ }
1057
+ /* Lightbox action links */
1058
+ #sby_lightbox .sby_lightbox_action{
1059
+ float: left;
1060
+ /*clear: both;*/
1061
+ position: relative;
1062
+ padding: 0 0 0 10px;
1063
+ margin: 5px 0 0 10px;
1064
+ border-left: 1px solid #666;
1065
+ font-size: 12px;
1066
+ }
1067
+ #sby_lightbox .sby_lightbox_action a{
1068
+ display: block;
1069
+ float: left;
1070
+ color: #999;
1071
+ text-decoration: none;
1072
+ }
1073
+ #sby_lightbox .sby_lightbox_action a:hover,
1074
+ #sby_lightbox .sby_lightbox_action a:focus{
1075
+ color: #fff;
1076
+ }
1077
+ #sby_lightbox .sby_lightbox_action .fa,
1078
+ #sby_lightbox .sby_lightbox_action svg {
1079
+ margin-right: 5px;
1080
+ }
1081
+ #sby_lightbox .sby_lightbox_action.sby_youtube .fa {
1082
+ font-size: 13px;
1083
+ }
1084
+ #sby_lightbox .sby_tooltip_social a svg {
1085
+ font-size: 19px;
1086
+ padding: 3px 4px;
1087
+ margin: auto;
1088
+ }
1089
+ /* Lightbox tooltip */
1090
+ #sby_lightbox .sby_lightbox_tooltip{
1091
+ display: none;
1092
+ position: absolute;
1093
+ width: 100px;
1094
+ bottom: 22px;
1095
+ left: 0;
1096
+ padding: 5px 10px;
1097
+ margin: 0;
1098
+ background: rgba(255,255,255,0.9);
1099
+ color: #222;
1100
+ font-size: 12px;
1101
+ line-height: 1.3;
1102
+
1103
+ -moz-border-radius: 4px;
1104
+ -webkit-border-radius: 4px;
1105
+ border-radius: 4px;
1106
+
1107
+ box-shadow: 0 0 10px rgba(0,0,0,0.4);
1108
+ -moz-box-shadow: 0 0 10px rgba(0,0,0,0.4);
1109
+ -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.4);
1110
+
1111
+ -webkit-box-sizing: border-box;
1112
+ -moz-box-sizing: border-box;
1113
+ box-sizing: border-box;
1114
+ }
1115
+ #sby_lightbox .sby_lightbox_tooltip .fa-play{
1116
+ position: absolute;
1117
+ font-size: 8px;
1118
+ bottom: -6px;
1119
+ left: 36px;
1120
+ color: rgba(255,255,255,0.9);
1121
+ }
1122
+ #sby_lightbox .sby_tooltip_social a .fa{
1123
+ font-size: 16px;
1124
+ margin: 0;
1125
+ padding: 5px;
1126
+ }
1127
+ #sby_lightbox .sby_tooltip_social a#sby_facebook_icon .fa,
1128
+ #sby_lightbox .sby_tooltip_social a#sby_twitter_icon .fa,
1129
+ #sby_lightbox .sby_tooltip_social a#sby_pinterest_icon .fa{
1130
+ padding-top: 4px;
1131
+ font-size: 18px;
1132
+ }
1133
+
1134
+ /* Hide photos tooltip */
1135
+ #sby_lightbox #sby_mod_box{
1136
+ width: 280px;
1137
+ padding: 5px 10px 7px 10px;
1138
+ }
1139
+ /* Social icons tooltip */
1140
+ #sby_lightbox .sby_tooltip_social{
1141
+ width: 172px;
1142
+ padding: 5px 5px 4px 5px;
1143
+ }
1144
+ #sby_lightbox .sby_tooltip_social a{
1145
+ color: #333;
1146
+
1147
+ -moz-border-radius: 4px;
1148
+ -webkit-border-radius: 4px;
1149
+ border-radius: 4px;
1150
+ }
1151
+ #sby_lightbox .sby_lightbox_action #sby_facebook_icon:hover{ background: #3b5998; }
1152
+ #sby_lightbox .sby_lightbox_action #sby_twitter_icon:hover{ background: #00aced; }
1153
+ #sby_lightbox .sby_lightbox_action #sby_google_icon:hover{ background: #dd4b39; }
1154
+ #sby_lightbox .sby_lightbox_action #sby_linkedin_icon:hover{ background: #007bb6; }
1155
+ #sby_lightbox .sby_lightbox_action #sby_pinterest_icon:hover{ background: #cb2027; }
1156
+ #sby_lightbox .sby_lightbox_action #sby_email_icon:hover{ background: #333; }
1157
+
1158
+ .sby_lb-outerContainer, .sby_lb-dataContainer{
1159
+ min-width: 450px;
1160
+ }
1161
+ @media all and (max-width: 450px){
1162
+ .sby_lb-outerContainer, .sby_lb-dataContainer {
1163
+ min-width: 0; /* Remove min-width on lightbox on mobile */
1164
+ }
1165
+ }
1166
+ .sby_lightbox .sby_lb-image {
1167
+ display: block;
1168
+ height: auto;
1169
+ max-width: inherit;
1170
+ margin: 0 auto;
1171
+ -webkit-border-radius: 0;
1172
+ -moz-border-radius: 0;
1173
+ -ms-border-radius: 0;
1174
+ -o-border-radius: 0;
1175
+ border-radius: 0;
1176
+ }
1177
+
1178
+ /* Mod only error msgs */
1179
+ #sby_mod_error{
1180
+ display: none;
1181
+ border: 1px solid #ddd;
1182
+ background: #eee;
1183
+ color: #333;
1184
+ margin: 10px 0 0;
1185
+ padding: 10px 15px;
1186
+ font-size: 13px;
1187
+ text-align: center;
1188
+ clear: both;
1189
+
1190
+ -moz-border-radius: 4px;
1191
+ -webkit-border-radius: 4px;
1192
+ border-radius: 4px;
1193
+ }
1194
+ #sby_mod_error p{
1195
+ padding: 5px 0 !important;
1196
+ margin: 0 !important;
1197
+ line-height: 1.3 !important;
1198
+ }
1199
+ #sby_mod_error ol,
1200
+ #sby_mod_error ul{
1201
+ padding: 5px 0 5px 20px !important;
1202
+ margin: 0 !important;
1203
+ }
1204
+ #sby_mod_error li{
1205
+ padding: 1px 0 !important;
1206
+ margin: 0 !important;
1207
+ }
1208
+ #sby_mod_error span{
1209
+ font-size: 12px;
1210
+ }
1211
+
1212
+ /* SVGs */
1213
+ [id^=sb_youtube_].sb_youtube svg:not(:root).svg-inline--fa,
1214
+ [id^=sb_youtube_].sb_youtube_lightbox svg:not(:root).svg-inline--fa{
1215
+ box-sizing: unset;
1216
+ overflow: visible;
1217
+ width: 1em;
1218
+ }
1219
+ [id^=sb_youtube_].sb_youtube .svg-inline--fa.fa-w-16,
1220
+ [id^=sb_youtube_].sb_youtube .svg-inline--fa.fa-w-16{
1221
+ width: 16px;
1222
+ }
1223
+ [id^=sb_youtube_].sb_youtube .svg-inline--fa,
1224
+ [id^=sb_youtube_].sb_youtube_lightbox .svg-inline--fa{
1225
+ display: inline-block;
1226
+ font-size: inherit;
1227
+ height: 1em;
1228
+ overflow: visible;
1229
+ vertical-align: -.125em;
1230
+ }
css/sb-youtube.min.css ADDED
@@ -0,0 +1 @@
 
1
+ [id^=sb_youtube_].sb_youtube{width:100%;margin:0 auto;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}[id^=sb_youtube_].sb_youtube:after{content:"";display:table;clear:both}[id^=sb_youtube_].sb_youtube.sby_fixed_height{overflow:hidden;overflow-y:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}[id^=sb_youtube_].sb_youtube .sby_items_wrap{width:100%;float:left;line-height:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}[id^=sb_youtube_].sb_youtube .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube .sby_player_outer_wrap .sby_video_thumbnail_wrap,[id^=sb_youtube_].sb_youtube .sby_player_wrap{display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1;max-height:1000px;padding:inherit!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}[id^=sb_youtube_].sb_youtube .sby_items_wrap .sby_item.sby_no_margin{margin:0!important}[id^=sb_youtube_].sb_youtube .sby_items_wrap .sby_item{float:left}[id^=sb_youtube_].sb_youtube .sby_items_wrap .sby_item.sby_transition{opacity:0;max-height:0}[id^=sb_youtube_].sb_youtube.sby_col_0 .sby_items_wrap .sby_item{width:100%}[id^=sb_youtube_].sb_youtube.sby_col_1 .sby_items_wrap .sby_item{width:100%}[id^=sb_youtube_].sb_youtube.sby_col_2 .sby_items_wrap .sby_item{width:50%}[id^=sb_youtube_].sb_youtube.sby_col_3 .sby_items_wrap .sby_item{width:33.33%}[id^=sb_youtube_].sb_youtube.sby_col_4 .sby_items_wrap .sby_item{width:25%}[id^=sb_youtube_].sb_youtube.sby_col_5 .sby_items_wrap .sby_item{width:20%}[id^=sb_youtube_].sb_youtube.sby_col_6 .sby_items_wrap .sby_item{width:16.66%}[id^=sb_youtube_].sb_youtube.sby_col_7 .sby_items_wrap .sby_item{width:14.28%}[id^=sb_youtube_].sb_youtube.sby_col_8 .sby_items_wrap .sby_item{width:12.5%}[id^=sb_youtube_].sb_youtube.sby_col_9 .sby_items_wrap .sby_item{width:11.11%}[id^=sb_youtube_].sb_youtube.sby_col_10 .sby_items_wrap .sby_item{width:10%}.sby-screenreader{text-indent:-9999px!important;display:block!important;width:0!important;height:0!important;line-height:0!important}[id^=sb_youtube_].sb_youtube .sby_player_outer_wrap,[id^=sb_youtube_].sb_youtube .sby_video_thumbnail_wrap{width:100%;position:relative;float:left}[id^=sb_youtube_].sb_youtube .sby_video_thumbnail{display:block;position:relative;text-decoration:none;line-height:0;z-index:5}[id^=sb_youtube_].sb_youtube .sby_video_thumbnail img{width:100%;height:auto;border-radius:0}[id^=sb_youtube_].sb_youtube .sby_link{display:none;position:absolute;z-index:1;top:0;right:0;bottom:0;left:0;width:100%;padding:0;background:#333;background:rgba(0,0,0,.6);text-align:center;color:#fff;font-size:12px;line-height:1.1;overflow:hidden}[id^=sb_youtube_].sb_youtube .sby_link.sby_default a,[id^=sb_youtube_].sb_youtube .sby_link.sby_default p,[id^=sb_youtube_].sb_youtube .sby_link.sby_default span{text-shadow:0 0 10px #000}[id^=sb_youtube_].sb_youtube .sby_link .sby_hover_bottom,[id^=sb_youtube_].sb_youtube .sby_link .sby_lightbox_link,[id^=sb_youtube_].sb_youtube .sby_link .sby_playbtn,[id^=sb_youtube_].sb_youtube .sby_link .sby_username a,[id^=sb_youtube_].sb_youtube .sby_link .sby_youtube_link,[id^=sb_youtube_].sb_youtube .sby_link .svg-inline--fa.fa-play{opacity:.9}[id^=sb_youtube_].sb_youtube .sby_link .sby_lightbox_link:hover,[id^=sb_youtube_].sb_youtube .sby_link .sby_playbtn:hover,[id^=sb_youtube_].sb_youtube .sby_link .sby_username a:hover,[id^=sb_youtube_].sb_youtube .sby_link .sby_youtube_link:hover,[id^=sb_youtube_].sb_youtube .sby_link .svg-inline--fa.fa-play:hover{opacity:1}[id^=sb_youtube_].sb_youtube .sby_link_area{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1}[id^=sb_youtube_].sb_youtube .sby_link a{padding:0;text-decoration:none;color:#ddd;color:rgba(255,255,255,.7);line-height:1.1;background:0 0;display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1}[id^=sb_youtube_].sb_youtube .sby_link a:active,[id^=sb_youtube_].sb_youtube .sby_link a:hover{color:#fff}[id^=sb_youtube_].sb_youtube .sby_link .sby_lightbox_link{display:block;position:absolute;z-index:2;top:50%;left:50%;margin-top:-24px;margin-left:-21px;padding:0;font-size:49px;font-style:normal!important}[id^=sb_youtube_].sb_youtube .sby_carousel_vid_first .sby_lightbox_link,[id^=sb_youtube_].sb_youtube .sby_type_video .sby_lightbox_link{display:none}[id^=sb_youtube_].sb_youtube .sby_link .sby_youtube_link{font-size:30px;position:absolute;z-index:100;bottom:0;right:2px;padding:8px}[id^=sb_youtube_].sb_youtube .sby_link a:focus,[id^=sb_youtube_].sb_youtube .sby_link a:hover{text-decoration:underline}[id^=sb_youtube_].sb_youtube .sby_player_wrap{z-index:1;width:100%!important;height:100%!important;position:absolute;top:0;left:0}[id^=sb_youtube_].sb_youtube .sby_player_wrap iframe{width:100%!important;height:100%!important}[id^=sb_youtube_].sb_youtube .sby_thumbail_hover{opacity:0;display:block;position:absolute;top:0;right:0;bottom:0;left:0;z-index:10;color:#fff;background:#333;background:rgba(0,0,0,.6);transition:opacity .6s ease-in-out;-moz-transition:opacity .6s ease-in-out;-webkit-transition:opacity .6s ease-in-out}[id^=sb_youtube_].sb_youtube.sby_layout_list .sby_thumbail_hover{display:none}.sby_video_title{display:inline-block;height:100%;padding:10px;overflow:hidden;font-size:13px;line-height:1.2}[id^=sb_youtube_].sb_youtube .sby_video_thumbnail:hover .sby_thumbail_hover{opacity:1;display:block;transition:opacity .2s ease-in-out;-moz-transition:opacity .2s ease-in-out;-webkit-transition:opacity .2s ease-in-out}[id^=sb_youtube_].sb_youtube.sby_layout_list .sby_video_thumbnail:hover .sby_thumbail_hover{opacity:0;display:none;transition:none;-moz-transition:none;-webkit-transition:none}[id^=sb_youtube_].sb_youtube .sby_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:sby-sk-scaleout 1s infinite ease-in-out;animation:sby-sk-scaleout 1s infinite ease-in-out}[id^=sb_youtube_].sb_youtube br{display:none}.sby_footer p{display:inline;padding:0;margin:0}[id^=sb_youtube_].sb_youtube .sby_footer .sby_loader,[id^=sb_youtube_].sb_youtube .sby_item .sby_loader,[id^=sb_youtube_].sb_youtube .sby_player_outer_wrap .sby_loader{position:absolute;margin-top:-11px;background-color:#fff}[id^=sb_youtube_].sb_youtube .sby_item.sby_player_loading,[id^=sb_youtube_].sb_youtube .sby_player_outer_wrap.sby_player_loading{opacity:.8}@-webkit-keyframes sby-sk-scaleout{0%{-webkit-transform:scale(0)}100%{-webkit-transform:scale(1);opacity:0}}@keyframes sby-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}}#sby_lightbox .fa-spin,[id^=sb_youtube_].sb_youtube .fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}#sby_lightbox .fa-pulse,[id^=sb_youtube_].sb_youtube .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)}}[id^=sb_youtube_].sb_youtube .sb_youtube_header{float:left;clear:both;margin:0 0 15px 0;padding:0;line-height:1.2;width:100%}[id^=sb_youtube_].sb_youtube .sb_youtube_header a{float:left;display:block;text-decoration:none;transition:color .5s ease}@media all and (min-width:480px){[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_img{width:80px;height:80px;border-radius:40px}[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_img img{width:80px;height:80px;border-radius:40px}[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text h3{font-size:20px}[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text .sby_bio,[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text .sby_bio_info{font-size:14px}[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text .sby_bio,[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text .sby_bio_info,[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text h3{margin-left:95px!important;line-height:1.4}[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text h3{margin-right:-85px!important}[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text .sby_bio_info{margin-top:4px!important}[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text.sby_no_bio h3{padding-top:20px!important}[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_img{width:120px;height:120px;border-radius:60px}[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_img img{width:120px;height:120px;border-radius:60px}[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text h3{font-size:28px}[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text .sby_bio,[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text .sby_bio_info{font-size:16px}[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text .sby_bio,[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text .sby_bio_info,[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text h3{margin-left:140px!important;line-height:1.5}[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text h3{margin-right:-120px!important}[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text .sby_bio_info{margin-top:12px!important}[id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text.sby_no_bio h3{padding-top:32px!important}}[id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_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}[id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_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}[id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_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)}[id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img_hover .sby_new_logo{position:absolute;top:50%;left:50%;margin-top:-12px;margin-left:-12px;width:24px;height:24px;font-size:24px}[id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img_hover i{overflow:hidden;background:url(../img/small-logo.png) no-repeat 0 0}[id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img_hover{z-index:2;transition:opacity .4s ease-in-out}[id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_fade_in{opacity:1;transition:opacity .2s ease-in-out}[id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_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}[id^=sb_youtube_].sb_youtube .sb_youtube_header a:focus .sby_header_img_hover,[id^=sb_youtube_].sb_youtube .sb_youtube_header a:hover .sby_header_img_hover{opacity:1}[id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text{float:left;width:100%;padding-top:5px}[id^=sb_youtube_].sb_youtube .sb_youtube_header a{text-decoration:none}[id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text .sby_bio,[id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text h3{float:left;clear:both;width:auto;margin:0 0 0 60px!important;padding:0!important}[id^=sb_youtube_].sb_youtube .sb_youtube_header h3{font-size:16px;line-height:1.3}[id^=sb_youtube_].sb_youtube .sb_youtube_header p{font-size:13px;line-height:1.3;margin:0;padding:0}[id^=sb_youtube_].sb_youtube p:empty{display:none}[id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text img.emoji{margin-right:3px!important}[id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text.sby_no_bio h3{padding-top:9px!important}[id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text.sby_no_bio .sby_bio_info{clear:both}[id^=sb_youtube_].sb_youtube .sby_footer{float:left;clear:both;width:100%;text-align:center}[id^=sb_youtube_].sb_youtube .sby_footer .fa-spinner{display:none;position:absolute;top:50%;left:50%;margin:-8px 0 0 -7px;font-size:15px}[id^=sb_youtube_].sb_youtube .sby_footer{opacity:1;transition:all .5s ease-in}[id^=sb_youtube_].sb_youtube .sby_load_btn .sby_btn_text,[id^=sb_youtube_].sb_youtube .sby_load_btn .sby_loader{opacity:1;transition:all .1s ease-in}[id^=sb_youtube_].sb_youtube .sby_hidden{opacity:0!important}[id^=sb_youtube_].sb_youtube .sby_follow_btn a,[id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn{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}[id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn{position:relative}[id^=sb_youtube_].sb_youtube .sby_follow_btn{display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1;text-align:center}[id^=sb_youtube_].sb_youtube .sby_follow_btn.sby_top{display:block;margin-bottom:5px}[id^=sb_youtube_].sb_youtube .sby_follow_btn a{background:#408bd1;color:#fff}[id^=sb_youtube_].sb_youtube .sby_follow_btn a,[id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn{transition:all .1s ease-in}[id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn:hover{outline:0;box-shadow:inset 0 0 20px 20px rgba(255,255,255,.25)}[id^=sb_youtube_].sb_youtube .sby_follow_btn a:focus,[id^=sb_youtube_].sb_youtube .sby_follow_btn a:hover{outline:0;box-shadow:inset 0 0 10px 20px #359dff}[id^=sb_youtube_].sb_youtube .sby_follow_btn.sby_custom a:focus,[id^=sb_youtube_].sb_youtube .sby_follow_btn.sby_custom a:hover,[id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn.sby_custom:hover{box-shadow:inset 0 0 20px 20px rgba(255,255,255,.15)}[id^=sb_youtube_].sb_youtube .sby_follow_btn a:active,[id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn:active{box-shadow:inset 0 0 10px 20px rgba(0,0,0,.3)}[id^=sb_youtube_].sb_youtube .sby_follow_btn .fa,[id^=sb_youtube_].sb_youtube .sby_follow_btn svg{margin-bottom:-1px;margin-right:7px;font-size:15px}[id^=sb_youtube_].sb_youtube .sby_follow_btn svg{vertical-align:-.125em}[id^=sb_youtube_].sb_youtube .sby_footer .sby_follow_btn{margin-left:5px}@media all and (max-width:640px){[id^=sb_youtube_].sb_youtube.sby_col_3.sby_mob_col_auto .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_4.sby_mob_col_auto .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_5.sby_mob_col_auto .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_6.sby_mob_col_auto .sby_items_wrap .sby_item{width:50%}[id^=sb_youtube_].sb_youtube.sby_col_10 .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_10.sby_mob_col_auto .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_7 .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_7.sby_mob_col_auto .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_8 .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_8.sby_mob_col_auto .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_9 .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_9.sby_mob_col_auto .sby_items_wrap .sby_item{width:25%}[id^=sb_youtube_].sb_youtube.sby_col_2 .sby_items_wrap .sby_item{width:50%}[id^=sb_youtube_].sb_youtube.sby_col_3 .sby_items_wrap .sby_item{width:33.33%}[id^=sb_youtube_].sb_youtube.sby_col_4 .sby_items_wrap .sby_item{width:25%}[id^=sb_youtube_].sb_youtube.sby_col_5 .sby_items_wrap .sby_item{width:20%}[id^=sb_youtube_].sb_youtube.sby_col_6 .sby_items_wrap .sby_item{width:16.66%}[id^=sb_youtube_].sb_youtube.sby_col_7 .sby_items_wrap .sby_item{width:14.28%}[id^=sb_youtube_].sb_youtube.sby_col_8 .sby_items_wrap .sby_item{width:12.5%}[id^=sb_youtube_].sb_youtube.sby_col_9 .sby_items_wrap .sby_item{width:11.11%}[id^=sb_youtube_].sb_youtube.sby_col_10 .sby_items_wrap .sby_item{width:10%}[id^=sb_youtube_].sb_youtube.sby_width_resp{width:100%!important}}@media all and (max-width:480px){[id^=sb_youtube_].sb_youtube.sby_col_10.sby_mob_col_auto .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_3.sby_mob_col_auto .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_4.sby_mob_col_auto .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_5.sby_mob_col_auto .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_6.sby_mob_col_auto .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_7.sby_mob_col_auto .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_8.sby_mob_col_auto .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_col_9.sby_mob_col_auto .sby_items_wrap .sby_item,[id^=sb_youtube_].sb_youtube.sby_mob_col_1 .sby_items_wrap .sby_item{width:100%}[id^=sb_youtube_].sb_youtube.sby_mob_col_2 .sby_items_wrap .sby_item{width:50%}[id^=sb_youtube_].sb_youtube.sby_mob_col_3 .sby_items_wrap .sby_item{width:33.33%}[id^=sb_youtube_].sb_youtube.sby_mob_col_4 .sby_items_wrap .sby_item{width:25%}[id^=sb_youtube_].sb_youtube.sby_mob_col_5 .sby_items_wrap .sby_item{width:20%}[id^=sb_youtube_].sb_youtube.sby_mob_col_6 .sby_items_wrap .sby_item{width:16.66%}[id^=sb_youtube_].sb_youtube.sby_mob_col_7 .sby_items_wrap .sby_item{width:14.28%}}.sby_lightboxOverlay{position:absolute;top:0;left:0;z-index:9999;background-color:#000;opacity:.9;display:none}.sby_lightbox{position:absolute;left:0;width:100%;z-index:10000;text-align:center;line-height:0;font-weight:400}.sby_lightbox .sby_lb-image{display:block;height:auto;max-width:inherit;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;-o-border-radius:3px;border-radius:3px}.sby_lightbox a:active,.sby_lightbox a:focus,.sby_lightbox a:hover{outline:0}.sby_lightbox a img{border:none}.sby_lb-outerContainer{position:relative;background-color:#000;width:250px;height:250px;margin:0 auto 5px auto;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;-o-border-radius:3px;border-radius:3px}.sby_lb-outerContainer:after{content:"";display:table;clear:both}.sby_lb-container{position:relative;padding:4px;top:0;left:0;width:100%;height:100%;bottom:0;right:0;overflow:hidden;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;-o-border-radius:3px;border-radius:3px}.sby_lb-loader{position:absolute;top:43%;left:0;height:25%;width:100%;text-align:center;line-height:0}.sby_lb-cancel{display:block;width:32px;height:32px;margin:0 auto;background-color:#666;background-color:rgba(255,255,255,.5);border-radius:100%;-webkit-animation:ctf-sk-scaleout 1s infinite ease-in-out;animation:ctf-sk-scaleout 1s infinite ease-in-out}.sby_lb-nav{top:0;left:0;width:100%;z-index:10}.sby_lb-container>.nav{left:0}.sby_lb-nav a{position:absolute;z-index:100;top:0;height:90%;outline:0}.sby_lb-next,.sby_lb-prev{height:100%;cursor:pointer;display:block}.sby_lb-nav a.sby_lb-prev{width:30%;left:0;float:left;background:url(../img/prev.png) left 52% no-repeat;opacity:0;-webkit-transition:opacity .6s;-moz-transition:opacity .6s;-o-transition:opacity .6s;transition:opacity .6s}.ctf-audio-iframe .sby_lb-nav a.sby_lb-prev{max-width:100px;height:80%;margin-top:10%;background:url(../img/prev.png) left 0 top 35% no-repeat}.sby_lb-nav a.sby_lb-prev:hover{opacity:1}.sby_lb-nav a.sby_lb-next{width:30%;right:0;float:right;background:url(../img/next.png) right 52% no-repeat;opacity:0;-webkit-transition:opacity .6s;-moz-transition:opacity .6s;-o-transition:opacity .6s;transition:opacity .6s}.sby_lb-nav a.sby_lb-next:hover{opacity:1}.sby_lb-dataContainer{margin:0 auto;padding-top:5px;width:100%;font-family:"Open Sans",Helvetica,Arial,sans-serif;-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px}.sby_lb-dataContainer:after{content:"";display:table;clear:both}.sby_lb-data{padding:0 4px;color:#ccc}.sby_lb-data .sby_lb-details{width:85%;float:left;text-align:left;line-height:1.1}.sby_lb-data .sby_lb-caption{float:left;font-size:13px;font-weight:400;line-height:1.3;padding-bottom:3px;color:#ccc;word-wrap:break-word;-webkit-hyphens:auto;-moz-hyphens:auto;hyphens:auto}.sby_lb-data .sby_lb-caption .ctf-screename-sep,.sby_lb-data .sby_lb-caption a{color:#ccc;font-weight:700;text-decoration:none}.sby_lb-data .sby_lb-caption a:hover{color:#fff;text-decoration:underline}.sby_lb-data .sby_lb-caption .sby_lightbox_username{float:left;width:100%;color:#ccc;padding-bottom:0;display:block;margin:0 0 5px 0}.sby_lb-data .sby_lb-caption .sby_lightbox_username{color:#ccc}.sby_lb-data .sby_lb-caption .sby_lightbox_username:hover p{color:#fff;text-decoration:underline}.sby_lightbox .sby_lightbox_username img{float:left;border:none;width:48px;height:48px;margin-right:10px;background:#666;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sby_lightbox_username p{float:left;margin:0;padding:0;color:#ccc;line-height:32px;font-weight:700;font-size:13px;text-align:left}.sby_lb-data .ctf-caption-text{width:100%;margin-left:58px;padding-top:3px}.sby_lb-data .sby_lb-caption .ctf-author-screenname,.sby_lb-data .sby_lb-caption .ctf-tweet-date{font-weight:400}.sby_lb-data .sby_lb-info{width:100%;float:left;clear:both}.sby_lb-data .sby_lb-number{display:block;float:left;clear:both;padding:5px 0 15px 0;font-size:12px;color:#999}.sby_lb-data .sby_lb-close{display:block;float:right;width:30px;height:30px;background:url(../img/close.png) top right no-repeat;text-align:right;outline:0;opacity:.7;-webkit-transition:opacity .2s;-moz-transition:opacity .2s;-o-transition:opacity .2s;transition:opacity .2s}.sby_lb-data .sby_lb-close:hover{cursor:pointer;opacity:1}.sby_lb-nav{height:auto}.sby_lb-container{padding:0}.sby_lb-container iframe{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1}#sby_lightbox .sby_lightbox_action{float:left;position:relative;padding:0 0 0 10px;margin:5px 0 0 10px;border-left:1px solid #666;font-size:12px}#sby_lightbox .sby_lightbox_action a{display:block;float:left;color:#999;text-decoration:none}#sby_lightbox .sby_lightbox_action a:focus,#sby_lightbox .sby_lightbox_action a:hover{color:#fff}#sby_lightbox .sby_lightbox_action .fa,#sby_lightbox .sby_lightbox_action svg{margin-right:5px}#sby_lightbox .sby_lightbox_action.sby_youtube .fa{font-size:13px}#sby_lightbox .sby_tooltip_social a svg{font-size:19px;padding:3px 4px;margin:auto}#sby_lightbox .sby_lightbox_tooltip{display:none;position:absolute;width:100px;bottom:22px;left:0;padding:5px 10px;margin:0;background:rgba(255,255,255,.9);color:#222;font-size:12px;line-height:1.3;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;box-shadow:0 0 10px rgba(0,0,0,.4);-moz-box-shadow:0 0 10px rgba(0,0,0,.4);-webkit-box-shadow:0 0 10px rgba(0,0,0,.4);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sby_lightbox .sby_lightbox_tooltip .fa-play{position:absolute;font-size:8px;bottom:-6px;left:36px;color:rgba(255,255,255,.9)}#sby_lightbox .sby_tooltip_social a .fa{font-size:16px;margin:0;padding:5px}#sby_lightbox .sby_tooltip_social a#sby_facebook_icon .fa,#sby_lightbox .sby_tooltip_social a#sby_pinterest_icon .fa,#sby_lightbox .sby_tooltip_social a#sby_twitter_icon .fa{padding-top:4px;font-size:18px}#sby_lightbox #sby_mod_box{width:280px;padding:5px 10px 7px 10px}#sby_lightbox .sby_tooltip_social{width:172px;padding:5px 5px 4px 5px}#sby_lightbox .sby_tooltip_social a{color:#333;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px}#sby_lightbox .sby_lightbox_action #sby_facebook_icon:hover{background:#3b5998}#sby_lightbox .sby_lightbox_action #sby_twitter_icon:hover{background:#00aced}#sby_lightbox .sby_lightbox_action #sby_google_icon:hover{background:#dd4b39}#sby_lightbox .sby_lightbox_action #sby_linkedin_icon:hover{background:#007bb6}#sby_lightbox .sby_lightbox_action #sby_pinterest_icon:hover{background:#cb2027}#sby_lightbox .sby_lightbox_action #sby_email_icon:hover{background:#333}.sby_lb-dataContainer,.sby_lb-outerContainer{min-width:450px}@media all and (max-width:450px){.sby_lb-dataContainer,.sby_lb-outerContainer{min-width:0}}.sby_lightbox .sby_lb-image{display:block;height:auto;max-width:inherit;margin:0 auto;-webkit-border-radius:0;-moz-border-radius:0;-ms-border-radius:0;-o-border-radius:0;border-radius:0}#sby_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}#sby_mod_error p{padding:5px 0!important;margin:0!important;line-height:1.3!important}#sby_mod_error ol,#sby_mod_error ul{padding:5px 0 5px 20px!important;margin:0!important}#sby_mod_error li{padding:1px 0!important;margin:0!important}#sby_mod_error span{font-size:12px}[id^=sb_youtube_].sb_youtube svg:not(:root).svg-inline--fa,[id^=sb_youtube_].sb_youtube_lightbox svg:not(:root).svg-inline--fa{box-sizing:unset;overflow:visible;width:1em}[id^=sb_youtube_].sb_youtube .svg-inline--fa.fa-w-16{width:16px}[id^=sb_youtube_].sb_youtube .svg-inline--fa,[id^=sb_youtube_].sb_youtube_lightbox .svg-inline--fa{display:inline-block;font-size:inherit;height:1em;overflow:visible;vertical-align:-.125em}
css/sby-notices.css ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Review notice */
2
+ .sby_review_notice{
3
+ position: relative;
4
+ overflow: hidden;
5
+ max-width: 870px;
6
+ margin-top: 10px;
7
+ padding: 10px 10px 7px 10px;
8
+
9
+ background: #E6F0E8;
10
+ border: 1px solid #6AB074;
11
+ color: #214F28;
12
+ }
13
+ .sby_bfcm_sale_notice,
14
+ .sby_new_user_sale_notice{
15
+ max-width: 672px;
16
+ }
17
+ .sby_review_notice img{
18
+ width: 74px;
19
+ margin: 0 0 0 -100% !important;
20
+
21
+ -moz-border-radius: 4px;
22
+ -webkit-border-radius: 4px;
23
+ border-radius: 4px;
24
+ }
25
+ .sby_review_notice .sby-notice-text{
26
+ float: left;
27
+ clear: none;
28
+ width: 100%;
29
+ padding: 0;
30
+ }
31
+ .sby_review_notice p{
32
+ float: left;
33
+ clear: both;
34
+ width: auto;
35
+ margin: 0 0 0 90px !important;
36
+ padding: 2px 40px 2px 0;
37
+ line-height: 1.4;
38
+ }
39
+ .sby_review_notice .sby-links{
40
+ margin-top: 4px !important;
41
+ }
42
+ .sby_review_notice a{
43
+ display: inline-block;
44
+ padding: 0 8px;
45
+ color: #178529;
46
+ }
47
+ .sby_review_notice a:hover,
48
+ .sby_review_notice a:focus{
49
+ color: #0c7abf;
50
+ }
51
+ .sby_review_notice .links{
52
+ margin: 0 0 0 82px !important;
53
+ padding: 4px 0 0 0;
54
+ margin-top: 6px !important;
55
+ }
56
+ .sby_review_notice .sby_notice_close,
57
+ .sby_review_notice .sby_bfcm_sale_notice_close,
58
+ .sby_review_notice .sby_new_user_sale_notice_close {
59
+ position: absolute;
60
+ top: 0;
61
+ right: 0;
62
+ padding: 10px;
63
+ line-height: 1;
64
+ }
65
+ .sby_review_notice .sby_notice_close:hover,
66
+ .sby_review_notice .sby_notice_close:focus{
67
+ color: #a34100;
68
+ }
69
+ .sby_review_notice .sby_offer_btn {
70
+ padding: 4px 12px 6px 12px;
71
+ background: green;
72
+ color: #fff;
73
+ border-radius: 4px;
74
+ display: inline-block;
75
+ text-decoration: none;
76
+ margin-left: 0;
77
+ }
78
+ .sby_review_notice .sby_offer_btn:hover, .sby_review_notice .sby_offer_btn:focus {
79
+ background: #049404;
80
+ color: #fff;
81
+ }
82
+ .sby_review_notice .sby_other_notice{
83
+ padding-top: 10px;
84
+ font-style: italic;
85
+ font-size: 12px;
86
+ }
87
+ .sby_review_notice .sby_other_notice a{
88
+ padding: 0;
89
+ }
img/balloon.png ADDED
Binary file
img/close.png ADDED
Binary file
img/gallery.png ADDED
Binary file
img/grid.png ADDED
Binary file
img/lightbox-placeholder.png ADDED
Binary file
img/list.png ADDED
Binary file
img/next.png ADDED
Binary file
img/placeholder.png ADDED
Binary file
img/prev.png ADDED
Binary file
img/sby-icon-offer.png ADDED
Binary file
img/sby-icon.png ADDED
Binary file
img/smash-balloon-logo-small.png ADDED
Binary file
inc/admin/admin-functions.php ADDED
@@ -0,0 +1,708 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( '-1' );
4
+ }
5
+
6
+ function sby_admin_init() {
7
+ global $sby_settings;
8
+
9
+ $base_path = trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/templates';
10
+ $slug = SBY_SLUG;
11
+ $plugin_name = SBY_PLUGIN_NAME;
12
+ $capability = current_user_can( 'manage_options' ) ? 'manage_options' : 'manage_youtube_feed_options';
13
+ $icon = 'dashicons-video-alt3';
14
+ $position = 99;
15
+ $tabs = array(
16
+ array(
17
+ 'title' => __( 'Configure', SBY_TEXT_DOMAIN ),
18
+ 'slug' => 'configure',
19
+ 'capability' => $capability,
20
+ 'next_step_instructions' => __( 'Customize your feed', SBY_TEXT_DOMAIN )
21
+ ),
22
+ array(
23
+ 'title' => __( 'Customize', SBY_TEXT_DOMAIN ),
24
+ 'slug' => 'customize',
25
+ 'capability' => $capability,
26
+ 'next_step_instructions' => __( 'Display your feed', SBY_TEXT_DOMAIN )
27
+ ),
28
+ array(
29
+ 'title' => __( 'Display', SBY_TEXT_DOMAIN ),
30
+ 'slug' => 'display',
31
+ 'capability' => $capability
32
+ ),
33
+ array(
34
+ 'title' => __( 'Support', SBY_TEXT_DOMAIN ),
35
+ 'slug' => 'support',
36
+ 'capability' => $capability,
37
+ 'numbered_tab' => false
38
+ )
39
+ );
40
+
41
+ $active_tab = $tabs[0]['slug'];
42
+ if ( isset( $_GET['tab'] ) ) {
43
+ $active_tab = sanitize_text_field( $_GET['tab'] ); $tabs[0]['slug'];
44
+ } elseif ( isset( $_GET['page'] ) ) {
45
+ foreach ( $tabs as $tab ) {
46
+ if ( $_GET['page'] === $slug . '_' . $tab['slug'] ) {
47
+ $active_tab = $tab['slug'];
48
+ }
49
+ }
50
+ }
51
+ $vars = new SBY_Vars();
52
+ $admin = new SBY_Admin( $vars, $base_path, $slug, $plugin_name, $capability, $icon, $position, $tabs, $sby_settings, $active_tab, 'sby_settings' );
53
+ $admin->access_token_listener();
54
+
55
+ $types = array(
56
+ array(
57
+ 'slug' => 'channel',
58
+ 'label' => __( 'Channel', SBY_TEXT_DOMAIN ),
59
+ 'input_type' => 'text',
60
+ 'note' => __( 'Eg: UCNrD5PWitIbhVK8ID or smashballoon.', SBY_TEXT_DOMAIN ),
61
+ 'tooltip' => '<p><ul>
62
+ <li><b>' . __( 'Channel ID or User Name', SBY_TEXT_DOMAIN ).'</b><br>
63
+ ' . __( 'You can find the ID or User Name of your YouTube Channel from the URL. In each URL format, the text you need to use is highlighted below:', SBY_TEXT_DOMAIN ).'<br><br>
64
+ ' . __( 'URL Format 1:', SBY_TEXT_DOMAIN ).' <code>https://www.youtube.com/channel/<span class="sbspf-highlight">UC1a2b3c4D5F6g7i8j9k</span></code>
65
+ <br>
66
+ ' . __( 'URL Format 2:', SBY_TEXT_DOMAIN ).' <code>https://www.youtube.com/user/<span class="sbspf-highlight">your_user_name</span></code>
67
+ </li>
68
+ </ul></p>'
69
+ )
70
+ );
71
+ $admin->set_feed_types( $types );
72
+
73
+ $text_domain = SBY_TEXT_DOMAIN;
74
+ /* Layout */
75
+ $layouts = array(
76
+ array(
77
+ 'slug' => 'list',
78
+ 'label' => __( 'List', $text_domain ),
79
+ 'image' => 'img/list.png',
80
+ 'note' => __( 'A single columns of videos that play when clicked.', $text_domain ),
81
+ ),
82
+ array(
83
+ 'slug' => 'grid',
84
+ 'label' => __( 'Grid', $text_domain ),
85
+ 'image' => 'img/grid.png',
86
+ 'note' => __( 'Video thumbnails are displayed in columns and play in a lightbox when clicked.', $text_domain ),
87
+ 'options' => array(
88
+ array(
89
+ 'name' => 'cols',
90
+ 'callback' => 'select',
91
+ 'label' => __( 'Columns', $text_domain ),
92
+ 'min' => 1,
93
+ 'max' => 7,
94
+ 'default' => 4,
95
+ 'shortcode_example' => 3
96
+ ),
97
+ array(
98
+ 'name' => 'colsmobile',
99
+ 'callback' => 'select',
100
+ 'label' => __( 'Mobile Columns', $text_domain ),
101
+ 'min' => 1,
102
+ 'max' => 2,
103
+ 'default' => 2,
104
+ 'shortcode_example' => 2
105
+ ),
106
+ )
107
+ ),
108
+ array(
109
+ 'slug' => 'gallery',
110
+ 'label' => __( 'Gallery', $text_domain ),
111
+ 'image' => 'img/gallery.png',
112
+ 'note' => __( 'One large video that plays when clicked with thumbnails underneath to play more.', $text_domain ),
113
+ 'options' => array(
114
+ array(
115
+ 'name' => 'cols',
116
+ 'callback' => 'select',
117
+ 'label' => __( 'Columns', $text_domain ),
118
+ 'min' => 1,
119
+ 'max' => 7,
120
+ 'default' => 4,
121
+ 'shortcode_example' => 3
122
+ ),
123
+ array(
124
+ 'name' => 'colsmobile',
125
+ 'callback' => 'select',
126
+ 'label' => __( 'Mobile Columns', $text_domain ),
127
+ 'min' => 1,
128
+ 'max' => 2,
129
+ 'default' => 1,
130
+ 'shortcode_example' => 2
131
+ ),
132
+ )
133
+ ),
134
+
135
+ );
136
+ $admin->set_feed_layouts( $layouts );
137
+
138
+ $display_your_feed_table_headings = array(
139
+ array(
140
+ 'slug' => 'configure',
141
+ 'label' => __( 'Configure Options', SBY_TEXT_DOMAIN ),
142
+ ),
143
+ array(
144
+ 'slug' => 'customize',
145
+ 'label' => __( 'Customize Options', SBY_TEXT_DOMAIN ),
146
+ ),
147
+ array(
148
+ 'slug' => 'layout',
149
+ 'label' => __( 'Layout Options', SBY_TEXT_DOMAIN ),
150
+ ),
151
+ array(
152
+ 'slug' => 'header',
153
+ 'label' => __( 'Header Options', SBY_TEXT_DOMAIN ),
154
+ ),
155
+ array(
156
+ 'slug' => 'button',
157
+ 'label' => __( '"Load More" Button Options', SBY_TEXT_DOMAIN ),
158
+ ),
159
+ array(
160
+ 'slug' => 'subscribe',
161
+ 'label' => __( '"Subscribe" Button Options', SBY_TEXT_DOMAIN ),
162
+ )
163
+ );
164
+ $admin->set_display_table_sections( $display_your_feed_table_headings );
165
+
166
+ $admin->init();
167
+ }
168
+
169
+ function sby_admin_style() {
170
+ wp_enqueue_style( SBY_SLUG . '_admin_notices_css', SBY_PLUGIN_URL . 'css/sby-notices.css', array(), SBYVER );
171
+ if ( ! sby_is_admin_page() ) {
172
+ return;
173
+ }
174
+ wp_enqueue_style( SBY_SLUG . '_admin_css', SBY_PLUGIN_URL . 'css/admin.css', array(), SBYVER );
175
+ wp_enqueue_style( 'sb_font_awesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' );
176
+ wp_enqueue_style( 'wp-color-picker' );
177
+ }
178
+ add_action( 'admin_enqueue_scripts', 'sby_admin_style' );
179
+
180
+ function sby_admin_scripts() {
181
+ if ( ! sby_is_admin_page() ) {
182
+ return;
183
+ }
184
+ wp_enqueue_script( SBY_SLUG . '_admin_js', SBY_PLUGIN_URL . 'js/admin.js', array(), SBYVER );
185
+ wp_localize_script( SBY_SLUG . '_admin_js', 'sbspf', array(
186
+ 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
187
+ 'nonce' => wp_create_nonce( 'sbspf_nonce' )
188
+ )
189
+ );
190
+ wp_enqueue_script('wp-color-picker' );
191
+ }
192
+ add_action( 'admin_enqueue_scripts', 'sby_admin_scripts' );
193
+
194
+ function sby_is_admin_page() {
195
+ if ( ! isset( $_GET['page'] ) ) {
196
+ return false;
197
+ } elseif ( strpos( sanitize_text_field( $_GET['page'] ), SBY_SLUG ) !== false ) {
198
+ return true;
199
+ }
200
+ return false;
201
+ }
202
+
203
+ function sby_admin_icon( $icon, $class = '' ) {
204
+ $class = ! empty( $class ) ? ' ' . $class : '';
205
+ if ( $icon === 'question-circle' ) {
206
+ return '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="question-circle" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-question-circle fa-w-16'.$class.'"><path fill="currentColor" d="M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zM262.655 90c-54.497 0-89.255 22.957-116.549 63.758-3.536 5.286-2.353 12.415 2.715 16.258l34.699 26.31c5.205 3.947 12.621 3.008 16.665-2.122 17.864-22.658 30.113-35.797 57.303-35.797 20.429 0 45.698 13.148 45.698 32.958 0 14.976-12.363 22.667-32.534 33.976C247.128 238.528 216 254.941 216 296v4c0 6.627 5.373 12 12 12h56c6.627 0 12-5.373 12-12v-1.333c0-28.462 83.186-29.647 83.186-106.667 0-58.002-60.165-102-116.531-102zM256 338c-25.365 0-46 20.635-46 46 0 25.364 20.635 46 46 46s46-20.636 46-46c0-25.365-20.635-46-46-46z" class=""></path></svg>';
207
+ } elseif ( $icon === 'info-circle' ) {
208
+ return '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="info-circle" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-info-circle fa-w-16'.$class.'"><path fill="currentColor" d="M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z" class=""></path></svg>';
209
+ } elseif ( $icon === 'life-ring' ) {
210
+ return '<svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="life-ring" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-life-ring fa-w-16'.$class.'"><path fill="currentColor" d="M256 504c136.967 0 248-111.033 248-248S392.967 8 256 8 8 119.033 8 256s111.033 248 248 248zm-103.398-76.72l53.411-53.411c31.806 13.506 68.128 13.522 99.974 0l53.411 53.411c-63.217 38.319-143.579 38.319-206.796 0zM336 256c0 44.112-35.888 80-80 80s-80-35.888-80-80 35.888-80 80-80 80 35.888 80 80zm91.28 103.398l-53.411-53.411c13.505-31.806 13.522-68.128 0-99.974l53.411-53.411c38.319 63.217 38.319 143.579 0 206.796zM359.397 84.72l-53.411 53.411c-31.806-13.505-68.128-13.522-99.973 0L152.602 84.72c63.217-38.319 143.579-38.319 206.795 0zM84.72 152.602l53.411 53.411c-13.506 31.806-13.522 68.128 0 99.974L84.72 359.398c-38.319-63.217-38.319-143.579 0-206.796z" class=""></path></svg>';
211
+ } elseif ( $icon === 'envelope' ) {
212
+ return '<svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="envelope" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-envelope fa-w-16'.$class.'"><path fill="currentColor" d="M464 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm0 48v40.805c-22.422 18.259-58.168 46.651-134.587 106.49-16.841 13.247-50.201 45.072-73.413 44.701-23.208.375-56.579-31.459-73.413-44.701C106.18 199.465 70.425 171.067 48 152.805V112h416zM48 400V214.398c22.914 18.251 55.409 43.862 104.938 82.646 21.857 17.205 60.134 55.186 103.062 54.955 42.717.231 80.509-37.199 103.053-54.947 49.528-38.783 82.032-64.401 104.947-82.653V400H48z" class=""></path></svg>';
213
+ } elseif ( $icon === 'chevron-right' ) {
214
+ return '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="chevron-circle-right" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-chevron-circle-right fa-w-16'.$class.'"><path fill="currentColor" d="M256 8c137 0 248 111 248 248S393 504 256 504 8 393 8 256 119 8 256 8zm113.9 231L234.4 103.5c-9.4-9.4-24.6-9.4-33.9 0l-17 17c-9.4 9.4-9.4 24.6 0 33.9L285.1 256 183.5 357.6c-9.4 9.4-9.4 24.6 0 33.9l17 17c9.4 9.4 24.6 9.4 33.9 0L369.9 273c9.4-9.4 9.4-24.6 0-34z" class=""></path></svg>';
215
+ } elseif ( $icon === 'rocket' ) {
216
+ return '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="rocket" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-rocket fa-w-16'.$class.'"><path fill="currentColor" d="M505.05 19.1a15.89 15.89 0 0 0-12.2-12.2C460.65 0 435.46 0 410.36 0c-103.2 0-165.1 55.2-211.29 128H94.87A48 48 0 0 0 52 154.49l-49.42 98.8A24 24 0 0 0 24.07 288h103.77l-22.47 22.47a32 32 0 0 0 0 45.25l50.9 50.91a32 32 0 0 0 45.26 0L224 384.16V488a24 24 0 0 0 34.7 21.49l98.7-49.39a47.91 47.91 0 0 0 26.5-42.9V312.79c72.59-46.3 128-108.4 128-211.09.1-25.2.1-50.4-6.85-82.6zM384 168a40 40 0 1 1 40-40 40 40 0 0 1-40 40z" class=""></path></svg>';
217
+ } elseif ( $icon === 'minus-circle' ) {
218
+ return '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="minus-circle" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-minus-circle fa-w-16'.$class.'"><path fill="currentColor" d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zM124 296c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h264c6.6 0 12 5.4 12 12v56c0 6.6-5.4 12-12 12H124z" class=""></path></svg>';
219
+ } elseif ( $icon === 'times' ) {
220
+ return '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512" class="svg-inline--fa fa-times fa-w-11'.$class.'"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z" class=""></path></svg>';
221
+ } elseif ( $icon === 'cog' ) {
222
+ return '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="cog" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-cog fa-w-16'.$class.'"><path fill="currentColor" d="M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z" class=""></path></svg>';
223
+ } elseif ( $icon === 'ellipsis' ) {
224
+ return '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="ellipsis-h" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-ellipsis-h fa-w-16'.$class.'"><path fill="currentColor" d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z" class=""></path></svg>';
225
+ } else {
226
+ sby_icon( $icon );
227
+ }
228
+ }
229
+
230
+ function sby_delete_connected_account() {
231
+ if ( ! isset( $_POST['sbspf_nonce'] ) || ! isset( $_POST['account_id']) ) return;
232
+ $nonce = $_POST['sbspf_nonce'];
233
+ if ( ! wp_verify_nonce( $nonce, 'sbspf_nonce' ) ) {
234
+ die ( 'You did not do this the right way!' );
235
+ }
236
+
237
+ global $sby_settings;
238
+
239
+ $account_id = sanitize_text_field( $_POST['account_id'] );
240
+ $to_save = array();
241
+
242
+ foreach ( $sby_settings['connected_accounts'] as $connected_account ) {
243
+ if ( (string)$connected_account['channel_id'] !== (string)$account_id ) {
244
+ $to_save[ $connected_account['channel_id'] ] = $connected_account;
245
+ }
246
+ }
247
+
248
+ $sby_settings['connected_accounts'] = $to_save;
249
+ update_option( 'sby_settings', $sby_settings );
250
+
251
+ echo wp_json_encode( array( 'success' => true ) );
252
+
253
+ die();
254
+ }
255
+ add_action( 'wp_ajax_sby_ca_after_remove_clicked', 'sby_delete_connected_account' );
256
+
257
+ function sby_process_access_token() {
258
+ if ( ! isset( $_POST['sbspf_nonce'] ) || ! isset( $_POST['sby_access_token'] ) ) return;
259
+ $nonce = $_POST['sbspf_nonce'];
260
+ if ( ! wp_verify_nonce( $nonce, 'sbspf_nonce' ) ) {
261
+ die ( 'You did not do this the right way!' );
262
+ }
263
+
264
+ $account = sby_attempt_connection();
265
+
266
+ if ( $account ) {
267
+ global $sby_settings;
268
+
269
+ $options = $sby_settings;
270
+ $username = $account['username'] ? $account['username'] : $account['channel_id'];
271
+ if ( isset( $account['local_avatar'] ) && $account['local_avatar'] && isset( $options['favorlocal'] ) && $options['favorlocal' ] === 'on' ) {
272
+ $upload = wp_upload_dir();
273
+ $resized_url = trailingslashit( $upload['baseurl'] ) . trailingslashit( SBY_UPLOADS_NAME );
274
+ $profile_picture = '<img class="sbspf_ca_avatar" src="'.$resized_url . $account['username'].'.jpg" />'; //Could add placeholder avatar image
275
+ } else {
276
+ $profile_picture = $account['profile_picture'] ? '<img class="sbspf_ca_avatar" src="'.$account['profile_picture'].'" />' : ''; //Could add placeholder avatar image
277
+ }
278
+
279
+ $text_domain = SBY_TEXT_DOMAIN;
280
+ $slug = SBY_SLUG;
281
+ ob_start();
282
+ include trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/templates/single-connected-account.php';
283
+ $html = ob_get_contents();
284
+ ob_get_clean();
285
+
286
+ $return = array(
287
+ 'account_id' => $account['channel_id'],
288
+ 'html' => $html
289
+ );
290
+ } else {
291
+ $return = array(
292
+ 'error' => __( 'Could not connect your account. Please check to make sure this is a valid access token for the Smash Balloon YouTube App.'),
293
+ 'html' => ''
294
+ );
295
+ }
296
+
297
+ echo wp_json_encode( $return );
298
+
299
+ die();
300
+ }
301
+ add_action( 'wp_ajax_sby_process_access_token', 'sby_process_access_token' );
302
+
303
+ function sby_delete_wp_posts() {
304
+ if ( ! isset( $_POST['sbspf_nonce'] ) ) return;
305
+ $nonce = $_POST['sbspf_nonce'];
306
+ if ( ! wp_verify_nonce( $nonce, 'sbspf_nonce' ) ) {
307
+ die ( 'You did not do this the right way!' );
308
+ }
309
+
310
+ sby_clear_wp_posts();
311
+
312
+ echo '{}';
313
+
314
+ die();
315
+ }
316
+ add_action( 'wp_ajax_sby_delete_wp_posts', 'sby_delete_wp_posts' );
317
+
318
+ function sby_attempt_connection() {
319
+
320
+
321
+ if ( isset( $_GET['sby_access_token'] ) ) {
322
+ $access_token = sanitize_text_field( urldecode( $_GET['sby_access_token'] ) );
323
+ $refresh_token = sanitize_text_field( urldecode( $_GET['sby_refresh_token'] ) );
324
+ } else {
325
+ $access_token = sanitize_text_field( $_POST['sby_access_token'] );
326
+ $refresh_token = sanitize_text_field( $_POST['sby_refresh_token'] );
327
+ }
328
+
329
+ $account_info = array(
330
+ 'access_token' => $access_token,
331
+ 'refresh_token' => $refresh_token
332
+ );
333
+ $sby_api_connect = new SBY_API_Connect( $account_info, 'tokeninfo' );
334
+ $sby_api_connect->connect();
335
+
336
+ $data = $sby_api_connect->get_data();
337
+
338
+ if ( isset( $data['audience'] ) && $data['audience'] === sby_get_account_bottom() ) {
339
+ $expires = $data['expires_in'] + time();
340
+ $sby_api_connect = new SBY_API_Connect( $account_info, 'channels' );
341
+ $sby_api_connect->connect();
342
+ $data = $sby_api_connect->get_data();
343
+
344
+ if ( isset( $data['items'] ) ) {
345
+ $account_info['username'] = $data['items'][0]['snippet']['title'];
346
+ $account_info['channel_id'] = $data['items'][0]['id'];
347
+ $account_info['profile_picture'] = $data['items'][0]['snippet']['thumbnails']['default']['url'];
348
+ $account_info['privacy'] = $data['items'][0]['status']['privacyStatus'];
349
+ $account_info['expires'] = $expires;
350
+ //privacyStatus
351
+ SBY_Admin::connect_account( $account_info );
352
+
353
+ return $account_info;
354
+ }
355
+ }
356
+ return false;
357
+ }
358
+
359
+ function sbspf_account_search() {
360
+ if ( ! isset( $_POST['sbspf_nonce'] ) || ! isset( $_POST['term']) ) return;
361
+ $nonce = $_POST['sbspf_nonce'];
362
+ if ( ! wp_verify_nonce( $nonce, 'sbspf_nonce' ) ) {
363
+ die ( 'You did not do this the right way!' );
364
+ }
365
+
366
+ global $sby_settings;
367
+
368
+ $term = sanitize_text_field( $_POST['term'] );
369
+ $params = array(
370
+ 'q' => $term,
371
+ 'type' => 'channel'
372
+ );
373
+
374
+ $connected_account_for_term = array();
375
+ foreach ( $sby_settings['connected_accounts'] as $connected_account ) {
376
+ $connected_account_for_term = $connected_account;
377
+ }
378
+ if ( $connected_account_for_term['expires'] < time() + 5 ) {
379
+ $new_token_data = SBY_API_Connect::refresh_token( sby_get_account_bottom(), $connected_account_for_term['refresh_token'], sby_get_account_top() );
380
+
381
+ if ( isset( $new_token_data['access_token'] ) ) {
382
+ $connected_account_for_term['access_token'] = $new_token_data['access_token'];
383
+ $connected_accounts_for_feed[ $term ]['access_token'] = $new_token_data['access_token'];
384
+ $connected_account_for_term['expires'] = $new_token_data['expires_in'] + time();
385
+ $connected_accounts_for_feed[ $term ]['expires'] = $new_token_data['expires_in'] + time();
386
+
387
+ sby_update_or_connect_account( $connected_account_for_term );
388
+
389
+ }
390
+ }
391
+
392
+ $search = new SBY_API_Connect( $connected_account_for_term, 'search', $params );
393
+
394
+ $search->connect();
395
+
396
+
397
+ echo wp_json_encode( $search->get_data() );
398
+
399
+ die();
400
+ }
401
+ add_action( 'wp_ajax_sbspf_account_search', 'sbspf_account_search' );
402
+
403
+ function sby_reset_cron( $settings ) {
404
+ $sbi_caching_type = isset( $settings['caching_type'] ) ? $settings['caching_type'] : '';
405
+ $sbi_cache_cron_interval = isset( $settings['cache_cron_interval'] ) ? $settings['cache_cron_interval'] : '';
406
+ $sbi_cache_cron_time = isset( $settings['cache_cron_time'] ) ? $settings['cache_cron_time'] : '';
407
+ $sbi_cache_cron_am_pm = isset( $settings['cache_cron_am_pm'] ) ? $settings['cache_cron_am_pm'] : '';
408
+
409
+ if ( $sbi_caching_type === 'background' ) {
410
+ delete_option( 'sby_cron_report' );
411
+ SBY_Cron_Updater::start_cron_job( $sbi_cache_cron_interval, $sbi_cache_cron_time, $sbi_cache_cron_am_pm );
412
+ }
413
+ }
414
+ add_action( 'sby_settings_after_configure_save', 'sby_reset_cron', 10, 1 );
415
+
416
+ function sby_clear_wp_posts() {
417
+
418
+ global $wpdb;
419
+
420
+ $youtube_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type = '".SBY_CPT."';" );
421
+
422
+ $id_string = implode( ', ', $youtube_ids );
423
+ if ( ! empty( $id_string ) ) {
424
+ $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE post_id IN ($id_string);" );
425
+ $wpdb->query( "DELETE FROM $wpdb->posts WHERE post_type = '".SBY_CPT."';" );
426
+ }
427
+ }
428
+
429
+ /** Notices */
430
+
431
+ function sby_get_current_time() {
432
+ $current_time = time();
433
+
434
+ // where to do tests
435
+ //$current_time = strtotime( 'November 25, 2020' ) + 1;
436
+
437
+ return $current_time;
438
+ }
439
+
440
+ // generates the html for the admin notices
441
+ function sby_notices_html() {
442
+
443
+ if ( function_exists( 'sbi_notices_html' ) || function_exists( 'cff_notices_html' || function_exists( 'ctf_notices_html' ) ) ) {
444
+ return;
445
+ }
446
+
447
+ $current_screen = get_current_screen();
448
+ $is_plugins_page = isset( $current_screen->id ) && $current_screen->id === 'plugins';
449
+ $page = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
450
+ //Only show to admins
451
+ if ( ! current_user_can( 'manage_options' ) ) {
452
+ return;
453
+ }
454
+
455
+ $sby_statuses_option = get_option( 'sby_statuses', array() );
456
+ $current_time = sby_get_current_time();
457
+ $sby_bfcm_discount_code = 'happysmashgiving' . date('Y', $current_time );
458
+
459
+ // reset everything for testing
460
+ if ( false ) {
461
+ global $current_user;
462
+ $user_id = $current_user->ID;
463
+ delete_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice' );
464
+ //delete_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
465
+ //$sby_statuses_option = array( 'first_install' => strtotime( 'December 8, 2019' ) );
466
+ //$sby_statuses_option = array( 'first_install' => time() );
467
+
468
+ //update_option( 'sby_statuses', $sby_statuses_option, false );
469
+ //delete_option( 'sby_rating_notice');
470
+ //delete_transient( 'instagram_feed_rating_notice_waiting' );
471
+
472
+ //set_transient( 'instagram_feed_rating_notice_waiting', 'waiting', 2 * WEEK_IN_SECONDS );
473
+ //update_option( 'sby_rating_notice', 'pending', false );
474
+ }
475
+
476
+ //$sby_statuses_option['rating_notice_dismissed'] = time();
477
+ //update_option( 'sby_statuses', $sby_statuses_option, false );
478
+ // rating notice logic
479
+ $sby_rating_notice_option = get_option( 'sby_rating_notice', false );
480
+ $sby_rating_notice_waiting = get_transient( 'feeds_for_youtube_rating_notice_waiting' );
481
+ $should_show_rating_notice = ($sby_rating_notice_waiting !== 'waiting' && $sby_rating_notice_option !== 'dismissed');
482
+
483
+ // black friday cyber monday logic
484
+ $thanksgiving_this_year = sby_get_future_date( 11, date('Y', $current_time ), 4, 4, 1 );
485
+ $one_week_before_black_friday_this_year = $thanksgiving_this_year - 7*24*60*60;
486
+ $one_day_after_cyber_monday_this_year = $thanksgiving_this_year + 5*24*60*60;
487
+ $has_been_two_days_since_rating_dismissal = isset( $sby_statuses_option['rating_notice_dismissed'] ) ? ((int)$sby_statuses_option['rating_notice_dismissed'] + 2*24*60*60) < $current_time : true;
488
+
489
+ $could_show_bfcm_discount = ($current_time > $one_week_before_black_friday_this_year && $current_time < $one_day_after_cyber_monday_this_year);
490
+ $should_show_bfcm_discount = false;
491
+ if ( $could_show_bfcm_discount && $has_been_two_days_since_rating_dismissal ) {
492
+ global $current_user;
493
+ $user_id = $current_user->ID;
494
+
495
+ $ignore_bfcm_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice' );
496
+ $ignore_bfcm_sale_notice_meta = isset( $ignore_bfcm_sale_notice_meta[0] ) ? $ignore_bfcm_sale_notice_meta[0] : '';
497
+
498
+ /* Check that the user hasn't already clicked to ignore the message */
499
+ $should_show_bfcm_discount = ($ignore_bfcm_sale_notice_meta !== 'always' && $ignore_bfcm_sale_notice_meta !== date( 'Y', $current_time ));
500
+ }
501
+
502
+ // new user discount logic
503
+ $in_new_user_month_range = true;
504
+ $should_show_new_user_discount = false;
505
+ $has_been_one_month_since_rating_dismissal = isset( $sby_statuses_option['rating_notice_dismissed'] ) ? ((int)$sby_statuses_option['rating_notice_dismissed'] + 30*24*60*60) < $current_time + 1: true;
506
+
507
+ if ( isset( $sby_statuses_option['first_install'] ) && $sby_statuses_option['first_install'] === 'from_update' ) {
508
+ global $current_user;
509
+ $user_id = $current_user->ID;
510
+ $ignore_new_user_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
511
+ $ignore_new_user_sale_notice_meta = isset( $ignore_new_user_sale_notice_meta[0] ) ? $ignore_new_user_sale_notice_meta[0] : '';
512
+
513
+ if ( $ignore_new_user_sale_notice_meta !== 'always' ) {
514
+ $should_show_new_user_discount = true;
515
+ }
516
+ } elseif ( $in_new_user_month_range && $has_been_one_month_since_rating_dismissal ) {
517
+ global $current_user;
518
+ $user_id = $current_user->ID;
519
+ $ignore_new_user_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
520
+ $ignore_new_user_sale_notice_meta = isset( $ignore_new_user_sale_notice_meta[0] ) ? $ignore_new_user_sale_notice_meta[0] : '';
521
+
522
+ if ( $ignore_new_user_sale_notice_meta !== 'always'
523
+ && isset( $sby_statuses_option['first_install'] )
524
+ && $current_time > (int)$sby_statuses_option['first_install'] + 60*60*24*30 ) {
525
+ $should_show_new_user_discount = true;
526
+ }
527
+ }
528
+
529
+ // for debugging
530
+ if ( false ) {
531
+ global $current_user;
532
+ $user_id = $current_user->ID;
533
+ $ignore_bfcm_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice' );
534
+ $ignore_new_user_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
535
+
536
+ var_dump( 'new user rating option', $sby_rating_notice_option );
537
+ var_dump( 'new user rating transient', $sby_rating_notice_waiting );
538
+
539
+ var_dump( 'should show new user rating notice?', $should_show_rating_notice );
540
+
541
+ var_dump( 'new user discount month range?', $in_new_user_month_range );
542
+ var_dump( 'should show new user discount?', $should_show_new_user_discount );
543
+
544
+ var_dump( 'Thanksgiving this year?', date('m/d/Y', $thanksgiving_this_year ) );
545
+
546
+ var_dump( 'could show bfcm discount?', $could_show_bfcm_discount );
547
+ var_dump( 'rating was dismissed?', date('m/d/Y', $sby_statuses_option['rating_notice_dismissed'] ) );
548
+
549
+ var_dump( 'should show bfcm discount?', $should_show_bfcm_discount );
550
+
551
+ var_dump( 'ignore_bfcm_sale_notice_meta', $ignore_bfcm_sale_notice_meta );
552
+ var_dump( 'ignore_new_user_sale_notice_meta', $ignore_new_user_sale_notice_meta );
553
+
554
+ var_dump( $sby_statuses_option );
555
+ }
556
+
557
+
558
+ // no pro version yet, set these to false
559
+ $should_show_new_user_discount = false;
560
+ $should_show_bfcm_discount = false;
561
+
562
+ if ( $should_show_rating_notice ) {
563
+ $other_notice_html = '';
564
+ $dismiss_url = add_query_arg( 'sby_ignore_rating_notice_nag', '1' );
565
+ $later_url = add_query_arg( 'sby_ignore_rating_notice_nag', 'later' );
566
+ if ( $should_show_bfcm_discount ) {
567
+ $other_notice_html = '<p class="sby_other_notice">' . __( 'PS. We currently have a <a href="https://smashballoon.com/video-feed/?utm_source=plugin-free&utm_campaign=sby&discount='.$sby_bfcm_discount_code.'" target="_blank"><b style="font-weight: 700;">Black Friday deal</b></a> for 20% off the Pro version!', SBY_TEXT_DOMAIN ) . '</p>';
568
+
569
+ $dismiss_url = add_query_arg( array(
570
+ 'sby_ignore_rating_notice_nag' => '1',
571
+ 'sby_ignore_bfcm_sale_notice' => date( 'Y', $current_time )
572
+ )
573
+ );
574
+ $later_url = add_query_arg( array(
575
+ 'sby_ignore_rating_notice_nag' => 'later',
576
+ 'sby_ignore_bfcm_sale_notice' => date( 'Y', $current_time )
577
+ )
578
+ );
579
+ }
580
+
581
+ echo "
582
+ <div class='sby_notice sby_review_notice'>
583
+ <img src='". SBY_PLUGIN_URL . 'img/sby-icon.png' ."' alt='" . SBY_PLUGIN_NAME . "'>
584
+ <div class='sby-notice-text'>
585
+ <p style='padding-top: 4px;'>" . sprintf( __( "It's great to see that you've been using the %s plugin for a while now. Hopefully you're happy with it!&nbsp; If so, would you consider leaving a positive review? It really helps to support the plugin and helps others to discover it too!", SBY_TEXT_DOMAIN ), '<strong style=\'font-weight: 700;\'>'.SBY_PLUGIN_NAME.'</strong>' ) . "</p>
586
+ <p class='links'";
587
+ if( $should_show_bfcm_discount ) echo " style='margin-top: 0 !important;'";
588
+ echo ">
589
+ <a class='sby_notice_dismiss' href='https://wordpress.org/support/plugin/feeds-for-youtube/reviews/' target='_blank'>" . __( 'Sure, I\'d love to!', SBY_TEXT_DOMAIN ) . "</a>
590
+ &middot;
591
+ <a class='sby_notice_dismiss' href='" .esc_url( $dismiss_url ). "'>" . __( 'No thanks', SBY_TEXT_DOMAIN ) . "</a>
592
+ &middot;
593
+ <a class='sby_notice_dismiss' href='" .esc_url( $dismiss_url ). "'>" . __( 'I\'ve already given a review', SBY_TEXT_DOMAIN ) . "</a>
594
+ &middot;
595
+ <a class='sby_notice_dismiss' href='" .esc_url( $later_url ). "'>" . __( 'Ask Me Later', SBY_TEXT_DOMAIN ) . "</a>
596
+ </p>"
597
+ . $other_notice_html .
598
+ "</div>
599
+ <a class='sby_notice_close' href='" .esc_url( $dismiss_url ). "'><i class='fa fa-close'></i></a>
600
+ </div>";
601
+
602
+ } elseif ( $should_show_new_user_discount ) {
603
+ global $current_user;
604
+ $user_id = $current_user->ID;
605
+ $ignore_new_user_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
606
+ if ( $ignore_new_user_sale_notice_meta !== 'always' ) {
607
+
608
+ echo "
609
+ <div class='sby_notice sby_review_notice sby_new_user_sale_notice'>
610
+ <img src='" . SBY_PLUGIN_URL . 'img/sby-icon-offer.png' . "' alt='".SBY_PLUGIN_NAME."'>
611
+ <div class='sby-notice-text'>
612
+ <p>" . sprintf( __( '<b style="font-weight: 700;">Exclusive offer!</b> We don\'t run promotions very often, but for a limited time we\'re offering <b style="font-weight: 700;">20% off</b> our Pro version to all users of our free %s plugin.', SBY_TEXT_DOMAIN ), SBY_PLUGIN_NAME ) . "</p>
613
+ <p class='sby-links'>
614
+ <a class='sby_notice_dismiss sby_offer_btn' href='https://smashballoon.com/video-feed/?utm_source=plugin-free&utm_campaign=sby&discount=youtubethankyou' target='_blank'><b>" . __( 'Get this offer', SBY_TEXT_DOMAIN ) . "</b></a>
615
+ <a class='sby_notice_dismiss' style='margin-left: 5px;' href='" . esc_url( add_query_arg( 'sby_ignore_new_user_sale_notice', 'always' ) ) . "'>" . __( 'I\'m not interested', SBY_TEXT_DOMAIN ) . "</a>
616
+
617
+ </p>
618
+ </div>
619
+ <a class='sby_new_user_sale_notice_close' href='" . esc_url( add_query_arg( 'sby_ignore_new_user_sale_notice', 'always' ) ) . "'><i class='fa fa-close'></i></a>
620
+ </div>
621
+ ";
622
+ }
623
+
624
+ } elseif ( $should_show_bfcm_discount ) {
625
+
626
+ echo "
627
+ <div class='sby_notice sby_review_notice sby_bfcm_sale_notice'>
628
+ <img src='". SBY_PLUGIN_URL . 'img/sby-icon-offer.png' ."' alt='".SBY_PLUGIN_NAME."'>
629
+ <div class='sby-notice-text'>
630
+ <p>" . sprintf( __( '<b style="font-weight: 700;">Black Friday/Cyber Monday Deal!</b> Thank you for using our free %s plugin. For a limited time, we\'re offering <b style="font-weight: 700;">20% off</b> the Pro version for all of our users.', SBY_TEXT_DOMAIN ), SBY_PLUGIN_NAME ) . "</p>
631
+ <p class='sby-links'>
632
+ <a class='sby_notice_dismiss sby_offer_btn' href='https://smashballoon.com/video-feed/?utm_source=plugin-free&utm_campaign=sby&discount=".$sby_bfcm_discount_code."' target='_blank'><b>" . __( 'Get this offer', SBY_TEXT_DOMAIN ) . "</b></a>
633
+ <a class='sby_notice_dismiss' style='margin-left: 5px;' href='" .esc_url( add_query_arg( 'sby_ignore_bfcm_sale_notice', date( 'Y', $current_time ) ) ). "'>" . __( 'I\'m not interested', SBY_TEXT_DOMAIN ) . "</a>
634
+ </p>
635
+ </div>
636
+ <a class='sby_bfcm_sale_notice_close' href='" .esc_url( add_query_arg( 'sby_ignore_bfcm_sale_notice', date( 'Y', $current_time ) ) ). "'><i class='fa fa-close'></i></a>
637
+ </div>
638
+ ";
639
+
640
+ }
641
+
642
+ }
643
+ add_action( 'admin_notices', 'sby_notices_html', 12 ); // priority 8 for Instagram, priority 10 for Facebook
644
+
645
+ function sby_process_nags() {
646
+
647
+ global $current_user;
648
+ $user_id = $current_user->ID;
649
+ $sby_statuses_option = get_option( 'sby_statuses', array() );
650
+
651
+ if ( isset( $_GET['sby_ignore_rating_notice_nag'] ) ) {
652
+ if ( (int)$_GET['sby_ignore_rating_notice_nag'] === 1 ) {
653
+ update_option( 'sby_rating_notice', 'dismissed', false );
654
+ $sby_statuses_option['rating_notice_dismissed'] = sby_get_current_time();
655
+ update_option( 'sby_statuses', $sby_statuses_option, false );
656
+
657
+ } elseif ( $_GET['sby_ignore_rating_notice_nag'] === 'later' ) {
658
+ set_transient( 'feeds_for_youtube_rating_notice_waiting', 'waiting', 2 * WEEK_IN_SECONDS );
659
+ update_option( 'sby_rating_notice', 'pending', false );
660
+ }
661
+ }
662
+
663
+ if ( isset( $_GET['sby_ignore_new_user_sale_notice'] ) ) {
664
+ $response = sanitize_text_field( $_GET['sby_ignore_new_user_sale_notice'] );
665
+ if ( $response === 'always' ) {
666
+ update_user_meta( $user_id, 'sby_ignore_new_user_sale_notice', 'always' );
667
+
668
+ $current_month_number = (int)date('n', sby_get_current_time() );
669
+ $not_early_in_the_year = ($current_month_number > 5);
670
+
671
+ if ( $not_early_in_the_year ) {
672
+ update_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice', date( 'Y', sby_get_current_time() ) );
673
+ }
674
+
675
+ }
676
+ }
677
+
678
+ if ( isset( $_GET['sby_ignore_bfcm_sale_notice'] ) ) {
679
+ $response = sanitize_text_field( $_GET['sby_ignore_bfcm_sale_notice'] );
680
+ if ( $response === 'always' ) {
681
+ update_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice', 'always' );
682
+ } elseif ( $response === date( 'Y', sby_get_current_time() ) ) {
683
+ update_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice', date( 'Y', sby_get_current_time() ) );
684
+ }
685
+ update_user_meta( $user_id, 'sby_ignore_new_user_sale_notice', 'always' );
686
+ }
687
+
688
+ }
689
+ add_action( 'admin_init', 'sby_process_nags' );
690
+
691
+ function sby_get_future_date( $month, $year, $week, $day, $direction ) {
692
+ if ( $direction > 0 ) {
693
+ $startday = 1;
694
+ } else {
695
+ $startday = date( 't', mktime(0, 0, 0, $month, 1, $year ) );
696
+ }
697
+
698
+ $start = mktime( 0, 0, 0, $month, $startday, $year );
699
+ $weekday = date( 'N', $start );
700
+
701
+ $offset = 0;
702
+ if ( $direction * $day >= $direction * $weekday ) {
703
+ $offset = -$direction * 7;
704
+ }
705
+
706
+ $offset += $direction * ($week * 7) + ($day - $weekday);
707
+ return mktime( 0, 0, 0, $month, $startday + $offset, $year );
708
+ }
inc/admin/class-sbspf-admin.php ADDED
@@ -0,0 +1,849 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( '-1' );
4
+ }
5
+
6
+ class SB_YOUTUBE_Admin {
7
+
8
+ protected $vars;
9
+
10
+ protected $base_path;
11
+
12
+ protected $slug;
13
+
14
+ protected $plugin_name;
15
+
16
+ protected $capability;
17
+
18
+ protected $tabs;
19
+
20
+ protected $active_tab;
21
+
22
+ protected $settings_sections;
23
+
24
+ protected $display_your_feed_sections;
25
+
26
+ protected $option_name;
27
+
28
+ protected $types;
29
+
30
+ protected $layouts;
31
+
32
+ protected $false_fields;
33
+
34
+ protected $textarea_fields;
35
+
36
+ public function __construct( $vars, $base_path, $slug, $plugin_name, $capability, $icon, $position, $tabs, $settings, $active_tab = false, $option_name = 'sbspf_settings' ) {
37
+ $this->vars = $vars;
38
+ $this->base_path = $base_path;
39
+ $this->slug = $slug;
40
+ $this->plugin_name = $plugin_name;
41
+ $this->capability = $capability;
42
+ $this->icon = $icon;
43
+ $this->position = $position;
44
+
45
+ $this->tabs = $tabs;
46
+
47
+ if ( $active_tab ) {
48
+ $this->set_active_tab( $active_tab );
49
+ } else {
50
+ $this->set_active_tab( $tabs[0]['slug'] );
51
+ }
52
+ $this->settings = $settings;
53
+ $this->option_name = $option_name;
54
+ $this->false_fields = array();
55
+ $this->textarea_fields = array();
56
+ $this->display_your_feed_sections = array();
57
+ }
58
+
59
+ public function get_vars() {
60
+ return $this->vars;
61
+ }
62
+
63
+ public function get_option_name() {
64
+ return $this->option_name;
65
+ }
66
+
67
+ public function verify_post( $post ) {
68
+ return wp_verify_nonce( $post[ $this->option_name . '_validate' ], $this->option_name . '_validate' );
69
+ }
70
+
71
+ public function hidden_fields_for_tab( $tab ) {
72
+ wp_nonce_field( $this->get_option_name() . '_validate', $this->get_option_name() . '_validate', true, true );
73
+ ?>
74
+ <input type="hidden" name="<?php echo $this->get_option_name() . '_tab_marker'; ?>" value="<?php echo esc_attr( $tab ); ?>"/>
75
+ <?php
76
+ }
77
+
78
+ public function init() {
79
+ add_action( 'admin_menu', array( $this, 'create_menus' ) );
80
+ add_action( 'admin_init', array( $this, 'settings_init' ) );
81
+ add_action( 'admin_init', array( $this, 'additional_settings_init' ) );
82
+
83
+ }
84
+
85
+ public function settings_init() {
86
+ $text_domain = $this->vars->text_domain();
87
+ /**
88
+ * Configure Tab
89
+ */
90
+ $args = array(
91
+ 'id' => 'sbspf_types',
92
+ 'tab' => 'configure',
93
+ 'save_after' => 'true'
94
+ );
95
+ $this->add_settings_section( $args );
96
+
97
+ /* Types */
98
+ $args = array(
99
+ 'name' => 'type',
100
+ 'section' => 'sbspf_types',
101
+ 'callback' => 'types',
102
+ 'title' => '<label>' . __( 'Feed Type', $text_domain ) .'</label>',
103
+ 'shortcode' => array(
104
+ 'key' => 'channel',
105
+ 'example' => 'smashballoon',
106
+ 'description' => __( 'Display videos from a YouTube channel (channel)', $text_domain ),
107
+ 'display_section' => 'configure'
108
+ ),
109
+ 'types' => $this->types
110
+ );
111
+ $this->add_settings_field( $args );
112
+
113
+ $args = array(
114
+ 'name' => 'preserve_settings',
115
+ 'section' => 'sbspf_types',
116
+ 'callback' => 'checkbox',
117
+ 'title' => __( 'Preserve settings when plugin is removed', $text_domain ),
118
+ 'default' => false,
119
+ 'tooltip_info' => __( 'When removing the plugin your settings are automatically erased. Checking this box will prevent any settings from being deleted. This means that you can uninstall and reinstall the plugin without losing your settings.', $text_domain )
120
+ );
121
+ $this->add_settings_field( $args );
122
+
123
+ /* Cache */
124
+ $args = array(
125
+ 'name' => 'cache',
126
+ 'section' => 'sbspf_types',
127
+ 'callback' => 'cache',
128
+ 'title' => __( 'Check for new posts', $text_domain )
129
+ );
130
+ $this->add_settings_field( $args );
131
+
132
+ /**
133
+ * Customize Tab
134
+ */
135
+ $args = array(
136
+ 'title' => __( 'General', $text_domain ),
137
+ 'id' => 'sbspf_general',
138
+ 'tab' => 'customize',
139
+ 'save_after' => 'true'
140
+ );
141
+ $this->add_settings_section( $args );
142
+
143
+ /* Width and Height */
144
+ $select_options = array(
145
+ array(
146
+ 'label' => '%',
147
+ 'value' => '%'
148
+ ),
149
+ array(
150
+ 'label' => 'px',
151
+ 'value' => 'px'
152
+ )
153
+ );
154
+
155
+ $args = array(
156
+ 'name' => 'width',
157
+ 'default' => '100',
158
+ 'section' => 'sbspf_general',
159
+ 'callback' => 'text',
160
+ 'min' => 1,
161
+ 'size' => 4,
162
+ 'title' => __( 'Width of Feed', $text_domain ),
163
+ 'shortcode' => array(
164
+ 'key' => 'width',
165
+ 'example' => '300px',
166
+ 'description' => __( 'The width of your feed. Any number with a unit like "px" or "%".', $text_domain ),
167
+ 'display_section' => 'customize'
168
+ ),
169
+ 'select_name' => 'widthunit',
170
+ 'select_options' => $select_options,
171
+ 'hidden' => array(
172
+ 'callback' => 'checkbox',
173
+ 'name' => 'width_responsive',
174
+ 'label' => __( 'Set to be 100% width on mobile?', $text_domain ),
175
+ 'before' => '<div id="sbspf_width_options">',
176
+ 'after' => '</div>',
177
+ 'tooltip_info' => __( 'If you set a width on the feed then this will be used on mobile as well as desktop. Check this setting to set the feed width to be 100% on mobile so that it is responsive.', $text_domain )
178
+ ),
179
+ );
180
+ $this->add_settings_field( $args );
181
+
182
+ $select_options = array(
183
+ array(
184
+ 'label' => '%',
185
+ 'value' => '%'
186
+ ),
187
+ array(
188
+ 'label' => 'px',
189
+ 'value' => 'px'
190
+ )
191
+ );
192
+ $args = array(
193
+ 'name' => 'height',
194
+ 'default' => '',
195
+ 'section' => 'sbspf_general',
196
+ 'callback' => 'text',
197
+ 'min' => 1,
198
+ 'size' => 4,
199
+ 'title' => __( 'Height of Feed', $text_domain ),
200
+ 'shortcode' => array(
201
+ 'key' => 'height',
202
+ 'example' => '500px',
203
+ 'description' => __( 'The height of your feed. Any number with a unit like "px" or "em".', $text_domain ),
204
+ 'display_section' => 'customize'
205
+ ),
206
+ 'select_name' => 'heightunit',
207
+ 'select_options' => $select_options,
208
+ );
209
+ $this->add_settings_field( $args );
210
+
211
+ $args = array(
212
+ 'name' => 'background',
213
+ 'default' => '',
214
+ 'section' => 'sbspf_general',
215
+ 'callback' => 'color',
216
+ 'title' => __( 'Background Color', $text_domain ),
217
+ 'shortcode' => array(
218
+ 'key' => 'background',
219
+ 'example' => '#f00',
220
+ 'description' => __( 'Background color for the feed. Any hex color code.', $text_domain ),
221
+ 'display_section' => 'customize'
222
+ ),
223
+ );
224
+ $this->add_settings_field( $args );
225
+
226
+ $args = array(
227
+ 'title' => __( 'Layout', $text_domain ),
228
+ 'id' => 'sbspf_layout',
229
+ 'tab' => 'customize',
230
+ 'save_after' => 'true'
231
+ );
232
+ $this->add_settings_section( $args );
233
+
234
+ $args = array(
235
+ 'name' => 'layout',
236
+ 'section' => 'sbspf_layout',
237
+ 'callback' => 'layout',
238
+ 'title' => __( 'Layout Type', $text_domain ),
239
+ 'layouts' => $this->layouts,
240
+ 'shortcode' => array(
241
+ 'key' => 'layout',
242
+ 'example' => 'list',
243
+ 'description' => __( 'How your posts are display visually.', $text_domain ),
244
+ 'display_section' => 'layout'
245
+ )
246
+ );
247
+ $this->add_settings_field( $args );
248
+ }
249
+
250
+ public function additional_settings_init() {
251
+
252
+ }
253
+
254
+ public function add_false_field( $name, $tab ) {
255
+ $this->false_fields[ $tab ][] = $name;
256
+ }
257
+
258
+ public function get_false_fields( $tab ) {
259
+ if ( isset( $this->false_fields[ $tab ] ) ) {
260
+ return $this->false_fields[ $tab ];
261
+ }
262
+
263
+ return array();
264
+ }
265
+
266
+ public function add_textarea_field( $name, $tab ) {
267
+ $this->textarea_fields[ $tab ][] = $name;
268
+ }
269
+
270
+ public function get_textarea_fields( $tab ) {
271
+ if ( isset( $this->textarea_fields[ $tab ] ) ) {
272
+ return $this->textarea_fields[ $tab ];
273
+ }
274
+
275
+ return array();
276
+ }
277
+
278
+ public function blank() {
279
+
280
+ }
281
+
282
+ public function add_settings_section( $args ) {
283
+ $title = isset( $args['title'] ) ? $args['title'] : '';
284
+ $callback = isset( $args['callback'] ) ? $args['callback'] : array( $this, 'blank' );
285
+ add_settings_section(
286
+ $args['id'],
287
+ $title,
288
+ $callback,
289
+ $args['id']
290
+ );
291
+
292
+ $save_after = isset( $args['save_after'] ) ? $args['save_after'] : false;
293
+ $this->settings_sections[ $args['tab'] ][] = array(
294
+ 'id' => $args['id'],
295
+ 'save_after' => $save_after
296
+ );
297
+ }
298
+
299
+ public function add_settings_field( $args ) {
300
+ $title_after = '';
301
+ $shortcode = false;
302
+ if ( isset( $args['shortcode'] ) ) {
303
+ $title_after = isset( $args['shortcode']['after'] ) ? $args['shortcode']['after'] : '';
304
+ $shortcode = $args['shortcode'];
305
+ }
306
+ $title = $this->format_title( $args['title'], $args['name'], $shortcode, $title_after );
307
+
308
+ if ( $args['callback'] === 'checkbox' || (isset( $args['falsefield'] ) && $args['falsefield'] === true) ) {
309
+ $tab = 'none';
310
+ foreach ( $this->settings_sections as $key => $settings_sections ) {
311
+ foreach ( $settings_sections as $this_tab_sections ) {
312
+ if ( $this_tab_sections['id'] === $args['section'] ) {
313
+ $tab = $key;
314
+ }
315
+ }
316
+
317
+ }
318
+ $this->add_false_field( $args['name'], $tab );
319
+ }
320
+
321
+ if ( $args['callback'] === 'textarea' ) {
322
+ $tab = 'none';
323
+ foreach ( $this->settings_sections as $key => $settings_sections ) {
324
+ foreach ( $settings_sections as $this_tab_sections ) {
325
+ if ( $this_tab_sections['id'] === $args['section'] ) {
326
+ $tab = $key;
327
+ }
328
+ }
329
+
330
+ }
331
+ $this->add_textarea_field( $args['name'], $tab );
332
+ }
333
+
334
+ add_settings_field(
335
+ $args['name'],
336
+ $title,
337
+ array( $this, $args['callback'] ),
338
+ $args['section'],
339
+ $args['section'],
340
+ $args
341
+ );
342
+
343
+ if ( $shortcode ) {
344
+ $this->display_your_feed_sections[ $shortcode['display_section'] ]['settings'][] = $shortcode;
345
+ }
346
+
347
+ if ( isset( $args['hidden'] ) ) {
348
+ if ( $args['hidden']['callback'] === 'checkbox' ) {
349
+ $tab = 'none';
350
+ foreach ( $this->settings_sections as $key => $settings_sections ) {
351
+ foreach ( $settings_sections as $this_tab_sections ) {
352
+ if ( $this_tab_sections['id'] === $args['section'] ) {
353
+ $tab = $key;
354
+ }
355
+ }
356
+
357
+ }
358
+ $this->add_false_field( $args['hidden']['name'], $tab );
359
+ }
360
+ }
361
+ }
362
+
363
+ public function set_feed_types( $types ) {
364
+ $this->types = $types;
365
+ }
366
+
367
+ public function set_feed_layouts( $layouts ) {
368
+ $this->layouts = $layouts;
369
+ }
370
+
371
+ public function set_display_table_sections( $headings ) {
372
+ foreach ( $headings as $heading ) {
373
+ $this->display_your_feed_sections[ $heading['slug'] ] = array(
374
+ 'label' => $heading['label'],
375
+ 'settings' => array()
376
+ );
377
+ }
378
+ }
379
+
380
+ public function checkbox( $args ) {
381
+ $default = isset( $args['default'] ) ? $args['default'] : false;
382
+ $selected = isset( $this->settings[ $args['name'] ] ) ? $this->settings[ $args['name'] ] : $default;
383
+ $label = isset( $args['label'] ) ? $args['label'] : __( 'Yes' );
384
+ $tooltip_text = isset( $args['tooltip_text'] ) ? $args['label'] : $this->default_tooltip_text();
385
+ ?>
386
+ <input name="<?php echo $this->option_name .'['.esc_attr( $args['name'] ).']'; ?>" id="<?php echo $this->option_name . '_' . $args['name']; ?>" type="checkbox"<?php if ( $selected ) echo ' checked'; ?>/>
387
+ <label for="<?php echo $this->option_name . '_' . $args['name']; ?>"><?php echo esc_html( $label ); ?></label>
388
+ <?php if ( isset( $args['tooltip_info'] ) ) : ?>
389
+ <a class="sbspf_tooltip_link" href="JavaScript:void(0);"><?php echo $tooltip_text; ?></a>
390
+ <p class="sbspf_tooltip sbspf_more_info"><?php echo $args['tooltip_info']; ?></p>
391
+ <?php
392
+ endif;
393
+ }
394
+
395
+ public function text( $args ) {
396
+ $default = isset( $args['default'] ) ? $args['default'] : '';
397
+ $value = isset( $this->settings[ $args['name'] ] ) ? $this->settings[ $args['name'] ] : $default;
398
+ $size = ( isset( $args['size'] ) ) ? ' size="'. $args['size'].'"' : '';
399
+ $class = isset( $args['class'] ) ? ' class="'. esc_attr( $args['class'] ) . '"' : '';
400
+
401
+ $tooltip_text = isset( $args['tooltip_text'] ) ? $args['label'] : $this->default_tooltip_text();
402
+
403
+ if ( isset( $args['min'] ) ) :
404
+ $min = ( isset( $args['min'] ) ) ? ' min="'. $args['min'].'"' : '';
405
+ $max = ( isset( $args['max'] ) ) ? ' max="'. $args['max'].'"' : '';
406
+ $step = ( isset( $args['step'] ) ) ? ' step="'. $args['step'].'"' : '';
407
+ $class = isset( $args['class'] ) ? ' class="sbspf_number_field sbspf_size_' . $args['size'] . ' '. esc_attr( $args['class'] ) . '"' : ' class="sbspf_number_field sbspf_size_' . $args['size'] . '"';
408
+ ?>
409
+ <input name="<?php echo $this->option_name.'['.$args['name'].']'; ?>" id="<?php echo $this->option_name . '_' . $args['name']; ?>"<?php echo $class; ?> type="number"<?php echo $size; ?><?php echo $min; ?><?php echo $max; ?><?php echo $step; ?> value="<?php echo esc_attr( $value ); ?>" />
410
+ <?php elseif ( isset( $args['color'] ) ) : ?>
411
+ <input name="<?php echo $this->option_name.'['.$args['name'].']'; ?>" id="<?php echo $this->option_name . '_' . $args['name']; ?>" class="sbspf_colorpicker" type="text" value="#<?php echo esc_attr( str_replace('#', '', $value ) ); ?>" />
412
+ <?php else: ?>
413
+ <input name="<?php echo $this->option_name.'['.$args['name'].']'; ?>" id="<?php echo $this->option_name . '_' . $args['name']; ?>"<?php echo $class; ?> type="text" value="<?php echo esc_attr( stripslashes( $value ) ); ?>" />
414
+ <?php endif; ?>
415
+
416
+ <?php if ( isset( $args['select_options'] ) ) :
417
+ $value = isset( $this->settings[ $args['select_name'] ] ) ? $this->settings[ $args['select_name'] ] : $args['select_options'][0]['value'];
418
+ ?>
419
+ <select name="<?php echo $this->option_name.'['.$args['select_name'].']'; ?>" id="<?php echo $this->option_name . '_' . $args['select_name']; ?>">
420
+ <?php foreach ( $args['select_options'] as $select_option ) : ?>
421
+ <option value="<?php echo esc_attr( $select_option['value'] ); ?>"<?php if ( (string)$select_option['value'] === (string)$value ) echo ' selected'; ?>><?php echo esc_html( $select_option['label'] ); ?></option>
422
+ <?php endforeach; ?>
423
+ </select>
424
+ <?php endif; ?>
425
+
426
+ <?php if ( isset( $args['hidden'] ) ) : ?>
427
+
428
+ <?php
429
+ if ( is_callable( array( $this, $args['hidden']['callback'] ) ) ){
430
+ echo $args['hidden']['before'];
431
+ call_user_func_array(
432
+ array( $this, $args['hidden']['callback'] ),
433
+ array( $args['hidden'] )
434
+ );
435
+ echo $args['hidden']['after'];
436
+ }
437
+ ?>
438
+ <?php endif; ?>
439
+
440
+ <?php if ( isset( $args['additional'] ) ) : ?>
441
+ <?php echo $args['additional']; ?>
442
+ <?php endif; ?>
443
+
444
+ <?php if ( isset( $args['tooltip_info'] ) ) : ?>
445
+ <a class="sbspf_tooltip_link" href="JavaScript:void(0);"><?php echo $tooltip_text; ?></a>
446
+ <p class="sbspf_tooltip sbspf_more_info"><?php echo $args['tooltip_info']; ?></p>
447
+ <?php
448
+ endif;
449
+ }
450
+
451
+ public function select( $args ) {
452
+ $default = isset( $args['default'] ) ? $args['default'] : $args['options'][0]['value'];
453
+ $value = isset( $this->settings[ $args['name'] ] ) ? $this->settings[ $args['name'] ] : $default;
454
+
455
+ if ( isset( $args['min'] ) && isset( $args['max'] ) && ((int)$args['min'] < (int)$args['max']) && empty( $args['options'] ) ) {
456
+ $args['options'] = array();
457
+ $i = (int)$args['min'];
458
+
459
+ while ( $i <= (int)$args['max'] ) {
460
+ $args['options'][] = array(
461
+ 'label' => $i,
462
+ 'value' => $i
463
+ );
464
+ $i++;
465
+ }
466
+ }
467
+
468
+ $tooltip_text = isset( $args['tooltip_text'] ) ? $args['label'] : $this->default_tooltip_text();
469
+ ?>
470
+ <select name="<?php echo $this->option_name.'['.$args['name'].']'; ?>" id="<?php echo $this->option_name . '_' . $args['name']; ?>">
471
+ <?php foreach ( $args['options'] as $select_option ) : ?>
472
+ <option value="<?php echo esc_attr( $select_option['value'] ); ?>"<?php if ( (string)$select_option['value'] === (string)$value ) echo ' selected'; ?>><?php echo esc_html( $select_option['label'] ); ?></option>
473
+ <?php endforeach; ?>
474
+ </select>
475
+
476
+ <?php if ( isset( $args['additional'] ) ) : ?>
477
+ <?php echo $args['additional']; ?>
478
+ <?php endif; ?>
479
+
480
+ <?php if ( isset( $args['tooltip_info'] ) ) : ?>
481
+ <a class="sbspf_tooltip_link" href="JavaScript:void(0);"><?php echo $tooltip_text; ?></a>
482
+ <p class="sbspf_tooltip sbspf_more_info"><?php echo $args['tooltip_info']; ?></p>
483
+ <?php endif;
484
+ }
485
+
486
+ public function textarea( $args ) {
487
+ $default = isset( $args['default'] ) ? $args['default'] : '';
488
+ $value = isset( $this->settings[ $args['name'] ] ) ? stripslashes( $this->settings[ $args['name'] ] ) : $default;
489
+
490
+ if ( isset( $args['tooltip_info'] ) ) : ?>
491
+ <span><?php echo $args['tooltip_info']; ?></span><br>
492
+ <?php endif; ?>
493
+
494
+ <textarea name="<?php echo $this->option_name.'['.$args['name'].']'; ?>" id="<?php echo $this->option_name . '_' . $args['name']; ?>"rows="7"><?php echo $value; ?></textarea>
495
+
496
+ <?php if ( isset( $args['note'] ) ) : ?>
497
+ <br><span class="sbspf_note"><?php echo $args['note']; ?></span>
498
+ <?php endif;
499
+ }
500
+
501
+ public function color( $args ) {
502
+ $args['color'] = true;
503
+ $this->text( $args );
504
+ }
505
+
506
+ public function types( $args ) {
507
+ $type_selected = isset( $this->settings[ $args['name'] ] ) ? $this->settings[ $args['name'] ] : $args['types'][0]['slug'];
508
+
509
+ foreach ( $args['types'] as $type ) :
510
+ $input_type = isset( $type['input_type'] ) ? $type['input_type'] : 'connected_account';
511
+ $selected = isset( $this->settings[ $type['slug'] ] ) ? $this->settings[ $type['slug'] ] : '';
512
+ if ( $input_type === 'connected_account' ) {
513
+ $selected = isset( $this->settings[ $type['slug'] . '_ids' ] ) ? $this->settings[ $type['slug'] . '_ids' ] : array();
514
+ }
515
+ ?>
516
+ <div class="sbspf_row" style="min-height: 29px;">
517
+ <div class="sbspf_col sbspf_one">
518
+ <input type="radio" name="<?php echo $this->option_name.'['.esc_attr( $args['name'] ).']'; ?>" id="sbspf_type_<?php echo esc_attr( $type['slug'] ); ?>" value="<?php echo esc_attr( $type['slug'] ); ?>"<?php if ( $type_selected === $type['slug'] ) echo 'checked'; ?>>
519
+ <label class="sbspf_radio_label" for="sbspf_type_<?php echo esc_attr( $type['slug'] ); ?>"><?php echo esc_html( $type['label'] ); ?>: <a class="sbspf_type_tooltip_link" href="JavaScript:void(0);"><i class="fa fa-question-circle" aria-hidden="true" style="margin-left: 2px;"></i></a></label>
520
+ </div>
521
+ <div class="sbspf_col sbspf_two">
522
+ <?php if ( $input_type === 'text' ) : ?>
523
+ <input name="<?php echo $this->option_name.'['.esc_attr( $type['slug'] ).']'; ?>" id="sbspf_<?php echo esc_attr( $type['slug'] ); ?>" type="text" value="<?php echo esc_attr( $selected ); ?>" size="45">
524
+ <?php else :
525
+ $connected_accounts = $this->get_connected_accounts(); ?>
526
+ <div class="sbspf_<?php echo esc_attr( $type['slug'] ); ?>_feed_ids_wrap">
527
+ <?php foreach ( $connected_accounts as $connected_account ) : if ( in_array( $connected_account['channel_id'], $selected, true ) ) : ?>
528
+ <div id="sbspf_<?php echo esc_attr( $type['slug'] ); ?>_feed_id_<?php echo esc_attr( $connected_account['channel_id'] ); ?>" class="sbspf_<?php echo esc_attr( $type['slug'] ); ?>_feed_account_wrap">
529
+ <strong><?php echo esc_html( $connected_account['username'] ); ?></strong> <span>(<?php echo esc_attr( $connected_account['channel_id'] ); ?>)</span><input type="hidden" name="<?php echo $this->option_name.'['.esc_attr( $type['slug'] ).'_feed_ids][]'; ?>" value="<?php echo esc_attr( $connected_account['channel_id'] ); ?>">
530
+ </div>
531
+ <?php endif; endforeach; ?>
532
+ </div>
533
+ <?php if ( empty( $selected ) ) : ?>
534
+ <p class="sbspf_no_accounts" style="margin-top: -3px; margin-right: 10px;"><?php _e( 'Connect an account above', $this->vars->text_domain() ); ?></p>
535
+ <?php endif; ?>
536
+
537
+ <?php endif; ?>
538
+ <?php if ( isset( $type['note'] ) ) : ?>
539
+ <br><span class="sbspf_note"><?php echo $type['note']; ?></span>
540
+ <?php endif; ?>
541
+ </div>
542
+
543
+ <div class="sbspf_tooltip sbspf_type_tooltip sbspf_more_info">
544
+ <?php if ( ! empty( $type['tooltip'] ) ) : ?>
545
+ <?php echo $type['tooltip']; ?>
546
+ <?php endif; ?>
547
+ </div>
548
+ </div>
549
+ <?php endforeach;
550
+ }
551
+
552
+ public function cache( $args ) {
553
+ $social_network = $this->vars->social_network();
554
+ $type_selected = isset( $this->settings['caching_type'] ) ? $this->settings['caching_type'] : 'page';
555
+ $caching_time = isset( $this->settings['caching_time'] ) ? $this->settings['caching_time'] : 1;
556
+ $cache_time_unit_selected = isset( $this->settings['cache_time_unit'] ) ? $this->settings['cache_time_unit'] : 'hours';
557
+ $cache_cron_interval_selected = isset( $this->settings['cache_cron_interval'] ) ? $this->settings['cache_cron_interval'] : '';
558
+ $cache_cron_time = isset( $this->settings['cache_cron_time'] ) ? $this->settings['cache_cron_time'] : '';
559
+ $cache_cron_am_pm = isset( $this->settings['cache_cron_am_pm'] ) ? $this->settings['cache_cron_am_pm'] : '';
560
+
561
+ ?>
562
+ <div class="sbspf_cache_settings_wrap">
563
+ <div class="sbspf_row">
564
+ <input type="radio" name="<?php echo $this->option_name.'[caching_type]'; ?>" class="sbspf_caching_type_input" id="sbspf_caching_type_page" value="page"<?php if ( $type_selected === 'page' ) echo ' checked'?>>
565
+ <label class="sbspf_radio_label" for="sbspf_caching_type_page"><?php _e ( 'When the page loads', $this->vars->text_domain() ); ?></label>
566
+ <a class="sbspf_tooltip_link sbspf_tooltip_link" href="JavaScript:void(0);" style="position: relative; top: 2px;"><?php echo $this->default_tooltip_text() ?></a>
567
+ <p class="sbspf_tooltip sbspf_more_info"><?php echo sprintf( __( "Your %s data is temporarily cached by the plugin in your WordPress database. There are two ways that you can set the plugin to check for new data:<br><br>
568
+ <b>1. When the page loads</b><br>Selecting this option means that when the cache expires then the plugin will check %s for new posts the next time that the feed is loaded. You can choose how long this data should be cached for. If you set the time to 60 minutes then the plugin will clear the cached data after that length of time, and the next time the page is viewed it will check for new data. <b>Tip:</b> If you're experiencing an issue with the plugin not updating automatically then try enabling the setting labeled <b>'Force cache to clear on interval'</b> which is located on the 'Customize' tab.<br><br>
569
+ <b>2. In the background</b><br>Selecting this option means that the plugin will check for new data in the background so that the feed is updated behind the scenes. You can select at what time and how often the plugin should check for new data using the settings below. <b>Please note</b> that the plugin will initially check for data from Instagram when the page first loads, but then after that will check in the background on the schedule selected - unless the cache is cleared.", $this->vars->text_domain() ), $social_network, $social_network ); ?>
570
+ </p>
571
+ </div>
572
+ <div class="sbspf_row sbspf-caching-page-options" style="display: none;">
573
+ <?php _e ( 'Every', $this->vars->text_domain() ); ?>:
574
+ <input name="<?php echo $this->option_name.'[caching_time]'; ?>" type="text" value="<?php echo esc_attr( $caching_time ); ?>" size="4">
575
+ <select name="<?php echo $this->option_name.'[caching_time_unit]'; ?>">
576
+ <option value="minutes"<?php if ( $cache_time_unit_selected === 'minutes' ) echo ' selected'?>><?php _e ( 'Minutes', $this->vars->text_domain() ); ?></option>
577
+ <option value="hours"<?php if ( $cache_time_unit_selected === 'hours' ) echo ' selected'?>><?php _e ( 'Hours', $this->vars->text_domain() ); ?></option>
578
+ <option value="days"<?php if ( $cache_time_unit_selected === 'days' ) echo ' selected'?>><?php _e ( 'Days', $this->vars->text_domain() ); ?></option>
579
+ </select>
580
+ <a class="sbspf_tooltip_link" href="JavaScript:void(0);"><?php _e ( 'What does this mean?', $this->vars->text_domain() ); ?></a>
581
+ <p class="sbspf_tooltip sbspf_more_info"><?php echo sprintf( __("Your %s posts are temporarily cached by the plugin in your WordPress database. You can choose how long the posts should be cached for. If you set the time to 1 hour then the plugin will clear the cache after that length of time and check %s for posts again.", $this->vars->text_domain() ), $social_network, $social_network ); ?></p>
582
+ </div>
583
+
584
+ <div class="sbspf_row">
585
+ <input type="radio" name="<?php echo $this->option_name.'[caching_type]'; ?>" id="sbspf_caching_type_cron" class="sbspf_caching_type_input" value="background" <?php if ( $type_selected === 'background' ) echo ' checked'?>>
586
+ <label class="sbspf_radio_label" for="sbspf_caching_type_cron"><?php _e ( 'In the background', $this->vars->text_domain() ); ?></label>
587
+ </div>
588
+ <div class="sbspf_row sbspf-caching-cron-options" style="display: block;">
589
+
590
+ <select name="<?php echo $this->option_name.'[cache_cron_interval]'; ?>" id="sbspf_cache_cron_interval">
591
+ <option value="30mins"<?php if ( $cache_cron_interval_selected === '30mins' ) echo ' selected'?>><?php _e ( 'Every 30 minutes', $this->vars->text_domain() ); ?></option>
592
+ <option value="1hour"<?php if ( $cache_cron_interval_selected === '1hour' ) echo ' selected'?>><?php _e ( 'Every hour', $this->vars->text_domain() ); ?></option>
593
+ <option value="12hours"<?php if ( $cache_cron_interval_selected === '12hours' ) echo ' selected'?>><?php _e ( 'Every 12 hours', $this->vars->text_domain() ); ?></option>
594
+ <option value="24hours"<?php if ( $cache_cron_interval_selected === '24hours' ) echo ' selected'?>><?php _e ( 'Every 24 hours', $this->vars->text_domain() ); ?></option>
595
+ </select>
596
+
597
+ <div id="sbspf-caching-time-settings" style="">
598
+ <?php _e ( 'at', $this->vars->text_domain() ); ?>
599
+ <select name="<?php echo $this->option_name.'[cache_cron_time]'; ?>" style="width: 80px">
600
+ <option value="1"<?php if ( (int)$cache_cron_time === 1 ) echo ' selected'?>>1:00</option>
601
+ <option value="2"<?php if ( (int)$cache_cron_time === 2 ) echo ' selected'?>>2:00</option>
602
+ <option value="3"<?php if ( (int)$cache_cron_time === 3 ) echo ' selected'?>>3:00</option>
603
+ <option value="4"<?php if ( (int)$cache_cron_time === 4 ) echo ' selected'?>>4:00</option>
604
+ <option value="5"<?php if ( (int)$cache_cron_time === 5 ) echo ' selected'?>>5:00</option>
605
+ <option value="6"<?php if ( (int)$cache_cron_time === 6 ) echo ' selected'?>>6:00</option>
606
+ <option value="7"<?php if ( (int)$cache_cron_time === 7 ) echo ' selected'?>>7:00</option>
607
+ <option value="8"<?php if ( (int)$cache_cron_time === 8 ) echo ' selected'?>>8:00</option>
608
+ <option value="9"<?php if ( (int)$cache_cron_time === 9 ) echo ' selected'?>>9:00</option>
609
+ <option value="10"<?php if ( (int)$cache_cron_time === 10 ) echo ' selected'?>>10:00</option>
610
+ <option value="11"<?php if ( (int)$cache_cron_time === 11 ) echo ' selected'?>>11:00</option>
611
+ <option value="0"<?php if ( (int)$cache_cron_time === 0 ) echo ' selected'?>>12:00</option>
612
+ </select>
613
+
614
+ <select name="<?php echo $this->option_name.'[cache_cron_am_pm]'; ?>" style="width: 50px">
615
+ <option value="am"<?php if ( $cache_cron_am_pm === 'am' ) echo ' selected'?>><?php _e ( 'AM', $this->vars->text_domain() ); ?></option>
616
+ <option value="pm"<?php if ( $cache_cron_am_pm === 'pm' ) echo ' selected'?>><?php _e ( 'PM', $this->vars->text_domain() ); ?></option>
617
+ </select>
618
+ </div>
619
+
620
+ <?php
621
+ if ( wp_next_scheduled( 'sbspf_feed_update' ) ) {
622
+ $time_format = get_option( 'time_format' );
623
+ if ( ! $time_format ) {
624
+ $time_format = 'g:i a';
625
+ }
626
+ //
627
+ $schedule = wp_get_schedule( 'sbspf_feed_update' );
628
+ if ( $schedule == '30mins' ) $schedule = __( 'every 30 minutes', $this->vars->text_domain() );
629
+ if ( $schedule == 'twicedaily' ) $schedule = __( 'every 12 hours', $this->vars->text_domain() );
630
+ $sbspf_next_cron_event = wp_next_scheduled( 'sbspf_feed_update' );
631
+ echo '<p class="sbspf-caching-sched-notice"><span><b>' . __( 'Next check', $this->vars->text_domain() ) . ': ' . date( $time_format, $sbspf_next_cron_event + sbspf_get_utc_offset() ) . ' (' . $schedule . ')</b> - ' . __( 'Note: Saving the settings on this page will clear the cache and reset this schedule', $this->vars->text_domain() ) . '</span></p>';
632
+ } else {
633
+ echo '<p style="font-size: 11px; color: #666;">' . __( 'Nothing currently scheduled', $this->vars->text_domain() ) . '</p>';
634
+ }
635
+ ?>
636
+ </div>
637
+ </div>
638
+ <?php
639
+ }
640
+
641
+ public function layout( $args ) {
642
+ $default = isset( $args['default'] ) ? $args['default'] : $args['layouts'][0]['slug'];
643
+ $value = isset( $this->settings[ $args['name'] ] ) ? $this->settings[ $args['name'] ] : $default;
644
+ ?>
645
+ <div class="sbspf_layouts">
646
+ <?php foreach ( $args['layouts'] as $layout ) : ?>
647
+ <div class="sbspf_layout_cell">
648
+ <input class="sbspf_layout_type" id="sbspf_layout_type_<?php echo esc_attr( $layout['slug'] ); ?>" name="<?php echo $this->option_name.'['.$args['name'].']'; ?>" type="radio" value="<?php echo esc_attr( $layout['slug'] ); ?>"<?php if ( $layout['slug'] === $value ) echo ' checked'?>><label for="sbspf_layout_type_<?php echo esc_attr( $layout['slug'] ); ?>"><span class="sbspf_label"><?php echo $layout['label']; ?></span><img src="<?php echo esc_url( $this->vars->plugin_url() . $layout['image'] ); ?>"></label>
649
+ </div>
650
+ <?php endforeach; ?>
651
+
652
+ <div class="sbspf_layout_options_wrap">
653
+ <?php foreach ( $args['layouts'] as $layout ) : ?>
654
+ <div class="sbspf_layout_settings sbspf_layout_type_<?php echo esc_attr( $layout['slug'] ); ?>">
655
+
656
+ <div class="sbspf_layout_setting">
657
+ <?php echo sby_admin_icon( 'info-circle' ); ?>&nbsp;&nbsp;&nbsp;<span class="sbspf_note" style="margin-left: 0;"><?php echo $layout['note']; ?></span>
658
+ </div>
659
+ <?php if ( ! empty( $layout['options'] ) ) : ?>
660
+ <div class="sbspf_layout_setting">
661
+ <?php foreach ( $layout['options'] as $option ) :
662
+ $option['name'] = $layout['slug'].$option['name'];
663
+ ?>
664
+ <div class="ctf_layout_setting">
665
+
666
+ <label title="<?php echo __( 'Click for shortcode option', $this->vars->text_domain() ); ?>"><?php echo $option['label']; ?></label><code class="sbspf_shortcode"> <?php echo $option['name'] . "\n"; ?>
667
+ Eg: <?php echo $option['name']; ?>=<?php echo $option['shortcode_example']; ?></code><br>
668
+ <?php call_user_func_array( array( $this, $option['callback'] ), array( $option ) ); ?>
669
+
670
+ </div>
671
+
672
+ <?php endforeach; ?>
673
+ </div>
674
+ <?php endif; ?>
675
+
676
+ </div>
677
+
678
+ <?php endforeach; ?>
679
+ </div>
680
+ </div>
681
+ <?php
682
+ }
683
+
684
+ public function format_title( $label, $name, $shortcode_args = false, $after = '' ) {
685
+ $formatted_label = '<label for="' . $this->option_name . '_' . $name . '">' . $label .'</label>';
686
+ if ( $shortcode_args ) {
687
+ $formatted_label .= '<code class="sbspf_shortcode"> ' . $shortcode_args['key'] . "\n";
688
+ $formatted_label .= 'Eg: ' . $shortcode_args['key'] . '=' . $shortcode_args['example'] . '</code><br>';
689
+ }
690
+ $formatted_label .= $after;
691
+
692
+ return $formatted_label;
693
+ }
694
+
695
+ public function validate_options( $input, $tab ) {
696
+ $updated_options = get_option( $this->option_name, array() );
697
+ $false_if_empty_keys = $this->get_false_fields( $tab );
698
+ $textarea_keys = $this->get_textarea_fields( $tab );
699
+
700
+ foreach ( $false_if_empty_keys as $false_key ) {
701
+ $updated_options[ $false_key ] = false;
702
+ }
703
+
704
+ foreach ( $input as $key => $val ) {
705
+ if ( in_array( $key, $false_if_empty_keys ) ) {
706
+ $updated_options[ $key ] = ($val === 'on');
707
+ } elseif ( in_array( $key, $textarea_keys ) ) {
708
+ $updated_options[ $key ] = sanitize_textarea_field( $val );
709
+ } elseif ( is_array( $val ) ) {
710
+ foreach ( $val as $key2 => $val2 ) {
711
+ $updated_options[ $key ][ $key2 ] = sanitize_text_field( $val2 );
712
+ }
713
+ } else {
714
+ $updated_options[ $key ] = sanitize_text_field( $val );
715
+ }
716
+ }
717
+
718
+ if ( $tab === 'configure' ) {
719
+ do_action( $this->option_name . '_after_configure_save', $updated_options );
720
+ }
721
+
722
+ return $updated_options;
723
+ }
724
+
725
+
726
+ public function update_options( $new_settings ) {
727
+ update_option( $this->get_option_name(), $new_settings );
728
+ $this->settings = $new_settings;
729
+ }
730
+
731
+ public function get_sections( $tab ) {
732
+ if ( isset( $this->settings_sections[ $tab ] ) ) {
733
+ return $this->settings_sections[ $tab ];
734
+ }
735
+ return array();
736
+ }
737
+
738
+ public function create_menus() {
739
+ add_menu_page(
740
+ $this->plugin_name,
741
+ $this->plugin_name,
742
+ $this->capability,
743
+ $this->slug,
744
+ array( $this, 'create_options_page' ),
745
+ $this->icon,
746
+ $this->position
747
+ );
748
+
749
+ foreach ( $this->tabs as $tab ) {
750
+ $title = isset( $tab['title'] ) ? $tab['title'] : '';
751
+ $capability = isset( $tab['capability'] ) ? $tab['capability'] : 'manage_options';
752
+ $slug = isset( $tab['slug'] ) ? $tab['slug'] : '';
753
+ $callback = isset( $tab['callback'] ) ? $tab['callback'] : array( $this, 'create_options_page' );
754
+
755
+ add_submenu_page(
756
+ $this->slug,
757
+ $title,
758
+ $title,
759
+ $capability,
760
+ $this->slug . '_' . $slug,
761
+ $callback
762
+ );
763
+ }
764
+
765
+ }
766
+
767
+ public function set_active_tab( $active_tab ) {
768
+ foreach ( $this->tabs as $tab ) {
769
+ if ( $tab['slug'] === $active_tab ) {
770
+ $this->active_tab = $tab['slug'];
771
+ }
772
+ }
773
+ }
774
+
775
+ public function get_tabs() {
776
+ return $this->tabs;
777
+ }
778
+
779
+ public function get_active_tab() {
780
+ return $this->active_tab;
781
+ }
782
+
783
+ public function get_slug() {
784
+ return $this->slug;
785
+ }
786
+
787
+ public function get_plugin_name() {
788
+ return $this->plugin_name;
789
+ }
790
+
791
+ public function get_path( $view ) {
792
+ return trailingslashit( $this->base_path ) . $view . '.php';
793
+ }
794
+
795
+ public function create_options_page() {
796
+ require_once trailingslashit( $this->base_path ) . 'main.php';
797
+ }
798
+
799
+ public function next_step() {
800
+ $return = array();
801
+ $i = 0;
802
+ foreach ( $this->tabs as $tab ) {
803
+ if ( $this->active_tab === $tab['slug'] && isset( $tab['next_step_instructions'] ) ) {
804
+ $next_tab_slug = isset( $this->tabs[ $i + 1 ]['slug'] ) ? $this->tabs[ $i + 1 ]['slug'] : $tab['slug'];
805
+ $return = array(
806
+ 'instructions' => $tab['next_step_instructions'],
807
+ 'next_tab' => $next_tab_slug
808
+ );
809
+ }
810
+ $i++;
811
+ }
812
+ return $return;
813
+ }
814
+
815
+ public function get_connected_accounts() {
816
+ global $sbspf_settings;
817
+
818
+ if ( isset( $sbspf_settings['connected_accounts'] ) ) {
819
+ return $sbspf_settings['connected_accounts'];
820
+ }
821
+ return array();
822
+ }
823
+
824
+ public static function connect_account( $args ) {
825
+ global $sbspf_settings;
826
+
827
+ // do connection
828
+
829
+ // random fake data
830
+ $account_id = time();
831
+
832
+ $sbspf_settings['connected_accounts'][ $account_id ] = array(
833
+ 'access_token' => 'at_' . str_shuffle( $account_id ),
834
+ 'channel_id' => $account_id,
835
+ 'username' => 'test' . $account_id,
836
+ 'is_valid' => true,
837
+ 'last_checked' => time(),
838
+ 'profile_picture' => $args['profile_picture']
839
+ );
840
+
841
+ update_option( 'sbspf_settings', $sbspf_settings );
842
+
843
+ return $sbspf_settings['connected_accounts'][ $account_id ];
844
+ }
845
+
846
+ public function default_tooltip_text() {
847
+ return '<span class="screen-reader-text">' . __( 'What does this mean?', $this->vars->text_domain() ) . '</span>' . sby_admin_icon( 'question-circle' );
848
+ }
849
+ }
inc/admin/class-sby-admin.php ADDED
@@ -0,0 +1,448 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( '-1' );
4
+ }
5
+
6
+ class SBY_Admin extends SB_YOUTUBE_Admin {
7
+
8
+ public function additional_settings_init() {
9
+ $text_domain = SBY_TEXT_DOMAIN;
10
+
11
+ $args = array(
12
+ 'name' => 'num',
13
+ 'default' => 8,
14
+ 'section' => 'sbspf_layout',
15
+ 'callback' => 'text',
16
+ 'min' => 1,
17
+ 'max' => 50,
18
+ 'size' => 4,
19
+ 'title' => __( 'Number of Videos', $text_domain ),
20
+ 'additional' => '<span class="sby_note">' . __( 'Number of videos to show initially.', $text_domain ) . '</span>',
21
+ 'shortcode' => array(
22
+ 'key' => 'num',
23
+ 'example' => 5,
24
+ 'description' => __( 'The number of videos in the feed', $text_domain ),
25
+ 'display_section' => 'layout'
26
+ )
27
+ );
28
+ $this->add_settings_field( $args );
29
+
30
+ $select_options = array(
31
+ array(
32
+ 'label' => 'px',
33
+ 'value' => 'px'
34
+ ),
35
+ array(
36
+ 'label' => '%',
37
+ 'value' => '%'
38
+ )
39
+ );
40
+ $args = array(
41
+ 'name' => 'itemspacing',
42
+ 'default' => 5,
43
+ 'section' => 'sbspf_layout',
44
+ 'callback' => 'text',
45
+ 'min' => 0,
46
+ 'size' => 4,
47
+ 'title' => __( 'Spacing between videos', $text_domain ),
48
+ 'shortcode' => array(
49
+ 'key' => 'itemspacing',
50
+ 'example' => '5px',
51
+ 'description' => __( 'The spacing/padding around the videos in the feed. Any number with a unit like "px" or "em".', $text_domain ),
52
+ 'display_section' => 'layout'
53
+ ),
54
+ 'select_name' => 'itemspacingunit',
55
+ 'select_options' => $select_options,
56
+ );
57
+ $this->add_settings_field( $args );
58
+
59
+ $args = array(
60
+ 'title' => __( 'Header', $text_domain ),
61
+ 'id' => 'sbspf_header',
62
+ 'tab' => 'customize',
63
+ );
64
+ $this->add_settings_section( $args );
65
+
66
+ $args = array(
67
+ 'name' => 'showheader',
68
+ 'section' => 'sbspf_header',
69
+ 'callback' => 'checkbox',
70
+ 'title' => __( 'Show Header', $text_domain ),
71
+ 'default' => true,
72
+ 'shortcode' => array(
73
+ 'key' => 'showheader',
74
+ 'example' => 'false',
75
+ 'description' => __( 'Include a header for this feed.', $text_domain ),
76
+ 'display_section' => 'header'
77
+ )
78
+ );
79
+ $this->add_settings_field( $args );
80
+
81
+ $args = array(
82
+ 'name' => 'showdescription',
83
+ 'section' => 'sbspf_header',
84
+ 'callback' => 'checkbox',
85
+ 'title' => __( 'Show Channel Description', $text_domain ),
86
+ 'default' => true,
87
+ 'shortcode' => array(
88
+ 'key' => 'showdescription',
89
+ 'example' => 'false',
90
+ 'description' => __( 'Include the channel description in the header.', $text_domain ),
91
+ 'display_section' => 'header'
92
+ )
93
+ );
94
+ $this->add_settings_field( $args );
95
+
96
+ $args = array(
97
+ 'title' => __( '"Load More" Button', $text_domain ),
98
+ 'id' => 'sbspf_loadmore',
99
+ 'tab' => 'customize',
100
+ );
101
+ $this->add_settings_section( $args );
102
+
103
+ $args = array(
104
+ 'name' => 'showbutton',
105
+ 'section' => 'sbspf_loadmore',
106
+ 'callback' => 'checkbox',
107
+ 'title' => __( 'Show "Load More" Button', $text_domain ),
108
+ 'default' => true,
109
+ 'shortcode' => array(
110
+ 'key' => 'showbutton',
111
+ 'example' => 'false',
112
+ 'description' => __( 'Include a "Load More" button at the bottom of the feed to load more videos.', $text_domain ),
113
+ 'display_section' => 'button'
114
+ )
115
+ );
116
+ $this->add_settings_field( $args );
117
+
118
+ $args = array(
119
+ 'name' => 'buttoncolor',
120
+ 'default' => '',
121
+ 'section' => 'sbspf_loadmore',
122
+ 'callback' => 'color',
123
+ 'title' => __( 'Button Background Color', $text_domain ),
124
+ 'shortcode' => array(
125
+ 'key' => 'buttoncolor',
126
+ 'example' => '#0f0',
127
+ 'description' => __( 'Background color for the "Load More" button. Any hex color code.', $text_domain ),
128
+ 'display_section' => 'button'
129
+ ),
130
+ );
131
+ $this->add_settings_field( $args );
132
+
133
+ $args = array(
134
+ 'name' => 'buttontextcolor',
135
+ 'default' => '',
136
+ 'section' => 'sbspf_loadmore',
137
+ 'callback' => 'color',
138
+ 'title' => __( 'Button Text Color', $text_domain ),
139
+ 'shortcode' => array(
140
+ 'key' => 'buttontextcolor',
141
+ 'example' => '#00f',
142
+ 'description' => __( 'Text color for the "Load More" button. Any hex color code.', $text_domain ),
143
+ 'display_section' => 'button'
144
+ ),
145
+ );
146
+ $this->add_settings_field( $args );
147
+
148
+ $args = array(
149
+ 'name' => 'buttontext',
150
+ 'default' => __( 'Load More...', $text_domain ),
151
+ 'section' => 'sbspf_loadmore',
152
+ 'callback' => 'text',
153
+ 'title' => __( 'Button Text', $text_domain ),
154
+ 'shortcode' => array(
155
+ 'key' => 'buttontext',
156
+ 'example' => '"More Videos"',
157
+ 'description' => __( 'The text that appers on the "Load More" button.', $text_domain ),
158
+ 'display_section' => 'button'
159
+ )
160
+ );
161
+ $this->add_settings_field( $args );
162
+
163
+ /* Subscribe button */
164
+ $args = array(
165
+ 'title' => __( '"Subscribe" Button', $text_domain ),
166
+ 'id' => 'sbspf_subscribe',
167
+ 'tab' => 'customize',
168
+ 'save_after' => true
169
+ );
170
+ $this->add_settings_section( $args );
171
+
172
+ $args = array(
173
+ 'name' => 'showsubscribe',
174
+ 'section' => 'sbspf_subscribe',
175
+ 'callback' => 'checkbox',
176
+ 'title' => __( 'Show "Subscribe" Button', $text_domain ),
177
+ 'default' => true,
178
+ 'shortcode' => array(
179
+ 'key' => 'showsubscribe',
180
+ 'example' => 'false',
181
+ 'description' => __( 'Include a "Subscribe" button at the bottom of the feed to load more videos.', $text_domain ),
182
+ 'display_section' => 'subscribe'
183
+ )
184
+ );
185
+ $this->add_settings_field( $args );
186
+
187
+ $args = array(
188
+ 'name' => 'subscribecolor',
189
+ 'default' => '',
190
+ 'section' => 'sbspf_subscribe',
191
+ 'callback' => 'color',
192
+ 'title' => __( 'Subscribe Background Color', $text_domain ),
193
+ 'shortcode' => array(
194
+ 'key' => 'subscribecolor',
195
+ 'example' => '#0f0',
196
+ 'description' => __( 'Background color for the "Subscribe" button. Any hex color code.', $text_domain ),
197
+ 'display_section' => 'subscribe'
198
+ ),
199
+ );
200
+ $this->add_settings_field( $args );
201
+
202
+ $args = array(
203
+ 'name' => 'subscribetextcolor',
204
+ 'default' => '',
205
+ 'section' => 'sbspf_subscribe',
206
+ 'callback' => 'color',
207
+ 'title' => __( 'Subscribe Text Color', $text_domain ),
208
+ 'shortcode' => array(
209
+ 'key' => 'subscribetextcolor',
210
+ 'example' => '#00f',
211
+ 'description' => __( 'Text color for the "Subscribe" button. Any hex color code.', $text_domain ),
212
+ 'display_section' => 'subscribe'
213
+ ),
214
+ );
215
+ $this->add_settings_field( $args );
216
+
217
+ $args = array(
218
+ 'name' => 'subscribetext',
219
+ 'default' => __( 'Subscribe', $text_domain ),
220
+ 'section' => 'sbspf_subscribe',
221
+ 'callback' => 'text',
222
+ 'title' => __( 'Subscribe Text', $text_domain ),
223
+ 'shortcode' => array(
224
+ 'key' => 'subscribetext',
225
+ 'example' => '"Subscribe to My Channel"',
226
+ 'description' => __( 'The text that appers on the "Subscribe" button.', $text_domain ),
227
+ 'display_section' => 'subscribe'
228
+ )
229
+ );
230
+ $this->add_settings_field( $args );
231
+
232
+ $args = array(
233
+ 'title' => __( 'Video Experience', $text_domain ),
234
+ 'id' => 'sbspf_experience',
235
+ 'tab' => 'customize',
236
+ );
237
+ $this->add_settings_section( $args );
238
+
239
+ $select_options = array(
240
+ array(
241
+ 'label' => __( 'Play when clicked', $text_domain ),
242
+ 'value' => 'onclick'
243
+ ),
244
+ array(
245
+ 'label' => 'Play automatically (desktop only)',
246
+ 'value' => 'automatically'
247
+ )
248
+ );
249
+ $args = array(
250
+ 'name' => 'playvideo',
251
+ 'default' => 'onclick',
252
+ 'section' => 'sbspf_experience',
253
+ 'callback' => 'select',
254
+ 'title' => __( 'When does video play?', $text_domain ),
255
+ 'shortcode' => array(
256
+ 'key' => 'playvideo',
257
+ 'example' => 'onclick',
258
+ 'description' => __( 'What the user needs to do to play a video. eg.', $text_domain ) . ' onclick, automatically',
259
+ 'display_section' => 'customize'
260
+ ),
261
+ 'options' => $select_options,
262
+ 'tooltip_info' => __( 'List layout will not play automatically. Choose whether to play the video automatically in the player or wait until the user clicks the play button after the video is loaded.', $text_domain )
263
+ );
264
+ $this->add_settings_field( $args );
265
+
266
+ $args = array(
267
+ 'title' => __( 'Custom Code Snippets', $text_domain ),
268
+ 'id' => 'sbspf_custom_snippets',
269
+ 'tab' => 'customize'
270
+ );
271
+ $this->add_settings_section( $args );
272
+
273
+ $args = array(
274
+ 'name' => 'custom_css',
275
+ 'default' => '',
276
+ 'section' => 'sbspf_custom_snippets',
277
+ 'callback' => 'textarea',
278
+ 'title' => __( 'Custom CSS', $text_domain ),
279
+ 'options' => $select_options,
280
+ 'tooltip_info' => __( 'Enter your own custom CSS in the box below', $text_domain )
281
+ );
282
+ $this->add_settings_field( $args );
283
+
284
+ $args = array(
285
+ 'name' => 'custom_js',
286
+ 'default' => '',
287
+ 'section' => 'sbspf_custom_snippets',
288
+ 'callback' => 'textarea',
289
+ 'title' => __( 'Custom JavaScript', $text_domain ),
290
+ 'options' => $select_options,
291
+ 'tooltip_info' => __( 'Enter your own custom JavaScript/jQuery in the box below', $text_domain ),
292
+ 'note' => __( 'Note: Custom JavaScript reruns every time more videos are loaded into the feed', $text_domain )
293
+ );
294
+ $this->add_settings_field( $args );
295
+
296
+ $args = array(
297
+ 'title' => __( 'Advanced', $text_domain ),
298
+ 'id' => 'sbspf_advanced',
299
+ 'tab' => 'customize'
300
+ );
301
+ $this->add_settings_section( $args );
302
+
303
+ $select_options = array(
304
+ array(
305
+ 'label' => __( 'Background', $text_domain ),
306
+ 'value' => 'background'
307
+ ),
308
+ array(
309
+ 'label' => __( 'Page', $text_domain ),
310
+ 'value' => 'page'
311
+ ),
312
+ array(
313
+ 'label' => __( 'None', $text_domain ),
314
+ 'value' => 'none'
315
+ )
316
+ );
317
+ $additional = '<input id="sby-clear-cache" class="button-secondary sbspf-button-action" data-sby-action="sby_delete_wp_posts" data-sby-confirm="'.esc_attr( 'This will permanently delete all YouTube posts from the wp_posts table and the related data in the postmeta table. Continue?', $text_domain ).'" style="margin-top: 1px;" type="submit" value="'.esc_attr( 'Clear YouTube Posts', $text_domain ).'">';
318
+ $args = array(
319
+ 'name' => 'storage_process',
320
+ 'default' => '',
321
+ 'section' => 'sbspf_advanced',
322
+ 'callback' => 'select',
323
+ 'title' => __( 'Local storage process', $text_domain ),
324
+ 'options' => $select_options,
325
+ 'additional' => $additional,
326
+ 'tooltip_info' => __( 'To preserve your feeds and videos even if the YouTube API is unavailable, a record of each video is added to the wp_posts table in the WordPress database.', $text_domain )
327
+ );
328
+ $this->add_settings_field( $args );
329
+
330
+ $args = array(
331
+ 'name' => 'ajaxtheme',
332
+ 'section' => 'sbspf_advanced',
333
+ 'callback' => 'checkbox',
334
+ 'title' => __( 'Are you using an AJAX theme?', $text_domain ),
335
+ 'default' => false,
336
+ 'tooltip_info' => __( 'When navigating your site, if your theme uses Ajax to load content into your pages (meaning your page doesn\'t refresh) then check this setting. If you\'re not sure then it\'s best to leave this setting unchecked while checking with your theme author, otherwise checking it may cause a problem.', $text_domain )
337
+ );
338
+ $this->add_settings_field( $args );
339
+ }
340
+
341
+ public function cache( $args ) {
342
+ $social_network = $this->vars->social_network();
343
+ $type_selected = isset( $this->settings['caching_type'] ) ? $this->settings['caching_type'] : 'page';
344
+ $caching_time = isset( $this->settings['caching_time'] ) ? $this->settings['caching_time'] : 1;
345
+ $cache_time_unit_selected = isset( $this->settings['cache_time_unit'] ) ? $this->settings['cache_time_unit'] : 'hours';
346
+ $cache_cron_interval_selected = isset( $this->settings['cache_cron_interval'] ) ? $this->settings['cache_cron_interval'] : '';
347
+ $cache_cron_time = isset( $this->settings['cache_cron_time'] ) ? $this->settings['cache_cron_time'] : '';
348
+ $cache_cron_am_pm = isset( $this->settings['cache_cron_am_pm'] ) ? $this->settings['cache_cron_am_pm'] : '';
349
+
350
+ ?>
351
+ <div class="sbspf_cache_settings_wrap">
352
+ <div class="sbspf_row">
353
+ <input type="radio" name="<?php echo $this->option_name.'[caching_type]'; ?>" class="sbspf_caching_type_input" id="sbspf_caching_type_page" value="page"<?php if ( $type_selected === 'page' ) echo ' checked'?>>
354
+ <label class="sbspf_radio_label" for="sbspf_caching_type_page"><?php _e ( 'When the page loads', $this->vars->text_domain() ); ?></label>
355
+ <a class="sbspf_tooltip_link sbspf_tooltip_link" href="JavaScript:void(0);" style="position: relative; top: 2px;"><?php echo $this->default_tooltip_text() ?></a>
356
+ <p class="sbspf_tooltip sbspf_more_info"><?php echo sprintf( __( "Your %s data is temporarily cached by the plugin in your WordPress database. There are two ways that you can set the plugin to check for new data:<br><br>
357
+ <b>1. When the page loads</b><br>Selecting this option means that when the cache expires then the plugin will check %s for new posts the next time that the feed is loaded. You can choose how long this data should be cached for. If you set the time to 60 minutes then the plugin will clear the cached data after that length of time, and the next time the page is viewed it will check for new data. <b>Tip:</b> If you're experiencing an issue with the plugin not updating automatically then try enabling the setting labeled <b>'Force cache to clear on interval'</b> which is located on the 'Customize' tab.<br><br>
358
+ <b>2. In the background</b><br>Selecting this option means that the plugin will check for new data in the background so that the feed is updated behind the scenes. You can select at what time and how often the plugin should check for new data using the settings below. <b>Please note</b> that the plugin will initially check for data from Instagram when the page first loads, but then after that will check in the background on the schedule selected - unless the cache is cleared.", $this->vars->text_domain() ), $social_network, $social_network ); ?>
359
+ </p>
360
+ </div>
361
+ <div class="sbspf_row sbspf-caching-page-options" style="display: none;">
362
+ <?php _e ( 'Every', $this->vars->text_domain() ); ?>:
363
+ <input name="<?php echo $this->option_name.'[caching_time]'; ?>" type="text" value="<?php echo esc_attr( $caching_time ); ?>" size="4">
364
+ <select name="<?php echo $this->option_name.'[caching_time_unit]'; ?>">
365
+ <option value="minutes"<?php if ( $cache_time_unit_selected === 'minutes' ) echo ' selected'?>><?php _e ( 'Minutes', $this->vars->text_domain() ); ?></option>
366
+ <option value="hours"<?php if ( $cache_time_unit_selected === 'hours' ) echo ' selected'?>><?php _e ( 'Hours', $this->vars->text_domain() ); ?></option>
367
+ <option value="days"<?php if ( $cache_time_unit_selected === 'days' ) echo ' selected'?>><?php _e ( 'Days', $this->vars->text_domain() ); ?></option>
368
+ </select>
369
+ <a class="sbspf_tooltip_link" href="JavaScript:void(0);"><?php _e ( 'What does this mean?', $this->vars->text_domain() ); ?></a>
370
+ <p class="sbspf_tooltip sbspf_more_info"><?php echo sprintf( __("Your %s posts are temporarily cached by the plugin in your WordPress database. You can choose how long the posts should be cached for. If you set the time to 1 hour then the plugin will clear the cache after that length of time and check %s for posts again.", $this->vars->text_domain() ), $social_network, $social_network ); ?></p>
371
+ </div>
372
+
373
+ <div class="sbspf_row">
374
+ <input type="radio" name="<?php echo $this->option_name.'[caching_type]'; ?>" id="sbspf_caching_type_cron" class="sbspf_caching_type_input" value="background" <?php if ( $type_selected === 'background' ) echo ' checked'?>>
375
+ <label class="sbspf_radio_label" for="sbspf_caching_type_cron"><?php _e ( 'In the background', $this->vars->text_domain() ); ?></label>
376
+ </div>
377
+ <div class="sbspf_row sbspf-caching-cron-options" style="display: block;">
378
+
379
+ <select name="<?php echo $this->option_name.'[cache_cron_interval]'; ?>" id="sbspf_cache_cron_interval">
380
+ <option value="30mins"<?php if ( $cache_cron_interval_selected === '30mins' ) echo ' selected'?>><?php _e ( 'Every 30 minutes', $this->vars->text_domain() ); ?></option>
381
+ <option value="1hour"<?php if ( $cache_cron_interval_selected === '1hour' ) echo ' selected'?>><?php _e ( 'Every hour', $this->vars->text_domain() ); ?></option>
382
+ <option value="12hours"<?php if ( $cache_cron_interval_selected === '12hours' ) echo ' selected'?>><?php _e ( 'Every 12 hours', $this->vars->text_domain() ); ?></option>
383
+ <option value="24hours"<?php if ( $cache_cron_interval_selected === '24hours' ) echo ' selected'?>><?php _e ( 'Every 24 hours', $this->vars->text_domain() ); ?></option>
384
+ </select>
385
+
386
+ <div id="sbspf-caching-time-settings" style="">
387
+ <?php _e ( 'at', $this->vars->text_domain() ); ?>
388
+ <select name="<?php echo $this->option_name.'[cache_cron_time]'; ?>" style="width: 80px">
389
+ <option value="1"<?php if ( (int)$cache_cron_time === 1 ) echo ' selected'?>>1:00</option>
390
+ <option value="2"<?php if ( (int)$cache_cron_time === 2 ) echo ' selected'?>>2:00</option>
391
+ <option value="3"<?php if ( (int)$cache_cron_time === 3 ) echo ' selected'?>>3:00</option>
392
+ <option value="4"<?php if ( (int)$cache_cron_time === 4 ) echo ' selected'?>>4:00</option>
393
+ <option value="5"<?php if ( (int)$cache_cron_time === 5 ) echo ' selected'?>>5:00</option>
394
+ <option value="6"<?php if ( (int)$cache_cron_time === 6 ) echo ' selected'?>>6:00</option>
395
+ <option value="7"<?php if ( (int)$cache_cron_time === 7 ) echo ' selected'?>>7:00</option>
396
+ <option value="8"<?php if ( (int)$cache_cron_time === 8 ) echo ' selected'?>>8:00</option>
397
+ <option value="9"<?php if ( (int)$cache_cron_time === 9 ) echo ' selected'?>>9:00</option>
398
+ <option value="10"<?php if ( (int)$cache_cron_time === 10 ) echo ' selected'?>>10:00</option>
399
+ <option value="11"<?php if ( (int)$cache_cron_time === 11 ) echo ' selected'?>>11:00</option>
400
+ <option value="0"<?php if ( (int)$cache_cron_time === 0 ) echo ' selected'?>>12:00</option>
401
+ </select>
402
+
403
+ <select name="<?php echo $this->option_name.'[cache_cron_am_pm]'; ?>" style="width: 50px">
404
+ <option value="am"<?php if ( $cache_cron_am_pm === 'am' ) echo ' selected'?>><?php _e ( 'AM', $this->vars->text_domain() ); ?></option>
405
+ <option value="pm"<?php if ( $cache_cron_am_pm === 'pm' ) echo ' selected'?>><?php _e ( 'PM', $this->vars->text_domain() ); ?></option>
406
+ </select>
407
+ </div>
408
+
409
+ <?php
410
+ if ( wp_next_scheduled( 'sby_feed_update' ) ) {
411
+ $time_format = get_option( 'time_format' );
412
+ if ( ! $time_format ) {
413
+ $time_format = 'g:i a';
414
+ }
415
+ //
416
+ $schedule = wp_get_schedule( 'sby_feed_update' );
417
+ if ( $schedule == '30mins' ) $schedule = __( 'every 30 minutes', $this->vars->text_domain() );
418
+ if ( $schedule == 'twicedaily' ) $schedule = __( 'every 12 hours', $this->vars->text_domain() );
419
+ $sbspf_next_cron_event = wp_next_scheduled( 'sby_feed_update' );
420
+ echo '<p class="sbspf-caching-sched-notice"><span><b>' . __( 'Next check', $this->vars->text_domain() ) . ': ' . date( $time_format, $sbspf_next_cron_event + sby_get_utc_offset() ) . ' (' . $schedule . ')</b> - ' . __( 'Note: Saving the settings on this page will clear the cache and reset this schedule', $this->vars->text_domain() ) . '</span></p>';
421
+ } else {
422
+ echo '<p style="font-size: 11px; color: #666;">' . __( 'Nothing currently scheduled', $this->vars->text_domain() ) . '</p>';
423
+ }
424
+ ?>
425
+ </div>
426
+ </div>
427
+ <?php
428
+ }
429
+
430
+ public function get_connected_accounts() {
431
+ global $sby_settings;
432
+
433
+ if ( isset( $sby_settings['connected_accounts'] ) ) {
434
+ return $sby_settings['connected_accounts'];
435
+ }
436
+ return array();
437
+ }
438
+
439
+ public function access_token_listener() {
440
+ if ( isset( $_GET['page'] ) && $_GET['page'] === SBY_SLUG && isset( $_GET['sby_access_token'] ) ) {
441
+ sby_attempt_connection();
442
+ }
443
+ }
444
+
445
+ public static function connect_account( $args ) {
446
+ sby_update_or_connect_account( $args );
447
+ }
448
+ }
inc/admin/templates/configure.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h3><?php _e( 'Configure', $text_domain ); ?></h3>
2
+ <div id="sbspf_config">
3
+ <a href="<?php echo $oauth_processor_url . admin_url( 'admin.php?page=' . esc_attr( $slug ) ); ?>" id="sbspf_get_token"><?php echo sby_icon( $slug, 'sbspf_small_svg' ); ?> <?php echo sprintf( __( 'Log in to %s and connect an account', $text_domain ), $social_network ); ?></a>
4
+ <a class="sbspf_not_working" href="https://smashballoon.com/<?php echo esc_attr( $slug ); ?>/token/" target="_blank"><?php _e( "Button not working?", $text_domain ); ?></a>
5
+ </div>
6
+
7
+ <form method="post" action="">
8
+ <?php
9
+ $settings = $this->settings;
10
+ $have_own_tokens = isset( $settings['have_own_tokens'] ) ? $settings['have_own_tokens'] : 0;
11
+ $api_key = isset( $settings['api_key'] ) ? $settings['api_key'] : '';
12
+ ?>
13
+ <input name="<?php echo $this->get_option_name(); ?>[have_own_tokens]" type="hidden" value="0">
14
+
15
+ <input name="<?php echo $this->get_option_name(); ?>[have_own_tokens]" id="sbspf_have_own_tokens" type="checkbox"<?php if ( $have_own_tokens === 'on' ) echo ' checked'; ?>><label for="sbspf_have_own_tokens"><?php echo sprintf( __( "Or, manually enter my own %s API key", $text_domain ), $social_network ); ?></label>
16
+ <span class="sbspf_tooltip_wrap">
17
+ <a class="sbspf_tooltip_link" href="JavaScript:void(0);"><?php echo $this->default_tooltip_text(); ?></a>
18
+ <p class="sbspf_tooltip sbspf_more_info"><?php echo __( 'Check this box if you would like to manually enter your own API key. To generate an API key use <a href="https://smashballoon.com/youtube-api-key/" target="_blank" rel="noopener">these instructions.</a>', $text_domain ); ?></p>
19
+ </span>
20
+ <table class="form-table sbspf_own_credentials_wrap" role="presentation">
21
+ <tbody>
22
+ <tr>
23
+ <th scope="row">
24
+ <label for="sby_app_id"><?php _e( "API Key", $text_domain ); ?></label>
25
+ </th>
26
+ <td>
27
+ <input name="<?php echo $this->get_option_name(); ?>[api_key]" id="sby_api_key" type="text" value="<?php echo esc_attr( $api_key ); ?>" size="64" minlength="15" maxlength="200" />
28
+ </td>
29
+ </tr>
30
+
31
+ </tbody>
32
+ </table>
33
+ <?php $this->hidden_fields_for_tab( 'configure' ); ?>
34
+ <?php include_once $this->get_path( 'connected-accounts' ); ?>
35
+
36
+ <?php foreach ( $this->get_sections( 'configure' ) as $section ) : ?>
37
+
38
+ <?php do_settings_sections( $section['id'] ); // matches the section name ?>
39
+ <?php if ( $section['save_after'] ) : ?>
40
+ <p class="submit"><input class="button-primary" type="submit" name="save" value="<?php esc_attr_e( 'Save Changes' ); ?>" /></p>
41
+ <?php endif; ?>
42
+ <hr>
43
+ <?php endforeach; ?>
44
+ </form>
inc/admin/templates/connected-accounts.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $connected_accounts = $this->get_connected_accounts();
3
+ $connected_channels = array();
4
+ ?>
5
+ <table class="form-table sbspf_connected-accounts-wrap" role="presentation">
6
+ <tbody>
7
+ <tr>
8
+ <th scope="row">
9
+ <label><?php echo sprintf( __( '%s Accounts', $text_domain ), $social_network ); ?></label>
10
+ <span style="font-weight:normal; font-style:italic; font-size: 12px; display: block;"><?php echo sprintf( __( 'Use the button above to connect %s account', $text_domain ), $sn_with_a_an ); ?></span>
11
+ </th>
12
+ <td class="sbspf_connected_accounts_wrap">
13
+ <?php if ( empty( $connected_accounts ) ) : ?>
14
+ <p class="sbspf_no_accounts"><?php echo sprintf( __( 'No %s accounts connected. Click the button above to connect an account.', $text_domain ), $social_network ); ?></p><br />
15
+ <?php else: ?>
16
+ <?php foreach ( $connected_accounts as $account ) :
17
+ $username = $account['username'] ? $account['username'] : $account['channel_id'];
18
+ if ( isset( $account['local_avatar'] ) && $account['local_avatar'] && isset( $options['sbspf_favor_local'] ) && $options['sbspf_favor_local' ] === 'on' ) {
19
+ $upload = wp_upload_dir();
20
+ $resized_url = trailingslashit( $upload['baseurl'] ) . trailingslashit( SBI_UPLOADS_NAME );
21
+ $profile_picture = '<img class="sbspf_ca_avatar" src="'.$resized_url . $account['username'].'.jpg" />'; //Could add placeholder avatar image
22
+ } else {
23
+ $profile_picture = $account['profile_picture'] ? '<img class="sbspf_ca_avatar" src="'.$account['profile_picture'].'" />' : ''; //Could add placeholder avatar image
24
+ }
25
+ $is_invalid_class = ! $account['is_valid'] ? ' sbspf_account_invalid' : '';
26
+ $account_type = isset( $account['type'] ) ? $account['type'] : 'personal';
27
+ $use_tagged = isset( $account['use_tagged'] ) && $account['use_tagged'] == '1';
28
+
29
+ include $this->get_path( 'single-connected-account' );
30
+ ?>
31
+ <?php endforeach; ?>
32
+ <?php endif; ?>
33
+ <a href="JavaScript:void(0);" class="sbspf_manually_connect button-secondary"><?php _e( 'Manually Connect a Primary Account', $text_domain ); ?></a>
34
+ <div class="sbspf_manually_connect_wrap">
35
+ <input name="sbspf_manual_at" id="sbspf_manual_at" type="text" value="" style="margin-top: 4px; padding: 5px 9px; margin-left: 0px;" size="64" minlength="15" maxlength="200" placeholder="<?php _e('Enter a valid Access Token', $text_domain );?>" />
36
+ <input name="sbspf_manual_rt" id="sbspf_manual_rt" type="text" value="" style="margin-top: 4px; padding: 5px 9px; margin-left: 0px;" size="64" minlength="15" maxlength="200" placeholder="<?php _e('Enter a valid Refresh Token', $text_domain );?>" />
37
+ <p class="sbspf_submit" style="display: inline-block;"><input type="sbspf_submit" name="submit" id="sbspf_manual_submit" class="button button-primary" style="text-align: center; padding: 0;" value="<?php _e('Connect This Account', $text_domain );?>"></p>
38
+ </div>
39
+ </td>
40
+ </tr>
41
+ </tbody>
42
+ </table>
inc/admin/templates/customize.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <form method="post" action="">
3
+ <?php $this->hidden_fields_for_tab( 'customize' ); ?>
4
+
5
+ <?php foreach ( $this->get_sections( 'customize' ) as $section ) : ?>
6
+ <?php do_settings_sections( $section['id'] ); // matches the section name ?>
7
+ <?php if ( $section['save_after'] ) : ?>
8
+ <p class="submit"><input class="button-primary" type="submit" name="save" value="<?php esc_attr_e( 'Save Changes' ); ?>" /></p>
9
+ <?php endif; ?>
10
+ <hr>
11
+ <?php endforeach; ?>
12
+ </form>
inc/admin/templates/display.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h3><?php _e( 'Display your Feed', $text_domain ); ?></h3>
2
+ <p><?php _e( "Copy and paste the following shortcode directly into the page, post or widget where you'd like the feed to show up:", $text_domain ); ?></p>
3
+ <input type="text" value="[<?php echo $slug; ?>]" size="20" readonly="readonly" style="text-align: center;" onclick="this.focus();this.select()" title="<?php _e( 'To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac).', $text_domain ); ?>" />
4
+
5
+ <h3 style="padding-top: 10px;"><?php _e( 'Multiple Feeds', $text_domain ); ?></h3>
6
+ <p><?php _e( "If you'd like to display multiple feeds then you can set different settings directly in the shortcode like so:", $text_domain ); ?>
7
+ </br><code>[<?php echo $slug; ?> user=gopro num=9]</code></p>
8
+ <p><?php _e( "You can display as many different feeds as you like, on either the same page or on different pages, by just using the shortcode options below. For example:", $text_domain ); ?><br />
9
+ <code>[<?php echo $slug; ?>]</code><br />
10
+ <code>[<?php echo $slug; ?> user="ANOTHER_CHANNEL"]</code><br />
11
+ <code>[<?php echo $slug; ?> num=4 showheader=false]</code>
12
+ </p>
13
+ <p><?php _e( "See the table below for a full list of available shortcode options:", $text_domain ); ?></p>
14
+
15
+ <table class="sbspf_shortcode_table">
16
+ <tbody>
17
+ <tr valign="top">
18
+ <th scope="row"><?php _e( 'Shortcode option', $text_domain ); ?></th>
19
+ <th scope="row"><?php _e( 'Description', $text_domain ); ?></th>
20
+ <th scope="row"><?php _e( 'Example', $text_domain ); ?></th>
21
+ </tr>
22
+
23
+ <?php foreach ( $this->display_your_feed_sections as $display_your_feed_section ) : ?>
24
+ <tr class="sbspf_table_header"><td colspan=3><?php echo $display_your_feed_section['label'] ?></td></tr>
25
+ <?php foreach ( $display_your_feed_section['settings'] as $setting ) : ?>
26
+ <tr>
27
+ <td><?php echo $setting['key']; ?></td>
28
+ <td><?php echo $setting['description']; ?></td>
29
+ <td><code>[<?php echo $slug; ?> <?php echo $setting['key']; ?>="<?php echo $setting['example']; ?>"]</code></td>
30
+ </tr>
31
+ <?php endforeach; ?>
32
+
33
+ <?php endforeach; ?>
34
+
35
+ </tbody>
36
+ </table>
37
+ <p><?php echo sby_admin_icon( 'question-circle', 'sbspf_small_svg' ); ?>&nbsp; <?php _e('Need help?', $text_domain ); ?> <a href="?page=<?php echo esc_attr( $slug ); ?>&tab=support"><?php _e('Get Support', $text_domain ); ?></a></p>
inc/admin/templates/main.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $vars = $this->get_vars();
3
+ $text_domain = $vars->text_domain();
4
+ $setup_url = $vars->setup_url();
5
+ $oauth_processor_url = $vars->oauth_processor_url();
6
+ $social_network = $vars->social_network();
7
+ $sn_with_a_an = $vars->social_network( true );
8
+ $plugin_version = $vars->version();
9
+ $demo_url = $vars->demo_url();
10
+ $pro_logo = $vars->pro_logo();
11
+
12
+ if ( isset( $_POST[ $this->get_option_name() . '_validate' ] ) && $this->verify_post( $_POST ) ) {
13
+ $tab = isset( $_POST[ $this->get_option_name() . '_tab_marker' ] ) ? sanitize_text_field( $_POST[ $this->get_option_name() . '_tab_marker' ] ) : 'main';
14
+ $new_settings = $this->validate_options( $_POST[ $this->get_option_name() ], $tab );
15
+ $this->update_options( $new_settings );
16
+ ?>
17
+ <div class="updated"><p><strong><?php _e('Settings saved.', $text_domain ); ?></strong></p></div>
18
+
19
+ <?php
20
+ }
21
+ $plugin_name = $this->get_plugin_name();
22
+ $active_tab = $this->get_active_tab();
23
+ $slug = $this->get_slug();
24
+ $tabs = $this->get_tabs();
25
+ ?>
26
+
27
+ <div id="sbspf_admin" class="wrap sbspf-admin" data-sb-plugin="sbspf">
28
+ <h1><?php echo esc_html( $plugin_name ); ?></h1>
29
+
30
+ <!-- Display the tabs along with styling for the 'active' tab -->
31
+ <h2 class="nav-tab-wrapper">
32
+ <?php
33
+ $i = 1;
34
+ foreach ( $tabs as $tab ) :
35
+ $title = isset( $tab['numbered_tab'] ) && ! $tab['numbered_tab'] ? __( $tab['title'], 'youtube-feed' ) : $i . '. ' . __( $tab['title'], 'youtube-feed' );
36
+ ?>
37
+ <a href="admin.php?page=<?php echo esc_attr( $slug ); ?>&tab=<?php echo esc_attr( $tab['slug'] ); ?>" class="nav-tab <?php if ( $active_tab === $tab['slug'] ){ echo 'nav-tab-active'; } ?>"><?php echo $title; ?></a>
38
+ <?php
39
+ $i ++;
40
+ endforeach; ?>
41
+ </h2>
42
+ <?php
43
+ settings_errors();
44
+
45
+ include $this->get_path( $active_tab );
46
+
47
+ $next_step = $this->next_step();
48
+ if ( ! empty( $next_step ) ) : ?>
49
+ <p class="sbspf_footer_help">
50
+ <?php echo sby_admin_icon( 'chevron-right', 'sbspf_small_svg' ) ; ?>&nbsp; <?php _e('Next Step', $text_domain ); ?>: <a href="?page=<?php echo esc_attr( $slug ); ?>&tab=<?php echo esc_attr( $next_step['next_tab'] ); ?>"><?php echo esc_html( __( $next_step['instructions'], 'youtube-feed' ) ); ?></a>
51
+ </p>
52
+ <?php endif; ?>
53
+
54
+ <p class="sbspf_footer_help"><?php echo sby_admin_icon( 'life-ring', 'sbspf_small_svg' ); ?>&nbsp; <?php _e('Need help setting up the plugin? Check out our <a href="' . esc_url( $setup_url ) . '" target="_blank">setup directions</a>', $text_domain); ?></p>
55
+
56
+ <div class="sbspf-quick-start">
57
+ <h3><?php echo sby_admin_icon( 'rocket', 'sbspf_small_svg' ); ?>&nbsp; <?php _e( 'Display your feed', $text_domain); ?></h3>
58
+ <p><?php _e( "Copy and paste this shortcode directly into the page, post or widget where you'd like to display the feed:", $text_domain ); ?>
59
+ <input type="text" value="[<?php echo $slug; ?>]" size="18" readonly="readonly" style="text-align: center;" onclick="this.focus();this.select()" title="<?php _e( 'To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac).', $text_domain ); ?>" /></p>
60
+ <p><?php _e( "Find out how to display <a href='?page=".$slug."&tab=display'>multiple feeds</a>.", $text_domain ); ?></p>
61
+ </div>
62
+
63
+ </div>
64
+ <div class="wp-clearfix"></div>
inc/admin/templates/single-connected-account.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="sbspf_connected_account" id="sbspf_connected_account_<?php esc_attr_e( $account['channel_id'] ); ?>" data-accesstoken="<?php esc_attr_e( $account['access_token'] ); ?>" data-userid="<?php esc_attr_e( $account['channel_id'] ); ?>" data-username="<?php esc_attr_e( $account['username'] ); ?>">
2
+
3
+ <div class="sbspf_ca_alert">
4
+ <span><?php _e( 'The Access Token for this account is expired or invalid. Click the button above to attempt to renew it.', $text_domain ) ?></span>
5
+ </div>
6
+ <div class="sbspf_ca_info">
7
+
8
+ <div class="sbspf_ca_delete">
9
+ <a href="JavaScript:void(0);" class="sbspf_delete_account"><?php echo sby_admin_icon( 'times', 'sbspf_small_svg' ) ; ?><span class="sbspf_remove_text"><?php _e( 'Remove', $text_domain ); ?></span></a>
10
+ </div>
11
+
12
+ <div class="sbspf_ca_username">
13
+ <?php echo $profile_picture; ?>
14
+ <strong><?php echo $username; ?><span><?php _e('Channel ID:', $text_domain ); ?><?php echo ' ' . $account['channel_id']; ?></span></strong>
15
+ </div>
16
+
17
+ <div class="sbspf_ca_actions">
18
+ <a class="sbspf_ca_token_shortcode button-secondary" href="JavaScript:void(0);"><?php echo sby_admin_icon( 'chevron-right', 'sbspf_small_svg' ) ; ?><?php _e( 'Add to another Feed', $text_domain ); ?></a>
19
+ <a class="sbspf_ca_show_token button-secondary" href="JavaScript:void(0);" title="<?php _e('Show access token and account info', $text_domain ); ?>"><?php echo sby_admin_icon( 'ellipsis', 'sbspf_small_svg' ) ; ?></a>
20
+ </div>
21
+
22
+ <div class="sbspf_ca_shortcode">
23
+
24
+ <p><?php _e('Copy and paste this shortcode into your page or widget area', $text_domain ); ?>:<br>
25
+ <?php if ( !empty( $account['username'] ) ) : ?>
26
+ <code>[<?php echo $slug; ?> channel="<?php echo $account['channel_id']; ?>"]</code>
27
+ <?php else : ?>
28
+ <code>[<?php echo $slug; ?> accesstoken="<?php echo $account['access_token']; ?>"]</code>
29
+ <?php endif; ?>
30
+ </p>
31
+
32
+ <p><?php _e('To add multiple channels in the same feed, simply separate them using commas', $text_domain); ?>:<br>
33
+ <code>[<?php echo $slug; ?> channel="<?php echo $account['channel_id']; ?>, a_second_channel, a_third_channel"]</code>
34
+
35
+ <p><?php echo sprintf( __('Click on the %s tab to learn more about shortcodes', $text_domain), '<a href="admin.php?page='. esc_attr( $slug ). '&tab=display" target="_blank">'. __( 'Display Your Feed', $text_domain ) . '</a>' ); ?></p>
36
+ </div>
37
+
38
+ <div class="sbspf_ca_accesstoken">
39
+ <span class="sbspf_ca_token_label"><?php _e('Access Token', $text_domain);?>:</span><input type="text" class="sbspf_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).', $text_domain);?>"><br>
40
+ <span class="sbspf_ca_token_label"><?php _e('Refresh Token', $text_domain);?>:</span><input type="text" class="sbspf_ca_refresh_token" value="<?php echo $account['refresh_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).', $text_domain);?>"><br>
41
+ <span class="sbspf_ca_token_label"><?php _e('Channel ID', $text_domain);?>:</span><input type="text" class="sbspf_ca_user_id" value="<?php echo $account['channel_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).', $text_domain);?>"><br>
42
+ </div>
43
+
44
+ </div>
45
+
46
+ </div>
inc/admin/templates/support.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h3><?php _e( 'Need help?', $text_domain ); ?></h3>
2
+
3
+ <p><?php echo sby_admin_icon( 'life-ring', 'sbspf_small_svg' ); ?>&nbsp; <?php _e( 'Check out our ', $text_domain ); ?><a href="<?php echo esc_url( $setup_url ); ?>" target="_blank"><?php _e( 'setup directions', $text_domain ); ?></a> <?php _e( 'for a step-by-step guide on how to setup and use the plugin', $text_domain ); ?>.</p>
4
+
5
+ <p><?php echo sby_admin_icon( 'envelope', 'sbspf_small_svg' ); ?>&nbsp; <?php _e( 'Have a problem? Submit a ', $text_domain ); ?><a href="<?php echo esc_url( SBY_SUPPORT_URL ); ?>" target="_blank"><?php _e( 'support ticket', $text_domain ); ?></a> <?php _e( 'on our website', $text_domain ); ?>. <?php _e( 'Please include your <b>System Info</b> below with all support requests.', $text_domain ); ?></p>
6
+
7
+ <br />
8
+ <h3><?php _e('System Info', $text_domain ); ?> &nbsp; <span style="color: #666; font-size: 11px; font-weight: normal;"><?php _e( 'Click the text below to select all', $text_domain ); ?></span></h3>
9
+
10
+ <textarea readonly="readonly" onclick="this.focus();this.select()" title="To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)." style="width: 70%; height: 500px; white-space: pre; font-family: Menlo,Monaco,monospace;">
11
+ ## SITE/SERVER INFO: ##
12
+ Plugin Version: <?php echo $plugin_name . ' v' . $plugin_version. "\n"; ?>
13
+ Site URL: <?php echo site_url() . "\n"; ?>
14
+ Home URL: <?php echo home_url() . "\n"; ?>
15
+ WordPress Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?>
16
+ PHP Version: <?php echo PHP_VERSION . "\n"; ?>
17
+ Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?>
18
+ PHP allow_url_fopen: <?php echo ini_get( 'allow_url_fopen' ) ? "Yes" . "\n" : "No" . "\n"; ?>
19
+ PHP cURL: <?php echo is_callable('curl_init') ? "Yes" . "\n" : "No" . "\n"; ?>
20
+ JSON: <?php echo function_exists("json_decode") ? "Yes" . "\n" : "No" . "\n" ?>
21
+ SSL Stream: <?php echo in_array('https', stream_get_wrappers()) ? "Yes" . "\n" : "No" . "\n" //extension=php_openssl.dll in php.ini ?>
22
+
23
+ ## ACTIVE PLUGINS: ##
24
+ <?php
25
+ $plugins = get_plugins();
26
+ $active_plugins = get_option( 'active_plugins', array() );
27
+
28
+ foreach ( $plugins as $plugin_path => $plugin ) {
29
+ // If the plugin isn't active, don't show it.
30
+ if ( in_array( $plugin_path, $active_plugins ) ) {
31
+ echo $plugin['Name'] . ': ' . $plugin['Version'] ."\n";
32
+ }
33
+ }
34
+ ?>
35
+
36
+ ## OPTIONS: ##
37
+ <?php
38
+ $options = get_option( $this->get_option_name(), array() );
39
+ foreach ( $options as $key => $val ) {
40
+ if ( is_array( $val ) ) {
41
+ foreach ( $val as $key2 => $val2 ) {
42
+ if ( is_array( $val2 ) ) {
43
+ foreach ( $val2 as $key3 => $val3 ) {
44
+ $label = $key3 . ':';
45
+ $value = isset( $val3 ) ? esc_attr( $val3 ) : 'unset';
46
+ echo str_pad( $label, 24 ) . $value ."\n";
47
+ }
48
+ } else {
49
+ $label = $key2 . ':';
50
+ $value = isset( $val2 ) ? esc_attr( $val2 ) : 'unset';
51
+ echo str_pad( $label, 24 ) . $value ."\n";
52
+ }
53
+ }
54
+ } else {
55
+ $label = $key . ':';
56
+ $value = isset( $val ) ? esc_attr( $val ) : 'unset';
57
+ echo str_pad( $label, 24 ) . $value ."\n";
58
+ }
59
+
60
+ }
61
+ ?>
62
+
63
+ ## Cron Events: ##
64
+ <?php
65
+ $cron = _get_cron_array();
66
+ foreach ( $cron as $key => $data ) {
67
+ $is_target = false;
68
+ foreach ( $data as $key2 => $val ) {
69
+ if ( strpos( $key2, 'sby' ) !== false ) {
70
+ $is_target = true;
71
+ echo $key2;
72
+ echo "\n";
73
+ }
74
+ }
75
+ if ( $is_target) {
76
+ echo date( "Y-m-d H:i:s", $key );
77
+ echo "\n";
78
+ echo 'Next Scheduled: ' . ((int)$key - time())/60 . ' minutes';
79
+ echo "\n\n";
80
+ }
81
+ }
82
+ ?>
83
+ ## Cron Cache Report: ##
84
+ <?php $cron_report = get_option( 'sby_cron_report', array() );
85
+ if ( ! empty( $cron_report ) ) {
86
+ var_export( $cron_report );
87
+ }
88
+ echo "\n";
89
+ ?>
90
+
91
+ ## Error Log: ##
92
+ <?php
93
+ global $sby_posts_manager;
94
+ $errors = $sby_posts_manager->get_errors();
95
+ if ( ! empty( $errors ) ) :
96
+ foreach ( $errors as $type => $error ) :
97
+ echo $type . ': ' . str_replace( array( '<p>', '<b>', '</p>', '</b>' ), ' ', $error[1] ) . "\n";
98
+ endforeach;
99
+ endif;
100
+ ?>
101
+
102
+ </textarea>
inc/class-sby-api-connect.php ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( '-1' );
4
+ }
5
+
6
+ class SBY_API_Connect
7
+ {
8
+ /**
9
+ * @var string
10
+ */
11
+ private $url;
12
+
13
+ /**
14
+ * @var object
15
+ */
16
+ private $response;
17
+
18
+ public function __construct( $connected_account_or_url, $endpoint = '', $params = array() ) {
19
+ if ( is_array( $connected_account_or_url ) && isset( $connected_account_or_url['access_token'] ) ) {
20
+ $this->set_url( $connected_account_or_url, $endpoint, $params );
21
+ } elseif ( strpos( $connected_account_or_url, 'https' ) !== false ) {
22
+ $this->url = $connected_account_or_url;
23
+ } else {
24
+ $this->url = '';
25
+ }
26
+ }
27
+
28
+ public function get_data() {
29
+ if (!is_wp_error($this->response) && !empty($this->response['data'])) {
30
+ return $this->response['data'];
31
+ } else {
32
+ return $this->response;
33
+ }
34
+ }
35
+
36
+ public function get_wp_error() {
37
+ if ( $this->is_wp_error() ) {
38
+ return array( 'response' => $this->response, 'url' => $this->url );
39
+ } else {
40
+ return false;
41
+ }
42
+ }
43
+
44
+ public function get_next_page() {
45
+ if ( ! empty( $this->response['nextPageToken'] ) ) {
46
+ return $this->response['nextPageToken'];
47
+ } else {
48
+ return '';
49
+ }
50
+ }
51
+
52
+ public function set_url_from_args( $url ) {
53
+ $this->url = $url;
54
+ }
55
+
56
+ public function get_url() {
57
+ return $this->url;
58
+ }
59
+
60
+ public function is_wp_error() {
61
+ return is_wp_error( $this->response );
62
+ }
63
+
64
+
65
+ public function is_youtube_error() {
66
+ return (is_wp_error( $this->response ) || isset( $this->response['error'] ));
67
+ }
68
+
69
+ public function connect() {
70
+ $args = array(
71
+ 'timeout' => 60,
72
+ 'sslverify' => false
73
+ );
74
+ $response = wp_remote_get( esc_url_raw( $this->url ), $args );
75
+
76
+ if ( ! is_wp_error( $response ) ) {
77
+ // certain ways of representing the html for double quotes causes errors so replaced here.
78
+ $response = json_decode( str_replace( '%22', '&rdquo;', $response['body'] ), true );
79
+ }
80
+
81
+ $this->response = $response;
82
+ }
83
+
84
+ public static function handle_youtube_error( $response, $error_connected_account, $request_type = '' ) {
85
+ if ( isset( $response['error'] ) ) {
86
+ if ( isset( $response['error']['errors'][0]['reason'] ) && $response['error']['errors'][0]['message'] === 'Invalid Credentials' ) {
87
+ if ( isset( $error_connected_account['refresh_token'] ) ) {
88
+ $new_token_data = SBY_API_Connect::refresh_token( sby_get_account_bottom(), $error_connected_account['refresh_token'], sby_get_account_top() );
89
+
90
+ if ( isset( $new_token_data['access_token'] ) ) {
91
+ return $new_token_data;
92
+ }
93
+ global $sby_posts_manager;
94
+
95
+ $sby_posts_manager->add_api_request_delay( 300 );
96
+
97
+ return false;
98
+ }
99
+ } elseif ( isset( $response['error']['errors'][0]['reason'] ) ) {
100
+ $error = $response['error']['errors'][0]['message'] . ' - ' . $response['error']['errors'][0]['reason'];
101
+
102
+ $error_message = '<p><b>' . sprintf( __( 'Error: %s.', 'instagram-feed' ), $error ) . '</b>';
103
+ if ( $response['error']['errors'][0]['reason'] === 'keyInvalid' ) {
104
+ $error_message .= '<p>' . __( 'There\'s an issue with the YouTube API Key that you are using. Please check to make sure that this is a valid API Key.', SBY_TEXT_DOMAIN );
105
+ }
106
+
107
+ global $sby_posts_manager;
108
+
109
+ $sby_posts_manager->add_frontend_error( 'api', $error_message );
110
+ $sby_posts_manager->add_error( 'api', array( 'Error connecting', $error_message ) );
111
+
112
+ $sby_posts_manager->add_api_request_delay( 300 );
113
+ }
114
+ }
115
+ }
116
+
117
+ public static function handle_wp_remote_get_error( $response ) {
118
+ $message = sprintf( __( 'Error connecting to %s.', SBY_TEXT_DOMAIN ), $response['url'] ). ' ';
119
+ if ( isset( $response['response'] ) && isset( $response['response']->errors ) ) {
120
+ foreach ( $response['response']->errors as $key => $item ) {
121
+ $message .= ' '.$key . ' - ' . $item[0] . ' |';
122
+ }
123
+ }
124
+
125
+ global $sby_posts_manager;
126
+
127
+ $sby_posts_manager->add_api_request_delay( 300 );
128
+
129
+ $sby_posts_manager->add_error( 'connection', array( 'Error connecting', $message ) );
130
+ }
131
+
132
+ protected function set_url( $connected_account, $endpoint_slug, $params ) {
133
+ $num = ! empty( $params['num'] ) ? (int)$params['num'] : 50;
134
+
135
+ if ( $endpoint_slug === 'tokeninfo' ) {
136
+ $url = 'https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=' . $connected_account['access_token'];
137
+ } elseif ( $endpoint_slug === 'channels' ) {
138
+ $channel_param = 'mine=true';
139
+ if ( isset( $params['channel_name'] ) ) {
140
+ $channel_param = 'forUsername=' . $params['channel_name'];
141
+ } elseif ( isset( $params['channel_id'] ) ) {
142
+ $channel_param = 'id=' . $params['channel_id'];
143
+ }
144
+ $next_page = '';
145
+ if ( isset( $params['nextPageToken'] ) ) {
146
+ $next_page = 'pageToken=' . $params['nextPageToken'];
147
+ }
148
+ $access_credentials = isset( $connected_account['api_key'] ) ? 'key=' . $connected_account['api_key'] : 'access_token=' . $connected_account['access_token'];
149
+
150
+ $url = 'https://www.googleapis.com/youtube/v3/channels?part=id,snippet,status,statistics,brandingSettings,contentDetails&'.$channel_param.'&' . $access_credentials . $next_page;
151
+ } elseif ( $endpoint_slug === 'search' ) {
152
+ $q_param = '';
153
+ if ( isset( $params['q'] ) ) {
154
+ $q_param = $params['q'];
155
+ }
156
+ $type = '';
157
+ if ( isset( $params['type'] ) ) {
158
+ $type = '&type='. $params['type'];
159
+ }
160
+ $access_credentials = isset( $connected_account['api_key'] ) ? 'key=' . $connected_account['api_key'] : 'access_token=' . $connected_account['access_token'];
161
+
162
+ $url = 'https://www.googleapis.com/youtube/v3/search?part=snippet&q='.$q_param.'&maxResults='.$num.$type.'&'.$access_credentials;
163
+ } elseif ( $endpoint_slug === 'playlistItems' ) {
164
+ $access_credentials = isset( $connected_account['api_key'] ) ? 'key=' . $connected_account['api_key'] : 'access_token=' . $connected_account['access_token'];
165
+
166
+ $url = 'https://www.googleapis.com/youtube/v3/playlistItems?part=id,snippet,contentDetails,status&maxResults='.$num.'&playlistId='.$params['playlist_id'].'&' . $access_credentials;
167
+ } else {
168
+ $channel_param = 'mine=true';
169
+ if ( isset( $params['username'] ) ) {
170
+ $channel_param = 'forUsername=' . $params['username'];
171
+ } elseif ( isset( $params['channel_id'] ) ) {
172
+ $channel_param = 'id=' . $params['channel_id'];
173
+ }
174
+ $access_credentials = isset( $connected_account['api_key'] ) ? 'key=' . $connected_account['api_key'] : 'access_token=' . $connected_account['access_token'];
175
+
176
+ $url = 'https://www.googleapis.com/youtube/v3/channels?part=id,snippet&'.$channel_param.'&' . $access_credentials;
177
+ }
178
+
179
+ $this->set_url_from_args( $url );
180
+ }
181
+
182
+ public static function refresh_token( $client_id, $refresh_token, $client_secret ) {
183
+ $response = wp_remote_post( 'https://www.googleapis.com/oauth2/v4/token/?client_id=' . $client_id . '&client_secret=' . $client_secret . '&refresh_token='. $refresh_token . '&grant_type=refresh_token' );
184
+
185
+ if ( $response['response']['code'] === 200 ) {
186
+ $return = json_decode( $response['body'], true );
187
+ } else {
188
+ $return = array();
189
+ }
190
+
191
+ return $return;
192
+ }
193
+
194
+ }
inc/class-sby-cron-update.php ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class SBY_Cron_Updater
4
+ *
5
+ * Finds all regular feed transients saved in the database and updates
6
+ * each cached feed in the background using WP Cron. This is set up with the
7
+ * "sby_cron_updater" function in the if-functions.php file. The "display_instagram"
8
+ * function will trigger a single feed update if no transient is found
9
+ * for the feed
10
+ *
11
+ * @since 2.0/5.0
12
+ */
13
+
14
+ if ( ! defined( 'ABSPATH' ) ) {
15
+ die( '-1' );
16
+ }
17
+
18
+ class SBY_Cron_Updater
19
+ {
20
+ /**
21
+ * Find and loop through all feed cache transients and update the post and
22
+ * header caches
23
+ *
24
+ * Overwritten in the Pro version
25
+ *
26
+ * @since 1.0
27
+ */
28
+ public static function do_feed_updates() {
29
+ $feed_caches = SBY_Cron_Updater::get_feed_cache_option_names();
30
+ shuffle( $feed_caches );
31
+ $database_settings = sby_get_database_settings();
32
+
33
+ // this is outputted in system info
34
+ $report = array(
35
+ 'notes' => array(
36
+ 'time_ran' => date( 'Y-m-d H:i:s' ),
37
+ 'num_found_transients' => count( $feed_caches )
38
+ )
39
+ );
40
+
41
+ foreach ( $feed_caches as $feed_cache ) {
42
+
43
+ $feed_id = str_replace( '_transient_', '', $feed_cache['option_name'] );
44
+ $report[ $feed_id ] = array();
45
+
46
+ $transient = get_transient( $feed_id );
47
+
48
+ if ( $transient ) {
49
+ $feed_data = json_decode( $transient, true );
50
+
51
+ // shortcode attributes are saved in order to recreate the feed is needed
52
+ $atts = isset( $feed_data['atts'] ) ? $feed_data['atts'] : false;
53
+ $last_retrieve = isset( $feed_data['last_retrieve'] ) ? (int)$feed_data['last_retrieve'] : 0;
54
+ // the last approximate time the feed was requested to be displayed on a page is recorded
55
+ // in order to stop updating feeds not in use.
56
+ $last_requested = isset( $feed_data['last_requested'] ) ? (int)$feed_data['last_requested'] : false;
57
+ $report[ $feed_id ]['last_retrieve'] = date( 'Y-m-d H:i:s', $last_retrieve );
58
+ if ( $atts !== false ) {
59
+
60
+ if ( ! $last_requested || $last_requested > (time() - 60*60*24*30) ) {
61
+ $sby_settings_obj = new SBY_Settings( $atts, $database_settings );
62
+
63
+ if ( empty( $settings['connected_accounts'] ) && empty( $database_settings['api_key'] ) ) {
64
+ $report[ $feed_id ]['did_update'] = 'no - no connected account';
65
+ } else {
66
+ SBY_Cron_Updater::do_single_feed_cron_update( $sby_settings_obj, $feed_data, $atts );
67
+
68
+ $report[ $feed_id ]['did_update'] = 'yes';
69
+ }
70
+ } else {
71
+ $report[ $feed_id ]['did_update'] = 'no - not recently requested';
72
+ }
73
+
74
+
75
+ } else {
76
+ $report[ $feed_id ]['did_update'] = 'no - missing atts';
77
+ }
78
+
79
+ } else {
80
+ $report[ $feed_id ]['did_update'] = 'no - no transient found';
81
+ }
82
+
83
+ }
84
+
85
+ update_option( 'sby_cron_report', $report, false );
86
+ }
87
+
88
+ /**
89
+ * Update a single feed cache based on settings. Local image storing and
90
+ * resizing is done in the background here as well unless this is the initial
91
+ * time the feed is created and no cached data exists yet.
92
+ *
93
+ * Overwritten in the Pro version
94
+ *
95
+ * @param object $sby_settings_obj object created by the sby_settings class
96
+ * @param array $feed_data post, header, shortcode settings, and other info
97
+ * associated with the feed that is saved in the cache
98
+ * @param array $atts shortcode settings
99
+ * @param bool $include_resize whether or not to resize images during the update since
100
+ * images can also be resized with an ajax call when the feed is viewed on the frontend
101
+ *
102
+ * @since 1.0
103
+ */
104
+ public static function do_single_feed_cron_update( $sby_settings_obj, $feed_data, $atts, $include_resize = true ) {
105
+ $sby_settings_obj->set_feed_type_and_terms();
106
+ $sby_settings_obj->set_transient_name();
107
+ $transient_name = $sby_settings_obj->get_transient_name();
108
+ $settings = $sby_settings_obj->get_settings();
109
+ $feed_type_and_terms = $sby_settings_obj->get_feed_type_and_terms();
110
+
111
+ $youtube_feed = new SBY_Feed( $transient_name );
112
+
113
+ while ( $youtube_feed->need_posts( $settings['num'] ) && $youtube_feed->can_get_more_posts() ) {
114
+ $youtube_feed->add_remote_posts( $settings, $feed_type_and_terms, $sby_settings_obj->get_connected_accounts_in_feed() );
115
+ }
116
+
117
+ $to_cache = array(
118
+ 'atts' => $atts,
119
+ 'last_requested' => $feed_data['last_requested'],
120
+ 'last_retrieve' => time()
121
+ );
122
+
123
+ $youtube_feed->set_cron_cache( $to_cache, $sby_settings_obj->get_cache_time_in_seconds(), $settings['backup_cache_enabled'] );
124
+
125
+ if ( $youtube_feed->need_header( $settings, $feed_type_and_terms ) ) {
126
+ $youtube_feed->set_remote_header_data( $settings, $feed_type_and_terms, $sby_settings_obj->get_connected_accounts_in_feed() );
127
+
128
+ $youtube_feed->cache_header_data( $sby_settings_obj->get_cache_time_in_seconds(), $settings['backup_cache_enabled'] );
129
+ }
130
+
131
+ if ( $include_resize ) {
132
+ $post_data = $youtube_feed->get_post_data();
133
+ $post_data = array_slice( $post_data, 0, $settings['num'] );
134
+
135
+ foreach ( $post_data as $post ) {
136
+ $wp_post = new SBY_WP_Post( $post, $transient_name );
137
+ $wp_post->update_post();
138
+ }
139
+ }
140
+
141
+ }
142
+
143
+ /**
144
+ * Retrieve option name column values for all feed cache transients
145
+ *
146
+ * @return array
147
+ *
148
+ * @since 1.0
149
+ */
150
+ public static function get_feed_cache_option_names() {
151
+ global $wpdb;
152
+ $feed_caches = array();
153
+
154
+ $results = $wpdb->get_results( "
155
+ SELECT option_name
156
+ FROM $wpdb->options
157
+ WHERE `option_name` LIKE ('%\_transient\_sby\_%')
158
+ AND `option_name` NOT LIKE ('%\_transient\_sby\_header%');", ARRAY_A );
159
+
160
+ if ( isset( $results[0] ) ) {
161
+ $feed_caches = $results;
162
+ }
163
+
164
+ return $feed_caches;
165
+ }
166
+
167
+ /**
168
+ * Start cron jobs based on user's settings for cron cache update frequency.
169
+ * This is triggered when settings are saved on the "Configure" tab.
170
+ *
171
+ * @param string $sby_cache_cron_interval arbitrary name from one of the
172
+ * settings on the "Configure" tab
173
+ * @param string $sby_cache_cron_time hour of the day (1 = 1:00)
174
+ * @param string $sby_cache_cron_am_pm am or pm (time of day)
175
+ *
176
+ * @since 1.0
177
+ */
178
+ public static function start_cron_job( $sby_cache_cron_interval, $sby_cache_cron_time, $sby_cache_cron_am_pm ) {
179
+ wp_clear_scheduled_hook( 'sby_feed_update' );
180
+
181
+ if ( $sby_cache_cron_interval === '12hours' || $sby_cache_cron_interval === '24hours' ) {
182
+ $relative_time_now = time() + sby_get_utc_offset();
183
+ $base_day = strtotime( date( 'Y-m-d', $relative_time_now ) );
184
+ $add_time = $sby_cache_cron_am_pm === 'pm' ? (int)$sby_cache_cron_time + 12 : (int)$sby_cache_cron_time;
185
+ $utc_start_time = $base_day + (($add_time * 60 * 60) - sby_get_utc_offset());
186
+
187
+ if ( $utc_start_time < time() ) {
188
+ if ( $sby_cache_cron_interval === '12hours' ) {
189
+ $utc_start_time += 60*60*12;
190
+ } else {
191
+ $utc_start_time += 60*60*24;
192
+ }
193
+ }
194
+
195
+ if ( $sby_cache_cron_interval === '12hours' ) {
196
+ wp_schedule_event( $utc_start_time, 'twicedaily', 'sby_feed_update' );
197
+ } else {
198
+ wp_schedule_event( $utc_start_time, 'daily', 'sby_feed_update' );
199
+ }
200
+
201
+ } else {
202
+
203
+ if ( $sby_cache_cron_interval === '30mins' ) {
204
+ wp_schedule_event( time(), 'sby30mins', 'sby_feed_update' );
205
+ } else {
206
+ wp_schedule_event( time(), 'hourly', 'sby_feed_update' );
207
+ }
208
+ }
209
+
210
+ }
211
+
212
+ }
inc/class-sby-display-elements.php ADDED
@@ -0,0 +1,398 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ die( '-1' );
5
+ }
6
+
7
+ class SBY_Display_Elements
8
+ {
9
+ /**
10
+ * Images are hidden initially with the new/transition classes
11
+ * except if the js image loading is disabled using the plugin
12
+ * settings
13
+ *
14
+ * @param $settings
15
+ *
16
+ * @return string
17
+ *
18
+ * @since 1.0
19
+ */
20
+ public static function get_item_classes( $settings ) {
21
+ $classes = array( 'sby_new' );
22
+ if ( !$settings['disable_js_image_loading'] ) {
23
+ $classes[] = 'sby_transition';
24
+ } else {
25
+ $classes[] = 'sby_no_js';
26
+
27
+ $classes[] = 'sby_no_resraise';
28
+ $classes[] = 'sby_js_load_disabled';
29
+ }
30
+
31
+ if ( $settings['layout'] !== 'list' ) {
32
+ $classes[] = 'sby_no_margin';
33
+ }
34
+
35
+ return ' ' . implode( ' ', $classes );
36
+ }
37
+
38
+ /**
39
+ * Overwritten in the Pro version.
40
+ *
41
+ * @param string $type key of the kind of icon needed
42
+ * @param string $icon_type svg or font
43
+ *
44
+ * @return string the complete html for the icon
45
+ *
46
+ * @since 1.0
47
+ */
48
+ public static function get_icon( $type, $icon_type ) {
49
+ return self::get_basic_icons( $type, $icon_type );
50
+ }
51
+
52
+ public static function get_cols( $settings ) {
53
+ if ( isset( $settings[ $settings['layout'] . 'cols'] ) ) {
54
+ return $settings[ $settings['layout'] . 'cols'];
55
+ }
56
+ return 0;
57
+ }
58
+
59
+ public static function get_cols_mobile( $settings ) {
60
+ if ( isset( $settings[ $settings['layout'] . 'colsmobile'] ) ) {
61
+ return $settings[ $settings['layout'] . 'colsmobile'];
62
+ }
63
+ return 0;
64
+ }
65
+
66
+ public static function get_style_att( $context, $settings, $pos = false ) {
67
+ $style_settings = array();
68
+ $item_spacing_setting = $settings['itemspacing'];
69
+ if ( ! preg_match("/(px)|(%)/", $item_spacing_setting ) ) {
70
+ $item_spacing_setting = $item_spacing_setting . $settings['itemspacingunit'];
71
+ }
72
+ if ( $context === 'player' ) {
73
+ $style_settings['margin-bottom'] = $item_spacing_setting;
74
+ } elseif ( $context === 'item' ) {
75
+ if ( $settings['layout'] === 'list' ) {
76
+ $style_settings['margin-bottom'] = $item_spacing_setting;
77
+ }
78
+ } elseif ( $context === 'items_wrap' || $context === 'player_outer_wrap' ) {
79
+ if ( $settings['layout'] !== 'list' ) {
80
+ $style_settings['padding'] = $item_spacing_setting;
81
+ }
82
+ } elseif ( $context === 'header' ) {
83
+ if ( $settings['itemspacing'] > 0 ) {
84
+ $style_settings['padding'] = $item_spacing_setting;
85
+ }
86
+ if ( $settings['itemspacing'] < 10 ) {
87
+ $style_settings['margin-bottom'] = '10px';
88
+ }
89
+ $style_settings['padding-bottom'] = '0';
90
+ }
91
+
92
+ if ( $context === 'player_outer_wrap' ) {
93
+ $style_settings['padding-bottom'] = 0;
94
+ }
95
+
96
+ $style_att = '';
97
+ if ( ! empty( $style_settings ) ) {
98
+ $style_att = ' style="';
99
+ foreach ( $style_settings as $prop => $val ) {
100
+ $style_att .= $prop . ': '. $val . ';';
101
+ }
102
+ $style_att .= '"';
103
+ }
104
+
105
+ return $style_att;
106
+ }
107
+
108
+ /**
109
+ * Returns the best media url for an image based on settings.
110
+ * By default a white placeholder image is loaded and replaced
111
+ * with the most optimal image size based on the actual dimensions
112
+ * of the image element in the feed.
113
+ *
114
+ * @param array $post data for an individual post
115
+ * @param array $settings
116
+ * @param array $resized_images (optional) not yet used but
117
+ * can pass in existing resized images to use in the source
118
+ *
119
+ * @return string
120
+ *
121
+ * @since 1.0
122
+ */
123
+ public static function get_optimum_media_url( $post, $settings, $resized_images = array() ) {
124
+ $media_url = '';
125
+ $optimum_res = $settings['imageres'];
126
+ $account_type = isset( $post['images'] ) ? 'personal' : 'business';
127
+
128
+ // only use the placeholder if it will be replaced using JS
129
+ if ( !$settings['disable_js_image_loading'] ) {
130
+ return trailingslashit( SBY_PLUGIN_URL ) . 'img/placeholder.png';
131
+ } elseif ( $settings['imageres'] === 'auto' ) {
132
+ $optimum_res = 'full';
133
+ $settings['imageres'] = 'full';
134
+ } else {
135
+ if ( $settings['imageres'] !== 'thumb' && ! empty( $resized_images ) ) {
136
+ $resolution = $settings['imageres'];
137
+ $post_id = SB_Instagram_Parse::get_post_id( $post );
138
+ if ( isset( $resized_images[ $post_id ] )
139
+ && $resized_images[ $post_id ]['id'] !== 'error'
140
+ && $resized_images[ $post_id ]['id'] !== 'pending'
141
+ && $resized_images[ $post_id ]['id'] !== 'video' ) {
142
+ if ( $resolution === 'medium' ) {
143
+ if ( isset( $resized_images[ $post_id ]['sizes']['low'] ) ) {
144
+ $suffix = 'low';
145
+ } elseif ( isset( $resized_images[ $post_id ]['sizes']['full'] ) ) {
146
+ $suffix = 'full';
147
+ }
148
+ } elseif ( $resolution === 'full' ) {
149
+ if ( isset( $resized_images[ $post_id ]['sizes']['full'] ) ) {
150
+ $suffix = 'full';
151
+ } elseif ( isset( $resized_images[ $post_id ]['sizes']['low'] ) ) {
152
+ $suffix = 'low';
153
+ }
154
+ } elseif ( $resolution === 'lightbox' ) {
155
+ if ( isset( $resized_images[ $post_id ]['sizes']['full'] ) ) {
156
+ $suffix = 'full';
157
+ }
158
+ }
159
+ if ( isset( $suffix ) ) {
160
+ $media_url = sby_get_resized_uploads_url() . $resized_images[ $post_id ]['id'] . $suffix . '.jpg';
161
+ return $media_url;
162
+ }
163
+ }
164
+ }
165
+ }
166
+
167
+ if ( $account_type === 'personal' ) {
168
+ switch ( $optimum_res ) {
169
+ case 'thumb' :
170
+ $media_url = $post['images']['thumbnail']['url'];
171
+ break;
172
+ case 'medium' :
173
+ $media_url = $post['images']['low_resolution']['url'];
174
+ break;
175
+ default :
176
+ $media_url = $post['images']['standard_resolution']['url'];
177
+ }
178
+ } else {
179
+ $post_id = SB_Instagram_Parse::get_post_id( $post );
180
+
181
+ // use resized images if exists
182
+ if ( $optimum_res === 'full' && isset( $resized_images[ $post_id ]['id'] )
183
+ && $resized_images[ $post_id ]['id'] !== 'pending'
184
+ && $resized_images[ $post_id ]['id'] !== 'video'
185
+ && $resized_images[ $post_id ]['id'] !== 'error' ) {
186
+ $media_url = sby_get_resized_uploads_url() . $resized_images[ $post_id ]['id'] . 'full.jpg';
187
+ } else {
188
+ $permalink = SB_Instagram_Parse::get_permalink( $post );
189
+ if ( substr_count( $permalink, '/' ) > 5 ) {
190
+ $permalink_array = explode( '/', $permalink );
191
+ $perm_id = $permalink_array[ count( $permalink_array ) - 2 ];
192
+ $permalink = 'https://www.instagram.com/p/' . $perm_id . '/';
193
+ }
194
+
195
+ if ( ($post['media_type'] === 'CAROUSEL_ALBUM' || $post['media_type'] === 'VIDEO') && ($optimum_res === 'lightbox' || $optimum_res === 'full')) {
196
+ $media_url = $permalink . 'media?size=l';
197
+ } else {
198
+ switch ($optimum_res) {
199
+ case 'thumb' :
200
+ $media_url = $permalink . 'media?size=t';
201
+ break;
202
+ case 'medium' :
203
+ $media_url = $permalink . 'media?size=m';
204
+ break;
205
+ default :
206
+ $media_url = $post['media_url'];
207
+ }
208
+ }
209
+ }
210
+
211
+ }
212
+
213
+ return $media_url;
214
+ }
215
+
216
+ /**
217
+ * Creates a style attribute that contains all of the styles for
218
+ * the main feed div.
219
+ *
220
+ * @param $settings
221
+ *
222
+ * @return string
223
+ */
224
+ public static function get_feed_style( $settings ) {
225
+
226
+ $styles = '';
227
+ $bg_color = str_replace( '#', '', $settings['background'] );
228
+
229
+ if ( ! empty( $settings['imagepadding'] )
230
+ || ! empty( $bg_color )
231
+ || ! empty( $settings['width'] )
232
+ || ! empty( $settings['height'] ) ) {
233
+ $styles = ' style="';
234
+ if ( ! empty( $settings['imagepadding'] ) ) {
235
+ $styles .= 'padding-bottom: ' . ((int)$settings['imagepadding'] * 2) . esc_attr( $settings['imagepaddingunit'] ) . ';';
236
+ }
237
+ if ( ! empty( $bg_color ) ) {
238
+ $styles .= 'background-color: rgb(' . esc_attr( sby_hextorgb( $bg_color ) ). ');';
239
+ }
240
+ if ( ! empty( $settings['width'] ) ) {
241
+ $styles .= 'width: ' . (int)$settings['width'] . esc_attr( $settings['widthunit'] ) . ';';
242
+ }
243
+ if ( ! empty( $settings['height'] ) ) {
244
+ $styles .= 'height: ' . (int)$settings['height'] . esc_attr( $settings['heightunit'] ) . ';';
245
+ }
246
+ $styles .= '"';
247
+ }
248
+ return $styles;
249
+ }
250
+
251
+ /**
252
+ * Creates a style attribute for the sby_images div
253
+ *
254
+ * @param $settings
255
+ *
256
+ * @return string
257
+ *
258
+ * @since 1.0
259
+ */
260
+ public static function get_items_wrap_style( $settings ) {
261
+ if ( ! empty ( $settings['imagepadding'] ) ) {
262
+ return 'style="padding: '.(int)$settings['imagepadding'] . esc_attr( $settings['imagepaddingunit'] ) . ';"';
263
+ }
264
+ return '';
265
+ }
266
+
267
+ /**
268
+ * Creates a style attribute for the header. Can be used in
269
+ * several places based on the header style
270
+ *
271
+ * @param $settings
272
+ *
273
+ * @return string
274
+ *
275
+ * @since 1.0
276
+ */
277
+ public static function get_header_text_color_styles( $settings ) {
278
+ $header_color = str_replace( '#', '', $settings['headercolor'] );
279
+
280
+ if ( ! empty( $header_color ) ) {
281
+ return 'style="color: rgb(' . esc_attr( sby_hextorgb( $header_color ) ). ');"';
282
+ }
283
+ return '';
284
+ }
285
+
286
+ /**
287
+ * Header icon and text size is styled using the class added here.
288
+ *
289
+ * @param $settings
290
+ *
291
+ * @return string
292
+ *
293
+ * @since 1.0
294
+ */
295
+ public static function get_header_size_class( $settings ) {
296
+ $header_size_class = in_array( strtolower( $settings['headersize'] ), array( 'medium', 'large' ) ) ? ' sby_'.strtolower( $settings['headersize'] ) : '';
297
+ return $header_size_class;
298
+ }
299
+
300
+ /**
301
+ * Creates a style attribute for the subscribe button. Can be in
302
+ * the feed footer or in a boxed header.
303
+ *
304
+ * @param $settings
305
+ *
306
+ * @return string
307
+ *
308
+ * @since 1.0
309
+ */
310
+ public static function get_subscribe_styles( $settings ) {
311
+ $styles = '';
312
+ $subscribe_color = str_replace( '#', '', $settings['subscribecolor'] );
313
+ $subscribe_text_color = str_replace( '#', '', $settings['subscribetextcolor'] );
314
+
315
+ if ( ! empty( $subscribe_color ) || ! empty( $subscribe_text_color ) ) {
316
+ $styles = 'style="';
317
+ if ( ! empty( $subscribe_color ) ) {
318
+ $styles .= 'background: rgb(' . esc_attr( sby_hextorgb( $subscribe_color ) ) . ');';
319
+ }
320
+ if ( ! empty( $subscribe_text_color ) ) {
321
+ $styles .= 'color: rgb(' . esc_attr( sby_hextorgb( $subscribe_text_color ) ). ');';
322
+ }
323
+ $styles .= '"';
324
+ }
325
+ return $styles;
326
+ }
327
+
328
+ /**
329
+ * Creates a style attribute for styling the load more button.
330
+ *
331
+ * @param $settings
332
+ *
333
+ * @return string
334
+ *
335
+ * @since 1.0
336
+ */
337
+ public static function get_load_button_styles( $settings ) {
338
+ $styles = '';
339
+ $button_color = str_replace( '#', '', $settings['buttoncolor'] );
340
+ $button_text_color = str_replace( '#', '', $settings['buttontextcolor'] );
341
+
342
+ if ( ! empty( $button_color ) || ! empty( $button_text_color ) ) {
343
+ $styles = 'style="';
344
+ if ( ! empty( $button_color ) ) {
345
+ $styles .= 'background: rgb(' . esc_attr( sby_hextorgb( $button_color ) ) . ');';
346
+ }
347
+ if ( ! empty( $button_text_color ) ) {
348
+ $styles .= 'color: rgb(' . esc_attr( sby_hextorgb( $button_text_color ) ). ');';
349
+ }
350
+ $styles .= '"';
351
+ }
352
+ return $styles;
353
+ }
354
+
355
+ /**
356
+ * Returns the html for an icon based on the kind requested
357
+ *
358
+ * @param string $type kind of icon needed (ex "video" is a play button)
359
+ * @param string $icon_type svg or font
360
+ *
361
+ * @return string
362
+ *
363
+ * @since 1.0
364
+ */
365
+ protected static function get_basic_icons( $type, $icon_type ) {
366
+ if ( $type === 'carousel' ) {
367
+ if ( $icon_type === 'svg' ) {
368
+ return '<svg class="svg-inline--fa fa-clone fa-w-16 sby_lightbox_carousel_icon" aria-hidden="true" data-fa-proÆ’cessed="" data-prefix="far" data-icon="clone" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
369
+ <path fill="currentColor" d="M464 0H144c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h320c26.51 0 48-21.49 48-48v-48h48c26.51 0 48-21.49 48-48V48c0-26.51-21.49-48-48-48zM362 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h42v224c0 26.51 21.49 48 48 48h224v42a6 6 0 0 1-6 6zm96-96H150a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h308a6 6 0 0 1 6 6v308a6 6 0 0 1-6 6z"></path>
370
+ </svg>';
371
+ } else {
372
+ return '<i class="fa fa-clone sby_carousel_icon" aria-hidden="true"></i>';
373
+ }
374
+
375
+ } elseif ( $type === 'video' ) {
376
+ if ( $icon_type === 'svg' ) {
377
+ return '<svg style="color: rgba(255,255,255,1)" class="svg-inline--fa fa-play fa-w-14 sby_playbtn" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="play" role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"></path></svg>';
378
+ } else {
379
+ return '<i class="fa fa-play sby_playbtn" aria-hidden="true"></i>';
380
+ }
381
+ } elseif ( $type === 'youtube' ) {
382
+ if ( $icon_type === 'svg' ) {
383
+ return '<svg aria-hidden="true" focusable="false" data-prefix="fab" data-icon="youtube" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" class="svg-inline--fa fa-youtube fa-w-18"><path fill="currentColor" d="M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z" class=""></path></svg>';
384
+ } else {
385
+ return '<i aria-hidden="true" role="img" class="sby_new_logo fab fa-youtube"></i>';
386
+ }
387
+ } elseif ( $type === 'newlogo' ) {
388
+ if ( $icon_type === 'svg' ) {
389
+ return '<svg aria-hidden="true" focusable="false" data-prefix="fab" data-icon="youtube" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" class="sby_new_logo svg-inline--fa fa-youtube fa-w-18"><path fill="currentColor" d="M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z" class=""></path></svg>';
390
+ } else {
391
+ return '<i aria-hidden="true" role="img" class="sby_new_logo fab fa-youtube"></i>';
392
+ }
393
+ } else {
394
+ return '';
395
+ }
396
+ }
397
+
398
+ }
inc/class-sby-feed.php ADDED
@@ -0,0 +1,1191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ die( '-1' );
5
+ }
6
+
7
+ class SBY_Feed
8
+ {
9
+ /**
10
+ * @var string
11
+ */
12
+ private $regular_feed_transient_name;
13
+
14
+ /**
15
+ * @var string
16
+ */
17
+ private $header_transient_name;
18
+
19
+ /**
20
+ * @var string
21
+ */
22
+ private $backup_feed_transient_name;
23
+
24
+ /**
25
+ * @var string
26
+ */
27
+ private $backup_header_transient_name;
28
+
29
+ private $channels_data;
30
+
31
+ /**
32
+ * @var array
33
+ */
34
+ private $post_data;
35
+
36
+ /**
37
+ * @var
38
+ */
39
+ private $header_data;
40
+
41
+ /**
42
+ * @var array
43
+ */
44
+ private $next_pages;
45
+
46
+ /**
47
+ * @var array
48
+ */
49
+ private $transient_atts;
50
+
51
+ /**
52
+ * @var int
53
+ */
54
+ private $last_retrieve;
55
+
56
+ /**
57
+ * @var bool
58
+ */
59
+ private $should_paginate;
60
+
61
+ /**
62
+ * @var int
63
+ */
64
+ private $num_api_calls;
65
+
66
+ /**
67
+ * @var int
68
+ */
69
+ private $max_api_calls;
70
+
71
+ /**
72
+ * @var array
73
+ */
74
+ private $image_ids_post_set;
75
+
76
+ /**
77
+ * @var bool
78
+ */
79
+ private $should_use_backup;
80
+
81
+ /**
82
+ * @var array
83
+ */
84
+ private $report;
85
+
86
+ private $successful_video_api_request_made;
87
+
88
+ /**
89
+ * SBY_Feed constructor.
90
+ *
91
+ * @param string $transient_name ID of this feed
92
+ * generated in the SBY_Settings class
93
+ */
94
+ public function __construct( $transient_name ) {
95
+ $this->regular_feed_transient_name = $transient_name;
96
+ $this->backup_feed_transient_name = SBY_BACKUP_PREFIX . $transient_name;
97
+
98
+ $sby_header_transient_name = str_replace( 'sby_', 'sby_header_', $transient_name );
99
+ $sby_header_transient_name = substr($sby_header_transient_name, 0, 44);
100
+ $this->header_transient_name = $sby_header_transient_name;
101
+ $this->backup_header_transient_name = SBY_BACKUP_PREFIX . $sby_header_transient_name;
102
+
103
+ $this->channels_data = array();
104
+
105
+ $this->post_data = array();
106
+ $this->next_pages = array();
107
+ $this->should_paginate = true;
108
+
109
+ // this is a count of how many api calls have been made for each feed
110
+ // type and term.
111
+ // By default the limit is 10
112
+ $this->num_api_calls = 0;
113
+ $this->max_api_calls = apply_filters( 'sby_max_concurrent_api_calls', 10 );
114
+ $this->should_use_backup = false;
115
+
116
+ // used for errors and the sby_debug report
117
+ $this->report = array();
118
+ $this->successful_video_api_request_made = false;
119
+ }
120
+
121
+ /**
122
+ * @return array
123
+ *
124
+ * @since 1.0
125
+ */
126
+ public function get_post_data() {
127
+ return $this->post_data;
128
+ }
129
+
130
+ /**
131
+ * @return array
132
+ *
133
+ * @since 1.0
134
+ */
135
+ public function set_post_data( $post_data ) {
136
+ $this->post_data = $post_data;
137
+ }
138
+
139
+ /**
140
+ * @return array
141
+ *
142
+ * @since 1.0
143
+ */
144
+ public function get_next_pages() {
145
+ return $this->next_pages;
146
+ }
147
+
148
+ /**
149
+ * Checks the database option related the transient expiration
150
+ * to ensure it will be available when the page loads
151
+ *
152
+ * @return bool
153
+ *
154
+ * @since 2.0/4.0
155
+ */
156
+ public function regular_cache_exists() {
157
+ //Check whether the cache transient exists in the database and is available for more than one more minute
158
+ $transient_exists = get_transient( $this->regular_feed_transient_name );
159
+
160
+ return $transient_exists;
161
+ }
162
+
163
+ /**
164
+ * Checks the database option related the header transient
165
+ * expiration to ensure it will be available when the page loads
166
+ *
167
+ * @return bool
168
+ *
169
+ * @since 1.0
170
+ */
171
+ public function regular_header_cache_exists() {
172
+ $header_transient = get_transient( $this->header_transient_name );
173
+
174
+ return $header_transient;
175
+ }
176
+
177
+ /**
178
+ * @return bool
179
+ *
180
+ * @since 1.0
181
+ */
182
+ public function should_use_backup() {
183
+ return $this->should_use_backup || empty( $this->post_data );
184
+ }
185
+
186
+ /**
187
+ * The header is only displayed when the setting is enabled and
188
+ * an account has been connected
189
+ *
190
+ * Overwritten in the Pro version
191
+ *
192
+ * @param array $settings settings specific to this feed
193
+ * @param array $feed_types_and_terms organized settings related to feed data
194
+ * (ex. 'user' => array( 'smashballoon', 'customyoutubefeed' )
195
+ *
196
+ * @return bool
197
+ *
198
+ * @since 1.0
199
+ */
200
+ public function need_header( $settings, $feed_types_and_terms ) {
201
+ $showheader = ($settings['showheader'] === 'on' || $settings['showheader'] === 'true' || $settings['showheader'] === true);
202
+ return ($showheader && isset( $feed_types_and_terms['channels'] ));
203
+ }
204
+
205
+ /**
206
+ * Use the transient name to retrieve cached data for header
207
+ *
208
+ * @since 1.0
209
+ */
210
+ public function set_header_data_from_cache() {
211
+ $header_cache = get_transient( $this->header_transient_name );
212
+
213
+ $header_cache = json_decode( $header_cache, true );
214
+
215
+ if ( ! empty( $header_cache ) ) {
216
+ $this->header_data = $header_cache;
217
+ }
218
+ }
219
+
220
+ public function set_header_data( $header_data ) {
221
+ $this->header_data = $header_data;
222
+ }
223
+
224
+ /**
225
+ * @since 1.0
226
+ */
227
+ public function get_header_data() {
228
+ return $this->header_data;
229
+ }
230
+
231
+ /**
232
+ * Sets the post data, pagination data, shortcode atts used (cron cache),
233
+ * and timestamp of last retrieval from transient (cron cache)
234
+ *
235
+ * @param array $atts available for cron caching
236
+ *
237
+ * @since 1.0
238
+ */
239
+ public function set_post_data_from_cache( $atts = array() ) {
240
+ $transient_data = get_transient( $this->regular_feed_transient_name );
241
+
242
+ $transient_data = json_decode( $transient_data, true );
243
+
244
+ if ( $transient_data ) {
245
+ $post_data = isset( $transient_data['data'] ) ? $transient_data['data'] : array();
246
+ $this->post_data = $post_data;
247
+ $this->next_pages = isset( $transient_data['pagination'] ) ? $transient_data['pagination'] : array();
248
+
249
+ if ( isset( $transient_data['atts'] ) ) {
250
+ $this->transient_atts = $transient_data['atts'];
251
+ $this->last_retrieve = $transient_data['last_retrieve'];
252
+ }
253
+ }
254
+ }
255
+
256
+ /**
257
+ * Sets post data from a permanent database backup of feed
258
+ * if it was created
259
+ *
260
+ * @since 1.0
261
+ */
262
+ public function maybe_set_post_data_from_backup() {
263
+ $args = array(
264
+ 'post_type' => SBY_CPT,
265
+ 'post_status' => array( 'publish', 'pending', 'draft' ),
266
+ 'orderby' => 'date',
267
+ 'order' => 'DESC',
268
+ 'posts_per_page' => 50,
269
+ 'meta_query' => array(
270
+ array(
271
+ 'value' => sby_strip_after_hash( $this->regular_feed_transient_name ),
272
+ 'key' => 'sby_feed_id'
273
+ )
274
+ )
275
+ );
276
+ $feed_videos = new WP_Query( $args );
277
+
278
+ if ( $feed_videos->have_posts() ) {
279
+ $posts = array();
280
+ while ( $feed_videos->have_posts() ) {
281
+ $feed_videos->the_post();
282
+ $json = get_post_meta( get_the_ID(), 'sby_json', true );
283
+
284
+ if ( $json ) {
285
+ $posts[] = json_decode( $json, true );
286
+ }
287
+ }
288
+
289
+ wp_reset_postdata();
290
+
291
+ $this->post_data = $posts;
292
+ return true;
293
+ } else {
294
+ $this->add_report( 'no backup post data found' );
295
+ wp_reset_postdata();
296
+
297
+ return false;
298
+ }
299
+ }
300
+
301
+ /**
302
+ * Sets header data from a permanent database backup of feed
303
+ * if it was created
304
+ *
305
+ * @since 1.0
306
+ */
307
+ public function maybe_set_header_data_from_backup() {
308
+ $backup_header_data = get_option( $this->backup_header_transient_name, false );
309
+
310
+ if ( ! empty( $backup_header_data ) ) {
311
+ $backup_header_data = json_decode( $backup_header_data, true );
312
+ $this->header_data = $backup_header_data;
313
+
314
+ return true;
315
+ } else {
316
+ $this->add_report( 'no backup header data found' );
317
+
318
+ return false;
319
+ }
320
+ }
321
+
322
+ /**
323
+ * Returns recorded image IDs for this post set
324
+ * for use with image resizing
325
+ *
326
+ * @return array
327
+ *
328
+ * @since 1.0
329
+ */
330
+ public function get_image_ids_post_set() {
331
+ return $this->image_ids_post_set;
332
+ }
333
+
334
+ /**
335
+ * Cron caching needs additional data saved in the transient
336
+ * to work properly. This function checks to make sure it's present
337
+ *
338
+ * @return bool
339
+ *
340
+ * @since 1.0
341
+ */
342
+ public function need_to_start_cron_job() {
343
+ return (( ! empty( $this->post_data ) && ! isset( $this->transient_atts )) || empty( $this->post_data ));
344
+ }
345
+
346
+ /**
347
+ * Checks to see if there are enough posts available to create
348
+ * the current page of the feed
349
+ *
350
+ * @param int $num
351
+ * @param int $offset
352
+ *
353
+ * @return bool
354
+ *
355
+ * @since 1.0
356
+ */
357
+ public function need_posts( $num, $offset = 0 ) {
358
+ $num_existing_posts = is_array( $this->post_data ) ? count( $this->post_data ) : 0;
359
+ $num_needed_for_page = (int)$num + (int)$offset;
360
+
361
+ ($num_existing_posts < $num_needed_for_page) ? $this->add_report( 'need more posts' ) : $this->add_report( 'have enough posts' );
362
+
363
+ return ($num_existing_posts < $num_needed_for_page);
364
+ }
365
+
366
+ /**
367
+ * Checks to see if there are additional pages available for any of the
368
+ * accounts in the feed and that the max conccurrent api request limit
369
+ * has not been reached
370
+ *
371
+ * @return bool
372
+ *
373
+ * @since 1.0
374
+ */
375
+ public function can_get_more_posts() {
376
+ $one_type_and_term_has_more_ages = $this->next_pages !== false;
377
+ $max_concurrent_api_calls_not_met = $this->num_api_calls < $this->max_api_calls;
378
+ $max_concurrent_api_calls_not_met ? $this->add_report( 'max conccurrent requests not met' ) : $this->add_report( 'max concurrent met' );
379
+ $one_type_and_term_has_more_ages ? $this->add_report( 'more pages available' ) : $this->add_report( 'no next page' );
380
+
381
+ return ($one_type_and_term_has_more_ages && $max_concurrent_api_calls_not_met);
382
+ }
383
+
384
+ /**
385
+ * Appends one filtered API request worth of posts for each feed term
386
+ *
387
+ * @param $settings
388
+ * @param array $feed_types_and_terms organized settings related to feed data
389
+ * (ex. 'user' => array( 'smashballoon', 'customyoutubefeed' )
390
+ * @param array $connected_accounts_for_feed connected account data for the
391
+ * feed types and terms
392
+ *
393
+ * @since 1.0
394
+ */
395
+ public function add_remote_posts( $settings, $feed_types_and_terms, $connected_accounts_for_feed ) {
396
+ $new_post_sets = array();
397
+ $next_pages = $this->next_pages;
398
+ global $sby_posts_manager;
399
+
400
+ /**
401
+ * Number of posts to retrieve in each API call
402
+ *
403
+ * @param int Minimum number of posts needed in each API request
404
+ * @param array $settings Settings for this feed
405
+ *
406
+ * @since 1.0
407
+ */
408
+ $num = apply_filters( 'sby_num_in_request', (int)$settings['minnum'], $settings );
409
+
410
+ $params = array(
411
+ 'num' => $num
412
+ );
413
+
414
+ $one_successful_connection = false;
415
+ $next_page_found = false;
416
+ $one_api_request_delayed = false;
417
+
418
+ foreach ( $feed_types_and_terms as $type => $terms ) {
419
+ if ( is_array( $terms ) && count( $terms ) > 5 ) {
420
+ shuffle( $terms );
421
+ }
422
+ foreach ( $terms as $term_and_params ) {
423
+ $term = $term_and_params['term'];
424
+ $params = array_merge( $params, $term_and_params['params'] );
425
+
426
+ $connected_account_for_term = $connected_accounts_for_feed[ $term ];
427
+ $api_requests_delayed = $sby_posts_manager->are_current_api_request_delays( $connected_account_for_term['channel_id'] );
428
+
429
+ if ( $connected_account_for_term['expires'] < time() + 5 ) {
430
+ $new_token_data = SBY_API_Connect::refresh_token( sby_get_account_bottom(), $connected_account_for_term['refresh_token'], sby_get_account_top() );
431
+
432
+ if ( isset( $new_token_data['access_token'] ) ) {
433
+ $connected_account_for_term['access_token'] = $new_token_data['access_token'];
434
+ $connected_accounts_for_feed[ $term ]['access_token'] = $new_token_data['access_token'];
435
+ $connected_account_for_term['expires'] = $new_token_data['expires_in'] + time();
436
+ $connected_accounts_for_feed[ $term ]['expires'] = $new_token_data['expires_in'] + time();
437
+
438
+ sby_update_or_connect_account( $connected_account_for_term );
439
+
440
+ $this->add_report( 'refreshing access token for ' . $connected_account_for_term['channel_id'] );
441
+ } else {
442
+ $this->add_report( 'refresh failed for ' . $connected_account_for_term['channel_id'] );
443
+ }
444
+ }
445
+
446
+ if ( ! $api_requests_delayed
447
+ && (! isset( $next_pages[ $term . '_' . $type ] ) || $next_pages[ $term . '_' . $type ] !== false) ) {
448
+
449
+ if ( empty( $this->channels_data[ $term ] ) ) {
450
+ $channel_data = array();
451
+ $api_connect_channels = new SBY_API_Connect( $connected_account_for_term, 'channels', $params );
452
+
453
+ $this->add_report( 'api call made for ' . $term . ' - ' . $type );
454
+
455
+ $api_connect_channels->connect();
456
+ if ( ! $api_connect_channels->is_wp_error() && ! $api_connect_channels->is_youtube_error() ) {
457
+ $channel_data = $api_connect_channels->get_data();
458
+ } else {
459
+ if ( ! $api_connect_channels->is_wp_error() ) {
460
+ $return = SBY_API_Connect::handle_youtube_error( $api_connect_channels->get_data(), $connected_account_for_term );
461
+ if ( $return && isset( $return['access_token'] ) ) {
462
+ $connected_account_for_term['access_token'] = $return['access_token'];
463
+ $connected_accounts_for_feed[ $term ]['access_token'] = $return['access_token'];
464
+ $connected_account_for_term['expires'] = $return['expires_in'] + time();
465
+ $connected_accounts_for_feed[ $term ]['expires'] = $return['expires_in'] + time();
466
+
467
+ sby_update_or_connect_account( $connected_account_for_term );
468
+ $this->add_report( 'refreshing access token for ' . $connected_account_for_term['channel_id'] );
469
+
470
+ $sby_api_connect_channel = new SBY_API_Connect( $connected_account_for_term, 'channels', $params );
471
+ $sby_api_connect_channel->connect();
472
+ if ( ! $sby_api_connect_channel->is_youtube_error() ) {
473
+ $channel_data = $sby_api_connect_channel->get_data();
474
+ }
475
+ } else {
476
+ $this->add_report( 'error connecting to channel' );
477
+ }
478
+ } else {
479
+ $api_connect_channels->handle_wp_remote_get_error( $api_connect_channels->get_data() );
480
+ }
481
+
482
+
483
+ }
484
+ $this->channels_data[ $term ] = $channel_data;
485
+ }
486
+
487
+ $first_playlist = isset( $this->channels_data[ $term ]['items'][0]['contentDetails']['relatedPlaylists']['uploads'] ) ? $this->channels_data[ $term ]['items'][0]['contentDetails']['relatedPlaylists']['uploads'] : false;
488
+ if ( $first_playlist ) {
489
+
490
+ $params = array( 'playlist_id' => $first_playlist );
491
+ if ( ! empty( $next_pages[ $term . '_' . $type ] ) ) {
492
+ $params['nextPageToken'] = $next_pages[ $term . '_' . $type ];
493
+ }
494
+
495
+ $api_connect_playlist_items = new SBY_API_Connect( $connected_account_for_term, 'playlistItems', $params );
496
+ $api_connect_playlist_items->connect();
497
+ if ( ! $api_connect_playlist_items->is_wp_error() && ! $api_connect_playlist_items->is_youtube_error() ) {
498
+ $one_successful_connection = true;
499
+
500
+ $data = $api_connect_playlist_items->get_data();
501
+
502
+ if ( isset( $data['items'][0] ) ) {
503
+ $post_set = $this->filter_posts( $data, $settings );
504
+
505
+ $this->successful_video_api_request_made = true;
506
+
507
+ $new_post_sets[] = $post_set;
508
+ }
509
+
510
+ $next_page = $api_connect_playlist_items->get_next_page();
511
+ if ( ! empty( $next_page ) ) {
512
+ $next_pages[ $term . '_' . $type ] = $next_page;
513
+ $next_page_found = true;
514
+ } else {
515
+ $next_pages[ $term . '_' . $type ] = false;
516
+ }
517
+ }
518
+ } else {
519
+ $this->add_report( 'no first playlist' );
520
+ }
521
+
522
+
523
+ $this->num_api_calls++;
524
+
525
+ }
526
+
527
+ }
528
+ }
529
+
530
+ if ( ! $one_successful_connection || ($one_api_request_delayed && empty( $new_post_sets )) ) {
531
+ $this->should_use_backup = true;
532
+ }
533
+ $posts = $this->merge_posts( $new_post_sets, $settings );
534
+
535
+ $posts = $this->sort_posts( $posts, $settings );
536
+
537
+ if ( ! empty( $this->post_data ) && is_array( $this->post_data ) ) {
538
+ $posts = array_merge( $this->post_data, $posts );
539
+ }
540
+
541
+ $this->post_data = $posts;
542
+
543
+ if ( isset( $next_page_found ) && $next_page_found ) {
544
+ $this->next_pages = $next_pages;
545
+ } else {
546
+ $this->next_pages = false;
547
+ }
548
+ }
549
+
550
+ /**
551
+ * Connects to the YouTube API and records returned data. Will use channel data if already
552
+ * set by the regular feed
553
+ *
554
+ * @param $settings
555
+ * @param array $feed_types_and_terms organized settings related to feed data
556
+ * (ex. 'user' => array( 'smashballoon', 'customyoutubefeed' )
557
+ * @param array $connected_accounts_for_feed connected account data for the
558
+ * feed types and terms
559
+ *
560
+ * @since 1.0
561
+ */
562
+ public function set_remote_header_data( $settings, $feed_types_and_terms, $connected_accounts_for_feed ) {
563
+ $first_user = $this->get_first_user( $feed_types_and_terms );
564
+ $this->header_data = false;
565
+
566
+ if ( isset( $this->channels_data[ $first_user ] ) ) {
567
+ $this->header_data = $this->channels_data[ $first_user ];
568
+ } elseif ( isset( $connected_accounts_for_feed[ $first_user ] ) ) {
569
+ $connection = new SBY_API_Connect( $connected_accounts_for_feed[ $first_user ], 'channels', array() );
570
+
571
+ $connection->connect();
572
+
573
+ if ( ! $connection->is_wp_error() && ! $connection->is_youtube_error() ) {
574
+ $this->header_data = $connection->get_data();
575
+
576
+ if ( isset( $connected_accounts_for_feed[ $first_user ]['local_avatar'] ) && $connected_accounts_for_feed[ $first_user ]['local_avatar'] ) {
577
+ $upload = wp_upload_dir();
578
+ $resized_url = trailingslashit( $upload['baseurl'] ) . trailingslashit( SBY_UPLOADS_NAME );
579
+
580
+ $full_file_name = $resized_url . $this->header_data['username'] . '.jpg';
581
+ $this->header_data['local_avatar'] = $full_file_name;
582
+ }
583
+ } else {
584
+ if ( $connection->is_wp_error() ) {
585
+ SBY_API_Connect::handle_wp_remote_get_error( $connection->get_wp_error() );
586
+ } else {
587
+ SBY_API_Connect::handle_youtube_error( $connection->get_data(), $connected_accounts_for_feed[ $first_user ], 'header' );
588
+ }
589
+ }
590
+ }
591
+ }
592
+
593
+ /**
594
+ * Stores feed data in a transient for a specified time
595
+ *
596
+ * @param int $cache_time
597
+ *
598
+ * @since 1.0
599
+ */
600
+ public function cache_feed_data( $cache_time ) {
601
+ if ( ! empty( $this->post_data ) || ! empty( $this->next_pages ) ) {
602
+ $this->remove_duplicate_posts();
603
+ $this->trim_posts_to_max();
604
+
605
+ $to_cache = array(
606
+ 'data' => $this->post_data,
607
+ 'pagination' => $this->next_pages
608
+ );
609
+
610
+ set_transient( $this->regular_feed_transient_name, wp_json_encode( $to_cache ), $cache_time );
611
+
612
+ } else {
613
+ $this->add_report( 'no data not caching' );
614
+ }
615
+ }
616
+
617
+ /**
618
+ * Stores feed data with additional data specifically for cron caching
619
+ *
620
+ * @param array $to_cache feed data with additional things like the shortcode
621
+ * settings, when the cache was last requested, when new posts were last retrieved
622
+ * @param int $cache_time how long the cache will last
623
+ *
624
+ * @since 1.0
625
+ */
626
+ public function set_cron_cache( $to_cache, $cache_time ) {
627
+ if ( ! empty( $this->post_data )
628
+ || ! empty( $this->next_pages )
629
+ || ! empty( $to_cache['data'] ) ) {
630
+ $this->remove_duplicate_posts();
631
+ $this->trim_posts_to_max();
632
+
633
+ $to_cache['data'] = isset( $to_cache['data'] ) ? $to_cache['data'] : $this->post_data;
634
+ $to_cache['pagination'] = isset( $to_cache['next_pages'] ) ? $to_cache['next_pages'] : $this->next_pages;
635
+ $to_cache['atts'] = isset( $to_cache['atts'] ) ? $to_cache['atts'] : $this->transient_atts;
636
+ $to_cache['last_requested'] = isset( $to_cache['last_requested'] ) ? $to_cache['last_requested'] : time();
637
+ $to_cache['last_retrieve'] = isset( $to_cache['last_retrieve'] ) ? $to_cache['last_retrieve'] : $this->last_retrieve;
638
+
639
+ set_transient( $this->regular_feed_transient_name, wp_json_encode( $to_cache ), $cache_time );
640
+ } else {
641
+ $this->add_report( 'no data not caching' );
642
+ }
643
+
644
+ }
645
+
646
+ /**
647
+ * Stores header data for a specified time as a transient
648
+ *
649
+ * @param int $cache_time
650
+ * @param bool $save_backup
651
+ *
652
+ * @since 1.0
653
+ */
654
+ public function cache_header_data( $cache_time, $save_backup = true ) {
655
+ if ( $this->header_data ) {
656
+ set_transient( $this->header_transient_name, wp_json_encode( $this->header_data ), $cache_time );
657
+
658
+ if ( $save_backup ) {
659
+ update_option( $this->backup_header_transient_name, wp_json_encode( $this->header_data ), false );
660
+ }
661
+ }
662
+ }
663
+
664
+ /**
665
+ * Used to randomly trigger an updating of the last requested data for cron caching
666
+ *
667
+ * @return bool
668
+ *
669
+ * @since 1.0
670
+ */
671
+ public function should_update_last_requested() {
672
+ return (rand( 1, 20 ) === 20);
673
+ }
674
+
675
+ /**
676
+ * Determines if pagination can and should be used based on settings and available feed data
677
+ *
678
+ * @param array $settings
679
+ * @param int $offset
680
+ *
681
+ * @return bool
682
+ *
683
+ * @since 1.0
684
+ */
685
+ public function should_use_pagination( $settings, $offset = 0 ) {
686
+ $posts_available = count( $this->post_data ) - ($offset + $settings['num']);
687
+ $show_loadmore_button_by_settings = ($settings['showbutton'] == 'on' || $settings['showbutton'] == 'true' || $settings['showbutton'] == true ) && $settings['showbutton'] !== 'false';
688
+
689
+ if ( $show_loadmore_button_by_settings ) {
690
+ // used for permanent and whitelist feeds
691
+ if ( $this->feed_is_complete( $settings, $offset ) ) {
692
+ $this->add_report( 'no pagination, feed complete' );
693
+ return false;
694
+ }
695
+ if ( $posts_available > 0 ) {
696
+ $this->add_report( 'do pagination, posts available' );
697
+ return true;
698
+ }
699
+ $pages = $this->next_pages;
700
+
701
+ if ( $pages && ! $this->should_use_backup() ) {
702
+ foreach ( $pages as $page ) {
703
+ if ( ! empty( $page ) ) {
704
+ return true;
705
+ }
706
+ }
707
+ }
708
+
709
+ }
710
+
711
+
712
+ $this->add_report( 'no pagination, no posts available' );
713
+
714
+ return false;
715
+ }
716
+
717
+ /**
718
+ * Generates the HTML for the feed if post data is available. Although it seems
719
+ * some of the variables ar not used they are set here to hide where they
720
+ * come from when used in the feed templates.
721
+ *
722
+ * @param array $settings
723
+ * @param array $atts
724
+ * @param array $feed_types_and_terms organized settings related to feed data
725
+ * (ex. 'user' => array( 'smashballoon', 'customyoutubefeed' )
726
+ * @param array $connected_accounts_for_feed connected account data for the
727
+ * feed types and terms
728
+ *
729
+ * @return false|string
730
+ *
731
+ * @since 1.0
732
+ */
733
+ public function get_the_feed_html( $settings, $atts, $feed_types_and_terms, $connected_accounts_for_feed ) {
734
+ global $sby_posts_manager;
735
+
736
+ if ( empty( $this->post_data ) && ! empty( $connected_accounts_for_feed ) ) {
737
+ $error = '<p><b>' . __( 'Error: No videos found.', SBY_TEXT_DOMAIN ) . '</b>';
738
+ $error .= '<p>' . __( 'Make sure this is a valid channel ID and that the channel has videos available on youtube.com.', SBY_TEXT_DOMAIN ) . '</p>';
739
+
740
+ $sby_posts_manager->add_frontend_error( 'noposts', $error );
741
+ }
742
+
743
+ $posts = array_slice( $this->post_data, 0, $settings['minnum'] );
744
+ $header_data = ! empty( $this->header_data ) ? $this->header_data : false;
745
+
746
+ $first_username = false;
747
+ if ( $header_data ) {
748
+ $first_username = SBY_Parse::get_channel_id( $header_data );
749
+ } elseif ( isset( $this->post_data[0] ) ) { // in case no connected account for feed
750
+ $first_username = SBY_Parse::get_channel_id( $this->post_data[0] );
751
+ }
752
+
753
+ $use_pagination = $this->should_use_pagination( $settings, 0 );
754
+
755
+ $feed_id = $this->regular_feed_transient_name;
756
+ $shortcode_atts = ! empty( $atts ) ? wp_json_encode( $atts ) : '{}';
757
+
758
+ $settings['header_outside'] = false;
759
+ $settings['header_inside'] = false;
760
+ if ( $header_data && $settings['showheader'] ) {
761
+ $settings['header_inside'] = true;
762
+ }
763
+
764
+ $other_atts = '';
765
+
766
+ $classes = array();
767
+ if ( empty( $settings['widthresp'] ) || $settings['widthresp'] == 'on' || $settings['widthresp'] == 'true' || $settings['widthresp'] === true ) {
768
+ if ( $settings['widthresp'] !== 'false' ) {
769
+ $classes[] = 'sby_width_resp';
770
+ }
771
+ }
772
+ if ( ! empty( $settings['class'] ) ) {
773
+ $classes[] = esc_attr( $settings['class'] );
774
+ }
775
+ if ( ! empty( $settings['height'] )
776
+ && (((int)$settings['height'] < 100 && $settings['heightunit'] === '%') || $settings['heightunit'] === 'px') ) {
777
+ $classes[] = 'sby_fixed_height';
778
+ }
779
+ if ( ! empty( $settings['disablemobile'] )
780
+ && ($settings['disablemobile'] == 'on' || $settings['disablemobile'] == 'true' || $settings['disablemobile'] == true) ) {
781
+ if ( $settings['disablemobile'] !== 'false' ) {
782
+ $classes[] = 'sby_disable_mobile';
783
+ }
784
+ }
785
+
786
+ $additional_classes = '';
787
+ if ( ! empty( $classes ) ) {
788
+ $additional_classes = ' ' . implode( ' ', $classes );
789
+ }
790
+
791
+ $other_atts = $this->add_other_atts( $other_atts, $settings );
792
+
793
+ $flags = array();
794
+
795
+ if ( $this->successful_video_api_request_made && ! empty( $posts ) ) {
796
+ if ( $settings['storage_process'] === 'page' ) {
797
+ foreach ( $posts as $post ) {
798
+ $wp_post = new SBY_WP_Post( $post, $this->regular_feed_transient_name );
799
+ $wp_post->update_post();
800
+ }
801
+ } elseif ( $settings['storage_process'] === 'background' ) {
802
+ $flags[] = 'checkWPPosts';
803
+ }
804
+ }
805
+
806
+ if ( $settings['disable_resize'] ) {
807
+ $flags[] = 'resizeDisable';
808
+ } elseif ( $settings['favor_local'] ) {
809
+ $flags[] = 'favorLocal';
810
+ }
811
+
812
+ if ( $settings['disable_js_image_loading'] ) {
813
+ $flags[] = 'imageLoadDisable';
814
+ }
815
+ if ( $settings['ajax_post_load'] ) {
816
+ $flags[] = 'ajaxPostLoad';
817
+ }
818
+ if ( isset( $_GET['sby_debug'] ) ) {
819
+ $flags[] = 'debug';
820
+ }
821
+
822
+ if ( ! empty( $flags ) ) {
823
+ $other_atts .= ' data-sby-flags="' . implode(',', $flags ) . '"';
824
+ }
825
+
826
+ if ( $settings['layout'] === 'grid' ) {
827
+ $other_atts .= ' data-sby-supports-lightbox="1"';
828
+ }
829
+ $icon_type = $settings['font_method'];
830
+
831
+
832
+ ob_start();
833
+ include sby_get_feed_template_part( 'feed', $settings );
834
+ $html = ob_get_contents();
835
+ ob_get_clean();
836
+
837
+ if ( $settings['ajaxtheme'] ) {
838
+ $html .= $this->get_ajax_page_load_html();
839
+ }
840
+
841
+ return $html;
842
+ }
843
+
844
+ /**
845
+ * Generates HTML for individual sby_item elements
846
+ *
847
+ * @param array $settings
848
+ * @param int $offset
849
+ * @param array $feed_types_and_terms organized settings related to feed data
850
+ * (ex. 'user' => array( 'smashballoon', 'customyoutubefeed' )
851
+ * @param array $connected_accounts_for_feed connected account data for the
852
+ * feed types and terms
853
+ *
854
+ * @return false|string
855
+ *
856
+ * @since 1.0
857
+ */
858
+ public function get_the_items_html( $settings, $offset, $feed_types_and_terms, $connected_accounts_for_feed ) {
859
+ if ( empty( $this->post_data ) ) {
860
+ ob_start();
861
+ $html = ob_get_contents();
862
+ ob_get_clean(); ?>
863
+ <p><?php _e( 'No posts found.', SBY_TEXT_DOMAIN ); ?></p>
864
+ <?php
865
+ $html = ob_get_contents();
866
+ ob_get_clean();
867
+ return $html;
868
+ }
869
+
870
+ $posts = array_slice( $this->post_data, $offset, $settings['num'] );
871
+
872
+ ob_start();
873
+
874
+ $this->posts_loop( $posts, $settings, $offset );
875
+
876
+ $html = ob_get_contents();
877
+ ob_get_clean();
878
+
879
+ return $html;
880
+ }
881
+
882
+ /**
883
+ * Overwritten in the Pro version
884
+ *
885
+ * @return object
886
+ */
887
+ public function make_api_connection( $connected_account_or_page, $type = NULL, $params = NULL ) {
888
+ return new SBY_API_Connect( $connected_account_or_page, $type, $params );
889
+ }
890
+
891
+ /**
892
+ * When the feed is loaded with AJAX, the JavaScript for the plugin
893
+ * needs to be triggered again. This function is a workaround that adds
894
+ * the file and settings to the page whenever the feed is generated.
895
+ *
896
+ * @return string
897
+ *
898
+ * @since 1.0
899
+ */
900
+ public static function get_ajax_page_load_html() {
901
+ global $sby_settings;
902
+
903
+ $js_options = array(
904
+ 'adminAjaxUrl' => admin_url( 'admin-ajax.php' ),
905
+ 'placeholder' => trailingslashit( SBY_PLUGIN_URL ) . 'img/placeholder.png',
906
+ 'lightboxPlaceholder' => trailingslashit( SBY_PLUGIN_URL ) . 'img/lightbox-placeholder.png',
907
+ 'autoplay' => $sby_settings['playvideo'] === 'automatically'
908
+ );
909
+
910
+ $encoded_options = wp_json_encode( $js_options );
911
+
912
+ $js_option_html = '<script type="text/javascript">if (typeof sbyOptions === "undefined") var sbyOptions = ' . $encoded_options . ';</script>';
913
+ $js_option_html .= "<script type='text/javascript' src='" . trailingslashit( SBY_PLUGIN_URL ) . 'js/sb-youtube.min.js?ver=' . SBYVER . "'></script>";
914
+
915
+ return $js_option_html;
916
+ }
917
+
918
+ /**
919
+ * Overwritten in the Pro version
920
+ *
921
+ * @param $feed_types_and_terms
922
+ *
923
+ * @return string
924
+ *
925
+ * @since 2.1/5.2
926
+ */
927
+ public function get_first_user( $feed_types_and_terms ) {
928
+ if ( isset( $feed_types_and_terms['channels'][0] ) ) {
929
+ return $feed_types_and_terms['channels'][0]['term'];
930
+ } else {
931
+ return '';
932
+ }
933
+ }
934
+
935
+ /**
936
+ * Adds recorded strings to an array
937
+ *
938
+ * @param $to_add
939
+ *
940
+ * @since 1.0
941
+ */
942
+ public function add_report( $to_add ) {
943
+ $this->report[] = $to_add;
944
+ }
945
+
946
+ /**
947
+ * @return array
948
+ *
949
+ * @since 1.0
950
+ */
951
+ public function get_report() {
952
+ return $this->report;
953
+ }
954
+
955
+ /**
956
+ * Additional options/settings added to the main div
957
+ * for the feed
958
+ *
959
+ * Overwritten in the Pro version
960
+ *
961
+ * @param $other_atts
962
+ * @param $settings
963
+ *
964
+ * @return string
965
+ */
966
+ protected function add_other_atts( $other_atts, $settings ) {
967
+ return '';
968
+ }
969
+
970
+ /**
971
+ * Used for filtering a single API request worth of posts
972
+ *
973
+ * Overwritten in the Pro version
974
+ *
975
+ * @param array $post_set a single set of post data from the api
976
+ *
977
+ * @return mixed|array
978
+ *
979
+ * @since 1.0
980
+ */
981
+ protected function filter_posts( $post_set, $settings = array() ) {
982
+ // array_unique( $post_set, SORT_REGULAR);
983
+
984
+ return $post_set['items'];
985
+ }
986
+
987
+ protected function remove_duplicate_posts() {
988
+ $posts = $this->post_data;
989
+ $ids_in_feed = array();
990
+ $non_duplicate_posts = array();
991
+ $removed = array();
992
+
993
+ foreach ( $posts as $post ) {
994
+ $post_id = SBY_Parse::get_post_id( $post );
995
+ if ( ! in_array( $post_id, $ids_in_feed, true ) ) {
996
+ $ids_in_feed[] = $post_id;
997
+ $non_duplicate_posts[] = $post;
998
+ } else {
999
+ $removed[] = $post_id;
1000
+ }
1001
+ }
1002
+
1003
+ $this->add_report( 'removed duplicates: ' . implode(', ', $removed ) );
1004
+ $this->set_post_data( $non_duplicate_posts );
1005
+ }
1006
+
1007
+ /**
1008
+ * Used for limiting the cache size
1009
+ *
1010
+ * @since 2.0/5.1.1
1011
+ */
1012
+ protected function trim_posts_to_max() {
1013
+ if ( ! is_array( $this->post_data ) ) {
1014
+ return;
1015
+ }
1016
+
1017
+ $max = apply_filters( 'sby_max_cache_size', 500 );
1018
+ $this->set_post_data( array_slice( $this->post_data , 0, $max ) );
1019
+
1020
+ }
1021
+
1022
+ /**
1023
+ * Used for permanent feeds or white list feeds to
1024
+ * stop pagination if all posts are already added
1025
+ *
1026
+ * Overwritten in the Pro version
1027
+ *
1028
+ * @param array $settings
1029
+ * @param int $offset
1030
+ *
1031
+ * @return bool
1032
+ *
1033
+ * @since 1.0
1034
+ */
1035
+ protected function feed_is_complete( $settings, $offset = 0 ) {
1036
+ return false;
1037
+ }
1038
+
1039
+ /**
1040
+ * Iterates through post data and tracks the index of the current post.
1041
+ * The actual post ids of the posts are stored in an array so the plugin
1042
+ * can search for local images that may be available.
1043
+ *
1044
+ * @param array $posts final filtered post data for the feed
1045
+ * @param array $settings
1046
+ * @param int $offset
1047
+ *
1048
+ * @since 1.0
1049
+ */
1050
+ private function posts_loop( $posts, $settings, $offset = 0 ) {
1051
+
1052
+ $image_ids = array();
1053
+ $post_index = $offset;
1054
+ $icon_type = $settings['font_method'];
1055
+
1056
+ foreach ( $posts as $post ) {
1057
+ $image_ids[] = SBY_Parse::get_post_id( $post );
1058
+ include sby_get_feed_template_part( 'item', $settings );
1059
+ $post_index++;
1060
+ }
1061
+
1062
+ $this->image_ids_post_set = $image_ids;
1063
+ }
1064
+
1065
+ /**
1066
+ * Uses array of API request results and merges them based on how
1067
+ * the feed should be sorted. Mixed feeds are always sorted alternating
1068
+ * since there is no post date for hashtag feeds.
1069
+ *
1070
+ * @param array $post_sets an array of single API request worth
1071
+ * of posts
1072
+ * @param array $settings
1073
+ *
1074
+ * @return array
1075
+ *
1076
+ * @since 1.0
1077
+ */
1078
+ private function merge_posts( $post_sets, $settings ) {
1079
+ $merged_posts = array();
1080
+ if ( $settings['sortby'] === 'alternate' ) {
1081
+ // don't bother merging posts if there is only one post set
1082
+ if ( isset( $post_sets[1] ) ) {
1083
+ $min_cycles = max( 1, (int)$settings['num'] );
1084
+ for( $i = 0; $i <= $min_cycles; $i++ ) {
1085
+ foreach ( $post_sets as $post_set ) {
1086
+ if ( isset( $post_set[ $i ] ) && isset( $post_set[ $i ]['id'] ) ) {
1087
+ $merged_posts[] = $post_set[ $i ];
1088
+ }
1089
+ }
1090
+ }
1091
+ } else {
1092
+ $merged_posts = isset( $post_sets[0] ) ? $post_sets[0] : array();
1093
+ }
1094
+ } else {
1095
+ // don't bother merging posts if there is only one post set
1096
+ if ( isset( $post_sets[1] ) ) {
1097
+ foreach ( $post_sets as $post_set ) {
1098
+ if ( isset( $post_set[0]['id'] ) ) {
1099
+ $merged_posts = array_merge( $merged_posts, $post_set );
1100
+ }
1101
+ }
1102
+ } else {
1103
+ $merged_posts = isset( $post_sets[0] ) ? $post_sets[0] : array();
1104
+ }
1105
+ }
1106
+
1107
+
1108
+ return $merged_posts;
1109
+ }
1110
+
1111
+ /**
1112
+ * Sorts a post set based on sorting settings. Sorting by "alternate"
1113
+ * is done when merging posts for efficiency's sake so the post set is
1114
+ * just returned as it is.
1115
+ *
1116
+ * @param array $post_set
1117
+ * @param array $settings
1118
+ *
1119
+ * @return mixed|array
1120
+ *
1121
+ * @since 1.0
1122
+ */
1123
+ private function sort_posts( $post_set, $settings ) {
1124
+ if ( empty( $post_set ) ) {
1125
+ return $post_set;
1126
+ }
1127
+
1128
+ // sorting done with "merge_posts" to be more efficient
1129
+ if ( $settings['sortby'] === 'alternate' ) {
1130
+ $return_post_set = $post_set;
1131
+ } elseif ( $settings['sortby'] === 'random' ) {
1132
+ /*
1133
+ * randomly selects posts in a random order. Cache saves posts
1134
+ * in this random order so paginating does not cause some posts to show up
1135
+ * twice or not at all
1136
+ */
1137
+ usort($post_set, 'sby_rand_sort' );
1138
+ $return_post_set = $post_set;
1139
+
1140
+ } else {
1141
+ // compares posted on dates of posts
1142
+ usort($post_set, 'sby_date_sort' );
1143
+ $return_post_set = $post_set;
1144
+ }
1145
+
1146
+ /**
1147
+ * Apply a custom sorting of posts
1148
+ *
1149
+ * @param array $return_post_set Ordered set of filtered posts
1150
+ * @param array $settings Settings for this feed
1151
+ *
1152
+ * @since 1.0
1153
+ */
1154
+
1155
+ return apply_filters( 'sby_sorted_posts', $return_post_set, $settings );
1156
+ }
1157
+
1158
+ /**
1159
+ * Can trigger a second attempt at getting posts from the API
1160
+ *
1161
+ * Overwritten in the Pro version
1162
+ *
1163
+ * @param string $type
1164
+ * @param array $connected_account_with_error
1165
+ * @param int $attempts
1166
+ *
1167
+ * @return bool
1168
+ *
1169
+ * @since 1.0
1170
+ */
1171
+ protected function can_try_another_request( $type, $connected_account_with_error, $attempts = 0 ) {
1172
+ return false;
1173
+ }
1174
+
1175
+ /**
1176
+ * returns a second connected account if it exists
1177
+ *
1178
+ * Overwritten in the Pro version
1179
+ *
1180
+ * @param string $type
1181
+ * @param array $attempted_connected_accounts
1182
+ *
1183
+ * @return bool
1184
+ *
1185
+ * @since 1.0
1186
+ */
1187
+ protected function get_different_connected_account( $type, $attempted_connected_accounts ) {
1188
+ return false;
1189
+ }
1190
+
1191
+ }
inc/class-sby-parse.php ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ die( '-1' );
5
+ }
6
+
7
+ class SBY_Parse
8
+ {
9
+ /**
10
+ * @param $post array
11
+ *
12
+ * @return mixed
13
+ *
14
+ * @since 1.0
15
+ */
16
+ public static function get_post_id( $post ) {
17
+ return $post['id'];
18
+ }
19
+
20
+ public static function get_video_id( $post ) {
21
+ return $post['snippet']['resourceId']['videoId'];
22
+ }
23
+
24
+ /**
25
+ * @param $post array
26
+ *
27
+ * @return false|int
28
+ *
29
+ * @since 1.0
30
+ */
31
+ public static function get_timestamp( $post ) {
32
+ $timestamp = 0;
33
+ // contentDetails->videoPublishedAt gives same result
34
+ if ( isset( $post['snippet']['publishedAt'] ) ) {
35
+ $remove_plus = trim( str_replace( array( 'T', '+', '.000Z' ), ' ', $post['snippet']['publishedAt'] ) );
36
+ $timestamp = strtotime( $remove_plus );
37
+ }
38
+
39
+ return $timestamp;
40
+ }
41
+
42
+ /**
43
+ * @param $post array
44
+ *
45
+ * @return mixed
46
+ *
47
+ * @since 1.0
48
+ */
49
+ public static function get_permalink( $post ) {
50
+ if ( isset( $post['snippet']['resourceId']['videoId'] ) ) {
51
+ return 'https://www.youtube.com/watch?v=' . $post['snippet']['resourceId']['videoId'];
52
+ } elseif ( isset( $post['snippet']['channelId'] ) ) {
53
+ return 'https://www.youtube.com/channel/' . $post['snippet']['channelId'];
54
+ }
55
+
56
+ return 'https://www.youtube.com/';
57
+ }
58
+
59
+ /**
60
+ * @param array $post
61
+ * @param string $resolution
62
+ *
63
+ * @return string
64
+ *
65
+ * @since 1.0
66
+ */
67
+ public static function get_media_url( $post, $resolution = 'lightbox' ) {
68
+ $thumbnail_key = 'standard';
69
+ switch ( $resolution ) {
70
+ case 'thumb' :
71
+ $thumbnail_key = 'default';
72
+ break;
73
+ case 'medium' :
74
+ $thumbnail_key = 'medium';
75
+ break;
76
+ case 'high' :
77
+ $thumbnail_key = 'high';
78
+ break;
79
+ }
80
+
81
+ if ( isset( $post['snippet']['thumbnails'][ $thumbnail_key ]['url'] ) ) {
82
+ return $post['snippet']['thumbnails'][ $thumbnail_key ]['url'];
83
+ }
84
+
85
+ return '';
86
+ }
87
+
88
+ /**
89
+ * Uses the existing data for the individual YouTube post to
90
+ * set the best image sources for each resolution size. Due to
91
+ * random bugs or just how the API works, different post types
92
+ * need special treatment.
93
+ *
94
+ * @param array $post
95
+ * @param array $resized_images
96
+ *
97
+ * @return array
98
+ *
99
+ * @since 1.0
100
+ */
101
+ public static function get_media_src_set( $post, $resized_images = array() ) {
102
+ $media_urls = array();
103
+ $thumbnails = isset( $post['snippet']['thumbnails'] ) ? $post['snippet']['thumbnails'] : false;
104
+ $largest_found = '';
105
+
106
+ if ( $thumbnails ) {
107
+ if ( isset( $thumbnails['default']['url'] ) ) {
108
+ $media_urls['120'] = $thumbnails['default']['url'];
109
+ $largest_found = $thumbnails['default']['url'];
110
+ } else {
111
+ $media_urls['120'] = $largest_found;
112
+ }
113
+ if ( isset( $thumbnails['medium']['url'] ) ) {
114
+ $media_urls['320'] = $thumbnails['medium']['url'];
115
+ $largest_found = $thumbnails['medium']['url'];
116
+ } else {
117
+ $media_urls['320'] = $largest_found;
118
+ }
119
+ if ( isset( $thumbnails['high']['url'] ) ) {
120
+ $media_urls['480'] = $thumbnails['high']['url'];
121
+ $largest_found = $thumbnails['high']['url'];
122
+ } else {
123
+ $media_urls['480'] = $largest_found;
124
+ }
125
+ if ( isset( $thumbnails['standard']['url'] ) ) {
126
+ $media_urls['640'] = $thumbnails['standard']['url'];
127
+ } else {
128
+ $media_urls['640'] = $largest_found;
129
+ }
130
+ }
131
+
132
+
133
+ return $media_urls;
134
+ }
135
+
136
+ /**
137
+ * A default can be set in the case that the user doesn't use captions
138
+ * for posts as this is also used as the alt text for the image.
139
+ *
140
+ * @param $post
141
+ * @param string $default
142
+ *
143
+ * @return string
144
+ *
145
+ * @since 1.0
146
+ */
147
+ public static function get_caption( $post, $default = '' ) {
148
+ $caption = $default;
149
+ if ( isset( $post['snippet']['description'] ) ) {
150
+ $caption = $post['snippet']['description'];
151
+ }
152
+
153
+ return $caption;
154
+ }
155
+
156
+ public static function get_video_title( $channel_or_playlist_item_data ) {
157
+ if ( isset( $channel_or_playlist_item_data['items'][0]['snippet']['title'] ) ) {
158
+ return $channel_or_playlist_item_data['items'][0]['snippet']['title'];
159
+ } else if ( isset( $channel_or_playlist_item_data['snippet']['title'] ) ) {
160
+ return $channel_or_playlist_item_data['snippet']['title'];
161
+ }
162
+ return '';
163
+ }
164
+
165
+ public static function get_channel_id( $channel_or_playlist_item_data ) {
166
+ if ( isset( $channel_or_playlist_item_data['items'][0]['id'] ) ) {
167
+ return $channel_or_playlist_item_data['items'][0]['id'];
168
+ } elseif ( isset( $channel_or_playlist_item_data['snippet']['channelId'] ) ) {
169
+ return $channel_or_playlist_item_data['snippet']['channelId'];
170
+ }
171
+ return '';
172
+ }
173
+
174
+ public static function get_channel_title( $channel_or_playlist_item_data ) {
175
+ if ( isset( $channel_or_playlist_item_data['items'][0]['snippet']['title'] ) ) {
176
+ return $channel_or_playlist_item_data['items'][0]['snippet']['title'];
177
+ } elseif ( isset( $channel_or_playlist_item_data['snippet']['channelTitle'] ) ) {
178
+ return $channel_or_playlist_item_data['snippet']['channelTitle'];
179
+ }
180
+ return '';
181
+ }
182
+
183
+ public static function get_channel_permalink( $channel_data ) {
184
+ return 'https://www.youtube.com/channel/' . SBY_Parse::get_channel_id( $channel_data ) . '/';
185
+ }
186
+
187
+ /**
188
+ * @param array $header_data
189
+ * @param array $settings
190
+ *
191
+ * @return string
192
+ *
193
+ * @since 1.0
194
+ */
195
+ public static function get_avatar( $header_data, $settings = array( 'favor_local' => false ) ) {
196
+ if ( $settings['favor_local'] && ! empty( $header_data['local_avatar'] ) ) {
197
+ return $header_data['local_avatar'];
198
+ } else {
199
+ if ( isset( $header_data['items'][0]['snippet']['thumbnails'] ) ) {
200
+ if ( $settings['headersize'] === 'large' ) {
201
+ return $header_data['items'][0]['snippet']['thumbnails']['high']['url'];
202
+ } elseif ( $settings['headersize'] === 'medium' ) {
203
+ return $header_data['items'][0]['snippet']['thumbnails']['medium']['url'];
204
+ } else {
205
+ return $header_data['items'][0]['snippet']['thumbnails']['default']['url'];
206
+ }
207
+ }
208
+ }
209
+ return '';
210
+ }
211
+
212
+ /**
213
+ * Account bio/description used in header
214
+ *
215
+ * @param $header_data
216
+ *
217
+ * @return string
218
+ *
219
+ * @since 1.0
220
+ */
221
+ public static function get_channel_description( $header_data ) {
222
+ if ( isset( $header_data['items'][0]['snippet']['description'] ) ) {
223
+ return $header_data['items'][0]['snippet']['description'];
224
+ }
225
+ return '';
226
+ }
227
+ }
inc/class-sby-posts-manager.php ADDED
@@ -0,0 +1,345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ die( '-1' );
5
+ }
6
+
7
+ class SBY_Posts_Manager
8
+ {
9
+ var $options_prefix;
10
+
11
+ /**
12
+ * @var int
13
+ */
14
+ var $limit;
15
+
16
+ /**
17
+ * @var array
18
+ */
19
+ var $errors;
20
+
21
+ var $ajax_status;
22
+
23
+ /**
24
+ * @var array
25
+ */
26
+ var $frontend_errors;
27
+
28
+ /**
29
+ * @var bool
30
+ */
31
+ var $resizing_tables_exist;
32
+
33
+ /**
34
+ * SBY_Posts_Manager constructor.
35
+ */
36
+ public function __construct( $options_prefix, $errors, $ajax_status ) {
37
+ $this->options_prefix = $options_prefix;
38
+ $this->errors = $errors;
39
+ $this->ajax_status = $ajax_status;
40
+ $this->frontend_errors = array();
41
+ }
42
+
43
+ /**
44
+ * @return array
45
+ *
46
+ * @since 1.0
47
+ */
48
+ public function get_ajax_status() {
49
+ return $this->ajax_status;
50
+ }
51
+
52
+ /**
53
+ * @param $to_update
54
+ *
55
+ * @since 1.0
56
+ */
57
+ public function update_ajax_status( $to_update ) {
58
+ foreach ( $to_update as $key => $value ) {
59
+ $this->ajax_status[ $key ] = $value;
60
+ }
61
+
62
+ update_option( $this->options_prefix . '_ajax_status', $this->ajax_status );
63
+ }
64
+
65
+ /**
66
+ * When the plugin is first installed and used, an AJAX call to admin-ajax.php
67
+ * is made to verify that it's available
68
+ *
69
+ * @param bool $force_check
70
+ *
71
+ * @return bool
72
+ *
73
+ * @since 1.0
74
+ */
75
+ public function maybe_start_ajax_test( $force_check = false ) {
76
+ if ( ! $this->ajax_status['tested'] || $force_check ) {
77
+ set_transient( $this->options_prefix . '_doing_ajax_test', 'yes', 60*60 );
78
+ $this->update_ajax_status( array( 'tested' => true ) );
79
+ return true;
80
+ }
81
+
82
+ return false;
83
+ }
84
+
85
+ /**
86
+ * Called if a successful admin ajax request is made
87
+ *
88
+ * @since 1.0
89
+ */
90
+ public function update_successful_ajax_test() {
91
+ $this->update_ajax_status( array( 'successful' => true ) );
92
+ }
93
+
94
+ /**
95
+ * @return bool
96
+ *
97
+ * @since 1.0
98
+ */
99
+ public function should_add_ajax_test_notice() {
100
+ return ($this->ajax_status['tested'] && ! $this->ajax_status['successful'] && get_transient( $this->options_prefix . '_doing_ajax_test' ) !== 'yes');
101
+ }
102
+
103
+ /**
104
+ * The plugin has a limit on how many post records can be stored and
105
+ * images resized to avoid overloading servers. This function deletes the post that
106
+ * has the longest time passed since it was retrieved.
107
+ *
108
+ * @since 1.0
109
+ */
110
+ public function delete_least_used_image() {
111
+
112
+ }
113
+
114
+ /**
115
+ * Calculates how many records are in the database and whether or not it exceeds the limit
116
+ *
117
+ * @return bool
118
+ *
119
+ * @since 1.0
120
+ */
121
+ public function max_total_records_reached() {
122
+ global $wpdb;
123
+ $table_name = $wpdb->prefix . SBY_ITEMS;
124
+
125
+ $num_records = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" );
126
+
127
+ if ( !isset( $this->limit ) && (int)$num_records > SBY_MAX_RECORDS ) {
128
+ $this->limit = (int)$num_records - SBY_MAX_RECORDS;
129
+ }
130
+
131
+ return ((int)$num_records > SBY_MAX_RECORDS);
132
+ }
133
+
134
+ /**
135
+ * The plugin caps how many new images are created in a 15 minute window to
136
+ * avoid overloading servers
137
+ *
138
+ * @return bool
139
+ *
140
+ * @since 1.0
141
+ */
142
+ public function max_resizing_per_time_period_reached() {
143
+ global $wpdb;
144
+ $table_name = $wpdb->prefix . SBY_ITEMS;
145
+
146
+ $fifteen_minutes_ago = date( 'Y-m-d H:i:s', time() - 15 * 60 );
147
+
148
+ $num_new_records = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name WHERE created_on > '$fifteen_minutes_ago'" );
149
+
150
+ return ((int)$num_new_records > 100);
151
+ }
152
+
153
+ /**
154
+ * @return bool
155
+ *
156
+ * @since 1.0
157
+ */
158
+ public function image_resizing_disabled() {
159
+ global $sby_settings;
160
+
161
+ $disable_resizing = isset( $sby_settings['disable_resize'] ) ? $sby_settings['disable_resize'] === 'on' || $sby_settings['disable_resize'] === true : false;
162
+
163
+ if ( ! $disable_resizing ) {
164
+ $disable_resizing = isset( $this->resizing_tables_exist ) ? ! $this->resizing_tables_exist : ! $this->does_resizing_tables_exist();
165
+ }
166
+
167
+ return $disable_resizing;
168
+ }
169
+
170
+ /**
171
+ * Used to skip image resizing if the tables were never successfully
172
+ * created
173
+ *
174
+ * @return bool
175
+ *
176
+ * @since 1.0
177
+ */
178
+ public function does_resizing_tables_exist() {
179
+ return true;
180
+ }
181
+
182
+ /**
183
+ * Resets the custom tables and deletes all image files
184
+ *
185
+ * @since 1.0
186
+ */
187
+ public function delete_all_sby_posts() {
188
+ $upload = wp_upload_dir();
189
+
190
+ global $wpdb;
191
+
192
+ $image_files = glob( trailingslashit( $upload['basedir'] ) . trailingslashit( SBY_UPLOADS_NAME ) . '*' ); // get all file names
193
+ foreach ( $image_files as $file ) { // iterate files
194
+ if ( is_file( $file ) ) {
195
+ unlink( $file );
196
+ }
197
+ }
198
+
199
+ $options = get_option( $this->options_prefix . '_settings', array() );
200
+ $connected_accounts = isset( $options['connected_accounts'] ) ? $options['connected_accounts'] : array();
201
+
202
+ foreach ( $connected_accounts as $account_id => $data ) {
203
+
204
+ if ( isset( $data['local_avatar'] ) ) {
205
+ $connected_accounts[ $account_id ]['local_avatar'] = false;
206
+ }
207
+
208
+ }
209
+
210
+ $options['connected_accounts'] = $connected_accounts;
211
+
212
+ update_option( $this->options_prefix . '_settings', $options );
213
+
214
+ $table_name = $wpdb->prefix . "options";
215
+
216
+ $wpdb->query( "
217
+ DELETE
218
+ FROM $table_name
219
+ WHERE `option_name` LIKE ('%\_transient\_\$sby\_%')
220
+ " );
221
+ $wpdb->query( "
222
+ DELETE
223
+ FROM $table_name
224
+ WHERE `option_name` LIKE ('%\_transient\_timeout\_\$sby\_%')
225
+ " );
226
+
227
+ $upload = wp_upload_dir();
228
+ $upload_dir = $upload['basedir'];
229
+ $upload_dir = trailingslashit( $upload_dir ) . SBY_UPLOADS_NAME;
230
+ if ( ! file_exists( $upload_dir ) ) {
231
+ $created = wp_mkdir_p( $upload_dir );
232
+ if ( $created ) {
233
+ $this->remove_error( 'upload_dir' );
234
+ } else {
235
+ $this->add_error( 'upload_dir', array( __( 'There was an error creating the folder for storing resized images.', SBY_TEXT_DOMAIN ), $upload_dir ) );
236
+ }
237
+ } else {
238
+ $this->remove_error( 'upload_dir' );
239
+ }
240
+
241
+ }
242
+
243
+ /**
244
+ * @return array
245
+ *
246
+ * @since 1.0
247
+ */
248
+ public function get_errors() {
249
+ return $this->errors;
250
+ }
251
+
252
+ /**
253
+ * @param $type
254
+ * @param $message_array
255
+ *
256
+ * @since 1.0
257
+ */
258
+ public function add_error( $type, $message_array ) {
259
+ $this->errors[ $type ] = $message_array;
260
+
261
+ update_option( 'sby_errors', $this->errors, false );
262
+ }
263
+
264
+ /**
265
+ * @param $type
266
+ *
267
+ * @since 1.0
268
+ */
269
+ public function remove_error( $type ) {
270
+ if ( isset( $this->errors[ $type ] ) ) {
271
+ unset( $this->errors[ $type ] );
272
+
273
+ update_option( $this->options_prefix . '_errors', $this->errors, false );
274
+ }
275
+ }
276
+
277
+ /**
278
+ * @param $type
279
+ * @param $message
280
+ *
281
+ * @since 1.0
282
+ */
283
+ public function add_frontend_error( $type, $message ) {
284
+ $this->frontend_errors[ $type ] = $message;
285
+ }
286
+
287
+ /**
288
+ * @return array
289
+ *
290
+ * @since 1.0
291
+ */
292
+ public function get_frontend_errors() {
293
+ return $this->frontend_errors;
294
+ }
295
+
296
+ /**
297
+ * @return array
298
+ *
299
+ * @since 1.0
300
+ */
301
+ public function reset_frontend_errors() {
302
+ return $this->frontend_errors = array();
303
+ }
304
+
305
+ /**
306
+ * @since 1.0
307
+ */
308
+ public function add_api_request_delay( $time_in_seconds = 300, $account_id = false ) {
309
+ if ( $account_id ) {
310
+ set_transient( SBY_USE_BACKUP_PREFIX . $this->options_prefix . '_' . $account_id, '1', $time_in_seconds );
311
+ } else {
312
+ set_transient( SBY_USE_BACKUP_PREFIX . $this->options_prefix . '_delay_requests', '1', $time_in_seconds );
313
+ }
314
+ }
315
+
316
+ /**
317
+ * @since 1.0
318
+ */
319
+ public function are_current_api_request_delays( $account_id = false ) {
320
+ $is_delay = (get_transient( SBY_USE_BACKUP_PREFIX . $this->options_prefix . '_delay_requests' ) !== false);
321
+
322
+ if ( $is_delay ) {
323
+ $error = '<p><b>' . sprintf( __( 'Notice: API requests are being delayed for 5 minutes.', SBY_TEXT_DOMAIN ) ) . ' ' . __( 'Feed will not update.', SBY_TEXT_DOMAIN ) . '</b>';
324
+ $errors = $this->get_errors();
325
+ if ( ! empty( $errors ) && current_user_can( 'manage_options' ) ) {
326
+ if ( isset( $errors['api'] ) ) {
327
+ $error .= '<p>' . $errors['api'][1] . '</p>';
328
+ } elseif ( isset( $errors['connection'] ) ) {
329
+ $error .= '<p>' . $errors['connection'][1] . '</p>';
330
+ }
331
+ } else {
332
+ $error .= '<p>' . __( 'There may be an issue with the YouTube access token that you are using. Your server might also be unable to connect to YouTube at this time.', SBY_TEXT_DOMAIN );
333
+ }
334
+
335
+ $this->add_frontend_error( 'api_delay', $error );
336
+
337
+ }
338
+
339
+ if ( ! $is_delay && $account_id ) {
340
+ $is_delay = (get_transient( SBY_BACKUP_PREFIX . $this->options_prefix . '_' . $account_id ) !== false);
341
+ }
342
+
343
+ return $is_delay;
344
+ }
345
+ }
inc/class-sby-settings.php ADDED
@@ -0,0 +1,326 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( '-1' );
4
+ }
5
+
6
+ class SBY_Settings {
7
+ /**
8
+ * @var array
9
+ */
10
+ protected $atts;
11
+
12
+ /**
13
+ * @var array
14
+ */
15
+ protected $db;
16
+
17
+ /**
18
+ * @var array
19
+ */
20
+ protected $settings;
21
+
22
+ /**
23
+ * @var array
24
+ */
25
+ protected $feed_type_and_terms;
26
+
27
+ /**
28
+ * @var array
29
+ */
30
+ protected $connected_accounts;
31
+
32
+ /**
33
+ * @var array
34
+ */
35
+ protected $connected_accounts_in_feed;
36
+
37
+ /**
38
+ * @var string
39
+ */
40
+ protected $transient_name;
41
+
42
+ /**
43
+ * SBY_Settings constructor.
44
+ *
45
+ * Overwritten in the Pro version.
46
+ *
47
+ * @param array $atts shortcode settings
48
+ * @param array $db settings from the wp_options table
49
+ */
50
+ public function __construct( $atts, $db ) {
51
+ $atts = is_array( $atts ) ? $atts : array();
52
+
53
+ // convert string 'false' and 'true' to booleans
54
+ foreach ( $atts as $key => $value ) {
55
+ if ( $value === 'false' ) {
56
+ $atts[ $key ] = false;
57
+ } elseif ( $value === 'true' ) {
58
+ $atts[ $key ] = true;
59
+ }
60
+ }
61
+
62
+ $this->atts = $atts;
63
+ $this->db = $db;
64
+
65
+ $this->connected_accounts = isset( $db['connected_accounts'] ) ? $db['connected_accounts'] : array();
66
+
67
+ if ( $this->db['have_own_tokens'] && ! empty( $this->db['api_key'] ) ) {
68
+ $this->connected_accounts = array(
69
+ 'own' => array(
70
+ 'access_token' => '',
71
+ 'refresh_token' => '',
72
+ 'channel_id' => '',
73
+ 'username' => '',
74
+ 'is_valid' => true,
75
+ 'last_checked' => '',
76
+ 'profile_picture' => '',
77
+ 'privacy' => '',
78
+ 'expires' => '2574196927',
79
+ 'api_key' => $this->db['api_key']
80
+ )
81
+ );
82
+ }
83
+
84
+ $this->settings = wp_parse_args( $atts, $db );
85
+
86
+ $this->settings['nummobile'] = $this->settings['num'];
87
+ $this->settings['minnum'] = $this->settings['num'];
88
+ }
89
+
90
+ /**
91
+ * @return array
92
+ *
93
+ * @since 1.0
94
+ */
95
+ public function get_settings() {
96
+ return $this->settings;
97
+ }
98
+
99
+ /**
100
+ * The plugin will output settings on the frontend for debugging purposes.
101
+ * Safe settings to display are added here.
102
+ *
103
+ * Overwritten in the Pro version.
104
+ *
105
+ * @return array
106
+ *
107
+ * @since 1.0
108
+ */
109
+ public static function get_public_db_settings_keys() {
110
+ $public = array(
111
+ );
112
+
113
+ return $public;
114
+ }
115
+
116
+ /**
117
+ * @return array
118
+ *
119
+ * @since 1.0
120
+ */
121
+ public function get_connected_accounts() {
122
+ return $this->connected_accounts;
123
+ }
124
+
125
+ /**
126
+ * @return array|bool
127
+ *
128
+ * @since 1.0
129
+ */
130
+ public function get_connected_accounts_in_feed() {
131
+ if ( isset( $this->connected_accounts_in_feed ) ) {
132
+ return $this->connected_accounts_in_feed;
133
+ } else {
134
+ return false;
135
+ }
136
+ }
137
+
138
+ /**
139
+ * @return bool|string
140
+ *
141
+ * @since 1.0
142
+ */
143
+ public function get_transient_name() {
144
+ if ( isset( $this->transient_name ) ) {
145
+ return $this->transient_name;
146
+ } else {
147
+ return false;
148
+ }
149
+ }
150
+
151
+ /**
152
+ * Uses the feed types and terms as well as as some
153
+ * settings to create a semi-unique feed id used for
154
+ * caching and other features.
155
+ *
156
+ * Overwritten in the Pro version.
157
+ *
158
+ * @param string $transient_name
159
+ *
160
+ * @since 1.0
161
+ */
162
+ public function set_transient_name( $transient_name = '' ) {
163
+
164
+ if ( ! empty( $transient_name ) ) {
165
+ $this->transient_name = $transient_name;
166
+ } elseif ( ! empty( $this->settings['feedid'] ) ) {
167
+ $this->transient_name = 'sby_' . $this->settings['feedid'];
168
+ } else {
169
+ $feed_type_and_terms = $this->feed_type_and_terms;
170
+
171
+ $sby_transient_name = 'sby_';
172
+
173
+ if ( isset( $feed_type_and_terms['channels'] ) ) {
174
+ foreach ( $feed_type_and_terms['channels'] as $term_and_params ) {
175
+ $channel = $term_and_params['term'];
176
+ $sby_transient_name .= $channel;
177
+ }
178
+ }
179
+
180
+ $num = $this->settings['num'];
181
+
182
+ $num_length = strlen( $num ) + 1;
183
+
184
+ //Add both parts of the caching string together and make sure it doesn't exceed 45
185
+ $sby_transient_name = substr( $sby_transient_name, 0, 45 - $num_length );
186
+
187
+ $sby_transient_name .= '#' . $num;
188
+
189
+ $this->transient_name = $sby_transient_name;
190
+ }
191
+
192
+ }
193
+
194
+ /**
195
+ * @return array|bool
196
+ *
197
+ * @since 1.0
198
+ */
199
+ public function get_feed_type_and_terms() {
200
+ if ( isset( $this->feed_type_and_terms ) ) {
201
+ return $this->feed_type_and_terms;
202
+ } else {
203
+ return false;
204
+ }
205
+ }
206
+
207
+ /**
208
+ * Based on the settings related to retrieving post data from the API,
209
+ * this setting is used to make sure all endpoints needed for the feed are
210
+ * connected and stored for easily looping through when adding posts
211
+ *
212
+ * Overwritten in the Pro version.
213
+ *
214
+ * @since 1.0
215
+ */
216
+ public function set_feed_type_and_terms() {
217
+ //global $sby_posts_manager;
218
+
219
+ $connected_accounts_in_feed = array();
220
+ $feed_type_and_terms = array(
221
+ 'channels' => array()
222
+ );
223
+
224
+ if ( ! empty( $this->settings['id'] ) ) {
225
+ $channel_array = is_array( $this->settings['id'] ) ? $this->settings['id'] : explode( ',', str_replace( ' ', '', $this->settings['id'] ) );
226
+ foreach ( $channel_array as $channel ) {
227
+ if ( isset( $this->connected_accounts[ $channel ] ) ) {
228
+ $feed_type_and_terms['channels'][] = array(
229
+ 'term' => $this->connected_accounts[ $channel ]['channel_id'],
230
+ 'params' => array(
231
+ 'channel_id' => $this->connected_accounts[ $channel ]['channel_id']
232
+ )
233
+ );
234
+ $connected_accounts_in_feed[ $this->connected_accounts[ $channel ]['channel_id'] ] = $this->connected_accounts[ $channel ];
235
+ }
236
+ }
237
+
238
+ if ( empty( $connected_accounts_in_feed ) ) {
239
+ $an_account = array();
240
+ foreach ( $this->connected_accounts as $account ) {
241
+ if ( empty( $an_account ) ) {
242
+ $an_account = $account;
243
+ }
244
+ }
245
+
246
+ foreach ( $channel_array as $channel ) {
247
+ $feed_type_and_terms['channels'][] = array(
248
+ 'term' => $channel,
249
+ 'params' => array(
250
+ 'channel_id' => $channel
251
+ )
252
+ );
253
+ $connected_accounts_in_feed[ $channel ] = $an_account;
254
+ }
255
+ }
256
+
257
+ } elseif ( ! empty( $this->settings['channel'] ) ) {
258
+ $channel_array = is_array( $this->settings['channel'] ) ? $this->settings['channel'] : explode( ',', str_replace( ' ', '', $this->settings['channel'] ) );
259
+
260
+ $an_account = array();
261
+ foreach ( $this->connected_accounts as $account ) {
262
+ if ( empty( $an_account ) ) {
263
+ $an_account = $account;
264
+ }
265
+ }
266
+
267
+ foreach ( $channel_array as $channel ) {
268
+ if ( strpos( $channel, 'UC' ) !== 0 ) {
269
+ $feed_type_and_terms['channels'][] = array(
270
+ 'term' => $channel,
271
+ 'params' => array(
272
+ 'channel_name' => $channel
273
+ )
274
+ );
275
+ } else {
276
+ $feed_type_and_terms['channels'][] = array(
277
+ 'term' => $channel,
278
+ 'params' => array(
279
+ 'channel_id' => $channel
280
+ )
281
+ );
282
+ }
283
+ $connected_accounts_in_feed[ $channel ] = $an_account;
284
+ }
285
+
286
+ } else {
287
+ foreach ( $this->connected_accounts as $connected_account ) {
288
+ if ( empty( $feed_type_and_terms['channels'] ) ) {
289
+ $feed_type_and_terms['channels'][] = array(
290
+ 'term' => $connected_account['channel_id'],
291
+ 'params' => array(
292
+ 'channel_id' => $connected_account['channel_id']
293
+ )
294
+ );
295
+ $connected_accounts_in_feed[ $connected_account['channel_id'] ] = $connected_account;
296
+ }
297
+
298
+ }
299
+ }
300
+
301
+ $this->connected_accounts_in_feed = $connected_accounts_in_feed;
302
+ $this->feed_type_and_terms = $feed_type_and_terms;
303
+ }
304
+
305
+ /**
306
+ * @return float|int
307
+ *
308
+ * @since 1.0
309
+ */
310
+ public function get_cache_time_in_seconds() {
311
+ if ( $this->db['caching_type'] === 'background' ) {
312
+ return SBY_CRON_UPDATE_CACHE_TIME;
313
+ } else {
314
+ //If the caching time doesn't exist in the database then set it to be 1 hour
315
+ $cache_time = isset( $this->settings['cache_time'] ) ? (int)$this->settings['cache_time'] : 1;
316
+ $cache_time_unit = isset( $this->settings['cache_time_unit'] ) ? $this->settings['cache_time_unit'] : 'hours';
317
+
318
+ //Calculate the cache time in seconds
319
+ if ( $cache_time_unit == 'minutes' ) $cache_time_unit = 60;
320
+ if ( $cache_time_unit == 'hours' ) $cache_time_unit = 60*60;
321
+ if ( $cache_time_unit == 'days' ) $cache_time_unit = 60*60*24;
322
+
323
+ return $cache_time * $cache_time_unit;
324
+ }
325
+ }
326
+ }
inc/class-sby-vars.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( '-1' );
4
+ }
5
+
6
+ class SBY_Vars {
7
+ public function version() { return SBYVER; }
8
+
9
+ public function plugin_dir() { return SBY_PLUGIN_DIR; }
10
+
11
+ public function plugin_url() { return SBY_PLUGIN_URL; }
12
+
13
+ public function plugin_basename() { return SBY_PLUGIN_BASENAME; }
14
+
15
+ public function cron_update_cache_time() { return SBY_CRON_UPDATE_CACHE_TIME; }
16
+
17
+ public function max_records() { return SBY_MAX_RECORDS; }
18
+
19
+ public function text_domain() { return SBY_TEXT_DOMAIN; }
20
+
21
+ public function slug() { return SBY_SLUG; }
22
+
23
+ public function plugin_name( $with_a_an = false ) { if ( $with_a_an ) { return SBY_INDEF_ART . ' ' . SBY_PLUGIN_NAME; } return SBY_PLUGIN_NAME; }
24
+
25
+ public function social_network() { return SBY_SOCIAL_NETWORK; }
26
+
27
+ public function setup_url() { return SBY_SETUP_URL; }
28
+
29
+ public function support_url() { return SBY_SUPPORT_URL; }
30
+
31
+ public function oauth_processor_url() { return SBY_OAUTH_PROCESSOR_URL; }
32
+
33
+ public function demo_url() { return SBY_DEMO_URL; }
34
+
35
+ public function pro_logo() { return SBY_PRO_LOGO; }
36
+ }
inc/class-sby-wp-post.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( '-1' );
4
+ }
5
+
6
+ class SBY_WP_Post
7
+ {
8
+ private $youtube_api_data;
9
+
10
+ private $feed_id;
11
+
12
+ private $wp_post_id;
13
+
14
+ public function __construct( $json_or_array, $feed_id ) {
15
+ $this->youtube_api_data = $json_or_array;
16
+ $this->feed_id = $feed_id;
17
+ }
18
+
19
+ public function update_post() {
20
+ if ( ! $this->get_wp_post_id() ) {
21
+ $postarr = array(
22
+ 'post_title' => SBY_Parse::get_video_title( $this->youtube_api_data ),
23
+ 'post_content' => $this->get_post_content(),
24
+ 'post_type' => SBY_CPT,
25
+ 'post_date' => date( 'Y-m-d H:i:s', SBY_Parse::get_timestamp( $this->youtube_api_data ) + sby_get_utc_offset() ),
26
+ 'post_date_gmt' => date( 'Y-m-d H:i:s', SBY_Parse::get_timestamp( $this->youtube_api_data ) ),
27
+ 'post_status' => 'draft'
28
+ );
29
+ $wp_post_id = wp_insert_post( $postarr );
30
+
31
+ if ( (int)$wp_post_id > 0 ) {
32
+ $this->wp_post_id = $wp_post_id;
33
+
34
+ $success = $this->update_meta();
35
+ }
36
+ }
37
+
38
+ }
39
+
40
+ public function update_meta() {
41
+ if ( ! isset( $this->wp_post_id ) ) {
42
+ return false;
43
+ }
44
+
45
+ $prefix = 'sby_';
46
+
47
+ update_post_meta( $this->wp_post_id, $prefix . 'video_id', SBY_Parse::get_video_id( $this->youtube_api_data ) );
48
+ update_post_meta( $this->wp_post_id, $prefix . 'feed_id', sby_strip_after_hash( $this->feed_id ) );
49
+ update_post_meta( $this->wp_post_id, $prefix . 'channel_id', SBY_Parse::get_channel_id( $this->youtube_api_data ) );
50
+ update_post_meta( $this->wp_post_id, $prefix . 'channel_title', SBY_Parse::get_channel_title( $this->youtube_api_data ) );
51
+ update_post_meta( $this->wp_post_id, $prefix . 'last_updated', date( 'Y-m-d H:i:s' ) );
52
+ update_post_meta( $this->wp_post_id, $prefix . 'thumbnails', SBY_Parse::get_media_src_set( $this->youtube_api_data ) );
53
+ update_post_meta( $this->wp_post_id, $prefix . 'youtube_publish_date', date( 'Y-m-d H:i:s', SBY_Parse::get_timestamp( $this->youtube_api_data ) ) );
54
+
55
+ $post_array = $this->youtube_api_data;
56
+ array_walk_recursive( $post_array, 'sby_replace_double_quotes' );
57
+ update_post_meta( $this->wp_post_id, $prefix . 'json', wp_json_encode( $post_array ) );
58
+
59
+ return true;
60
+ }
61
+
62
+ protected function get_wp_post_id() {
63
+ if ( isset( $this->wp_post_id ) ) {
64
+ return $this->wp_post_id;
65
+ }
66
+
67
+ $video_id = SBY_Parse::get_video_id( $this->youtube_api_data );
68
+
69
+ global $wpdb;
70
+ $results = $wpdb->get_results( $wpdb->prepare( "SELECT post_id, meta_key FROM $wpdb->postmeta WHERE meta_value = %s AND meta_key = %s", $video_id, 'sby_video_id' ), ARRAY_A );
71
+
72
+ if ( isset( $results[0] ) ) {
73
+ $this->wp_post_id = $results[0]['post_id'];
74
+
75
+ return $results[0]['post_id'];
76
+ } else {
77
+ return false;
78
+ }
79
+ }
80
+
81
+ protected function get_post_content() {
82
+ return '['.SBY_SLUG.'-single]';
83
+ }
84
+ }
inc/sby-functions.php ADDED
@@ -0,0 +1,736 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ add_shortcode('youtube-feed', 'sby_youtube_feed');
6
+ function sby_youtube_feed( $atts = array() ) {
7
+
8
+ $database_settings = sby_get_database_settings();
9
+ if ( !$database_settings['ajaxtheme'] ) {
10
+ wp_enqueue_script( 'sby_scripts' );
11
+ }
12
+
13
+ if ( $database_settings['enqueue_css_in_shortcode'] ) {
14
+ wp_enqueue_style( 'sby_styles' );
15
+ }
16
+
17
+ if ( empty( $database_settings['connected_accounts'] ) && empty( $database_settings['api_key'] ) ) {
18
+ $style = current_user_can( 'manage_youtube_feed_options' ) ? ' style="display: block;"' : '';
19
+ ob_start(); ?>
20
+ <div id="sbi_mod_error" <?php echo $style; ?>>
21
+ <span><?php _e('This error message is only visible to WordPress admins', 'youtube-feed' ); ?></span><br />
22
+ <p><b><?php _e( 'Error: No Connected Account or API key.', 'youtube-feed' ); ?></b>
23
+ <p><?php _e( 'Please go to the YouTube Feed settings page to connect an account or enter your own API key.', 'youtube-feed' ); ?></p>
24
+ </div>
25
+ <?php
26
+ $html = ob_get_contents();
27
+ ob_get_clean();
28
+ return $html;
29
+ }
30
+
31
+ $youtube_feed_settings = new SBY_Settings( $atts, $database_settings );
32
+ $youtube_feed_settings->set_feed_type_and_terms();
33
+ $youtube_feed_settings->set_transient_name();
34
+ $transient_name = $youtube_feed_settings->get_transient_name();
35
+ $settings = $youtube_feed_settings->get_settings();
36
+ $feed_type_and_terms = $youtube_feed_settings->get_feed_type_and_terms();
37
+
38
+ $youtube_feed = new SBY_Feed( $transient_name );
39
+
40
+ if ( $database_settings['caching_type'] === 'background' ) {
41
+ $youtube_feed->add_report( 'background caching used' );
42
+ if ( $youtube_feed->regular_cache_exists() ) {
43
+ $youtube_feed->add_report( 'setting posts from cache' );
44
+ $youtube_feed->set_post_data_from_cache();
45
+ }
46
+
47
+ if ( $youtube_feed->need_to_start_cron_job() ) {
48
+ $youtube_feed->add_report( 'setting up feed for cron cache' );
49
+ $to_cache = array(
50
+ 'atts' => $atts,
51
+ 'last_requested' => time(),
52
+ );
53
+
54
+ $youtube_feed->set_cron_cache( $to_cache, $youtube_feed_settings->get_cache_time_in_seconds() );
55
+
56
+ SBY_Cron_Updater::do_single_feed_cron_update( $youtube_feed_settings, $to_cache, $atts, false );
57
+
58
+ $youtube_feed->set_post_data_from_cache();
59
+
60
+ } elseif ( $youtube_feed->should_update_last_requested() ) {
61
+ $youtube_feed->add_report( 'updating last requested' );
62
+ $to_cache = array(
63
+ 'last_requested' => time(),
64
+ );
65
+
66
+ $youtube_feed->set_cron_cache( $to_cache, $youtube_feed_settings->get_cache_time_in_seconds() );
67
+ }
68
+
69
+ } elseif ( $youtube_feed->regular_cache_exists() ) {
70
+ $youtube_feed->add_report( 'page load caching used and regular cache exists' );
71
+ $youtube_feed->set_post_data_from_cache();
72
+
73
+ if ( $youtube_feed->need_posts( $settings['num'] ) && $youtube_feed->can_get_more_posts() ) {
74
+ while ( $youtube_feed->need_posts( $settings['num'] ) && $youtube_feed->can_get_more_posts() ) {
75
+ $youtube_feed->add_remote_posts( $settings, $feed_type_and_terms, $youtube_feed_settings->get_connected_accounts_in_feed() );
76
+ }
77
+ $youtube_feed->cache_feed_data( $youtube_feed_settings->get_cache_time_in_seconds() );
78
+ }
79
+
80
+ } else {
81
+ $youtube_feed->add_report( 'no feed cache found' );
82
+
83
+ while ( $youtube_feed->need_posts( $settings['num'] ) && $youtube_feed->can_get_more_posts() ) {
84
+ $youtube_feed->add_remote_posts( $settings, $feed_type_and_terms, $youtube_feed_settings->get_connected_accounts_in_feed() );
85
+ }
86
+
87
+ if ( ! $youtube_feed->should_use_backup() ) {
88
+ $youtube_feed->cache_feed_data( $youtube_feed_settings->get_cache_time_in_seconds() );
89
+ }
90
+
91
+ }
92
+
93
+ if ( $youtube_feed->should_use_backup() ) {
94
+ $youtube_feed->add_report( 'trying to use backup' );
95
+ $youtube_feed->maybe_set_post_data_from_backup();
96
+ $youtube_feed->maybe_set_header_data_from_backup();
97
+ }
98
+
99
+ // if need a header
100
+ if ( $youtube_feed->need_header( $settings, $feed_type_and_terms ) && ! $youtube_feed->should_use_backup() ) {
101
+ if ( $database_settings['caching_type'] === 'background' ) {
102
+ $youtube_feed->add_report( 'background header caching used' );
103
+ $youtube_feed->set_header_data_from_cache();
104
+ } elseif ( $youtube_feed->regular_header_cache_exists() ) {
105
+ // set_post_data_from_cache
106
+ $youtube_feed->add_report( 'page load caching used and regular header cache exists' );
107
+ $youtube_feed->set_header_data_from_cache();
108
+ } else {
109
+ $youtube_feed->add_report( 'no header cache exists' );
110
+ $youtube_feed->set_remote_header_data( $settings, $feed_type_and_terms, $youtube_feed_settings->get_connected_accounts_in_feed() );
111
+
112
+ $youtube_feed->cache_header_data( $youtube_feed_settings->get_cache_time_in_seconds(), $settings['backup_cache_enabled'] );
113
+ }
114
+ } else {
115
+ $youtube_feed->add_report( 'no header needed' );
116
+ }
117
+
118
+ return $youtube_feed->get_the_feed_html( $settings, $atts, $youtube_feed_settings->get_feed_type_and_terms(), $youtube_feed_settings->get_connected_accounts_in_feed() );
119
+ }
120
+
121
+ /**
122
+ * Outputs an organized error report for the front end.
123
+ * This hooks into the end of the feed before the closing div
124
+ *
125
+ * @param object $youtube_feed
126
+ * @param string $feed_id
127
+ */
128
+ function sby_error_report( $youtube_feed, $feed_id ) {
129
+ global $sby_posts_manager;
130
+
131
+ $style = current_user_can( 'manage_youtube_feed_options' ) ? ' style="display: block;"' : '';
132
+
133
+ $error_messages = $sby_posts_manager->get_frontend_errors();
134
+ if ( ! empty( $error_messages ) ) {?>
135
+ <div id="sby_mod_error"<?php echo $style; ?>>
136
+ <span><?php _e('This error message is only visible to WordPress admins', SBY_TEXT_DOMAIN ); ?></span><br />
137
+ <?php foreach ( $error_messages as $error_message ) {
138
+ echo $error_message;
139
+ } ?>
140
+ </div>
141
+ <?php
142
+ }
143
+
144
+ $sby_posts_manager->reset_frontend_errors();
145
+ }
146
+ add_action( 'sby_before_feed_end', 'sby_error_report', 10, 2 );
147
+
148
+ /**
149
+ * Called after the load more button is clicked using admin-ajax.php
150
+ */
151
+ function sby_get_next_post_set() {
152
+ if ( ! isset( $_POST['feed_id'] ) || strpos( $_POST['feed_id'], 'sby' ) === false ) {
153
+ die( 'invalid feed ID');
154
+ }
155
+
156
+ $feed_id = sanitize_text_field( $_POST['feed_id'] );
157
+ $atts_raw = isset( $_POST['atts'] ) ? json_decode( stripslashes( $_POST['atts'] ), true ) : array();
158
+ if ( is_array( $atts_raw ) ) {
159
+ array_map( 'sanitize_text_field', $atts_raw );
160
+ } else {
161
+ $atts_raw = array();
162
+ }
163
+ $atts = $atts_raw; // now sanitized
164
+
165
+ $offset = isset( $_POST['offset'] ) ? (int)$_POST['offset'] : 0;
166
+
167
+ $database_settings = sby_get_database_settings();
168
+ $youtube_feed_settings = new SBY_Settings( $atts, $database_settings );
169
+
170
+ if ( empty( $database_settings['connected_accounts'] ) && empty( $database_settings['api_key'] ) ) {
171
+ die( 'error no connected account' );
172
+ }
173
+
174
+ $youtube_feed_settings->set_feed_type_and_terms();
175
+ $youtube_feed_settings->set_transient_name();
176
+ $transient_name = $youtube_feed_settings->get_transient_name();
177
+
178
+ if ( $transient_name !== $feed_id ) {
179
+ die( 'id does not match' );
180
+ }
181
+
182
+ $settings = $youtube_feed_settings->get_settings();
183
+
184
+ $feed_type_and_terms = $youtube_feed_settings->get_feed_type_and_terms();
185
+
186
+ $youtube_feed = new SBY_Feed( $transient_name );
187
+
188
+ if ( $settings['caching_type'] === 'permanent' && empty( $settings['doingModerationMode'] ) ) {
189
+ $youtube_feed->add_report( 'trying to use permanent cache' );
190
+ $youtube_feed->maybe_set_post_data_from_backup();
191
+ } elseif ( $settings['caching_type'] === 'background' ) {
192
+ $youtube_feed->add_report( 'background caching used' );
193
+ if ( $youtube_feed->regular_cache_exists() ) {
194
+ $youtube_feed->add_report( 'setting posts from cache' );
195
+ $youtube_feed->set_post_data_from_cache();
196
+ }
197
+
198
+ if ( $youtube_feed->need_posts( $settings['num'], $offset ) && $youtube_feed->can_get_more_posts() ) {
199
+ while ( $youtube_feed->need_posts( $settings['num'], $offset ) && $youtube_feed->can_get_more_posts() ) {
200
+ $youtube_feed->add_remote_posts( $settings, $feed_type_and_terms, $youtube_feed_settings->get_connected_accounts_in_feed() );
201
+ }
202
+
203
+ if ( $youtube_feed->need_to_start_cron_job() ) {
204
+ $youtube_feed->add_report( 'needed to start cron job' );
205
+ $to_cache = array(
206
+ 'atts' => $atts,
207
+ 'last_requested' => time(),
208
+ );
209
+
210
+ $youtube_feed->set_cron_cache( $to_cache, $youtube_feed_settings->get_cache_time_in_seconds() );
211
+
212
+ } else {
213
+ $youtube_feed->add_report( 'updating last requested and adding to cache' );
214
+ $to_cache = array(
215
+ 'last_requested' => time(),
216
+ );
217
+
218
+ $youtube_feed->set_cron_cache( $to_cache, $youtube_feed_settings->get_cache_time_in_seconds(), $settings['backup_cache_enabled'] );
219
+ }
220
+ }
221
+
222
+ } elseif ( $youtube_feed->regular_cache_exists() ) {
223
+ $youtube_feed->add_report( 'regular cache exists' );
224
+ $youtube_feed->set_post_data_from_cache();
225
+
226
+ if ( $youtube_feed->need_posts( $settings['num'], $offset ) && $youtube_feed->can_get_more_posts() ) {
227
+ while ( $youtube_feed->need_posts( $settings['num'], $offset ) && $youtube_feed->can_get_more_posts() ) {
228
+ $youtube_feed->add_remote_posts( $settings, $feed_type_and_terms, $youtube_feed_settings->get_connected_accounts_in_feed() );
229
+ }
230
+
231
+ $youtube_feed->add_report( 'adding to cache' );
232
+ $youtube_feed->cache_feed_data( $youtube_feed_settings->get_cache_time_in_seconds(), $settings['backup_cache_enabled'] );
233
+ }
234
+
235
+
236
+ } else {
237
+ $youtube_feed->add_report( 'no feed cache found' );
238
+
239
+ while ( $youtube_feed->need_posts( $settings['num'], $offset ) && $youtube_feed->can_get_more_posts() ) {
240
+ $youtube_feed->add_remote_posts( $settings, $feed_type_and_terms, $youtube_feed_settings->get_connected_accounts_in_feed() );
241
+ }
242
+
243
+ if ( $youtube_feed->should_use_backup() ) {
244
+ $youtube_feed->add_report( 'trying to use a backup cache' );
245
+ $youtube_feed->maybe_set_post_data_from_backup();
246
+ } else {
247
+ $youtube_feed->add_report( 'transient gone, adding to cache' );
248
+ $youtube_feed->cache_feed_data( $youtube_feed_settings->get_cache_time_in_seconds(), $settings['backup_cache_enabled'] );
249
+ }
250
+ }
251
+ /*
252
+ $settings['feed_avatars'] = array();
253
+ if ( $youtube_feed->need_avatars( $settings ) ) {
254
+ $youtube_feed->set_up_feed_avatars( $youtube_feed_settings->get_connected_accounts_in_feed(), $feed_type_and_terms );
255
+ $settings['feed_avatars'] = $youtube_feed->get_username_avatars();
256
+ }
257
+ */
258
+ $feed_status = array( 'shouldPaginate' => $youtube_feed->should_use_pagination( $settings, $offset ) );
259
+
260
+ /*if ( $settings['disable_js_image_loading'] || $settings['imageres'] !== 'auto' ) {
261
+ global $sby_posts_manager;
262
+ $post_data = array_slice( $youtube_feed->get_post_data(), $offset, $settings['minnum'] );
263
+
264
+ if ( ! $sby_posts_manager->image_resizing_disabled() ) {
265
+ $image_ids = array();
266
+ foreach ( $post_data as $post ) {
267
+ $image_ids[] = SBY_Parse::get_post_id( $post );
268
+ }
269
+ $resized_images = SBY_Feed::get_resized_images_source_set( $image_ids, 0, $feed_id );
270
+
271
+ $youtube_feed->set_resized_images( $resized_images );
272
+ }
273
+ }*/
274
+
275
+ $return = array(
276
+ 'html' => $youtube_feed->get_the_items_html( $settings, $offset, $youtube_feed_settings->get_feed_type_and_terms(), $youtube_feed_settings->get_connected_accounts_in_feed() ),
277
+ 'feedStatus' => $feed_status,
278
+ 'report' => $youtube_feed->get_report(),
279
+ 'resizedImages' => array()
280
+ //'resizedImages' => SBY_Feed::get_resized_images_source_set( $youtube_feed->get_image_ids_post_set(), 0, $feed_id )
281
+ );
282
+
283
+ //SBY_Feed::update_last_requested( $youtube_feed->get_image_ids_post_set() );
284
+
285
+ echo wp_json_encode( $return );
286
+
287
+ global $sby_posts_manager;
288
+
289
+ $sby_posts_manager->update_successful_ajax_test();
290
+
291
+ die();
292
+ }
293
+ add_action( 'wp_ajax_sby_load_more_clicked', 'sby_get_next_post_set' );
294
+ add_action( 'wp_ajax_nopriv_sby_load_more_clicked', 'sby_get_next_post_set' );
295
+
296
+ /**
297
+ * Posts that need resized images are processed after being sent to the server
298
+ * using AJAX
299
+ *
300
+ * @return string
301
+ */
302
+ function sby_process_wp_posts() {
303
+ if ( ! isset( $_POST['feed_id'] ) || strpos( $_POST['feed_id'], 'sby' ) === false ) {
304
+ die( 'invalid feed ID');
305
+ }
306
+
307
+ $feed_id = sanitize_text_field( $_POST['feed_id'] );
308
+
309
+ $atts_raw = isset( $_POST['atts'] ) ? json_decode( stripslashes( $_POST['atts'] ), true ) : array();
310
+ if ( is_array( $atts_raw ) ) {
311
+ array_map( 'sanitize_text_field', $atts_raw );
312
+ } else {
313
+ $atts_raw = array();
314
+ }
315
+ $atts = $atts_raw; // now sanitized
316
+
317
+ $offset = isset( $_POST['offset'] ) ? (int)$_POST['offset'] : 0;
318
+
319
+ $database_settings = sby_get_database_settings();
320
+ $sby_settings = new SBY_Settings( $atts, $database_settings );
321
+
322
+ $settings = $sby_settings->get_settings();
323
+
324
+ $youtube_feed = new SBY_Feed( $feed_id );
325
+ if ( $youtube_feed->regular_cache_exists() ) {
326
+ $youtube_feed->set_post_data_from_cache();
327
+
328
+ $posts = array_slice( $youtube_feed->get_post_data(), max( 0, $offset - $settings['minnum'] ), $settings['minnum'] );
329
+
330
+ foreach ( $posts as $post ) {
331
+ $wp_post = new SBY_WP_Post( $post, $feed_id );
332
+ $wp_post->update_post();
333
+ }
334
+ }
335
+
336
+
337
+
338
+ //global $sby_posts_manager;
339
+
340
+ //$sby_posts_manager->update_successful_ajax_test();
341
+
342
+ die( 'check success' );
343
+ }
344
+ add_action( 'wp_ajax_sby_check_wp_submit', 'sby_process_wp_posts' );
345
+ add_action( 'wp_ajax_nopriv_sby_check_wp_submit', 'sby_process_wp_posts' );
346
+
347
+ function sby_clear_cache() {
348
+ //Delete all transients
349
+ global $wpdb;
350
+ $table_name = $wpdb->prefix . "options";
351
+ $wpdb->query( "
352
+ DELETE
353
+ FROM $table_name
354
+ WHERE `option_name` LIKE ('%\_transient\_sby\_%')
355
+ " );
356
+ $wpdb->query( "
357
+ DELETE
358
+ FROM $table_name
359
+ WHERE `option_name` LIKE ('%\_transient\_timeout\_sby\_%')
360
+ " );
361
+ $wpdb->query( "
362
+ DELETE
363
+ FROM $table_name
364
+ WHERE `option_name` LIKE ('%\_transient\_&sby\_%')
365
+ " );
366
+ $wpdb->query( "
367
+ DELETE
368
+ FROM $table_name
369
+ WHERE `option_name` LIKE ('%\_transient\_timeout\_&sby\_%')
370
+ " );
371
+ $wpdb->query( "
372
+ DELETE
373
+ FROM $table_name
374
+ WHERE `option_name` LIKE ('%\_transient\_\$sby\_%')
375
+ " );
376
+ $wpdb->query( "
377
+ DELETE
378
+ FROM $table_name
379
+ WHERE `option_name` LIKE ('%\_transient\_timeout\_\$sby\_%')
380
+ " );
381
+
382
+ sby_clear_page_caches();
383
+ }
384
+ add_action( 'sby_settings_after_configure_save', 'sby_clear_cache' );
385
+
386
+ /**
387
+ * When certain events occur, page caches need to
388
+ * clear or errors occur or changes will not be seen
389
+ */
390
+ function sby_clear_page_caches() {
391
+ if ( isset( $GLOBALS['wp_fastest_cache'] ) && method_exists( $GLOBALS['wp_fastest_cache'], 'deleteCache' ) ){
392
+ /* Clear WP fastest cache*/
393
+ $GLOBALS['wp_fastest_cache']->deleteCache();
394
+ }
395
+
396
+ if ( function_exists( 'wp_cache_clear_cache' ) ) {
397
+ wp_cache_clear_cache();
398
+ }
399
+
400
+ if ( class_exists('W3_Plugin_TotalCacheAdmin') ) {
401
+ $plugin_totalcacheadmin = & w3_instance('W3_Plugin_TotalCacheAdmin');
402
+
403
+ $plugin_totalcacheadmin->flush_all();
404
+ }
405
+
406
+ if ( function_exists( 'rocket_clean_domain' ) ) {
407
+ rocket_clean_domain();
408
+ }
409
+
410
+ if ( class_exists( 'autoptimizeCache' ) ) {
411
+ /* Clear autoptimize */
412
+ autoptimizeCache::clearall();
413
+ }
414
+ }
415
+
416
+ /**
417
+ * Triggered by a cron event to update feeds
418
+ */
419
+ function sby_cron_updater() {
420
+ global $sby_settings;
421
+
422
+ if ( $sby_settings['caching_type'] === 'background' ) {
423
+ SBY_Cron_Updater::do_feed_updates();
424
+ }
425
+
426
+ }
427
+ add_action( 'sby_feed_update', 'sby_cron_updater' );
428
+
429
+ function sby_update_or_connect_account( $args ) {
430
+ global $sby_settings;
431
+ $account_id = $args['channel_id'];
432
+ $sby_settings['connected_accounts'][ $account_id ] = array(
433
+ 'access_token' => $args['access_token'],
434
+ 'refresh_token' => $args['refresh_token'],
435
+ 'channel_id' => $args['channel_id'],
436
+ 'username' => $args['username'],
437
+ 'is_valid' => true,
438
+ 'last_checked' => time(),
439
+ 'profile_picture' => $args['profile_picture'],
440
+ 'privacy' => $args['privacy'],
441
+ 'expires' => $args['expires']
442
+ );
443
+
444
+ update_option( 'sby_settings', $sby_settings );
445
+
446
+ return $sby_settings['connected_accounts'][ $account_id ];
447
+ }
448
+
449
+ function sby_get_first_connected_account() {
450
+ global $sby_settings;
451
+ $an_account = array();
452
+
453
+ if ( $sby_settings['have_own_tokens'] && ! empty( $sby_settings['api_key'] ) ) {
454
+ $an_account = array(
455
+ 'access_token' => '',
456
+ 'refresh_token' => '',
457
+ 'channel_id' => '',
458
+ 'username' => '',
459
+ 'is_valid' => true,
460
+ 'last_checked' => '',
461
+ 'profile_picture' => '',
462
+ 'privacy' => '',
463
+ 'expires' => '2574196927',
464
+ 'api_key' => $sby_settings['api_key']
465
+ );
466
+ } else {
467
+ $connected_accounts = $sby_settings['connected_accounts'];
468
+ foreach ( $connected_accounts as $account ) {
469
+ if ( empty( $an_account ) ) {
470
+ $an_account = $account;
471
+ }
472
+ }
473
+ }
474
+
475
+ return $an_account;
476
+
477
+ }
478
+
479
+ function sby_get_feed_template_part( $part, $settings = array() ) {
480
+ $file = '';
481
+
482
+ $using_custom_templates_in_theme = apply_filters( 'sby_use_theme_templates', $settings['customtemplates'] );
483
+ $generic_path = trailingslashit( SBY_PLUGIN_DIR ) . 'templates/';
484
+
485
+ if ( $using_custom_templates_in_theme ) {
486
+ $custom_header_template = locate_template( 'sby/header.php', false, false );
487
+ $custom_player_template = locate_template( 'sby/player.php', false, false );
488
+ $custom_item_template = locate_template( 'sby/item.php', false, false );
489
+ $custom_footer_template = locate_template( 'sby/footer.php', false, false );
490
+ $custom_feed_template = locate_template( 'sby/feed.php', false, false );
491
+ } else {
492
+ $custom_header_template = false;
493
+ $custom_player_template = false;
494
+ $custom_item_template = false;
495
+ $custom_footer_template = false;
496
+ $custom_feed_template = false;
497
+ }
498
+
499
+ if ( $part === 'header' ) {
500
+ if ( $custom_header_template ) {
501
+ $file = $custom_header_template;
502
+ } else {
503
+ $file = $generic_path . 'header.php';
504
+ }
505
+ } elseif ( $part === 'player' ) {
506
+ if ( $custom_player_template ) {
507
+ $file = $custom_player_template;
508
+ } else {
509
+ $file = $generic_path . 'player.php';
510
+ }
511
+ } elseif ( $part === 'item' ) {
512
+ if ( $custom_item_template ) {
513
+ $file = $custom_item_template;
514
+ } else {
515
+ $file = $generic_path . 'item.php';
516
+ }
517
+ } elseif ( $part === 'footer' ) {
518
+ if ( $custom_footer_template ) {
519
+ $file = $custom_footer_template;
520
+ } else {
521
+ $file = $generic_path . 'footer.php';
522
+ }
523
+ } elseif ( $part === 'feed' ) {
524
+ if ( $custom_feed_template ) {
525
+ $file = $custom_feed_template;
526
+ } else {
527
+ $file = $generic_path . 'feed.php';
528
+ }
529
+ }
530
+
531
+ return $file;
532
+ }
533
+
534
+ /**
535
+ * Get the settings in the database with defaults
536
+ *
537
+ * @return array
538
+ */
539
+ function sby_get_database_settings() {
540
+ global $sby_settings;
541
+
542
+ $defaults = sby_settings_defaults();
543
+
544
+ return array_merge( $defaults, $sby_settings );
545
+ }
546
+
547
+ function sby_icon( $icon, $class = '' ) {
548
+ $class = ! empty( $class ) ? ' ' . trim( $class ) : '';
549
+ if ( $icon === SBY_SLUG ) {
550
+ return '<svg aria-hidden="true" focusable="false" data-prefix="fab" data-icon="youtube" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" class="svg-inline--fa fa-youtube fa-w-18'.$class.'"><path fill="currentColor" d="M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z" class=""></path></svg>';
551
+ } else {
552
+ return '<i aria-hidden="true" role="img" class="fab fa-youtube"></i>';
553
+ }
554
+ }
555
+
556
+
557
+ /**
558
+ * @param $a
559
+ * @param $b
560
+ *
561
+ * @return false|int
562
+ */
563
+ function sby_date_sort( $a, $b ) {
564
+ $time_stamp_a = SBY_Parse::get_timestamp( $a );
565
+ $time_stamp_b = SBY_Parse::get_timestamp( $b );
566
+
567
+ if ( isset( $time_stamp_a ) ) {
568
+ return $time_stamp_b - $time_stamp_a;
569
+ } else {
570
+ return rand ( -1, 1 );
571
+ }
572
+ }
573
+
574
+ /**
575
+ * @param $a
576
+ * @param $b
577
+ *
578
+ * @return false|int
579
+ */
580
+ function sby_rand_sort( $a, $b ) {
581
+ return rand ( -1, 1 );
582
+ }
583
+
584
+ /**
585
+ * Converts a hex code to RGB so opacity can be
586
+ * applied more easily
587
+ *
588
+ * @param $hex
589
+ *
590
+ * @return string
591
+ */
592
+ function sby_hextorgb( $hex ) {
593
+ // allows someone to use rgb in shortcode
594
+ if ( strpos( $hex, ',' ) !== false ) {
595
+ return $hex;
596
+ }
597
+
598
+ $hex = str_replace( '#', '', $hex );
599
+
600
+ if ( strlen( $hex ) === 3 ) {
601
+ $r = hexdec( substr( $hex,0,1 ).substr( $hex,0,1 ) );
602
+ $g = hexdec( substr( $hex,1,1 ).substr( $hex,1,1 ) );
603
+ $b = hexdec( substr( $hex,2,1 ).substr( $hex,2,1 ) );
604
+ } else {
605
+ $r = hexdec( substr( $hex,0,2 ) );
606
+ $g = hexdec( substr( $hex,2,2 ) );
607
+ $b = hexdec( substr( $hex,4,2 ) );
608
+ }
609
+ $rgb = array( $r, $g, $b );
610
+
611
+ return implode( ',', $rgb ); // returns the rgb values separated by commas
612
+ }
613
+
614
+ function sby_get_utc_offset() {
615
+ return get_option( 'gmt_offset', 0 ) * HOUR_IN_SECONDS;
616
+ }
617
+
618
+ function sby_strip_after_hash( $string ) {
619
+ $string_array = explode( '#', $string );
620
+ $finished_string = $string_array[0];
621
+
622
+ return $finished_string;
623
+ }
624
+
625
+ function sby_get_account_bottom() {
626
+ return '1080046074015-mcpf8i271957vq1srjr153eb1a9g3efg.apps.googleusercontent.com';
627
+ }
628
+
629
+ function sby_get_account_top() {
630
+ return '0CWXAMs40D8U8uPLpe7xe9oo';
631
+ }
632
+
633
+ function sby_replace_double_quotes( &$element, $index ) {
634
+ $element = str_replace( '"', "&quot;", $element );
635
+ }
636
+
637
+ /**
638
+ * Adds the ajax url and custom JavaScript to the page
639
+ */
640
+ function sby_custom_js() {
641
+ global $sby_settings;
642
+
643
+ $js = isset( $sby_settings['custom_js'] ) ? trim( $sby_settings['custom_js'] ) : '';
644
+
645
+ echo '<!-- YouTube Feed JS -->';
646
+ echo "\r\n";
647
+ echo '<script type="text/javascript">';
648
+ echo "\r\n";
649
+
650
+ if ( ! empty( $js ) ) {
651
+ echo "\r\n";
652
+ echo "jQuery( document ).ready(function($) {";
653
+ echo "\r\n";
654
+ echo "window.sbyCustomJS = function(){";
655
+ echo "\r\n";
656
+ echo stripslashes($js);
657
+ echo "\r\n";
658
+ echo "}";
659
+ echo "\r\n";
660
+ echo "});";
661
+ }
662
+
663
+ echo "\r\n";
664
+ echo '</script>';
665
+ echo "\r\n";
666
+ }
667
+ add_action( 'wp_footer', 'sby_custom_js' );
668
+
669
+ //Custom CSS
670
+ add_action( 'wp_head', 'sby_custom_css' );
671
+ function sby_custom_css() {
672
+ global $sby_settings;
673
+
674
+ $css = isset( $sby_settings['custom_css'] ) ? trim( $sby_settings['custom_css'] ) : '';
675
+
676
+ //Show CSS if an admin (so can see Hide Photos link), if including Custom CSS or if hiding some photos
677
+ if ( current_user_can( 'manage_youtube_feed_options' ) || current_user_can( 'manage_options' ) || ! empty( $css ) ) {
678
+
679
+ echo '<!-- Instagram Feed CSS -->';
680
+ echo "\r\n";
681
+ echo '<style type="text/css">';
682
+
683
+ if ( ! empty( $css ) ){
684
+ echo "\r\n";
685
+ echo stripslashes($css);
686
+ }
687
+
688
+ if ( current_user_can( 'manage_youtube_feed_options' ) || current_user_can( 'manage_options' ) ){
689
+ echo "\r\n";
690
+ echo "#sby_mod_link, #sby_mod_error{ display: block !important; width: 100%; float: left; box-sizing: border-box; }";
691
+ }
692
+
693
+ echo "\r\n";
694
+ echo '</style>';
695
+ echo "\r\n";
696
+ }
697
+
698
+ }
699
+
700
+ /**
701
+ * Makes the JavaScript file available and enqueues the stylesheet
702
+ * for the plugin
703
+ */
704
+ function sby_scripts_enqueue() {
705
+ //Register the script to make it available
706
+
707
+ //Options to pass to JS file
708
+ global $sby_settings;
709
+
710
+ $js_file = 'js/sb-youtube.min.js';
711
+ if ( isset( $_GET['sby_debug'] ) ) {
712
+ $js_file = 'js/sb-youtube.js';
713
+ }
714
+
715
+ if ( isset( $sby_settings['enqueue_js_in_head'] ) && $sby_settings['enqueue_js_in_head'] ) {
716
+ wp_enqueue_script( 'sby_scripts', trailingslashit( SBY_PLUGIN_URL ) . $js_file, array('jquery'), SBYVER, false );
717
+ } else {
718
+ wp_register_script( 'sby_scripts', trailingslashit( SBY_PLUGIN_URL ) . $js_file, array('jquery'), SBYVER, true );
719
+ }
720
+
721
+ if ( isset( $sby_settings['enqueue_css_in_shortcode'] ) && $sby_settings['enqueue_css_in_shortcode'] ) {
722
+ wp_register_style( 'sby_styles', trailingslashit( SBY_PLUGIN_URL ) . 'css/sb-youtube.min.css', array(), SBYVER );
723
+ } else {
724
+ wp_enqueue_style( 'sby_styles', trailingslashit( SBY_PLUGIN_URL ) . 'css/sb-youtube.min.css', array(), SBYVER );
725
+ }
726
+
727
+ $data = array(
728
+ 'adminAjaxUrl' => admin_url( 'admin-ajax.php' ),
729
+ 'placeholder' => trailingslashit( SBY_PLUGIN_URL ) . 'img/placeholder.png',
730
+ 'lightboxPlaceholder' => trailingslashit( SBY_PLUGIN_URL ) . 'img/lightbox-placeholder.png',
731
+ 'autoplay' => $sby_settings['playvideo'] === 'automatically'
732
+ );
733
+ //Pass option to JS file
734
+ wp_localize_script('sby_scripts', 'sbyOptions', $data );
735
+ }
736
+ add_action( 'wp_enqueue_scripts', 'sby_scripts_enqueue', 2 );
inc/widget.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class SbyWidget
4
+ *
5
+ * Adds support for a text widget with the [youtube-feed] shortcode inside
6
+ */
7
+
8
+ class SbyWidget extends WP_Widget
9
+ {
10
+ function __construct() {
11
+ parent::__construct(
12
+ 'youtube-feeds-widget',
13
+ __( 'YouTube Feed', SBY_TEXT_DOMAIN ),
14
+ array( 'description' => __( 'Display your YouTube feed', SBY_TEXT_DOMAIN ), )
15
+ );
16
+ }
17
+
18
+ public function widget( $args, $instance ) {
19
+
20
+ $title = isset( $instance['title'] ) ? apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) : '';
21
+ $content = isset( $instance['content'] ) ? strip_tags( $instance['content'] ) : '['.SBY_SLUG.']';
22
+
23
+ echo $args['before_widget'];
24
+
25
+ if ( ! empty( $title ) ) {
26
+ echo $args['before_title'] . esc_html( $title ) . $args['after_title'];
27
+ }
28
+
29
+ echo do_shortcode( $content );
30
+
31
+ echo $args['after_widget'];
32
+ }
33
+
34
+ public function form( $instance ) {
35
+
36
+ $title = isset( $instance['title'] ) ? $instance['title'] : '';
37
+ $content = isset ( $instance['content'] ) ? strip_tags( $instance['content'] ) : '['.SBY_SLUG.']';
38
+ ?>
39
+ <p>
40
+ <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?></label>
41
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
42
+ </p>
43
+ <textarea class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'content' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'content' ) ); ?>" rows="16"><?php echo strip_tags( $content ); ?></textarea>
44
+ <?php
45
+ }
46
+
47
+ public function update( $new_instance, $old_instance ) {
48
+ $instance = array();
49
+ $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
50
+ $instance['content'] = ( ! empty( $new_instance['content'] ) ) ? strip_tags( $new_instance['content'] ) : '';
51
+
52
+ return $instance;
53
+ }
54
+ }
55
+
56
+ // register and load the widget
57
+ function sby_load_widget() {
58
+ register_widget( 'SbyWidget' );
59
+ }
60
+ add_action( 'widgets_init', 'sby_load_widget' );
61
+
62
+ // allow shortcode in widgets
63
+ add_filter( 'widget_text', 'do_shortcode' );
js/admin.js ADDED
@@ -0,0 +1,520 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+ function SbspfAdmin(plugin) {
3
+ this.plugin = plugin;
4
+ this.accesstokenSplitter = 'access_token=';
5
+ }
6
+
7
+ SbspfAdmin.prototype = {
8
+ init: function() {
9
+ var self = this,
10
+ id = '#'+this.plugin,
11
+ cla = '.'+this.plugin;
12
+ this.addAccessTokenListener();
13
+ $('.'+this.plugin +'_connected_accounts_wrap .'+this.plugin +'_connected_account').each(function() {
14
+ self.initClickRemove($(this));
15
+ self.initInfoToggle($('.'+self.plugin +'_connected_accounts_wrap').last());
16
+ });
17
+
18
+ self.initAppCredToggle();
19
+
20
+ self.initWidthResponsiveToggle();
21
+ self.initActionButtons();
22
+
23
+ this.addManualAccessTokenListener();
24
+
25
+ $(id + '_search_submit').click(function(event) {
26
+ event.preventDefault();
27
+
28
+ var submitData = {
29
+ 'term' : $(id + '_channel_search').val(),
30
+ 'action' : self.plugin + '_account_search',
31
+ 'sbspf_nonce' : sbspf.nonce
32
+ };
33
+ var onSuccess = function (data) {
34
+ if (data.trim().indexOf('{') === 0) {
35
+ var returnObj = JSON.parse(data.trim());
36
+
37
+ var html = '';
38
+ $.each(returnObj.items,function(index,value){
39
+ });
40
+ }
41
+ };
42
+ sbAjax(submitData,onSuccess);
43
+ });
44
+
45
+ // color picker
46
+ var $ctfColorpicker = $(cla+'_colorpicker');
47
+
48
+ if($ctfColorpicker.length > 0){
49
+ $ctfColorpicker.wpColorPicker();
50
+ }
51
+
52
+ // shortcode tooltips
53
+ var $adminLabel = $(id +'_admin label');
54
+
55
+ $adminLabel.click(function(){
56
+ var $shortcode = $(this).siblings(cla + '_shortcode');
57
+ if($shortcode.is(':visible')){
58
+ $shortcode.hide();
59
+ } else {
60
+ $shortcode.show();
61
+ }
62
+ });
63
+ $adminLabel.hover(function(){
64
+ if($(this).siblings(cla + '_shortcode').length && ! $(this).find(cla + '_shortcode_symbol').length){
65
+ $(this).append('<code class="'+self.plugin+'_shortcode_symbol">[]</code>');
66
+ }
67
+ }, function(){
68
+ $(this).find(cla + '_shortcode_symbol').remove();
69
+ });
70
+ $(cla + '_shortcode').hide();
71
+
72
+ //Scroll to hash for quick links
73
+ $(id + '_admin a').click(function() {
74
+ if(location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
75
+ var target = $(this.hash);
76
+ target = target.length ? target : this.hash.slice(1);
77
+ if(target.length) {
78
+ $('html,body').animate({
79
+ scrollTop: target.offset().top
80
+ }, 500);
81
+ return false;
82
+ }
83
+ }
84
+ });
85
+
86
+ //Caching options
87
+ if( $(id+'_caching_type_page').is(':checked') ) {
88
+ $(cla+'-caching-cron-options').hide();
89
+ $(cla+'-caching-page-options').show();
90
+ } else {
91
+ $(cla+'-caching-page-options').hide();
92
+ $(cla+'-caching-cron-options').show();
93
+ }
94
+
95
+ $('.'+self.plugin+'_caching_type_input').change(function() {
96
+ if (this.value == 'page') {
97
+ $(cla+'-caching-cron-options').slideUp();
98
+ $(cla+'-caching-page-options').slideDown();
99
+ }
100
+ else if (this.value == 'background') {
101
+ $(cla+'-caching-page-options').slideUp();
102
+ $(cla+'-caching-cron-options').slideDown();
103
+ }
104
+ });
105
+
106
+ //Should we show the caching time settings?
107
+ var sbspf_cache_cron_interval = $(id+'_cache_cron_interval').val(),
108
+ $sbspf_caching_time_settings = $(id+'-caching-time-settings');
109
+
110
+ //Should we show anything initially?
111
+ if(sbspf_cache_cron_interval == '30mins' || sbspf_cache_cron_interval == '1hour') $sbspf_caching_time_settings.hide();
112
+
113
+ $(id+'_cache_cron_interval').change(function(){
114
+ sbspf_cache_cron_interval = $(id+'_cache_cron_interval').val();
115
+
116
+ if(sbspf_cache_cron_interval == '30mins' || sbspf_cache_cron_interval == '1hour'){
117
+ $sbspf_caching_time_settings.hide();
118
+ } else {
119
+ $sbspf_caching_time_settings.show();
120
+ }
121
+ });
122
+ sbspf_cache_cron_interval = $(id+'_cache_cron_interval').val();
123
+
124
+ if(sbspf_cache_cron_interval == '30mins' || sbspf_cache_cron_interval == '1hour'){
125
+ $sbspf_caching_time_settings.hide();
126
+ } else {
127
+ $sbspf_caching_time_settings.show();
128
+ }
129
+
130
+ self.updateLayoutOptionsDisplay();
131
+ $(cla + '_layout_type').change(function() {
132
+ self.updateLayoutOptionsDisplay()
133
+ });
134
+
135
+ // tooltips
136
+ $(id +'_admin '+ cla + '_tooltip_link').click(function(){
137
+ $(this).closest('tr, h3, '+ cla + '_tooltip_wrap').find(cla + '_tooltip').slideToggle();
138
+ });
139
+
140
+ $(id +'_admin '+ cla + '_type_tooltip_link').click(function(){
141
+ $(this).closest(cla + '_row').find(cla + '_tooltip').slideToggle();
142
+ });
143
+
144
+ //Mobile width
145
+ var $feedWidth = $(id+'_admin '+id+'_settings_width'),
146
+ $widthUnit = $(id+'_admin '+id+'_settings_width_unit');
147
+ if ($feedWidth.length) {
148
+ $feedWidth.change(function(){
149
+ self.updateFeedWidthDisplay();
150
+ });
151
+ $widthUnit.change(function(){
152
+ self.updateFeedWidthDisplay();
153
+ });
154
+ self.updateFeedWidthDisplay();
155
+ }
156
+ },
157
+ addAccessTokenListener: function() {
158
+ var self = this;
159
+ if (window.location.hash.length > 5 && window.location.hash.indexOf(this.accesstokenSplitter) > -1) {
160
+ var accessToken = window.location.hash.split(this.accesstokenSplitter);
161
+ // clear access token from hash
162
+ window.location.hash = '';
163
+ var submitData = {
164
+ 'access_token' : accessToken[1],
165
+ 'action' : this.plugin + '_process_access_token',
166
+ 'sbspf_nonce' : sbspf.nonce
167
+ };
168
+ var onSuccess = function (data) {
169
+ if (data.trim().indexOf('{') === 0) {
170
+ var returnObj = JSON.parse(data.trim());
171
+ $('.'+self.plugin +'_connected_accounts_wrap').prepend(returnObj.html);
172
+ self.initClickRemove($('.'+self.plugin +'_connected_accounts_wrap').last());
173
+ self.initInfoToggle($('.'+self.plugin +'_connected_accounts_wrap').last());
174
+ }
175
+ };
176
+ sbAjax(submitData,onSuccess);
177
+ }
178
+ },
179
+ initClickRemove: function(el) {
180
+ var self = this;
181
+ el.find('.'+this.plugin +'_delete_account').click(function() {
182
+ if (!$(this).closest('.'+self.plugin +'_connected_accounts_wrap').hasClass(self.plugin +'-waiting')) {
183
+ $(this).closest('.'+self.plugin +'_connected_accounts_wrap').addClass(self.plugin +'-waiting');
184
+ var $connectedAccount = $(this).closest('.'+self.plugin +'_connected_account'),
185
+ accountID = $connectedAccount.attr('data-userid');
186
+
187
+ if (window.confirm("Delete this connected account?")) {
188
+ $('#'+self.plugin +'_user_feed_id_' + accountID).remove();
189
+ $('#'+self.plugin +'_connected_account_' + accountID).append('<div class="spinner" style="margin-top: -10px;visibility: visible;top: 50%;position: absolute;right: 50%;"></div>').find('.'+self.plugin +'_ca_info').css('opacity','.5');
190
+
191
+ var submitData = {
192
+ 'account_id' : accountID,
193
+ 'action' : self.getAction( 'ca_after_remove_clicked' ),
194
+ 'sbspf_nonce' : sbspf.nonce
195
+ };
196
+ var onSuccess = function (data) {
197
+ if (data.trim().indexOf('{') === 0) {
198
+ var returnObj = JSON.parse(data.trim());
199
+ $('.'+self.plugin +'-waiting').removeClass(self.plugin +'-waiting');
200
+ $connectedAccount.fadeOut(300, function() { $(this).remove(); });
201
+ self.afterConnectedAccountRemoved(accountID);
202
+ }
203
+ };
204
+ sbAjax(submitData,onSuccess);
205
+ } else {
206
+ $('.'+self.plugin +'-waiting').removeClass(self.plugin +'-waiting');
207
+ }
208
+ }
209
+
210
+ });
211
+ },
212
+ initInfoToggle: function(el) {
213
+ var self = this;
214
+ el.find('.'+self.plugin +'_ca_show_token').click(function() {
215
+ $(this).closest('.'+self.plugin +'_ca_info').find('.'+self.plugin +'_ca_accesstoken').slideToggle(200);
216
+ });
217
+
218
+ el.find('.'+self.plugin +'_ca_token_shortcode').click(function() {
219
+ $(this).closest('.'+self.plugin +'_ca_info').find('.'+self.plugin +'_ca_shortcode').slideToggle(200);
220
+ });
221
+ },
222
+ initAppCredToggle: function() {
223
+ var self = this;
224
+ $('#'+self.plugin +'_have_own_tokens').click(function() {
225
+ if ($(this).is(':checked')) {
226
+ $(this).closest('form').find('.'+self.plugin +'_own_credentials_wrap').slideDown();
227
+ } else {
228
+ $(this).closest('form').find('.'+self.plugin +'_own_credentials_wrap').slideUp();
229
+ }
230
+ });
231
+
232
+ if ($('#'+self.plugin +'_have_own_tokens').is(':checked')) {
233
+ $('#'+self.plugin +'_have_own_tokens').closest('form').find('.'+self.plugin +'_own_credentials_wrap').slideDown();
234
+ } else {
235
+ $('#'+self.plugin +'_have_own_tokens').closest('form').find('.'+self.plugin +'_own_credentials_wrap').slideUp();
236
+ }
237
+ },
238
+ initWidthResponsiveToggle: function() {
239
+ //Mobile width
240
+ var feedWidth = $('#sby_settings_width').length ? $('#sby_settings_width').val() : '100',
241
+ widthUnit = $('#sby_settings_widthunit').length ? $('#sby_settings_widthunit').val() : '%',
242
+ $widthOptions = $('#sbspf_width_options');
243
+
244
+ if ($('#sby_settings_widthunit').length) {
245
+
246
+ //Show initially if a width is set
247
+ if (feedWidth !== '100' && widthUnit === '%') {
248
+ $widthOptions.slideDown();
249
+ } else {
250
+ $widthOptions.slideUp();
251
+ }
252
+
253
+ $('#sby_settings_width_unit, #sby_settings_width').change(function(){
254
+ feedWidth = $('#sby_settings_width').length ? $('#sby_settings_width').val() : '100';
255
+ widthUnit = $('#sby_settings_widthunit').length ? $('#sby_settings_widthunit').val() : '%';
256
+
257
+ if (feedWidth !== '100' && widthUnit === '%') {
258
+ $widthOptions.slideDown();
259
+ } else {
260
+ $widthOptions.slideUp();
261
+ }
262
+
263
+ });
264
+
265
+ }
266
+ },
267
+ initActionButtons: function() {
268
+ $('#sbspf_admin .sbspf-button-action').each(function(){
269
+ $(this).click(function() {
270
+ event.preventDefault();
271
+ $(this).next('.sbspf_success').remove();
272
+
273
+ var doAction = typeof $(this).attr('data-sby-action') !== 'undefined' ? $(this).attr('data-sby-action') : '',
274
+ confirmMessage = typeof $(this).attr('data-sby-confirm') !== 'undefined' ? $(this).attr('data-sby-confirm') : false,
275
+ $targetWaitingEl = typeof $(this).attr('data-sby-waiter') !== 'undefined' ? $($(this).attr('data-sby-waiter')) : $(this),
276
+ $self = $(this);
277
+ if (!confirmMessage || window.confirm(confirmMessage)) {
278
+ $(this).attr('disabled',true);
279
+ $targetWaitingEl.after('<div class="spinner sbspf_spinner" style="display:inline-block;visibility: visible;"></div>');
280
+
281
+ var submitData = {
282
+ 'action' : doAction,
283
+ 'sbspf_nonce' : sbspf.nonce
284
+ };
285
+ var onSuccess = function (data) {
286
+ $self.removeAttr('disabled');
287
+ $targetWaitingEl.next('.spinner').fadeOut('slow',function(){
288
+ $targetWaitingEl.after('<span class="sbspf_success"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="check-circle" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-check-circle fa-w-16"><path fill="currentColor" d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z" class=""></path></svg></span>');
289
+ });
290
+
291
+ if (data.trim().indexOf('{') === 0) {
292
+ var returnObj = JSON.parse(data.trim());
293
+ console.log(returnObj);
294
+
295
+ }
296
+ };
297
+ sbAjax(submitData,onSuccess);
298
+ } else {
299
+ $('.'+self.plugin +'-waiting').removeClass(self.plugin +'-waiting');
300
+ }
301
+ console.log($(this).attr('data-sby-action'),$(this).attr('data-sby-confirm'));
302
+ });
303
+ });
304
+ },
305
+ getAction(action) {
306
+ return self.plugin + '_' + action
307
+ },
308
+ addManualAccessTokenListener: function() {
309
+ var self = this,
310
+ id = '#'+this.plugin,
311
+ cla = '.'+this.plugin;
312
+
313
+ $(cla+'_manually_connect_wrap').hide();
314
+ $(cla+'_manually_connect').click(function(event) {
315
+ event.preventDefault();
316
+ if ( $(cla+'_manually_connect_wrap').is(':visible') ) {
317
+ $(cla+'_manually_connect_wrap').slideUp(200);
318
+ } else {
319
+ $(cla+'_manually_connect_wrap').slideDown(200);
320
+ $(id+'_manual_at').focus();
321
+ }
322
+ });
323
+
324
+ $(id+'_manual_submit').click(function(event) {
325
+ event.preventDefault();
326
+ var $self = $(this);
327
+ var accessToken = $(id+'_manual_at').val(),
328
+ error = false;
329
+
330
+ if (accessToken.length < 15) {
331
+ if (!$(cla+'_manually_connect_wrap').find(cla+'_user_id_error').length) {
332
+ $(cla+'_manually_connect_wrap').show().prepend('<div class="'+self.plugin+'_user_id_error" style="display:block;">Please enter a valid access token</div>');
333
+ }
334
+ } else if (! error) {
335
+ $(this).attr('disabled',true);
336
+ $(this).closest(cla+'_manually_connect_wrap').fadeOut();
337
+ $(cla+'_connected_accounts_wrap').fadeTo("slow" , 0.5).find(cla+'_user_id_error').remove();
338
+
339
+ var submitData = {
340
+ 'access_token' : accessToken,
341
+ 'action' : self.plugin + '_process_access_token',
342
+ 'sbspf_nonce' : sbspf.nonce
343
+ };
344
+ var onSuccess = function (data) {
345
+ $(cla+'_connected_accounts_wrap').fadeTo("slow" , 1);
346
+ $self.removeAttr('disabled');
347
+ var returnObj = JSON.parse(data.trim());
348
+ $('.'+self.plugin +'_connected_accounts_wrap').prepend(returnObj.html);
349
+ self.initClickRemove($('.'+self.plugin +'_connected_accounts_wrap').last());
350
+ self.initInfoToggle($('.'+self.plugin +'_connected_accounts_wrap').last());
351
+ };
352
+ sbAjax(submitData,onSuccess);
353
+ }
354
+
355
+ });
356
+ },
357
+ afterConnectedAccountRemoved: function(accountID) {
358
+
359
+ },
360
+ updateLayoutOptionsDisplay: function() {
361
+ self = this;
362
+ setTimeout(function(){
363
+ $('.'+self.plugin+'_layout_settings').hide();
364
+ $('.'+self.plugin+'_layout_settings.'+self.plugin+'_layout_type_'+$('.'+self.plugin+'_layout_type:checked').val()).show();
365
+ }, 1);
366
+ },
367
+ updateFeedWidthDisplay: function() {
368
+ self = this;
369
+ var sbspfFeedWidth = $('#'+self.plugin+'_admin '+'#'+self.plugin+'_settings_width').val(),
370
+ sbspfWidthUnit = $('#'+self.plugin+'_admin '+'#'+self.plugin+'_settings_width_unit').val(),
371
+ $sbspfWidthOptions = $('#'+self.plugin+'_admin '+'#'+self.plugin+'_width_options');
372
+
373
+ if( sbspfFeedWidth.length < 2 || (sbspfFeedWidth == '100' && sbspfWidthUnit == '%') ) {
374
+ $sbspfWidthOptions.slideUp();
375
+ } else {
376
+ $sbspfWidthOptions.slideDown();
377
+ }
378
+ },
379
+ encodeHTML: function(raw) {
380
+ // make sure passed variable is defined
381
+ if (typeof raw === 'undefined') {
382
+ return '';
383
+ }
384
+ // replace greater than and less than symbols with html entity to disallow html in comments
385
+ var encoded = raw.replace(/(>)/g,'&gt;'),
386
+ encoded = encoded.replace(/(<)/g,'&lt;');
387
+ encoded = encoded.replace(/(&lt;br\/&gt;)/g,'<br>');
388
+ encoded = encoded.replace(/(&lt;br&gt;)/g,'<br>');
389
+
390
+ return encoded;
391
+ },
392
+ };
393
+
394
+ window.sbspf_admin_init = function() {
395
+ var plugin = typeof $('.sbspf-admin').attr('data-sb-plugin') !== 'undefined' ? $('.sbspf-admin').attr('data-sb-plugin') : 'sbspf';
396
+ window.sb = new SbspfAdmin(plugin);
397
+ window.sb.init();
398
+ };
399
+
400
+ function sbAjax(submitData,onSuccess) {
401
+ $.ajax({
402
+ url: sbspf.ajaxUrl,
403
+ type: 'post',
404
+ data: submitData,
405
+ success: onSuccess
406
+ });
407
+ }
408
+
409
+ function SbYoutubeAdmin(plugin) {
410
+ SbspfAdmin.call(this, plugin);
411
+
412
+ this.addAccessTokenListener = function () {
413
+ var self = this;
414
+ if (window.location.hash.length > 5 && window.location.hash.indexOf(this.accesstokenSplitter) > -1) {
415
+ var accessToken = window.location.hash.split(this.accesstokenSplitter);
416
+ // clear access token from hash
417
+ window.location.hash = '';
418
+ var submitData = {
419
+ 'access_token' : accessToken[1],
420
+ 'action' : 'sby_process_access_token',
421
+ 'sbspf_nonce' : sbspf.nonce
422
+ };
423
+ var onSuccess = function (data) {
424
+ if (data.trim().indexOf('{') === 0) {
425
+ var returnObj = JSON.parse(data.trim());
426
+ $('.'+self.plugin +'_connected_accounts_wrap').prepend(returnObj.html);
427
+ self.initClickRemove($('.'+self.plugin +'_connected_accounts_wrap').last());
428
+ self.initInfoToggle($('.'+self.plugin +'_connected_accounts_wrap').last());
429
+ }
430
+ };
431
+ sbAjax(submitData,onSuccess);
432
+ }
433
+ };
434
+
435
+ this.addManualAccessTokenListener = function() {
436
+ var self = this,
437
+ id = '#'+this.plugin,
438
+ cla = '.'+this.plugin;
439
+
440
+ $(cla+'_manually_connect_wrap').hide();
441
+ $(cla+'_manually_connect').click(function(event) {
442
+ event.preventDefault();
443
+ if ( $(cla+'_manually_connect_wrap').is(':visible') ) {
444
+ $(cla+'_manually_connect_wrap').slideUp(200);
445
+ } else {
446
+ $(cla+'_manually_connect_wrap').slideDown(200);
447
+ $(id+'_manual_at').focus();
448
+ }
449
+ });
450
+
451
+ $(id+'_manual_submit').click(function(event) {
452
+ event.preventDefault();
453
+ var $self = $(this);
454
+ var accessToken = $(id+'_manual_at').val(),
455
+ refreshToken = $(id+'_manual_rt').val(),
456
+ error = false;
457
+
458
+ if (accessToken.length < 15) {
459
+ if (!$(cla+'_manually_connect_wrap').find(cla+'_user_id_error').length) {
460
+ $(cla+'_manually_connect_wrap').show().prepend('<div class="'+self.plugin+'_user_id_error" style="display:block;">Please enter a valid access token</div>');
461
+ }
462
+ } else if (! error) {
463
+ $(this).attr('disabled',true);
464
+ $(this).closest(cla+'_manually_connect_wrap').fadeOut();
465
+ $(cla+'_connected_accounts_wrap').fadeTo("slow" , 0.5).find(cla+'_user_id_error').remove();
466
+
467
+ var submitData = {
468
+ 'sby_access_token' : accessToken,
469
+ 'sby_refresh_token' : refreshToken,
470
+ 'action' : 'sby_process_access_token',
471
+ 'sbspf_nonce' : sbspf.nonce
472
+ };
473
+ var onSuccess = function (data) {
474
+ $(cla+'_connected_accounts_wrap').fadeTo("slow" , 1);
475
+ $self.removeAttr('disabled');
476
+ if (data.trim().indexOf('{') === 0) {
477
+ var returnObj = JSON.parse(data.trim());
478
+ if (typeof returnObj.error === 'undefined') {
479
+ if (!$('#sbspf_connected_account_'+returnObj.account_id).length) {
480
+ $('.'+self.plugin +'_connected_accounts_wrap').prepend(returnObj.html);
481
+ self.initClickRemove($('.'+self.plugin +'_connected_accounts_wrap').last());
482
+ self.initInfoToggle($('.'+self.plugin +'_connected_accounts_wrap').last());
483
+ console.log('added');
484
+ } else {
485
+ $('#sbspf_connected_account_'+returnObj.account_id).replaceWith(returnObj.html);
486
+ self.initClickRemove($('#sbspf_connected_account_'+returnObj.account_id));
487
+ self.initInfoToggle($('#sbspf_connected_account_'+returnObj.account_id));
488
+ console.log('updated');
489
+ }
490
+ } else {
491
+ alert(returnObj.error);
492
+ }
493
+ }
494
+
495
+ };
496
+ sbAjax(submitData,onSuccess);
497
+ }
498
+
499
+ });
500
+ };
501
+ this.getAction = function(action) {
502
+ return 'sby_' + action;
503
+ };
504
+
505
+ }
506
+
507
+ SbYoutubeAdmin.prototype = Object.create(SbspfAdmin.prototype);
508
+
509
+
510
+ window.sby_admin_init = function() {
511
+ var plugin = typeof $('.sbspf-admin').attr('data-sb-plugin') !== 'undefined' ? $('.sbspf-admin').attr('data-sb-plugin') : 'sbspf';
512
+ window.sb = new SbYoutubeAdmin(plugin);
513
+ window.sb.init();
514
+ };
515
+
516
+ })(jQuery);
517
+
518
+ jQuery(document).ready(function($) {
519
+ sby_admin_init();
520
+ });
js/sb-youtube.js ADDED
@@ -0,0 +1,1158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var sby_js_exists = (typeof sby_js_exists !== 'undefined') ? true : false;
2
+ if(!sby_js_exists) {
3
+
4
+ //Checks whether browser support HTML5 video element
5
+ function sby_supports_video() {
6
+ return !!document.createElement('video').canPlayType;
7
+ }
8
+
9
+ (function($){
10
+
11
+ function sbyAddVisibilityListener() {
12
+ /* Detect when element becomes visible. Used for when the feed is initially hidden, in a tab for example. https://github.com/shaunbowe/jquery.visibilityChanged */
13
+ !function (i) {
14
+ var n = {
15
+ callback: function () {
16
+ }, runOnLoad: !0, frequency: 100, sbyPreviousVisibility: null
17
+ }, c = {};
18
+ c.sbyCheckVisibility = function (i, n) {
19
+ if (jQuery.contains(document, i[0])) {
20
+ var e = n.sbyPreviousVisibility, t = i.is(":visible");
21
+ n.sbyPreviousVisibility = t, null == e ? n.runOnLoad && n.callback(i, t) : e !== t && n.callback(i, t), setTimeout(function () {
22
+ c.sbyCheckVisibility(i, n)
23
+ }, n.frequency)
24
+ }
25
+ }, i.fn.sbyVisibilityChanged = function (e) {
26
+ var t = i.extend({}, n, e);
27
+ return this.each(function () {
28
+ c.sbyCheckVisibility(i(this), t)
29
+ })
30
+ }
31
+ }(jQuery);
32
+ }
33
+
34
+ function Sby() {
35
+ this.feeds = {};
36
+ this.options = sbyOptions;
37
+ this.isTouch = sbyIsTouch();
38
+ }
39
+
40
+ Sby.prototype = {
41
+ createPage: function (createFeeds, createFeedsArgs) {
42
+ if (typeof window.sbyajaxurl === 'undefined' || window.sbyajaxurl.indexOf(window.location.hostname) === -1) {
43
+ window.sbyajaxurl = window.location.hostname + '/wp-admin/admin-ajax.php';
44
+ }
45
+
46
+ $('.sby_no_js_error_message').remove();
47
+ $('.sby_no_js').removeClass('sby_no_js');
48
+ var youtubeScriptId = "youtube-api";
49
+ var youtubeScript = document.getElementById(youtubeScriptId);
50
+
51
+ if (youtubeScript === null) {
52
+ var tag = document.createElement("script");
53
+ var firstScript = document.getElementsByTagName("script")[0];
54
+
55
+ tag.src = "http://www.youtube.com/iframe_api";
56
+ tag.id = youtubeScriptId;
57
+ firstScript.parentNode.insertBefore(tag, firstScript);
58
+
59
+ }
60
+ createFeeds(createFeedsArgs);
61
+ },
62
+ createLightbox: function() {
63
+ /* Lightbox v2.7.1 by Lokesh Dhakar - http://lokeshdhakar.com/projects/lightbox2/ - Heavily modified specifically for this plugin */
64
+ (function() {
65
+ var a = jQuery,
66
+ b = function() {
67
+ function a() {
68
+ this.fadeDuration = 500, this.fitImagesInViewport = !0, this.resizeDuration = 700, this.positionFromTop = 50, this.showImageNumberLabel = !0, this.alwaysShowNavOnTouchDevices = !1, this.wrapAround = !1
69
+ }
70
+ return a.prototype.albumLabel = function(a, b) {
71
+ return a + " / " + b
72
+ }, a
73
+ }(),
74
+ c = function() {
75
+ function b(a) {
76
+ this.options = a, this.album = [], this.currentImageIndex = void 0, this.init()
77
+ }
78
+ return b.prototype.init = function() {
79
+ this.enable(), this.build()
80
+ }, b.prototype.enable = function() {
81
+ var b = this;
82
+ a("body").on("click", "a[data-sby-lightbox]", function(c) {
83
+ return b.start(a(c.currentTarget)), !1
84
+ })
85
+ }, b.prototype.build = function() {
86
+ var b = this;
87
+ a(""+
88
+ "<div id='sby_lightboxOverlay' class='sby_lightboxOverlay'></div>"+
89
+ "<div id='sby_lightbox' class='sby_lightbox'>"+
90
+ "<div class='sby_lb-outerContainer'>"+
91
+ "<div class='sby_lb-container'>"+
92
+ "<img class='sby_lb-image' alt='Lightbox image placeholder' src='' />"+
93
+ "<div class='sby_lb-player' id='sby_lb-player'></div>" +
94
+ "<div class='sby_lb-nav'><a class='sby_lb-prev' href='#' ><p class='sby-screenreader'>Previous Slide</p></a><a class='sby_lb-next' href='#' ><p class='sby-screenreader'>Next Slide</p></a></div>"+
95
+ "<div class='sby_lb-loader'><a class='sby_lb-cancel'></a></div>"+
96
+ "</div>"+
97
+ "</div>"+
98
+ "<div class='sby_lb-dataContainer'>"+
99
+ "<div class='sby_lb-data'>"+
100
+ "<div class='sby_lb-details'>"+
101
+ "<div class='sby_lb-caption'></div>"+
102
+ "<div class='sby_lb-info'>"+
103
+ "<div class='sby_lb-number'></div>"+
104
+ "<div class='sby_lb-closeContainer'><a class='sby_lb-close'></a></div>"+
105
+ "</div>"+
106
+ "</div>"+
107
+ "</div>").appendTo(a("body")), this.$lightbox = a("#sby_lightbox"), this.$overlay = a("#sby_lightboxOverlay"), this.$outerContainer = this.$lightbox.find(".sby_lb-outerContainer"), this.$container = this.$lightbox.find(".sby_lb-container"), this.containerTopPadding = parseInt(this.$container.css("padding-top"), 10), this.containerRightPadding = parseInt(this.$container.css("padding-right"), 10), this.containerBottomPadding = parseInt(this.$container.css("padding-bottom"), 10), this.containerLeftPadding = parseInt(this.$container.css("padding-left"), 10), this.$overlay.hide().on("click", function() {
108
+ return b.end(), !1
109
+ }), jQuery(document).on('click', function(event, b, c) {
110
+ //Fade out the lightbox if click anywhere outside of the two elements defined below
111
+ if (!jQuery(event.target).closest('.sby_lb-outerContainer').length) {
112
+ if (!jQuery(event.target).closest('.sby_lb-dataContainer').length) {
113
+ //Fade out lightbox
114
+ if (typeof window.sbyLightboxPlayer !== 'undefined') { window.sbyLightboxPlayer.pauseVideo(); }
115
+
116
+ jQuery('#sby_lightboxOverlay, #sby_lightbox').fadeOut();
117
+ }
118
+ }
119
+ }), this.$lightbox.hide(),
120
+ jQuery('#sby_lightboxOverlay').on("click", function(c) {
121
+ if (typeof window.sbyLightboxPlayer !== 'undefined') { window.sbyLightboxPlayer.pauseVideo(); }
122
+
123
+ return "sby_lightbox" === a(c.target).attr("id") && b.end(), !1
124
+ }), this.$lightbox.find(".sby_lb-prev").on("click", function() {
125
+
126
+ if (typeof window.sbyLightboxPlayer !== 'undefined') { window.sbyLightboxPlayer.pauseVideo(); }
127
+
128
+ return b.changeImage(0 === b.currentImageIndex ? b.album.length - 1 : b.currentImageIndex - 1), !1
129
+ }), this.$lightbox.find(".sby_lb-container").on("swiperight", function() {
130
+
131
+ if (typeof window.sbyLightboxPlayer !== 'undefined') { window.sbyLightboxPlayer.pauseVideo(); }
132
+
133
+ return b.changeImage(0 === b.currentImageIndex ? b.album.length - 1 : b.currentImageIndex - 1), !1
134
+ }), this.$lightbox.find(".sby_lb-next").on("click", function() {
135
+
136
+ if (typeof window.sbyLightboxPlayer !== 'undefined') { window.sbyLightboxPlayer.pauseVideo(); }
137
+
138
+ return b.changeImage(b.currentImageIndex === b.album.length - 1 ? 0 : b.currentImageIndex + 1), !1
139
+ }), this.$lightbox.find(".sby_lb-container").on("swipeleft", function() {
140
+
141
+ if (typeof window.sbyLightboxPlayer !== 'undefined') { window.sbyLightboxPlayer.pauseVideo(); }
142
+
143
+ return b.changeImage(b.currentImageIndex === b.album.length - 1 ? 0 : b.currentImageIndex + 1), !1
144
+ }), this.$lightbox.find(".sby_lb-loader, .sby_lb-close").on("click", function() {
145
+
146
+ if (typeof window.sbyLightboxPlayer !== 'undefined') { window.sbyLightboxPlayer.pauseVideo(); }
147
+
148
+ return b.end(), !1
149
+ })
150
+ }, b.prototype.start = function(b) {
151
+ function c(a) {
152
+ d.album.push({
153
+ link: a.attr("href"),
154
+ video: a.attr("data-video-id"),
155
+ })
156
+ }
157
+ var d = this,
158
+ e = a(window);
159
+ e.on("resize", a.proxy(this.sizeOverlay, this)), a("select, object, embed").css({
160
+ visibility: "hidden"
161
+ }), this.sizeOverlay(), this.album = [];
162
+ var f, g = 0,
163
+ h = b.attr("data-sby-lightbox");
164
+ if (h) {
165
+ f = a(b.prop("tagName") + '[data-sby-lightbox="' + h + '"]');
166
+ for (var i = 0; i < f.length; i = ++i) c(a(f[i])), f[i] === b[0] && (g = i)
167
+ } else if ("lightbox" === b.attr("rel")) c(b);
168
+ else {
169
+ f = a(b.prop("tagName") + '[rel="' + b.attr("rel") + '"]');
170
+ for (var j = 0; j < f.length; j = ++j) c(a(f[j])), f[j] === b[0] && (g = j)
171
+ }
172
+ var k = e.scrollTop() + this.options.positionFromTop,
173
+ l = e.scrollLeft();
174
+ this.$lightbox.css({
175
+ top: k + "px",
176
+ left: l + "px"
177
+ }).fadeIn(this.options.fadeDuration), this.changeImage(g)
178
+ }, b.prototype.changeImage = function(b) {
179
+ var c = this;
180
+ this.disableKeyboardNav();
181
+ var d = this.$lightbox.find(".sby_lb-image");
182
+ this.$overlay.fadeIn(this.options.fadeDuration), a(".sby_lb-loader").fadeIn("slow"), this.$lightbox.find(".sby_lb-image, .sby_lb-nav, .sby_lb-prev, .sby_lb-next, .sby_lb-dataContainer, .sby_lb-numbers, .sby_lb-caption").hide(), this.$outerContainer.addClass("animating");
183
+ var e = new Image;
184
+ e.onload = function() {
185
+ var f, g, h, i, j, k, l;
186
+ d.attr("src", c.album[b].link), f = a(e), d.width(e.width), d.height(e.height), c.options.fitImagesInViewport && (l = a(window).width(), k = a(window).height(), j = l - c.containerLeftPadding - c.containerRightPadding - 20, i = k - c.containerTopPadding - c.containerBottomPadding - 150, (e.width > j || e.height > i) && (e.width / j > e.height / i ? (h = j, g = parseInt(e.height / (e.width / h), 10), d.width(h), d.height(g)) : (g = i, h = parseInt(e.width / (e.height / g), 10), d.width(h), d.height(g)))), c.sizeContainer(d.width(), d.height())
187
+ }, e.src = this.album[b].link, this.currentImageIndex = b
188
+ }, b.prototype.sizeOverlay = function() {
189
+ this.$overlay.width(a(window).width()).height(a(document).height())
190
+ }, b.prototype.sizeContainer = function(a, b) {
191
+ function c() {
192
+ d.$lightbox.find(".sby_lb-dataContainer").width(g), d.$lightbox.find(".sby_lb-prevLink").height(h), d.$lightbox.find(".sby_lb-nextLink").height(h), d.showImage()
193
+ }
194
+ var d = this,
195
+ e = this.$outerContainer.outerWidth(),
196
+ f = this.$outerContainer.outerHeight(),
197
+ g = a + this.containerLeftPadding + this.containerRightPadding,
198
+ h = b + this.containerTopPadding + this.containerBottomPadding;
199
+ e !== g || f !== h ? this.$outerContainer.animate({
200
+ width: g,
201
+ height: h
202
+ }, this.options.resizeDuration, "swing", function() {
203
+ c()
204
+ }) : c()
205
+ }, b.prototype.showImage = function() {
206
+ this.$lightbox.find(".sby_lb-loader").hide(), this.$lightbox.find(".sby_lb-image").fadeIn("slow"), this.updateNav(), this.updateDetails(), this.preloadNeighboringImages(), this.enableKeyboardNav()
207
+ }, b.prototype.updateNav = function() {
208
+ var a = !1;
209
+ try {
210
+ document.createEvent("TouchEvent"), a = this.options.alwaysShowNavOnTouchDevices ? !0 : !1
211
+ } catch (b) {}
212
+ this.$lightbox.find(".sby_lb-nav").show(), this.album.length > 1 && (this.options.wrapAround ? (a && this.$lightbox.find(".sby_lb-prev, .sby_lb-next").css("opacity", "1"), this.$lightbox.find(".sby_lb-prev, .sby_lb-next").show()) : (this.currentImageIndex > 0 && (this.$lightbox.find(".sby_lb-prev").show(), a && this.$lightbox.find(".sby_lb-prev").css("opacity", "1")), this.currentImageIndex < this.album.length - 1 && (this.$lightbox.find(".sby_lb-next").show(), a && this.$lightbox.find(".sby_lb-next").css("opacity", "1"))))
213
+ }, b.prototype.updateDetails = function() {
214
+ var b = this;
215
+
216
+ /** NEW PHOTO ACTION **/
217
+ //Switch video when either a new popup or navigating to new one
218
+ if( sby_supports_video() ){
219
+ jQuery('#sby_lightbox').removeClass('sby_video_lightbox');
220
+ if( this.album[this.currentImageIndex].video.length ){
221
+ var playerID = 'sby_lb-player';
222
+ jQuery('#sby_lightbox').addClass('sby_video_lightbox');
223
+
224
+ var videoID = this.album[this.currentImageIndex].video,
225
+ autoplay = sbyOptions.autoplay;
226
+ if (typeof window.sbyLightboxPlayer === 'undefined') {
227
+ var args = {
228
+ host: window.location.protocol + '//www.youtube-nocookie.com',
229
+ videoId: videoID,
230
+ playerVars: {
231
+ modestbranding: 1,
232
+ rel: 0,
233
+ autoplay: autoplay
234
+ },
235
+ };
236
+
237
+ window.sbyLightboxPlayer = new window.YT.Player(playerID, args);
238
+ } else {
239
+ window.sbyLightboxPlayer.loadVideoById(videoID);
240
+ }
241
+
242
+ }
243
+ }
244
+ }, b.prototype.preloadNeighboringImages = function() {
245
+ if (this.album.length > this.currentImageIndex + 1) {
246
+ var a = new Image;
247
+ a.src = this.album[this.currentImageIndex + 1].link
248
+ }
249
+ if (this.currentImageIndex > 0) {
250
+ var b = new Image;
251
+ b.src = this.album[this.currentImageIndex - 1].link
252
+ }
253
+ }, b.prototype.enableKeyboardNav = function() {
254
+ a(document).on("keyup.keyboard", a.proxy(this.keyboardAction, this))
255
+ }, b.prototype.disableKeyboardNav = function() {
256
+ a(document).off(".keyboard")
257
+ }, b.prototype.keyboardAction = function(a) {
258
+
259
+ var KEYCODE_ESC = 27;
260
+ var KEYCODE_LEFTARROW = 37;
261
+ var KEYCODE_RIGHTARROW = 39;
262
+
263
+ var keycode = event.keyCode;
264
+ var key = String.fromCharCode(keycode).toLowerCase();
265
+ if (keycode === KEYCODE_ESC || key.match(/x|o|c/)) {
266
+ if( sby_supports_video() ) $('#sby_lightbox video.sby_video')[0].pause();
267
+ $('#sby_lightbox iframe').attr('src', '');
268
+ this.end();
269
+ } else if (key === 'p' || keycode === KEYCODE_LEFTARROW) {
270
+ if (this.currentImageIndex !== 0) {
271
+ this.changeImage(this.currentImageIndex - 1);
272
+ } else if (this.options.wrapAround && this.album.length > 1) {
273
+ this.changeImage(this.album.length - 1);
274
+ }
275
+
276
+ if( sby_supports_video() ) $('#sby_lightbox video.sby_video')[0].pause();
277
+ $('#sby_lightbox iframe').attr('src', '');
278
+
279
+ } else if (key === 'n' || keycode === KEYCODE_RIGHTARROW) {
280
+ if (this.currentImageIndex !== this.album.length - 1) {
281
+ this.changeImage(this.currentImageIndex + 1);
282
+ } else if (this.options.wrapAround && this.album.length > 1) {
283
+ this.changeImage(0);
284
+ }
285
+
286
+ if (typeof window.sbyLightboxPlayer !== 'undefined') { window.sbyLightboxPlayer.pauseVideo(); }
287
+ }
288
+
289
+ }, b.prototype.end = function() {
290
+ this.disableKeyboardNav(), a(window).off("resize", this.sizeOverlay), this.$lightbox.fadeOut(this.options.fadeDuration), this.$overlay.fadeOut(this.options.fadeDuration), a("select, object, embed").css({
291
+ visibility: "visible"
292
+ })
293
+ }, b
294
+ }();
295
+ a(function() {
296
+ {
297
+ var a = new b;
298
+ new c(a)
299
+
300
+ //Lightbox hide photo function
301
+ $('.sby_lightbox_action a').unbind().bind('click', function(){
302
+ $(this).parent().find('.sby_lightbox_tooltip').toggle();
303
+ });
304
+ }
305
+ })
306
+ }).call(this);
307
+ },
308
+ createFeeds: function (args) {
309
+ window.sby.createLightbox();
310
+ args.whenFeedsCreated(
311
+ $('.sb_youtube').each(function (index) {
312
+ $(this).attr('data-sby-index', index + 1);
313
+ $(this).find('.sby_player').replaceWith('<div id="sby_player'+index+'"></div>');
314
+ var $self = $(this),
315
+ flags = typeof $self.attr('data-sby-flags') !== 'undefined' ? $self.attr('data-sby-flags').split(',') : [],
316
+ general = typeof $self.attr('data-options') !== 'undefined' ? JSON.parse($self.attr('data-options')) : {};
317
+ if (flags.indexOf('testAjax') > -1) {
318
+ window.sby.triggeredTest = true;
319
+ var submitData = {
320
+ 'action' : 'sby_on_ajax_test_trigger'
321
+ },
322
+ onSuccess = function(data) {
323
+ console.log('did test');
324
+ };
325
+ sbyAjax(submitData,onSuccess)
326
+ }
327
+ var feedOptions = {
328
+ cols : $self.attr('data-cols'),
329
+ colsmobile : $self.attr('data-colsmobile') !== 'same' ? $self.attr('data-colsmobile') : $self.attr('data-cols'),
330
+ num : $self.attr('data-num'),
331
+ imgRes : $self.attr('data-res'),
332
+ feedID : $self.attr('data-feedid'),
333
+ shortCodeAtts : $self.attr('data-shortcode-atts'),
334
+ resizingEnabled : (flags.indexOf('resizeDisable') === -1),
335
+ imageLoadEnabled : (flags.indexOf('imageLoadDisable') === -1),
336
+ debugEnabled : (flags.indexOf('debug') > -1),
337
+ favorLocal : (flags.indexOf('favorLocal') > -1),
338
+ ajaxPostLoad : (flags.indexOf('ajaxPostLoad') > -1),
339
+ checkWPPosts : (flags.indexOf('checkWPPosts') > -1),
340
+ lightboxEnabled : typeof $self.attr('data-sby-supports-lightbox') !== 'undefined',
341
+ autoMinRes : 1,
342
+ general : general
343
+ };
344
+
345
+ window.sby.feeds[index] = sbyGetNewFeed(this, index, feedOptions);
346
+ window.sby.feeds[index].setResizedImages();
347
+ window.sby.feeds[index].init();
348
+
349
+ var evt = jQuery.Event('sbyafterfeedcreate');
350
+ evt.feed = window.sby.feeds[index];
351
+ jQuery(window).trigger(evt);
352
+
353
+ })
354
+ );
355
+ },
356
+ afterFeedsCreated: function () {
357
+ // enable header hover action
358
+ $('.sb_instagram_header').each(function () {
359
+ var $thisHeader = $(this);
360
+ $thisHeader.find('.sby_header_link').hover(function () {
361
+ $thisHeader.find('.sby_header_img_hover').addClass('sby_fade_in');
362
+ }, function () {
363
+ $thisHeader.find('.sby_header_img_hover').removeClass('sby_fade_in');
364
+ });
365
+ });
366
+
367
+ },
368
+ encodeHTML: function(raw) {
369
+ // make sure passed variable is defined
370
+ if (typeof raw === 'undefined') {
371
+ return '';
372
+ }
373
+ // replace greater than and less than symbols with html entity to disallow html in comments
374
+ var encoded = raw.replace(/(>)/g,'&gt;'),
375
+ encoded = encoded.replace(/(<)/g,'&lt;');
376
+ encoded = encoded.replace(/(&lt;br\/&gt;)/g,'<br>');
377
+ encoded = encoded.replace(/(&lt;br&gt;)/g,'<br>');
378
+
379
+ return encoded;
380
+ },
381
+ urlDetect: function(text) {
382
+ var urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g;
383
+ return text.match(urlRegex);
384
+ }
385
+ };
386
+
387
+ function SbyFeed(el, index, settings) {
388
+ this.el = el;
389
+ this.index = index;
390
+ this.settings = settings;
391
+ this.playerAPIReady = false;
392
+ this.consentGiven = true;
393
+ this.players = {};
394
+ this.minImageWidth = 0;
395
+ this.imageResolution = 150;
396
+ this.resizedImages = {};
397
+ this.needsResizing = [];
398
+ this.outOfPages = false;
399
+ this.isInitialized = false;
400
+ }
401
+
402
+ SbyFeed.prototype = {
403
+ init: function() {
404
+ var feed = this;
405
+ if (this.settings.ajaxPostLoad) {
406
+ this.getNewPostSet();
407
+ } else {
408
+ this.afterInitialImagesLoaded();
409
+ //Only check the width once the resize event is over
410
+ }
411
+ var sby_delay = (function () {
412
+ var sby_timer = 0;
413
+ return function (sby_callback, sby_ms) {
414
+ clearTimeout(sby_timer);
415
+ sby_timer = setTimeout(sby_callback, sby_ms);
416
+ };
417
+ })();
418
+ jQuery(window).resize(function () {
419
+ sby_delay(function () {
420
+ feed.afterResize();
421
+ }, 500);
422
+ });
423
+ },
424
+ initLayout: function() {
425
+ var $self = $(this.el),
426
+ feed = this;
427
+ if ($self.hasClass('sby_layout_gallery') && $self.find('.sby_player_outer_wrap').length) {
428
+ this.maybeRaiseSingleImageResolution($self.find('.sby_player_outer_wrap'), 0, true);
429
+ $self.find('.sby_player_outer_wrap .sby_video_thumbnail').off().click(function (event) {
430
+ event.preventDefault();
431
+ feed.onThumbnailClick($(this), true);
432
+ });
433
+
434
+ $self.mouseenter(function() {
435
+ if (!feed.canCreatePlayer()) {
436
+ return;
437
+ }
438
+ if (!$self.find('.sby_player_outer_wrap iframe').length) {
439
+ $self.addClass('sby_player_added').find('.sby_player_outer_wrap').addClass('sby_player_loading');
440
+ $self.find('.sby_player_outer_wrap .sby_video_thumbnail').find('.sby_loader').show().removeClass('sby_hidden');
441
+ feed.createPlayer('sby_player'+feed.index);
442
+ }
443
+ });
444
+
445
+ }
446
+
447
+ },
448
+ createPlayer: function(playerID,videoID,autoplay,args) {
449
+ var $self = $(this.el),
450
+ feed = this;
451
+ videoID = typeof videoID !== 'undefined' ? videoID : this.getVideoID($self.find('.sby_item').first());
452
+ autoplay = typeof autoplay !== 'undefined' ? autoplay : 0;
453
+
454
+ if (typeof args === 'undefined') {
455
+ args = {
456
+ host: window.location.protocol + '//www.youtube-nocookie.com',
457
+ videoId: videoID,
458
+ playerVars: {
459
+ modestbranding: 1,
460
+ rel: 0,
461
+ autoplay: autoplay
462
+ },
463
+ }
464
+ }
465
+ if (typeof args.events === 'undefined') {
466
+ args.events = {
467
+ 'onReady': function () {
468
+ $self.find('.sby_player_outer_wrap').removeClass('sby_player_loading').find('.sby_video_thumbnail').css('z-index', -1).find('.sby_loader').hide().addClass('sby_hidden');
469
+ if ($('#' + playerID).length && $('#' + playerID).closest('.sby_video_thumbnail_wrap').find('.sby_video_thumbnail').length) {
470
+ $('#' + playerID).closest('.sby_video_thumbnail_wrap').find('.sby_video_thumbnail').fadeTo(0, 'slow', function () {
471
+ $(this).css('z-index', -1);
472
+ $(this).find('.sby_loader').hide().addClass('sby_hidden');
473
+ $(this).closest('.sby_item').removeClass('sby_player_loading');
474
+ });
475
+ }
476
+ },
477
+ 'onStateChange': function(data) {
478
+ if (data.data !== 1) return;
479
+ if (typeof feed.players !== 'undefined') {
480
+ $self.find('.sby_item').each(function() {
481
+ var itemVidID = feed.getVideoID($(this));
482
+ if (videoID !== itemVidID) {
483
+ if (typeof feed.players[itemVidID] !== 'undefined') {
484
+ feed.players[itemVidID].pauseVideo();
485
+ }
486
+ }
487
+ });
488
+ }
489
+
490
+ },
491
+ }
492
+ }
493
+ var newPlayer = new window.YT.Player(playerID, args);
494
+
495
+ if ($self.hasClass('sby_layout_list') && typeof this.players[videoID] === 'undefined') {
496
+ this.players[videoID] = newPlayer;
497
+ } else if (typeof this.player === 'undefined') {
498
+ this.player = newPlayer;
499
+ }
500
+
501
+ return newPlayer;
502
+ },
503
+ afterInitialImagesLoaded: function() {
504
+ this.initLayout();
505
+ this.loadMoreButtonInit();
506
+ this.hideExtraItemsForWidth();
507
+ this.beforeNewImagesRevealed();
508
+ this.revealNewImages();
509
+ this.afterNewImagesRevealed();
510
+ },
511
+ afterResize: function() {
512
+ this.setImageHeight();
513
+ this.setImageResolution();
514
+ this.maybeRaiseImageResolution();
515
+ this.setImageSizeClass();
516
+ },
517
+ afterLoadMoreClicked: function($button) {
518
+ $button.find('.sby_loader').removeClass('sby_hidden');
519
+ $button.find('.sby_btn_text').addClass('sby_hidden');
520
+ $button.closest('.sb_youtube').find('.sby_num_diff_hide').addClass('sby_transition').removeClass('sby_num_diff_hide');
521
+ },
522
+ afterNewImagesLoaded: function() {
523
+ var $self = $(this.el),
524
+ feed = this;
525
+ this.beforeNewImagesRevealed();
526
+ this.revealNewImages();
527
+ this.afterNewImagesRevealed();
528
+ setTimeout(function () {
529
+ //Hide the loader in the load more button
530
+ $self.find('.sby_loader').addClass('sby_hidden');
531
+ $self.find('.sby_btn_text').removeClass('sby_hidden');
532
+ feed.maybeRaiseImageResolution();
533
+ }, 500);
534
+ },
535
+ beforeNewImagesRevealed: function() {
536
+ this.setImageHeight();
537
+ this.maybeRaiseImageResolution(true);
538
+ this.setImageSizeClass();
539
+ },
540
+ revealNewImages: function() {
541
+ var $self = $(this.el),
542
+ feed = this;
543
+
544
+ // Call Custom JS if it exists
545
+ if (typeof sbyCustomJS == 'function') setTimeout(function(){ sbyCustomJS(); }, 100);
546
+
547
+ $self.find('.sby_item').each(function (index) {
548
+ var $self = jQuery(this);
549
+
550
+ //Photo links
551
+ //If lightbox is disabled
552
+ $self.find('.sby_video_thumbnail').hover(function () {
553
+ jQuery(this).fadeTo(200, 0.85);
554
+ }, function () {
555
+ jQuery(this).stop().fadeTo(500, 1);
556
+ });
557
+
558
+ //init click
559
+ $self.find('.sby_video_thumbnail').off().click(function(event) {
560
+ event.preventDefault();
561
+
562
+ feed.onThumbnailClick($(this), false);
563
+ });
564
+ $self.find('.sby_video_thumbnail').mouseenter(function() {
565
+ feed.onThumbnailEnter($(this), false);
566
+ });
567
+ $self.find('.sby_player_wrap').mouseleave(function() {
568
+ feed.onThumbnailLeave($(this), false);
569
+ });
570
+
571
+ // lightbox
572
+ if (feed.settings.lightboxEnabled) {
573
+ $self.find('.sby_video_thumbnail').attr('data-sby-lightbox',feed.index);
574
+ if (typeof sbyOptions !== 'undefined' && typeof sbyOptions.lightboxPlaceholder !== 'undefined') {
575
+ $self.find('.sby_video_thumbnail').attr('href',sbyOptions.lightboxPlaceholder);
576
+ }
577
+ }
578
+ }); //End .sby_item each
579
+
580
+ //Remove the new class after 500ms, once the sorting is done
581
+ setTimeout(function () {
582
+ $self.find('.sby_item.sby_new').removeClass('sby_new');
583
+ //Loop through items and remove class to reveal them
584
+ var time = 10,
585
+ num = $self.find('.sby_transition').length;
586
+ $self.find('.sby_transition').each(function(index) {
587
+ var $sby_item_transition_el = jQuery(this);
588
+
589
+ setTimeout( function(){
590
+ $sby_item_transition_el.removeClass('sby_transition');
591
+ }, time);
592
+ time += 10;
593
+ });
594
+ }, 500);
595
+ },
596
+ afterNewImagesRevealed: function() {
597
+ this.listenForVisibilityChange();
598
+ this.sendNeedsResizingToServer();
599
+ this.sendCheckWPPostsToServer();
600
+ if (!this.settings.imageLoadEnabled) {
601
+ $('.sby_no_resraise').removeClass('sby_no_resraise');
602
+ }
603
+
604
+ var evt = $.Event('sbyafterimagesloaded');
605
+ evt.el = $(this.el);
606
+ $(window).trigger(evt);
607
+ },
608
+ setResizedImages: function () {
609
+ if ($(this.el).find('.sby_resized_image_data').length
610
+ && typeof $(this.el).find('.sby_resized_image_data').attr('data-resized') !== 'undefined'
611
+ && $(this.el).find('.sby_resized_image_data').attr('data-resized').indexOf('{"') === 0) {
612
+ this.resizedImages = JSON.parse($(this.el).find('.sby_resized_image_data').attr('data-resized'));
613
+ $(this.el).find('.sby_resized_image_data').remove();
614
+ }
615
+ },
616
+ sendNeedsResizingToServer: function() {
617
+ var feed = this;
618
+ if (feed.needsResizing.length > 0 && feed.settings.resizingEnabled) {
619
+ var itemOffset = $(this.el).find('.sby_item').length;
620
+
621
+ var submitData = {
622
+ action: 'sby_resized_images_submit',
623
+ needs_resizing: feed.needsResizing,
624
+ offset: itemOffset,
625
+ feed_id: feed.settings.feedID,
626
+ atts: feed.settings.shortCodeAtts,
627
+ };
628
+ var onSuccess = function(data) {
629
+ if (data.trim().indexOf('{') === 0) {
630
+ var response = JSON.parse(data);
631
+ if (feed.settings.debugEnabled) {
632
+ console.log(response);
633
+ }
634
+ }
635
+ };
636
+ sbyAjax(submitData,onSuccess);
637
+ }
638
+ },
639
+ sendCheckWPPostsToServer: function() {
640
+ var feed = this;
641
+ if (feed.settings.checkWPPosts) {
642
+ var submitData = {
643
+ action: 'sby_check_wp_submit',
644
+ feed_id: feed.settings.feedID,
645
+ atts: feed.settings.shortCodeAtts,
646
+ offset: $(this.el).find('.sby_item').length,
647
+ };
648
+ var onSuccess = function(data) {
649
+ if (data.trim().indexOf('{') === 0) {
650
+ var response = JSON.parse(data);
651
+ if (feed.settings.debugEnabled) {
652
+ console.log(response);
653
+ }
654
+ }
655
+ };
656
+ sbyAjax(submitData,onSuccess);
657
+ }
658
+ },
659
+ loadMoreButtonInit: function () {
660
+ var $self = $(this.el),
661
+ feed = this;
662
+ $self.find('.sby_footer .sby_load_btn').off().on('click', function () {
663
+ feed.afterLoadMoreClicked(jQuery(this));
664
+ feed.getNewPostSet();
665
+ }); //End click event
666
+ },
667
+ getNewPostSet: function () {
668
+ var $self = $(this.el),
669
+ feed = this;
670
+ var itemOffset = $self.find('.sby_item').length,
671
+ submitData = {
672
+ action: 'sby_load_more_clicked',
673
+ offset: itemOffset,
674
+ feed_id: feed.settings.feedID,
675
+ atts: feed.settings.shortCodeAtts,
676
+ current_resolution: feed.imageResolution
677
+ };
678
+ var onSuccess = function (data) {
679
+ if (data.trim().indexOf('{') === 0) {
680
+ var response = JSON.parse(data);
681
+ if (feed.settings.debugEnabled) {
682
+ console.log(response);
683
+ }
684
+ feed.appendNewPosts(response.html);
685
+ feed.addResizedImages(response.resizedImages);
686
+ if (feed.settings.ajaxPostLoad) {
687
+ feed.settings.ajaxPostLoad = false;
688
+ feed.afterInitialImagesLoaded();
689
+ } else {
690
+ feed.afterNewImagesLoaded();
691
+ }
692
+
693
+ if (!response.feedStatus.shouldPaginate) {
694
+ feed.outOfPages = true;
695
+ $self.find('.sby_load_btn').hide();
696
+ } else {
697
+ feed.outOfPages = false;
698
+ }
699
+ $('.sby_no_js').removeClass('sby_no_js');
700
+ }
701
+
702
+ };
703
+ sbyAjax(submitData, onSuccess);
704
+ },
705
+ appendNewPosts: function (newPostsHtml) {
706
+ var $self = $(this.el),
707
+ feed = this;
708
+ if ($self.find('.sby_items_wrap .sby_item').length) {
709
+ $self.find('.sby_items_wrap .sby_item').last().after(newPostsHtml);
710
+ } else {
711
+ $self.find('.sby_items_wrap').append(newPostsHtml);
712
+ }
713
+ },
714
+ addResizedImages: function (resizedImagesToAdd) {
715
+ for (var imageID in resizedImagesToAdd) {
716
+ this.resizedImages[imageID] = resizedImagesToAdd[imageID];
717
+ }
718
+ },
719
+ setImageHeight: function() {
720
+ },
721
+ maybeRaiseSingleImageResolution: function ($item, index, forceChange) {
722
+ var feed = this,
723
+ imgSrcSet = feed.getImageUrls($item),
724
+ currentUrl = $item.find('.sby_video_thumbnail img').attr('src'),
725
+ currentRes = 150,
726
+ aspectRatio = 1, // all thumbnails are oriented the same so the best calculation uses 1
727
+ forceChange = typeof forceChange !== 'undefined' ? forceChange : false;
728
+
729
+ if ($item.hasClass('sby_no_resraise')) {
730
+ return;
731
+ }
732
+
733
+ $.each(imgSrcSet, function (index, value) {
734
+ if (value === currentUrl) {
735
+ currentRes = parseInt(index);
736
+ // If the image has already been changed to an existing real source, don't force the change
737
+ forceChange = false;
738
+ }
739
+ });
740
+ //Image res
741
+ var newRes = 640;
742
+ switch (feed.settings.imgRes) {
743
+ case 'thumb':
744
+ newRes = 120;
745
+ break;
746
+ case 'medium':
747
+ newRes = 320;
748
+ break;
749
+ case 'large':
750
+ newRes = 480;
751
+ break;
752
+ case 'full':
753
+ newRes = 640;
754
+ break;
755
+ default:
756
+ var minImageWidth = Math.max(feed.settings.autoMinRes,$item.find('.sby_video_thumbnail').innerWidth()),
757
+ thisImageReplace = feed.getBestResolutionForAuto(minImageWidth, aspectRatio, $(this.el).find('sby_item').first());
758
+ switch (thisImageReplace) {
759
+ case 480:
760
+ newRes = 480;
761
+ break;
762
+ case 320:
763
+ newRes = 320;
764
+ break;
765
+ case 120:
766
+ newRes = 120;
767
+ break;
768
+ }
769
+ break;
770
+ }
771
+
772
+ if (newRes > currentRes || currentUrl === window.sby.options.placeholder || forceChange) {
773
+ if (feed.settings.debugEnabled) {
774
+ var reason = currentUrl === window.sby.options.placeholder ? 'was placeholder' : 'too small';
775
+ console.log('rais res for ' + currentUrl, reason);
776
+ }
777
+ var newUrl = imgSrcSet[newRes];
778
+ $item.find('.sby_video_thumbnail img').attr('src', newUrl);
779
+ }
780
+
781
+ $item.find('img').on('error', function () {
782
+ if (!$(this).hasClass('sby_img_error')) {
783
+ $(this).addClass('sby_img_error');
784
+ var sourceFromAPI = ($(this).attr('src').indexOf('i.ytimg.com') > -1);
785
+
786
+ if (!sourceFromAPI) {
787
+ if (typeof $(this).closest('.sby_video_thumbnail').attr('data-full-res') !== 'undefined') {
788
+ //$(this).attr('src', $(this).closest('.sby_video_thumbnail').attr('data-full-res'));
789
+ //$(this).closest('.sby_video_thumbnail').css('background-image', 'url(' + $(this).closest('.sby_video_thumbnail').attr('data-full-res') + ')');
790
+ } else if ($(this).closest('.sby_video_thumbnail').attr('href') !== 'undefined') {
791
+ //$(this).attr('src', $(this).closest('.sby_video_thumbnail').attr('href') + 'media?size=l');
792
+ //$(this).closest('.sby_video_thumbnail').css('background-image', 'url(' + $(this).closest('.sby_video_thumbnail').attr('href') + 'media?size=l)');
793
+ }
794
+ } else {
795
+ feed.settings.favorLocal = true;
796
+ var srcSet = feed.getImageUrls($(this).closest('.sby_item'));
797
+ if (typeof srcSet[640] !== 'undefined') {
798
+ //$(this).attr('src', srcSet[640]);
799
+ //$(this).closest('.sby_video_thumbnail').css('background-image', 'url(' + srcSet[640] + ')');
800
+ }
801
+ }
802
+ setTimeout(function() {
803
+ feed.afterResize();
804
+ }, 1500)
805
+ } else {
806
+ console.log('unfixed error ' + $(this).attr('src'));
807
+ }
808
+ });
809
+ },
810
+ maybeRaiseImageResolution: function (justNew) {
811
+ var feed = this,
812
+ itemsSelector = typeof justNew !== 'undefined' && justNew === true ? '.sby_item.sby_new' : '.sby_item',
813
+ forceChange = !feed.isInitialized ? true : false;
814
+ $(feed.el).find(itemsSelector).each(function (index) {
815
+ if (!$(this).hasClass('sby_num_diff_hide')
816
+ && $(this).find('.sby_video_thumbnail').length
817
+ && typeof $(this).find('.sby_video_thumbnail').attr('data-img-src-set') !== 'undefined') {
818
+ feed.maybeRaiseSingleImageResolution($(this),index,forceChange);
819
+ }
820
+ }); //End .sby_item each
821
+ feed.isInitialized = true;
822
+ },
823
+ getBestResolutionForAuto: function(colWidth, aspectRatio, $item) {
824
+ if (isNaN(aspectRatio) || aspectRatio < 1) {
825
+ aspectRatio = 1;
826
+ }
827
+ var bestWidth = colWidth * aspectRatio,
828
+ bestWidthRounded = Math.ceil(bestWidth / 10) * 10,
829
+ customSizes = [120, 320, 480, 640];
830
+
831
+ if ($item.hasClass('sby_highlighted')) {
832
+ bestWidthRounded = bestWidthRounded *2;
833
+ }
834
+
835
+ if (customSizes.indexOf(parseInt(bestWidthRounded)) === -1) {
836
+ var done = false;
837
+ $.each(customSizes, function (index, item) {
838
+ if (item > parseInt(bestWidthRounded) && !done) {
839
+ bestWidthRounded = item;
840
+ done = true;
841
+ }
842
+ });
843
+ }
844
+
845
+ return bestWidthRounded;
846
+ },
847
+ hideExtraItemsForWidth: function() {
848
+ if (this.layout === 'carousel') {
849
+ return;
850
+ }
851
+ var $self = $(this.el),
852
+ num = typeof $self.attr('data-num') !== 'undefined' && $self.attr('data-num') !== '' ? parseInt($self.attr('data-num')) : 1,
853
+ nummobile = typeof $self.attr('data-nummobile') !== 'undefined' && $self.attr('data-nummobile') !== '' ? parseInt($self.attr('data-nummobile')) : num;
854
+
855
+ if ($(window).width() < 480) {
856
+ if (nummobile < $self.find('.sby_item').length) {
857
+ $self.find('.sby_item').slice(nummobile - $self.find('.sby_item').length).addClass('sby_num_diff_hide');
858
+ }
859
+ } else {
860
+ if (num < $self.find('.sby_item').length) {
861
+ $self.find('.sby_item').slice(num - $self.find('.sby_item').length).addClass('sby_num_diff_hide');
862
+ }
863
+ }
864
+ },
865
+ setImageSizeClass: function () {
866
+ var $self = $(this.el);
867
+ $self.removeClass('sby_small sby_medium');
868
+ var feedWidth = $self.innerWidth(),
869
+ photoPadding = parseInt(($self.find('.sby_items_wrap').outerWidth() - $self.find('.sby_items_wrap').width())) / 2,
870
+ cols = this.getColumnCount(),
871
+ feedWidthSansPadding = feedWidth - (photoPadding * (cols+2)),
872
+ colWidth = (feedWidthSansPadding / cols);
873
+ if (colWidth > 120 && colWidth < 240) {
874
+ $self.addClass('sby_medium');
875
+ } else if (colWidth <= 120) {
876
+ $self.addClass('sby_small');
877
+ }
878
+ },
879
+ setMinImageWidth: function () {
880
+ if ($(this.el).find('.sby_item .sby_video_thumbnail').first().length) {
881
+ this.minImageWidth = $(this.el).find('.sby_item .sby_video_thumbnail').first().innerWidth();
882
+ } else {
883
+ this.minImageWidth = 150;
884
+ }
885
+ },
886
+ setImageResolution: function () {
887
+ if (this.settings.imgRes === 'auto') {
888
+ this.imageResolution = 'auto';
889
+ } else {
890
+ switch (this.settings.imgRes) {
891
+ case 'thumb':
892
+ this.imageResolution = 150;
893
+ break;
894
+ case 'medium':
895
+ this.imageResolution = 320;
896
+ break;
897
+ default:
898
+ this.imageResolution = 640;
899
+ }
900
+ }
901
+ },
902
+ getImageUrls: function ($item) {
903
+ var srcSet = JSON.parse($item.find('.sby_video_thumbnail').attr('data-img-src-set').replace(/\\\//g, '/')),
904
+ id = $item.attr('id').replace('sby_', '').replace('player_','');
905
+ if (typeof this.resizedImages[id] !== 'undefined'
906
+ && this.resizedImages[id] !== 'video'
907
+ && this.resizedImages[id] !== 'pending'
908
+ && this.resizedImages[id].id !== 'error'
909
+ && this.resizedImages[id].id !== 'video'
910
+ && this.resizedImages[id].id !== 'pending') {
911
+
912
+ if (typeof this.resizedImages[id]['sizes'] !== 'undefined') {
913
+ var foundSizes = [];
914
+ if (typeof this.resizedImages[id]['sizes']['full'] !== 'undefined') {
915
+ foundSizes.push(640);
916
+ srcSet[640] = sbyOptions.resized_url + this.resizedImages[id].id + 'full.jpg';
917
+ $item.find('.sby_link_area').attr( 'href', sbyOptions.resized_url + this.resizedImages[id].id + 'full.jpg' );
918
+ $item.find('.sby_video_thumbnail').attr( 'data-full-res', sbyOptions.resized_url + this.resizedImages[id].id + 'full.jpg' );
919
+ }
920
+ if (typeof this.resizedImages[id]['sizes']['low'] !== 'undefined') {
921
+ foundSizes.push(320);
922
+ srcSet[320] = sbyOptions.resized_url + this.resizedImages[id].id + 'low.jpg';
923
+ if (this.settings.favorLocal && typeof this.resizedImages[id]['sizes']['full'] === 'undefined') {
924
+ $item.find('.sby_link_area').attr( 'href', sbyOptions.resized_url + this.resizedImages[id].id + 'low.jpg' );
925
+ $item.find('.sby_video_thumbnail').attr( 'data-full-res', sbyOptions.resized_url + this.resizedImages[id].id + 'low.jpg' );
926
+ }
927
+ }
928
+ if (typeof this.resizedImages[id]['sizes']['thumb'] !== 'undefined') {
929
+ foundSizes.push(150);
930
+ srcSet[150] = sbyOptions.resized_url + this.resizedImages[id].id + 'thumb.jpg';
931
+ }
932
+ if (this.settings.favorLocal) {
933
+ if (foundSizes.indexOf(640) === -1) {
934
+ if (foundSizes.indexOf(320) > -1) {
935
+ srcSet[640] = sbyOptions.resized_url + this.resizedImages[id].id + 'low.jpg';
936
+ }
937
+ }
938
+ if (foundSizes.indexOf(320) === -1) {
939
+ if (foundSizes.indexOf(640) > -1) {
940
+ srcSet[320] = sbyOptions.resized_url + this.resizedImages[id].id + 'full.jpg';
941
+ } else if (foundSizes.indexOf(150) > -1) {
942
+ srcSet[320] = sbyOptions.resized_url + this.resizedImages[id].id + 'thumb.jpg';
943
+ }
944
+ }
945
+ if (foundSizes.indexOf(150) === -1) {
946
+ if (foundSizes.indexOf(320) > -1) {
947
+ srcSet[150] = sbyOptions.resized_url + this.resizedImages[id].id + 'low.jpg';
948
+ } else if (foundSizes.indexOf(640) > -1) {
949
+ srcSet[150] = sbyOptions.resized_url + this.resizedImages[id].id + 'full.jpg';
950
+ }
951
+ }
952
+ }
953
+ }
954
+ } else if (typeof this.resizedImages[id] === 'undefined'
955
+ || (typeof this.resizedImages[id]['id'] !== 'undefined' && this.resizedImages[id]['id'] !== 'pending' && this.resizedImages[id]['id'] !== 'error')) {
956
+ this.addToNeedsResizing(id);
957
+ }
958
+
959
+ return srcSet;
960
+ },
961
+ getVideoID: function ($el) {
962
+ if ($el.hasClass('sby_item') || $el.hasClass('sby_player_item')) {
963
+ if (typeof $el.find('.sby_video_thumbnail').attr('data-video-id') !== 'undefined') {
964
+ return $el.find('.sby_video_thumbnail').attr('data-video-id');
965
+ }
966
+ } else if ($el.closest('sby_item').length || $el.closest('sby_player_item').length) {
967
+ var $targeEl = $el.closest('sby_item').length ? $el.closest('sby_item') : $el.closest('sby_player_item');
968
+ if (typeof $targeEl.find('.sby_video_thumbnail').attr('data-video-id') !== 'undefined') {
969
+ return $targeEl.find('.sby_video_thumbnail').attr('data-video-id');
970
+ }
971
+ } else if ($el.hasClass('sb_youtube')) {
972
+ return $el.find('.sby_item').first().find('.sby_video_thumbnail').attr('data-video-id');
973
+ }
974
+ console.log('no id');
975
+ return '';
976
+ },
977
+ getAvatarUrl: function (username,favorType) {
978
+ if (username === '') {
979
+ return '';
980
+ }
981
+
982
+ var availableAvatars = this.settings.general.avatars,
983
+ favorType = typeof favorType !== 'undefined' ? favorType : 'local';
984
+
985
+ if (favorType === 'local') {
986
+ if (typeof availableAvatars['LCL'+username] !== 'undefined' && parseInt(availableAvatars['LCL'+username]) === 1) {
987
+ return sbyOptions.resized_url + username + '.jpg';
988
+ } else if (typeof availableAvatars[username] !== 'undefined') {
989
+ return availableAvatars[username];
990
+ } else {
991
+ return '';
992
+ }
993
+ } else {
994
+ if (typeof availableAvatars[username] !== 'undefined') {
995
+ return availableAvatars[username];
996
+ } else if (typeof availableAvatars['LCL'+username] !== 'undefined' && parseInt(availableAvatars['LCL'+username]) === 1) {
997
+ return sbyOptions.resized_url + username + '.jpg';
998
+ } else {
999
+ return '';
1000
+ }
1001
+ }
1002
+ },
1003
+ addToNeedsResizing: function (id) {
1004
+ if (this.needsResizing.indexOf(id) === -1) {
1005
+ this.needsResizing.push(id);
1006
+ }
1007
+ },
1008
+ listenForVisibilityChange: function() {
1009
+ var feed = this;
1010
+ sbyAddVisibilityListener();
1011
+ if (typeof $(this.el).filter(':hidden').sbyVisibilityChanged == 'function') {
1012
+ //If the feed is initially hidden (in a tab for example) then check for when it becomes visible and set then set the height
1013
+ $(this.el).filter(':hidden').sbyVisibilityChanged({
1014
+ callback: function (element, visible) {
1015
+ feed.afterResize();
1016
+ },
1017
+ runOnLoad: false
1018
+ });
1019
+ }
1020
+ },
1021
+ getColumnCount: function() {
1022
+ var $self = $(this.el),
1023
+ cols = this.settings.cols,
1024
+ colsmobile = this.settings.colsmobile,
1025
+ returnCols = cols;
1026
+
1027
+ sbyWindowWidth = window.innerWidth;
1028
+
1029
+ if ($self.hasClass('sby_mob_col_auto')) {
1030
+ if (sbyWindowWidth < 640 && (parseInt(cols) > 2 && parseInt(cols) < 7)) returnCols = 2;
1031
+ if (sbyWindowWidth < 640 && (parseInt(cols) > 6 && parseInt(cols) < 11)) returnCols = 4;
1032
+ if (sbyWindowWidth <= 480 && parseInt(cols) > 2) returnCols = 1;
1033
+ } else if (sbyWindowWidth <= 480) {
1034
+ returnCols = colsmobile;
1035
+ }
1036
+
1037
+ return parseInt(returnCols);
1038
+ },
1039
+ onThumbnailClick: function($clicked,isPlayer) {
1040
+ if (!this.canCreatePlayer()) {
1041
+ return;
1042
+ }
1043
+ var $self = $(this.el);
1044
+ if ($self.hasClass('sby_layout_gallery')) {
1045
+
1046
+ $self.addClass('sby_player_added').find('.sby_player_outer_wrap').addClass('sby_player_loading');
1047
+ $self.find('.sby_player_outer_wrap .sby_video_thumbnail').find('.sby_loader').show().removeClass('sby_hidden');
1048
+ if (!$self.find('.sby_player_outer_wrap iframe').length) {
1049
+ if (isPlayer) {
1050
+ this.createPlayer('sby_player'+this.index);
1051
+ } else {
1052
+ this.createPlayer('sby_player'+this.index,this.getVideoID($clicked.closest('.sby_item')));
1053
+ }
1054
+ } else {
1055
+ if (isPlayer) {
1056
+ this.playVideoInPlayer(this.getVideoID($self.find('.sby_item').first()));
1057
+ } else {
1058
+ this.playVideoInPlayer(this.getVideoID($clicked.closest('.sby_item')));
1059
+ this.afterVideoChanged();
1060
+ }
1061
+ }
1062
+
1063
+ } else if ($(this.el).hasClass('sby_layout_grid')) {
1064
+ var $sbyItem = $clicked.closest('.sby_item'),
1065
+ videoID = this.getVideoID($sbyItem);
1066
+ this.playVideoInPlayer(videoID);
1067
+ this.afterVideoChanged();
1068
+ } else if ($(this.el).hasClass('sby_layout_list')) {
1069
+ var $sbyItem = $clicked.closest('.sby_item'),
1070
+ videoID = this.getVideoID($sbyItem);
1071
+ if (!$sbyItem.find('iframe').length) {
1072
+ $sbyItem.find('.sby_loader').show().removeClass('sby_hidden');
1073
+ $sbyItem.addClass('sby_player_loading sby_player_loaded');
1074
+ this.createPlayer('sby_player_'+videoID,videoID);
1075
+ }
1076
+ }
1077
+ },
1078
+ onThumbnailEnter: function($hovered) {
1079
+ if (!this.canCreatePlayer()) {
1080
+ return;
1081
+ }
1082
+ var $self = $(this.el);
1083
+ if ($self.hasClass('sby_layout_list')) {
1084
+ var $sbyItem = $hovered.closest('.sby_item'),
1085
+ videoID = this.getVideoID($sbyItem);
1086
+ if (!$sbyItem.find('iframe').length) {
1087
+ $sbyItem.find('.sby_loader').show().removeClass('sby_hidden');
1088
+ $sbyItem.addClass('sby_player_loading sby_player_loaded');
1089
+ this.createPlayer('sby_player_'+videoID,videoID,0);
1090
+ }
1091
+ }
1092
+ },
1093
+ onThumbnailLeave: function($hovered) {
1094
+ },
1095
+ canCreatePlayer: function() {
1096
+ return (this.playerAPIReady && this.consentGiven);
1097
+ },
1098
+ playVideoInPlayer: function(videoID) {
1099
+ if (typeof this.player !== 'undefined' && typeof this.player.loadVideoById !== 'undefined') {
1100
+ this.player.loadVideoById(videoID);
1101
+ }
1102
+ },
1103
+ afterVideoChanged: function() {
1104
+ if ($(this.el).hasClass('sby_layout_gallery')) {
1105
+ $(this.el).find('.sby_player_outer_wrap').removeClass('sby_player_loading');
1106
+ $(this.el).find('.sby_player_outer_wrap .sby_video_thumbnail').find('.sby_loader').hide().addClass('sby_hidden');
1107
+
1108
+ if ($(window).width() < 480) {
1109
+ $('html, body').animate({
1110
+ scrollTop: $(this.el).find('.sby_player_outer_wrap').offset().top
1111
+ }, 300);
1112
+ }
1113
+
1114
+ }
1115
+ }
1116
+ };
1117
+
1118
+ window.sby_init = function() {
1119
+ window.sby = new Sby();
1120
+ window.sby.createPage( window.sby.createFeeds, {whenFeedsCreated: window.sby.afterFeedsCreated});
1121
+ };
1122
+
1123
+ function sbyGetNewFeed(feed,index,feedOptions) {
1124
+ return new SbyFeed(feed,index,feedOptions);
1125
+ }
1126
+
1127
+ function sbyAjax(submitData,onSuccess) {
1128
+ $.ajax({
1129
+ url: sbyOptions.adminAjaxUrl,
1130
+ type: 'post',
1131
+ data: submitData,
1132
+ success: onSuccess
1133
+ });
1134
+ }
1135
+
1136
+ function sbyIsTouch() {
1137
+ if ("ontouchstart" in document.documentElement) {
1138
+ return true;
1139
+ }
1140
+ return false;
1141
+ }
1142
+
1143
+ })(jQuery);
1144
+
1145
+ jQuery(document).ready(function($) {
1146
+ sby_init();
1147
+ });
1148
+
1149
+ } // if sby_js_exists
1150
+
1151
+ window.onYouTubeIframeAPIReady = function() {
1152
+ var numFeeds = document.getElementsByClassName('sb_youtube').length;
1153
+ if (numFeeds > 0) {
1154
+ for (var i = 0; i < numFeeds; i++) {
1155
+ window.sby.feeds[i].playerAPIReady = true;
1156
+ }
1157
+ }
1158
+ };
js/sb-youtube.min.js ADDED
@@ -0,0 +1 @@
 
1
+ var sby_js_exists=void 0!==sby_js_exists;if(!sby_js_exists){function sby_supports_video(){return!!document.createElement("video").canPlayType}!function(e){function i(){this.feeds={},this.options=sbyOptions,this.isTouch=function(){if("ontouchstart"in document.documentElement)return!0;return!1}()}function t(e,i,t){this.el=e,this.index=i,this.settings=t,this.playerAPIReady=!1,this.consentGiven=!0,this.players={},this.minImageWidth=0,this.imageResolution=150,this.resizedImages={},this.needsResizing=[],this.outOfPages=!1,this.isInitialized=!1}function s(i,t){e.ajax({url:sbyOptions.adminAjaxUrl,type:"post",data:i,success:t})}i.prototype={createPage:function(i,t){void 0!==window.sbyajaxurl&&-1!==window.sbyajaxurl.indexOf(window.location.hostname)||(window.sbyajaxurl=window.location.hostname+"/wp-admin/admin-ajax.php"),e(".sby_no_js_error_message").remove(),e(".sby_no_js").removeClass("sby_no_js");if(null===document.getElementById("youtube-api")){var s=document.createElement("script"),a=document.getElementsByTagName("script")[0];s.src="http://www.youtube.com/iframe_api",s.id="youtube-api",a.parentNode.insertBefore(s,a)}i(t)},createLightbox:function(){(function(){var i=jQuery,t=function(){function e(){this.fadeDuration=500,this.fitImagesInViewport=!0,this.resizeDuration=700,this.positionFromTop=50,this.showImageNumberLabel=!0,this.alwaysShowNavOnTouchDevices=!1,this.wrapAround=!1}return e.prototype.albumLabel=function(e,i){return e+" / "+i},e}(),s=function(){function t(e){this.options=e,this.album=[],this.currentImageIndex=void 0,this.init()}return t.prototype.init=function(){this.enable(),this.build()},t.prototype.enable=function(){var e=this;i("body").on("click","a[data-sby-lightbox]",function(t){return e.start(i(t.currentTarget)),!1})},t.prototype.build=function(){var e=this;i("<div id='sby_lightboxOverlay' class='sby_lightboxOverlay'></div><div id='sby_lightbox' class='sby_lightbox'><div class='sby_lb-outerContainer'><div class='sby_lb-container'><img class='sby_lb-image' alt='Lightbox image placeholder' src='' /><div class='sby_lb-player' id='sby_lb-player'></div><div class='sby_lb-nav'><a class='sby_lb-prev' href='#' ><p class='sby-screenreader'>Previous Slide</p></a><a class='sby_lb-next' href='#' ><p class='sby-screenreader'>Next Slide</p></a></div><div class='sby_lb-loader'><a class='sby_lb-cancel'></a></div></div></div><div class='sby_lb-dataContainer'><div class='sby_lb-data'><div class='sby_lb-details'><div class='sby_lb-caption'></div><div class='sby_lb-info'><div class='sby_lb-number'></div><div class='sby_lb-closeContainer'><a class='sby_lb-close'></a></div></div></div></div>").appendTo(i("body")),this.$lightbox=i("#sby_lightbox"),this.$overlay=i("#sby_lightboxOverlay"),this.$outerContainer=this.$lightbox.find(".sby_lb-outerContainer"),this.$container=this.$lightbox.find(".sby_lb-container"),this.containerTopPadding=parseInt(this.$container.css("padding-top"),10),this.containerRightPadding=parseInt(this.$container.css("padding-right"),10),this.containerBottomPadding=parseInt(this.$container.css("padding-bottom"),10),this.containerLeftPadding=parseInt(this.$container.css("padding-left"),10),this.$overlay.hide().on("click",function(){return e.end(),!1}),jQuery(document).on("click",function(e,i,t){jQuery(e.target).closest(".sby_lb-outerContainer").length||jQuery(e.target).closest(".sby_lb-dataContainer").length||(void 0!==window.sbyLightboxPlayer&&window.sbyLightboxPlayer.pauseVideo(),jQuery("#sby_lightboxOverlay, #sby_lightbox").fadeOut())}),this.$lightbox.hide(),jQuery("#sby_lightboxOverlay").on("click",function(t){return void 0!==window.sbyLightboxPlayer&&window.sbyLightboxPlayer.pauseVideo(),"sby_lightbox"===i(t.target).attr("id")&&e.end(),!1}),this.$lightbox.find(".sby_lb-prev").on("click",function(){return void 0!==window.sbyLightboxPlayer&&window.sbyLightboxPlayer.pauseVideo(),e.changeImage(0===e.currentImageIndex?e.album.length-1:e.currentImageIndex-1),!1}),this.$lightbox.find(".sby_lb-container").on("swiperight",function(){return void 0!==window.sbyLightboxPlayer&&window.sbyLightboxPlayer.pauseVideo(),e.changeImage(0===e.currentImageIndex?e.album.length-1:e.currentImageIndex-1),!1}),this.$lightbox.find(".sby_lb-next").on("click",function(){return void 0!==window.sbyLightboxPlayer&&window.sbyLightboxPlayer.pauseVideo(),e.changeImage(e.currentImageIndex===e.album.length-1?0:e.currentImageIndex+1),!1}),this.$lightbox.find(".sby_lb-container").on("swipeleft",function(){return void 0!==window.sbyLightboxPlayer&&window.sbyLightboxPlayer.pauseVideo(),e.changeImage(e.currentImageIndex===e.album.length-1?0:e.currentImageIndex+1),!1}),this.$lightbox.find(".sby_lb-loader, .sby_lb-close").on("click",function(){return void 0!==window.sbyLightboxPlayer&&window.sbyLightboxPlayer.pauseVideo(),e.end(),!1})},t.prototype.start=function(e){function t(e){s.album.push({link:e.attr("href"),video:e.attr("data-video-id")})}var s=this,a=i(window);a.on("resize",i.proxy(this.sizeOverlay,this)),i("select, object, embed").css({visibility:"hidden"}),this.sizeOverlay(),this.album=[];var n,o=0,d=e.attr("data-sby-lightbox");if(d){n=i(e.prop("tagName")+'[data-sby-lightbox="'+d+'"]');for(var r=0;r<n.length;r=++r)t(i(n[r])),n[r]===e[0]&&(o=r)}else if("lightbox"===e.attr("rel"))t(e);else{n=i(e.prop("tagName")+'[rel="'+e.attr("rel")+'"]');for(var l=0;l<n.length;l=++l)t(i(n[l])),n[l]===e[0]&&(o=l)}var h=a.scrollTop()+this.options.positionFromTop,b=a.scrollLeft();this.$lightbox.css({top:h+"px",left:b+"px"}).fadeIn(this.options.fadeDuration),this.changeImage(o)},t.prototype.changeImage=function(e){var t=this;this.disableKeyboardNav();var s=this.$lightbox.find(".sby_lb-image");this.$overlay.fadeIn(this.options.fadeDuration),i(".sby_lb-loader").fadeIn("slow"),this.$lightbox.find(".sby_lb-image, .sby_lb-nav, .sby_lb-prev, .sby_lb-next, .sby_lb-dataContainer, .sby_lb-numbers, .sby_lb-caption").hide(),this.$outerContainer.addClass("animating");var a=new Image;a.onload=function(){var n,o,d,r,l,h;s.attr("src",t.album[e].link),i(a),s.width(a.width),s.height(a.height),t.options.fitImagesInViewport&&(h=i(window).width(),l=i(window).height(),r=h-t.containerLeftPadding-t.containerRightPadding-20,d=l-t.containerTopPadding-t.containerBottomPadding-150,(a.width>r||a.height>d)&&(a.width/r>a.height/d?(o=r,n=parseInt(a.height/(a.width/o),10),s.width(o),s.height(n)):(n=d,o=parseInt(a.width/(a.height/n),10),s.width(o),s.height(n)))),t.sizeContainer(s.width(),s.height())},a.src=this.album[e].link,this.currentImageIndex=e},t.prototype.sizeOverlay=function(){this.$overlay.width(i(window).width()).height(i(document).height())},t.prototype.sizeContainer=function(e,i){function t(){s.$lightbox.find(".sby_lb-dataContainer").width(o),s.$lightbox.find(".sby_lb-prevLink").height(d),s.$lightbox.find(".sby_lb-nextLink").height(d),s.showImage()}var s=this,a=this.$outerContainer.outerWidth(),n=this.$outerContainer.outerHeight(),o=e+this.containerLeftPadding+this.containerRightPadding,d=i+this.containerTopPadding+this.containerBottomPadding;a!==o||n!==d?this.$outerContainer.animate({width:o,height:d},this.options.resizeDuration,"swing",function(){t()}):t()},t.prototype.showImage=function(){this.$lightbox.find(".sby_lb-loader").hide(),this.$lightbox.find(".sby_lb-image").fadeIn("slow"),this.updateNav(),this.updateDetails(),this.preloadNeighboringImages(),this.enableKeyboardNav()},t.prototype.updateNav=function(){var e=!1;try{document.createEvent("TouchEvent"),e=!!this.options.alwaysShowNavOnTouchDevices}catch(e){}this.$lightbox.find(".sby_lb-nav").show(),this.album.length>1&&(this.options.wrapAround?(e&&this.$lightbox.find(".sby_lb-prev, .sby_lb-next").css("opacity","1"),this.$lightbox.find(".sby_lb-prev, .sby_lb-next").show()):(this.currentImageIndex>0&&(this.$lightbox.find(".sby_lb-prev").show(),e&&this.$lightbox.find(".sby_lb-prev").css("opacity","1")),this.currentImageIndex<this.album.length-1&&(this.$lightbox.find(".sby_lb-next").show(),e&&this.$lightbox.find(".sby_lb-next").css("opacity","1"))))},t.prototype.updateDetails=function(){if(sby_supports_video()&&(jQuery("#sby_lightbox").removeClass("sby_video_lightbox"),this.album[this.currentImageIndex].video.length)){jQuery("#sby_lightbox").addClass("sby_video_lightbox");var e=this.album[this.currentImageIndex].video,i=sbyOptions.autoplay;if(void 0===window.sbyLightboxPlayer){var t={host:window.location.protocol+"//www.youtube-nocookie.com",videoId:e,playerVars:{modestbranding:1,rel:0,autoplay:i}};window.sbyLightboxPlayer=new window.YT.Player("sby_lb-player",t)}else window.sbyLightboxPlayer.loadVideoById(e)}},t.prototype.preloadNeighboringImages=function(){this.album.length>this.currentImageIndex+1&&((new Image).src=this.album[this.currentImageIndex+1].link);this.currentImageIndex>0&&((new Image).src=this.album[this.currentImageIndex-1].link)},t.prototype.enableKeyboardNav=function(){i(document).on("keyup.keyboard",i.proxy(this.keyboardAction,this))},t.prototype.disableKeyboardNav=function(){i(document).off(".keyboard")},t.prototype.keyboardAction=function(i){var t=event.keyCode,s=String.fromCharCode(t).toLowerCase();27===t||s.match(/x|o|c/)?(sby_supports_video()&&e("#sby_lightbox video.sby_video")[0].pause(),e("#sby_lightbox iframe").attr("src",""),this.end()):"p"===s||37===t?(0!==this.currentImageIndex?this.changeImage(this.currentImageIndex-1):this.options.wrapAround&&this.album.length>1&&this.changeImage(this.album.length-1),sby_supports_video()&&e("#sby_lightbox video.sby_video")[0].pause(),e("#sby_lightbox iframe").attr("src","")):"n"!==s&&39!==t||(this.currentImageIndex!==this.album.length-1?this.changeImage(this.currentImageIndex+1):this.options.wrapAround&&this.album.length>1&&this.changeImage(0),void 0!==window.sbyLightboxPlayer&&window.sbyLightboxPlayer.pauseVideo())},t.prototype.end=function(){this.disableKeyboardNav(),i(window).off("resize",this.sizeOverlay),this.$lightbox.fadeOut(this.options.fadeDuration),this.$overlay.fadeOut(this.options.fadeDuration),i("select, object, embed").css({visibility:"visible"})},t}();i(function(){var i=new t;new s(i),e(".sby_lightbox_action a").unbind().bind("click",function(){e(this).parent().find(".sby_lightbox_tooltip").toggle()})})}).call(this)},createFeeds:function(i){window.sby.createLightbox(),i.whenFeedsCreated(e(".sb_youtube").each(function(i){e(this).attr("data-sby-index",i+1),e(this).find(".sby_player").replaceWith('<div id="sby_player'+i+'"></div>');var a=e(this),n=void 0!==a.attr("data-sby-flags")?a.attr("data-sby-flags").split(","):[],o=void 0!==a.attr("data-options")?JSON.parse(a.attr("data-options")):{};if(n.indexOf("testAjax")>-1){window.sby.triggeredTest=!0;s({action:"sby_on_ajax_test_trigger"},function(e){console.log("did test")})}var d={cols:a.attr("data-cols"),colsmobile:"same"!==a.attr("data-colsmobile")?a.attr("data-colsmobile"):a.attr("data-cols"),num:a.attr("data-num"),imgRes:a.attr("data-res"),feedID:a.attr("data-feedid"),shortCodeAtts:a.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,checkWPPosts:n.indexOf("checkWPPosts")>-1,lightboxEnabled:void 0!==a.attr("data-sby-supports-lightbox"),autoMinRes:1,general:o};window.sby.feeds[i]=function(e,i,s){return new t(e,i,s)}(this,i,d),window.sby.feeds[i].setResizedImages(),window.sby.feeds[i].init();var r=jQuery.Event("sbyafterfeedcreate");r.feed=window.sby.feeds[i],jQuery(window).trigger(r)}))},afterFeedsCreated:function(){e(".sb_instagram_header").each(function(){var i=e(this);i.find(".sby_header_link").hover(function(){i.find(".sby_header_img_hover").addClass("sby_fade_in")},function(){i.find(".sby_header_img_hover").removeClass("sby_fade_in")})})},encodeHTML:function(e){return void 0===e?"":e.replace(/(>)/g,"&gt;").replace(/(<)/g,"&lt;").replace(/(&lt;br\/&gt;)/g,"<br>").replace(/(&lt;br&gt;)/g,"<br>")},urlDetect:function(e){return e.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;this.settings.ajaxPostLoad?this.getNewPostSet():this.afterInitialImagesLoaded();var i,t=(i=0,function(e,t){clearTimeout(i),i=setTimeout(e,t)});jQuery(window).resize(function(){t(function(){e.afterResize()},500)})},initLayout:function(){var i=e(this.el),t=this;i.hasClass("sby_layout_gallery")&&i.find(".sby_player_outer_wrap").length&&(this.maybeRaiseSingleImageResolution(i.find(".sby_player_outer_wrap"),0,!0),i.find(".sby_player_outer_wrap .sby_video_thumbnail").off().click(function(i){i.preventDefault(),t.onThumbnailClick(e(this),!0)}),i.mouseenter(function(){t.canCreatePlayer()&&(i.find(".sby_player_outer_wrap iframe").length||(i.addClass("sby_player_added").find(".sby_player_outer_wrap").addClass("sby_player_loading"),i.find(".sby_player_outer_wrap .sby_video_thumbnail").find(".sby_loader").show().removeClass("sby_hidden"),t.createPlayer("sby_player"+t.index)))}))},createPlayer:function(i,t,s,a){var n=e(this.el),o=this;t=void 0!==t?t:this.getVideoID(n.find(".sby_item").first()),s=void 0!==s?s:0,void 0===a&&(a={host:window.location.protocol+"//www.youtube-nocookie.com",videoId:t,playerVars:{modestbranding:1,rel:0,autoplay:s}}),void 0===a.events&&(a.events={onReady:function(){n.find(".sby_player_outer_wrap").removeClass("sby_player_loading").find(".sby_video_thumbnail").css("z-index",-1).find(".sby_loader").hide().addClass("sby_hidden"),e("#"+i).length&&e("#"+i).closest(".sby_video_thumbnail_wrap").find(".sby_video_thumbnail").length&&e("#"+i).closest(".sby_video_thumbnail_wrap").find(".sby_video_thumbnail").fadeTo(0,"slow",function(){e(this).css("z-index",-1),e(this).find(".sby_loader").hide().addClass("sby_hidden"),e(this).closest(".sby_item").removeClass("sby_player_loading")})},onStateChange:function(i){1===i.data&&void 0!==o.players&&n.find(".sby_item").each(function(){var i=o.getVideoID(e(this));t!==i&&void 0!==o.players[i]&&o.players[i].pauseVideo()})}});var d=new window.YT.Player(i,a);return n.hasClass("sby_layout_list")&&void 0===this.players[t]?this.players[t]=d:void 0===this.player&&(this.player=d),d},afterInitialImagesLoaded:function(){this.initLayout(),this.loadMoreButtonInit(),this.hideExtraItemsForWidth(),this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed()},afterResize:function(){this.setImageHeight(),this.setImageResolution(),this.maybeRaiseImageResolution(),this.setImageSizeClass()},afterLoadMoreClicked:function(e){e.find(".sby_loader").removeClass("sby_hidden"),e.find(".sby_btn_text").addClass("sby_hidden"),e.closest(".sb_youtube").find(".sby_num_diff_hide").addClass("sby_transition").removeClass("sby_num_diff_hide")},afterNewImagesLoaded:function(){var i=e(this.el),t=this;this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed(),setTimeout(function(){i.find(".sby_loader").addClass("sby_hidden"),i.find(".sby_btn_text").removeClass("sby_hidden"),t.maybeRaiseImageResolution()},500)},beforeNewImagesRevealed:function(){this.setImageHeight(),this.maybeRaiseImageResolution(!0),this.setImageSizeClass()},revealNewImages:function(){var i=e(this.el),t=this;"function"==typeof sbyCustomJS&&setTimeout(function(){sbyCustomJS()},100),i.find(".sby_item").each(function(i){var s=jQuery(this);s.find(".sby_video_thumbnail").hover(function(){jQuery(this).fadeTo(200,.85)},function(){jQuery(this).stop().fadeTo(500,1)}),s.find(".sby_video_thumbnail").off().click(function(i){i.preventDefault(),t.onThumbnailClick(e(this),!1)}),s.find(".sby_video_thumbnail").mouseenter(function(){t.onThumbnailEnter(e(this),!1)}),s.find(".sby_player_wrap").mouseleave(function(){t.onThumbnailLeave(e(this),!1)}),t.settings.lightboxEnabled&&(s.find(".sby_video_thumbnail").attr("data-sby-lightbox",t.index),"undefined"!=typeof sbyOptions&&void 0!==sbyOptions.lightboxPlaceholder&&s.find(".sby_video_thumbnail").attr("href",sbyOptions.lightboxPlaceholder))}),setTimeout(function(){i.find(".sby_item.sby_new").removeClass("sby_new");var e=10;i.find(".sby_transition").length;i.find(".sby_transition").each(function(i){var t=jQuery(this);setTimeout(function(){t.removeClass("sby_transition")},e),e+=10})},500)},afterNewImagesRevealed:function(){this.listenForVisibilityChange(),this.sendNeedsResizingToServer(),this.sendCheckWPPostsToServer(),this.settings.imageLoadEnabled||e(".sby_no_resraise").removeClass("sby_no_resraise");var i=e.Event("sbyafterimagesloaded");i.el=e(this.el),e(window).trigger(i)},setResizedImages:function(){e(this.el).find(".sby_resized_image_data").length&&void 0!==e(this.el).find(".sby_resized_image_data").attr("data-resized")&&0===e(this.el).find(".sby_resized_image_data").attr("data-resized").indexOf('{"')&&(this.resizedImages=JSON.parse(e(this.el).find(".sby_resized_image_data").attr("data-resized")),e(this.el).find(".sby_resized_image_data").remove())},sendNeedsResizingToServer:function(){var i=this;if(i.needsResizing.length>0&&i.settings.resizingEnabled){var t=e(this.el).find(".sby_item").length;s({action:"sby_resized_images_submit",needs_resizing:i.needsResizing,offset:t,feed_id:i.settings.feedID,atts:i.settings.shortCodeAtts},function(e){if(0===e.trim().indexOf("{")){var t=JSON.parse(e);i.settings.debugEnabled&&console.log(t)}})}},sendCheckWPPostsToServer:function(){var i=this;if(i.settings.checkWPPosts){s({action:"sby_check_wp_submit",feed_id:i.settings.feedID,atts:i.settings.shortCodeAtts,offset:e(this.el).find(".sby_item").length},function(e){if(0===e.trim().indexOf("{")){var t=JSON.parse(e);i.settings.debugEnabled&&console.log(t)}})}},loadMoreButtonInit:function(){var i=e(this.el),t=this;i.find(".sby_footer .sby_load_btn").off().on("click",function(){t.afterLoadMoreClicked(jQuery(this)),t.getNewPostSet()})},getNewPostSet:function(){var i=e(this.el),t=this;s({action:"sby_load_more_clicked",offset:i.find(".sby_item").length,feed_id:t.settings.feedID,atts:t.settings.shortCodeAtts,current_resolution:t.imageResolution},function(s){if(0===s.trim().indexOf("{")){var a=JSON.parse(s);t.settings.debugEnabled&&console.log(a),t.appendNewPosts(a.html),t.addResizedImages(a.resizedImages),t.settings.ajaxPostLoad?(t.settings.ajaxPostLoad=!1,t.afterInitialImagesLoaded()):t.afterNewImagesLoaded(),a.feedStatus.shouldPaginate?t.outOfPages=!1:(t.outOfPages=!0,i.find(".sby_load_btn").hide()),e(".sby_no_js").removeClass("sby_no_js")}})},appendNewPosts:function(i){var t=e(this.el);t.find(".sby_items_wrap .sby_item").length?t.find(".sby_items_wrap .sby_item").last().after(i):t.find(".sby_items_wrap").append(i)},addResizedImages:function(e){for(var i in e)this.resizedImages[i]=e[i]},setImageHeight:function(){},maybeRaiseSingleImageResolution:function(i,t,s){var a=this,n=a.getImageUrls(i),o=i.find(".sby_video_thumbnail img").attr("src"),d=150;s=void 0!==s&&s;if(!i.hasClass("sby_no_resraise")){e.each(n,function(e,i){i===o&&(d=parseInt(e),s=!1)});var r=640;switch(a.settings.imgRes){case"thumb":r=120;break;case"medium":r=320;break;case"large":r=480;break;case"full":r=640;break;default:var l=Math.max(a.settings.autoMinRes,i.find(".sby_video_thumbnail").innerWidth());switch(a.getBestResolutionForAuto(l,1,e(this.el).find("sby_item").first())){case 480:r=480;break;case 320:r=320;break;case 120:r=120}}if(r>d||o===window.sby.options.placeholder||s){if(a.settings.debugEnabled){var h=o===window.sby.options.placeholder?"was placeholder":"too small";console.log("rais res for "+o,h)}var b=n[r];i.find(".sby_video_thumbnail img").attr("src",b)}i.find("img").on("error",function(){if(e(this).hasClass("sby_img_error"))console.log("unfixed error "+e(this).attr("src"));else{if(e(this).addClass("sby_img_error"),e(this).attr("src").indexOf("i.ytimg.com")>-1)a.settings.favorLocal=!0,a.getImageUrls(e(this).closest(".sby_item"))[640];else void 0!==e(this).closest(".sby_video_thumbnail").attr("data-full-res")||e(this).closest(".sby_video_thumbnail").attr("href");setTimeout(function(){a.afterResize()},1500)}})}},maybeRaiseImageResolution:function(i){var t=this,s=void 0!==i&&!0===i?".sby_item.sby_new":".sby_item",a=!t.isInitialized;e(t.el).find(s).each(function(i){!e(this).hasClass("sby_num_diff_hide")&&e(this).find(".sby_video_thumbnail").length&&void 0!==e(this).find(".sby_video_thumbnail").attr("data-img-src-set")&&t.maybeRaiseSingleImageResolution(e(this),i,a)}),t.isInitialized=!0},getBestResolutionForAuto:function(i,t,s){(isNaN(t)||t<1)&&(t=1);var a=i*t,n=10*Math.ceil(a/10),o=[120,320,480,640];if(s.hasClass("sby_highlighted")&&(n*=2),-1===o.indexOf(parseInt(n))){var d=!1;e.each(o,function(e,i){i>parseInt(n)&&!d&&(n=i,d=!0)})}return n},hideExtraItemsForWidth:function(){if("carousel"!==this.layout){var i=e(this.el),t=void 0!==i.attr("data-num")&&""!==i.attr("data-num")?parseInt(i.attr("data-num")):1,s=void 0!==i.attr("data-nummobile")&&""!==i.attr("data-nummobile")?parseInt(i.attr("data-nummobile")):t;e(window).width()<480?s<i.find(".sby_item").length&&i.find(".sby_item").slice(s-i.find(".sby_item").length).addClass("sby_num_diff_hide"):t<i.find(".sby_item").length&&i.find(".sby_item").slice(t-i.find(".sby_item").length).addClass("sby_num_diff_hide")}},setImageSizeClass:function(){var i=e(this.el);i.removeClass("sby_small sby_medium");var t=i.innerWidth(),s=parseInt(i.find(".sby_items_wrap").outerWidth()-i.find(".sby_items_wrap").width())/2,a=this.getColumnCount(),n=(t-s*(a+2))/a;n>120&&n<240?i.addClass("sby_medium"):n<=120&&i.addClass("sby_small")},setMinImageWidth:function(){e(this.el).find(".sby_item .sby_video_thumbnail").first().length?this.minImageWidth=e(this.el).find(".sby_item .sby_video_thumbnail").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(e){var i=JSON.parse(e.find(".sby_video_thumbnail").attr("data-img-src-set").replace(/\\\//g,"/")),t=e.attr("id").replace("sby_","").replace("player_","");if(void 0!==this.resizedImages[t]&&"video"!==this.resizedImages[t]&&"pending"!==this.resizedImages[t]&&"error"!==this.resizedImages[t].id&&"video"!==this.resizedImages[t].id&&"pending"!==this.resizedImages[t].id){if(void 0!==this.resizedImages[t].sizes){var s=[];void 0!==this.resizedImages[t].sizes.full&&(s.push(640),i[640]=sbyOptions.resized_url+this.resizedImages[t].id+"full.jpg",e.find(".sby_link_area").attr("href",sbyOptions.resized_url+this.resizedImages[t].id+"full.jpg"),e.find(".sby_video_thumbnail").attr("data-full-res",sbyOptions.resized_url+this.resizedImages[t].id+"full.jpg")),void 0!==this.resizedImages[t].sizes.low&&(s.push(320),i[320]=sbyOptions.resized_url+this.resizedImages[t].id+"low.jpg",this.settings.favorLocal&&void 0===this.resizedImages[t].sizes.full&&(e.find(".sby_link_area").attr("href",sbyOptions.resized_url+this.resizedImages[t].id+"low.jpg"),e.find(".sby_video_thumbnail").attr("data-full-res",sbyOptions.resized_url+this.resizedImages[t].id+"low.jpg"))),void 0!==this.resizedImages[t].sizes.thumb&&(s.push(150),i[150]=sbyOptions.resized_url+this.resizedImages[t].id+"thumb.jpg"),this.settings.favorLocal&&(-1===s.indexOf(640)&&s.indexOf(320)>-1&&(i[640]=sbyOptions.resized_url+this.resizedImages[t].id+"low.jpg"),-1===s.indexOf(320)&&(s.indexOf(640)>-1?i[320]=sbyOptions.resized_url+this.resizedImages[t].id+"full.jpg":s.indexOf(150)>-1&&(i[320]=sbyOptions.resized_url+this.resizedImages[t].id+"thumb.jpg")),-1===s.indexOf(150)&&(s.indexOf(320)>-1?i[150]=sbyOptions.resized_url+this.resizedImages[t].id+"low.jpg":s.indexOf(640)>-1&&(i[150]=sbyOptions.resized_url+this.resizedImages[t].id+"full.jpg")))}}else(void 0===this.resizedImages[t]||void 0!==this.resizedImages[t].id&&"pending"!==this.resizedImages[t].id&&"error"!==this.resizedImages[t].id)&&this.addToNeedsResizing(t);return i},getVideoID:function(e){if(e.hasClass("sby_item")||e.hasClass("sby_player_item")){if(void 0!==e.find(".sby_video_thumbnail").attr("data-video-id"))return e.find(".sby_video_thumbnail").attr("data-video-id")}else if(e.closest("sby_item").length||e.closest("sby_player_item").length){var i=e.closest("sby_item").length?e.closest("sby_item"):e.closest("sby_player_item");if(void 0!==i.find(".sby_video_thumbnail").attr("data-video-id"))return i.find(".sby_video_thumbnail").attr("data-video-id")}else if(e.hasClass("sb_youtube"))return e.find(".sby_item").first().find(".sby_video_thumbnail").attr("data-video-id");return console.log("no id"),""},getAvatarUrl:function(e,i){if(""===e)return"";var t=this.settings.general.avatars;return"local"===(i=void 0!==i?i:"local")?void 0!==t["LCL"+e]&&1===parseInt(t["LCL"+e])?sbyOptions.resized_url+e+".jpg":void 0!==t[e]?t[e]:"":void 0!==t[e]?t[e]:void 0!==t["LCL"+e]&&1===parseInt(t["LCL"+e])?sbyOptions.resized_url+e+".jpg":""},addToNeedsResizing:function(e){-1===this.needsResizing.indexOf(e)&&this.needsResizing.push(e)},listenForVisibilityChange:function(){var i,t,s,a=this;i=jQuery,t={callback:function(){},runOnLoad:!0,frequency:100,sbyPreviousVisibility:null},s={sbyCheckVisibility:function(e,i){if(jQuery.contains(document,e[0])){var t=i.sbyPreviousVisibility,a=e.is(":visible");i.sbyPreviousVisibility=a,null==t?i.runOnLoad&&i.callback(e,a):t!==a&&i.callback(e,a),setTimeout(function(){s.sbyCheckVisibility(e,i)},i.frequency)}}},i.fn.sbyVisibilityChanged=function(e){var a=i.extend({},t,e);return this.each(function(){s.sbyCheckVisibility(i(this),a)})},"function"==typeof e(this.el).filter(":hidden").sbyVisibilityChanged&&e(this.el).filter(":hidden").sbyVisibilityChanged({callback:function(e,i){a.afterResize()},runOnLoad:!1})},getColumnCount:function(){var i=e(this.el),t=this.settings.cols,s=this.settings.colsmobile,a=t;return sbyWindowWidth=window.innerWidth,i.hasClass("sby_mob_col_auto")?(sbyWindowWidth<640&&parseInt(t)>2&&parseInt(t)<7&&(a=2),sbyWindowWidth<640&&parseInt(t)>6&&parseInt(t)<11&&(a=4),sbyWindowWidth<=480&&parseInt(t)>2&&(a=1)):sbyWindowWidth<=480&&(a=s),parseInt(a)},onThumbnailClick:function(i,t){if(this.canCreatePlayer()){var s=e(this.el);if(s.hasClass("sby_layout_gallery"))s.addClass("sby_player_added").find(".sby_player_outer_wrap").addClass("sby_player_loading"),s.find(".sby_player_outer_wrap .sby_video_thumbnail").find(".sby_loader").show().removeClass("sby_hidden"),s.find(".sby_player_outer_wrap iframe").length?t?this.playVideoInPlayer(this.getVideoID(s.find(".sby_item").first())):(this.playVideoInPlayer(this.getVideoID(i.closest(".sby_item"))),this.afterVideoChanged()):t?this.createPlayer("sby_player"+this.index):this.createPlayer("sby_player"+this.index,this.getVideoID(i.closest(".sby_item")));else if(e(this.el).hasClass("sby_layout_grid")){var a=i.closest(".sby_item"),n=this.getVideoID(a);this.playVideoInPlayer(n),this.afterVideoChanged()}else if(e(this.el).hasClass("sby_layout_list")){a=i.closest(".sby_item"),n=this.getVideoID(a);a.find("iframe").length||(a.find(".sby_loader").show().removeClass("sby_hidden"),a.addClass("sby_player_loading sby_player_loaded"),this.createPlayer("sby_player_"+n,n))}}},onThumbnailEnter:function(i){if(this.canCreatePlayer()&&e(this.el).hasClass("sby_layout_list")){var t=i.closest(".sby_item"),s=this.getVideoID(t);t.find("iframe").length||(t.find(".sby_loader").show().removeClass("sby_hidden"),t.addClass("sby_player_loading sby_player_loaded"),this.createPlayer("sby_player_"+s,s,0))}},onThumbnailLeave:function(e){},canCreatePlayer:function(){return this.playerAPIReady&&this.consentGiven},playVideoInPlayer:function(e){void 0!==this.player&&void 0!==this.player.loadVideoById&&this.player.loadVideoById(e)},afterVideoChanged:function(){e(this.el).hasClass("sby_layout_gallery")&&(e(this.el).find(".sby_player_outer_wrap").removeClass("sby_player_loading"),e(this.el).find(".sby_player_outer_wrap .sby_video_thumbnail").find(".sby_loader").hide().addClass("sby_hidden"),e(window).width()<480&&e("html, body").animate({scrollTop:e(this.el).find(".sby_player_outer_wrap").offset().top},300))}},window.sby_init=function(){window.sby=new i,window.sby.createPage(window.sby.createFeeds,{whenFeedsCreated:window.sby.afterFeedsCreated})}}(jQuery),jQuery(document).ready(function(e){sby_init()})}window.onYouTubeIframeAPIReady=function(){var e=document.getElementsByClassName("sb_youtube").length;if(e>0)for(var i=0;i<e;i++)window.sby.feeds[i].playerAPIReady=!0};
languages/youtube-feed-de_DE.mo ADDED
Binary file
languages/youtube-feed-de_DE.po ADDED
@@ -0,0 +1,875 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "POT-Creation-Date: 2019-11-29 14:34-0600\n"
5
+ "PO-Revision-Date: 2019-11-29 14:40-0600\n"
6
+ "Language-Team: \n"
7
+ "MIME-Version: 1.0\n"
8
+ "Content-Type: text/plain; charset=UTF-8\n"
9
+ "Content-Transfer-Encoding: 8bit\n"
10
+ "X-Generator: Poedit 2.2.4\n"
11
+ "X-Poedit-Basepath: ..\n"
12
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
13
+ "X-Poedit-KeywordsList: __;_e;esc_html__;esc_html_e;esc_attr_e;esc_attr__\n"
14
+ "Last-Translator: \n"
15
+ "Language: de_DE\n"
16
+ "X-Poedit-SearchPath-0: .\n"
17
+
18
+ #: inc/admin/admin-functions.php:17 inc/admin/templates/configure.php:1
19
+ msgid "Configure"
20
+ msgstr "Konfigurieren"
21
+
22
+ #: inc/admin/admin-functions.php:20
23
+ msgid "Customize your feed"
24
+ msgstr ""
25
+
26
+ #: inc/admin/admin-functions.php:23
27
+ msgid "Customize"
28
+ msgstr "Anpassen"
29
+
30
+ #: inc/admin/admin-functions.php:26 inc/admin/templates/main.php:57
31
+ msgid "Display your feed"
32
+ msgstr ""
33
+
34
+ #: inc/admin/admin-functions.php:29
35
+ msgid "Display"
36
+ msgstr "Anzeige"
37
+
38
+ #: inc/admin/admin-functions.php:34
39
+ msgid "Support"
40
+ msgstr ""
41
+
42
+ #: inc/admin/admin-functions.php:58
43
+ msgid "Channel"
44
+ msgstr ""
45
+
46
+ #: inc/admin/admin-functions.php:60
47
+ msgid "Eg: UCNrD5PWitIbhVK8ID or smashballoon."
48
+ msgstr ""
49
+
50
+ #: inc/admin/admin-functions.php:61
51
+ msgid "Show the latest videos from a YouTube channel."
52
+ msgstr ""
53
+
54
+ #: inc/admin/admin-functions.php:71
55
+ msgid "List"
56
+ msgstr ""
57
+
58
+ #: inc/admin/admin-functions.php:73
59
+ msgid "A single columns of videos that play when clicked."
60
+ msgstr ""
61
+
62
+ #: inc/admin/admin-functions.php:77
63
+ msgid "Grid"
64
+ msgstr ""
65
+
66
+ #: inc/admin/admin-functions.php:79
67
+ msgid ""
68
+ "Video thumbnails are displayed in columns and play in a lightbox when "
69
+ "clicked."
70
+ msgstr ""
71
+
72
+ #: inc/admin/admin-functions.php:84 inc/admin/admin-functions.php:110
73
+ msgid "Columns"
74
+ msgstr ""
75
+
76
+ #: inc/admin/admin-functions.php:93 inc/admin/admin-functions.php:119
77
+ msgid "Mobile Columns"
78
+ msgstr ""
79
+
80
+ #: inc/admin/admin-functions.php:103
81
+ msgid "Gallery"
82
+ msgstr ""
83
+
84
+ #: inc/admin/admin-functions.php:105
85
+ msgid ""
86
+ "One large video that plays when clicked with thumbnails underneath to play "
87
+ "more."
88
+ msgstr ""
89
+
90
+ #: inc/admin/admin-functions.php:134
91
+ msgid "Configure Options"
92
+ msgstr ""
93
+
94
+ #: inc/admin/admin-functions.php:138
95
+ msgid "Customize Options"
96
+ msgstr ""
97
+
98
+ #: inc/admin/admin-functions.php:142
99
+ msgid "Layout Options"
100
+ msgstr ""
101
+
102
+ #: inc/admin/admin-functions.php:146
103
+ msgid "Header Options"
104
+ msgstr ""
105
+
106
+ #: inc/admin/admin-functions.php:150
107
+ msgid "\"Load More\" Button Options"
108
+ msgstr ""
109
+
110
+ #: inc/admin/admin-functions.php:154
111
+ msgid "\"Subscribe\" Button Options"
112
+ msgstr ""
113
+
114
+ #: inc/admin/admin-functions.php:284
115
+ msgid ""
116
+ "Could not connect your account. Please check to make sure this is a valid "
117
+ "access token for the Smash Balloon YouTube App."
118
+ msgstr ""
119
+
120
+ #: inc/admin/class-sbspf-admin.php:102
121
+ msgid "Feed Type"
122
+ msgstr ""
123
+
124
+ #: inc/admin/class-sbspf-admin.php:106
125
+ msgid "Display videos from a YouTube channel (channel)"
126
+ msgstr ""
127
+
128
+ #: inc/admin/class-sbspf-admin.php:117
129
+ msgid "Preserve settings when plugin is removed"
130
+ msgstr ""
131
+
132
+ #: inc/admin/class-sbspf-admin.php:119
133
+ msgid ""
134
+ "When removing the plugin your settings are automatically erased. Checking "
135
+ "this box will prevent any settings from being deleted. This means that you "
136
+ "can uninstall and reinstall the plugin without losing your settings."
137
+ msgstr ""
138
+
139
+ #: inc/admin/class-sbspf-admin.php:128
140
+ msgid "Check for new posts"
141
+ msgstr ""
142
+
143
+ #: inc/admin/class-sbspf-admin.php:136
144
+ msgid "General"
145
+ msgstr ""
146
+
147
+ #: inc/admin/class-sbspf-admin.php:162
148
+ msgid "Width of Feed"
149
+ msgstr ""
150
+
151
+ #: inc/admin/class-sbspf-admin.php:166
152
+ msgid "The width of your feed. Any number with a unit like \"px\" or \"%\"."
153
+ msgstr ""
154
+
155
+ #: inc/admin/class-sbspf-admin.php:174
156
+ msgid "Set to be 100% width on mobile?"
157
+ msgstr ""
158
+
159
+ #: inc/admin/class-sbspf-admin.php:177
160
+ #, php-format
161
+ msgid ""
162
+ "If you set a width on the feed then this will be used on mobile as well as "
163
+ "desktop. Check this setting to set the feed width to be 100% on mobile so "
164
+ "that it is responsive."
165
+ msgstr ""
166
+
167
+ #: inc/admin/class-sbspf-admin.php:199
168
+ msgid "Height of Feed"
169
+ msgstr ""
170
+
171
+ #: inc/admin/class-sbspf-admin.php:203
172
+ msgid "The height of your feed. Any number with a unit like \"px\" or \"em\"."
173
+ msgstr ""
174
+
175
+ #: inc/admin/class-sbspf-admin.php:216
176
+ msgid "Background Color"
177
+ msgstr ""
178
+
179
+ #: inc/admin/class-sbspf-admin.php:220
180
+ msgid "Background color for the feed. Any hex color code."
181
+ msgstr ""
182
+
183
+ #: inc/admin/class-sbspf-admin.php:227
184
+ msgid "Layout"
185
+ msgstr ""
186
+
187
+ #: inc/admin/class-sbspf-admin.php:238
188
+ msgid "Layout Type"
189
+ msgstr ""
190
+
191
+ #: inc/admin/class-sbspf-admin.php:243
192
+ msgid "How your posts are display visually."
193
+ msgstr ""
194
+
195
+ #: inc/admin/class-sbspf-admin.php:383
196
+ msgid "Yes"
197
+ msgstr ""
198
+
199
+ #: inc/admin/class-sbspf-admin.php:534
200
+ msgid "Connect an account above"
201
+ msgstr ""
202
+
203
+ #: inc/admin/class-sbspf-admin.php:565 inc/admin/class-sby-admin.php:354
204
+ msgid "When the page loads"
205
+ msgstr ""
206
+
207
+ #: inc/admin/class-sbspf-admin.php:567 inc/admin/class-sby-admin.php:356
208
+ #, php-format
209
+ msgid ""
210
+ "Your %s data is temporarily cached by the plugin in your WordPress database. "
211
+ "There are two ways that you can set the plugin to check for new data:"
212
+ "<br><br>\n"
213
+ " <b>1. When the page loads</b><br>Selecting this option means "
214
+ "that when the cache expires then the plugin will check %s for new posts the "
215
+ "next time that the feed is loaded. You can choose how long this data should "
216
+ "be cached for. If you set the time to 60 minutes then the plugin will clear "
217
+ "the cached data after that length of time, and the next time the page is "
218
+ "viewed it will check for new data. <b>Tip:</b> If you're experiencing an "
219
+ "issue with the plugin not updating automatically then try enabling the "
220
+ "setting labeled <b>'Force cache to clear on interval'</b> which is located "
221
+ "on the 'Customize' tab.<br><br>\n"
222
+ " <b>2. In the background</b><br>Selecting this option means "
223
+ "that the plugin will check for new data in the background so that the feed "
224
+ "is updated behind the scenes. You can select at what time and how often the "
225
+ "plugin should check for new data using the settings below. <b>Please note</"
226
+ "b> that the plugin will initially check for data from Instagram when the "
227
+ "page first loads, but then after that will check in the background on the "
228
+ "schedule selected - unless the cache is cleared."
229
+ msgstr ""
230
+
231
+ #: inc/admin/class-sbspf-admin.php:573 inc/admin/class-sby-admin.php:362
232
+ msgid "Every"
233
+ msgstr ""
234
+
235
+ #: inc/admin/class-sbspf-admin.php:576 inc/admin/class-sby-admin.php:365
236
+ msgid "Minutes"
237
+ msgstr ""
238
+
239
+ #: inc/admin/class-sbspf-admin.php:577 inc/admin/class-sby-admin.php:366
240
+ msgid "Hours"
241
+ msgstr ""
242
+
243
+ #: inc/admin/class-sbspf-admin.php:578 inc/admin/class-sby-admin.php:367
244
+ msgid "Days"
245
+ msgstr ""
246
+
247
+ #: inc/admin/class-sbspf-admin.php:580 inc/admin/class-sbspf-admin.php:847
248
+ #: inc/admin/class-sby-admin.php:369
249
+ msgid "What does this mean?"
250
+ msgstr ""
251
+
252
+ #: inc/admin/class-sbspf-admin.php:581 inc/admin/class-sby-admin.php:370
253
+ #, php-format
254
+ msgid ""
255
+ "Your %s posts are temporarily cached by the plugin in your WordPress "
256
+ "database. You can choose how long the posts should be cached for. If you set "
257
+ "the time to 1 hour then the plugin will clear the cache after that length of "
258
+ "time and check %s for posts again."
259
+ msgstr ""
260
+
261
+ #: inc/admin/class-sbspf-admin.php:586 inc/admin/class-sby-admin.php:375
262
+ msgid "In the background"
263
+ msgstr ""
264
+
265
+ #: inc/admin/class-sbspf-admin.php:591 inc/admin/class-sby-admin.php:380
266
+ #: youtube-feed.php:180
267
+ msgid "Every 30 minutes"
268
+ msgstr ""
269
+
270
+ #: inc/admin/class-sbspf-admin.php:592 inc/admin/class-sby-admin.php:381
271
+ msgid "Every hour"
272
+ msgstr ""
273
+
274
+ #: inc/admin/class-sbspf-admin.php:593 inc/admin/class-sby-admin.php:382
275
+ msgid "Every 12 hours"
276
+ msgstr ""
277
+
278
+ #: inc/admin/class-sbspf-admin.php:594 inc/admin/class-sby-admin.php:383
279
+ msgid "Every 24 hours"
280
+ msgstr ""
281
+
282
+ #: inc/admin/class-sbspf-admin.php:598 inc/admin/class-sby-admin.php:387
283
+ msgid "at"
284
+ msgstr ""
285
+
286
+ #: inc/admin/class-sbspf-admin.php:615 inc/admin/class-sby-admin.php:404
287
+ msgid "AM"
288
+ msgstr ""
289
+
290
+ #: inc/admin/class-sbspf-admin.php:616 inc/admin/class-sby-admin.php:405
291
+ msgid "PM"
292
+ msgstr ""
293
+
294
+ #: inc/admin/class-sbspf-admin.php:628 inc/admin/class-sby-admin.php:417
295
+ msgid "every 30 minutes"
296
+ msgstr ""
297
+
298
+ #: inc/admin/class-sbspf-admin.php:629 inc/admin/class-sby-admin.php:418
299
+ msgid "every 12 hours"
300
+ msgstr ""
301
+
302
+ #: inc/admin/class-sbspf-admin.php:631 inc/admin/class-sby-admin.php:420
303
+ msgid "Next check"
304
+ msgstr ""
305
+
306
+ #: inc/admin/class-sbspf-admin.php:631 inc/admin/class-sby-admin.php:420
307
+ msgid ""
308
+ "Note: Saving the settings on this page will clear the cache and reset this "
309
+ "schedule"
310
+ msgstr ""
311
+
312
+ #: inc/admin/class-sbspf-admin.php:633 inc/admin/class-sby-admin.php:422
313
+ msgid "Nothing currently scheduled"
314
+ msgstr ""
315
+
316
+ #: inc/admin/class-sbspf-admin.php:666
317
+ msgid "Click for shortcode option"
318
+ msgstr ""
319
+
320
+ #: inc/admin/class-sby-admin.php:19
321
+ msgid "Number of Videos"
322
+ msgstr ""
323
+
324
+ #: inc/admin/class-sby-admin.php:20
325
+ msgid "Number of videos to show initially."
326
+ msgstr ""
327
+
328
+ #: inc/admin/class-sby-admin.php:24
329
+ msgid "The number of videos in the feed"
330
+ msgstr ""
331
+
332
+ #: inc/admin/class-sby-admin.php:47
333
+ msgid "Spacing between videos"
334
+ msgstr ""
335
+
336
+ #: inc/admin/class-sby-admin.php:51
337
+ msgid ""
338
+ "The spacing/padding around the videos in the feed. Any number with a unit "
339
+ "like \"px\" or \"em\"."
340
+ msgstr ""
341
+
342
+ #: inc/admin/class-sby-admin.php:60
343
+ msgid "Header"
344
+ msgstr ""
345
+
346
+ #: inc/admin/class-sby-admin.php:70
347
+ msgid "Show Header"
348
+ msgstr ""
349
+
350
+ #: inc/admin/class-sby-admin.php:75
351
+ msgid "Include a header for this feed."
352
+ msgstr ""
353
+
354
+ #: inc/admin/class-sby-admin.php:85
355
+ msgid "Show Channel Description"
356
+ msgstr ""
357
+
358
+ #: inc/admin/class-sby-admin.php:90
359
+ msgid "Include the channel description in the header."
360
+ msgstr ""
361
+
362
+ #: inc/admin/class-sby-admin.php:97
363
+ msgid "\"Load More\" Button"
364
+ msgstr ""
365
+
366
+ #: inc/admin/class-sby-admin.php:107
367
+ msgid "Show \"Load More\" Button"
368
+ msgstr ""
369
+
370
+ #: inc/admin/class-sby-admin.php:112
371
+ msgid ""
372
+ "Include a \"Load More\" button at the bottom of the feed to load more videos."
373
+ msgstr ""
374
+
375
+ #: inc/admin/class-sby-admin.php:123
376
+ msgid "Button Background Color"
377
+ msgstr ""
378
+
379
+ #: inc/admin/class-sby-admin.php:127
380
+ msgid "Background color for the \"Load More\" button. Any hex color code."
381
+ msgstr ""
382
+
383
+ #: inc/admin/class-sby-admin.php:138
384
+ msgid "Button Text Color"
385
+ msgstr ""
386
+
387
+ #: inc/admin/class-sby-admin.php:142
388
+ msgid "Text color for the \"Load More\" button. Any hex color code."
389
+ msgstr ""
390
+
391
+ #: inc/admin/class-sby-admin.php:150 youtube-feed.php:412
392
+ msgid "Load More..."
393
+ msgstr "Mehr laden…"
394
+
395
+ #: inc/admin/class-sby-admin.php:153
396
+ msgid "Button Text"
397
+ msgstr ""
398
+
399
+ #: inc/admin/class-sby-admin.php:157
400
+ msgid "The text that appers on the \"Load More\" button."
401
+ msgstr ""
402
+
403
+ #: inc/admin/class-sby-admin.php:165
404
+ msgid "\"Subscribe\" Button"
405
+ msgstr ""
406
+
407
+ #: inc/admin/class-sby-admin.php:176
408
+ msgid "Show \"Subscribe\" Button"
409
+ msgstr ""
410
+
411
+ #: inc/admin/class-sby-admin.php:181
412
+ msgid ""
413
+ "Include a \"Subscribe\" button at the bottom of the feed to load more videos."
414
+ msgstr ""
415
+
416
+ #: inc/admin/class-sby-admin.php:192
417
+ msgid "Subscribe Background Color"
418
+ msgstr ""
419
+
420
+ #: inc/admin/class-sby-admin.php:196
421
+ msgid "Background color for the \"Subscribe\" button. Any hex color code."
422
+ msgstr ""
423
+
424
+ #: inc/admin/class-sby-admin.php:207
425
+ msgid "Subscribe Text Color"
426
+ msgstr ""
427
+
428
+ #: inc/admin/class-sby-admin.php:211
429
+ msgid "Text color for the \"Subscribe\" button. Any hex color code."
430
+ msgstr ""
431
+
432
+ #: inc/admin/class-sby-admin.php:219 youtube-feed.php:413
433
+ msgid "Subscribe"
434
+ msgstr "Abonnieren"
435
+
436
+ #: inc/admin/class-sby-admin.php:222
437
+ msgid "Subscribe Text"
438
+ msgstr ""
439
+
440
+ #: inc/admin/class-sby-admin.php:226
441
+ msgid "The text that appers on the \"Subscribe\" button."
442
+ msgstr ""
443
+
444
+ #: inc/admin/class-sby-admin.php:233
445
+ msgid "Video Experience"
446
+ msgstr ""
447
+
448
+ #: inc/admin/class-sby-admin.php:241
449
+ msgid "Play when clicked"
450
+ msgstr ""
451
+
452
+ #: inc/admin/class-sby-admin.php:254
453
+ msgid "When does video play?"
454
+ msgstr ""
455
+
456
+ #: inc/admin/class-sby-admin.php:258
457
+ msgid "What the user needs to do to play a video. eg."
458
+ msgstr ""
459
+
460
+ #: inc/admin/class-sby-admin.php:262
461
+ msgid ""
462
+ "List layout will not play automatically. Choose whether to play the video "
463
+ "automatically in the player or wait until the user clicks the play button "
464
+ "after the video is loaded."
465
+ msgstr ""
466
+
467
+ #: inc/admin/class-sby-admin.php:267
468
+ msgid "Custom Code Snippets"
469
+ msgstr ""
470
+
471
+ #: inc/admin/class-sby-admin.php:278
472
+ msgid "Custom CSS"
473
+ msgstr ""
474
+
475
+ #: inc/admin/class-sby-admin.php:280
476
+ msgid "Enter your own custom CSS in the box below"
477
+ msgstr ""
478
+
479
+ #: inc/admin/class-sby-admin.php:289
480
+ msgid "Custom JavaScript"
481
+ msgstr ""
482
+
483
+ #: inc/admin/class-sby-admin.php:291
484
+ msgid "Enter your own custom JavaScript/jQuery in the box below"
485
+ msgstr ""
486
+
487
+ #: inc/admin/class-sby-admin.php:292
488
+ msgid ""
489
+ "Note: Custom JavaScript reruns every time more videos are loaded into the "
490
+ "feed"
491
+ msgstr ""
492
+
493
+ #: inc/admin/class-sby-admin.php:297
494
+ msgid "Advanced"
495
+ msgstr ""
496
+
497
+ #: inc/admin/class-sby-admin.php:305
498
+ msgid "Background"
499
+ msgstr ""
500
+
501
+ #: inc/admin/class-sby-admin.php:309
502
+ msgid "Page"
503
+ msgstr ""
504
+
505
+ #: inc/admin/class-sby-admin.php:313
506
+ msgid "None"
507
+ msgstr ""
508
+
509
+ #: inc/admin/class-sby-admin.php:323
510
+ msgid "Local storage process"
511
+ msgstr ""
512
+
513
+ #: inc/admin/class-sby-admin.php:326
514
+ msgid ""
515
+ "To preserve your feeds and videos even if the YouTube API is unavailable, a "
516
+ "record of each video is added to the wp_posts table in the WordPress "
517
+ "database."
518
+ msgstr ""
519
+
520
+ #: inc/admin/class-sby-admin.php:334
521
+ msgid "Are you using an AJAX theme?"
522
+ msgstr ""
523
+
524
+ #: inc/admin/class-sby-admin.php:336
525
+ msgid ""
526
+ "When navigating your site, if your theme uses Ajax to load content into your "
527
+ "pages (meaning your page doesn't refresh) then check this setting. If you're "
528
+ "not sure then it's best to leave this setting unchecked while checking with "
529
+ "your theme author, otherwise checking it may cause a problem."
530
+ msgstr ""
531
+
532
+ #: inc/admin/templates/configure.php:3
533
+ #, php-format
534
+ msgid "Log in to %s and connect an account"
535
+ msgstr "Melden Sie sich bei %s an und verbinden Sie ein Konto"
536
+
537
+ #: inc/admin/templates/configure.php:4
538
+ msgid "Button not working?"
539
+ msgstr ""
540
+
541
+ #: inc/admin/templates/configure.php:15
542
+ #, php-format
543
+ msgid "Or, manually enter my own %s API key"
544
+ msgstr ""
545
+
546
+ #: inc/admin/templates/configure.php:18
547
+ msgid ""
548
+ "Check this box if you would like to manually enter your own API key. To "
549
+ "generate an api key use <a href=\"https://smashballoon.com/youtube-api-key/"
550
+ "\" target=\"_blank\" rel=\"noopener\">these instructions.</a>"
551
+ msgstr ""
552
+
553
+ #: inc/admin/templates/configure.php:24
554
+ msgid "API Key"
555
+ msgstr ""
556
+
557
+ #: inc/admin/templates/configure.php:40 inc/admin/templates/customize.php:8
558
+ msgid "Save Changes"
559
+ msgstr ""
560
+
561
+ #: inc/admin/templates/connected-accounts.php:9
562
+ #, php-format
563
+ msgid "%s Accounts"
564
+ msgstr ""
565
+
566
+ #: inc/admin/templates/connected-accounts.php:10
567
+ #, php-format
568
+ msgid "Use the button above to connect %s account"
569
+ msgstr ""
570
+
571
+ #: inc/admin/templates/connected-accounts.php:14
572
+ #, php-format
573
+ msgid "No %s accounts connected. Click the button above to connect an account."
574
+ msgstr ""
575
+
576
+ #: inc/admin/templates/connected-accounts.php:33
577
+ msgid "Manually Connect a Primary Account"
578
+ msgstr ""
579
+
580
+ #: inc/admin/templates/connected-accounts.php:35
581
+ msgid "Enter a valid Access Token"
582
+ msgstr ""
583
+
584
+ #: inc/admin/templates/connected-accounts.php:36
585
+ msgid "Enter a valid Refresh Token"
586
+ msgstr ""
587
+
588
+ #: inc/admin/templates/connected-accounts.php:37
589
+ msgid "Connect This Account"
590
+ msgstr ""
591
+
592
+ #: inc/admin/templates/display.php:1
593
+ msgid "Display your Feed"
594
+ msgstr ""
595
+
596
+ #: inc/admin/templates/display.php:2
597
+ msgid ""
598
+ "Copy and paste the following shortcode directly into the page, post or "
599
+ "widget where you'd like the feed to show up:"
600
+ msgstr ""
601
+
602
+ #: inc/admin/templates/display.php:3 inc/admin/templates/main.php:59
603
+ #: inc/admin/templates/single-connected-account.php:39
604
+ #: inc/admin/templates/single-connected-account.php:40
605
+ #: inc/admin/templates/single-connected-account.php:41
606
+ msgid "To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)."
607
+ msgstr ""
608
+
609
+ #: inc/admin/templates/display.php:5
610
+ msgid "Multiple Feeds"
611
+ msgstr ""
612
+
613
+ #: inc/admin/templates/display.php:6
614
+ msgid ""
615
+ "If you'd like to display multiple feeds then you can set different settings "
616
+ "directly in the shortcode like so:"
617
+ msgstr ""
618
+
619
+ #: inc/admin/templates/display.php:8
620
+ msgid ""
621
+ "You can display as many different feeds as you like, on either the same page "
622
+ "or on different pages, by just using the shortcode options below. For "
623
+ "example:"
624
+ msgstr ""
625
+
626
+ #: inc/admin/templates/display.php:13
627
+ msgid "See the table below for a full list of available shortcode options:"
628
+ msgstr ""
629
+
630
+ #: inc/admin/templates/display.php:18
631
+ msgid "Shortcode option"
632
+ msgstr ""
633
+
634
+ #: inc/admin/templates/display.php:19
635
+ msgid "Description"
636
+ msgstr ""
637
+
638
+ #: inc/admin/templates/display.php:20
639
+ msgid "Example"
640
+ msgstr ""
641
+
642
+ #: inc/admin/templates/display.php:37 inc/admin/templates/support.php:1
643
+ msgid "Need help?"
644
+ msgstr ""
645
+
646
+ #: inc/admin/templates/display.php:37
647
+ msgid "Get Support"
648
+ msgstr ""
649
+
650
+ #: inc/admin/templates/main.php:17
651
+ msgid "Settings saved."
652
+ msgstr ""
653
+
654
+ #: inc/admin/templates/main.php:50
655
+ msgid "Next Step"
656
+ msgstr ""
657
+
658
+ #: inc/admin/templates/main.php:54
659
+ msgid "Need help setting up the plugin? Check out our <a href=\""
660
+ msgstr ""
661
+
662
+ #: inc/admin/templates/main.php:58
663
+ msgid ""
664
+ "Copy and paste this shortcode directly into the page, post or widget where "
665
+ "you'd like to display the feed:"
666
+ msgstr ""
667
+
668
+ #: inc/admin/templates/main.php:60
669
+ msgid "Find out how to display <a href='?page="
670
+ msgstr ""
671
+
672
+ #: inc/admin/templates/single-connected-account.php:4
673
+ msgid ""
674
+ "The Access Token for this account is expired or invalid. Click the button "
675
+ "above to attempt to renew it."
676
+ msgstr ""
677
+
678
+ #: inc/admin/templates/single-connected-account.php:9
679
+ msgid "Remove"
680
+ msgstr ""
681
+
682
+ #: inc/admin/templates/single-connected-account.php:14
683
+ msgid "Channel ID:"
684
+ msgstr ""
685
+
686
+ #: inc/admin/templates/single-connected-account.php:18
687
+ msgid "Add to another Feed"
688
+ msgstr ""
689
+
690
+ #: inc/admin/templates/single-connected-account.php:19
691
+ msgid "Show access token and account info"
692
+ msgstr ""
693
+
694
+ #: inc/admin/templates/single-connected-account.php:24
695
+ msgid "Copy and paste this shortcode into your page or widget area"
696
+ msgstr ""
697
+
698
+ #: inc/admin/templates/single-connected-account.php:32
699
+ msgid ""
700
+ "To add multiple channels in the same feed, simply separate them using commas"
701
+ msgstr ""
702
+
703
+ #: inc/admin/templates/single-connected-account.php:35
704
+ #, php-format
705
+ msgid "Click on the %s tab to learn more about shortcodes"
706
+ msgstr ""
707
+
708
+ #: inc/admin/templates/single-connected-account.php:35
709
+ msgid "Display Your Feed"
710
+ msgstr ""
711
+
712
+ #: inc/admin/templates/single-connected-account.php:39
713
+ msgid "Access Token"
714
+ msgstr ""
715
+
716
+ #: inc/admin/templates/single-connected-account.php:40
717
+ msgid "Refresh Token"
718
+ msgstr ""
719
+
720
+ #: inc/admin/templates/single-connected-account.php:41
721
+ msgid "Channel ID"
722
+ msgstr ""
723
+
724
+ #: inc/admin/templates/support.php:3
725
+ msgid "Check out our "
726
+ msgstr ""
727
+
728
+ #: inc/admin/templates/support.php:3
729
+ msgid "setup directions"
730
+ msgstr ""
731
+
732
+ #: inc/admin/templates/support.php:3
733
+ msgid "for a step-by-step guide on how to setup and use the plugin"
734
+ msgstr ""
735
+
736
+ #: inc/admin/templates/support.php:5
737
+ msgid "Have a problem? Submit a "
738
+ msgstr ""
739
+
740
+ #: inc/admin/templates/support.php:5
741
+ msgid "support ticket"
742
+ msgstr ""
743
+
744
+ #: inc/admin/templates/support.php:5
745
+ msgid "on our website"
746
+ msgstr ""
747
+
748
+ #: inc/admin/templates/support.php:5
749
+ msgid "Please include your <b>System Info</b> below with all support requests."
750
+ msgstr ""
751
+
752
+ #: inc/admin/templates/support.php:8
753
+ msgid "System Info"
754
+ msgstr ""
755
+
756
+ #: inc/admin/templates/support.php:8
757
+ msgid "Click the text below to select all"
758
+ msgstr ""
759
+
760
+ #: inc/class-sby-api-connect.php:102
761
+ #, php-format
762
+ msgid "Error: %s."
763
+ msgstr ""
764
+
765
+ #: inc/class-sby-api-connect.php:104
766
+ msgid ""
767
+ "There's an issue with the YouTube API Key that you are using. Please check "
768
+ "to make sure that this is a valid API Key."
769
+ msgstr ""
770
+
771
+ #: inc/class-sby-api-connect.php:118
772
+ #, php-format
773
+ msgid "Error connecting to %s."
774
+ msgstr ""
775
+
776
+ #: inc/class-sby-feed.php:737
777
+ msgid "Error: No videos found."
778
+ msgstr ""
779
+
780
+ #: inc/class-sby-feed.php:738
781
+ msgid ""
782
+ "Make sure this is a valid channel ID and that the channel has videos "
783
+ "available on youtube.com."
784
+ msgstr ""
785
+
786
+ #: inc/class-sby-feed.php:863
787
+ msgid "No posts found."
788
+ msgstr ""
789
+
790
+ #: inc/class-sby-posts-manager.php:235
791
+ msgid "There was an error creating the folder for storing resized images."
792
+ msgstr ""
793
+
794
+ #: inc/class-sby-posts-manager.php:323
795
+ msgid "Notice: API requests are being delayed for 5 minutes."
796
+ msgstr ""
797
+
798
+ #: inc/class-sby-posts-manager.php:323
799
+ msgid "Feed will not update."
800
+ msgstr ""
801
+
802
+ #: inc/class-sby-posts-manager.php:332
803
+ msgid ""
804
+ "There may be an issue with the YouTube access token that you are using. Your "
805
+ "server might also be unable to connect to YouTube at this time."
806
+ msgstr ""
807
+
808
+ #: inc/sby-functions.php:21 inc/sby-functions.php:137
809
+ msgid "This error message is only visible to WordPress admins"
810
+ msgstr ""
811
+
812
+ #: inc/sby-functions.php:22
813
+ msgid "Error: No connected account."
814
+ msgstr ""
815
+
816
+ #: inc/sby-functions.php:23
817
+ msgid "Please go to the YouTube Feed settings page to connect an account."
818
+ msgstr ""
819
+
820
+ #: inc/widget.php:13 youtube-feed.php:94
821
+ msgid "YouTube Feed"
822
+ msgstr ""
823
+
824
+ #: inc/widget.php:14
825
+ msgid "Display your YouTube feed"
826
+ msgstr ""
827
+
828
+ #: inc/widget.php:40
829
+ msgid "Title:"
830
+ msgstr ""
831
+
832
+ #: templates/item.php:22 templates/player.php:10
833
+ msgid "Image for post"
834
+ msgstr ""
835
+
836
+ #: templates/item.php:34 templates/player.php:17
837
+ #, php-format
838
+ msgid "YouTube Video %s"
839
+ msgstr ""
840
+
841
+ #: youtube-feed.php:97
842
+ msgid "a"
843
+ msgstr ""
844
+
845
+ #: youtube-feed.php:100
846
+ msgid "YouTube"
847
+ msgstr ""
848
+
849
+ #: youtube-feed.php:125
850
+ msgid "Videos"
851
+ msgstr ""
852
+
853
+ #: youtube-feed.php:126
854
+ msgid " "
855
+ msgstr ""
856
+
857
+ #: youtube-feed.php:127 youtube-feed.php:128
858
+ msgid "Add New Video"
859
+ msgstr ""
860
+
861
+ #: youtube-feed.php:129
862
+ msgid "Edit Video"
863
+ msgstr ""
864
+
865
+ #: youtube-feed.php:130
866
+ msgid "View Video"
867
+ msgstr ""
868
+
869
+ #: youtube-feed.php:131
870
+ msgid "All Videos"
871
+ msgstr ""
872
+
873
+ #: youtube-feed.php:441
874
+ msgid "Settings"
875
+ msgstr ""
languages/youtube-feed-fr_FR.mo ADDED
Binary file
languages/youtube-feed-fr_FR.po ADDED
@@ -0,0 +1,875 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "POT-Creation-Date: 2019-11-29 14:34-0600\n"
5
+ "PO-Revision-Date: 2019-11-29 16:33-0600\n"
6
+ "Language-Team: \n"
7
+ "MIME-Version: 1.0\n"
8
+ "Content-Type: text/plain; charset=UTF-8\n"
9
+ "Content-Transfer-Encoding: 8bit\n"
10
+ "X-Generator: Poedit 2.2.4\n"
11
+ "X-Poedit-Basepath: ..\n"
12
+ "Plural-Forms: nplurals=2; plural=(n > 1);\n"
13
+ "X-Poedit-KeywordsList: __;_e;esc_html__;esc_html_e;esc_attr_e;esc_attr__\n"
14
+ "Last-Translator: \n"
15
+ "Language: fr_FR\n"
16
+ "X-Poedit-SearchPath-0: .\n"
17
+
18
+ #: inc/admin/admin-functions.php:17 inc/admin/templates/configure.php:1
19
+ msgid "Configure"
20
+ msgstr "Configurer"
21
+
22
+ #: inc/admin/admin-functions.php:20
23
+ msgid "Customize your feed"
24
+ msgstr ""
25
+
26
+ #: inc/admin/admin-functions.php:23
27
+ msgid "Customize"
28
+ msgstr "Personnaliser"
29
+
30
+ #: inc/admin/admin-functions.php:26 inc/admin/templates/main.php:57
31
+ msgid "Display your feed"
32
+ msgstr ""
33
+
34
+ #: inc/admin/admin-functions.php:29
35
+ msgid "Display"
36
+ msgstr "Afficher"
37
+
38
+ #: inc/admin/admin-functions.php:34
39
+ msgid "Support"
40
+ msgstr ""
41
+
42
+ #: inc/admin/admin-functions.php:58
43
+ msgid "Channel"
44
+ msgstr ""
45
+
46
+ #: inc/admin/admin-functions.php:60
47
+ msgid "Eg: UCNrD5PWitIbhVK8ID or smashballoon."
48
+ msgstr ""
49
+
50
+ #: inc/admin/admin-functions.php:61
51
+ msgid "Show the latest videos from a YouTube channel."
52
+ msgstr ""
53
+
54
+ #: inc/admin/admin-functions.php:71
55
+ msgid "List"
56
+ msgstr ""
57
+
58
+ #: inc/admin/admin-functions.php:73
59
+ msgid "A single columns of videos that play when clicked."
60
+ msgstr ""
61
+
62
+ #: inc/admin/admin-functions.php:77
63
+ msgid "Grid"
64
+ msgstr ""
65
+
66
+ #: inc/admin/admin-functions.php:79
67
+ msgid ""
68
+ "Video thumbnails are displayed in columns and play in a lightbox when "
69
+ "clicked."
70
+ msgstr ""
71
+
72
+ #: inc/admin/admin-functions.php:84 inc/admin/admin-functions.php:110
73
+ msgid "Columns"
74
+ msgstr ""
75
+
76
+ #: inc/admin/admin-functions.php:93 inc/admin/admin-functions.php:119
77
+ msgid "Mobile Columns"
78
+ msgstr ""
79
+
80
+ #: inc/admin/admin-functions.php:103
81
+ msgid "Gallery"
82
+ msgstr ""
83
+
84
+ #: inc/admin/admin-functions.php:105
85
+ msgid ""
86
+ "One large video that plays when clicked with thumbnails underneath to play "
87
+ "more."
88
+ msgstr ""
89
+
90
+ #: inc/admin/admin-functions.php:134
91
+ msgid "Configure Options"
92
+ msgstr ""
93
+
94
+ #: inc/admin/admin-functions.php:138
95
+ msgid "Customize Options"
96
+ msgstr ""
97
+
98
+ #: inc/admin/admin-functions.php:142
99
+ msgid "Layout Options"
100
+ msgstr ""
101
+
102
+ #: inc/admin/admin-functions.php:146
103
+ msgid "Header Options"
104
+ msgstr ""
105
+
106
+ #: inc/admin/admin-functions.php:150
107
+ msgid "\"Load More\" Button Options"
108
+ msgstr ""
109
+
110
+ #: inc/admin/admin-functions.php:154
111
+ msgid "\"Subscribe\" Button Options"
112
+ msgstr ""
113
+
114
+ #: inc/admin/admin-functions.php:284
115
+ msgid ""
116
+ "Could not connect your account. Please check to make sure this is a valid "
117
+ "access token for the Smash Balloon YouTube App."
118
+ msgstr ""
119
+
120
+ #: inc/admin/class-sbspf-admin.php:102
121
+ msgid "Feed Type"
122
+ msgstr ""
123
+
124
+ #: inc/admin/class-sbspf-admin.php:106
125
+ msgid "Display videos from a YouTube channel (channel)"
126
+ msgstr ""
127
+
128
+ #: inc/admin/class-sbspf-admin.php:117
129
+ msgid "Preserve settings when plugin is removed"
130
+ msgstr ""
131
+
132
+ #: inc/admin/class-sbspf-admin.php:119
133
+ msgid ""
134
+ "When removing the plugin your settings are automatically erased. Checking "
135
+ "this box will prevent any settings from being deleted. This means that you "
136
+ "can uninstall and reinstall the plugin without losing your settings."
137
+ msgstr ""
138
+
139
+ #: inc/admin/class-sbspf-admin.php:128
140
+ msgid "Check for new posts"
141
+ msgstr ""
142
+
143
+ #: inc/admin/class-sbspf-admin.php:136
144
+ msgid "General"
145
+ msgstr ""
146
+
147
+ #: inc/admin/class-sbspf-admin.php:162
148
+ msgid "Width of Feed"
149
+ msgstr ""
150
+
151
+ #: inc/admin/class-sbspf-admin.php:166
152
+ msgid "The width of your feed. Any number with a unit like \"px\" or \"%\"."
153
+ msgstr ""
154
+
155
+ #: inc/admin/class-sbspf-admin.php:174
156
+ msgid "Set to be 100% width on mobile?"
157
+ msgstr ""
158
+
159
+ #: inc/admin/class-sbspf-admin.php:177
160
+ #, php-format
161
+ msgid ""
162
+ "If you set a width on the feed then this will be used on mobile as well as "
163
+ "desktop. Check this setting to set the feed width to be 100% on mobile so "
164
+ "that it is responsive."
165
+ msgstr ""
166
+
167
+ #: inc/admin/class-sbspf-admin.php:199
168
+ msgid "Height of Feed"
169
+ msgstr ""
170
+
171
+ #: inc/admin/class-sbspf-admin.php:203
172
+ msgid "The height of your feed. Any number with a unit like \"px\" or \"em\"."
173
+ msgstr ""
174
+
175
+ #: inc/admin/class-sbspf-admin.php:216
176
+ msgid "Background Color"
177
+ msgstr ""
178
+
179
+ #: inc/admin/class-sbspf-admin.php:220
180
+ msgid "Background color for the feed. Any hex color code."
181
+ msgstr ""
182
+
183
+ #: inc/admin/class-sbspf-admin.php:227
184
+ msgid "Layout"
185
+ msgstr ""
186
+
187
+ #: inc/admin/class-sbspf-admin.php:238
188
+ msgid "Layout Type"
189
+ msgstr ""
190
+
191
+ #: inc/admin/class-sbspf-admin.php:243
192
+ msgid "How your posts are display visually."
193
+ msgstr ""
194
+
195
+ #: inc/admin/class-sbspf-admin.php:383
196
+ msgid "Yes"
197
+ msgstr ""
198
+
199
+ #: inc/admin/class-sbspf-admin.php:534
200
+ msgid "Connect an account above"
201
+ msgstr ""
202
+
203
+ #: inc/admin/class-sbspf-admin.php:565 inc/admin/class-sby-admin.php:354
204
+ msgid "When the page loads"
205
+ msgstr ""
206
+
207
+ #: inc/admin/class-sbspf-admin.php:567 inc/admin/class-sby-admin.php:356
208
+ #, php-format
209
+ msgid ""
210
+ "Your %s data is temporarily cached by the plugin in your WordPress database. "
211
+ "There are two ways that you can set the plugin to check for new data:"
212
+ "<br><br>\n"
213
+ " <b>1. When the page loads</b><br>Selecting this option means "
214
+ "that when the cache expires then the plugin will check %s for new posts the "
215
+ "next time that the feed is loaded. You can choose how long this data should "
216
+ "be cached for. If you set the time to 60 minutes then the plugin will clear "
217
+ "the cached data after that length of time, and the next time the page is "
218
+ "viewed it will check for new data. <b>Tip:</b> If you're experiencing an "
219
+ "issue with the plugin not updating automatically then try enabling the "
220
+ "setting labeled <b>'Force cache to clear on interval'</b> which is located "
221
+ "on the 'Customize' tab.<br><br>\n"
222
+ " <b>2. In the background</b><br>Selecting this option means "
223
+ "that the plugin will check for new data in the background so that the feed "
224
+ "is updated behind the scenes. You can select at what time and how often the "
225
+ "plugin should check for new data using the settings below. <b>Please note</"
226
+ "b> that the plugin will initially check for data from Instagram when the "
227
+ "page first loads, but then after that will check in the background on the "
228
+ "schedule selected - unless the cache is cleared."
229
+ msgstr ""
230
+
231
+ #: inc/admin/class-sbspf-admin.php:573 inc/admin/class-sby-admin.php:362
232
+ msgid "Every"
233
+ msgstr ""
234
+
235
+ #: inc/admin/class-sbspf-admin.php:576 inc/admin/class-sby-admin.php:365
236
+ msgid "Minutes"
237
+ msgstr ""
238
+
239
+ #: inc/admin/class-sbspf-admin.php:577 inc/admin/class-sby-admin.php:366
240
+ msgid "Hours"
241
+ msgstr ""
242
+
243
+ #: inc/admin/class-sbspf-admin.php:578 inc/admin/class-sby-admin.php:367
244
+ msgid "Days"
245
+ msgstr ""
246
+
247
+ #: inc/admin/class-sbspf-admin.php:580 inc/admin/class-sbspf-admin.php:847
248
+ #: inc/admin/class-sby-admin.php:369
249
+ msgid "What does this mean?"
250
+ msgstr ""
251
+
252
+ #: inc/admin/class-sbspf-admin.php:581 inc/admin/class-sby-admin.php:370
253
+ #, php-format
254
+ msgid ""
255
+ "Your %s posts are temporarily cached by the plugin in your WordPress "
256
+ "database. You can choose how long the posts should be cached for. If you set "
257
+ "the time to 1 hour then the plugin will clear the cache after that length of "
258
+ "time and check %s for posts again."
259
+ msgstr ""
260
+
261
+ #: inc/admin/class-sbspf-admin.php:586 inc/admin/class-sby-admin.php:375
262
+ msgid "In the background"
263
+ msgstr ""
264
+
265
+ #: inc/admin/class-sbspf-admin.php:591 inc/admin/class-sby-admin.php:380
266
+ #: youtube-feed.php:180
267
+ msgid "Every 30 minutes"
268
+ msgstr ""
269
+
270
+ #: inc/admin/class-sbspf-admin.php:592 inc/admin/class-sby-admin.php:381
271
+ msgid "Every hour"
272
+ msgstr ""
273
+
274
+ #: inc/admin/class-sbspf-admin.php:593 inc/admin/class-sby-admin.php:382
275
+ msgid "Every 12 hours"
276
+ msgstr ""
277
+
278
+ #: inc/admin/class-sbspf-admin.php:594 inc/admin/class-sby-admin.php:383
279
+ msgid "Every 24 hours"
280
+ msgstr ""
281
+
282
+ #: inc/admin/class-sbspf-admin.php:598 inc/admin/class-sby-admin.php:387
283
+ msgid "at"
284
+ msgstr ""
285
+
286
+ #: inc/admin/class-sbspf-admin.php:615 inc/admin/class-sby-admin.php:404
287
+ msgid "AM"
288
+ msgstr ""
289
+
290
+ #: inc/admin/class-sbspf-admin.php:616 inc/admin/class-sby-admin.php:405
291
+ msgid "PM"
292
+ msgstr ""
293
+
294
+ #: inc/admin/class-sbspf-admin.php:628 inc/admin/class-sby-admin.php:417
295
+ msgid "every 30 minutes"
296
+ msgstr ""
297
+
298
+ #: inc/admin/class-sbspf-admin.php:629 inc/admin/class-sby-admin.php:418
299
+ msgid "every 12 hours"
300
+ msgstr ""
301
+
302
+ #: inc/admin/class-sbspf-admin.php:631 inc/admin/class-sby-admin.php:420
303
+ msgid "Next check"
304
+ msgstr ""
305
+
306
+ #: inc/admin/class-sbspf-admin.php:631 inc/admin/class-sby-admin.php:420
307
+ msgid ""
308
+ "Note: Saving the settings on this page will clear the cache and reset this "
309
+ "schedule"
310
+ msgstr ""
311
+
312
+ #: inc/admin/class-sbspf-admin.php:633 inc/admin/class-sby-admin.php:422
313
+ msgid "Nothing currently scheduled"
314
+ msgstr ""
315
+
316
+ #: inc/admin/class-sbspf-admin.php:666
317
+ msgid "Click for shortcode option"
318
+ msgstr ""
319
+
320
+ #: inc/admin/class-sby-admin.php:19
321
+ msgid "Number of Videos"
322
+ msgstr ""
323
+
324
+ #: inc/admin/class-sby-admin.php:20
325
+ msgid "Number of videos to show initially."
326
+ msgstr ""
327
+
328
+ #: inc/admin/class-sby-admin.php:24
329
+ msgid "The number of videos in the feed"
330
+ msgstr ""
331
+
332
+ #: inc/admin/class-sby-admin.php:47
333
+ msgid "Spacing between videos"
334
+ msgstr ""
335
+
336
+ #: inc/admin/class-sby-admin.php:51
337
+ msgid ""
338
+ "The spacing/padding around the videos in the feed. Any number with a unit "
339
+ "like \"px\" or \"em\"."
340
+ msgstr ""
341
+
342
+ #: inc/admin/class-sby-admin.php:60
343
+ msgid "Header"
344
+ msgstr ""
345
+
346
+ #: inc/admin/class-sby-admin.php:70
347
+ msgid "Show Header"
348
+ msgstr ""
349
+
350
+ #: inc/admin/class-sby-admin.php:75
351
+ msgid "Include a header for this feed."
352
+ msgstr ""
353
+
354
+ #: inc/admin/class-sby-admin.php:85
355
+ msgid "Show Channel Description"
356
+ msgstr ""
357
+
358
+ #: inc/admin/class-sby-admin.php:90
359
+ msgid "Include the channel description in the header."
360
+ msgstr ""
361
+
362
+ #: inc/admin/class-sby-admin.php:97
363
+ msgid "\"Load More\" Button"
364
+ msgstr ""
365
+
366
+ #: inc/admin/class-sby-admin.php:107
367
+ msgid "Show \"Load More\" Button"
368
+ msgstr ""
369
+
370
+ #: inc/admin/class-sby-admin.php:112
371
+ msgid ""
372
+ "Include a \"Load More\" button at the bottom of the feed to load more videos."
373
+ msgstr ""
374
+
375
+ #: inc/admin/class-sby-admin.php:123
376
+ msgid "Button Background Color"
377
+ msgstr ""
378
+
379
+ #: inc/admin/class-sby-admin.php:127
380
+ msgid "Background color for the \"Load More\" button. Any hex color code."
381
+ msgstr ""
382
+
383
+ #: inc/admin/class-sby-admin.php:138
384
+ msgid "Button Text Color"
385
+ msgstr ""
386
+
387
+ #: inc/admin/class-sby-admin.php:142
388
+ msgid "Text color for the \"Load More\" button. Any hex color code."
389
+ msgstr ""
390
+
391
+ #: inc/admin/class-sby-admin.php:150 youtube-feed.php:412
392
+ msgid "Load More..."
393
+ msgstr "Charger plus…"
394
+
395
+ #: inc/admin/class-sby-admin.php:153
396
+ msgid "Button Text"
397
+ msgstr ""
398
+
399
+ #: inc/admin/class-sby-admin.php:157
400
+ msgid "The text that appers on the \"Load More\" button."
401
+ msgstr ""
402
+
403
+ #: inc/admin/class-sby-admin.php:165
404
+ msgid "\"Subscribe\" Button"
405
+ msgstr ""
406
+
407
+ #: inc/admin/class-sby-admin.php:176
408
+ msgid "Show \"Subscribe\" Button"
409
+ msgstr ""
410
+
411
+ #: inc/admin/class-sby-admin.php:181
412
+ msgid ""
413
+ "Include a \"Subscribe\" button at the bottom of the feed to load more videos."
414
+ msgstr ""
415
+
416
+ #: inc/admin/class-sby-admin.php:192
417
+ msgid "Subscribe Background Color"
418
+ msgstr ""
419
+
420
+ #: inc/admin/class-sby-admin.php:196
421
+ msgid "Background color for the \"Subscribe\" button. Any hex color code."
422
+ msgstr ""
423
+
424
+ #: inc/admin/class-sby-admin.php:207
425
+ msgid "Subscribe Text Color"
426
+ msgstr ""
427
+
428
+ #: inc/admin/class-sby-admin.php:211
429
+ msgid "Text color for the \"Subscribe\" button. Any hex color code."
430
+ msgstr ""
431
+
432
+ #: inc/admin/class-sby-admin.php:219 youtube-feed.php:413
433
+ msgid "Subscribe"
434
+ msgstr "S'abonner"
435
+
436
+ #: inc/admin/class-sby-admin.php:222
437
+ msgid "Subscribe Text"
438
+ msgstr ""
439
+
440
+ #: inc/admin/class-sby-admin.php:226
441
+ msgid "The text that appers on the \"Subscribe\" button."
442
+ msgstr ""
443
+
444
+ #: inc/admin/class-sby-admin.php:233
445
+ msgid "Video Experience"
446
+ msgstr ""
447
+
448
+ #: inc/admin/class-sby-admin.php:241
449
+ msgid "Play when clicked"
450
+ msgstr ""
451
+
452
+ #: inc/admin/class-sby-admin.php:254
453
+ msgid "When does video play?"
454
+ msgstr ""
455
+
456
+ #: inc/admin/class-sby-admin.php:258
457
+ msgid "What the user needs to do to play a video. eg."
458
+ msgstr ""
459
+
460
+ #: inc/admin/class-sby-admin.php:262
461
+ msgid ""
462
+ "List layout will not play automatically. Choose whether to play the video "
463
+ "automatically in the player or wait until the user clicks the play button "
464
+ "after the video is loaded."
465
+ msgstr ""
466
+
467
+ #: inc/admin/class-sby-admin.php:267
468
+ msgid "Custom Code Snippets"
469
+ msgstr ""
470
+
471
+ #: inc/admin/class-sby-admin.php:278
472
+ msgid "Custom CSS"
473
+ msgstr ""
474
+
475
+ #: inc/admin/class-sby-admin.php:280
476
+ msgid "Enter your own custom CSS in the box below"
477
+ msgstr ""
478
+
479
+ #: inc/admin/class-sby-admin.php:289
480
+ msgid "Custom JavaScript"
481
+ msgstr ""
482
+
483
+ #: inc/admin/class-sby-admin.php:291
484
+ msgid "Enter your own custom JavaScript/jQuery in the box below"
485
+ msgstr ""
486
+
487
+ #: inc/admin/class-sby-admin.php:292
488
+ msgid ""
489
+ "Note: Custom JavaScript reruns every time more videos are loaded into the "
490
+ "feed"
491
+ msgstr ""
492
+
493
+ #: inc/admin/class-sby-admin.php:297
494
+ msgid "Advanced"
495
+ msgstr ""
496
+
497
+ #: inc/admin/class-sby-admin.php:305
498
+ msgid "Background"
499
+ msgstr ""
500
+
501
+ #: inc/admin/class-sby-admin.php:309
502
+ msgid "Page"
503
+ msgstr ""
504
+
505
+ #: inc/admin/class-sby-admin.php:313
506
+ msgid "None"
507
+ msgstr ""
508
+
509
+ #: inc/admin/class-sby-admin.php:323
510
+ msgid "Local storage process"
511
+ msgstr ""
512
+
513
+ #: inc/admin/class-sby-admin.php:326
514
+ msgid ""
515
+ "To preserve your feeds and videos even if the YouTube API is unavailable, a "
516
+ "record of each video is added to the wp_posts table in the WordPress "
517
+ "database."
518
+ msgstr ""
519
+
520
+ #: inc/admin/class-sby-admin.php:334
521
+ msgid "Are you using an AJAX theme?"
522
+ msgstr ""
523
+
524
+ #: inc/admin/class-sby-admin.php:336
525
+ msgid ""
526
+ "When navigating your site, if your theme uses Ajax to load content into your "
527
+ "pages (meaning your page doesn't refresh) then check this setting. If you're "
528
+ "not sure then it's best to leave this setting unchecked while checking with "
529
+ "your theme author, otherwise checking it may cause a problem."
530
+ msgstr ""
531
+
532
+ #: inc/admin/templates/configure.php:3
533
+ #, php-format
534
+ msgid "Log in to %s and connect an account"
535
+ msgstr ""
536
+
537
+ #: inc/admin/templates/configure.php:4
538
+ msgid "Button not working?"
539
+ msgstr ""
540
+
541
+ #: inc/admin/templates/configure.php:15
542
+ #, php-format
543
+ msgid "Or, manually enter my own %s API key"
544
+ msgstr ""
545
+
546
+ #: inc/admin/templates/configure.php:18
547
+ msgid ""
548
+ "Check this box if you would like to manually enter your own API key. To "
549
+ "generate an api key use <a href=\"https://smashballoon.com/youtube-api-key/"
550
+ "\" target=\"_blank\" rel=\"noopener\">these instructions.</a>"
551
+ msgstr ""
552
+
553
+ #: inc/admin/templates/configure.php:24
554
+ msgid "API Key"
555
+ msgstr ""
556
+
557
+ #: inc/admin/templates/configure.php:40 inc/admin/templates/customize.php:8
558
+ msgid "Save Changes"
559
+ msgstr ""
560
+
561
+ #: inc/admin/templates/connected-accounts.php:9
562
+ #, php-format
563
+ msgid "%s Accounts"
564
+ msgstr ""
565
+
566
+ #: inc/admin/templates/connected-accounts.php:10
567
+ #, php-format
568
+ msgid "Use the button above to connect %s account"
569
+ msgstr ""
570
+
571
+ #: inc/admin/templates/connected-accounts.php:14
572
+ #, php-format
573
+ msgid "No %s accounts connected. Click the button above to connect an account."
574
+ msgstr ""
575
+
576
+ #: inc/admin/templates/connected-accounts.php:33
577
+ msgid "Manually Connect a Primary Account"
578
+ msgstr ""
579
+
580
+ #: inc/admin/templates/connected-accounts.php:35
581
+ msgid "Enter a valid Access Token"
582
+ msgstr ""
583
+
584
+ #: inc/admin/templates/connected-accounts.php:36
585
+ msgid "Enter a valid Refresh Token"
586
+ msgstr ""
587
+
588
+ #: inc/admin/templates/connected-accounts.php:37
589
+ msgid "Connect This Account"
590
+ msgstr ""
591
+
592
+ #: inc/admin/templates/display.php:1
593
+ msgid "Display your Feed"
594
+ msgstr ""
595
+
596
+ #: inc/admin/templates/display.php:2
597
+ msgid ""
598
+ "Copy and paste the following shortcode directly into the page, post or "
599
+ "widget where you'd like the feed to show up:"
600
+ msgstr ""
601
+
602
+ #: inc/admin/templates/display.php:3 inc/admin/templates/main.php:59
603
+ #: inc/admin/templates/single-connected-account.php:39
604
+ #: inc/admin/templates/single-connected-account.php:40
605
+ #: inc/admin/templates/single-connected-account.php:41
606
+ msgid "To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)."
607
+ msgstr ""
608
+
609
+ #: inc/admin/templates/display.php:5
610
+ msgid "Multiple Feeds"
611
+ msgstr ""
612
+
613
+ #: inc/admin/templates/display.php:6
614
+ msgid ""
615
+ "If you'd like to display multiple feeds then you can set different settings "
616
+ "directly in the shortcode like so:"
617
+ msgstr ""
618
+
619
+ #: inc/admin/templates/display.php:8
620
+ msgid ""
621
+ "You can display as many different feeds as you like, on either the same page "
622
+ "or on different pages, by just using the shortcode options below. For "
623
+ "example:"
624
+ msgstr ""
625
+
626
+ #: inc/admin/templates/display.php:13
627
+ msgid "See the table below for a full list of available shortcode options:"
628
+ msgstr ""
629
+
630
+ #: inc/admin/templates/display.php:18
631
+ msgid "Shortcode option"
632
+ msgstr ""
633
+
634
+ #: inc/admin/templates/display.php:19
635
+ msgid "Description"
636
+ msgstr ""
637
+
638
+ #: inc/admin/templates/display.php:20
639
+ msgid "Example"
640
+ msgstr ""
641
+
642
+ #: inc/admin/templates/display.php:37 inc/admin/templates/support.php:1
643
+ msgid "Need help?"
644
+ msgstr ""
645
+
646
+ #: inc/admin/templates/display.php:37
647
+ msgid "Get Support"
648
+ msgstr ""
649
+
650
+ #: inc/admin/templates/main.php:17
651
+ msgid "Settings saved."
652
+ msgstr ""
653
+
654
+ #: inc/admin/templates/main.php:50
655
+ msgid "Next Step"
656
+ msgstr ""
657
+
658
+ #: inc/admin/templates/main.php:54
659
+ msgid "Need help setting up the plugin? Check out our <a href=\""
660
+ msgstr ""
661
+
662
+ #: inc/admin/templates/main.php:58
663
+ msgid ""
664
+ "Copy and paste this shortcode directly into the page, post or widget where "
665
+ "you'd like to display the feed:"
666
+ msgstr ""
667
+
668
+ #: inc/admin/templates/main.php:60
669
+ msgid "Find out how to display <a href='?page="
670
+ msgstr ""
671
+
672
+ #: inc/admin/templates/single-connected-account.php:4
673
+ msgid ""
674
+ "The Access Token for this account is expired or invalid. Click the button "
675
+ "above to attempt to renew it."
676
+ msgstr ""
677
+
678
+ #: inc/admin/templates/single-connected-account.php:9
679
+ msgid "Remove"
680
+ msgstr ""
681
+
682
+ #: inc/admin/templates/single-connected-account.php:14
683
+ msgid "Channel ID:"
684
+ msgstr ""
685
+
686
+ #: inc/admin/templates/single-connected-account.php:18
687
+ msgid "Add to another Feed"
688
+ msgstr ""
689
+
690
+ #: inc/admin/templates/single-connected-account.php:19
691
+ msgid "Show access token and account info"
692
+ msgstr ""
693
+
694
+ #: inc/admin/templates/single-connected-account.php:24
695
+ msgid "Copy and paste this shortcode into your page or widget area"
696
+ msgstr ""
697
+
698
+ #: inc/admin/templates/single-connected-account.php:32
699
+ msgid ""
700
+ "To add multiple channels in the same feed, simply separate them using commas"
701
+ msgstr ""
702
+
703
+ #: inc/admin/templates/single-connected-account.php:35
704
+ #, php-format
705
+ msgid "Click on the %s tab to learn more about shortcodes"
706
+ msgstr ""
707
+
708
+ #: inc/admin/templates/single-connected-account.php:35
709
+ msgid "Display Your Feed"
710
+ msgstr ""
711
+
712
+ #: inc/admin/templates/single-connected-account.php:39
713
+ msgid "Access Token"
714
+ msgstr ""
715
+
716
+ #: inc/admin/templates/single-connected-account.php:40
717
+ msgid "Refresh Token"
718
+ msgstr ""
719
+
720
+ #: inc/admin/templates/single-connected-account.php:41
721
+ msgid "Channel ID"
722
+ msgstr ""
723
+
724
+ #: inc/admin/templates/support.php:3
725
+ msgid "Check out our "
726
+ msgstr ""
727
+
728
+ #: inc/admin/templates/support.php:3
729
+ msgid "setup directions"
730
+ msgstr ""
731
+
732
+ #: inc/admin/templates/support.php:3
733
+ msgid "for a step-by-step guide on how to setup and use the plugin"
734
+ msgstr ""
735
+
736
+ #: inc/admin/templates/support.php:5
737
+ msgid "Have a problem? Submit a "
738
+ msgstr ""
739
+
740
+ #: inc/admin/templates/support.php:5
741
+ msgid "support ticket"
742
+ msgstr ""
743
+
744
+ #: inc/admin/templates/support.php:5
745
+ msgid "on our website"
746
+ msgstr ""
747
+
748
+ #: inc/admin/templates/support.php:5
749
+ msgid "Please include your <b>System Info</b> below with all support requests."
750
+ msgstr ""
751
+
752
+ #: inc/admin/templates/support.php:8
753
+ msgid "System Info"
754
+ msgstr ""
755
+
756
+ #: inc/admin/templates/support.php:8
757
+ msgid "Click the text below to select all"
758
+ msgstr ""
759
+
760
+ #: inc/class-sby-api-connect.php:102
761
+ #, php-format
762
+ msgid "Error: %s."
763
+ msgstr ""
764
+
765
+ #: inc/class-sby-api-connect.php:104
766
+ msgid ""
767
+ "There's an issue with the YouTube API Key that you are using. Please check "
768
+ "to make sure that this is a valid API Key."
769
+ msgstr ""
770
+
771
+ #: inc/class-sby-api-connect.php:118
772
+ #, php-format
773
+ msgid "Error connecting to %s."
774
+ msgstr ""
775
+
776
+ #: inc/class-sby-feed.php:737
777
+ msgid "Error: No videos found."
778
+ msgstr ""
779
+
780
+ #: inc/class-sby-feed.php:738
781
+ msgid ""
782
+ "Make sure this is a valid channel ID and that the channel has videos "
783
+ "available on youtube.com."
784
+ msgstr ""
785
+
786
+ #: inc/class-sby-feed.php:863
787
+ msgid "No posts found."
788
+ msgstr ""
789
+
790
+ #: inc/class-sby-posts-manager.php:235
791
+ msgid "There was an error creating the folder for storing resized images."
792
+ msgstr ""
793
+
794
+ #: inc/class-sby-posts-manager.php:323
795
+ msgid "Notice: API requests are being delayed for 5 minutes."
796
+ msgstr ""
797
+
798
+ #: inc/class-sby-posts-manager.php:323
799
+ msgid "Feed will not update."
800
+ msgstr ""
801
+
802
+ #: inc/class-sby-posts-manager.php:332
803
+ msgid ""
804
+ "There may be an issue with the YouTube access token that you are using. Your "
805
+ "server might also be unable to connect to YouTube at this time."
806
+ msgstr ""
807
+
808
+ #: inc/sby-functions.php:21 inc/sby-functions.php:137
809
+ msgid "This error message is only visible to WordPress admins"
810
+ msgstr ""
811
+
812
+ #: inc/sby-functions.php:22
813
+ msgid "Error: No connected account."
814
+ msgstr ""
815
+
816
+ #: inc/sby-functions.php:23
817
+ msgid "Please go to the YouTube Feed settings page to connect an account."
818
+ msgstr ""
819
+
820
+ #: inc/widget.php:13 youtube-feed.php:94
821
+ msgid "YouTube Feed"
822
+ msgstr ""
823
+
824
+ #: inc/widget.php:14
825
+ msgid "Display your YouTube feed"
826
+ msgstr ""
827
+
828
+ #: inc/widget.php:40
829
+ msgid "Title:"
830
+ msgstr ""
831
+
832
+ #: templates/item.php:22 templates/player.php:10
833
+ msgid "Image for post"
834
+ msgstr ""
835
+
836
+ #: templates/item.php:34 templates/player.php:17
837
+ #, php-format
838
+ msgid "YouTube Video %s"
839
+ msgstr ""
840
+
841
+ #: youtube-feed.php:97
842
+ msgid "a"
843
+ msgstr ""
844
+
845
+ #: youtube-feed.php:100
846
+ msgid "YouTube"
847
+ msgstr ""
848
+
849
+ #: youtube-feed.php:125
850
+ msgid "Videos"
851
+ msgstr ""
852
+
853
+ #: youtube-feed.php:126
854
+ msgid " "
855
+ msgstr ""
856
+
857
+ #: youtube-feed.php:127 youtube-feed.php:128
858
+ msgid "Add New Video"
859
+ msgstr ""
860
+
861
+ #: youtube-feed.php:129
862
+ msgid "Edit Video"
863
+ msgstr ""
864
+
865
+ #: youtube-feed.php:130
866
+ msgid "View Video"
867
+ msgstr ""
868
+
869
+ #: youtube-feed.php:131
870
+ msgid "All Videos"
871
+ msgstr ""
872
+
873
+ #: youtube-feed.php:441
874
+ msgid "Settings"
875
+ msgstr ""
languages/youtube-feed.pot ADDED
@@ -0,0 +1,875 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "POT-Creation-Date: 2019-11-29 14:34-0600\n"
5
+ "PO-Revision-Date: 2019-11-29 14:35-0600\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: \n"
8
+ "Language: en_US\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.2.4\n"
13
+ "X-Poedit-Basepath: ..\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "X-Poedit-KeywordsList: __;_e;esc_html__;esc_html_e;esc_attr_e;esc_attr__\n"
16
+ "X-Poedit-SearchPath-0: .\n"
17
+
18
+ #: inc/admin/admin-functions.php:17 inc/admin/templates/configure.php:1
19
+ msgid "Configure"
20
+ msgstr ""
21
+
22
+ #: inc/admin/admin-functions.php:20
23
+ msgid "Customize your feed"
24
+ msgstr ""
25
+
26
+ #: inc/admin/admin-functions.php:23
27
+ msgid "Customize"
28
+ msgstr ""
29
+
30
+ #: inc/admin/admin-functions.php:26 inc/admin/templates/main.php:57
31
+ msgid "Display your feed"
32
+ msgstr ""
33
+
34
+ #: inc/admin/admin-functions.php:29
35
+ msgid "Display"
36
+ msgstr ""
37
+
38
+ #: inc/admin/admin-functions.php:34
39
+ msgid "Support"
40
+ msgstr ""
41
+
42
+ #: inc/admin/admin-functions.php:58
43
+ msgid "Channel"
44
+ msgstr ""
45
+
46
+ #: inc/admin/admin-functions.php:60
47
+ msgid "Eg: UCNrD5PWitIbhVK8ID or smashballoon."
48
+ msgstr ""
49
+
50
+ #: inc/admin/admin-functions.php:61
51
+ msgid "Show the latest videos from a YouTube channel."
52
+ msgstr ""
53
+
54
+ #: inc/admin/admin-functions.php:71
55
+ msgid "List"
56
+ msgstr ""
57
+
58
+ #: inc/admin/admin-functions.php:73
59
+ msgid "A single columns of videos that play when clicked."
60
+ msgstr ""
61
+
62
+ #: inc/admin/admin-functions.php:77
63
+ msgid "Grid"
64
+ msgstr ""
65
+
66
+ #: inc/admin/admin-functions.php:79
67
+ msgid ""
68
+ "Video thumbnails are displayed in columns and play in a lightbox when "
69
+ "clicked."
70
+ msgstr ""
71
+
72
+ #: inc/admin/admin-functions.php:84 inc/admin/admin-functions.php:110
73
+ msgid "Columns"
74
+ msgstr ""
75
+
76
+ #: inc/admin/admin-functions.php:93 inc/admin/admin-functions.php:119
77
+ msgid "Mobile Columns"
78
+ msgstr ""
79
+
80
+ #: inc/admin/admin-functions.php:103
81
+ msgid "Gallery"
82
+ msgstr ""
83
+
84
+ #: inc/admin/admin-functions.php:105
85
+ msgid ""
86
+ "One large video that plays when clicked with thumbnails underneath to play "
87
+ "more."
88
+ msgstr ""
89
+
90
+ #: inc/admin/admin-functions.php:134
91
+ msgid "Configure Options"
92
+ msgstr ""
93
+
94
+ #: inc/admin/admin-functions.php:138
95
+ msgid "Customize Options"
96
+ msgstr ""
97
+
98
+ #: inc/admin/admin-functions.php:142
99
+ msgid "Layout Options"
100
+ msgstr ""
101
+
102
+ #: inc/admin/admin-functions.php:146
103
+ msgid "Header Options"
104
+ msgstr ""
105
+
106
+ #: inc/admin/admin-functions.php:150
107
+ msgid "\"Load More\" Button Options"
108
+ msgstr ""
109
+
110
+ #: inc/admin/admin-functions.php:154
111
+ msgid "\"Subscribe\" Button Options"
112
+ msgstr ""
113
+
114
+ #: inc/admin/admin-functions.php:284
115
+ msgid ""
116
+ "Could not connect your account. Please check to make sure this is a valid "
117
+ "access token for the Smash Balloon YouTube App."
118
+ msgstr ""
119
+
120
+ #: inc/admin/class-sbspf-admin.php:102
121
+ msgid "Feed Type"
122
+ msgstr ""
123
+
124
+ #: inc/admin/class-sbspf-admin.php:106
125
+ msgid "Display videos from a YouTube channel (channel)"
126
+ msgstr ""
127
+
128
+ #: inc/admin/class-sbspf-admin.php:117
129
+ msgid "Preserve settings when plugin is removed"
130
+ msgstr ""
131
+
132
+ #: inc/admin/class-sbspf-admin.php:119
133
+ msgid ""
134
+ "When removing the plugin your settings are automatically erased. Checking "
135
+ "this box will prevent any settings from being deleted. This means that you "
136
+ "can uninstall and reinstall the plugin without losing your settings."
137
+ msgstr ""
138
+
139
+ #: inc/admin/class-sbspf-admin.php:128
140
+ msgid "Check for new posts"
141
+ msgstr ""
142
+
143
+ #: inc/admin/class-sbspf-admin.php:136
144
+ msgid "General"
145
+ msgstr ""
146
+
147
+ #: inc/admin/class-sbspf-admin.php:162
148
+ msgid "Width of Feed"
149
+ msgstr ""
150
+
151
+ #: inc/admin/class-sbspf-admin.php:166
152
+ msgid "The width of your feed. Any number with a unit like \"px\" or \"%\"."
153
+ msgstr ""
154
+
155
+ #: inc/admin/class-sbspf-admin.php:174
156
+ msgid "Set to be 100% width on mobile?"
157
+ msgstr ""
158
+
159
+ #: inc/admin/class-sbspf-admin.php:177
160
+ #, php-format
161
+ msgid ""
162
+ "If you set a width on the feed then this will be used on mobile as well as "
163
+ "desktop. Check this setting to set the feed width to be 100% on mobile so "
164
+ "that it is responsive."
165
+ msgstr ""
166
+
167
+ #: inc/admin/class-sbspf-admin.php:199
168
+ msgid "Height of Feed"
169
+ msgstr ""
170
+
171
+ #: inc/admin/class-sbspf-admin.php:203
172
+ msgid "The height of your feed. Any number with a unit like \"px\" or \"em\"."
173
+ msgstr ""
174
+
175
+ #: inc/admin/class-sbspf-admin.php:216
176
+ msgid "Background Color"
177
+ msgstr ""
178
+
179
+ #: inc/admin/class-sbspf-admin.php:220
180
+ msgid "Background color for the feed. Any hex color code."
181
+ msgstr ""
182
+
183
+ #: inc/admin/class-sbspf-admin.php:227
184
+ msgid "Layout"
185
+ msgstr ""
186
+
187
+ #: inc/admin/class-sbspf-admin.php:238
188
+ msgid "Layout Type"
189
+ msgstr ""
190
+
191
+ #: inc/admin/class-sbspf-admin.php:243
192
+ msgid "How your posts are display visually."
193
+ msgstr ""
194
+
195
+ #: inc/admin/class-sbspf-admin.php:383
196
+ msgid "Yes"
197
+ msgstr ""
198
+
199
+ #: inc/admin/class-sbspf-admin.php:534
200
+ msgid "Connect an account above"
201
+ msgstr ""
202
+
203
+ #: inc/admin/class-sbspf-admin.php:565 inc/admin/class-sby-admin.php:354
204
+ msgid "When the page loads"
205
+ msgstr ""
206
+
207
+ #: inc/admin/class-sbspf-admin.php:567 inc/admin/class-sby-admin.php:356
208
+ #, php-format
209
+ msgid ""
210
+ "Your %s data is temporarily cached by the plugin in your WordPress database. "
211
+ "There are two ways that you can set the plugin to check for new data:"
212
+ "<br><br>\n"
213
+ " <b>1. When the page loads</b><br>Selecting this option means "
214
+ "that when the cache expires then the plugin will check %s for new posts the "
215
+ "next time that the feed is loaded. You can choose how long this data should "
216
+ "be cached for. If you set the time to 60 minutes then the plugin will clear "
217
+ "the cached data after that length of time, and the next time the page is "
218
+ "viewed it will check for new data. <b>Tip:</b> If you're experiencing an "
219
+ "issue with the plugin not updating automatically then try enabling the "
220
+ "setting labeled <b>'Force cache to clear on interval'</b> which is located "
221
+ "on the 'Customize' tab.<br><br>\n"
222
+ " <b>2. In the background</b><br>Selecting this option means "
223
+ "that the plugin will check for new data in the background so that the feed "
224
+ "is updated behind the scenes. You can select at what time and how often the "
225
+ "plugin should check for new data using the settings below. <b>Please note</"
226
+ "b> that the plugin will initially check for data from Instagram when the "
227
+ "page first loads, but then after that will check in the background on the "
228
+ "schedule selected - unless the cache is cleared."
229
+ msgstr ""
230
+
231
+ #: inc/admin/class-sbspf-admin.php:573 inc/admin/class-sby-admin.php:362
232
+ msgid "Every"
233
+ msgstr ""
234
+
235
+ #: inc/admin/class-sbspf-admin.php:576 inc/admin/class-sby-admin.php:365
236
+ msgid "Minutes"
237
+ msgstr ""
238
+
239
+ #: inc/admin/class-sbspf-admin.php:577 inc/admin/class-sby-admin.php:366
240
+ msgid "Hours"
241
+ msgstr ""
242
+
243
+ #: inc/admin/class-sbspf-admin.php:578 inc/admin/class-sby-admin.php:367
244
+ msgid "Days"
245
+ msgstr ""
246
+
247
+ #: inc/admin/class-sbspf-admin.php:580 inc/admin/class-sbspf-admin.php:847
248
+ #: inc/admin/class-sby-admin.php:369
249
+ msgid "What does this mean?"
250
+ msgstr ""
251
+
252
+ #: inc/admin/class-sbspf-admin.php:581 inc/admin/class-sby-admin.php:370
253
+ #, php-format
254
+ msgid ""
255
+ "Your %s posts are temporarily cached by the plugin in your WordPress "
256
+ "database. You can choose how long the posts should be cached for. If you set "
257
+ "the time to 1 hour then the plugin will clear the cache after that length of "
258
+ "time and check %s for posts again."
259
+ msgstr ""
260
+
261
+ #: inc/admin/class-sbspf-admin.php:586 inc/admin/class-sby-admin.php:375
262
+ msgid "In the background"
263
+ msgstr ""
264
+
265
+ #: inc/admin/class-sbspf-admin.php:591 inc/admin/class-sby-admin.php:380
266
+ #: youtube-feed.php:180
267
+ msgid "Every 30 minutes"
268
+ msgstr ""
269
+
270
+ #: inc/admin/class-sbspf-admin.php:592 inc/admin/class-sby-admin.php:381
271
+ msgid "Every hour"
272
+ msgstr ""
273
+
274
+ #: inc/admin/class-sbspf-admin.php:593 inc/admin/class-sby-admin.php:382
275
+ msgid "Every 12 hours"
276
+ msgstr ""
277
+
278
+ #: inc/admin/class-sbspf-admin.php:594 inc/admin/class-sby-admin.php:383
279
+ msgid "Every 24 hours"
280
+ msgstr ""
281
+
282
+ #: inc/admin/class-sbspf-admin.php:598 inc/admin/class-sby-admin.php:387
283
+ msgid "at"
284
+ msgstr ""
285
+
286
+ #: inc/admin/class-sbspf-admin.php:615 inc/admin/class-sby-admin.php:404
287
+ msgid "AM"
288
+ msgstr ""
289
+
290
+ #: inc/admin/class-sbspf-admin.php:616 inc/admin/class-sby-admin.php:405
291
+ msgid "PM"
292
+ msgstr ""
293
+
294
+ #: inc/admin/class-sbspf-admin.php:628 inc/admin/class-sby-admin.php:417
295
+ msgid "every 30 minutes"
296
+ msgstr ""
297
+
298
+ #: inc/admin/class-sbspf-admin.php:629 inc/admin/class-sby-admin.php:418
299
+ msgid "every 12 hours"
300
+ msgstr ""
301
+
302
+ #: inc/admin/class-sbspf-admin.php:631 inc/admin/class-sby-admin.php:420
303
+ msgid "Next check"
304
+ msgstr ""
305
+
306
+ #: inc/admin/class-sbspf-admin.php:631 inc/admin/class-sby-admin.php:420
307
+ msgid ""
308
+ "Note: Saving the settings on this page will clear the cache and reset this "
309
+ "schedule"
310
+ msgstr ""
311
+
312
+ #: inc/admin/class-sbspf-admin.php:633 inc/admin/class-sby-admin.php:422
313
+ msgid "Nothing currently scheduled"
314
+ msgstr ""
315
+
316
+ #: inc/admin/class-sbspf-admin.php:666
317
+ msgid "Click for shortcode option"
318
+ msgstr ""
319
+
320
+ #: inc/admin/class-sby-admin.php:19
321
+ msgid "Number of Videos"
322
+ msgstr ""
323
+
324
+ #: inc/admin/class-sby-admin.php:20
325
+ msgid "Number of videos to show initially."
326
+ msgstr ""
327
+
328
+ #: inc/admin/class-sby-admin.php:24
329
+ msgid "The number of videos in the feed"
330
+ msgstr ""
331
+
332
+ #: inc/admin/class-sby-admin.php:47
333
+ msgid "Spacing between videos"
334
+ msgstr ""
335
+
336
+ #: inc/admin/class-sby-admin.php:51
337
+ msgid ""
338
+ "The spacing/padding around the videos in the feed. Any number with a unit "
339
+ "like \"px\" or \"em\"."
340
+ msgstr ""
341
+
342
+ #: inc/admin/class-sby-admin.php:60
343
+ msgid "Header"
344
+ msgstr ""
345
+
346
+ #: inc/admin/class-sby-admin.php:70
347
+ msgid "Show Header"
348
+ msgstr ""
349
+
350
+ #: inc/admin/class-sby-admin.php:75
351
+ msgid "Include a header for this feed."
352
+ msgstr ""
353
+
354
+ #: inc/admin/class-sby-admin.php:85
355
+ msgid "Show Channel Description"
356
+ msgstr ""
357
+
358
+ #: inc/admin/class-sby-admin.php:90
359
+ msgid "Include the channel description in the header."
360
+ msgstr ""
361
+
362
+ #: inc/admin/class-sby-admin.php:97
363
+ msgid "\"Load More\" Button"
364
+ msgstr ""
365
+
366
+ #: inc/admin/class-sby-admin.php:107
367
+ msgid "Show \"Load More\" Button"
368
+ msgstr ""
369
+
370
+ #: inc/admin/class-sby-admin.php:112
371
+ msgid ""
372
+ "Include a \"Load More\" button at the bottom of the feed to load more videos."
373
+ msgstr ""
374
+
375
+ #: inc/admin/class-sby-admin.php:123
376
+ msgid "Button Background Color"
377
+ msgstr ""
378
+
379
+ #: inc/admin/class-sby-admin.php:127
380
+ msgid "Background color for the \"Load More\" button. Any hex color code."
381
+ msgstr ""
382
+
383
+ #: inc/admin/class-sby-admin.php:138
384
+ msgid "Button Text Color"
385
+ msgstr ""
386
+
387
+ #: inc/admin/class-sby-admin.php:142
388
+ msgid "Text color for the \"Load More\" button. Any hex color code."
389
+ msgstr ""
390
+
391
+ #: inc/admin/class-sby-admin.php:150 youtube-feed.php:412
392
+ msgid "Load More..."
393
+ msgstr ""
394
+
395
+ #: inc/admin/class-sby-admin.php:153
396
+ msgid "Button Text"
397
+ msgstr ""
398
+
399
+ #: inc/admin/class-sby-admin.php:157
400
+ msgid "The text that appers on the \"Load More\" button."
401
+ msgstr ""
402
+
403
+ #: inc/admin/class-sby-admin.php:165
404
+ msgid "\"Subscribe\" Button"
405
+ msgstr ""
406
+
407
+ #: inc/admin/class-sby-admin.php:176
408
+ msgid "Show \"Subscribe\" Button"
409
+ msgstr ""
410
+
411
+ #: inc/admin/class-sby-admin.php:181
412
+ msgid ""
413
+ "Include a \"Subscribe\" button at the bottom of the feed to load more videos."
414
+ msgstr ""
415
+
416
+ #: inc/admin/class-sby-admin.php:192
417
+ msgid "Subscribe Background Color"
418
+ msgstr ""
419
+
420
+ #: inc/admin/class-sby-admin.php:196
421
+ msgid "Background color for the \"Subscribe\" button. Any hex color code."
422
+ msgstr ""
423
+
424
+ #: inc/admin/class-sby-admin.php:207
425
+ msgid "Subscribe Text Color"
426
+ msgstr ""
427
+
428
+ #: inc/admin/class-sby-admin.php:211
429
+ msgid "Text color for the \"Subscribe\" button. Any hex color code."
430
+ msgstr ""
431
+
432
+ #: inc/admin/class-sby-admin.php:219 youtube-feed.php:413
433
+ msgid "Subscribe"
434
+ msgstr ""
435
+
436
+ #: inc/admin/class-sby-admin.php:222
437
+ msgid "Subscribe Text"
438
+ msgstr ""
439
+
440
+ #: inc/admin/class-sby-admin.php:226
441
+ msgid "The text that appers on the \"Subscribe\" button."
442
+ msgstr ""
443
+
444
+ #: inc/admin/class-sby-admin.php:233
445
+ msgid "Video Experience"
446
+ msgstr ""
447
+
448
+ #: inc/admin/class-sby-admin.php:241
449
+ msgid "Play when clicked"
450
+ msgstr ""
451
+
452
+ #: inc/admin/class-sby-admin.php:254
453
+ msgid "When does video play?"
454
+ msgstr ""
455
+
456
+ #: inc/admin/class-sby-admin.php:258
457
+ msgid "What the user needs to do to play a video. eg."
458
+ msgstr ""
459
+
460
+ #: inc/admin/class-sby-admin.php:262
461
+ msgid ""
462
+ "List layout will not play automatically. Choose whether to play the video "
463
+ "automatically in the player or wait until the user clicks the play button "
464
+ "after the video is loaded."
465
+ msgstr ""
466
+
467
+ #: inc/admin/class-sby-admin.php:267
468
+ msgid "Custom Code Snippets"
469
+ msgstr ""
470
+
471
+ #: inc/admin/class-sby-admin.php:278
472
+ msgid "Custom CSS"
473
+ msgstr ""
474
+
475
+ #: inc/admin/class-sby-admin.php:280
476
+ msgid "Enter your own custom CSS in the box below"
477
+ msgstr ""
478
+
479
+ #: inc/admin/class-sby-admin.php:289
480
+ msgid "Custom JavaScript"
481
+ msgstr ""
482
+
483
+ #: inc/admin/class-sby-admin.php:291
484
+ msgid "Enter your own custom JavaScript/jQuery in the box below"
485
+ msgstr ""
486
+
487
+ #: inc/admin/class-sby-admin.php:292
488
+ msgid ""
489
+ "Note: Custom JavaScript reruns every time more videos are loaded into the "
490
+ "feed"
491
+ msgstr ""
492
+
493
+ #: inc/admin/class-sby-admin.php:297
494
+ msgid "Advanced"
495
+ msgstr ""
496
+
497
+ #: inc/admin/class-sby-admin.php:305
498
+ msgid "Background"
499
+ msgstr ""
500
+
501
+ #: inc/admin/class-sby-admin.php:309
502
+ msgid "Page"
503
+ msgstr ""
504
+
505
+ #: inc/admin/class-sby-admin.php:313
506
+ msgid "None"
507
+ msgstr ""
508
+
509
+ #: inc/admin/class-sby-admin.php:323
510
+ msgid "Local storage process"
511
+ msgstr ""
512
+
513
+ #: inc/admin/class-sby-admin.php:326
514
+ msgid ""
515
+ "To preserve your feeds and videos even if the YouTube API is unavailable, a "
516
+ "record of each video is added to the wp_posts table in the WordPress "
517
+ "database."
518
+ msgstr ""
519
+
520
+ #: inc/admin/class-sby-admin.php:334
521
+ msgid "Are you using an AJAX theme?"
522
+ msgstr ""
523
+
524
+ #: inc/admin/class-sby-admin.php:336
525
+ msgid ""
526
+ "When navigating your site, if your theme uses Ajax to load content into your "
527
+ "pages (meaning your page doesn't refresh) then check this setting. If you're "
528
+ "not sure then it's best to leave this setting unchecked while checking with "
529
+ "your theme author, otherwise checking it may cause a problem."
530
+ msgstr ""
531
+
532
+ #: inc/admin/templates/configure.php:3
533
+ #, php-format
534
+ msgid "Log in to %s and connect an account"
535
+ msgstr ""
536
+
537
+ #: inc/admin/templates/configure.php:4
538
+ msgid "Button not working?"
539
+ msgstr ""
540
+
541
+ #: inc/admin/templates/configure.php:15
542
+ #, php-format
543
+ msgid "Or, manually enter my own %s API key"
544
+ msgstr ""
545
+
546
+ #: inc/admin/templates/configure.php:18
547
+ msgid ""
548
+ "Check this box if you would like to manually enter your own API key. To "
549
+ "generate an api key use <a href=\"https://smashballoon.com/youtube-api-key/"
550
+ "\" target=\"_blank\" rel=\"noopener\">these instructions.</a>"
551
+ msgstr ""
552
+
553
+ #: inc/admin/templates/configure.php:24
554
+ msgid "API Key"
555
+ msgstr ""
556
+
557
+ #: inc/admin/templates/configure.php:40 inc/admin/templates/customize.php:8
558
+ msgid "Save Changes"
559
+ msgstr ""
560
+
561
+ #: inc/admin/templates/connected-accounts.php:9
562
+ #, php-format
563
+ msgid "%s Accounts"
564
+ msgstr ""
565
+
566
+ #: inc/admin/templates/connected-accounts.php:10
567
+ #, php-format
568
+ msgid "Use the button above to connect %s account"
569
+ msgstr ""
570
+
571
+ #: inc/admin/templates/connected-accounts.php:14
572
+ #, php-format
573
+ msgid "No %s accounts connected. Click the button above to connect an account."
574
+ msgstr ""
575
+
576
+ #: inc/admin/templates/connected-accounts.php:33
577
+ msgid "Manually Connect a Primary Account"
578
+ msgstr ""
579
+
580
+ #: inc/admin/templates/connected-accounts.php:35
581
+ msgid "Enter a valid Access Token"
582
+ msgstr ""
583
+
584
+ #: inc/admin/templates/connected-accounts.php:36
585
+ msgid "Enter a valid Refresh Token"
586
+ msgstr ""
587
+
588
+ #: inc/admin/templates/connected-accounts.php:37
589
+ msgid "Connect This Account"
590
+ msgstr ""
591
+
592
+ #: inc/admin/templates/display.php:1
593
+ msgid "Display your Feed"
594
+ msgstr ""
595
+
596
+ #: inc/admin/templates/display.php:2
597
+ msgid ""
598
+ "Copy and paste the following shortcode directly into the page, post or "
599
+ "widget where you'd like the feed to show up:"
600
+ msgstr ""
601
+
602
+ #: inc/admin/templates/display.php:3 inc/admin/templates/main.php:59
603
+ #: inc/admin/templates/single-connected-account.php:39
604
+ #: inc/admin/templates/single-connected-account.php:40
605
+ #: inc/admin/templates/single-connected-account.php:41
606
+ msgid "To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)."
607
+ msgstr ""
608
+
609
+ #: inc/admin/templates/display.php:5
610
+ msgid "Multiple Feeds"
611
+ msgstr ""
612
+
613
+ #: inc/admin/templates/display.php:6
614
+ msgid ""
615
+ "If you'd like to display multiple feeds then you can set different settings "
616
+ "directly in the shortcode like so:"
617
+ msgstr ""
618
+
619
+ #: inc/admin/templates/display.php:8
620
+ msgid ""
621
+ "You can display as many different feeds as you like, on either the same page "
622
+ "or on different pages, by just using the shortcode options below. For "
623
+ "example:"
624
+ msgstr ""
625
+
626
+ #: inc/admin/templates/display.php:13
627
+ msgid "See the table below for a full list of available shortcode options:"
628
+ msgstr ""
629
+
630
+ #: inc/admin/templates/display.php:18
631
+ msgid "Shortcode option"
632
+ msgstr ""
633
+
634
+ #: inc/admin/templates/display.php:19
635
+ msgid "Description"
636
+ msgstr ""
637
+
638
+ #: inc/admin/templates/display.php:20
639
+ msgid "Example"
640
+ msgstr ""
641
+
642
+ #: inc/admin/templates/display.php:37 inc/admin/templates/support.php:1
643
+ msgid "Need help?"
644
+ msgstr ""
645
+
646
+ #: inc/admin/templates/display.php:37
647
+ msgid "Get Support"
648
+ msgstr ""
649
+
650
+ #: inc/admin/templates/main.php:17
651
+ msgid "Settings saved."
652
+ msgstr ""
653
+
654
+ #: inc/admin/templates/main.php:50
655
+ msgid "Next Step"
656
+ msgstr ""
657
+
658
+ #: inc/admin/templates/main.php:54
659
+ msgid "Need help setting up the plugin? Check out our <a href=\""
660
+ msgstr ""
661
+
662
+ #: inc/admin/templates/main.php:58
663
+ msgid ""
664
+ "Copy and paste this shortcode directly into the page, post or widget where "
665
+ "you'd like to display the feed:"
666
+ msgstr ""
667
+
668
+ #: inc/admin/templates/main.php:60
669
+ msgid "Find out how to display <a href='?page="
670
+ msgstr ""
671
+
672
+ #: inc/admin/templates/single-connected-account.php:4
673
+ msgid ""
674
+ "The Access Token for this account is expired or invalid. Click the button "
675
+ "above to attempt to renew it."
676
+ msgstr ""
677
+
678
+ #: inc/admin/templates/single-connected-account.php:9
679
+ msgid "Remove"
680
+ msgstr ""
681
+
682
+ #: inc/admin/templates/single-connected-account.php:14
683
+ msgid "Channel ID:"
684
+ msgstr ""
685
+
686
+ #: inc/admin/templates/single-connected-account.php:18
687
+ msgid "Add to another Feed"
688
+ msgstr ""
689
+
690
+ #: inc/admin/templates/single-connected-account.php:19
691
+ msgid "Show access token and account info"
692
+ msgstr ""
693
+
694
+ #: inc/admin/templates/single-connected-account.php:24
695
+ msgid "Copy and paste this shortcode into your page or widget area"
696
+ msgstr ""
697
+
698
+ #: inc/admin/templates/single-connected-account.php:32
699
+ msgid ""
700
+ "To add multiple channels in the same feed, simply separate them using commas"
701
+ msgstr ""
702
+
703
+ #: inc/admin/templates/single-connected-account.php:35
704
+ #, php-format
705
+ msgid "Click on the %s tab to learn more about shortcodes"
706
+ msgstr ""
707
+
708
+ #: inc/admin/templates/single-connected-account.php:35
709
+ msgid "Display Your Feed"
710
+ msgstr ""
711
+
712
+ #: inc/admin/templates/single-connected-account.php:39
713
+ msgid "Access Token"
714
+ msgstr ""
715
+
716
+ #: inc/admin/templates/single-connected-account.php:40
717
+ msgid "Refresh Token"
718
+ msgstr ""
719
+
720
+ #: inc/admin/templates/single-connected-account.php:41
721
+ msgid "Channel ID"
722
+ msgstr ""
723
+
724
+ #: inc/admin/templates/support.php:3
725
+ msgid "Check out our "
726
+ msgstr ""
727
+
728
+ #: inc/admin/templates/support.php:3
729
+ msgid "setup directions"
730
+ msgstr ""
731
+
732
+ #: inc/admin/templates/support.php:3
733
+ msgid "for a step-by-step guide on how to setup and use the plugin"
734
+ msgstr ""
735
+
736
+ #: inc/admin/templates/support.php:5
737
+ msgid "Have a problem? Submit a "
738
+ msgstr ""
739
+
740
+ #: inc/admin/templates/support.php:5
741
+ msgid "support ticket"
742
+ msgstr ""
743
+
744
+ #: inc/admin/templates/support.php:5
745
+ msgid "on our website"
746
+ msgstr ""
747
+
748
+ #: inc/admin/templates/support.php:5
749
+ msgid "Please include your <b>System Info</b> below with all support requests."
750
+ msgstr ""
751
+
752
+ #: inc/admin/templates/support.php:8
753
+ msgid "System Info"
754
+ msgstr ""
755
+
756
+ #: inc/admin/templates/support.php:8
757
+ msgid "Click the text below to select all"
758
+ msgstr ""
759
+
760
+ #: inc/class-sby-api-connect.php:102
761
+ #, php-format
762
+ msgid "Error: %s."
763
+ msgstr ""
764
+
765
+ #: inc/class-sby-api-connect.php:104
766
+ msgid ""
767
+ "There's an issue with the YouTube API Key that you are using. Please check "
768
+ "to make sure that this is a valid API Key."
769
+ msgstr ""
770
+
771
+ #: inc/class-sby-api-connect.php:118
772
+ #, php-format
773
+ msgid "Error connecting to %s."
774
+ msgstr ""
775
+
776
+ #: inc/class-sby-feed.php:737
777
+ msgid "Error: No videos found."
778
+ msgstr ""
779
+
780
+ #: inc/class-sby-feed.php:738
781
+ msgid ""
782
+ "Make sure this is a valid channel ID and that the channel has videos "
783
+ "available on youtube.com."
784
+ msgstr ""
785
+
786
+ #: inc/class-sby-feed.php:863
787
+ msgid "No posts found."
788
+ msgstr ""
789
+
790
+ #: inc/class-sby-posts-manager.php:235
791
+ msgid "There was an error creating the folder for storing resized images."
792
+ msgstr ""
793
+
794
+ #: inc/class-sby-posts-manager.php:323
795
+ msgid "Notice: API requests are being delayed for 5 minutes."
796
+ msgstr ""
797
+
798
+ #: inc/class-sby-posts-manager.php:323
799
+ msgid "Feed will not update."
800
+ msgstr ""
801
+
802
+ #: inc/class-sby-posts-manager.php:332
803
+ msgid ""
804
+ "There may be an issue with the YouTube access token that you are using. Your "
805
+ "server might also be unable to connect to YouTube at this time."
806
+ msgstr ""
807
+
808
+ #: inc/sby-functions.php:21 inc/sby-functions.php:137
809
+ msgid "This error message is only visible to WordPress admins"
810
+ msgstr ""
811
+
812
+ #: inc/sby-functions.php:22
813
+ msgid "Error: No connected account."
814
+ msgstr ""
815
+
816
+ #: inc/sby-functions.php:23
817
+ msgid "Please go to the YouTube Feed settings page to connect an account."
818
+ msgstr ""
819
+
820
+ #: inc/widget.php:13 youtube-feed.php:94
821
+ msgid "YouTube Feed"
822
+ msgstr ""
823
+
824
+ #: inc/widget.php:14
825
+ msgid "Display your YouTube feed"
826
+ msgstr ""
827
+
828
+ #: inc/widget.php:40
829
+ msgid "Title:"
830
+ msgstr ""
831
+
832
+ #: templates/item.php:22 templates/player.php:10
833
+ msgid "Image for post"
834
+ msgstr ""
835
+
836
+ #: templates/item.php:34 templates/player.php:17
837
+ #, php-format
838
+ msgid "YouTube Video %s"
839
+ msgstr ""
840
+
841
+ #: youtube-feed.php:97
842
+ msgid "a"
843
+ msgstr ""
844
+
845
+ #: youtube-feed.php:100
846
+ msgid "YouTube"
847
+ msgstr ""
848
+
849
+ #: youtube-feed.php:125
850
+ msgid "Videos"
851
+ msgstr ""
852
+
853
+ #: youtube-feed.php:126
854
+ msgid " "
855
+ msgstr ""
856
+
857
+ #: youtube-feed.php:127 youtube-feed.php:128
858
+ msgid "Add New Video"
859
+ msgstr ""
860
+
861
+ #: youtube-feed.php:129
862
+ msgid "Edit Video"
863
+ msgstr ""
864
+
865
+ #: youtube-feed.php:130
866
+ msgid "View Video"
867
+ msgstr ""
868
+
869
+ #: youtube-feed.php:131
870
+ msgid "All Videos"
871
+ msgstr ""
872
+
873
+ #: youtube-feed.php:441
874
+ msgid "Settings"
875
+ msgstr ""
templates/feed.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ die( '-1' );
5
+ }
6
+ $feed_styles = SBY_Display_Elements::get_feed_style( $settings );
7
+ $cols_setting = SBY_Display_Elements::get_cols( $settings );
8
+ $mobile_cols_setting = SBY_Display_Elements::get_cols_mobile( $settings );
9
+ $items_wrap_style_attr = SBY_Display_Elements::get_style_att( 'items_wrap', $settings );
10
+ $num_setting = $settings['num'];
11
+ $nummobile_setting = $settings['nummobile'];
12
+
13
+ if ( $settings['showheader'] && ! empty( $posts ) && $settings['headeroutside'] ) {
14
+ include sby_get_feed_template_part( 'header', $settings );
15
+ }
16
+ ?>
17
+
18
+ <div id="sb_youtube_<?php echo esc_attr( preg_replace( "/[^A-Za-z0-9 ]/", '', $feed_id ) ); ?>" class="sb_youtube sby_layout_<?php echo esc_attr( $settings['layout'] ); ?> sby_col_<?php echo esc_attr( $cols_setting ); ?> sby_mob_col_<?php echo esc_attr( $mobile_cols_setting ); ?> <?php echo esc_attr( $additional_classes ); ?>" data-feedid="<?php echo esc_attr( $feed_id ); ?>" data-shortcode-atts="<?php echo esc_attr( $shortcode_atts ); ?>" data-num="<?php echo esc_attr( $num_setting ); ?>" data-nummobile="<?php echo esc_attr( $nummobile_setting ); ?>"<?php echo $other_atts . $feed_styles; ?>>
19
+ <?php
20
+ if ( $settings['showheader'] && ! empty( $posts ) && !$settings['headeroutside'] ) {
21
+ include sby_get_feed_template_part( 'header', $settings );
22
+ }
23
+ ?>
24
+ <?php if ( $settings['layout'] === 'gallery' && isset( $posts[0] ) ) {
25
+ $placeholder_post = $posts[0];
26
+ include sby_get_feed_template_part( 'player', $settings );
27
+ } ?>
28
+ <div class="sby_items_wrap"<?php echo $items_wrap_style_attr; ?>>
29
+ <?php
30
+ if ( ! in_array( 'ajaxPostLoad', $flags, true ) ) {
31
+ $this->posts_loop( $posts, $settings );
32
+ }
33
+ ?>
34
+ </div>
35
+
36
+ <?php if ( ! empty( $posts ) ) { include sby_get_feed_template_part( 'footer', $settings ); } ?>
37
+
38
+ <?php
39
+ /**
40
+ * Things to add before the closing "div" tag for the main feed element. Several
41
+ * features rely on this hook such as local images and some error messages
42
+ *
43
+ * @param object SBY_Feed
44
+ * @param string $feed_id
45
+ *
46
+ * @since 1.0
47
+ */
48
+ do_action( 'sby_before_feed_end', $this, $feed_id ); ?>
49
+ </div>
templates/footer.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Don't load directly
4
+ if ( ! defined( 'ABSPATH' ) ) {
5
+ die( '-1' );
6
+ }
7
+ $subscribe_url = isset( $posts[0] ) ? SBY_Parse::get_channel_permalink( $posts[0] ) : '';
8
+
9
+ $sub_btn_style = SBY_Display_Elements::get_subscribe_styles( $settings ); // style="background: rgb();color: rgb();" already escaped
10
+ $sub_btn_classes = strpos( $sub_btn_style, 'background' ) !== false ? ' sby_custom' : '';
11
+ $show_subscribe_button = $settings['showsubscribe'];
12
+ $subscribe_button_text = __( $settings['subscribetext'], 'youtube-feed' );
13
+
14
+ $load_btn_style = SBY_Display_Elements::get_load_button_styles( $settings ); // style="background: rgb();color: rgb();" already escaped
15
+ $load_btn_classes = strpos( $load_btn_style, 'background' ) !== false ? ' sby_custom' : '';
16
+ $load_button_text = __( $settings['buttontext'], 'youtube-feed' );
17
+ ?>
18
+ <div class="sby_footer">
19
+
20
+ <?php if ( $use_pagination ) : ?>
21
+ <a class="sby_load_btn" href="javascript:void(0);" <?php echo $load_btn_style; ?>>
22
+ <span class="sby_btn_text"><?php echo esc_html( $load_button_text ); ?></span>
23
+ <span class="sby_loader sby_hidden" style="background-color: rgb(255, 255, 255);"></span>
24
+ </a>
25
+ <?php endif; ?>
26
+
27
+ <?php if ( $first_username && $show_subscribe_button ) : ?>
28
+ <span class="sby_follow_btn<?php echo esc_attr( $sub_btn_classes ); ?>">
29
+ <a href="<?php echo esc_url( $subscribe_url ); ?>" <?php echo $sub_btn_style; ?> target="_blank" rel="noopener"><?php echo SBY_Display_Elements::get_icon( 'youtube', $icon_type );echo esc_html( $subscribe_button_text ); ?></a>
30
+ </span>
31
+ <?php endif; ?>
32
+ </div>
templates/header.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Don't load directly
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ die( '-1' );
5
+ }
6
+ $avatar = SBY_Parse::get_avatar( $header_data, $settings );
7
+ $channel_title = SBY_Parse::get_channel_title( $header_data );
8
+ $channel_description = SBY_Parse::get_channel_description( $header_data );
9
+ $permalink = SBY_Parse::get_channel_permalink( $header_data );
10
+ $header_style_attr = SBY_Display_Elements::get_style_att( 'items', $settings );
11
+ $header_text_color_style = SBY_Display_Elements::get_header_text_color_styles( $settings ); // style="color: #517fa4;" already escaped
12
+ $size_class = SBY_Display_Elements::get_header_size_class( $settings );
13
+ $should_show_bio = $settings['showdescription'] && $channel_description !== '';
14
+ $bio_class = ! $should_show_bio ? ' sby_no_bio' : '';
15
+ ?>
16
+ <div class="sb_youtube_header <?php echo esc_attr( $size_class ); ?>"<?php echo $header_style_attr; ?>>
17
+ <a href="<?php echo esc_url( $permalink ); ?>" target="_blank" rel="noopener" title="@<?php echo esc_attr( $channel_title ); ?>" class="sby_header_link">
18
+ <div class="sby_header_text<?php echo esc_attr( $bio_class ); ?>">
19
+ <h3 <?php echo $header_text_color_style; ?>><?php echo esc_html( $channel_title ); ?></h3>
20
+ <?php if ( $should_show_bio ) : ?>
21
+ <p class="sby_bio" <?php echo $header_text_color_style; ?>><?php echo str_replace( '&lt;br /&gt;', '<br>', esc_html( nl2br( $channel_description ) ) ); ?></p>
22
+ <?php endif; ?>
23
+ </div>
24
+ <div class="sby_header_img" data-avatar-url="<?php echo esc_attr( $avatar ); ?>">
25
+ <div class="sby_header_img_hover"><?php echo SBY_Display_Elements::get_icon( 'newlogo', $icon_type ); ?></div>
26
+ <img src="<?php echo esc_url( $avatar ); ?>" alt="<?php echo esc_attr( $channel_title ); ?>" width="50" height="50">
27
+ </div>
28
+ </a>
29
+ </div>
templates/item.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Item Template
4
+ * Adds an image, link, and other data for each post in the feed
5
+ *
6
+ * @version 1.0 by Smash Balloon
7
+ *
8
+ */
9
+
10
+ // Don't load directly
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ die( '-1' );
13
+ }
14
+ $classes = SBY_Display_Elements::get_item_classes( $settings, $offset );
15
+ $post_id = SBY_Parse::get_post_id( $post );
16
+ $timestamp = SBY_Parse::get_timestamp( $post );
17
+ $video_id = SBY_Parse::get_video_id( $post );
18
+ $media_url = SBY_Display_Elements::get_optimum_media_url( $post, $settings );
19
+ $media_full_res = SBY_Parse::get_media_url( $post );
20
+ $media_all_sizes_json = SBY_Parse::get_media_src_set( $post );
21
+ $permalink = SBY_Parse::get_permalink( $post );
22
+ $img_alt = SBY_Parse::get_caption( $post, __( 'Image for post' ) . ' ' . $post_id );
23
+ $items_style_attr = SBY_Display_Elements::get_style_att( 'item', $settings );
24
+ $title = SBY_Parse::get_video_title( $post );
25
+ ?>
26
+ <div class="sby_item <?php echo esc_attr( $classes ); ?>" id="sby_<?php echo esc_html( $post_id ); ?>" data-date="<?php echo esc_html( $timestamp ); ?>" data-video-id="<?php echo esc_attr( $video_id ); ?>"<?php echo $items_style_attr; ?>>
27
+ <div class="sby_video_thumbnail_wrap">
28
+ <a class="sby_video_thumbnail" href="<?php echo esc_url( $permalink ); ?>" target="_blank" rel="noopener" data-full-res="<?php echo esc_url( $media_full_res ); ?>" data-img-src-set="<?php echo esc_attr( wp_json_encode( $media_all_sizes_json ) ); ?>" data-video-id="<?php echo esc_attr( $video_id ); ?>">
29
+
30
+ <div class="sby_thumbail_hover">
31
+ <span class="sby_video_title"><?php echo esc_html( $title ); ?></span>
32
+ </div>
33
+
34
+ <span class="sby-screenreader"><?php echo sprintf( __( 'YouTube Video %s', 'youtube-feed' ), $post_id ); ?></span>
35
+ <img src="<?php echo esc_url( $media_url ); ?>" alt="<?php echo esc_attr( $img_alt ); ?>">
36
+ <span class="sby_loader sby_hidden" style="background-color: rgb(255, 255, 255);"></span>
37
+ </a>
38
+
39
+ <?php if ( $settings['layout'] === 'list' ) : ?>
40
+ <div id="sby_player_<?php echo esc_html( $video_id ); ?>" class="sby_player_wrap"></div>
41
+ <?php endif; ?>
42
+
43
+ </div>
44
+ </div>
templates/player.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $post_id = SBY_Parse::get_post_id( $placeholder_post );
3
+ $timestamp = SBY_Parse::get_timestamp( $placeholder_post );
4
+ $video_id = SBY_Parse::get_video_id( $placeholder_post );
5
+ $protocol = is_ssl() ? 'https' : 'http';
6
+ $media_url = SBY_Display_Elements::get_optimum_media_url( $placeholder_post, $settings );
7
+ $media_full_res = SBY_Parse::get_media_url( $placeholder_post );
8
+ $media_all_sizes_json = SBY_Parse::get_media_src_set( $placeholder_post );
9
+ $permalink = SBY_Parse::get_permalink( $placeholder_post );
10
+ $img_alt = SBY_Parse::get_caption( $placeholder_post, __( 'Image for post' ) . ' ' . $post_id );
11
+ $player_outer_wrap_style_attr = SBY_Display_Elements::get_style_att( 'player_outer_wrap', $settings );
12
+
13
+ ?>
14
+ <div id="sby_player_<?php echo esc_attr( $post_id ); ?>" class="sby_player_outer_wrap sby_player_item" <?php echo $player_outer_wrap_style_attr; ?>>
15
+ <div class="sby_video_thumbnail_wrap">
16
+ <a class="sby_video_thumbnail" href="<?php echo esc_url( $permalink ); ?>" target="_blank" rel="noopener" data-full-res="<?php echo esc_url( $media_full_res ); ?>" data-img-src-set="<?php echo esc_attr( wp_json_encode( $media_all_sizes_json ) ); ?>" data-video-id="<?php echo esc_attr( $video_id ); ?>">
17
+ <span class="sby-screenreader"><?php echo sprintf( __( 'YouTube Video %s', 'youtube-feed' ), $post_id ); ?></span>
18
+ <img src="<?php echo esc_url( $media_url ); ?>" alt="<?php echo esc_attr( $img_alt ); ?>">
19
+ <span class="sby_loader sby_hidden" style="background-color: rgb(255, 255, 255);"></span>
20
+ </a>
21
+ <div class="sby_player_wrap">
22
+ <div class="sby_player"></div>
23
+ </div>
24
+ </div>
25
+
26
+ </div>
uninstall.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
3
+ exit();
4
+ }
5
+
6
+ //If the user is preserving the settings then don't delete them
7
+ $options = get_option( 'sby_settings' );
8
+ $sby_preserve_settings = isset( $options[ 'preserve_settings' ] ) ? $options[ 'preserve_settings' ] : false;
9
+
10
+ // allow the user to preserve their settings in case they are upgrading
11
+ if ( ! $sby_preserve_settings ) {
12
+
13
+ // clear cron jobs
14
+ wp_clear_scheduled_hook( 'sby_cron_job' );
15
+ wp_clear_scheduled_hook( 'sby_feed_update' );
16
+
17
+ // clean up options from the database
18
+ delete_option( 'sby_settings' );
19
+ delete_option( 'sby_cron_report' );
20
+ delete_option( 'sby_errors' );
21
+ delete_option( 'sby_ajax_status' );
22
+ delete_option( 'sby_db_version' );
23
+
24
+ // delete role
25
+ global $wp_roles;
26
+ $wp_roles->remove_cap( 'administrator', 'manage_youtube_feed_options' );
27
+
28
+ // delete all custom post type data
29
+ global $wpdb;
30
+
31
+ $youtube_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type = 'sby_videos';" );
32
+
33
+ $id_string = implode( ', ', $youtube_ids );
34
+ if ( ! empty( $id_string ) ) {
35
+ $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE post_id IN ($id_string);" );
36
+ $wpdb->query( "DELETE FROM $wpdb->posts WHERE post_type = 'sby_videos';" );
37
+ }
38
+
39
+ // delete transients and backup data
40
+ $table_name = $wpdb->prefix . "options";
41
+ $wpdb->query( "
42
+ DELETE
43
+ FROM $table_name
44
+ WHERE `option_name` LIKE ('%\!sby\_%')
45
+ " );
46
+ $wpdb->query( "
47
+ DELETE
48
+ FROM $table_name
49
+ WHERE `option_name` LIKE ('%\_transient\_sby\_%')
50
+ " );
51
+ $wpdb->query( "
52
+ DELETE
53
+ FROM $table_name
54
+ WHERE `option_name` LIKE ('%\_transient\_timeout\_sby\_%')
55
+ " );
56
+ $wpdb->query( "
57
+ DELETE
58
+ FROM $table_name
59
+ WHERE `option_name` LIKE ('%\_transient\_&sby\_%')
60
+ " );
61
+ $wpdb->query( "
62
+ DELETE
63
+ FROM $table_name
64
+ WHERE `option_name` LIKE ('%\_transient\_timeout\_&sby\_%')
65
+ " );
66
+ $wpdb->query( "
67
+ DELETE
68
+ FROM $table_name
69
+ WHERE `option_name` LIKE ('%\_transient\_\$sby\_%')
70
+ " );
71
+ $wpdb->query( "
72
+ DELETE
73
+ FROM $table_name
74
+ WHERE `option_name` LIKE ('%\_transient\_timeout\_\$sby\_%')
75
+ " );
76
+
77
+ //delete image resizing related things
78
+ $posts_table_name = $wpdb->prefix . 'sby_items';
79
+ $feeds_posts_table_name = esc_sql( $wpdb->prefix . 'sby_items_feeds' );
80
+
81
+ $upload = wp_upload_dir();
82
+ $wpdb->query( "DROP TABLE IF EXISTS $posts_table_name" );
83
+ $wpdb->query( "DROP TABLE IF EXISTS $feeds_posts_table_name" );
84
+
85
+ $image_files = glob( trailingslashit( $upload['basedir'] ) . trailingslashit( 'sby-local-media' ) . '*' ); // get all file names
86
+ foreach ( $image_files as $file ) { // iterate files
87
+ if ( is_file( $file ) ) {
88
+ unlink( $file );
89
+ } // delete file
90
+ }
91
+
92
+ global $wp_filesystem;
93
+
94
+ $wp_filesystem->delete( trailingslashit( $upload['basedir'] ) . trailingslashit( 'sby-local-media' ) , true );
95
+ }
96
+
97
+
youtube-feed.php ADDED
@@ -0,0 +1,490 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Feeds for YouTube
4
+ Plugin URI: http://smashballoon.com/youtube-feed
5
+ Description: The Feeds for YouTube plugin allows you to display completely customizable YouTube feeds from any channel.
6
+ Version: 1.0
7
+ Author: Smash Balloon
8
+ Author URI: http://smashballoon.com/
9
+ Text Domain: feeds-for-youtube
10
+ */
11
+ /*
12
+ Copyright 2019 Smash Balloon LLC (email : hey@smashballoon.com)
13
+ This program is free software; you can redistribute it and/or modify
14
+ it under the terms of the GNU General Public License as published by
15
+ the Free Software Foundation; either version 2 of the License, or
16
+ (at your option) any later version.
17
+ This program is distributed in the hope that it will be useful,
18
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ GNU General Public License for more details.
21
+ You should have received a copy of the GNU General Public License
22
+ 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
+
26
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
27
+
28
+ if ( ! defined( 'SBYVER' ) ) {
29
+ define( 'SBYVER', 1.0 );
30
+ }
31
+ if ( ! defined( 'SBY_DBVERSION' ) ) {
32
+ define( 'SBY_DBVERSION', 1.1 );
33
+ }
34
+ // Upload folder name for local image files for posts
35
+ if ( ! defined( 'SBY_UPLOADS_NAME' ) ) {
36
+ define( 'SBY_UPLOADS_NAME', 'sby-local-media' );
37
+ }
38
+ // Name of the database table that contains instagram posts
39
+ if ( ! defined( 'SBY_ITEMS' ) ) {
40
+ define( 'SBY_ITEMS', 'sby_items' );
41
+ }
42
+ // Name of the database table that contains feed ids and the ids of posts
43
+ if ( ! defined( 'SBY_ITEMS_FEEDS' ) ) {
44
+ define( 'SBY_ITEMS_FEEDS', 'sby_items_feeds' );
45
+ }
46
+ // Name of the database table that contains feed ids and the ids of posts
47
+ if ( ! defined( 'SBY_CPT' ) ) {
48
+ define( 'SBY_CPT', 'sby_videos' );
49
+ }
50
+
51
+ if ( function_exists( 'sby_init' ) ) {
52
+ wp_die( "Please deactivate Feeds for YouTube.<br /><br />Back to the WordPress <a href='".get_admin_url( null, 'plugins.php' )."'>Plugins page</a>." );
53
+ } else {
54
+ /**
55
+ * Define constants and load plugin files
56
+ *
57
+ * @since 2.0
58
+ */
59
+ function sby_init() {
60
+ // Plugin Folder Path.
61
+ if ( ! defined( 'SBY_PLUGIN_DIR' ) ) {
62
+ define( 'SBY_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
63
+ }
64
+ // Plugin Folder URL.
65
+ if ( ! defined( 'SBY_PLUGIN_URL' ) ) {
66
+ define( 'SBY_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
67
+ }
68
+ // Plugin Base Name
69
+ if ( ! defined( 'SBY_PLUGIN_BASENAME' ) ) {
70
+ define( 'SBY_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
71
+ }
72
+ // Cron Updating Cache Time 60 days
73
+ if ( ! defined( 'SBY_CRON_UPDATE_CACHE_TIME' ) ) {
74
+ define( 'SBY_CRON_UPDATE_CACHE_TIME', 60 * 60 * 24 * 60 );
75
+ }
76
+ // Plugin Base Name
77
+ if ( ! defined( 'SBY_BACKUP_PREFIX' ) ) {
78
+ define( 'SBY_BACKUP_PREFIX', '!' );
79
+ }
80
+ if ( ! defined( 'SBY_USE_BACKUP_PREFIX' ) ) {
81
+ define( 'SBY_USE_BACKUP_PREFIX', '&' );
82
+ }
83
+ // Max Records in Database for Image Resizing
84
+ if ( ! defined( 'SBY_MAX_RECORDS' ) ) {
85
+ define( 'SBY_MAX_RECORDS', 100 );
86
+ }
87
+ if ( ! defined( 'SBY_TEXT_DOMAIN' ) ) {
88
+ define( 'SBY_TEXT_DOMAIN', 'feeds-for-youtube' );
89
+ }
90
+ if ( ! defined( 'SBY_SLUG' ) ) {
91
+ define( 'SBY_SLUG', 'youtube-feed' );
92
+ }
93
+ if ( ! defined( 'SBY_PLUGIN_NAME' ) ) {
94
+ define( 'SBY_PLUGIN_NAME', __( 'Feeds for YouTube', SBY_TEXT_DOMAIN ) );
95
+ }
96
+ if ( ! defined( 'SBY_INDEF_ART' ) ) {
97
+ define( 'SBY_INDEF_ART', __( 'a', SBY_TEXT_DOMAIN ) );
98
+ }
99
+ if ( ! defined( 'SBY_SOCIAL_NETWORK' ) ) {
100
+ define( 'SBY_SOCIAL_NETWORK', __( 'YouTube', SBY_TEXT_DOMAIN ) );
101
+ }
102
+ if ( ! defined( 'SBY_SETUP_URL' ) ) {
103
+ define( 'SBY_SETUP_URL', 'https://smashballoon.com/youtube-feed/free');
104
+ }
105
+ if ( ! defined( 'SBY_SUPPORT_URL' ) ) {
106
+ define( 'SBY_SUPPORT_URL', 'https://smashballoon.com/youtube-feed/support');
107
+ }
108
+ if ( ! defined( 'SBY_OAUTH_PROCESSOR_URL' ) ) {
109
+ define( 'SBY_OAUTH_PROCESSOR_URL', 'https://smashballoon.com/youtube-login/?return_uri=');
110
+ }
111
+ if ( ! defined( 'SBY_DEMO_URL' ) ) {
112
+ define( 'SBY_DEMO_URL', 'https://smashballoon.com/youtube-feed/demo' );
113
+ }
114
+ if ( ! defined( 'SBY_PRO_LOGO' ) ) {
115
+ define( 'SBY_PRO_LOGO', SBY_PLUGIN_URL . '/img/smash-balloon-logo-small.png' );
116
+ }
117
+
118
+ global $sby_settings;
119
+ $sby_settings = get_option( 'sby_settings', array() );
120
+ $sby_settings = wp_parse_args( $sby_settings, sby_settings_defaults() );
121
+
122
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-vars.php';
123
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/sby-functions.php';
124
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-api-connect.php';
125
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-cron-update.php';
126
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-display-elements.php';
127
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-feed.php';
128
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-parse.php';
129
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-posts-manager.php';
130
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-settings.php';
131
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-wp-post.php';
132
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/widget.php';
133
+
134
+ if ( is_admin() ) {
135
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/admin-functions.php';
136
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/class-sbspf-admin.php';
137
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/class-sby-admin.php';
138
+ sby_admin_init();
139
+ }
140
+
141
+ global $sby_posts_manager;
142
+ $sby_posts_manager = new SBY_Posts_Manager( 'sby', get_option( 'sby_errors', array() ), get_option( 'sby_ajax_status', array( 'tested' => false, 'successful' => false ) ) );
143
+ }
144
+ add_action( 'plugins_loaded', 'sby_init' );
145
+
146
+ function sby_register_cpt() {
147
+ register_post_type( SBY_CPT, array(
148
+ 'label' => SBY_SOCIAL_NETWORK,
149
+ 'labels' => array(
150
+ 'name' => SBY_SOCIAL_NETWORK . ' ' . __( 'Videos', SBY_TEXT_DOMAIN ),
151
+ 'singular_name' => __( SBY_SOCIAL_NETWORK . ' ' . 'Video', SBY_TEXT_DOMAIN ),
152
+ 'add_new' => __( 'Add New Video', SBY_TEXT_DOMAIN ),
153
+ 'add_new_item' => __( 'Add New Video', SBY_TEXT_DOMAIN ),
154
+ 'edit_item' => __( 'Edit Video', SBY_TEXT_DOMAIN ),
155
+ 'view_item' => __( 'View Video', SBY_TEXT_DOMAIN ),
156
+ 'all_items' => __( 'All Videos', SBY_TEXT_DOMAIN ),
157
+ ),
158
+ 'public' => false,
159
+ 'show_ui' => false,
160
+ 'show_in_menu' => false,
161
+ 'query_var' => false,
162
+ 'rewrite' => false,
163
+ 'has_archive' => false,
164
+ 'hierarchical' => false,
165
+ 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'author' ) //'comments'
166
+ ) );
167
+ }
168
+
169
+ add_action( 'init', 'sby_register_cpt' );
170
+
171
+ /**
172
+ * Add the custom interval of 30 minutes for cron caching
173
+ *
174
+ * @param array $schedules current list of cron intervals
175
+ *
176
+ * @return array
177
+ *
178
+ * @since 2.0
179
+ */
180
+ function sby_cron_custom_interval( $schedules ) {
181
+ $schedules['sby30mins'] = array(
182
+ 'interval' => 30 * 60,
183
+ 'display' => __( 'Every 30 minutes' )
184
+ );
185
+
186
+ return $schedules;
187
+ }
188
+
189
+ add_filter( 'cron_schedules', 'sby_cron_custom_interval' );
190
+
191
+ /**
192
+ * Create database tables, schedule cron events, initiate capabilities
193
+ *
194
+ * @param bool $network_wide is a multisite network activation
195
+ *
196
+ * @since 2.0 database tables and capabilties created
197
+ * @since 1.0
198
+ */
199
+ function sby_activate( $network_wide ) {
200
+ //Clear page caching plugins and autoptomize
201
+ if ( is_callable( 'sby_clear_page_caches' ) ) {
202
+ sby_clear_page_caches();
203
+ }
204
+
205
+ //Run cron twice daily when plugin is first activated for new users
206
+ if ( ! wp_next_scheduled( 'sby_cron_job' ) ) {
207
+ wp_schedule_event( time(), 'twicedaily', 'sby_cron_job' );
208
+ }
209
+
210
+ $sby_settings = get_option( 'sby_settings', array() );
211
+ if ( isset( $sby_settings['caching_type'] ) && $sby_settings['caching_type'] === 'background' ) {
212
+ require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'inc/class-sby-cron-update.php';
213
+ SBY_Cron_Updater::start_cron_job( $sby_settings['cache_cron_interval'], $sby_settings['cache_cron_time'], $sby_settings['cache_cron_am_pm'] );
214
+ }
215
+
216
+ if ( is_multisite() && $network_wide && function_exists( 'get_sites' ) && class_exists( 'WP_Site_Query' ) ) {
217
+ // Get all blogs in the network and activate plugin on each one
218
+ $sites = get_sites();
219
+ foreach ( $sites as $site ) {
220
+ switch_to_blog( $site->blog_id );
221
+ $upload = wp_upload_dir();
222
+ $upload_dir = $upload['basedir'];
223
+ $upload_dir = trailingslashit( $upload_dir ) . SBY_UPLOADS_NAME;
224
+ if ( ! file_exists( $upload_dir ) ) {
225
+ $created = wp_mkdir_p( $upload_dir );
226
+ }
227
+ restore_current_blog();
228
+ }
229
+
230
+ } else {
231
+ $upload = wp_upload_dir();
232
+ $upload_dir = $upload['basedir'];
233
+ $upload_dir = trailingslashit( $upload_dir ) . SBY_UPLOADS_NAME;
234
+ if ( ! file_exists( $upload_dir ) ) {
235
+ $created = wp_mkdir_p( $upload_dir );
236
+ }
237
+ }
238
+
239
+ global $wp_roles;
240
+ $wp_roles->add_cap( 'administrator', 'manage_youtube_feed_options' );
241
+ }
242
+ register_activation_hook( __FILE__, 'sby_activate' );
243
+
244
+ /**
245
+ * Stop cron events when deactivated
246
+ *
247
+ * @since 1.0
248
+ */
249
+ function sby_deactivate() {
250
+ wp_clear_scheduled_hook( 'sby_cron_job' );
251
+ }
252
+ register_deactivation_hook( __FILE__, 'sby_deactivate' );
253
+
254
+
255
+ /**
256
+ * Compares previous plugin version and updates database related
257
+ * items as needed
258
+ *
259
+ * @since 2.0
260
+ */
261
+ function sby_check_for_db_updates() {
262
+
263
+ $db_ver = get_option( 'sby_db_version', 0 );
264
+
265
+ if ( (float) $db_ver < 1.0 ) {
266
+ update_option( 'sby_db_version', SBY_DBVERSION );
267
+ }
268
+
269
+ if ( (float) $db_ver < 1.1 ) {
270
+
271
+ $sby_statuses_option = get_option( 'sby_statuses', array() );
272
+
273
+ if ( ! isset( $sby_statuses_option['first_install'] ) ) {
274
+
275
+ $options_set = get_option( 'sby_options', false );
276
+
277
+ if ( $options_set ) {
278
+ $sby_statuses_option['first_install'] = 'from_update';
279
+ } else {
280
+ $sby_statuses_option['first_install'] = time();
281
+ }
282
+
283
+ $sby_rating_notice_option = get_option( 'sby_rating_notice', false );
284
+
285
+ if ( $sby_rating_notice_option === 'dismissed' ) {
286
+ $sby_statuses_option['rating_notice_dismissed'] = time();
287
+ }
288
+
289
+ $sby_rating_notice_waiting = get_transient( 'feeds_for_youtube_rating_notice_waiting' );
290
+
291
+ if ( $sby_rating_notice_waiting === false
292
+ && $sby_rating_notice_option === false ) {
293
+ $time = 2 * WEEK_IN_SECONDS;
294
+ set_transient( 'feeds_for_youtube_rating_notice_waiting', 'waiting', $time );
295
+ update_option( 'sby_rating_notice', 'pending', false );
296
+ }
297
+
298
+ update_option( 'sby_statuses', $sby_statuses_option, false );
299
+
300
+ }
301
+
302
+ update_option( 'sby_db_version', SBY_DBVERSION );
303
+ }
304
+
305
+ }
306
+ add_action( 'wp_loaded', 'sby_check_for_db_updates' );
307
+
308
+ /**
309
+ * Deletes saved data for the plugin unless setting to preserve
310
+ * settings is enabled
311
+ *
312
+ * @since 2.0 custom tables, custom images, and image directory deleted
313
+ * @since 1.0
314
+ */
315
+ function sby_uninstall() {
316
+ if ( ! current_user_can( 'activate_plugins' ) ) {
317
+ return;
318
+ }
319
+
320
+ //If the user is preserving the settings then don't delete them
321
+ $options = get_option( 'sby_settings' );
322
+ $preserve_settings = $options['preserve_settings'];
323
+ if ( $preserve_settings ) {
324
+ return;
325
+ }
326
+
327
+ //Settings
328
+ delete_option( 'sby_settings' );
329
+ delete_option( 'sby_ver' );
330
+ delete_option( 'sby_db_version' );
331
+ delete_option( 'sby_cron_report' );
332
+ delete_option( 'sby_errors' );
333
+ delete_option( 'sby_ajax_status' );
334
+ delete_option( 'sby_statuses' );
335
+
336
+ // Clear backup caches
337
+ global $wpdb;
338
+ $table_name = $wpdb->prefix . "options";
339
+ $wpdb->query( "
340
+ DELETE
341
+ FROM $table_name
342
+ WHERE `option_name` LIKE ('%!sb\_%')
343
+ " );
344
+
345
+ //image resizing
346
+ $upload = wp_upload_dir();
347
+ $posts_table_name = $wpdb->prefix . 'sby_items';
348
+ $feeds_posts_table_name = esc_sql( $wpdb->prefix . 'sby_items_feeds' );
349
+
350
+ $image_files = glob( trailingslashit( $upload['basedir'] ) . trailingslashit( 'sby-local-media' ) . '*' ); // get all file names
351
+ foreach ( $image_files as $file ) { // iterate files
352
+ if ( is_file( $file ) ) {
353
+ unlink( $file );
354
+ } // delete file
355
+ }
356
+
357
+ global $wp_filesystem;
358
+ $wp_filesystem->delete( trailingslashit( $upload['basedir'] ) . trailingslashit( 'sby-local-media' ) , true );
359
+ //Delete tables
360
+ $wpdb->query( "DROP TABLE IF EXISTS $posts_table_name" );
361
+ $wpdb->query( "DROP TABLE IF EXISTS $feeds_posts_table_name" );
362
+
363
+
364
+ global $wp_roles;
365
+ $wp_roles->remove_cap( 'administrator', 'manage_youtube_feed_options' );
366
+
367
+ }
368
+
369
+ register_uninstall_hook( __FILE__, 'sby_uninstall' );
370
+
371
+ /**
372
+ * Create database tables for sub-site if multisite
373
+ *
374
+ * @param int $blog_id
375
+ * @param int $user_id
376
+ * @param string $domain
377
+ * @param string $path
378
+ * @param string $site_id
379
+ * @param array $meta
380
+ *
381
+ * @since 2.0
382
+ */
383
+ function sby_on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
384
+ if ( is_plugin_active_for_network( 'youtube-feed/youtube-feed.php' ) ) {
385
+ switch_to_blog( $blog_id );
386
+ restore_current_blog();
387
+ }
388
+ }
389
+
390
+ add_action( 'wpmu_new_blog', 'sby_on_create_blog', 10, 6 );
391
+
392
+ /**
393
+ * Delete custom tables if not preserving settings
394
+ *
395
+ * @param array $tables tables to drop
396
+ *
397
+ * @return array
398
+ *
399
+ * @since 2.0
400
+ */
401
+ function sby_on_delete_blog( $tables ) {
402
+ $options = get_option( 'sby_settings' );
403
+ $preserve_settings = $options['preserve_settings'];
404
+ if ( $preserve_settings ) {
405
+ return;
406
+ }
407
+
408
+ global $wpdb;
409
+ $tables[] = $wpdb->prefix . 'sby_items';
410
+ $tables[] = $wpdb->prefix . 'sby_items_feeds';
411
+
412
+ return $tables;
413
+ }
414
+
415
+ add_filter( 'wpmu_drop_tables', 'sby_on_delete_blog' );
416
+
417
+ function sby_settings_defaults() {
418
+ $defaults = array(
419
+ 'have_own_tokens' => 0,
420
+ 'app_id' => '',
421
+ 'app_secret' => '',
422
+ 'connected_accounts' => array(),
423
+ 'type' => 'channel',
424
+ 'channel' => '',
425
+ 'num' => 8,
426
+ 'nummobile' => 8,
427
+ 'minnum' => 8,
428
+ 'widthresp' => true,
429
+ 'class' => '',
430
+ 'height' => '',
431
+ 'heightunit' => '%',
432
+ 'disablemobile' => false,
433
+ 'itemspacing' => 5,
434
+ 'itemspacingunit' => 'px',
435
+ 'background' => '',
436
+ 'headercolor' => '',
437
+ 'subscribecolor' => '',
438
+ 'subscribetextcolor' => '',
439
+ 'buttoncolor' => '',
440
+ 'buttontextcolor' => '',
441
+ 'layout' => 'list',
442
+ 'playvideo' => 'onclick',
443
+ 'sortby' => 'none',
444
+ 'imageres' => 'auto',
445
+ 'showheader' => true,
446
+ 'showdescription' => true,
447
+ 'showbutton' => true,
448
+ 'headersize' => 'small',
449
+ 'headeroutside' => false,
450
+ 'showsubscribe' => true,
451
+ 'buttontext' => __( 'Load More...', 'youtube-feed' ),
452
+ 'subscribetext' => __( 'Subscribe', 'youtube-feed' ),
453
+ 'caching_type' => 'page',
454
+ 'cache_time' => 1,
455
+ 'cache_time_unit' => 'hours',
456
+ 'backup_cache_enabled' => true,
457
+ 'resizeprocess' => 'background',
458
+ 'disable_resize' => true,
459
+ 'storage_process' => 'background',
460
+ 'favor_local' => false,
461
+ 'disable_js_image_loading' => false,
462
+ 'ajax_post_load' => false,
463
+ 'ajaxtheme' => false,
464
+ 'enqueue_css_in_shortcode' => false,
465
+ 'font_method' => 'svg',
466
+ 'customtemplates' => false,
467
+ 'gallerycols' => 4,
468
+ 'gallerycolsmobile' => 'auto',
469
+ 'gridcols' => 4,
470
+ 'gridcolsmobile' => 'auto',
471
+ );
472
+
473
+ return $defaults;
474
+ }
475
+
476
+ // Add a Settings link to the plugin on the Plugins page
477
+ $plugin_file = 'youtube-feed/youtube-feed.php';
478
+ add_filter( "plugin_action_links_{$plugin_file}", 'sby_add_settings_link', 10, 2 );
479
+ function sby_add_settings_link( $links, $file ) {
480
+ $sby_settings_link = '<a href="' . admin_url( 'admin.php?page=youtube-feed' ) . '">' . __( 'Settings' ) . '</a>';
481
+ array_unshift( $links, $sby_settings_link );
482
+ return $links;
483
+ }
484
+
485
+ function sby_text_domain() {
486
+ load_plugin_textdomain( 'youtube-feed', false, basename( dirname(__FILE__) ) . '/languages' );
487
+ }
488
+ add_action( 'plugins_loaded', 'sby_text_domain' );
489
+ }
490
+