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

Version Description

  • Tweak: Minor update to item.php template to accommodate dynamic title attribute in lightbox.
  • Tweak: Added support for improved notices on the plugin settings page.
  • Fix: Connecting an account that didn't have an associated YouTube channel would result in nothing happening. Now an empty channel is connected that can be used to create feeds.
  • Fix: Iframe player now uses the video title as the iframe element title attribute.
Download this release

Release Info

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

Code changes from version 1.2.3 to 1.2.4

Files changed (82) hide show
  1. README.txt +12 -6
  2. css/admin-notifications.css +171 -0
  3. css/sby-notices.css +56 -27
  4. inc/admin/admin-functions.php +11 -240
  5. inc/admin/class-sby-new-user.php +400 -0
  6. inc/admin/class-sby-notifications.php +582 -0
  7. inc/admin/templates/main.php +2 -0
  8. inc/admin/templates/single-connected-account.php +8 -2
  9. inc/sby-functions.php +3 -0
  10. js/admin-notifications.js +208 -0
  11. js/sb-youtube.js +4 -0
  12. js/sb-youtube.min.js +1 -1
  13. templates/item.php +2 -2
  14. trunk/README.txt +227 -0
  15. trunk/css/admin.css +1083 -0
  16. trunk/css/sb-youtube.css +1355 -0
  17. trunk/css/sb-youtube.min.css +1 -0
  18. trunk/css/sby-blocks.css +3 -0
  19. trunk/css/sby-notices.css +89 -0
  20. trunk/img/balloon.png +0 -0
  21. trunk/img/carousel.png +0 -0
  22. trunk/img/close.png +0 -0
  23. trunk/img/gallery.png +0 -0
  24. trunk/img/grid.png +0 -0
  25. trunk/img/lightbox-placeholder-narrow.png +0 -0
  26. trunk/img/lightbox-placeholder.png +0 -0
  27. trunk/img/list.png +0 -0
  28. trunk/img/next.png +0 -0
  29. trunk/img/placeholder-narrow.png +0 -0
  30. trunk/img/placeholder.png +0 -0
  31. trunk/img/prev.png +0 -0
  32. trunk/img/pro.png +0 -0
  33. {img → trunk/img}/sby-icon-offer.png +0 -0
  34. trunk/img/sby-icon.png +0 -0
  35. trunk/img/sby-sprite.png +0 -0
  36. trunk/img/smash-balloon-logo-small.png +0 -0
  37. trunk/inc/admin/admin-functions.php +1007 -0
  38. trunk/inc/admin/class-sbspf-admin.php +1045 -0
  39. trunk/inc/admin/class-sby-admin.php +956 -0
  40. trunk/inc/admin/templates/configure.php +42 -0
  41. trunk/inc/admin/templates/connected-accounts.php +41 -0
  42. trunk/inc/admin/templates/customize.php +22 -0
  43. trunk/inc/admin/templates/display.php +42 -0
  44. trunk/inc/admin/templates/main.php +79 -0
  45. trunk/inc/admin/templates/single-connected-account.php +55 -0
  46. trunk/inc/admin/templates/support.php +122 -0
  47. trunk/inc/blocks/class-sby-blocks.php +149 -0
  48. trunk/inc/class-sby-api-connect.php +195 -0
  49. trunk/inc/class-sby-cron-update.php +205 -0
  50. trunk/inc/class-sby-display-elements.php +369 -0
  51. trunk/inc/class-sby-feed.php +1634 -0
  52. trunk/inc/class-sby-parse.php +258 -0
  53. trunk/inc/class-sby-posts-manager.php +328 -0
  54. trunk/inc/class-sby-rss-connect.php +123 -0
  55. trunk/inc/class-sby-settings.php +352 -0
  56. trunk/inc/class-sby-vars.php +36 -0
  57. trunk/inc/class-sby-wp-post.php +166 -0
  58. trunk/inc/sby-functions.php +868 -0
  59. trunk/inc/widget.php +63 -0
  60. trunk/js/admin.js +880 -0
  61. trunk/js/sb-youtube.js +1805 -0
  62. trunk/js/sb-youtube.min.js +1 -0
  63. trunk/js/sby-blocks.js +126 -0
  64. trunk/languages/feeds-for-youtube-de_DE.mo +0 -0
  65. trunk/languages/feeds-for-youtube-de_DE.po +989 -0
  66. trunk/languages/feeds-for-youtube-fr_FR.mo +0 -0
  67. trunk/languages/feeds-for-youtube-fr_FR.po +989 -0
  68. trunk/languages/feeds-for-youtube.pot +990 -0
  69. trunk/languages/youtube-feed-de_DE.mo +0 -0
  70. trunk/languages/youtube-feed-de_DE.po +875 -0
  71. trunk/languages/youtube-feed-fr_FR.mo +0 -0
  72. trunk/languages/youtube-feed-fr_FR.po +875 -0
  73. trunk/languages/youtube-feed.pot +875 -0
  74. trunk/templates/feed.php +49 -0
  75. trunk/templates/footer.php +32 -0
  76. trunk/templates/header.php +29 -0
  77. trunk/templates/item.php +54 -0
  78. trunk/templates/player.php +26 -0
  79. trunk/uninstall.php +104 -0
  80. trunk/youtube-feed.php +636 -0
  81. uninstall.php +3 -0
  82. youtube-feed.php +42 -3
README.txt CHANGED
@@ -1,11 +1,11 @@
1
- === Feeds for YouTube (YouTube video, channel, and gallery plugin) ===
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.5
8
- Stable tag: 1.2.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -15,7 +15,7 @@ The Feeds for YouTube plugin allows you to display customizable YouTube feeds fr
15
  **Display customizable YouTube channel feeds on your website. Feed YouTube channel content automatically to your website in a powerful and customizable gallery.**
16
 
17
  ### YouTube Feed Features
18
- * **Completely Customizable** YouTube feeds - by default inherits your theme's styles
19
  * **Completely responsive and mobile optimized** - your feeds look great on any screen size
20
  * **Light and low overhead** - minimal bloat and optimized requests to YouTube
21
  * **Multiple layouts** - display videos from any YouTube channel in a list, gallery, or grid layout
@@ -32,8 +32,8 @@ For simple step-by-step directions on how to set up the Feeds for YouTube plugin
32
  ### Benefits
33
  * **Increase social engagement** between you and your subscribers
34
  * **Save time** by using the plugin to generate dynamic, search engine crawlable content on your website
35
- * **Get more subscribers** by displaying your videos directly on your site
36
- * Display your channel content **your way** to perfectly match your website's style
37
  * The plugin is **updated regularly** with new features, bug-fixes and API changes
38
  * Support is quick, effective, and always happy to help
39
  * We're dedicated to providing the **most customizable**, **robust** and **well supported** YouTube gallery plugin in the world!
@@ -165,6 +165,12 @@ By default, the plugin retrieves new videos for your YouTube gallery once every
165
  7. To display a YouTube feed just copy and paste the [youtube-feed] shortcode into a widget or page
166
 
167
  == Changelog ==
 
 
 
 
 
 
168
  = 1.2.3 =
169
  * New: Added setting to use WordPress cron to clear feed caches on an interval. If your feeds are not updating automatically, try enabling the setting found on the "Customize" tab "Cron Clear Cache".
170
  * Tweak: Added notice explaining the account connection and what it can and can't be used for when connecting an account.
1
+ === Feeds for YouTube - YouTube video, channel, and gallery plugin ===
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.6
8
+ Stable tag: 1.2.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
15
  **Display customizable YouTube channel feeds on your website. Feed YouTube channel content automatically to your website in a powerful and customizable gallery.**
16
 
17
  ### YouTube Feed Features
18
+ * **Completely Customizable** feeds - by default inherits your theme's styles
19
  * **Completely responsive and mobile optimized** - your feeds look great on any screen size
20
  * **Light and low overhead** - minimal bloat and optimized requests to YouTube
21
  * **Multiple layouts** - display videos from any YouTube channel in a list, gallery, or grid layout
32
  ### Benefits
33
  * **Increase social engagement** between you and your subscribers
34
  * **Save time** by using the plugin to generate dynamic, search engine crawlable content on your website
35
+ * **Get more YouTube subscribers** by displaying your YouTube videos directly on your site
36
+ * Display your YouTube channel content **your way** to perfectly match your website's style
37
  * The plugin is **updated regularly** with new features, bug-fixes and API changes
38
  * Support is quick, effective, and always happy to help
39
  * We're dedicated to providing the **most customizable**, **robust** and **well supported** YouTube gallery plugin in the world!
165
  7. To display a YouTube feed just copy and paste the [youtube-feed] shortcode into a widget or page
166
 
167
  == Changelog ==
168
+ = 1.2.4 =
169
+ * Tweak: Minor update to item.php template to accommodate dynamic title attribute in lightbox.
170
+ * Tweak: Added support for improved notices on the plugin settings page.
171
+ * Fix: Connecting an account that didn't have an associated YouTube channel would result in nothing happening. Now an empty channel is connected that can be used to create feeds.
172
+ * Fix: Iframe player now uses the video title as the iframe element title attribute.
173
+
174
  = 1.2.3 =
175
  * New: Added setting to use WordPress cron to clear feed caches on an interval. If your feeds are not updating automatically, try enabling the setting found on the "Customize" tab "Cron Clear Cache".
176
  * Tweak: Added notice explaining the account connection and what it can and can't be used for when connecting an account.
css/admin-notifications.css ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #sby-notifications {
2
+ position: relative;
3
+ background: #FFFFFF 0 0 no-repeat padding-box;
4
+ box-shadow: 0px 5px 15px #0000000D;
5
+ border-radius: 6px;
6
+ opacity: 1;
7
+ min-height: 48px;
8
+ padding: 15px 102px 15px 72px;
9
+ margin: 0 0 14px 0;
10
+ }
11
+
12
+ #sby-notifications * {
13
+ box-sizing: border-box;
14
+ }
15
+
16
+ #sby-notifications .bell,
17
+ #sby-notifications .thumb{
18
+ position: absolute;
19
+ top: 15px;
20
+ left: 15px;
21
+ width: 42px;
22
+ height: 48px;
23
+ }
24
+ #sby-notifications .thumb img {
25
+ max-width: 100%;
26
+ }
27
+ #sby-notifications .thumb .img-overlay {
28
+ top: 42px;
29
+ left: -6px;
30
+ width: 54px;
31
+ position: absolute;
32
+ background: #ca4a1f;
33
+ color: #fff;
34
+ padding: 2px 4px;
35
+ border-radius: 3px;
36
+ line-height: 1;
37
+ font-size: 11px;
38
+ font-weight: bold;
39
+ text-align: center;
40
+ }
41
+
42
+ #sby-notifications .messages .message {
43
+ display: none;
44
+ }
45
+
46
+ #sby-notifications .messages .message.current {
47
+ display: block;
48
+ }
49
+
50
+ #sby-notifications .messages .message .title {
51
+ font-weight: bold;
52
+ font-size: 17px;
53
+ line-height: 20px;
54
+ margin: 0;
55
+ color: #444;
56
+ }
57
+
58
+ #sby-notifications .messages .message .content {
59
+ font-weight: normal;
60
+ font-size: 13px;
61
+ line-height: 20px;
62
+ margin: 6px 0 40px 0;
63
+ }
64
+
65
+ #sby-notifications .messages .message .buttons {
66
+ margin: -30px 80px 0 0;
67
+ }
68
+
69
+ #sby-notifications .messages .message .buttons a {
70
+ margin: 0 6px 0 0;
71
+ padding: 8px 10px;
72
+ line-height: 13px;
73
+ font-size: 13px;
74
+ min-height: unset;
75
+ }
76
+
77
+ #sby-notifications .messages .message .buttons .button-secondary {
78
+ border: 1px solid #0071A1;
79
+ }
80
+
81
+ #sby-notifications .dismiss {
82
+ position: absolute;
83
+ top: 15px;
84
+ right: 15px;
85
+ width: 16px;
86
+ height: 16px;
87
+ color: #72777C;
88
+ font-size: 16px;
89
+ cursor: pointer;
90
+ text-align: center;
91
+ vertical-align: middle;
92
+ line-height: 16px;
93
+ }
94
+
95
+ #sby-notifications .dismiss:hover {
96
+ color: #dc3232;
97
+ }
98
+
99
+ #sby-notifications .navigation {
100
+ position: absolute;
101
+ bottom: 15px;
102
+ right: 15px;
103
+ width: 63px;
104
+ height: 30px;
105
+ }
106
+
107
+ #sby-notifications .navigation a {
108
+ display: block;
109
+ width: 30px;
110
+ height: 30px;
111
+ border: 1px solid #7E8993;
112
+ border-radius: 3px;
113
+ font-size: 8px;
114
+ text-align: center;
115
+ vertical-align: middle;
116
+ line-height: 30px;
117
+ cursor: pointer;
118
+ background-color: #ffffff;
119
+ color: #41454A;
120
+ }
121
+ #sby-notifications .navigation svg {
122
+ width: 8px;
123
+ height: 8px;
124
+ }
125
+
126
+ #sby-notifications .navigation a:hover {
127
+ background-color: #f1f1f1;
128
+ }
129
+
130
+ #sby-notifications .navigation .prev {
131
+ float: left;
132
+ }
133
+
134
+ #sby-notifications .navigation .next {
135
+ float: right;
136
+ }
137
+
138
+ #sby-notifications .navigation .disabled {
139
+ border-color: #dddddd;
140
+ color: #A0A5AA;
141
+ cursor: default;
142
+ }
143
+
144
+ #sby-notifications .navigation .disabled:hover {
145
+ background-color: #ffffff;
146
+ }
147
+
148
+ @media screen and (max-width: 768px) {
149
+ #sby-notifications {
150
+ padding: 15px 15px 15px 72px;
151
+ }
152
+ #sby-notifications .messages .message .title {
153
+ margin: 0 30px 0 0;
154
+ }
155
+ #sby-notifications .messages .message .content {
156
+ font-size: 16px;
157
+ line-height: 24px;
158
+ }
159
+ #sby-notifications .messages .message .buttons {
160
+ margin: -30px 80px 0 0;
161
+ }
162
+ #sby-notifications .messages .message .buttons a {
163
+ margin: 0;
164
+ display: table;
165
+ }
166
+ #sby-notifications .messages .message .buttons .button-secondary {
167
+ margin-top: 6px;
168
+ }
169
+ }
170
+
171
+ /*# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzZXRzL2Nzcy9hZG1pbi1ub3RpZmljYXRpb25zLmNzcyIsInNvdXJjZXMiOlsiYXNzZXRzL3Njc3MvYWRtaW4tbm90aWZpY2F0aW9ucy5zY3NzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIEFkbWluIG5vdGlmaWNhdGlvbiBzdHlsZXMuXG5cbiN3cGZvcm1zLW5vdGlmaWNhdGlvbnMge1xuXG5cdHBvc2l0aW9uOiByZWxhdGl2ZTtcblx0YmFja2dyb3VuZDogI0ZGRkZGRiAwIDAgbm8tcmVwZWF0IHBhZGRpbmctYm94O1xuXHRib3gtc2hhZG93OiAwcHggNXB4IDE1cHggIzAwMDAwMDBEO1xuXHRib3JkZXItcmFkaXVzOiA2cHg7XG5cdG9wYWNpdHk6IDE7XG5cdG1pbi1oZWlnaHQ6IDQ4cHg7XG5cdHBhZGRpbmc6IDE1cHggMTAycHggMTVweCA3MnB4O1xuXHRtYXJnaW46IDAgMCAxNHB4IDA7XG5cblx0KiB7XG5cdFx0Ym94LXNpemluZzogYm9yZGVyLWJveDtcblx0fVxuXG5cdC5iZWxsIHtcblx0XHRwb3NpdGlvbjogYWJzb2x1dGU7XG5cdFx0dG9wOiAxNXB4O1xuXHRcdGxlZnQ6IDE1cHg7XG5cdFx0d2lkdGg6IDQycHg7XG5cdFx0aGVpZ2h0OiA0OHB4O1xuXHR9XG5cblx0Lm1lc3NhZ2VzIHtcblx0XHQubWVzc2FnZSB7XG5cdFx0XHRkaXNwbGF5OiBub25lO1xuXG5cdFx0XHQmLmN1cnJlbnQge1xuXHRcdFx0XHRkaXNwbGF5OiBibG9jaztcblx0XHRcdH1cblxuXHRcdFx0LnRpdGxlIHtcblx0XHRcdFx0Zm9udC13ZWlnaHQ6IGJvbGQ7XG5cdFx0XHRcdGZvbnQtc2l6ZTogMTdweDtcblx0XHRcdFx0bGluZS1oZWlnaHQ6IDIwcHg7XG5cdFx0XHRcdG1hcmdpbjogMDtcblx0XHRcdFx0Y29sb3I6ICM0NDQ7XG5cdFx0XHR9XG5cblx0XHRcdC5jb250ZW50IHtcblx0XHRcdFx0Zm9udC13ZWlnaHQ6IG5vcm1hbDtcblx0XHRcdFx0Zm9udC1zaXplOiAxM3B4O1xuXHRcdFx0XHRsaW5lLWhlaWdodDogMjBweDtcblx0XHRcdFx0bWFyZ2luOiA2cHggMCA0MHB4IDA7XG5cdFx0XHR9XG5cblx0XHRcdC5idXR0b25zIHtcblx0XHRcdFx0bWFyZ2luOiAtMzBweCA4MHB4IDAgMDtcblxuXHRcdFx0XHRhIHtcblx0XHRcdFx0XHRtYXJnaW46IDAgNnB4IDAgMDtcblx0XHRcdFx0XHRwYWRkaW5nOiA4cHggMTBweDtcblx0XHRcdFx0XHRsaW5lLWhlaWdodDogMTNweDtcblx0XHRcdFx0XHRmb250LXNpemU6IDEzcHg7XG5cdFx0XHRcdFx0bWluLWhlaWdodDogdW5zZXQ7XG5cdFx0XHRcdH1cblxuXHRcdFx0XHQuYnV0dG9uLXNlY29uZGFyeSB7XG5cdFx0XHRcdFx0Ym9yZGVyOiAxcHggc29saWQgIzAwNzFBMTtcblx0XHRcdFx0fVxuXHRcdFx0fVxuXHRcdH1cblx0fVxuXG5cdC5kaXNtaXNzIHtcblx0XHRwb3NpdGlvbjogYWJzb2x1dGU7XG5cdFx0dG9wOiAxNXB4O1xuXHRcdHJpZ2h0OiAxNXB4O1xuXHRcdHdpZHRoOiAxNnB4O1xuXHRcdGhlaWdodDogMTZweDtcblx0XHRjb2xvcjogIzcyNzc3Qztcblx0XHRmb250LXNpemU6IDE2cHg7XG5cdFx0Y3Vyc29yOiBwb2ludGVyO1xuXHRcdHRleHQtYWxpZ246IGNlbnRlcjtcblx0XHR2ZXJ0aWNhbC1hbGlnbjogbWlkZGxlO1xuXHRcdGxpbmUtaGVpZ2h0OiAxNnB4O1xuXG5cdFx0Jjpob3ZlciB7XG5cdFx0XHRjb2xvcjogI2RjMzIzMjtcblx0XHR9XG5cdH1cblxuXHQubmF2aWdhdGlvbiB7XG5cdFx0cG9zaXRpb246IGFic29sdXRlO1xuXHRcdGJvdHRvbTogMTVweDtcblx0XHRyaWdodDogMTVweDtcblx0XHR3aWR0aDogNjNweDtcblx0XHRoZWlnaHQ6IDMwcHg7XG5cblx0XHRhIHtcblx0XHRcdGRpc3BsYXk6IGJsb2NrO1xuXHRcdFx0d2lkdGg6IDMwcHg7XG5cdFx0XHRoZWlnaHQ6IDMwcHg7XG5cdFx0XHRib3JkZXI6IDFweCBzb2xpZCAjN0U4OTkzO1xuXHRcdFx0Ym9yZGVyLXJhZGl1czogM3B4O1xuXHRcdFx0Zm9udC1zaXplOiA4cHg7XG5cdFx0XHR0ZXh0LWFsaWduOiBjZW50ZXI7XG5cdFx0XHR2ZXJ0aWNhbC1hbGlnbjogbWlkZGxlO1xuXHRcdFx0bGluZS1oZWlnaHQ6IDMwcHg7XG5cdFx0XHRjdXJzb3I6IHBvaW50ZXI7XG5cdFx0XHRiYWNrZ3JvdW5kLWNvbG9yOiAjZmZmZmZmO1xuXHRcdFx0Y29sb3I6ICM0MTQ1NEE7XG5cblx0XHRcdCY6aG92ZXIge1xuXHRcdFx0XHRiYWNrZ3JvdW5kLWNvbG9yOiAjZjFmMWYxO1xuXHRcdFx0fVxuXHRcdH1cblxuXHRcdC5wcmV2IHtcblx0XHRcdGZsb2F0OiBsZWZ0O1xuXHRcdH1cblxuXHRcdC5uZXh0IHtcblx0XHRcdGZsb2F0OiByaWdodDtcblx0XHR9XG5cblx0XHQuZGlzYWJsZWQge1xuXHRcdFx0Ym9yZGVyLWNvbG9yOiAjZGRkZGRkO1xuXHRcdFx0Y29sb3I6ICNBMEE1QUE7XG5cdFx0XHRjdXJzb3I6IGRlZmF1bHQ7XG5cblx0XHRcdCY6aG92ZXIge1xuXHRcdFx0XHRiYWNrZ3JvdW5kLWNvbG9yOiAjZmZmZmZmO1xuXHRcdFx0fVxuXHRcdH1cblx0fVxufVxuXG5AbWVkaWEgc2NyZWVuIGFuZCAobWF4LXdpZHRoOiA3NjhweCkge1xuXG5cdCN3cGZvcm1zLW5vdGlmaWNhdGlvbnMge1xuXHRcdHBhZGRpbmc6IDE1cHggMTVweCAxNXB4IDcycHg7XG5cblx0XHQubWVzc2FnZXMge1xuXG5cdFx0XHQubWVzc2FnZSB7XG5cblx0XHRcdFx0LnRpdGxlIHtcblx0XHRcdFx0XHRtYXJnaW46IDAgMzBweCAwIDA7XG5cdFx0XHRcdH1cblxuXHRcdFx0XHQuY29udGVudCB7XG5cdFx0XHRcdFx0Zm9udC1zaXplOiAxNnB4O1xuXHRcdFx0XHRcdGxpbmUtaGVpZ2h0OiAyNHB4XG5cdFx0XHRcdH1cblxuXHRcdFx0XHQuYnV0dG9ucyB7XG5cdFx0XHRcdFx0bWFyZ2luOiAtMzBweCA4MHB4IDAgMDtcblxuXHRcdFx0XHRcdGEge1xuXHRcdFx0XHRcdFx0bWFyZ2luOiAwO1xuXHRcdFx0XHRcdFx0ZGlzcGxheTogdGFibGU7XG5cdFx0XHRcdFx0fVxuXG5cdFx0XHRcdFx0LmJ1dHRvbi1zZWNvbmRhcnkge1xuXHRcdFx0XHRcdFx0bWFyZ2luLXRvcDogNnB4O1xuXHRcdFx0XHRcdH1cblx0XHRcdFx0fVxuXHRcdFx0fVxuXHRcdH1cblx0fVxufSJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxBQUFBLHNCQUFzQixDQUFDO0VBRXRCLFFBQVEsRUFBRSxRQUFRO0VBQ2xCLFVBQVUsRUFBRSxpQ0FBaUM7RUFDN0MsVUFBVSxFQUFFLHNCQUFzQjtFQUNsQyxhQUFhLEVBQUUsR0FBRztFQUNsQixPQUFPLEVBQUUsQ0FBQztFQUNWLFVBQVUsRUFBRSxJQUFJO0VBQ2hCLE9BQU8sRUFBRSxvQkFBb0I7RUFDN0IsTUFBTSxFQUFFLFVBQVU7Q0FxSGxCOztBQTlIRCxBQVdDLHNCQVhxQixDQVdyQixDQUFDLENBQUM7RUFDRCxVQUFVLEVBQUUsVUFBVTtDQUN0Qjs7QUFiRixBQWVDLHNCQWZxQixDQWVyQixLQUFLLENBQUM7RUFDTCxRQUFRLEVBQUUsUUFBUTtFQUNsQixHQUFHLEVBQUUsSUFBSTtFQUNULElBQUksRUFBRSxJQUFJO0VBQ1YsS0FBSyxFQUFFLElBQUk7RUFDWCxNQUFNLEVBQUUsSUFBSTtDQUNaOztBQXJCRixBQXdCRSxzQkF4Qm9CLENBdUJyQixTQUFTLENBQ1IsUUFBUSxDQUFDO0VBQ1IsT0FBTyxFQUFFLElBQUk7Q0FvQ2I7O0FBN0RILEFBMkJHLHNCQTNCbUIsQ0F1QnJCLFNBQVMsQ0FDUixRQUFRLEFBR04sUUFBUSxDQUFDO0VBQ1QsT0FBTyxFQUFFLEtBQUs7Q0FDZDs7QUE3QkosQUErQkcsc0JBL0JtQixDQXVCckIsU0FBUyxDQUNSLFFBQVEsQ0FPUCxNQUFNLENBQUM7RUFDTixXQUFXLEVBQUUsSUFBSTtFQUNqQixTQUFTLEVBQUUsSUFBSTtFQUNmLFdBQVcsRUFBRSxJQUFJO0VBQ2pCLE1BQU0sRUFBRSxDQUFDO0VBQ1QsS0FBSyxFQUFFLElBQUk7Q0FDWDs7QUFyQ0osQUF1Q0csc0JBdkNtQixDQXVCckIsU0FBUyxDQUNSLFFBQVEsQ0FlUCxRQUFRLENBQUM7RUFDUixXQUFXLEVBQUUsTUFBTTtFQUNuQixTQUFTLEVBQUUsSUFBSTtFQUNmLFdBQVcsRUFBRSxJQUFJO0VBQ2pCLE1BQU0sRUFBRSxZQUFZO0NBQ3BCOztBQTVDSixBQThDRyxzQkE5Q21CLENBdUJyQixTQUFTLENBQ1IsUUFBUSxDQXNCUCxRQUFRLENBQUM7RUFDUixNQUFNLEVBQUUsY0FBYztDQWF0Qjs7QUE1REosQUFpREksc0JBakRrQixDQXVCckIsU0FBUyxDQUNSLFFBQVEsQ0FzQlAsUUFBUSxDQUdQLENBQUMsQ0FBQztFQUNELE1BQU0sRUFBRSxTQUFTO0VBQ2pCLE9BQU8sRUFBRSxRQUFRO0VBQ2pCLFdBQVcsRUFBRSxJQUFJO0VBQ2pCLFNBQVMsRUFBRSxJQUFJO0VBQ2YsVUFBVSxFQUFFLEtBQUs7Q0FDakI7O0FBdkRMLEFBeURJLHNCQXpEa0IsQ0F1QnJCLFNBQVMsQ0FDUixRQUFRLENBc0JQLFFBQVEsQ0FXUCxpQkFBaUIsQ0FBQztFQUNqQixNQUFNLEVBQUUsaUJBQWlCO0NBQ3pCOztBQTNETCxBQWdFQyxzQkFoRXFCLENBZ0VyQixRQUFRLENBQUM7RUFDUixRQUFRLEVBQUUsUUFBUTtFQUNsQixHQUFHLEVBQUUsSUFBSTtFQUNULEtBQUssRUFBRSxJQUFJO0VBQ1gsS0FBSyxFQUFFLElBQUk7RUFDWCxNQUFNLEVBQUUsSUFBSTtFQUNaLEtBQUssRUFBRSxPQUFPO0VBQ2QsU0FBUyxFQUFFLElBQUk7RUFDZixNQUFNLEVBQUUsT0FBTztFQUNmLFVBQVUsRUFBRSxNQUFNO0VBQ2xCLGNBQWMsRUFBRSxNQUFNO0VBQ3RCLFdBQVcsRUFBRSxJQUFJO0NBS2pCOztBQWhGRixBQTZFRSxzQkE3RW9CLENBZ0VyQixRQUFRLEFBYU4sTUFBTSxDQUFDO0VBQ1AsS0FBSyxFQUFFLE9BQU87Q0FDZDs7QUEvRUgsQUFrRkMsc0JBbEZxQixDQWtGckIsV0FBVyxDQUFDO0VBQ1gsUUFBUSxFQUFFLFFBQVE7RUFDbEIsTUFBTSxFQUFFLElBQUk7RUFDWixLQUFLLEVBQUUsSUFBSTtFQUNYLEtBQUssRUFBRSxJQUFJO0VBQ1gsTUFBTSxFQUFFLElBQUk7Q0FzQ1o7O0FBN0hGLEFBeUZFLHNCQXpGb0IsQ0FrRnJCLFdBQVcsQ0FPVixDQUFDLENBQUM7RUFDRCxPQUFPLEVBQUUsS0FBSztFQUNkLEtBQUssRUFBRSxJQUFJO0VBQ1gsTUFBTSxFQUFFLElBQUk7RUFDWixNQUFNLEVBQUUsaUJBQWlCO0VBQ3pCLGFBQWEsRUFBRSxHQUFHO0VBQ2xCLFNBQVMsRUFBRSxHQUFHO0VBQ2QsVUFBVSxFQUFFLE1BQU07RUFDbEIsY0FBYyxFQUFFLE1BQU07RUFDdEIsV0FBVyxFQUFFLElBQUk7RUFDakIsTUFBTSxFQUFFLE9BQU87RUFDZixnQkFBZ0IsRUFBRSxPQUFPO0VBQ3pCLEtBQUssRUFBRSxPQUFPO0NBS2Q7O0FBMUdILEFBdUdHLHNCQXZHbUIsQ0FrRnJCLFdBQVcsQ0FPVixDQUFDLEFBY0MsTUFBTSxDQUFDO0VBQ1AsZ0JBQWdCLEVBQUUsT0FBTztDQUN6Qjs7QUF6R0osQUE0R0Usc0JBNUdvQixDQWtGckIsV0FBVyxDQTBCVixLQUFLLENBQUM7RUFDTCxLQUFLLEVBQUUsSUFBSTtDQUNYOztBQTlHSCxBQWdIRSxzQkFoSG9CLENBa0ZyQixXQUFXLENBOEJWLEtBQUssQ0FBQztFQUNMLEtBQUssRUFBRSxLQUFLO0NBQ1o7O0FBbEhILEFBb0hFLHNCQXBIb0IsQ0FrRnJCLFdBQVcsQ0FrQ1YsU0FBUyxDQUFDO0VBQ1QsWUFBWSxFQUFFLE9BQU87RUFDckIsS0FBSyxFQUFFLE9BQU87RUFDZCxNQUFNLEVBQUUsT0FBTztDQUtmOztBQTVISCxBQXlIRyxzQkF6SG1CLENBa0ZyQixXQUFXLENBa0NWLFNBQVMsQUFLUCxNQUFNLENBQUM7RUFDUCxnQkFBZ0IsRUFBRSxPQUFPO0NBQ3pCOztBQUtKLE1BQU0sQ0FBQyxNQUFNLE1BQU0sU0FBUyxFQUFFLEtBQUs7RUFFbEMsQUFBQSxzQkFBc0IsQ0FBQztJQUN0QixPQUFPLEVBQUUsbUJBQW1CO0dBNkI1QjtFQTlCRCxBQU9HLHNCQVBtQixDQUdyQixTQUFTLENBRVIsUUFBUSxDQUVQLE1BQU0sQ0FBQztJQUNOLE1BQU0sRUFBRSxVQUFVO0dBQ2xCO0VBVEosQUFXRyxzQkFYbUIsQ0FHckIsU0FBUyxDQUVSLFFBQVEsQ0FNUCxRQUFRLENBQUM7SUFDUixTQUFTLEVBQUUsSUFBSTtJQUNmLFdBQVcsRUFBRSxJQUNkO0dBQUM7RUFkSixBQWdCRyxzQkFoQm1CLENBR3JCLFNBQVMsQ0FFUixRQUFRLENBV1AsUUFBUSxDQUFDO0lBQ1IsTUFBTSxFQUFFLGNBQWM7R0FVdEI7RUEzQkosQUFtQkksc0JBbkJrQixDQUdyQixTQUFTLENBRVIsUUFBUSxDQVdQLFFBQVEsQ0FHUCxDQUFDLENBQUM7SUFDRCxNQUFNLEVBQUUsQ0FBQztJQUNULE9BQU8sRUFBRSxLQUFLO0dBQ2Q7RUF0QkwsQUF3Qkksc0JBeEJrQixDQUdyQixTQUFTLENBRVIsUUFBUSxDQVdQLFFBQVEsQ0FRUCxpQkFBaUIsQ0FBQztJQUNqQixVQUFVLEVBQUUsR0FBRztHQUNmIn0= */
css/sby-notices.css CHANGED
@@ -1,8 +1,8 @@
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
 
@@ -10,11 +10,9 @@
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
 
@@ -22,13 +20,31 @@
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;
@@ -36,37 +52,43 @@
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;
@@ -74,16 +96,23 @@
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
  }
1
  /* Review notice */
2
+ .sby_notice{
3
  position: relative;
4
  overflow: hidden;
5
+ max-width: 885px;
6
  margin-top: 10px;
7
  padding: 10px 10px 7px 10px;
8
 
10
  border: 1px solid #6AB074;
11
  color: #214F28;
12
  }
13
+ .sby_notice .sby_thumb{
14
+ position: relative;
15
+ display: inline-block;
 
 
16
  width: 74px;
17
  margin: 0 0 0 -100% !important;
18
 
20
  -webkit-border-radius: 4px;
21
  border-radius: 4px;
22
  }
23
+ .sby_notice .sby_thumb .img-overlay {
24
+ position: absolute;
25
+ bottom: 4px;
26
+ padding: 6px 7px 6px 5px;
27
+ font-size: 13px;
28
+ font-weight: bold;
29
+ background: #fff;
30
+ background: rgba(255,255,255,0.85);
31
+ line-height: 1;
32
+ color: #333;
33
+ box-shadow: 1px -1px 3px 0 rgba(0,0,0,0.15);
34
+ }
35
+ .sby_notice .sby_thumb img {
36
+ max-width: 100%;
37
+ }
38
+ .sby_notice .sby-notice-text{
39
  float: left;
40
  clear: none;
41
  width: 100%;
42
  padding: 0;
43
  }
44
+ .sby_notice .sby-links{
45
+ margin-top: 4px !important;
46
+ }
47
+ .sby_notice p{
48
  float: left;
49
  clear: both;
50
  width: auto;
52
  padding: 2px 40px 2px 0;
53
  line-height: 1.4;
54
  }
55
+ .sby_notice a{
 
 
 
56
  display: inline-block;
57
  padding: 0 8px;
58
  color: #178529;
59
  }
60
+ .sby_notice a:hover,
61
+ .sby_notice a:focus{
62
  color: #0c7abf;
63
  }
64
+ .sby_notice .links{
65
+ margin: 0 0 0 90px !important;
66
  padding: 4px 0 0 0;
67
+ margin-top: 1px !important;
68
  }
69
+ .sby_review_notice .links{
70
+ margin-left: 82px !important;
71
+ margin-top: 0 !important;
72
+ }
73
+ .sby_notice .sby_notice_close,
74
+ .sby_notice .sby_bfcm_sale_notice_close,
75
+ .sby_notice .sby_new_user_sale_notice_close {
76
  position: absolute;
77
  top: 0;
78
  right: 0;
79
  padding: 10px;
80
  line-height: 1;
81
  }
82
+ .sby_notice .sby_notice_close:hover,
83
+ .sby_notice .sby_notice_close:focus{
84
  color: #a34100;
85
  }
86
+ .sby_notice strong span {
87
+ font-weight: 900;
88
+ }
89
+ /* Notice CTA btn */
90
+ .sby_notice .sby_offer_btn,
91
+ .sby_notice .sby_main_cta{
92
  padding: 4px 12px 6px 12px;
93
  background: green;
94
  color: #fff;
96
  display: inline-block;
97
  text-decoration: none;
98
  margin-left: 0;
99
+ margin-right: 4px;
100
  }
101
+ .sby_notice .sby_offer_btn:hover,
102
+ .sby_notice .sby_offer_btn:focus,
103
+ .sby_notice .sby_main_cta:hover,
104
+ .sby_notice .sby_main_cta:focus{
105
  background: #049404;
106
  color: #fff;
107
  }
108
+ .sby_notice .sby_other_notice{
109
  padding-top: 10px;
110
  font-style: italic;
111
  font-size: 12px;
112
  }
113
+ .sby_notice .sby_other_notice a{
114
  padding: 0;
115
+ }
116
+ .sby_notice .links > .sby_main_cta:first-child {
117
+ margin-left: 8px;
118
  }
inc/admin/admin-functions.php CHANGED
@@ -543,6 +543,16 @@ function sby_attempt_connection() {
543
  //privacyStatus
544
  SBY_Admin::connect_account( $account_info );
545
 
 
 
 
 
 
 
 
 
 
 
546
  return $account_info;
547
  }
548
  }
@@ -675,253 +685,14 @@ function sby_get_current_time() {
675
  // generates the html for the admin notices
676
  function sby_notices_html() {
677
 
678
- if ( function_exists( 'sbi_notices_html' ) || function_exists( 'cff_notices_html' || function_exists( 'ctf_notices_html' ) ) ) {
679
- return;
680
- }
681
-
682
- $current_screen = get_current_screen();
683
- $is_plugins_page = isset( $current_screen->id ) && $current_screen->id === 'plugins';
684
- $page = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
685
- //Only show to admins
686
- if ( ! current_user_can( 'manage_options' ) ) {
687
- return;
688
- }
689
-
690
- $sby_statuses_option = get_option( 'sby_statuses', array() );
691
- $current_time = sby_get_current_time();
692
- $sby_bfcm_discount_code = 'happysmashgiving' . date('Y', $current_time );
693
-
694
- // reset everything for testing
695
- if ( false ) {
696
- global $current_user;
697
- $user_id = $current_user->ID;
698
- delete_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice' );
699
- //delete_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
700
- //$sby_statuses_option = array( 'first_install' => strtotime( 'December 8, 2019' ) );
701
- //$sby_statuses_option = array( 'first_install' => time() );
702
-
703
- //update_option( 'sby_statuses', $sby_statuses_option, false );
704
- //delete_option( 'sby_rating_notice');
705
  //delete_transient( 'instagram_feed_rating_notice_waiting' );
706
 
707
  //set_transient( 'instagram_feed_rating_notice_waiting', 'waiting', 2 * WEEK_IN_SECONDS );
708
  //update_option( 'sby_rating_notice', 'pending', false );
709
- }
710
-
711
- //$sby_statuses_option['rating_notice_dismissed'] = time();
712
- //update_option( 'sby_statuses', $sby_statuses_option, false );
713
- // rating notice logic
714
- $sby_rating_notice_option = get_option( 'sby_rating_notice', false );
715
- $sby_rating_notice_waiting = get_transient( 'feeds_for_youtube_rating_notice_waiting' );
716
- $should_show_rating_notice = ($sby_rating_notice_waiting !== 'waiting' && $sby_rating_notice_option !== 'dismissed');
717
-
718
- // black friday cyber monday logic
719
- $thanksgiving_this_year = sby_get_future_date( 11, date('Y', $current_time ), 4, 4, 1 );
720
- $one_week_before_black_friday_this_year = $thanksgiving_this_year - 7*24*60*60;
721
- $one_day_after_cyber_monday_this_year = $thanksgiving_this_year + 5*24*60*60;
722
- $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;
723
-
724
- $could_show_bfcm_discount = ($current_time > $one_week_before_black_friday_this_year && $current_time < $one_day_after_cyber_monday_this_year);
725
- $should_show_bfcm_discount = false;
726
- if ( $could_show_bfcm_discount && $has_been_two_days_since_rating_dismissal ) {
727
- global $current_user;
728
- $user_id = $current_user->ID;
729
-
730
- $ignore_bfcm_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice' );
731
- $ignore_bfcm_sale_notice_meta = isset( $ignore_bfcm_sale_notice_meta[0] ) ? $ignore_bfcm_sale_notice_meta[0] : '';
732
-
733
- /* Check that the user hasn't already clicked to ignore the message */
734
- $should_show_bfcm_discount = ($ignore_bfcm_sale_notice_meta !== 'always' && $ignore_bfcm_sale_notice_meta !== date( 'Y', $current_time ));
735
- }
736
-
737
- // new user discount logic
738
- $in_new_user_month_range = true;
739
- $should_show_new_user_discount = false;
740
- $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;
741
-
742
- if ( isset( $sby_statuses_option['first_install'] ) && $sby_statuses_option['first_install'] === 'from_update' ) {
743
- global $current_user;
744
- $user_id = $current_user->ID;
745
- $ignore_new_user_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
746
- $ignore_new_user_sale_notice_meta = isset( $ignore_new_user_sale_notice_meta[0] ) ? $ignore_new_user_sale_notice_meta[0] : '';
747
-
748
- if ( $ignore_new_user_sale_notice_meta !== 'always' ) {
749
- $should_show_new_user_discount = true;
750
- }
751
- } elseif ( $in_new_user_month_range && $has_been_one_month_since_rating_dismissal ) {
752
- global $current_user;
753
- $user_id = $current_user->ID;
754
- $ignore_new_user_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
755
- $ignore_new_user_sale_notice_meta = isset( $ignore_new_user_sale_notice_meta[0] ) ? $ignore_new_user_sale_notice_meta[0] : '';
756
-
757
- if ( $ignore_new_user_sale_notice_meta !== 'always'
758
- && isset( $sby_statuses_option['first_install'] )
759
- && $current_time > (int)$sby_statuses_option['first_install'] + 60*60*24*30 ) {
760
- $should_show_new_user_discount = true;
761
- }
762
- }
763
-
764
- // for debugging
765
- if ( false ) {
766
- global $current_user;
767
- $user_id = $current_user->ID;
768
- $ignore_bfcm_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice' );
769
- $ignore_new_user_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
770
-
771
- var_dump( 'new user rating option', $sby_rating_notice_option );
772
- var_dump( 'new user rating transient', $sby_rating_notice_waiting );
773
-
774
- var_dump( 'should show new user rating notice?', $should_show_rating_notice );
775
-
776
- var_dump( 'new user discount month range?', $in_new_user_month_range );
777
- var_dump( 'should show new user discount?', $should_show_new_user_discount );
778
-
779
- var_dump( 'Thanksgiving this year?', date('m/d/Y', $thanksgiving_this_year ) );
780
-
781
- var_dump( 'could show bfcm discount?', $could_show_bfcm_discount );
782
- var_dump( 'rating was dismissed?', date('m/d/Y', $sby_statuses_option['rating_notice_dismissed'] ) );
783
-
784
- var_dump( 'should show bfcm discount?', $should_show_bfcm_discount );
785
 
786
- var_dump( 'ignore_bfcm_sale_notice_meta', $ignore_bfcm_sale_notice_meta );
787
- var_dump( 'ignore_new_user_sale_notice_meta', $ignore_new_user_sale_notice_meta );
788
-
789
- var_dump( $sby_statuses_option );
790
- }
791
-
792
-
793
- // no pro version yet, set these to false
794
- $should_show_new_user_discount = false;
795
- $should_show_bfcm_discount = false;
796
-
797
- if ( $should_show_rating_notice ) {
798
- $other_notice_html = '';
799
- $dismiss_url = add_query_arg( 'sby_ignore_rating_notice_nag', '1' );
800
- $later_url = add_query_arg( 'sby_ignore_rating_notice_nag', 'later' );
801
- if ( $should_show_bfcm_discount ) {
802
- $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 60% off the Pro version!', SBY_TEXT_DOMAIN ) . '</p>';
803
-
804
- $dismiss_url = add_query_arg( array(
805
- 'sby_ignore_rating_notice_nag' => '1',
806
- 'sby_ignore_bfcm_sale_notice' => date( 'Y', $current_time )
807
- )
808
- );
809
- $later_url = add_query_arg( array(
810
- 'sby_ignore_rating_notice_nag' => 'later',
811
- 'sby_ignore_bfcm_sale_notice' => date( 'Y', $current_time )
812
- )
813
- );
814
- }
815
-
816
- echo "
817
- <div class='sby_notice sby_review_notice'>
818
- <img src='". SBY_PLUGIN_URL . 'img/sby-icon.png' ."' alt='" . SBY_PLUGIN_NAME . "'>
819
- <div class='sby-notice-text'>
820
- <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>
821
- <p class='links'";
822
- if( $should_show_bfcm_discount ) echo " style='margin-top: 0 !important;'";
823
- echo ">
824
- <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>
825
- &middot;
826
- <a class='sby_notice_dismiss' href='" .esc_url( $dismiss_url ). "'>" . __( 'No thanks', SBY_TEXT_DOMAIN ) . "</a>
827
- &middot;
828
- <a class='sby_notice_dismiss' href='" .esc_url( $dismiss_url ). "'>" . __( 'I\'ve already given a review', SBY_TEXT_DOMAIN ) . "</a>
829
- &middot;
830
- <a class='sby_notice_dismiss' href='" .esc_url( $later_url ). "'>" . __( 'Ask Me Later', SBY_TEXT_DOMAIN ) . "</a>
831
- </p>"
832
- . $other_notice_html .
833
- "</div>
834
- <a class='sby_notice_close' href='" .esc_url( $dismiss_url ). "'><i class='fa fa-close'></i></a>
835
- </div>";
836
-
837
- } elseif ( $should_show_new_user_discount ) {
838
- global $current_user;
839
- $user_id = $current_user->ID;
840
- $ignore_new_user_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
841
- if ( $ignore_new_user_sale_notice_meta !== 'always' ) {
842
-
843
- echo "
844
- <div class='sby_notice sby_review_notice sby_new_user_sale_notice'>
845
- <img src='" . SBY_PLUGIN_URL . 'img/sby-icon-offer.png' . "' alt='".SBY_PLUGIN_NAME."'>
846
- <div class='sby-notice-text'>
847
- <p>" . __( '<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;">60% off</b> our Pro version to all users of our free Feeds for YouTube plugin.', SBY_TEXT_DOMAIN ) . "</p>
848
- <p class='sby-links'>
849
- <a class='sby_notice_dismiss sby_offer_btn' href='https://smashballoon.com/youtube-feed/?utm_source=plugin-free&utm_campaign=sby&discount=youtubethankyou' target='_blank'><b>" . __( 'Get this offer', SBY_TEXT_DOMAIN ) . "</b></a>
850
- <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>
851
-
852
- </p>
853
- </div>
854
- <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>
855
- </div>
856
- ";
857
- }
858
-
859
- } elseif ( $should_show_bfcm_discount ) {
860
-
861
- echo "
862
- <div class='sby_notice sby_review_notice sby_bfcm_sale_notice'>
863
- <img src='". SBY_PLUGIN_URL . 'img/sby-icon-offer.png' ."' alt='".SBY_PLUGIN_NAME."'>
864
- <div class='sby-notice-text'>
865
- <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;">60% off</b> the Pro version for all of our users.', SBY_TEXT_DOMAIN ), SBY_PLUGIN_NAME ) . "</p>
866
- <p class='sby-links'>
867
- <a class='sby_notice_dismiss sby_offer_btn' href='https://smashballoon.com/youtube-feed/?utm_source=plugin-free&utm_campaign=sby&discount=".$sby_bfcm_discount_code."' target='_blank'><b>" . __( 'Get this offer', SBY_TEXT_DOMAIN ) . "</b></a>
868
- <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>
869
- </p>
870
- </div>
871
- <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>
872
- </div>
873
- ";
874
-
875
- }
876
-
877
- }
878
- add_action( 'admin_notices', 'sby_notices_html', 12 ); // priority 8 for Instagram, priority 10 for Facebook
879
-
880
- function sby_process_nags() {
881
-
882
- global $current_user;
883
- $user_id = $current_user->ID;
884
- $sby_statuses_option = get_option( 'sby_statuses', array() );
885
-
886
- if ( isset( $_GET['sby_ignore_rating_notice_nag'] ) ) {
887
- if ( (int)$_GET['sby_ignore_rating_notice_nag'] === 1 ) {
888
- update_option( 'sby_rating_notice', 'dismissed', false );
889
- $sby_statuses_option['rating_notice_dismissed'] = sby_get_current_time();
890
- update_option( 'sby_statuses', $sby_statuses_option, false );
891
-
892
- } elseif ( $_GET['sby_ignore_rating_notice_nag'] === 'later' ) {
893
- set_transient( 'feeds_for_youtube_rating_notice_waiting', 'waiting', 2 * WEEK_IN_SECONDS );
894
- update_option( 'sby_rating_notice', 'pending', false );
895
- }
896
- }
897
-
898
- if ( isset( $_GET['sby_ignore_new_user_sale_notice'] ) ) {
899
- $response = sanitize_text_field( $_GET['sby_ignore_new_user_sale_notice'] );
900
- if ( $response === 'always' ) {
901
- update_user_meta( $user_id, 'sby_ignore_new_user_sale_notice', 'always' );
902
-
903
- $current_month_number = (int)date('n', sby_get_current_time() );
904
- $not_early_in_the_year = ($current_month_number > 5);
905
-
906
- if ( $not_early_in_the_year ) {
907
- update_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice', date( 'Y', sby_get_current_time() ) );
908
- }
909
-
910
- }
911
- }
912
-
913
- if ( isset( $_GET['sby_ignore_bfcm_sale_notice'] ) ) {
914
- $response = sanitize_text_field( $_GET['sby_ignore_bfcm_sale_notice'] );
915
- if ( $response === 'always' ) {
916
- update_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice', 'always' );
917
- } elseif ( $response === date( 'Y', sby_get_current_time() ) ) {
918
- update_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice', date( 'Y', sby_get_current_time() ) );
919
- }
920
- update_user_meta( $user_id, 'sby_ignore_new_user_sale_notice', 'always' );
921
- }
922
 
923
  }
924
- add_action( 'admin_init', 'sby_process_nags' );
925
 
926
 
927
  function sby_lite_dismiss() {
543
  //privacyStatus
544
  SBY_Admin::connect_account( $account_info );
545
 
546
+ return $account_info;
547
+ } else {
548
+ $account_info['username'] = '(No Channel)';
549
+ $account_info['channel_id'] = '';
550
+ $account_info['profile_picture'] = '';
551
+ $account_info['privacy'] = '';
552
+ $account_info['expires'] = $expires;
553
+ //privacyStatus
554
+ SBY_Admin::connect_account( $account_info );
555
+
556
  return $account_info;
557
  }
558
  }
685
  // generates the html for the admin notices
686
  function sby_notices_html() {
687
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
688
  //delete_transient( 'instagram_feed_rating_notice_waiting' );
689
 
690
  //set_transient( 'instagram_feed_rating_notice_waiting', 'waiting', 2 * WEEK_IN_SECONDS );
691
  //update_option( 'sby_rating_notice', 'pending', false );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
692
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
693
 
694
  }
695
+ //add_action( 'admin_notices', 'sby_notices_html', 12 ); // priority 8 for Instagram, priority 10 for Facebook
696
 
697
 
698
  function sby_lite_dismiss() {
inc/admin/class-sby-new-user.php ADDED
@@ -0,0 +1,400 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SBY_New_User.
4
+ *
5
+ * @since 2.18
6
+ */
7
+
8
+ // Exit if accessed directly
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class SBY_New_User extends SBY_Notifications {
14
+
15
+ /**
16
+ * Source of notifications content.
17
+ *
18
+ * @since 2.18
19
+ *
20
+ * @var string
21
+ */
22
+ const SOURCE_URL = 'http://plugin.smashballoon.com/newuser.json';
23
+
24
+ /**
25
+ * @var string
26
+ */
27
+ const OPTION_NAME = 'sby_newuser_notifications';
28
+
29
+ /**
30
+ * Register hooks.
31
+ *
32
+ * @since 2.18
33
+ */
34
+ public function hooks() {
35
+ add_action( 'admin_notices', array( $this, 'output' ), 8 );
36
+
37
+ add_action( 'admin_init', array( $this, 'dismiss' ) );
38
+ }
39
+
40
+ public function option_name() {
41
+ return self::OPTION_NAME;
42
+ }
43
+
44
+ public function source_url() {
45
+ return self::SOURCE_URL;
46
+ }
47
+
48
+ /**
49
+ * Verify notification data before it is saved.
50
+ *
51
+ * @param array $notifications Array of notifications items to verify.
52
+ *
53
+ * @return array
54
+ *
55
+ * @since 2.18
56
+ */
57
+ public function verify( $notifications ) {
58
+ $data = array();
59
+
60
+ if ( ! is_array( $notifications ) || empty( $notifications ) ) {
61
+ return $data;
62
+ }
63
+
64
+ $option = $this->get_option();
65
+
66
+ foreach ( $notifications as $key => $notification ) {
67
+
68
+ // The message should never be empty, if they are, ignore.
69
+ if ( empty( $notification['content'] ) ) {
70
+ continue;
71
+ }
72
+
73
+ // Ignore if notification has already been dismissed.
74
+ if ( ! empty( $option['dismissed'] ) && in_array( $notification['id'], $option['dismissed'] ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
75
+ continue;
76
+ }
77
+
78
+ $data[ $key ] = $notification;
79
+ }
80
+
81
+ return $data;
82
+ }
83
+
84
+ /**
85
+ * Verify saved notification data for active notifications.
86
+ *
87
+ * @since 2.18
88
+ *
89
+ * @param array $notifications Array of notifications items to verify.
90
+ *
91
+ * @return array
92
+ */
93
+ public function verify_active( $notifications ) {
94
+ if ( ! is_array( $notifications ) || empty( $notifications ) ) {
95
+ return array();
96
+ }
97
+
98
+ $sby_statuses_option = get_option( 'sby_statuses', array() );
99
+ $current_time = sby_get_current_time();
100
+
101
+ // rating notice logic
102
+ $sby_rating_notice_option = get_option( 'sby_rating_notice', false );
103
+ $sby_rating_notice_waiting = get_transient( 'feeds_for_youtube_rating_notice_waiting' );
104
+ $should_show_rating_notice = ($sby_rating_notice_waiting !== 'waiting' && $sby_rating_notice_option !== 'dismissed');
105
+
106
+ // new user discount logic
107
+ $in_new_user_month_range = true;
108
+ $should_show_new_user_discount = false;
109
+ $has_been_one_month_since_rating_dismissal = isset( $sby_statuses_option['rating_notice_dismissed'] ) ? ((int)$sby_statuses_option['rating_notice_dismissed'] + ((int)$notifications['review']['wait'] * DAY_IN_SECONDS)) < $current_time + 1: true;
110
+
111
+ if ( isset( $sby_statuses_option['first_install'] ) && $sby_statuses_option['first_install'] === 'from_update' ) {
112
+ global $current_user;
113
+ $user_id = $current_user->ID;
114
+ $ignore_new_user_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
115
+ $ignore_new_user_sale_notice_meta = isset( $ignore_new_user_sale_notice_meta[0] ) ? $ignore_new_user_sale_notice_meta[0] : '';
116
+ if ( $ignore_new_user_sale_notice_meta !== 'always' ) {
117
+ $should_show_new_user_discount = true;
118
+ }
119
+ } elseif ( $in_new_user_month_range && $has_been_one_month_since_rating_dismissal && $sby_rating_notice_waiting !== 'waiting' ) {
120
+ global $current_user;
121
+ $user_id = $current_user->ID;
122
+ $ignore_new_user_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
123
+ $ignore_new_user_sale_notice_meta = isset( $ignore_new_user_sale_notice_meta[0] ) ? $ignore_new_user_sale_notice_meta[0] : '';
124
+
125
+ if ( $ignore_new_user_sale_notice_meta !== 'always'
126
+ && isset( $sby_statuses_option['first_install'] )
127
+ && $current_time > (int)$sby_statuses_option['first_install'] + ((int)$notifications['discount']['wait'] * DAY_IN_SECONDS) ) {
128
+ $should_show_new_user_discount = true;
129
+ }
130
+ }
131
+
132
+ if ( isset( $notifications['review'] ) && $should_show_rating_notice ) {
133
+ return array( $notifications['review'] );
134
+ } elseif ( isset( $notifications['discount'] ) && $should_show_new_user_discount ) {
135
+ return array( $notifications['discount'] );
136
+ }
137
+
138
+ return array();
139
+ }
140
+
141
+ /**
142
+ * Get notification data.
143
+ *
144
+ * @since 2.18
145
+ *
146
+ * @return array
147
+ */
148
+ public function get() {
149
+ if ( ! $this->has_access() ) {
150
+ return array();
151
+ }
152
+
153
+ $option = $this->get_option();
154
+
155
+ // Only update if does not exist.
156
+ if ( empty( $option['update'] ) ) {
157
+ $this->update();
158
+ }
159
+
160
+ $events = ! empty( $option['events'] ) ? $this->verify_active( $option['events'] ) : array();
161
+ $feed = ! empty( $option['feed'] ) ? $this->verify_active( $option['feed'] ) : array();
162
+
163
+ return array_merge( $events, $feed );
164
+ }
165
+
166
+ /**
167
+ * Add a manual notification event.
168
+ *
169
+ * @since 2.18
170
+ *
171
+ * @param array $notification Notification data.
172
+ */
173
+ public function add( $notification ) {
174
+ if ( empty( $notification['id'] ) ) {
175
+ return;
176
+ }
177
+
178
+ $option = $this->get_option();
179
+
180
+ if ( in_array( $notification['id'], $option['dismissed'] ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
181
+ return;
182
+ }
183
+
184
+ foreach ( $option['events'] as $item ) {
185
+ if ( $item['id'] === $notification['id'] ) {
186
+ return;
187
+ }
188
+ }
189
+
190
+ $notification = $this->verify( array( $notification ) );
191
+
192
+ update_option(
193
+ $this->option_name(),
194
+ array(
195
+ 'update' => $option['update'],
196
+ 'feed' => $option['feed'],
197
+ 'events' => array_merge( $notification, $option['events'] ),
198
+ 'dismissed' => $option['dismissed'],
199
+ )
200
+ );
201
+ }
202
+
203
+ /**
204
+ * Update notification data from feed.
205
+ *
206
+ * @since 2.18
207
+ */
208
+ public function update() {
209
+ $feed = $this->fetch_feed();
210
+ $option = $this->get_option();
211
+
212
+ update_option(
213
+ $this->option_name(),
214
+ array(
215
+ 'update' => time(),
216
+ 'feed' => $feed,
217
+ 'events' => $option['events'],
218
+ 'dismissed' => $option['dismissed'],
219
+ )
220
+ );
221
+ }
222
+
223
+ /**
224
+ * Do not enqueue anything extra.
225
+ *
226
+ * @since 2.18
227
+ */
228
+ public function enqueues() {
229
+
230
+ }
231
+
232
+ /**
233
+ * Output notifications on Form Overview admin area.
234
+ *
235
+ * @since 2.18
236
+ */
237
+ public function output() {
238
+ // If the Instagram Feed plugin is active, notices only shown on SBY Settings pages
239
+ if ( function_exists( 'sb_instagram_activate' )
240
+ && ! function_exists( 'sb_instagram_feed_pro_init' ) ) {
241
+ return;
242
+ }
243
+
244
+ if ( function_exists( 'cff_check_for_db_updates' ) ) {
245
+ return;
246
+ }
247
+
248
+ if ( function_exists( 'ctf_check_for_db_updates' ) ) {
249
+ return;
250
+ }
251
+
252
+ $notifications = $this->get();
253
+
254
+ if ( empty( $notifications ) ) {
255
+ return;
256
+ }
257
+
258
+ // new user notices included in regular settings page notifications so this
259
+ // checks to see if user is one of those pages
260
+ if ( ! empty( $_GET['page'] )
261
+ && strpos( $_GET['page'], 'youtube-feed' ) !== false ) {
262
+ return;
263
+ }
264
+
265
+ $content_allowed_tags = array(
266
+ 'em' => array(),
267
+ 'strong' => array(),
268
+ 'span' => array(
269
+ 'style' => array(),
270
+ ),
271
+ 'a' => array(
272
+ 'href' => array(),
273
+ 'target' => array(),
274
+ 'rel' => array(),
275
+ ),
276
+ );
277
+ $image_overlay = '';
278
+
279
+ foreach ( $notifications as $notification ) {
280
+ $type = sanitize_text_field( $notification['id'] );
281
+ $img_src = SBY_PLUGIN_URL . 'img/' . sanitize_text_field( $notification['image'] );
282
+ $content = '';
283
+ if ( ! empty( $notification['content'] ) ) {
284
+ $content = wp_kses( $this->replace_merge_fields( $notification['content'], $notification ), $content_allowed_tags );
285
+ }
286
+ $buttons = array();
287
+ if ( ! empty( $notification['btns'] ) && is_array( $notification['btns'] ) ) {
288
+ foreach ( $notification['btns'] as $btn_type => $btn ) {
289
+ if ( ! is_array( $btn['url'] ) ) {
290
+ $buttons[ $btn_type ]['url'] = $this->replace_merge_fields( $btn['url'], $notification );
291
+ } elseif ( is_array( $btn['url'] ) ) {
292
+ $buttons[ $btn_type ]['url'] = add_query_arg( $btn['url'] );
293
+ }
294
+
295
+ $buttons[ $btn_type ]['attr'] = '';
296
+ if ( ! empty( $btn['attr'] ) ) {
297
+ $buttons[ $btn_type ]['attr'] = ' target="_blank" rel="noopener noreferrer"';
298
+ }
299
+
300
+ $buttons[ $btn_type ]['class'] = '';
301
+ if ( ! empty( $btn['class'] ) ) {
302
+ $buttons[ $btn_type ]['class'] = ' ' . $btn['class'];
303
+ }
304
+
305
+ $buttons[ $btn_type ]['text'] = '';
306
+ if ( ! empty( $btn['text'] ) ) {
307
+ $buttons[ $btn_type ]['text'] = wp_kses( $btn['text'], $content_allowed_tags );
308
+ }
309
+ }
310
+ }
311
+ if ( isset( $notification['image_overlay'] ) ) {
312
+ $image_overlay = '<div class="img-overlay">'. esc_html( $notification['image_overlay'] ).'</div>';
313
+ }
314
+ }
315
+ ?>
316
+
317
+ <div class="sby_notice sby_<?php echo esc_attr( $type ); ?>_notice">
318
+ <div class="sby_thumb">
319
+ <img src="<?php echo esc_url( $img_src ); ?>" alt="notice">
320
+ <?php echo $image_overlay; ?>
321
+ </div>
322
+ <div class="sby-notice-text">
323
+ <p style="padding-top: 4px;"><?php echo $content; ?></p>
324
+ <p class="links">
325
+ <?php foreach ( $buttons as $button ) : ?>
326
+ <a class="<?php echo esc_attr( $button['class'] ); ?>" href="<?php echo esc_attr( $button['url'] ); ?>"<?php echo $button['attr']; ?>><?php echo $button['text']; ?></a>
327
+ <?php endforeach; ?>
328
+ </p>
329
+ </div>
330
+ <a class="sby_notice_close" href="<?php echo add_query_arg( array( 'sby_dismiss' => $type ) ); ?>"><i class="fa fa-close"></i></a>
331
+ </div>
332
+ <?php
333
+ }
334
+
335
+ /**
336
+ * Hide messages permanently or some can be dismissed temporarily
337
+ *
338
+ * @since 2.18
339
+ */
340
+ public function dismiss() {
341
+ global $current_user;
342
+ $user_id = $current_user->ID;
343
+ $sby_statuses_option = get_option( 'sby_statuses', array() );
344
+
345
+ if ( isset( $_GET['sby_ignore_rating_notice_nag'] ) ) {
346
+ if ( (int)$_GET['sby_ignore_rating_notice_nag'] === 1 ) {
347
+ update_option( 'sby_rating_notice', 'dismissed', false );
348
+ $sby_statuses_option['rating_notice_dismissed'] = sby_get_current_time();
349
+ update_option( 'sby_statuses', $sby_statuses_option, false );
350
+
351
+ } elseif ( $_GET['sby_ignore_rating_notice_nag'] === 'later' ) {
352
+ set_transient( 'feeds_for_youtube_rating_notice_waiting', 'waiting', 2 * WEEK_IN_SECONDS );
353
+ update_option( 'sby_rating_notice', 'pending', false );
354
+ }
355
+ }
356
+
357
+ if ( isset( $_GET['sby_ignore_new_user_sale_notice'] ) ) {
358
+ $response = sanitize_text_field( $_GET['sby_ignore_new_user_sale_notice'] );
359
+ if ( $response === 'always' ) {
360
+ update_user_meta( $user_id, 'sby_ignore_new_user_sale_notice', 'always' );
361
+
362
+ $current_month_number = (int)date('n', sby_get_current_time() );
363
+ $not_early_in_the_year = ($current_month_number > 5);
364
+
365
+ if ( $not_early_in_the_year ) {
366
+ update_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice', date( 'Y', sby_get_current_time() ) );
367
+ }
368
+
369
+ }
370
+ }
371
+
372
+ if ( isset( $_GET['sby_ignore_bfcm_sale_notice'] ) ) {
373
+ $response = sanitize_text_field( $_GET['sby_ignore_bfcm_sale_notice'] );
374
+ if ( $response === 'always' ) {
375
+ update_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice', 'always' );
376
+ } elseif ( $response === date( 'Y', sby_get_current_time() ) ) {
377
+ update_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice', date( 'Y', sby_get_current_time() ) );
378
+ }
379
+ update_user_meta( $user_id, 'sby_ignore_new_user_sale_notice', 'always' );
380
+ }
381
+
382
+ if ( isset( $_GET['sby_dismiss'] ) ) {
383
+ if ( $_GET['sby_dismiss'] === 'review' ) {
384
+ update_option( 'sby_rating_notice', 'dismissed', false );
385
+ $sby_statuses_option['rating_notice_dismissed'] = sby_get_current_time();
386
+ update_option( 'sby_statuses', $sby_statuses_option, false );
387
+ } elseif ( $_GET['sby_dismiss'] === 'discount' ) {
388
+ update_user_meta( $user_id, 'sby_ignore_new_user_sale_notice', 'always' );
389
+
390
+ $current_month_number = (int)date('n', sby_get_current_time() );
391
+ $not_early_in_the_year = ($current_month_number > 5);
392
+
393
+ if ( $not_early_in_the_year ) {
394
+ update_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice', date( 'Y', sby_get_current_time() ) );
395
+ }
396
+ }
397
+ update_user_meta( $user_id, 'sby_ignore_new_user_sale_notice', 'always' );
398
+ }
399
+ }
400
+ }
inc/admin/class-sby-notifications.php ADDED
@@ -0,0 +1,582 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SBY_Notifications.
4
+ *
5
+ * @since 1.7/1.11
6
+ */
7
+
8
+ // Exit if accessed directly
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class SBY_Notifications {
14
+
15
+ /**
16
+ * Source of notifications content.
17
+ *
18
+ * @var string
19
+ */
20
+ const SOURCE_URL = 'http://plugin.smashballoon.com/notifications.json';
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ const OPTION_NAME = 'sby_notifications';
26
+
27
+ /**
28
+ * JSON data contains notices for all plugins. This is used
29
+ * to select messages only meant for this plugin
30
+ *
31
+ * @var string
32
+ */
33
+ const PLUGIN = 'youtube';
34
+
35
+ /**
36
+ * Option value.
37
+ *
38
+ * @since 1.7/1.11
39
+ *
40
+ * @var bool|array
41
+ */
42
+ public $option = false;
43
+
44
+ /**
45
+ * Initialize class.
46
+ *
47
+ * @since 1.7/1.11
48
+ */
49
+ public function init() {
50
+ $this->hooks();
51
+ }
52
+
53
+ /**
54
+ * Use this function to get the option name to allow
55
+ * inheritance for the New_User class
56
+ *
57
+ * @return string
58
+ */
59
+ public function option_name() {
60
+ return self::OPTION_NAME;
61
+ }
62
+
63
+ /**
64
+ * Use this function to get the source URL to allow
65
+ * inheritance for the New_User class
66
+ *
67
+ * @return string
68
+ */
69
+ public function source_url() {
70
+ return self::SOURCE_URL;
71
+ }
72
+
73
+ /**
74
+ * Register hooks.
75
+ *
76
+ * @since 1.7/1.11
77
+ */
78
+ public function hooks() {
79
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueues' ) );
80
+
81
+ add_action( 'sby_admin_overview_before_title', array( $this, 'output' ) );
82
+
83
+ // on cron. Once a week?
84
+ add_action( 'sby_notification_update', array( $this, 'update' ) );
85
+
86
+ add_action( 'wp_ajax_sby_dashboard_notification_dismiss', array( $this, 'dismiss' ) );
87
+ }
88
+
89
+
90
+ /**
91
+ * Check if user has access and is enabled.
92
+ *
93
+ * @since 1.7/1.11
94
+ *
95
+ * @return bool
96
+ */
97
+ public function has_access() {
98
+ $access = false;
99
+
100
+ if ( current_user_can( 'manage_options' ) ) {
101
+ $access = true;
102
+ }
103
+
104
+ return apply_filters( 'sby_admin_notifications_has_access', $access );
105
+ }
106
+
107
+ /**
108
+ * Get option value.
109
+ *
110
+ * @since 1.7/1.11
111
+ *
112
+ * @param bool $cache Reference property cache if available.
113
+ *
114
+ * @return array
115
+ */
116
+ public function get_option( $cache = true ) {
117
+ if ( $this->option && $cache ) {
118
+ return $this->option;
119
+ }
120
+
121
+ $option = get_option( $this->option_name(), array() );
122
+
123
+ $this->option = array(
124
+ 'update' => ! empty( $option['update'] ) ? $option['update'] : 0,
125
+ 'events' => ! empty( $option['events'] ) ? $option['events'] : array(),
126
+ 'feed' => ! empty( $option['feed'] ) ? $option['feed'] : array(),
127
+ 'dismissed' => ! empty( $option['dismissed'] ) ? $option['dismissed'] : array(),
128
+ );
129
+
130
+ return $this->option;
131
+ }
132
+
133
+ /**
134
+ * Fetch notifications from feed.
135
+ *
136
+ * @since 1.7/1.11
137
+ *
138
+ * @return array
139
+ */
140
+ public function fetch_feed() {
141
+ $res = wp_remote_get( $this->source_url() );
142
+
143
+ if ( is_wp_error( $res ) ) {
144
+ return array();
145
+ }
146
+
147
+ $body = wp_remote_retrieve_body( $res );
148
+
149
+ if ( empty( $body ) ) {
150
+ return array();
151
+ }
152
+
153
+ $body = str_replace( array( 'sbi_', 'sbi-' ), array( 'sby_', 'sby-' ), $body );
154
+
155
+ return $this->verify( json_decode( $body, true ) );
156
+ }
157
+
158
+ /**
159
+ * Verify notification data before it is saved.
160
+ *
161
+ * @since 1.7/1.11
162
+ *
163
+ * @param array $notifications Array of notifications items to verify.
164
+ *
165
+ * @return array
166
+ */
167
+ public function verify( $notifications ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
168
+ $data = array();
169
+
170
+ if ( ! is_array( $notifications ) || empty( $notifications ) ) {
171
+ return $data;
172
+ }
173
+
174
+ $option = $this->get_option();
175
+
176
+ foreach ( $notifications as $notification ) {
177
+
178
+ // The message and license should never be empty, if they are, ignore.
179
+ if ( empty( $notification['content'] ) || empty( $notification['type'] ) ) {
180
+ continue;
181
+ }
182
+
183
+ // Ignore if license type does not match.
184
+ $license = sby_is_pro_version() ? 'pro' : 'free';
185
+
186
+ if ( ! in_array( $license, $notification['type'], true ) ) {
187
+ continue;
188
+ }
189
+
190
+ // Ignore if expired.
191
+ if ( ! empty( $notification['end'] ) && sby_get_current_time() > strtotime( $notification['end'] ) ) {
192
+ continue;
193
+ }
194
+
195
+ // Ignore if notification has already been dismissed.
196
+ if ( ! empty( $option['dismissed'] ) && in_array( $notification['id'], $option['dismissed'] ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
197
+ continue;
198
+ }
199
+
200
+ // TODO: Ignore if notification existed before installing SBY.
201
+ // Prevents bombarding the user with notifications after activation.
202
+ $activated = false;
203
+ if ( ! empty( $activated )
204
+ && ! empty( $notification['start'] )
205
+ && $activated > strtotime( $notification['start'] ) ) {
206
+ continue;
207
+ }
208
+
209
+ $data[] = $notification;
210
+ }
211
+
212
+ return $data;
213
+ }
214
+
215
+ /**
216
+ * Verify saved notification data for active notifications.
217
+ *
218
+ * @since 1.7/1.11
219
+ *
220
+ * @param array $notifications Array of notifications items to verify.
221
+ *
222
+ * @return array
223
+ */
224
+ public function verify_active( $notifications ) {
225
+ if ( ! is_array( $notifications ) || empty( $notifications ) ) {
226
+ return array();
227
+ }
228
+
229
+ // Remove notfications that are not active.
230
+ foreach ( $notifications as $key => $notification ) {
231
+ if ( ( ! empty( $notification['start'] ) && sby_get_current_time() < strtotime( $notification['start'] ) )
232
+ || ( ! empty( $notification['end'] ) && sby_get_current_time() > strtotime( $notification['end'] ) ) ) {
233
+ unset( $notifications[ $key ] );
234
+ }
235
+ }
236
+
237
+ return $notifications;
238
+ }
239
+
240
+ /**
241
+ * Get notification data.
242
+ *
243
+ * @since 1.7/1.11
244
+ *
245
+ * @return array
246
+ */
247
+ public function get() {
248
+ if ( ! $this->has_access() ) {
249
+ return array();
250
+ }
251
+
252
+ $option = $this->get_option();
253
+
254
+ // Update notifications using async task.
255
+ if ( empty( $option['update'] ) || sby_get_current_time() > $option['update'] + DAY_IN_SECONDS ) {
256
+ $this->update();
257
+ }
258
+
259
+ $events = ! empty( $option['events'] ) ? $this->verify_active( $option['events'] ) : array();
260
+ $feed = ! empty( $option['feed'] ) ? $this->verify_active( $option['feed'] ) : array();
261
+
262
+ // If there is a new user notification, add it to the beginning of the notification list
263
+ $sby_newuser = new SBY_New_User();
264
+ $newuser_notifications = $sby_newuser->get();
265
+
266
+ if ( ! empty( $newuser_notifications ) ) {
267
+ $events = array_merge( $newuser_notifications, $events );
268
+ }
269
+
270
+ return array_merge( $events, $feed );
271
+ }
272
+
273
+ /**
274
+ * Get notification count.
275
+ *
276
+ * @since 1.7/1.11
277
+ *
278
+ * @return int
279
+ */
280
+ public function get_count() {
281
+ return count( $this->get() );
282
+ }
283
+
284
+ /**
285
+ * Add a manual notification event.
286
+ *
287
+ * @since 1.7/1.11
288
+ *
289
+ * @param array $notification Notification data.
290
+ */
291
+ public function add( $notification ) {
292
+ if ( empty( $notification['id'] ) ) {
293
+ return;
294
+ }
295
+
296
+ $option = $this->get_option();
297
+
298
+ if ( in_array( $notification['id'], $option['dismissed'] ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
299
+ return;
300
+ }
301
+
302
+ foreach ( $option['events'] as $item ) {
303
+ if ( $item['id'] === $notification['id'] ) {
304
+ return;
305
+ }
306
+ }
307
+
308
+ $notification = $this->verify( array( $notification ) );
309
+
310
+ update_option(
311
+ 'sby_notifications',
312
+ array(
313
+ 'update' => $option['update'],
314
+ 'feed' => $option['feed'],
315
+ 'events' => array_merge( $notification, $option['events'] ),
316
+ 'dismissed' => $option['dismissed'],
317
+ )
318
+ );
319
+ }
320
+
321
+ /**
322
+ * Update notification data from feed.
323
+ *
324
+ * @since 1.7/1.11
325
+ */
326
+ public function update() {
327
+ $feed = $this->fetch_feed();
328
+ $option = $this->get_option();
329
+
330
+ update_option(
331
+ 'sby_notifications',
332
+ array(
333
+ 'update' => sby_get_current_time(),
334
+ 'feed' => $feed,
335
+ 'events' => $option['events'],
336
+ 'dismissed' => $option['dismissed'],
337
+ )
338
+ );
339
+ }
340
+
341
+ /**
342
+ * Admin area Form Overview enqueues.
343
+ *
344
+ * @since 1.7/1.11
345
+ */
346
+ public function enqueues() {
347
+ if ( ! $this->has_access() ) {
348
+ return;
349
+ }
350
+
351
+ $notifications = $this->get();
352
+
353
+ if ( empty( $notifications ) ) {
354
+ return;
355
+ }
356
+
357
+ $min = '';
358
+
359
+ wp_enqueue_style(
360
+ 'sby-admin-notifications',
361
+ SBY_PLUGIN_URL . "css/admin-notifications{$min}.css",
362
+ array(),
363
+ SBYVER
364
+ );
365
+
366
+ wp_enqueue_script(
367
+ 'sby-admin-notifications',
368
+ SBY_PLUGIN_URL . "js/admin-notifications{$min}.js",
369
+ array( 'jquery' ),
370
+ SBYVER,
371
+ true
372
+ );
373
+
374
+ wp_localize_script( 'sby-admin-notifications', 'sby_admin', array(
375
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
376
+ 'nonce' => wp_create_nonce( 'sby-admin' )
377
+ )
378
+ );
379
+ }
380
+
381
+ /**
382
+ * Fields from the remote source contain placeholders to allow
383
+ * some messages to be used for multiple plugins.
384
+ *
385
+ * @param $content string
386
+ * @param $notification array
387
+ *
388
+ * @return string
389
+ *
390
+ * @since 1.7/1.11
391
+ */
392
+ public function replace_merge_fields( $content, $notification ) {
393
+ $merge_fields = array(
394
+ '{plugin}' => 'Feeds for YouTube',
395
+ '{amount}' => isset( $notification['amount'] ) ? $notification['amount'] : '',
396
+ '{platform}' => 'YouTube',
397
+ '{lowerplatform}' => 'youtube',
398
+ '{review-url}' => 'https://wordpress.org/support/plugin/feeds-for-youtube/reviews/',
399
+ '{slug}' => 'youtube-feed',
400
+ '{campaign}' => 'youtube-free'
401
+ );
402
+
403
+ if ( sby_is_pro_version() ) {
404
+ $merge_fields['{campaign}'] = 'youtube-pro';
405
+ $merge_fields['{plugin}'] = 'Feeds for YouTube Pro';
406
+ }
407
+
408
+ foreach ( $merge_fields as $find => $replace ) {
409
+ $content = str_replace( $find, $replace, $content );
410
+ }
411
+
412
+ return $content;
413
+ }
414
+
415
+ /**
416
+ * Output notifications on Feeds for YouTube admin area.
417
+ *
418
+ * @since 1.7/1.11
419
+ */
420
+ public function output() {
421
+ $notifications = $this->get();
422
+
423
+ if ( empty( $notifications ) ) {
424
+ return;
425
+ }
426
+
427
+ $notifications_html = '';
428
+ $current_class = ' current';
429
+ $content_allowed_tags = array(
430
+ 'em' => array(),
431
+ 'strong' => array(),
432
+ 'span' => array(
433
+ 'style' => array(),
434
+ ),
435
+ 'a' => array(
436
+ 'href' => array(),
437
+ 'target' => array(),
438
+ 'rel' => array(),
439
+ ),
440
+ );
441
+
442
+ foreach ( $notifications as $notification ) {
443
+
444
+ // Buttons HTML.
445
+ $buttons_html = '';
446
+ if ( ! empty( $notification['btns'] ) && is_array( $notification['btns'] ) ) {
447
+ foreach ( $notification['btns'] as $btn_type => $btn ) {
448
+ if ( is_array( $btn['url'] ) ) {
449
+ $btn['url'] = add_query_arg( $btn['url'] );
450
+ }
451
+ if ( ! empty( $btn['attr'] ) ) {
452
+ $btn['target'] = '_blank';
453
+ }
454
+ $buttons_html .= sprintf(
455
+ '<a href="%1$s" class="button button-%2$s"%3$s>%4$s</a>',
456
+ ! empty( $btn['url'] ) ? esc_url( $this->replace_merge_fields( $btn['url'], $notification ) ) : '',
457
+ $btn_type === 'primary' ? 'primary' : 'secondary',
458
+ ! empty( $btn['target'] ) && $btn['target'] === '_blank' ? ' target="_blank" rel="noopener noreferrer"' : '',
459
+ ! empty( $btn['text'] ) ? sanitize_text_field( $btn['text'] ) : ''
460
+ );
461
+ }
462
+ $buttons_html = ! empty( $buttons_html ) ? '<div class="buttons">' . $buttons_html . '</div>' : '';
463
+ }
464
+
465
+ if ( empty( $notification['image'] ) ) {
466
+ $image_html = '<div class="bell">';
467
+
468
+ $image_html .= '<svg xmlns="http://www.w3.org/2000/svg" width="42" height="48" viewBox="0 0 42 48"><defs><style>.a{fill:#777;}.b{fill:#ca4a1f;}</style></defs><path class="a" d="M23-79a6.005,6.005,0,0,1-6-6h10.06a12.066,12.066,0,0,0,1.791,1.308,6.021,6.021,0,0,1-2.077,3.352A6.008,6.008,0,0,1,23-79Zm1.605-9H5.009a2.955,2.955,0,0,1-2.173-.923A3.088,3.088,0,0,1,2-91a2.919,2.919,0,0,1,.807-2.036c.111-.12.229-.243.351-.371a14.936,14.936,0,0,0,3.126-4.409A23.283,23.283,0,0,0,8.007-107.5a14.846,14.846,0,0,1,.906-5.145,14.5,14.5,0,0,1,2.509-4.324A15.279,15.279,0,0,1,20-122.046V-124a3,3,0,0,1,3-3,3,3,0,0,1,3,3v1.954a15.28,15.28,0,0,1,8.58,5.078,14.5,14.5,0,0,1,2.509,4.324,14.846,14.846,0,0,1,.906,5.145c0,.645.016,1.281.047,1.888A12.036,12.036,0,0,0,35-106a11.921,11.921,0,0,0-8.485,3.515A11.923,11.923,0,0,0,23-94a12,12,0,0,0,1.6,6Z" transform="translate(-2 127)"/><circle class="b" cx="9" cy="9" r="9" transform="translate(24 24)"/></svg>';
469
+ $image_html .= '</div>';
470
+ } else {
471
+ if ( $notification['image'] === 'balloon'
472
+ || $notification['id'] === 'review'
473
+ || $notification['id'] === 'discount') {
474
+ $image_html = '<div class="bell">';
475
+
476
+ $image_html .= '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1438 1878" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2">';
477
+ $image_html .= ' <path d="M671.51004 492.9884C539.9423 433.8663 402.90125 345.5722 274.97656 304.47286c45.45163 108.39592 83.81332 223.88017 123.51 338.03105C319.308 702.00293 226.8217 748.19258 138.46278 798.51607c75.1914 74.32371 181.67968 117.34651 266.52444 182.01607-67.96124 83.86195-201.48527 171.01801-234.02107 247.01998 140.6922-17.6268 304.63688-46.21031 435.53794-52.00418 28.76427 144.58328 43.5987 303.09763 84.50756 435.53713 60.92033-175.26574 116.0014-356.37317 188.51594-520.0451 111.90644 46.2857 248.29012 102.72607 357.52902 130.01188-76.64636-107.5347-146.59346-221.76948-214.5166-338.02903 100.51162-72.83876 202.1718-144.52451 299.02538-221.02092-136.89514-12.61229-278.73428-20.28827-422.53618-25.99865-22.85288-148.33212-16.84826-325.51604-52.005-461.53983-53.19327 111.4882-115.96694 213.39155-175.51418 318.52497m65.00513 1228.60735c-18.0795 77.37586 41.4876 109.11326 32.50298 156.01215-58.8141-20.268-103.0576-30.67962-182.01567-19.50203 2.47018-60.37036 56.76662-68.90959 45.50432-143.0108C-208.90184 1619.4318-210.59186 99.02478 626.00572 5.44992c1046.0409-117.00405 1078.86445 1689.2596 110.50945 1716.14582" fill="#e34f0e"/>';
478
+ $image_html .= ' <path d="M847.02422 174.46342c35.15674 136.02379 29.15212 313.20771 52.0046 461.53578 143.8023 5.71443 285.63982 13.38636 422.53658 26.0027-96.85317 76.4964-198.51497 148.18216-299.02579 221.0189 67.92355 116.26239 137.87024 230.49432 214.51864 338.03024-109.24093-27.28662-245.62461-83.72577-357.53106-130.01269-72.51454 163.67274-127.5956 344.78017-188.51553 520.0459-40.90926-132.4395-55.74329-290.95384-84.50796-435.53712-130.90066 5.79549-294.84493 34.37738-435.53754 52.00418 32.5358-76.00075 166.05902-163.156 234.02026-247.02038-84.84516-64.67037-191.33222-107.69074-266.52363-182.01486 88.35892-50.32349 180.8436-96.51314 260.02295-156.0162-39.69708-114.14683-78.05674-229.63108-123.50878-338.027C402.89923 345.5722 539.9423 433.86629 671.51004 492.98839c59.54684-105.13342 122.3209-207.03677 175.51418-318.52497" fill="#fff"/>';
479
+ $image_html .= '</svg>';
480
+ } else {
481
+ $image_html = '<div class="thumb">';
482
+ $img_src = SBY_PLUGIN_URL . 'img/' . sanitize_text_field( $notification['image'] );
483
+ $image_html .= '<img src="'.esc_url( $img_src ).'" alt="notice">';
484
+
485
+ if ( isset( $notification['image_overlay'] ) ) {
486
+ $image_html .= '<div class="img-overlay">'. esc_html( str_replace( '%', '%%', $notification['image_overlay'] ) ).'</div>';
487
+ }
488
+ }
489
+
490
+ $image_html .= '</div>';
491
+
492
+ }
493
+
494
+ // Notification HTML.
495
+ $notifications_html .= sprintf(
496
+ '<div class="message%5$s" data-message-id="%4$s">' . $image_html . '
497
+ <h3 class="title">%1$s</h3>
498
+ <p class="content">%2$s</p>
499
+ %3$s
500
+ </div>',
501
+ ! empty( $notification['title'] ) ? $this->replace_merge_fields( sanitize_text_field( $notification['title'] ), $notification ) : '',
502
+ ! empty( $notification['content'] ) ? wp_kses( $this->replace_merge_fields( $notification['content'], $notification ), $content_allowed_tags ) : '',
503
+ $buttons_html,
504
+ ! empty( $notification['id'] ) ? esc_attr( sanitize_text_field( $notification['id'] ) ) : 0,
505
+ $current_class
506
+ );
507
+
508
+ // Only first notification is current.
509
+ $current_class = '';
510
+ }
511
+ ?>
512
+
513
+ <div id="sby-notifications">
514
+ <a class="dismiss" title="<?php echo esc_attr__( 'Dismiss this message', 'feeds-for-youtube' ); ?>"><i class="fa fa-times-circle" aria-hidden="true"></i></a>
515
+
516
+ <div class="navigation">
517
+ <a class="prev disabled" title="<?php echo esc_attr__( 'Previous message', 'feeds-for-youtube' ); ?>"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="chevron-left" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" class="svg-inline--fa fa-chevron-left fa-w-10"><path fill="currentColor" d="M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z" class=""></path></svg></a>
518
+ <a class="next disabled" title="<?php echo esc_attr__( 'Next message', 'feeds-for-youtube' ); ?>"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="chevron-right" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" class="svg-inline--fa fa-chevron-right fa-w-10"><path fill="currentColor" d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z" class=""></path></svg></a>
519
+ </div>
520
+
521
+ <div class="messages">
522
+ <?php echo $notifications_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
523
+ </div>
524
+ </div>
525
+ <?php
526
+ }
527
+
528
+ /**
529
+ * Dismiss notification via AJAX. If it's a new user message, also dismiss it
530
+ * on all admin pages.
531
+ *
532
+ * @since 1.7/1.11
533
+ */
534
+ public function dismiss() {
535
+ // Run a security check.
536
+ check_ajax_referer( 'sby-admin', 'nonce' );
537
+
538
+ // Check for access and required param.
539
+ if ( ! $this->has_access() || empty( $_POST['id'] ) ) {
540
+ wp_send_json_error();
541
+ }
542
+
543
+ $id = sanitize_text_field( wp_unslash( $_POST['id'] ) );
544
+
545
+ if ( $id === 'review' ) {
546
+ $sby_statuses_option = get_option( 'sby_statuses', array() );
547
+
548
+ update_option( 'sby_rating_notice', 'dismissed', false );
549
+ $sby_statuses_option['rating_notice_dismissed'] = sby_get_current_time();
550
+ update_option( 'sby_statuses', $sby_statuses_option, false );
551
+ } elseif ( $id === 'discount' ) {
552
+ update_user_meta( get_current_user_id(), 'sby_ignore_new_user_sale_notice', 'always' );
553
+
554
+ $current_month_number = (int)date('n', sby_get_current_time() );
555
+ $not_early_in_the_year = ($current_month_number > 5);
556
+
557
+ if ( $not_early_in_the_year ) {
558
+ update_user_meta( get_current_user_id(), 'sby_ignore_bfcm_sale_notice', date( 'Y', sby_get_current_time() ) );
559
+ }
560
+ }
561
+
562
+ $option = $this->get_option();
563
+ $type = is_numeric( $id ) ? 'feed' : 'events';
564
+
565
+ $option['dismissed'][] = $id;
566
+ $option['dismissed'] = array_unique( $option['dismissed'] );
567
+
568
+ // Remove notification.
569
+ if ( is_array( $option[ $type ] ) && ! empty( $option[ $type ] ) ) {
570
+ foreach ( $option[ $type ] as $key => $notification ) {
571
+ if ( $notification['id'] == $id ) { // phpcs:ignore WordPress.PHP.StrictComparisons
572
+ unset( $option[ $type ][ $key ] );
573
+ break;
574
+ }
575
+ }
576
+ }
577
+
578
+ update_option( 'sby_notifications', $option );
579
+
580
+ wp_send_json_success();
581
+ }
582
+ }
inc/admin/templates/main.php CHANGED
@@ -37,6 +37,8 @@ $tabs = $this->get_tabs();
37
  </div>
38
  <?php endif; ?>
39
 
 
 
40
  <h1><?php echo esc_html( $plugin_name ); ?></h1>
41
 
42
  <!-- Display the tabs along with styling for the 'active' tab -->
37
  </div>
38
  <?php endif; ?>
39
 
40
+ <?php do_action( 'sby_admin_overview_before_title' ); ?>
41
+
42
  <h1><?php echo esc_html( $plugin_name ); ?></h1>
43
 
44
  <!-- Display the tabs along with styling for the 'active' tab -->
inc/admin/templates/single-connected-account.php CHANGED
@@ -21,11 +21,17 @@ $just_updated_class = $just_updated ? ' sbspf_just_updated' : '';
21
 
22
  <div class="sbspf_ca_username">
23
  <?php echo $profile_picture; ?>
24
- <strong><?php echo $username; ?><span><?php _e('Channel ID:', $text_domain ); ?><?php echo ' ' . $account['channel_id']; ?></span></strong>
 
 
 
 
25
  </div>
26
 
27
  <div class="sbspf_ca_actions">
28
- <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>
 
 
29
  <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>
30
  </div>
31
 
21
 
22
  <div class="sbspf_ca_username">
23
  <?php echo $profile_picture; ?>
24
+ <?php if ( ! empty( $account['channel_id'] ) ) : ?>
25
+ <strong><?php echo $username; ?><span><?php _e('Channel ID:', $text_domain ); ?><?php echo ' ' . $account['channel_id']; ?></span></strong>
26
+ <?php else: ?>
27
+ <strong><?php echo $username; ?><span><?php echo sprintf( __( '%sHow to create a channel%s', $text_domain ), '<a href="https://support.google.com/youtube/answer/1646861?hl=en" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></span></strong>
28
+ <?php endif; ?>
29
  </div>
30
 
31
  <div class="sbspf_ca_actions">
32
+ <?php if ( ! empty( $account['channel_id'] ) ) : ?>
33
+ <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>
34
+ <?php endif; ?>
35
  <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>
36
  </div>
37
 
inc/sby-functions.php CHANGED
@@ -758,6 +758,9 @@ function sby_replace_double_quotes( &$element, $index ) {
758
  $element = str_replace( '"', "&quot;", $element );
759
  }
760
 
 
 
 
761
  /**
762
  * Adds the ajax url and custom JavaScript to the page
763
  */
758
  $element = str_replace( '"', "&quot;", $element );
759
  }
760
 
761
+ function sby_esc_attr_with_br( $text ) {
762
+ return str_replace( array( '&lt;br /&gt;', '&lt;br&gt;' ), '&lt;br /&gt;', esc_attr( nl2br( $text ) ) );
763
+ }
764
  /**
765
  * Adds the ajax url and custom JavaScript to the page
766
  */
js/admin-notifications.js ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * SBY Admin Notifications.
3
+ *
4
+ * @since 2.18
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ var SBYAdminNotifications = window.SBYAdminNotifications || ( function( document, window, $ ) {
10
+
11
+ /**
12
+ * Elements holder.
13
+ *
14
+ * @since 2.18
15
+ *
16
+ * @type {object}
17
+ */
18
+ var el = {
19
+
20
+ $notifications: $( '#sby-notifications' ),
21
+ $nextButton: $( '#sby-notifications .navigation .next' ),
22
+ $prevButton: $( '#sby-notifications .navigation .prev' ),
23
+ $adminBarCounter: $( '#wp-admin-bar-wpforms-menu .sby-menu-notification-counter' ),
24
+ $adminBarMenuItem: $( '#wp-admin-bar-sby-notifications' ),
25
+
26
+ };
27
+
28
+ /**
29
+ * Public functions and properties.
30
+ *
31
+ * @since 2.18
32
+ *
33
+ * @type {object}
34
+ */
35
+ var app = {
36
+
37
+ /**
38
+ * Start the engine.
39
+ *
40
+ * @since 2.18
41
+ */
42
+ init: function() {
43
+ el.$notifications.find( '.messages a').each(function() {
44
+ if ($(this).attr('href').indexOf('dismiss=') > -1 ) {
45
+ $(this).addClass('button-dismiss');
46
+ }
47
+ })
48
+
49
+ $( app.ready );
50
+ },
51
+
52
+ /**
53
+ * Document ready.
54
+ *
55
+ * @since 2.18
56
+ */
57
+ ready: function() {
58
+
59
+ app.updateNavigation();
60
+ app.events();
61
+ },
62
+
63
+ /**
64
+ * Register JS events.
65
+ *
66
+ * @since 2.18
67
+ */
68
+ events: function() {
69
+
70
+ el.$notifications
71
+ .on( 'click', '.dismiss', app.dismiss )
72
+ .on( 'click', '.button-dismiss', app.buttonDismiss )
73
+ .on( 'click', '.next', app.navNext )
74
+ .on( 'click', '.prev', app.navPrev );
75
+ },
76
+
77
+ /**
78
+ * Click on a dismiss button.
79
+ *
80
+ * @since 2.18
81
+ */
82
+ buttonDismiss: function( event ) {
83
+ event.preventDefault();
84
+ app.dismiss(event);
85
+ },
86
+
87
+ /**
88
+ * Click on the Dismiss notification button.
89
+ *
90
+ * @since 2.18
91
+ *
92
+ * @param {object} event Event object.
93
+ */
94
+ dismiss: function( event ) {
95
+
96
+ if ( el.$currentMessage.length === 0 ) {
97
+ return;
98
+ }
99
+
100
+ // Update counter.
101
+ var count = parseInt( el.$adminBarCounter.text(), 10 );
102
+ if ( count > 1 ) {
103
+ --count;
104
+ el.$adminBarCounter.html( '<span>' + count + '</span>' );
105
+ } else {
106
+ el.$adminBarCounter.remove();
107
+ el.$adminBarMenuItem.remove();
108
+ }
109
+
110
+ // Remove notification.
111
+ var $nextMessage = el.$nextMessage.length < 1 ? el.$prevMessage : el.$nextMessage,
112
+ messageId = el.$currentMessage.data( 'message-id' );
113
+
114
+ if ( $nextMessage.length === 0 ) {
115
+ el.$notifications.remove();
116
+ } else {
117
+ el.$currentMessage.remove();
118
+ $nextMessage.addClass( 'current' );
119
+ app.updateNavigation();
120
+ }
121
+
122
+ // AJAX call - update option.
123
+ var data = {
124
+ action: 'sby_dashboard_notification_dismiss',
125
+ nonce: sby_admin.nonce,
126
+ id: messageId,
127
+ };
128
+
129
+ $.post( sby_admin.ajax_url, data, function( res ) {
130
+
131
+ if ( ! res.success ) {
132
+ //SBYAdmin.debug( res );
133
+ }
134
+ } ).fail( function( xhr, textStatus, e ) {
135
+
136
+ //SBYAdmin.debug( xhr.responseText );
137
+ } );
138
+ },
139
+
140
+ /**
141
+ * Click on the Next notification button.
142
+ *
143
+ * @since 2.18
144
+ *
145
+ * @param {object} event Event object.
146
+ */
147
+ navNext: function( event ) {
148
+
149
+ if ( el.$nextButton.hasClass( 'disabled' ) ) {
150
+ return;
151
+ }
152
+
153
+ el.$currentMessage.removeClass( 'current' );
154
+ el.$nextMessage.addClass( 'current' );
155
+
156
+ app.updateNavigation();
157
+ },
158
+
159
+ /**
160
+ * Click on the Previous notification button.
161
+ *
162
+ * @since 2.18
163
+ *
164
+ * @param {object} event Event object.
165
+ */
166
+ navPrev: function( event ) {
167
+
168
+ if ( el.$prevButton.hasClass( 'disabled' ) ) {
169
+ return;
170
+ }
171
+
172
+ el.$currentMessage.removeClass( 'current' );
173
+ el.$prevMessage.addClass( 'current' );
174
+
175
+ app.updateNavigation();
176
+ },
177
+
178
+ /**
179
+ * Update navigation buttons.
180
+ *
181
+ * @since 2.18
182
+ */
183
+ updateNavigation: function() {
184
+
185
+ el.$currentMessage = el.$notifications.find( '.message.current' );
186
+ el.$nextMessage = el.$currentMessage.next( '.message' );
187
+ el.$prevMessage = el.$currentMessage.prev( '.message' );
188
+
189
+ if ( el.$nextMessage.length === 0 ) {
190
+ el.$nextButton.addClass( 'disabled' );
191
+ } else {
192
+ el.$nextButton.removeClass( 'disabled' );
193
+ }
194
+
195
+ if ( el.$prevMessage.length === 0 ) {
196
+ el.$prevButton.addClass( 'disabled' );
197
+ } else {
198
+ el.$prevButton.removeClass( 'disabled' );
199
+ }
200
+ },
201
+ };
202
+
203
+ return app;
204
+
205
+ }( document, window, jQuery ) );
206
+
207
+ // Initialize.
208
+ SBYAdminNotifications.init();
js/sb-youtube.js CHANGED
@@ -392,6 +392,9 @@ if(!sby_js_exists) {
392
  });
393
  },400);
394
 
 
 
 
395
  }
396
  }
397
  }, b.prototype.preloadNeighboringImages = function() {
@@ -1502,6 +1505,7 @@ if(!sby_js_exists) {
1502
  return {
1503
  feedIndex : closestFeedIndex,
1504
  link: a.attr("href"),
 
1505
  video: a.attr("data-video-id")
1506
  }
1507
  },
392
  });
393
  },400);
394
 
395
+ if (this.$lightbox.find('iframe').length) {
396
+ this.$lightbox.find('iframe').attr('title',this.album[this.currentImageIndex].videoTitle);
397
+ }
398
  }
399
  }
400
  }, b.prototype.preloadNeighboringImages = function() {
1505
  return {
1506
  feedIndex : closestFeedIndex,
1507
  link: a.attr("href"),
1508
+ videoTitle: typeof a.attr("data-video-title") !== 'undefined' ? a.attr("data-video-title") : 'YouTube Video',
1509
  video: a.attr("data-video-id")
1510
  }
1511
  },
js/sb-youtube.min.js CHANGED
@@ -1 +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(){var e,i,t,s=s||{VER:"0.9.944"};s.bgs_Available=!1,s.bgs_CheckRunned=!1,function(e){e.fn.extend({sby_imgLiquid:function(i){this.defaults={fill:!0,verticalAlign:"center",horizontalAlign:"center",useBackgroundSize:!0,useDataHtmlAttr:!0,responsive:!0,delay:0,fadeInTime:0,removeBoxBackground:!0,hardPixels:!0,responsiveCheckTime:500,timecheckvisibility:500,onStart:null,onFinish:null,onItemStart:null,onItemFinish:null,onItemError:null},function(){if(!s.bgs_CheckRunned){s.bgs_CheckRunned=!0;var i=e('<span style="background-size:cover" />');e("body").append(i),function(){var e=i[0];if(e&&window.getComputedStyle){var t=window.getComputedStyle(e,null);t&&t.backgroundSize&&(s.bgs_Available="cover"===t.backgroundSize)}}(),i.remove()}}();var t=this;return this.options=i,this.settings=e.extend({},this.defaults,this.options),this.settings.onStart&&this.settings.onStart(),this.each(function(i){function a(){(r.responsive||h.data("sby_imgLiquid_oldProcessed"))&&h.data("sby_imgLiquid_settings")&&(r=h.data("sby_imgLiquid_settings"),l.actualSize=l.get(0).offsetWidth+l.get(0).offsetHeight/1e4,l.sizeOld&&l.actualSize!==l.sizeOld&&o(),l.sizeOld=l.actualSize,setTimeout(a,r.responsiveCheckTime))}function n(){h.data("sby_imgLiquid_error",!0),l.addClass("sby_imgLiquid_error"),r.onItemError&&r.onItemError(i,l,h),d()}function o(){var e,t,s,a,n,o,y,b,u=0,g=0,_=l.width(),f=l.height();void 0===h.data("owidth")&&h.data("owidth",h[0].width),void 0===h.data("oheight")&&h.data("oheight",h[0].height),r.fill===_/f>=h.data("owidth")/h.data("oheight")?(e="100%",t="auto",s=Math.floor(_),a=Math.floor(_*(h.data("oheight")/h.data("owidth")))):(e="auto",t="100%",s=Math.floor(f*(h.data("owidth")/h.data("oheight"))),a=Math.floor(f)),y=_-s,"left"===(n=r.horizontalAlign.toLowerCase())&&(g=0),"center"===n&&(g=.5*y),"right"===n&&(g=y),-1!==n.indexOf("%")&&((n=parseInt(n.replace("%",""),10))>0&&(g=y*n*.01)),b=f-a,"left"===(o=r.verticalAlign.toLowerCase())&&(u=0),"center"===o&&(u=.5*b),"bottom"===o&&(u=b),-1!==o.indexOf("%")&&((o=parseInt(o.replace("%",""),10))>0&&(u=b*o*.01)),r.hardPixels&&(e=s,t=a),h.css({width:e,height:t,"margin-left":Math.floor(g),"margin-top":Math.floor(u)}),h.data("sby_imgLiquid_oldProcessed")||(h.fadeTo(r.fadeInTime,1),h.data("sby_imgLiquid_oldProcessed",!0),r.removeBoxBackground&&l.css("background-image","none"),l.addClass("sby_imgLiquid_nobgSize"),l.addClass("sby_imgLiquid_ready")),r.onItemFinish&&r.onItemFinish(i,l,h),d()}function d(){i===t.length-1&&t.settings.onFinish&&t.settings.onFinish()}var r=t.settings,l=e(this),h=e("img:first",l);return h.length?(h.data("sby_imgLiquid_settings")?(l.removeClass("sby_imgLiquid_error").removeClass("sby_imgLiquid_ready"),r=e.extend({},h.data("sby_imgLiquid_settings"),t.options)):r=e.extend({},t.settings,function(){var e={};if(t.settings.useDataHtmlAttr){var i=l.attr("data-sby_imgLiquid-fill"),a=l.attr("data-sby_imgLiquid-horizontalAlign"),n=l.attr("data-sby_imgLiquid-verticalAlign");("true"===i||"false"===i)&&(e.fill=Boolean("true"===i)),void 0===a||"left"!==a&&"center"!==a&&"right"!==a&&-1===a.indexOf("%")||(e.horizontalAlign=a),void 0===n||"top"!==n&&"bottom"!==n&&"center"!==n&&-1===n.indexOf("%")||(e.verticalAlign=n)}return s.isIE&&t.settings.ieFadeInDisabled&&(e.fadeInTime=0),e}()),h.data("sby_imgLiquid_settings",r),r.onItemStart&&r.onItemStart(i,l,h),void(s.bgs_Available&&r.useBackgroundSize?(-1===l.css("background-image").indexOf(encodeURI(h.attr("src")))&&l.css({"background-image":'url("'+encodeURI(h.attr("src"))+'")'}),l.css({"background-size":r.fill?"cover":"contain","background-position":(r.horizontalAlign+" "+r.verticalAlign).toLowerCase(),"background-repeat":"no-repeat"}),e("a:first",l).css({display:"block",width:"100%",height:"100%"}),e("img",l).css({display:"none"}),r.onItemFinish&&r.onItemFinish(i,l,h),l.addClass("sby_imgLiquid_bgSize"),l.addClass("sby_imgLiquid_ready"),d()):function t(){if(h.data("oldSrc")&&h.data("oldSrc")!==h.attr("src")){var s=h.clone().removeAttr("style");return s.data("sby_imgLiquid_settings",h.data("sby_imgLiquid_settings")),h.parent().prepend(s),h.remove(),(h=s)[0].width=0,void setTimeout(t,10)}return h.data("sby_imgLiquid_oldProcessed")?void o():(h.data("sby_imgLiquid_oldProcessed",!1),h.data("oldSrc",h.attr("src")),e("img:not(:first)",l).css("display","none"),l.css({overflow:"hidden"}),h.fadeTo(0,0).removeAttr("width").removeAttr("height").css({visibility:"visible","max-width":"none","max-height":"none",width:"auto",height:"auto",display:"block"}),h.on("error",n),h[0].onerror=n,function e(){h.data("sby_imgLiquid_error")||h.data("sby_imgLiquid_loaded")||h.data("sby_imgLiquid_oldProcessed")||(l.is(":visible")&&h[0].complete&&h[0].width>0&&h[0].height>0?(h.data("sby_imgLiquid_loaded",!0),setTimeout(o,i*r.delay)):setTimeout(e,r.timecheckvisibility))}(),void a())}())):void n()})}})}(jQuery),e=s.injectCss,i=document.getElementsByTagName("head")[0],(t=document.createElement("style")).type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),i.appendChild(t)}function t(){this.feeds={},this.options=sbyOptions,this.isTouch=function(){if("ontouchstart"in document.documentElement)return!0;return!1}()}function s(e,i,t){this.el=e,this.index=i,this.settings=t,this.placeholderURL=window.sby.options.placeholder,t.narrowPlayer&&(this.placeholderURL=window.sby.options.placeholderNarrow),this.playerAPIReady=!1,this.consentGiven=!0,this.players={},this.minImageWidth=0,this.imageResolution=150,this.resizedImages={},this.needsResizing=[],this.outOfPages=!1,this.isInitialized=!1,this.mostRecentlyLoadedPosts=[]}function a(){}function n(i,t){e.ajax({url:sbyOptions.adminAjaxUrl,type:"post",data:i,success:t})}t.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="https://www.youtube.com/iframe_api",s.id="youtube-api",a.parentNode.insertBefore(s,a)}i(t)},createLightbox:function(){var i,t=new a,s=(i=0,function(e,t){clearTimeout(i),i=setTimeout(e,t)});jQuery(window).resize(function(){s(function(){t.afterResize()},200)}),function(){var i=jQuery,s=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}(),a=function(){function s(e){this.options=e,this.album=[],this.currentImageIndex=void 0,this.init()}return s.prototype.init=function(){this.enable(),this.build()},s.prototype.enable=function(){var e=this;i("body").on("click","a[data-sby-lightbox]",function(t){return e.start(i(t.currentTarget)),!1})},s.prototype.build=function(){var e=this;i(""+t.template()).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&&YT.get("sby_lb-player").pauseVideo(),jQuery("#sby_lightboxOverlay, #sby_lightbox").fadeOut())}),this.$lightbox.hide(),jQuery("#sby_lightboxOverlay").on("click",function(t){return void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").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&&YT.get("sby_lb-player").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&&YT.get("sby_lb-player").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&&YT.get("sby_lb-player").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&&YT.get("sby_lb-player").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&&YT.get("sby_lb-player").pauseVideo(),e.end(),!1})},s.prototype.start=function(e){function s(e){a.album.push(t.getData(e))}var a=this,n=i(window);n.on("resize",i.proxy(this.sizeOverlay,this)),i("select, object, embed").css({visibility:"hidden"}),this.sizeOverlay(),this.album=[];var o,d=0,r=e.attr("data-sby-lightbox");if(r){o=i(e.prop("tagName")+'[data-sby-lightbox="'+r+'"]');for(var l=0;l<o.length;l=++l)s(i(o[l])),o[l]===e[0]&&(d=l)}else if("lightbox"===e.attr("rel"))s(e);else{o=i(e.prop("tagName")+'[rel="'+e.attr("rel")+'"]');for(var h=0;h<o.length;h=++h)s(i(o[h])),o[h]===e[0]&&(d=h)}var y=n.scrollTop()+this.options.positionFromTop,b=n.scrollLeft();this.$lightbox.css({top:y+"px",left:b+"px"}).fadeIn(this.options.fadeDuration),this.changeImage(d)},s.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-100,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},s.prototype.sizeOverlay=function(){this.$overlay.width(i(window).width()).height(i(document).height())},s.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()},s.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()},s.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"))))},s.prototype.updateDetails=function(){var i=this;jQuery("iframe.sby_lb-player-loaded").length&&(jQuery(".sby_lb-player-placeholder").replaceWith(jQuery("iframe.sby_lb-player-loaded")),jQuery("iframe.sby_lb-player-loaded").removeClass("sby_lb-player-loaded").show());var s=window.sby.feeds[this.album[this.currentImageIndex].feedIndex];if(t.beforePlayerSetup(this.$lightbox,this.album[this.currentImageIndex],this.currentImageIndex,this.album,s),sby_supports_video()&&(jQuery("#sby_lightbox").removeClass("sby_video_lightbox"),this.album[this.currentImageIndex].video.length)){var a="sby_lb-player";jQuery("#sby_lightbox").addClass("sby_video_lightbox");var n=this.album[this.currentImageIndex].video,o=sbyOptions.autoplay;if(void 0===window.sbyLightboxPlayer){var d={host:window.location.protocol+"//www.youtube-nocookie.com",videoId:n,playerVars:{modestbranding:1,rel:0,autoplay:o},events:{onStateChange:function(i){var t=i.target.getVideoData().video_id;s.afterStateChange(a,t,i,e("#"+a).closest(".sby_video_thumbnail_wrap"))}}};s.maybeAddCTA(a),window.sbyLightboxPlayer=new window.YT.Player(a,d)}else window.sbyLightboxPlayer.loadVideoById(n);t.afterPlayerSetup(this.$lightbox,this.album[this.currentImageIndex],this.currentImageIndex,this.album),this.album.length>1&&this.options.showImageNumberLabel?this.$lightbox.find(".sby_lb-number").text(this.options.albumLabel(this.currentImageIndex+1,this.album.length)).fadeIn("fast"):this.$lightbox.find(".sby_lb-number").hide(),this.$outerContainer.removeClass("animating"),this.$lightbox.find(".sby_lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return i.sizeOverlay()}),setTimeout(function(){e("#sby_lightbox .sby_lb-player").css({height:e("#sby_lightbox .sby_lb-outerContainer").height()+"px",width:e("#sby_lightbox .sby_lb-outerContainer").width()+"px",top:0})},400)}},s.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)},s.prototype.enableKeyboardNav=function(){i(document).on("keyup.keyboard",i.proxy(this.keyboardAction,this))},s.prototype.disableKeyboardNav=function(){i(document).off(".keyboard")},s.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&&YT.get("sby_lb-player").pauseVideo())},s.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"})},s}();i(function(){var i=new s;new a(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 t=e(this),a=void 0!==t.attr("data-sby-flags")?t.attr("data-sby-flags").split(","):[],o=void 0!==t.attr("data-options")?JSON.parse(t.attr("data-options")):{};if(a.indexOf("testAjax")>-1){window.sby.triggeredTest=!0;n({action:"sby_on_ajax_test_trigger"},function(e){console.log("did test")})}var d={cols:t.attr("data-cols"),colsmobile:"same"!==t.attr("data-colsmobile")?t.attr("data-colsmobile"):t.attr("data-cols"),num:t.attr("data-num"),imgRes:t.attr("data-res"),feedID:t.attr("data-feedid"),shortCodeAtts:t.attr("data-shortcode-atts"),resizingEnabled:-1===a.indexOf("resizeDisable"),imageLoadEnabled:-1===a.indexOf("imageLoadDisable"),debugEnabled:a.indexOf("debug")>-1,favorLocal:a.indexOf("favorLocal")>-1,ajaxPostLoad:a.indexOf("ajaxPostLoad")>-1,checkWPPosts:a.indexOf("checkWPPosts")>-1,cacheAll:a.indexOf("cacheAll")>-1,lightboxEnabled:void 0!==t.attr("data-sby-supports-lightbox"),autoMinRes:1,general:o};window.sby.feeds[i]=function(e,i,t){return new s(e,i,t)}(this,i,d),void 0!==window.sbyAPIReady&&(window.sby.feeds[i].playerAPIReady=!0),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)}},s.prototype={init:function(){var i=this;e(this.el).find("#sby_mod_error").length&&e(this.el).prepend(e(this.el).find("#sby_mod_error")),this.settings.ajaxPostLoad?this.getNewPostSet():this.afterInitialImagesLoaded();var t,s=(t=0,function(e,i){clearTimeout(t),t=setTimeout(e,i)});jQuery(window).resize(function(){s(function(){i.afterResize()},500)})},initLayout:function(){this.initGalleryLayout(),this.initGrid()},initGalleryLayout: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?void 0===t.player&&t.playerEagerLoaded()&&t.createPlayer("sby_player"+t.index):(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)))}),window.sbySemiEagerLoading&&t.createPlayer("sby_player"+t.index))},initGrid:function(){if(window.sbySemiEagerLoading&&jQuery("#sby_lightbox").length){var i=this;playerID="sby_lb-player",jQuery("#sby_lightbox").addClass("sby_video_lightbox");var t=e(this.el).find("sby_item").first().attr("data-video-id"),s=sbyOptions.autoplay;if(void 0===window.sbyLightboxPlayer){var a={host:window.location.protocol+"//www.youtube-nocookie.com",videoId:t,playerVars:{modestbranding:1,rel:0,autoplay:s},events:{onStateChange:function(t){var s=t.target.getVideoData().video_id;i.afterStateChange(playerID,s,t,e("#"+playerID).closest(".sby_video_thumbnail_wrap"))}}};i.maybeAddCTA(playerID),window.sbyLightboxPlayer=new window.YT.Player(playerID,a)}}},createPlayer:function(i,t,s,a){var n=e(this.el),o=this;if(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(s){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"),o.afterStateChange(i,t,s,e("#"+i).closest(".sby_video_thumbnail_wrap")),1===s.data&&void 0!==o.players&&n.find(".sby_item").each(function(){var i=o.getVideoID(e(this));e(this).find("iframe").length&&i!==t&&void 0!==o.players[i]&&"function"==typeof o.players[i].pauseVideo&&o.players[i].pauseVideo()})}}),window.sbyEagerLoading)var d=YT.get(i);else d=new window.YT.Player(i,a);return this.maybeAddCTA(i),n.hasClass("sby_layout_list")&&void 0===this.players[t]?this.players[t]=d:void 0===this.player&&(this.player=d),d},afterStateChange:function(e,i,t,s){},afterInitialImagesLoaded:function(){this.initLayout(),this.loadMoreButtonInit(),this.hideExtraItemsForWidth(),this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed(),this.afterFeedSet(),this.sizePlayer(),this.sizeItems()},afterResize:function(){this.setImageHeight(),this.setImageResolution(),this.maybeRaiseImageResolution(),this.setImageSizeClass(),this.sizePlayer(),this.sizeItems()},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(),this.sizePlayer(),this.sizeItems(),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()},afterFeedSet:function(){},sizePlayer:function(){var i=e(this.el),t=this;if(i.hasClass("sby_layout_gallery")){$playerThumbnail=i.find(".sby_player_item").find(".sby_player_video_thumbnail");var s=$playerThumbnail.innerWidth(),a=Math.floor(9*s/16);t.settings.narrowPlayer&&(a=Math.floor(3*s/4)),$playerThumbnail.css("height",a+"px").css("overflow","hidden")}else i.hasClass("sby_layout_list")&&i.find(".sby_item").each(function(){$playerThumbnail=e(this).find(".sby_item_video_thumbnail");var i=$playerThumbnail.innerWidth(),s=Math.floor(9*i/16);t.settings.narrowPlayer&&(s=Math.floor(3*i/4)),$playerThumbnail.css("height",s+"px").css("overflow","hidden")})},sizeItems:function(){var i=e(this.el);i.hasClass("sby_layout_list")||i.find(".sby_item").find(".sby_item_video_thumbnail").each(function(){if(e(this).hasClass("sby_imgLiquid_ready")){var i=e(this).innerWidth(),t=Math.floor(9*i/16);e(this).css("height",t+"px").css("overflow","hidden")}})},revealNewImages:function(){var i=e(this.el),t=this;this.applyImageLiquid(),"function"==typeof sbyCustomJS&&setTimeout(function(){sbyCustomJS()},100),i.find(".sby-screenreader").find("img").remove(),i.find(".sby_item.sby_new").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)}),videoID=s.attr("data-video-id"),window.sbyEagerLoading&&t.canCreatePlayer()&&e("#sby_player_"+videoID).length&&(player=new YT.Player("sby_player_"+videoID,{height:"100",width:"100",videoId:videoID,playerVars:{modestbranding:1,rel:0,autoplay:0},events:{onStateChange:function(e){e.target.getVideoData().video_id;1===e.data&&s.find(".sby_item").each(function(){var i=jQuery(this).attr("data-video-id");jQuery(this).find("iframe").length&&jQuery(e.target.a).attr("id")!==jQuery(this).find("iframe").attr("id")&&YT.get("sby_player_"+i).pauseVideo()})}}})),s.find(".sby_video_thumbnail").mouseenter(function(){t.onThumbnailEnter(e(this),!1)}),s.find(".sby_player_wrap").mouseleave(function(){t.onThumbnailLeave(e(this),!1)}),s.find(".sby_video_thumbnail").click(function(i){i.preventDefault(),t.onThumbnailClick(e(this),!1)}),t.settings.lightboxEnabled&&(s.find(".sby_video_thumbnail").attr("data-sby-lightbox",t.index),"undefined"!=typeof sbyOptions&&void 0!==sbyOptions.lightboxPlaceholder&&(t.settings.narrowPlayer?s.find(".sby_video_thumbnail").attr("href",sbyOptions.lightboxPlaceholderNarrow):s.find(".sby_video_thumbnail").attr("href",sbyOptions.lightboxPlaceholder))),t.afterItemRevealed(s),""===s.find(".sby_info_item").text().trim()&&s.find(".sby_info_item").addClass("sby_no_space")}),i.find(".sby_player_item").each(function(e){var i=jQuery(this);t.afterItemRevealed(i)}),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)},afterItemRevealed:function(){},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;n({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||i.settings.singleCheckPosts){var t=void 0!==i.settings.feedID?i.settings.feedID:"sby_single",s=i.mostRecentlyLoadedPosts;i.mostRecentlyLoadedPosts=[];n({action:"sby_check_wp_submit",feed_id:t,atts:i.settings.shortCodeAtts,offset:e(this.el).hasClass("sby_layout_carousel")?Math.floor(e(this.el).find(".sby_item").length/2-1):e(this.el).find(".sby_item").length,posts:s,cache_all:i.settings.cacheAll},function(e){if(0===e.trim().indexOf("{")){var t=JSON.parse(e);i.settings.debugEnabled&&console.log(t),i.afterSendCheckWPPostsToServer(t)}})}},afterSendCheckWPPostsToServer:function(e){},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;n({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),n=void 0!==a.feedStatus.checkWPPosts&&a.feedStatus.checkWPPosts;t.settings.debugEnabled&&console.log(a),t.settings.checkWPPosts=!!n,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===a.placeholderURL||s){if(a.settings.debugEnabled){var h=o===a.placeholderURL?"was placeholder":"too small";console.log("rais res for "+o,h)}var y=n[r];i.find(".sby_video_thumbnail > img").attr("src",y),i.find(".sby_video_thumbnail").hasClass("sby_imgLiquid_ready")&&i.find(".sby_video_thumbnail").css("background-image",'url("'+y+'")')}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;i.hasClass(".sby_layout_carousel")||(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>140&&n<240?i.addClass("sby_medium"):n<=140&&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(i){if(i.hasClass("sby_item")||i.hasClass("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(i.closest("sby_item").length||i.closest("sby_player_item").length){var t=i.closest("sby_item").length?i.closest("sby_item"):i.closest("sby_player_item");if(void 0!==t.find(".sby_video_thumbnail").attr("data-video-id"))return t.find(".sby_video_thumbnail").attr("data-video-id")}else{if(i.hasClass("sb_youtube"))return i.find(".sby_item").first().find(".sby_video_thumbnail").attr("data-video-id");if(e(this.el).find(".sby_video_thumbnail").first().length&&void 0!==e(this.el).find(".sby_video_thumbnail").first().attr("data-video-id"))return e(this.el).find(".sby_video_thumbnail").first().attr("data-video-id")}return""},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)},applyImageLiquid:function(){var t=e(this.el);i(),"function"==typeof t.find(".sby_player_item").sby_imgLiquid&&(t.find(".sby_player_item").length&&t.find(".sby_player_item .sby_player_video_thumbnail").sby_imgLiquid({fill:!0}),t.find(".sby_item .sby_item_video_thumbnail").sby_imgLiquid({fill:!0}))},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,s){if(this.canCreatePlayer()){var a=e(this.el);if(a.hasClass("sby_layout_gallery"))if(a.addClass("sby_player_added").find(".sby_player_outer_wrap").addClass("sby_player_loading"),a.find(".sby_player_outer_wrap .sby_video_thumbnail").find(".sby_loader").show().removeClass("sby_hidden"),a.find(".sby_player_outer_wrap iframe").length)if(t){s=void 0===s?this.getVideoID(a.find(".sby_item").first()):s;this.playVideoInPlayer(s)}else{s=void 0===s?this.getVideoID(i.closest(".sby_item")):s;this.changePlayerInfo(i.closest(".sby_item")),this.playVideoInPlayer(s),this.afterVideoChanged()}else if(t)this.createPlayer("sby_player"+this.index);else{var s=void 0===s?this.getVideoID(i.closest(".sby_item")):s;this.createPlayer("sby_player"+this.index,s)}else if(e(this.el).hasClass("sby_layout_grid")||e(this.el).hasClass("sby_layout_carousel")){var n=i.closest(".sby_item");s=void 0===s?this.getVideoID(n):s;this.playVideoInPlayer(s),this.afterVideoChanged()}else if(e(this.el).hasClass("sby_layout_list")){n=i.closest(".sby_item"),s=void 0===s?this.getVideoID(n):s;n.length&&!n.find("iframe").length?(n.find(".sby_loader").show().removeClass("sby_hidden"),n.addClass("sby_player_loading sby_player_loaded"),this.createPlayer("sby_player_"+s,s)):(this.playVideoInPlayer(s,n.attr("data-video-id")),this.afterVideoChanged())}}},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){},changePlayerInfo:function(e){},playerEagerLoaded:function(){if(void 0!==this.player||e(this.el).hasClass("sby_player_loaded"))return!0},canCreatePlayer:function(){return!e(this.el).find("#sby_blank").length&&(this.playerEagerLoaded()||this.playerAPIReady&&this.consentGiven||window.sbyAPIReady&&this.consentGiven)},playVideoInPlayer:function(e,i){void 0!==this.player&&void 0!==this.player.loadVideoById?this.player.loadVideoById(e):void 0!==window.sbyLightboxPlayer&&void 0!==window.sbyLightboxPlayer.loadVideoById?window.sbyLightboxPlayer.loadVideoById(e):void 0!==i&&void 0!==this.players&&void 0!==this.players[i]&&void 0!==this.players[i].loadVideoById&&this.players[i].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))},maybeAddCTA:function(e,i){}},a.prototype={getData:function(e){return{feedIndex:parseInt(e.closest(".sb_youtube").attr("data-sby-index")-1),link:e.attr("href"),video:e.attr("data-video-id")}},template:function(){return"<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 sby_lb-player-placeholder' id='sby_lb-player'></div><div class='sby_lb-nav'><a class='sby_lb-prev' href='#' ><p class='sby-screenreader'>Previous Slide</p><span></span></a><a class='sby_lb-next' href='#' ><p class='sby-screenreader'>Next Slide</p><span></span></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></div><div class='sby_lb-closeContainer'><a class='sby_lb-close'></a></div></div></div></div>"},beforePlayerSetup:function(e,i,t,s,a){},afterPlayerSetup:function(e,i,t,s){},afterResize:function(){var i=e("#sby_lightbox .sby_lb-player").height();if(i>100){var t=e("#sby_lightbox .sby_lb-outerContainer").height()-i;t>10&&e("#sby_lightbox .sby_lb-player").css("top",t/2)}},pausePlayer:function(){void 0!==YT.get("sby_lb-player")&&"function"==typeof YT.get("sby_lb-player").pauseVideo?YT.get("sby_lb-player").pauseVideo():void 0!==window.sbyLightboxPlayer&&"function"==typeof window.sbyLightboxPlayer.pauseVideo&&window.sbyLightboxPlayer.pauseVideo()}},window.sby_init=function(){window.sby=new t,window.sby.createPage(window.sby.createFeeds,{whenFeedsCreated:window.sby.afterFeedsCreated})}}(jQuery),void 0===window.sbyEagerLoading&&(window.sbyEagerLoading=void 0!==window.sbyOptions&&window.sbyOptions.eagerload,jQuery("div[data-vc-video-bg]").length&&(window.sbyEagerLoading=!0)),void 0===window.sbySemiEagerLoading&&(window.sbySemiEagerLoading=void 0!==window.sbyOptions&&window.sbyOptions.semiEagerload,(jQuery("div[data-vc-video-bg]").length||window.sbyEagerLoading)&&(window.sbySemiEagerLoading=!1)),jQuery(document).ready(function(e){window.sbySemiEagerLoading||sby_init()})}if(window.sbySemiEagerLoading){var sbyYScriptId="sby-youtube-api",sbyYScript=document.getElementById(sbyYScriptId);if(null===sbyYScript){var tag=document.createElement("script"),firstScript=document.getElementsByTagName("script")[0];tag.src="https://www.youtube.com/iframe_api",tag.id=sbyYScriptId,firstScript.parentNode.insertBefore(tag,firstScript)}}window.onYouTubeIframeAPIReady=function(){var e=document.getElementsByClassName("sb_youtube").length;if(e>0){if(window.sbySemiEagerLoading){if(void 0!==window.sby)for(var i=0;i<e;i++)window.sby.feeds[i].playerAPIReady=!0;else window.sbyAPIReady=!0;sby_init()}else if(jQuery(".sb_youtube").each(function(e){var i=jQuery(this);i.find(".sby_live_player").length&&(player=new YT.Player(i.find(".sby_live_player").attr("id"),{events:{onReady:function(){i.find(".sby_live_player").hide(),i.find(".sby_item").remove();var t=YT.get(i.find(".sby_live_player").attr("id")).getVideoData().video_id;i.find(".sby_player_video_thumbnail").attr("data-video-id",t).css("z-index",-1);i.find(".sby_item").length;var s={action:"sby_live_retrieve",video_id:t,feed_id:i.attr("data-feedid"),atts:i.attr("data-shortcode-atts")};jQuery.ajax({url:sbyOptions.adminAjaxUrl,type:"post",data:s,success:function(t){if(0===t.trim().indexOf("{")){var s=window.sby.feeds[e],a=JSON.parse(t),n=void 0!==a.feedStatus.checkWPPosts&&a.feedStatus.checkWPPosts;s.settings.debugEnabled&&console.log(a),s.settings.checkWPPosts=!!n,s.appendNewPosts(a.html),s.addResizedImages(a.resizedImages),s.afterInitialImagesLoaded(),a.feedStatus.shouldPaginate?s.outOfPages=!1:(s.outOfPages=!0,i.find(".sby_load_btn").hide()),jQuery(".sby_no_js").removeClass("sby_no_js"),i.find(".sby_live_player").remove(),i.hasClass("sby_layout_gallery")&&s.createPlayer("sby_player"+s.index),i.find(".sby_player_item").css("opacity",1),i.find(".sby_item").css("opacity",1),i.find(".sby_player_loading").removeClass("sby_player_loading"),i.hasClass("sby_layout_list")&&i.find(".sby_item_video_thumbnail").mouseenter(function(){jQuery(this).css("z-index",-1)})}}})}}}))}),window.sbyEagerLoading){var t=!1,s=!1;jQuery(".sb_youtube").each(function(e){var i=jQuery(this);i.hasClass("sby_layout_list")?(jQuery(this).addClass("sby_player_loaded"),i.find(".sby_item").each(function(){videoID=jQuery(this).attr("data-video-id"),player=new YT.Player("sby_player_"+videoID,{height:"100",width:"100",videoId:videoID,playerVars:{modestbranding:1,rel:0,autoplay:s},events:{onStateChange:function(e){e.target.getVideoData().video_id;1===e.data&&i.find(".sby_item").each(function(){var e=jQuery(this).attr("data-video-id");jQuery(this).find("iframe").length&&e!==jQuery(this).find("iframe").attr("id").replace("sby_player_","")&&YT.get("sby_player_"+e).pauseVideo()})}}})})):i.hasClass("sby_layout_gallery")?(jQuery(this).addClass("sby_player_loaded"),player=new YT.Player("sby_player"+e,{height:"100",width:"100",videoId:jQuery(this).find(".sby_item").first().attr("data-video-id"),playerVars:{modestbranding:1,rel:0,autoplay:s},events:{onStateChange:function(e){e.target.getVideoData().video_id;1===e.data&&i.find(".sby_item").each(function(){var i=jQuery(this).attr("data-video-id");jQuery(this).find("iframe").length&&jQuery(e.target.a).attr("id")!==jQuery(this).find("iframe").attr("id")&&YT.get("sby_player_"+i).pauseVideo()})}}})):t=!0})}else if(void 0!==window.sby)for(i=0;i<e;i++)window.sby.feeds[i].playerAPIReady=!0;else window.sbyAPIReady=!0;t&&(jQuery("#sby_lb-player").length||jQuery(".sb_youtube").first().append('<div class="sby_lb-player-loaded sby_lb-player" id="sby_lb-player" style="display: none;"></div>'),player=new YT.Player("sby_lb-player",{height:"100",width:"100",videoId:jQuery(this).find(".sby_item").first().attr("data-video-id"),playerVars:{modestbranding:1,rel:0,autoplay:s}}),window.sbyLightboxPlayer=player)}};
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(){var e,i,t,s=s||{VER:"0.9.944"};s.bgs_Available=!1,s.bgs_CheckRunned=!1,function(e){e.fn.extend({sby_imgLiquid:function(i){this.defaults={fill:!0,verticalAlign:"center",horizontalAlign:"center",useBackgroundSize:!0,useDataHtmlAttr:!0,responsive:!0,delay:0,fadeInTime:0,removeBoxBackground:!0,hardPixels:!0,responsiveCheckTime:500,timecheckvisibility:500,onStart:null,onFinish:null,onItemStart:null,onItemFinish:null,onItemError:null},function(){if(!s.bgs_CheckRunned){s.bgs_CheckRunned=!0;var i=e('<span style="background-size:cover" />');e("body").append(i),function(){var e=i[0];if(e&&window.getComputedStyle){var t=window.getComputedStyle(e,null);t&&t.backgroundSize&&(s.bgs_Available="cover"===t.backgroundSize)}}(),i.remove()}}();var t=this;return this.options=i,this.settings=e.extend({},this.defaults,this.options),this.settings.onStart&&this.settings.onStart(),this.each(function(i){function a(){(r.responsive||h.data("sby_imgLiquid_oldProcessed"))&&h.data("sby_imgLiquid_settings")&&(r=h.data("sby_imgLiquid_settings"),l.actualSize=l.get(0).offsetWidth+l.get(0).offsetHeight/1e4,l.sizeOld&&l.actualSize!==l.sizeOld&&o(),l.sizeOld=l.actualSize,setTimeout(a,r.responsiveCheckTime))}function n(){h.data("sby_imgLiquid_error",!0),l.addClass("sby_imgLiquid_error"),r.onItemError&&r.onItemError(i,l,h),d()}function o(){var e,t,s,a,n,o,y,b,u=0,g=0,_=l.width(),f=l.height();void 0===h.data("owidth")&&h.data("owidth",h[0].width),void 0===h.data("oheight")&&h.data("oheight",h[0].height),r.fill===_/f>=h.data("owidth")/h.data("oheight")?(e="100%",t="auto",s=Math.floor(_),a=Math.floor(_*(h.data("oheight")/h.data("owidth")))):(e="auto",t="100%",s=Math.floor(f*(h.data("owidth")/h.data("oheight"))),a=Math.floor(f)),y=_-s,"left"===(n=r.horizontalAlign.toLowerCase())&&(g=0),"center"===n&&(g=.5*y),"right"===n&&(g=y),-1!==n.indexOf("%")&&((n=parseInt(n.replace("%",""),10))>0&&(g=y*n*.01)),b=f-a,"left"===(o=r.verticalAlign.toLowerCase())&&(u=0),"center"===o&&(u=.5*b),"bottom"===o&&(u=b),-1!==o.indexOf("%")&&((o=parseInt(o.replace("%",""),10))>0&&(u=b*o*.01)),r.hardPixels&&(e=s,t=a),h.css({width:e,height:t,"margin-left":Math.floor(g),"margin-top":Math.floor(u)}),h.data("sby_imgLiquid_oldProcessed")||(h.fadeTo(r.fadeInTime,1),h.data("sby_imgLiquid_oldProcessed",!0),r.removeBoxBackground&&l.css("background-image","none"),l.addClass("sby_imgLiquid_nobgSize"),l.addClass("sby_imgLiquid_ready")),r.onItemFinish&&r.onItemFinish(i,l,h),d()}function d(){i===t.length-1&&t.settings.onFinish&&t.settings.onFinish()}var r=t.settings,l=e(this),h=e("img:first",l);return h.length?(h.data("sby_imgLiquid_settings")?(l.removeClass("sby_imgLiquid_error").removeClass("sby_imgLiquid_ready"),r=e.extend({},h.data("sby_imgLiquid_settings"),t.options)):r=e.extend({},t.settings,function(){var e={};if(t.settings.useDataHtmlAttr){var i=l.attr("data-sby_imgLiquid-fill"),a=l.attr("data-sby_imgLiquid-horizontalAlign"),n=l.attr("data-sby_imgLiquid-verticalAlign");("true"===i||"false"===i)&&(e.fill=Boolean("true"===i)),void 0===a||"left"!==a&&"center"!==a&&"right"!==a&&-1===a.indexOf("%")||(e.horizontalAlign=a),void 0===n||"top"!==n&&"bottom"!==n&&"center"!==n&&-1===n.indexOf("%")||(e.verticalAlign=n)}return s.isIE&&t.settings.ieFadeInDisabled&&(e.fadeInTime=0),e}()),h.data("sby_imgLiquid_settings",r),r.onItemStart&&r.onItemStart(i,l,h),void(s.bgs_Available&&r.useBackgroundSize?(-1===l.css("background-image").indexOf(encodeURI(h.attr("src")))&&l.css({"background-image":'url("'+encodeURI(h.attr("src"))+'")'}),l.css({"background-size":r.fill?"cover":"contain","background-position":(r.horizontalAlign+" "+r.verticalAlign).toLowerCase(),"background-repeat":"no-repeat"}),e("a:first",l).css({display:"block",width:"100%",height:"100%"}),e("img",l).css({display:"none"}),r.onItemFinish&&r.onItemFinish(i,l,h),l.addClass("sby_imgLiquid_bgSize"),l.addClass("sby_imgLiquid_ready"),d()):function t(){if(h.data("oldSrc")&&h.data("oldSrc")!==h.attr("src")){var s=h.clone().removeAttr("style");return s.data("sby_imgLiquid_settings",h.data("sby_imgLiquid_settings")),h.parent().prepend(s),h.remove(),(h=s)[0].width=0,void setTimeout(t,10)}return h.data("sby_imgLiquid_oldProcessed")?void o():(h.data("sby_imgLiquid_oldProcessed",!1),h.data("oldSrc",h.attr("src")),e("img:not(:first)",l).css("display","none"),l.css({overflow:"hidden"}),h.fadeTo(0,0).removeAttr("width").removeAttr("height").css({visibility:"visible","max-width":"none","max-height":"none",width:"auto",height:"auto",display:"block"}),h.on("error",n),h[0].onerror=n,function e(){h.data("sby_imgLiquid_error")||h.data("sby_imgLiquid_loaded")||h.data("sby_imgLiquid_oldProcessed")||(l.is(":visible")&&h[0].complete&&h[0].width>0&&h[0].height>0?(h.data("sby_imgLiquid_loaded",!0),setTimeout(o,i*r.delay)):setTimeout(e,r.timecheckvisibility))}(),void a())}())):void n()})}})}(jQuery),e=s.injectCss,i=document.getElementsByTagName("head")[0],(t=document.createElement("style")).type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),i.appendChild(t)}function t(){this.feeds={},this.options=sbyOptions,this.isTouch=function(){if("ontouchstart"in document.documentElement)return!0;return!1}()}function s(e,i,t){this.el=e,this.index=i,this.settings=t,this.placeholderURL=window.sby.options.placeholder,t.narrowPlayer&&(this.placeholderURL=window.sby.options.placeholderNarrow),this.playerAPIReady=!1,this.consentGiven=!0,this.players={},this.minImageWidth=0,this.imageResolution=150,this.resizedImages={},this.needsResizing=[],this.outOfPages=!1,this.isInitialized=!1,this.mostRecentlyLoadedPosts=[]}function a(){}function n(i,t){e.ajax({url:sbyOptions.adminAjaxUrl,type:"post",data:i,success:t})}t.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="https://www.youtube.com/iframe_api",s.id="youtube-api",a.parentNode.insertBefore(s,a)}i(t)},createLightbox:function(){var i,t=new a,s=(i=0,function(e,t){clearTimeout(i),i=setTimeout(e,t)});jQuery(window).resize(function(){s(function(){t.afterResize()},200)}),function(){var i=jQuery,s=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}(),a=function(){function s(e){this.options=e,this.album=[],this.currentImageIndex=void 0,this.init()}return s.prototype.init=function(){this.enable(),this.build()},s.prototype.enable=function(){var e=this;i("body").on("click","a[data-sby-lightbox]",function(t){return e.start(i(t.currentTarget)),!1})},s.prototype.build=function(){var e=this;i(""+t.template()).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&&YT.get("sby_lb-player").pauseVideo(),jQuery("#sby_lightboxOverlay, #sby_lightbox").fadeOut())}),this.$lightbox.hide(),jQuery("#sby_lightboxOverlay").on("click",function(t){return void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").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&&YT.get("sby_lb-player").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&&YT.get("sby_lb-player").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&&YT.get("sby_lb-player").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&&YT.get("sby_lb-player").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&&YT.get("sby_lb-player").pauseVideo(),e.end(),!1})},s.prototype.start=function(e){function s(e){a.album.push(t.getData(e))}var a=this,n=i(window);n.on("resize",i.proxy(this.sizeOverlay,this)),i("select, object, embed").css({visibility:"hidden"}),this.sizeOverlay(),this.album=[];var o,d=0,r=e.attr("data-sby-lightbox");if(r){o=i(e.prop("tagName")+'[data-sby-lightbox="'+r+'"]');for(var l=0;l<o.length;l=++l)s(i(o[l])),o[l]===e[0]&&(d=l)}else if("lightbox"===e.attr("rel"))s(e);else{o=i(e.prop("tagName")+'[rel="'+e.attr("rel")+'"]');for(var h=0;h<o.length;h=++h)s(i(o[h])),o[h]===e[0]&&(d=h)}var y=n.scrollTop()+this.options.positionFromTop,b=n.scrollLeft();this.$lightbox.css({top:y+"px",left:b+"px"}).fadeIn(this.options.fadeDuration),this.changeImage(d)},s.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-100,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},s.prototype.sizeOverlay=function(){this.$overlay.width(i(window).width()).height(i(document).height())},s.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()},s.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()},s.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"))))},s.prototype.updateDetails=function(){var i=this;jQuery("iframe.sby_lb-player-loaded").length&&(jQuery(".sby_lb-player-placeholder").replaceWith(jQuery("iframe.sby_lb-player-loaded")),jQuery("iframe.sby_lb-player-loaded").removeClass("sby_lb-player-loaded").show());var s=window.sby.feeds[this.album[this.currentImageIndex].feedIndex];if(t.beforePlayerSetup(this.$lightbox,this.album[this.currentImageIndex],this.currentImageIndex,this.album,s),sby_supports_video()&&(jQuery("#sby_lightbox").removeClass("sby_video_lightbox"),this.album[this.currentImageIndex].video.length)){var a="sby_lb-player";jQuery("#sby_lightbox").addClass("sby_video_lightbox");var n=this.album[this.currentImageIndex].video,o=sbyOptions.autoplay;if(void 0===window.sbyLightboxPlayer){var d={host:window.location.protocol+"//www.youtube-nocookie.com",videoId:n,playerVars:{modestbranding:1,rel:0,autoplay:o},events:{onStateChange:function(i){var t=i.target.getVideoData().video_id;s.afterStateChange(a,t,i,e("#"+a).closest(".sby_video_thumbnail_wrap"))}}};s.maybeAddCTA(a),window.sbyLightboxPlayer=new window.YT.Player(a,d)}else window.sbyLightboxPlayer.loadVideoById(n);t.afterPlayerSetup(this.$lightbox,this.album[this.currentImageIndex],this.currentImageIndex,this.album),this.album.length>1&&this.options.showImageNumberLabel?this.$lightbox.find(".sby_lb-number").text(this.options.albumLabel(this.currentImageIndex+1,this.album.length)).fadeIn("fast"):this.$lightbox.find(".sby_lb-number").hide(),this.$outerContainer.removeClass("animating"),this.$lightbox.find(".sby_lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return i.sizeOverlay()}),setTimeout(function(){e("#sby_lightbox .sby_lb-player").css({height:e("#sby_lightbox .sby_lb-outerContainer").height()+"px",width:e("#sby_lightbox .sby_lb-outerContainer").width()+"px",top:0})},400),this.$lightbox.find("iframe").length&&this.$lightbox.find("iframe").attr("title",this.album[this.currentImageIndex].videoTitle)}},s.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)},s.prototype.enableKeyboardNav=function(){i(document).on("keyup.keyboard",i.proxy(this.keyboardAction,this))},s.prototype.disableKeyboardNav=function(){i(document).off(".keyboard")},s.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&&YT.get("sby_lb-player").pauseVideo())},s.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"})},s}();i(function(){var i=new s;new a(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 t=e(this),a=void 0!==t.attr("data-sby-flags")?t.attr("data-sby-flags").split(","):[],o=void 0!==t.attr("data-options")?JSON.parse(t.attr("data-options")):{};if(a.indexOf("testAjax")>-1){window.sby.triggeredTest=!0;n({action:"sby_on_ajax_test_trigger"},function(e){console.log("did test")})}var d={cols:t.attr("data-cols"),colsmobile:"same"!==t.attr("data-colsmobile")?t.attr("data-colsmobile"):t.attr("data-cols"),num:t.attr("data-num"),imgRes:t.attr("data-res"),feedID:t.attr("data-feedid"),shortCodeAtts:t.attr("data-shortcode-atts"),resizingEnabled:-1===a.indexOf("resizeDisable"),imageLoadEnabled:-1===a.indexOf("imageLoadDisable"),debugEnabled:a.indexOf("debug")>-1,favorLocal:a.indexOf("favorLocal")>-1,ajaxPostLoad:a.indexOf("ajaxPostLoad")>-1,checkWPPosts:a.indexOf("checkWPPosts")>-1,cacheAll:a.indexOf("cacheAll")>-1,lightboxEnabled:void 0!==t.attr("data-sby-supports-lightbox"),autoMinRes:1,general:o};window.sby.feeds[i]=function(e,i,t){return new s(e,i,t)}(this,i,d),void 0!==window.sbyAPIReady&&(window.sby.feeds[i].playerAPIReady=!0),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)}},s.prototype={init:function(){var i=this;e(this.el).find("#sby_mod_error").length&&e(this.el).prepend(e(this.el).find("#sby_mod_error")),this.settings.ajaxPostLoad?this.getNewPostSet():this.afterInitialImagesLoaded();var t,s=(t=0,function(e,i){clearTimeout(t),t=setTimeout(e,i)});jQuery(window).resize(function(){s(function(){i.afterResize()},500)})},initLayout:function(){this.initGalleryLayout(),this.initGrid()},initGalleryLayout: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?void 0===t.player&&t.playerEagerLoaded()&&t.createPlayer("sby_player"+t.index):(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)))}),window.sbySemiEagerLoading&&t.createPlayer("sby_player"+t.index))},initGrid:function(){if(window.sbySemiEagerLoading&&jQuery("#sby_lightbox").length){var i=this;playerID="sby_lb-player",jQuery("#sby_lightbox").addClass("sby_video_lightbox");var t=e(this.el).find("sby_item").first().attr("data-video-id"),s=sbyOptions.autoplay;if(void 0===window.sbyLightboxPlayer){var a={host:window.location.protocol+"//www.youtube-nocookie.com",videoId:t,playerVars:{modestbranding:1,rel:0,autoplay:s},events:{onStateChange:function(t){var s=t.target.getVideoData().video_id;i.afterStateChange(playerID,s,t,e("#"+playerID).closest(".sby_video_thumbnail_wrap"))}}};i.maybeAddCTA(playerID),window.sbyLightboxPlayer=new window.YT.Player(playerID,a)}}},createPlayer:function(i,t,s,a){var n=e(this.el),o=this;if(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(s){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"),o.afterStateChange(i,t,s,e("#"+i).closest(".sby_video_thumbnail_wrap")),1===s.data&&void 0!==o.players&&n.find(".sby_item").each(function(){var i=o.getVideoID(e(this));e(this).find("iframe").length&&i!==t&&void 0!==o.players[i]&&"function"==typeof o.players[i].pauseVideo&&o.players[i].pauseVideo()})}}),window.sbyEagerLoading)var d=YT.get(i);else d=new window.YT.Player(i,a);return this.maybeAddCTA(i),n.hasClass("sby_layout_list")&&void 0===this.players[t]?this.players[t]=d:void 0===this.player&&(this.player=d),d},afterStateChange:function(e,i,t,s){},afterInitialImagesLoaded:function(){this.initLayout(),this.loadMoreButtonInit(),this.hideExtraItemsForWidth(),this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed(),this.afterFeedSet(),this.sizePlayer(),this.sizeItems()},afterResize:function(){this.setImageHeight(),this.setImageResolution(),this.maybeRaiseImageResolution(),this.setImageSizeClass(),this.sizePlayer(),this.sizeItems()},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(),this.sizePlayer(),this.sizeItems(),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()},afterFeedSet:function(){},sizePlayer:function(){var i=e(this.el),t=this;if(i.hasClass("sby_layout_gallery")){$playerThumbnail=i.find(".sby_player_item").find(".sby_player_video_thumbnail");var s=$playerThumbnail.innerWidth(),a=Math.floor(9*s/16);t.settings.narrowPlayer&&(a=Math.floor(3*s/4)),$playerThumbnail.css("height",a+"px").css("overflow","hidden")}else i.hasClass("sby_layout_list")&&i.find(".sby_item").each(function(){$playerThumbnail=e(this).find(".sby_item_video_thumbnail");var i=$playerThumbnail.innerWidth(),s=Math.floor(9*i/16);t.settings.narrowPlayer&&(s=Math.floor(3*i/4)),$playerThumbnail.css("height",s+"px").css("overflow","hidden")})},sizeItems:function(){var i=e(this.el);i.hasClass("sby_layout_list")||i.find(".sby_item").find(".sby_item_video_thumbnail").each(function(){if(e(this).hasClass("sby_imgLiquid_ready")){var i=e(this).innerWidth(),t=Math.floor(9*i/16);e(this).css("height",t+"px").css("overflow","hidden")}})},revealNewImages:function(){var i=e(this.el),t=this;this.applyImageLiquid(),"function"==typeof sbyCustomJS&&setTimeout(function(){sbyCustomJS()},100),i.find(".sby-screenreader").find("img").remove(),i.find(".sby_item.sby_new").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)}),videoID=s.attr("data-video-id"),window.sbyEagerLoading&&t.canCreatePlayer()&&e("#sby_player_"+videoID).length&&(player=new YT.Player("sby_player_"+videoID,{height:"100",width:"100",videoId:videoID,playerVars:{modestbranding:1,rel:0,autoplay:0},events:{onStateChange:function(e){e.target.getVideoData().video_id;1===e.data&&s.find(".sby_item").each(function(){var i=jQuery(this).attr("data-video-id");jQuery(this).find("iframe").length&&jQuery(e.target.a).attr("id")!==jQuery(this).find("iframe").attr("id")&&YT.get("sby_player_"+i).pauseVideo()})}}})),s.find(".sby_video_thumbnail").mouseenter(function(){t.onThumbnailEnter(e(this),!1)}),s.find(".sby_player_wrap").mouseleave(function(){t.onThumbnailLeave(e(this),!1)}),s.find(".sby_video_thumbnail").click(function(i){i.preventDefault(),t.onThumbnailClick(e(this),!1)}),t.settings.lightboxEnabled&&(s.find(".sby_video_thumbnail").attr("data-sby-lightbox",t.index),"undefined"!=typeof sbyOptions&&void 0!==sbyOptions.lightboxPlaceholder&&(t.settings.narrowPlayer?s.find(".sby_video_thumbnail").attr("href",sbyOptions.lightboxPlaceholderNarrow):s.find(".sby_video_thumbnail").attr("href",sbyOptions.lightboxPlaceholder))),t.afterItemRevealed(s),""===s.find(".sby_info_item").text().trim()&&s.find(".sby_info_item").addClass("sby_no_space")}),i.find(".sby_player_item").each(function(e){var i=jQuery(this);t.afterItemRevealed(i)}),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)},afterItemRevealed:function(){},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;n({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||i.settings.singleCheckPosts){var t=void 0!==i.settings.feedID?i.settings.feedID:"sby_single",s=i.mostRecentlyLoadedPosts;i.mostRecentlyLoadedPosts=[];n({action:"sby_check_wp_submit",feed_id:t,atts:i.settings.shortCodeAtts,offset:e(this.el).hasClass("sby_layout_carousel")?Math.floor(e(this.el).find(".sby_item").length/2-1):e(this.el).find(".sby_item").length,posts:s,cache_all:i.settings.cacheAll},function(e){if(0===e.trim().indexOf("{")){var t=JSON.parse(e);i.settings.debugEnabled&&console.log(t),i.afterSendCheckWPPostsToServer(t)}})}},afterSendCheckWPPostsToServer:function(e){},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;n({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),n=void 0!==a.feedStatus.checkWPPosts&&a.feedStatus.checkWPPosts;t.settings.debugEnabled&&console.log(a),t.settings.checkWPPosts=!!n,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===a.placeholderURL||s){if(a.settings.debugEnabled){var h=o===a.placeholderURL?"was placeholder":"too small";console.log("rais res for "+o,h)}var y=n[r];i.find(".sby_video_thumbnail > img").attr("src",y),i.find(".sby_video_thumbnail").hasClass("sby_imgLiquid_ready")&&i.find(".sby_video_thumbnail").css("background-image",'url("'+y+'")')}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;i.hasClass(".sby_layout_carousel")||(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>140&&n<240?i.addClass("sby_medium"):n<=140&&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(i){if(i.hasClass("sby_item")||i.hasClass("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(i.closest("sby_item").length||i.closest("sby_player_item").length){var t=i.closest("sby_item").length?i.closest("sby_item"):i.closest("sby_player_item");if(void 0!==t.find(".sby_video_thumbnail").attr("data-video-id"))return t.find(".sby_video_thumbnail").attr("data-video-id")}else{if(i.hasClass("sb_youtube"))return i.find(".sby_item").first().find(".sby_video_thumbnail").attr("data-video-id");if(e(this.el).find(".sby_video_thumbnail").first().length&&void 0!==e(this.el).find(".sby_video_thumbnail").first().attr("data-video-id"))return e(this.el).find(".sby_video_thumbnail").first().attr("data-video-id")}return""},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)},applyImageLiquid:function(){var t=e(this.el);i(),"function"==typeof t.find(".sby_player_item").sby_imgLiquid&&(t.find(".sby_player_item").length&&t.find(".sby_player_item .sby_player_video_thumbnail").sby_imgLiquid({fill:!0}),t.find(".sby_item .sby_item_video_thumbnail").sby_imgLiquid({fill:!0}))},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,s){if(this.canCreatePlayer()){var a=e(this.el);if(a.hasClass("sby_layout_gallery"))if(a.addClass("sby_player_added").find(".sby_player_outer_wrap").addClass("sby_player_loading"),a.find(".sby_player_outer_wrap .sby_video_thumbnail").find(".sby_loader").show().removeClass("sby_hidden"),a.find(".sby_player_outer_wrap iframe").length)if(t){s=void 0===s?this.getVideoID(a.find(".sby_item").first()):s;this.playVideoInPlayer(s)}else{s=void 0===s?this.getVideoID(i.closest(".sby_item")):s;this.changePlayerInfo(i.closest(".sby_item")),this.playVideoInPlayer(s),this.afterVideoChanged()}else if(t)this.createPlayer("sby_player"+this.index);else{var s=void 0===s?this.getVideoID(i.closest(".sby_item")):s;this.createPlayer("sby_player"+this.index,s)}else if(e(this.el).hasClass("sby_layout_grid")||e(this.el).hasClass("sby_layout_carousel")){var n=i.closest(".sby_item");s=void 0===s?this.getVideoID(n):s;this.playVideoInPlayer(s),this.afterVideoChanged()}else if(e(this.el).hasClass("sby_layout_list")){n=i.closest(".sby_item"),s=void 0===s?this.getVideoID(n):s;n.length&&!n.find("iframe").length?(n.find(".sby_loader").show().removeClass("sby_hidden"),n.addClass("sby_player_loading sby_player_loaded"),this.createPlayer("sby_player_"+s,s)):(this.playVideoInPlayer(s,n.attr("data-video-id")),this.afterVideoChanged())}}},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){},changePlayerInfo:function(e){},playerEagerLoaded:function(){if(void 0!==this.player||e(this.el).hasClass("sby_player_loaded"))return!0},canCreatePlayer:function(){return!e(this.el).find("#sby_blank").length&&(this.playerEagerLoaded()||this.playerAPIReady&&this.consentGiven||window.sbyAPIReady&&this.consentGiven)},playVideoInPlayer:function(e,i){void 0!==this.player&&void 0!==this.player.loadVideoById?this.player.loadVideoById(e):void 0!==window.sbyLightboxPlayer&&void 0!==window.sbyLightboxPlayer.loadVideoById?window.sbyLightboxPlayer.loadVideoById(e):void 0!==i&&void 0!==this.players&&void 0!==this.players[i]&&void 0!==this.players[i].loadVideoById&&this.players[i].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))},maybeAddCTA:function(e,i){}},a.prototype={getData:function(e){return{feedIndex:parseInt(e.closest(".sb_youtube").attr("data-sby-index")-1),link:e.attr("href"),videoTitle:void 0!==e.attr("data-video-title")?e.attr("data-video-title"):"YouTube Video",video:e.attr("data-video-id")}},template:function(){return"<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 sby_lb-player-placeholder' id='sby_lb-player'></div><div class='sby_lb-nav'><a class='sby_lb-prev' href='#' ><p class='sby-screenreader'>Previous Slide</p><span></span></a><a class='sby_lb-next' href='#' ><p class='sby-screenreader'>Next Slide</p><span></span></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></div><div class='sby_lb-closeContainer'><a class='sby_lb-close'></a></div></div></div></div>"},beforePlayerSetup:function(e,i,t,s,a){},afterPlayerSetup:function(e,i,t,s){},afterResize:function(){var i=e("#sby_lightbox .sby_lb-player").height();if(i>100){var t=e("#sby_lightbox .sby_lb-outerContainer").height()-i;t>10&&e("#sby_lightbox .sby_lb-player").css("top",t/2)}},pausePlayer:function(){void 0!==YT.get("sby_lb-player")&&"function"==typeof YT.get("sby_lb-player").pauseVideo?YT.get("sby_lb-player").pauseVideo():void 0!==window.sbyLightboxPlayer&&"function"==typeof window.sbyLightboxPlayer.pauseVideo&&window.sbyLightboxPlayer.pauseVideo()}},window.sby_init=function(){window.sby=new t,window.sby.createPage(window.sby.createFeeds,{whenFeedsCreated:window.sby.afterFeedsCreated})}}(jQuery),void 0===window.sbyEagerLoading&&(window.sbyEagerLoading=void 0!==window.sbyOptions&&window.sbyOptions.eagerload,jQuery("div[data-vc-video-bg]").length&&(window.sbyEagerLoading=!0)),void 0===window.sbySemiEagerLoading&&(window.sbySemiEagerLoading=void 0!==window.sbyOptions&&window.sbyOptions.semiEagerload,(jQuery("div[data-vc-video-bg]").length||window.sbyEagerLoading)&&(window.sbySemiEagerLoading=!1)),jQuery(document).ready(function(e){window.sbySemiEagerLoading||sby_init()})}if(window.sbySemiEagerLoading){var sbyYScriptId="sby-youtube-api",sbyYScript=document.getElementById(sbyYScriptId);if(null===sbyYScript){var tag=document.createElement("script"),firstScript=document.getElementsByTagName("script")[0];tag.src="https://www.youtube.com/iframe_api",tag.id=sbyYScriptId,firstScript.parentNode.insertBefore(tag,firstScript)}}window.onYouTubeIframeAPIReady=function(){var e=document.getElementsByClassName("sb_youtube").length;if(e>0){if(window.sbySemiEagerLoading){if(void 0!==window.sby)for(var i=0;i<e;i++)window.sby.feeds[i].playerAPIReady=!0;else window.sbyAPIReady=!0;sby_init()}else if(jQuery(".sb_youtube").each(function(e){var i=jQuery(this);i.find(".sby_live_player").length&&(player=new YT.Player(i.find(".sby_live_player").attr("id"),{events:{onReady:function(){i.find(".sby_live_player").hide(),i.find(".sby_item").remove();var t=YT.get(i.find(".sby_live_player").attr("id")).getVideoData().video_id;i.find(".sby_player_video_thumbnail").attr("data-video-id",t).css("z-index",-1);i.find(".sby_item").length;var s={action:"sby_live_retrieve",video_id:t,feed_id:i.attr("data-feedid"),atts:i.attr("data-shortcode-atts")};jQuery.ajax({url:sbyOptions.adminAjaxUrl,type:"post",data:s,success:function(t){if(0===t.trim().indexOf("{")){var s=window.sby.feeds[e],a=JSON.parse(t),n=void 0!==a.feedStatus.checkWPPosts&&a.feedStatus.checkWPPosts;s.settings.debugEnabled&&console.log(a),s.settings.checkWPPosts=!!n,s.appendNewPosts(a.html),s.addResizedImages(a.resizedImages),s.afterInitialImagesLoaded(),a.feedStatus.shouldPaginate?s.outOfPages=!1:(s.outOfPages=!0,i.find(".sby_load_btn").hide()),jQuery(".sby_no_js").removeClass("sby_no_js"),i.find(".sby_live_player").remove(),i.hasClass("sby_layout_gallery")&&s.createPlayer("sby_player"+s.index),i.find(".sby_player_item").css("opacity",1),i.find(".sby_item").css("opacity",1),i.find(".sby_player_loading").removeClass("sby_player_loading"),i.hasClass("sby_layout_list")&&i.find(".sby_item_video_thumbnail").mouseenter(function(){jQuery(this).css("z-index",-1)})}}})}}}))}),window.sbyEagerLoading){var t=!1,s=!1;jQuery(".sb_youtube").each(function(e){var i=jQuery(this);i.hasClass("sby_layout_list")?(jQuery(this).addClass("sby_player_loaded"),i.find(".sby_item").each(function(){videoID=jQuery(this).attr("data-video-id"),player=new YT.Player("sby_player_"+videoID,{height:"100",width:"100",videoId:videoID,playerVars:{modestbranding:1,rel:0,autoplay:s},events:{onStateChange:function(e){e.target.getVideoData().video_id;1===e.data&&i.find(".sby_item").each(function(){var e=jQuery(this).attr("data-video-id");jQuery(this).find("iframe").length&&e!==jQuery(this).find("iframe").attr("id").replace("sby_player_","")&&YT.get("sby_player_"+e).pauseVideo()})}}})})):i.hasClass("sby_layout_gallery")?(jQuery(this).addClass("sby_player_loaded"),player=new YT.Player("sby_player"+e,{height:"100",width:"100",videoId:jQuery(this).find(".sby_item").first().attr("data-video-id"),playerVars:{modestbranding:1,rel:0,autoplay:s},events:{onStateChange:function(e){e.target.getVideoData().video_id;1===e.data&&i.find(".sby_item").each(function(){var i=jQuery(this).attr("data-video-id");jQuery(this).find("iframe").length&&jQuery(e.target.a).attr("id")!==jQuery(this).find("iframe").attr("id")&&YT.get("sby_player_"+i).pauseVideo()})}}})):t=!0})}else if(void 0!==window.sby)for(i=0;i<e;i++)window.sby.feeds[i].playerAPIReady=!0;else window.sbyAPIReady=!0;t&&(jQuery("#sby_lb-player").length||jQuery(".sb_youtube").first().append('<div class="sby_lb-player-loaded sby_lb-player" id="sby_lb-player" style="display: none;"></div>'),player=new YT.Player("sby_lb-player",{height:"100",width:"100",videoId:jQuery(this).find(".sby_item").first().attr("data-video-id"),playerVars:{modestbranding:1,rel:0,autoplay:s}}),window.sbyLightboxPlayer=player)}};
templates/item.php CHANGED
@@ -3,7 +3,7 @@
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
 
@@ -29,7 +29,7 @@ $additional_atts_string = SBY_Display_Elements::escaped_data_att_string( $additi
29
  ?>
30
  <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; ?><?php echo $additional_atts_string; ?>>
31
  <div class="sby_video_thumbnail_wrap">
32
- <a class="sby_video_thumbnail sby_item_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 ); ?>">
33
  <img src="<?php echo esc_url( $media_url ); ?>" alt="<?php echo esc_attr( $img_alt ); ?>">
34
 
35
  <div class="sby_thumbnail_hover">
3
  * Item Template
4
  * Adds an image, link, and other data for each post in the feed
5
  *
6
+ * @version 1.2 by Smash Balloon
7
  *
8
  */
9
 
29
  ?>
30
  <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; ?><?php echo $additional_atts_string; ?>>
31
  <div class="sby_video_thumbnail_wrap">
32
+ <a class="sby_video_thumbnail sby_item_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 ); ?>" data-video-title="<?php echo sby_esc_attr_with_br( $title ); ?>">
33
  <img src="<?php echo esc_url( $media_url ); ?>" alt="<?php echo esc_attr( $img_alt ); ?>">
34
 
35
  <div class="sby_thumbnail_hover">
trunk/README.txt ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Feeds for YouTube (YouTube video, channel, and gallery plugin) ===
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.4
8
+ Stable tag: 1.2.3
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 customizable YouTube feeds from any YouTube channel.
13
+
14
+ == Description ==
15
+ **Display customizable YouTube channel feeds on your website. Feed YouTube channel content automatically to your website in a powerful and customizable gallery.**
16
+
17
+ ### YouTube Feed Features
18
+ * **Completely Customizable** YouTube feeds - by default inherits your theme's styles
19
+ * **Completely responsive and mobile optimized** - your feeds look great on any screen size
20
+ * **Light and low overhead** - minimal bloat and optimized requests to YouTube
21
+ * **Multiple layouts** - display videos from any YouTube channel in a list, gallery, or grid layout
22
+ * **Multiple feeds** from different YouTube channels on multiple pages or widgets
23
+ * **Lightning fast** - post caching and minimized YouTube API requests means that your feed loads lightning fast
24
+ * **Infinitely load more** of your videos with the 'Load More' button
25
+ * Built-in easy to use YouTube Feed Widget
26
+ * Fully internationalized and translatable into any language
27
+ * Includes a header at the top of your feed
28
+ * Enter your own custom CSS or JavaScript for even deeper customization
29
+
30
+ 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').
31
+
32
+ ### Benefits
33
+ * **Increase social engagement** between you and your subscribers
34
+ * **Save time** by using the plugin to generate dynamic, search engine crawlable content on your website
35
+ * **Get more subscribers** by displaying your videos directly on your site
36
+ * Display your channel content **your way** to perfectly match your website's style
37
+ * The plugin is **updated regularly** with new features, bug-fixes and API changes
38
+ * Support is quick, effective, and always happy to help
39
+ * We're dedicated to providing the **most customizable**, **robust** and **well supported** YouTube gallery plugin in the world!
40
+
41
+ ### Feedback or Support
42
+ 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 plugin then 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").
43
+
44
+ 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.
45
+
46
+ ### Pro Version
47
+ 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 content in even more powerful ways:
48
+
49
+ * Display YouTube videos from your **favorites list**
50
+ * Integrate the **YouTube Live API** to show live streaming videos on your site.
51
+ * Display a YouTube gallery in a carousel slider
52
+ * Allow **filtering** of videos using keywords in the description or title
53
+ * Fully functional **search endpoint** for display videos from a search result
54
+ * **Combine multiple feeds** into one
55
+ * Customizable **actions when video completes** like displaying a link to a product page for example, or displaying thumbnails of your other videos.
56
+ * Download video data into a **custom post type** to allow visitors to browse and view videos on your website.
57
+
58
+ ### How to use the "Feeds for YouTube" plugin
59
+
60
+ 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:
61
+
62
+ * 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.
63
+ * 2) Once you've connected your account, save the plugin settings.
64
+ * 3) Then simply copy and paste the `[youtube-feed]` shortcode onto any page, post, or widget where you want your feed to be displayed.
65
+
66
+ That's it! You can then customize the feed as needed using the settings on the plugin "Customize" page.
67
+
68
+ For full step-by-step setup directions with screenshots, see [here](https://smashballoon.com/youtube-feed/free/ "YouTube Feed Free Setup Doc").
69
+
70
+ ### Who's behind this plugin?
71
+
72
+ We're Smash Balloon; a fun-loving WordPress plugin development company birthed into existence in early 2013. We specialize in creating social media plugins (for Facebook, Instagram, Twitter, and YouTube) 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.
73
+
74
+ To find out more about the team, see [here](https://smashballoon.com/about/ "Team Smash Balloon").
75
+
76
+ == Installation ==
77
+ 1. Install the plugin either via the WordPress plugin directory, or by uploading the files to your web server (in the /wp-content/plugins/ directory).
78
+ 2. Activate the plugin through the 'Plugins' menu in WordPress.
79
+ 3. Navigate to the 'Feeds for YouTube' settings page to configure your YouTube gallery.
80
+ 4. Use the shortcode [youtube-feed] in your page, post or widget to display your YouTube feed.
81
+ 5. You can display multiple channels with different configurations by specifying the necessary parameters directly in the shortcode: [youtube-feed channel=smashballoon].
82
+
83
+ For simple step-by-step directions on how to set up the plugin please refer to our [setup guide](http://smashballoon.com/youtube-feed/free/?utm_source=wordpress&utm_campaign=sby 'Feeds for YouTube setup guide').
84
+
85
+ = Setting up the plugin =
86
+
87
+ 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.
88
+
89
+ 1) Once you've installed the "Feeds for YouTube" plugin click on the "Feeds for YouTube" item in your WordPress menu
90
+
91
+ 2) Click on the large blue YouTube login button to get your Access Token and Refresh Token. Note; if you have your own Developer Project set up then you can enter your API key by enabling the checkbox below the YouTube login button.
92
+
93
+ 3) Authorize the plugin to read data about your videos and channel.
94
+
95
+ 4) YouTube sends back your Access Token and Refresh Token which are then automatically saved by the plugin. This information is required in order to connect to the API.
96
+
97
+ 5) Enter a channel name to display videos from.
98
+
99
+ 6) Navigate to the Customize and Style pages to customize your feed.
100
+
101
+ 7) Once you've customized your feed, click on the "Display Your Feed" tab for directions on how to display your YouTube feed (or multiple feeds).
102
+
103
+ 8) Copy the [youtube-feed] shortcode and paste it into any page, post or widget where you want the YouTube feed to appear.
104
+
105
+ 9) You can paste the [youtube-feed] shortcode directly into your page editor.
106
+
107
+ 10) You can use the default WordPress 'Text' widget to display your feed in a sidebar or other widget area.
108
+
109
+ 11) View your website to see your feed(s) in all their glory!
110
+
111
+ == Frequently Asked Questions ==
112
+
113
+ = Can I display multiple YouTube feeds on my site or on the same page? =
114
+
115
+ Yep. You can display multiple feeds by using our built-in shortcode options, for example: `[youtube-feed channel="smashballoon" num=3]`.
116
+
117
+ = How do I embed a YouTube gallery directly into a WordPress page template? =
118
+
119
+ You can embed a 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]'); ?>`.
120
+
121
+ = Will the plugin work with W3 Total Cache or other caching plugins? =
122
+
123
+ 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 feed to update successfully and display your latest posts. If you are experiencing problems with your 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 feed displays and updates successfully.
124
+
125
+ = Can I change whether the video autoplays or plays on click =
126
+
127
+ Yep, just use the following setting: Feeds for YouTube > Customize > Video Experience > When does video play? You can then set the video to play when clicked or to autoplay.
128
+
129
+ = How can I change the layout of my feed? =
130
+
131
+ This free plugin has several layout options built into it. Use the settings in the following location to display your videos in a list, grid, or gallery layout: Feeds for YouTube > Customize > Layout. You can also change the spacing/padding between the videos by using the "Spacing between videos" setting in this same section.
132
+
133
+ = Can I select how many YouTube videos should be displayed in the feed? =
134
+
135
+ Yep, you can choose to display between 1-50 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 videos into your feed.
136
+
137
+ = Will my YouTube gallery be responsive to accommodate mobile visitors? =
138
+
139
+ Yes. All feed layouts are completely mobile responsive. Using the plugin's gallery layout will automatically scroll visitors to the video player to view the video when the video thumbnail is clicked.
140
+
141
+ = Will videos from my YouTube channel be cached? =
142
+
143
+ Yes. The plugin will cache all of the posts collected from the API. Your YouTube videos and information about your channel can then be retrieved and used for future page loads.
144
+
145
+ = How do I find the nickname of channel ID for different channels? =
146
+
147
+ You can display videos from any channel using the unique YouTube channel ID. This can be found by viewing the channel page on YouTube and looking at the end of the URL. ex: https://www.youtube.com/channel/UC1a2b3c4D5F6g7i8j9k. You can also use the channel nickname.
148
+
149
+ = Will displaying my YouTube channel affect the time it takes to load the page? =
150
+
151
+ The plugin has a few features to minimize the impact it has on page load time. For example, iframes for playing YouTube videos are not loaded until the feed is interacted with by a visitor. Thumbnails of your videos are the smallest resolution necessary relative to the size of the feed. Also, these video thumbnails are not loaded until the rest of the content on the page is loaded.
152
+
153
+ = How often do new videos from my channel appear in the feed? =
154
+
155
+ By default, the plugin retrieves new videos for your YouTube gallery once every hour. You can reduce this to as little as 15 minutes if needed. You can even set your feed to update using WordPress cron in the background so the caching process is not relying on the page with your feed being visited.
156
+
157
+ == Screenshots ==
158
+
159
+ 1. By default the plugin inherits styles from your theme
160
+ 2. Display multiple feeds and customize each one
161
+ 3. When using the "grid" layout, videos open and play in a lightbox
162
+ 4. Feeds for YouTube Settings pages
163
+ 5. Built in customization settings make customizing your feed easy
164
+ 6. Use handy shortcode options to customize individual feeds
165
+ 7. To display a YouTube feed just copy and paste the [youtube-feed] shortcode into a widget or page
166
+
167
+ == Changelog ==
168
+ = 1.2.3 =
169
+ * New: Added setting to use WordPress cron to clear feed caches on an interval. If your feeds are not updating automatically, try enabling the setting found on the "Customize" tab "Cron Clear Cache".
170
+ * Tweak: Added notice explaining the account connection and what it can and can't be used for when connecting an account.
171
+ * Tweak: Removed refresh token from being required for a manual connection.
172
+ * Fix: Improved performance of API requests for creating feeds.
173
+
174
+ = 1.2.2 =
175
+ * Tweak: More details are provided for API errors such as an API key not working after being created.
176
+ * Tweak: If an API key has not been entered, an account reconnection is required if trying to display videos from a previously unused channel and more than an hour has passed since the last account connection.
177
+ * Tweak: Play icon changed to YouTube logo to comply with their terms of service.
178
+ * Fix: Prevented a Fatal PHP error caused by retrieving YouTube videos without using an API key and either entering a non-existing YouTube channel ID or having allow_url_fopen disabled on the server.
179
+ * Fix: Non-latin characters were displaying incorrectly in titles and descriptions when a feed was using backup data.
180
+ * Fix: Thumbnails were not resizing properly when the browser was resized.
181
+
182
+ = 1.2.1 =
183
+ * Tweak: Video thumbnails are cropped to a 9:16 aspect ratio to remove black bars at the top and bottom of the images.
184
+ * Tweak: Improved workarounds for video player issues caused by having iframes from other sources on the same page.
185
+
186
+ = 1.2 =
187
+ * New: Display video players in 9:16 ratio. To use 3:4 ratio go to: Feeds for YouTube > Customize > Video Experience.
188
+ * New: Added a "Feeds for YouTube" Gutenberg block to use in the block editor, allowing you to easily add a feed to posts and pages.
189
+ * Tweak: Hide admin notices from other plugins when using the Feeds for YouTube settings pages.
190
+ * Fix: Video player would sometimes not work when the iframe JS API was available earlier than the feeds were created.
191
+
192
+ = 1.1.1 =
193
+ * Tested with upcoming WordPress 5.4 update.
194
+ * New: Added setting for using custom templates for feed HTML.
195
+ * Tweak: Added CSS to help feeds work better with certain themes.
196
+ * Tweak: Used a higher resolution image file if optimum resolution was not available from the API.
197
+ * Fix: "include=" shortcode setting would cause play icon to never show.
198
+ * Fix: Fast response from player API would cause the players to load along with the page when not necessary.
199
+ * Fix: Background caching was not updating YouTube feed caches.
200
+
201
+ = 1.1 =
202
+ * New: Several improvements to the lightbox for grid feeds were made including a video index indicator, navigation arrows moved to the outside of the video, and a close button.
203
+ * New: Added YouTube play button icon that displays on top of video thumbnails. Disable this on the "Customize" tab.
204
+ * New: Added workaround for occasional issue caused by multiple elements of the page using the YouTube Player API.
205
+ * Tweak: Fixed typo in HTML element with the class "sby_thumbail_hover". Now "sby_thumbnail_hover".
206
+ * Tweak: Updated admin PHP code.
207
+ * Tweak: Updated JavaScript code.
208
+ * Tweak: Updated language files and several strings to use text domain "feeds-for-youtube" instead of "youtube-feed".
209
+
210
+ = 1.0.3 =
211
+ * Tweak: Changed tooltip and notes regarding how to display a feed from a certain channel.
212
+ * Fix: YouTube iframe JavaScript file was being loaded with HTTP. Changed to HTTPS.
213
+ * Fix: Prevented error if allow_url_fopen set to false in php.ini by changing how YouTube RSS feeds are retrieved from YouTube.
214
+ * Fix: Unable to view YouTube account details if more than one account connected.
215
+
216
+ = 1.0.2 =
217
+ * New: Changed the method used to update feeds to reduce API requests.
218
+ * Tweak: More posts cached in the wp_posts table when an API request is made.
219
+ * Tweak: YouTube channel data cached to reduce API requests.
220
+ * Fix: Error when deactivating and reactivating the plugin with background caching enabled.
221
+
222
+ = 1.0.1 =
223
+ * Fix: Optimized API calls to YouTube to reduce requests.
224
+ * Fix: Minor bug fixes.
225
+
226
+ = 1.0 =
227
+ * Launched the Feeds for YouTube plugin!
trunk/css/admin.css ADDED
@@ -0,0 +1,1083 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ #sbspf_admin .sbspf_fade {
24
+ opacity: .6;
25
+ }
26
+ #sbspf_admin .sbspf_aside {
27
+ font-style: italic;
28
+ font-weight: normal;
29
+ font-size: 12px;
30
+ margin: .3em 0;
31
+ }
32
+ #sbspf_admin .sbspf_red {
33
+ color: #eb381c;
34
+ }
35
+ #sbspf_admin #sbspf_get_token:hover{
36
+ background-color: #3880c4;
37
+ color: #fff;
38
+
39
+ -moz-transition: all 0.1s ease-in-out;
40
+ -webkit-transition: all 0.1s ease-in-out;
41
+ -o-transition: all 0.1s ease-in-out;
42
+ transition: all 0.1s ease-in-out;
43
+ }
44
+ /* Tooltips */
45
+ #sbspf_admin .sbspf_tooltip {
46
+ display: none;
47
+ }
48
+ #sbspf_admin .sbspf_tooltip_link {
49
+ font-size: 13px;
50
+ margin-left: 10px;
51
+ }
52
+ #sbspf_admin .sbspf_tooltip_link svg,
53
+ #sbspf_admin .sbspf_layouts svg,
54
+ .sbspf_small_svg {
55
+ width: 13px;
56
+ }
57
+ #sbspf_admin .sbspf_more_info{
58
+ clear: both;
59
+ padding: 10px 15px;
60
+ margin: 10px 0;
61
+ font-size: 13px;
62
+ background: #f9f9f9;
63
+ background: rgba(255,255,255,0.8);
64
+ -moz-border-radius: 8px;
65
+ -webkit-border-radius: 8px;
66
+ border-radius: 8px;
67
+ }
68
+ #sbspf_admin .postbox .sbspf_more_info{
69
+ background: #eee;
70
+ background: rgba(0,0,0,0.05);
71
+ }
72
+ #sbspf_admin .sbspf_more_info p{
73
+ font-size: 13px;
74
+ }
75
+ #sbspf_admin .sbspf_tooltip_link {
76
+ vertical-align: top;
77
+ }
78
+ #sbspf_admin .sbspf_tooltip_link svg {
79
+ vertical-align: bottom;
80
+ }
81
+ #sbspf_admin .sbspf-highlight{
82
+ background: #ffed51;
83
+ font-weight: bold;
84
+ color: black;
85
+ }
86
+
87
+ /* Quick Start */
88
+ #sbspf_admin .sbspf-quick-start{
89
+ display: block;
90
+ float: left;
91
+ clear: both;
92
+ width: 808px;
93
+ max-width: 100%;
94
+ margin: 15px 0 0 0;
95
+ padding: 15px 20px;
96
+
97
+ border: 1px solid #ccc;
98
+ background: #eee;
99
+ background: rgba(255,255,255,0.5);
100
+
101
+ -moz-border-radius: 5px;
102
+ -webkit-border-radius: 5px;
103
+ border-radius: 5px;
104
+ }
105
+ #sbspf_admin .sbspf-quick-start h3,
106
+ #sbspf_admin .sbspf-quick-start p{
107
+ margin: 0;
108
+ padding: 5px 0;
109
+ }
110
+ #sbspf_admin .sbspf-success{
111
+ font-size: 14px;
112
+ }
113
+ #sbspf_admin .sbspf-footnote{
114
+ width: 100%;
115
+ float: left;
116
+ clear: both;
117
+ padding: 20px 0 0 0;
118
+ border-top: 1px solid #ccc;
119
+ margin: 20px 0 0 0;
120
+ }
121
+ #sbspf_have_own_tokens {
122
+ margin: 1px 6px 0 0;
123
+ }
124
+ #sbspf_width_options {
125
+ margin-top: 8px;
126
+ }
127
+ /* Pro Notice */
128
+ #sbspf_admin .sbspf-pro-notice,
129
+ #sbspf_admin .sbspf-pro-notice img{
130
+ display: block;
131
+ float: left;
132
+ clear: both;
133
+ margin: 20px 0 0 0;
134
+ overflow: hidden;
135
+ max-width: 100%;
136
+
137
+ -moz-border-radius: 4px;
138
+ -webkit-border-radius: 4px;
139
+ border-radius: 4px;
140
+
141
+ -moz-transition: all 0.5s ease-in-out;
142
+ -webkit-transition: all 0.5s ease-in-out;
143
+ -o-transition: all 0.5s ease-in-out;
144
+ transition: all 0.5s ease-in-out;
145
+ }
146
+ #sbspf_admin .sbspf-pro-notice img{
147
+ margin: 0;
148
+ }
149
+ #sbspf_admin .sbspf-pro-notice:hover{
150
+ opacity: 0.95;
151
+
152
+ -moz-transition: all 0.1s ease-in-out;
153
+ -webkit-transition: all 0.1s ease-in-out;
154
+ -o-transition: all 0.1s ease-in-out;
155
+ transition: all 0.1s ease-in-out;
156
+ }
157
+
158
+ /* General Formatting */
159
+ #sbspf_admin .sbspf_note {
160
+ font-size: 12px;
161
+ font-style: italic;
162
+ margin-left: 5px;
163
+ }
164
+ #sbspf_admin .sbspf_shortcode {
165
+ position: absolute;
166
+ z-index: 10;
167
+ font-size: 11px;
168
+ float: left;
169
+ width: auto;
170
+ white-space: pre-line;
171
+ line-height: 1.4;
172
+ max-width: 195px;
173
+ }
174
+ .sbspf_size_4 {
175
+ max-width: 60px;
176
+ }
177
+ #sbspf_admin td textarea {
178
+ width: 100%;
179
+ max-width: 700px;
180
+ }
181
+
182
+ /* Lock floating on top */
183
+ .sbspf_lock {
184
+ position: absolute;
185
+ top: 50%;
186
+ right: 50%;
187
+ height: 18px;
188
+ padding: 4px 10px;
189
+ background: rgba(255,255,255,1);
190
+ border-radius: 5px;
191
+ box-shadow: 0 0 5px 0 rgba(0,0,0,0.1);
192
+ color: #333;
193
+ z-index: 99;
194
+ font-size: 14px;
195
+ font-weight: 700;
196
+ text-decoration: none;
197
+ border: 1px solid #333;
198
+ }
199
+
200
+ .sbspf_lock svg {
201
+ height: 11px;
202
+ margin-right: 4px;
203
+ }
204
+
205
+ /* Types */
206
+ #sbspf_admin .sbspf_row{
207
+ width: 100%;
208
+ float: left;
209
+ clear: both;
210
+ margin-bottom: 5px;
211
+ }
212
+ #sbspf_admin .sbspf_col{
213
+ float: left;
214
+ }
215
+ #sbspf_admin .sbspf_col.sbspf_one{
216
+ width: 138px;
217
+ }
218
+ #sbspf_admin .sbspf_col.sbspf_two{
219
+ width: 73%;
220
+ }
221
+ #sbspf_admin .sbspf_row input[type=radio]{
222
+ margin: 5px 2px 0 0;
223
+ }
224
+ #sbspf_admin .sbspf_radio_label {
225
+ padding-top: 4px;
226
+ display: -moz-inline-stack;
227
+ display: inline-block;
228
+ vertical-align: top;
229
+ zoom: 1;
230
+ *display: inline;
231
+ }
232
+
233
+ /* Log In Get Access Token Button */
234
+ #sbspf_admin #sbspf_get_token{
235
+ display: block;
236
+ float: left;
237
+ clear: both;
238
+ padding: 0 21px;
239
+ height: 47px;
240
+ line-height: 47px;
241
+ font-size: 14px;
242
+
243
+ background: #386793;
244
+
245
+ color: #e9eef3;
246
+ text-decoration: none;
247
+
248
+ -moz-border-radius: 5px;
249
+ -webkit-border-radius: 5px;
250
+ border-radius: 5px;
251
+
252
+ -moz-transition: all 0.5s ease-in-out;
253
+ -webkit-transition: all 0.5s ease-in-out;
254
+ -o-transition: all 0.5s ease-in-out;
255
+ transition: all 0.5s ease-in-out;
256
+ }
257
+
258
+ /* Connected Accounts */
259
+ #sbspf_get_token svg {
260
+ width: 29px;
261
+ margin-right: 10px;
262
+ position: relative;
263
+ top: 7px;
264
+ }
265
+ #sbspf_admin .sbspf_connected_account {
266
+ position: relative;
267
+ box-sizing: border-box;
268
+ padding: 10px 35px 10px 10px;
269
+ border-radius: 5px;
270
+ background: #fff;
271
+ margin-bottom: 5px;
272
+ overflow: hidden;
273
+ clear: both;
274
+ border: 1px solid #ddd;
275
+ max-width: 700px;
276
+ }
277
+ #sbspf_admin .sbspf_connected_account .sbspf_ca_accesstoken input {
278
+ min-height: auto;
279
+ line-height: 1;
280
+ }
281
+ #sbspf_admin .sbspf_ca_user_id{
282
+ width: 275px;
283
+ }
284
+ #sbspf_admin .sbspf_ca_refresh_token {
285
+ width: 510px;
286
+ }
287
+ #sbspf_admin .sbspf_connected_account svg {
288
+ vertical-align: bottom;
289
+ }
290
+ #sbspf_admin .sbspf_ca_username {
291
+ line-height: 1.4;
292
+ margin-left: 15px;
293
+ float: left;
294
+ font-size: 18px;
295
+ }
296
+ #sbspf_admin .sbspf_connected_account .sbspf_ca_avatar{
297
+ margin-right: 15px;
298
+ }
299
+ #sbspf_admin .sbspf_connected_account .sbspf_ca_username {
300
+ margin-left: 0;
301
+ margin-right: 15px;
302
+ }
303
+ #sbspf_admin .sbspf_connected_account .sbspf_ca_username strong{
304
+ float: left;
305
+ }
306
+ #sbspf_admin .sbspf_connected_account .sbspf_ca_username span{
307
+ font-size: 10px;
308
+ font-weight: normal;
309
+ padding: 0;
310
+ margin: 0;
311
+ display: block;
312
+ }
313
+
314
+ #sbspf_admin .sbspf_ca_actions {
315
+ display: inline-block;
316
+ }
317
+ #sbspf_admin .sbspf_ca_actions .fa,
318
+ #sbspf_admin .sbspf_ca_actions svg{
319
+ margin-right: 5px;
320
+ }
321
+ #sbspf_admin .sbspf_ca_actions a.button-primary,
322
+ #sbspf_admin .sbspf_ca_actions a.button-secondary,
323
+ #sbspf_admin .sbspf_ca_accesstoken a.sbspf_ca_token_shortcode {
324
+ font-size: 12px;
325
+ padding: 6px;
326
+ height: auto;
327
+ line-height: 1;
328
+ margin: 7px 5px 0 0;
329
+ vertical-align: top;
330
+ }
331
+ #sbspf_admin .sbspf_ca_at_is_valid {
332
+ margin-top: 10px;
333
+ display: none;
334
+ }
335
+
336
+ @-webkit-keyframes sbspf_flash {
337
+ 0% {
338
+ background-color: #cae2a5;
339
+ opacity:1;
340
+ border: 1px solid #b2ce88;
341
+ }
342
+ 100% {
343
+ background-color: #fff;
344
+ }
345
+ }
346
+ #sbspf_admin .sbspf_account_updated{
347
+ border: 1px solid #ddd;
348
+ background: #fff;
349
+
350
+ -webkit-animation-name: sbspf_flash;
351
+ -webkit-animation-duration: 700ms;
352
+ -webkit-animation-iteration-count: 1;
353
+ -webkit-animation-timing-function: linear;
354
+ -moz-animation-name: sbspf_flash;
355
+ -moz-animation-duration: 700ms;
356
+ -moz-animation-iteration-count: 1;
357
+ -moz-animation-timing-function: linear;
358
+ }
359
+
360
+ #sbspf_admin .sbspf_account_active{
361
+ border: 1px solid #b2ce88;
362
+ background: #ecf2e3;
363
+ }
364
+
365
+ #sbspf_admin .sbspf_ca_alert {
366
+ display: none;
367
+ }
368
+ #sbspf_admin .sbspf_ca_alert {
369
+ padding: 5px 10px;
370
+ margin: 0px 0 12px 0;
371
+ border-radius: 5px;
372
+ font-size: 13px;
373
+ border: 1px solid;
374
+ }
375
+ #sbspf_admin .sbspf_ca_updated {
376
+ display: inline-block;
377
+ background: #d3dec1;
378
+ color: #2e4506;
379
+ border-color: #a9b594;
380
+ }
381
+ #sbspf_admin .sbspf_account_invalid .sbspf_ca_alert {
382
+ display: inline-block;
383
+ }
384
+ #sbspf_admin .sbspf_ca_avatar{
385
+ float: left;
386
+ width: 40px;
387
+ height: 40px;
388
+ border-radius: 5px;
389
+ }
390
+ #sbspf_admin .sbspf_ca_accesstoken{
391
+ display: none;
392
+ width: 100%;
393
+ float: left;
394
+ clear: both;
395
+ margin-top: 10px;
396
+ }
397
+ #sbspf_admin .sbspf_ca_token_label{
398
+ display: inline-block;
399
+ position: relative;
400
+ background: #f9f9f9;
401
+ color: #555;
402
+ padding: 3px 5px;
403
+ font-size: 12px;
404
+ border: 1px solid #d6d6d6;
405
+ height: 16px;
406
+ line-height: 15px;
407
+ border-radius: 4px 0 0 4px;
408
+ min-width: 80px;
409
+ margin-bottom: 2px;
410
+ }
411
+ #sbspf_admin .sbspf_permissions_desc,
412
+ #sbspf_admin .sbspf_ca_token,
413
+ #sbspf_admin .sbspf_ca_refresh_token,
414
+ #sbspf_admin .sbspf_ca_user_id {
415
+ padding: 3px 10px;
416
+ }
417
+
418
+ #sbspf_admin .sbspf_ca_token,
419
+ #sbspf_admin .sbspf_ca_user_id,
420
+ #sbspf_admin .sbspf_ca_refresh_token{
421
+ position: relative;
422
+ top: 1px;
423
+ border: 1px solid #d6d6d6;
424
+ border-left: none;
425
+ font-size: 13px;
426
+ border-radius: 0 4px 4px 0;
427
+ background: rgba(255,255,255,0.8);
428
+ display: inline-block;
429
+ margin-left: 0;
430
+ }
431
+ #sbspf_admin .sbspf_ca_token {
432
+ width: 510px;
433
+ }
434
+ #sbspf_admin .sbspf_ca_accesstoken a.sbspf_ca_token_shortcode{
435
+ margin: 0 8px 8px;
436
+ padding: 6px;
437
+ height: auto;
438
+ line-height: 1;
439
+ }
440
+
441
+ #sbspf_admin .sbspf_delete_account{
442
+ position: absolute;
443
+ right: 10px;
444
+ top: 10px;
445
+
446
+ padding: 5px 10px;
447
+ background: rgba(0,0,0,0.05);
448
+ color: #666;
449
+ border-radius: 50px;
450
+ text-decoration: none;
451
+ font-size: 12px;
452
+ }
453
+ #sbspf_admin .sbspf_delete_account:hover,
454
+ #sbspf_admin .sbspf_delete_account:focus{
455
+ background: #333;
456
+ color: #ddd;
457
+ }
458
+ #sbspf_admin .sbspf_ca_delete a {
459
+ display: block;
460
+ height: 13px;
461
+ padding: 5px 6px;
462
+ }
463
+ #sbspf_admin .sbspf_ca_delete svg {
464
+ height: 12px;
465
+ line-height: 1;
466
+ padding-bottom: 2px;
467
+ }
468
+ #sbspf_admin .sbspf_delete_account .sbspf_remove_text{
469
+ margin-left: 5px;
470
+ }
471
+
472
+ .sbspf_connected_accounts_wrap{
473
+ vertical-align: top;
474
+ }
475
+ #sbspf_admin .sbspf_no_accounts{
476
+ display: inline-block;
477
+ padding: 4px 15px;
478
+ border-radius: 8px;
479
+ background: rgba(255,255,255,0.8);
480
+ margin-bottom: 3px;
481
+ }
482
+ #sbspf_admin #sbspf_manual_submit:active{
483
+ vertical-align: unset;
484
+ }
485
+ #sbspf_admin .sbspf_manually_connect_wrap{
486
+ padding-top: 5px;
487
+ }
488
+ #sbspf_admin .sbspf_user_feed_account_wrap:first-child,
489
+ #sbspf_admin .sbspf_tagged_feed_account_wrap:first-child{
490
+ padding-top: 5px;
491
+ }
492
+ #sbspf_admin .sbspf_user_feed_account_wrap:last-child,
493
+ #sbspf_admin .sbspf_tagged_feed_account_wrap:last-child{
494
+ padding-bottom: 6px;
495
+ }
496
+ #sbspf_admin .sbspf_user_feed_account_wrap,
497
+ #sbspf_admin .sbspf_tagged_feed_account_wrap{
498
+ padding-bottom: 5px;
499
+ padding-left: 2px;
500
+ }
501
+ #sbspf_admin .sbspf_user_feed_account_wrap span,
502
+ #sbspf_admin .sbspf_tagged_feed_account_wrap span{
503
+ font-size: 13px;
504
+ }
505
+ #sbspf_admin .sbspf_manual_account_id_toggle label{
506
+ display: block;
507
+ margin: 10px 0 0 0;
508
+ font-size: 13px;
509
+ }
510
+ #sbspf_admin .sbspf_business_profile_tag{
511
+ display: none;
512
+ padding: 8px 10px;
513
+ background: rgba(0,0,0,0.05);
514
+ border-radius: 0 5px 5px 0;
515
+ margin: 0 0 0 -2px;
516
+ font-size: 13px;
517
+ height: 15px;
518
+ line-height: 15px;
519
+ box-shadow: inset 0 0 1px rgba(0,0,0,.5);
520
+ }
521
+ #sbspf_admin .sbspf_ca_info{
522
+ overflow: hidden;
523
+ }
524
+ #sbspf_admin .sbspf_ca_show_token .fa,
525
+ #sbspf_admin .sbspf_ca_show_token svg{
526
+ margin-right: 0;
527
+ }
528
+ #sbspf_admin .sbspf_ca_show_token{
529
+ display: inline-block;
530
+ padding: 10px 5px 0px 5px;
531
+ margin: 0;
532
+ font-size: 12px;
533
+ vertical-align: top;
534
+ }
535
+ #sbspf_admin .sbspf_ca_shortcode{
536
+ display: none;
537
+ padding: 0;
538
+ width: 100%;
539
+ float: left;
540
+ clear: both;
541
+ margin: 10px 0 0 0;
542
+ }
543
+ #sbspf_admin .sbspf_ca_shortcode p{
544
+ padding-bottom: 10px;
545
+ font-size: 13px;
546
+ }
547
+ #sbspf_admin .sbspf_ca_shortcode code{
548
+ margin-top: 5px;
549
+ display: inline-block;
550
+ }
551
+ #sbspf_admin .sbspf_user_feed_ids_wrap .sbspf_ca_avatar{
552
+ width: 20px;
553
+ height: 20px;
554
+ position: relative;
555
+ top: 5px;
556
+ margin-right: 8px;
557
+ border-radius: 4px;
558
+ }
559
+
560
+
561
+ @media all and (max-width: 1200px){
562
+ #sbspf_admin .sbspf_delete_account .sbspf_remove_text{
563
+ display: none;
564
+ }
565
+ #sbspf_admin .sbspf_ca_token,
566
+ #sbspf_admin .sbspf_ca_user_id{
567
+ border-left: 1px solid #d6d6d6;
568
+ border-radius: 4px;
569
+ }
570
+ }
571
+ @media all and (max-width: 800px){
572
+ #sbspf_admin .sbspf_col.sbspf_one {
573
+ width: 25%;
574
+ margin-right: 5%;
575
+ }
576
+ #sbspf_admin .sbspf_col.sbspf_two{
577
+ width: 70%;
578
+ }
579
+ }
580
+
581
+ /* Configure */
582
+ #sbspf_config {
583
+ float: left;
584
+ width: 100%;
585
+ clear: both;
586
+ margin: 10px 0 10px 0;
587
+ }
588
+ #sbspf_config .sbspf_not_working {
589
+ position: relative;
590
+ top: 14px;
591
+ left: 15px;
592
+ }
593
+ /* Caching settings */
594
+ #sbspf_admin #sbspf-caching-time-settings{
595
+ display: inline-block;
596
+ }
597
+ #sbspf_admin .sbspf-caching-cron-options .submit{
598
+ display: inline-block;
599
+ margin: 0;
600
+ padding: 0;
601
+ }
602
+ #sbspf_admin .sbspf-caching-sched-notice{
603
+ font-size: 11px;
604
+ display: block;
605
+ width: 100%;
606
+ }
607
+ #sbspf_admin .sbspf-caching-sched-notice span{
608
+ color: green;
609
+ background: #e5eae1;
610
+ padding: 5px 10px;
611
+ border-radius: 5px;
612
+ border: 1px solid #ccd3c6;
613
+ display: inline-block;
614
+ }
615
+ #sbspf_admin .sbspf_cron_cache_opts .sbspf_row{
616
+ padding: 3px 0;
617
+ }
618
+ #sbspf_admin .sbspf_cron_cache_opts .sbspf_row label {
619
+ display: inline-block;
620
+ margin: 5px 2px 0 0;
621
+ }
622
+
623
+ /* Layout */
624
+ .form-table .sbspf_layout_type {
625
+ display: inline-block;
626
+ margin-left: 20px;
627
+ }
628
+ .form-table .sbspf_layout_type:first-child {
629
+ margin-left: 0;
630
+ }
631
+ .sbspf_layout_setting,
632
+ .sbspf_sub_option_setting{
633
+ margin-bottom: 20px;
634
+ }
635
+ .sbspf_layout_setting:last-child,
636
+ .sbspf_box_setting:last-child,
637
+ .sbspf_sub_option_setting:last-child{
638
+ margin-bottom: 0;
639
+ }
640
+ .sbspf_layout_setting label,
641
+ .sbspf_box_setting label {
642
+ display: inline-block;
643
+ font-weight: bold;
644
+ font-size: 14px;
645
+ padding-bottom: 5px;
646
+ padding-right: 5px;
647
+ }
648
+ #sbspf_admin .sbspf_layout_options_wrap .sbspf_shortcode_symbol{
649
+ bottom: 4px;
650
+ right: -20px;
651
+ }
652
+ #sbspf_admin .sbspf_layout_options_wrap .sbspf_shortcode,
653
+ #sbspf_admin .sbspf_box_setting .sbspf_shortcode{
654
+ position: relative;
655
+ float: none;
656
+ top: -4px
657
+ }
658
+ .sbspf_layout_cell,
659
+ .sbspf_sub_option_cell{
660
+ padding: 0;
661
+ display: inline-block;
662
+ float: left;
663
+ width: 155px;
664
+ padding: 15px 15px 10px 15px;
665
+ margin-right: 10px;
666
+ margin-bottom: 10px;
667
+ background: #f6f6f6;
668
+ border: 1px solid #ddd;
669
+ -moz-border-radius: 5px;
670
+ -webkit-border-radius: 5px;
671
+ border-radius: 5px;
672
+ vertical-align: top;
673
+ }
674
+ .sbspf_layout_cell:nth-child(4) {
675
+ margin-right: 0;
676
+ }
677
+ @media all and (max-width: 1200px){
678
+ .sbspf_layout_cell,
679
+ .sbspf_sub_option_cell{
680
+ width: 21%;
681
+ padding: 1%;
682
+ margin-right: 1%;
683
+ }
684
+ .sbspf_sub_option_cell {
685
+ width: 30%;
686
+ }
687
+ }
688
+ @media all and (max-width: 480px){
689
+ .sbspf_layout_cell,
690
+ .sbspf_sub_option_cell{
691
+ width: 98%;
692
+ padding: 1%;
693
+ margin: 5px 0;
694
+ }
695
+ }
696
+ .sbspf_label {
697
+ font-size: 16px;
698
+ font-weight: bold;
699
+ padding-left: 2px;
700
+ }
701
+ .sbspf_layout_cell:hover,
702
+ .sbspf_layout_cell:focus,
703
+ .sbspf_sub_option_cell:hover,
704
+ .sbspf_sub_option_cell:focus{
705
+ background: #fcfcfc;
706
+ cursor: pointer;
707
+ }
708
+ .sbspf_layout_cell.sbspf_layout_selected,
709
+ .sbspf_sub_option_cell.sbspf_sub_option_selected{
710
+ background: #f7faf1;
711
+ border: 1px solid #7ad03a;
712
+ }
713
+ .sbspf_layout_cell h3
714
+ .sbspf_sub_option_cell h3 {
715
+ font-size: 15px;
716
+ margin-top: 0;
717
+ }
718
+ .sbspf_layout_cell img,
719
+ .sbspf_sub_option_cell img {
720
+ width: 100%;
721
+ border: 1px solid #ddd;
722
+ margin-top: 5px;
723
+ }
724
+ #sbspf_admin .sbspf_layout_settings,
725
+ #sbspf_admin .sbspf_sub_option_settings{
726
+ float: left;
727
+ clear: both;
728
+ width: 96%;
729
+ max-width: 700px;
730
+
731
+ padding: 20px 2%;
732
+ margin: 0 0 10px 0;
733
+ font-size: 13px;
734
+ background: #f9f9f9;
735
+ background: rgba(255,255,255,0.8);
736
+
737
+ -moz-border-radius: 8px;
738
+ -webkit-border-radius: 8px;
739
+ border-radius: 8px;
740
+ }
741
+ .sbspf_layout_setting,
742
+ .sbspf_sub_option_setting{
743
+ clear:left;
744
+ margin-bottom: 20px;
745
+ }
746
+ #sbspf_admin .sbspf_layout_options_wrap .sbspf-tooltip,
747
+ #sbspf_admin .sbspf_box_setting .sbspf-tooltip{
748
+ width: 98%;
749
+ padding: 10px 1%;
750
+ background: #eee;
751
+ background: rgba(0,0,0,0.05);
752
+ }
753
+ #sbspf_admin .sbspf_layout_mobile_layout_setting {
754
+ width: auto;
755
+ }
756
+
757
+
758
+ /* Display Tab */
759
+ #sbspf_admin table.sbspf_shortcode_table{
760
+ border-collapse: collapse;
761
+ }
762
+ #sbspf_admin table.sbspf_shortcode_table th,
763
+ #sbspf_admin table.sbspf_shortcode_table td{
764
+ border: 1px solid #999;
765
+ padding: 0.5rem;
766
+ text-align: left;
767
+ }
768
+ #sbspf_admin table.sbspf_shortcode_table th{
769
+ background: rgba(0,0,0,0.1);
770
+ }
771
+ #sbspf_admin table.sbspf_shortcode_table td{
772
+ background: rgba(255,255,255,0.5);
773
+ }
774
+ #sbspf_admin .sbspf_table_header{
775
+ background: #ddd;
776
+ font-weight: bold;
777
+ }
778
+
779
+ /* Modal */
780
+
781
+ #sbspf_modal_overlay{
782
+ position: fixed;
783
+ z-index: 999;
784
+ width: 100%;
785
+ top: 0;
786
+ right: 0;
787
+ bottom: 0;
788
+ left: 0;
789
+
790
+ background: rgba(0,0,0,0.3);
791
+ }
792
+ #sbspf_modal_overlay .sbspf_modal{
793
+ position: absolute;
794
+ top: 160px;
795
+ left: 50%;
796
+ width: 450px;
797
+
798
+ margin: 0 0 0 -230px;
799
+ padding: 20px 30px;
800
+ background: #fff;
801
+
802
+ -webkit-box-shadow: 0 1px 20px rgba(0,0,0,0.2);
803
+ box-shadow: 0 1px 20px rgba(0,0,0,0.2);
804
+
805
+ -moz-border-radius: 3px;
806
+ -webkit-border-radius: 3px;
807
+ border-radius: 3px;
808
+ }
809
+ #sbspf_modal_overlay .sbspf_modal p{
810
+ margin: 8px 0;
811
+ }
812
+ #sbspf_modal_overlay .sbspf_modal .sbspf_submit{
813
+ margin-top: 20px;
814
+ }
815
+ #sbspf_modal_overlay .sbspf_modal .heading{
816
+ font-weight: 500;
817
+ font-size: 15px;
818
+ }
819
+ @media all and (max-width: 480px){
820
+ #sbspf_modal_overlay .sbspf_modal{
821
+ max-width: 100%;
822
+ margin: 0 0 0 -50%;
823
+ box-sizing: border-box;
824
+ }
825
+ }
826
+ .sbspf_emphasis {
827
+ display: block;
828
+ font-size: 16px;
829
+ text-align: center;
830
+ margin-bottom: 20px;
831
+ }
832
+ .sbspf_emphasis svg {
833
+ height: 14px;
834
+ }
835
+ .sbspf_modal_message h3 {
836
+ font-size: 14px;
837
+ }
838
+ .sbspf_modal .sbspf_modal_close{
839
+ position: absolute;
840
+ top: 0;
841
+ right: 0;
842
+ padding: 10px;
843
+ font-size: 14px;
844
+ color: #ccc;
845
+ margin: 0;
846
+ }
847
+ .sbspf_modal .sbspf_modal_close:focus,
848
+ .sbspf_modal .sbspf_modal_close:hover{
849
+ color: #333;
850
+ }
851
+ /* Pro only notices */
852
+ #sbspf_admin .sbspf_sub_options,
853
+ #sbspf_admin .sbspf_layout_cell,
854
+ #sbspf_admin .sbspf_layout_settings,
855
+ #sbspf_admin .sbspf_disabled_wrap{
856
+ position: relative;
857
+ }
858
+ #sbspf_admin .sbspf_sub_options:after,
859
+ #sbspf_admin .sbspf_disabled_wrap{
860
+ clear: both;
861
+ display: table;
862
+ content: ""
863
+ }
864
+ #sbspf_admin .sbspf_disabled_wrap{
865
+ width: 100%;
866
+ max-width: 520px;
867
+ }
868
+ #sbspf_admin .sby_includes_pro_only .sbspf_pro_tooltip {
869
+ top: 50%;
870
+ left: 30px;
871
+ bottom: auto;
872
+ margin-top: -96px;
873
+ }
874
+ #sbspf_admin .sbspf-show-pro{
875
+ margin-top: 10px;
876
+ text-align: center;
877
+ }
878
+ .sbspf_layout_cell.sbspf_pro_only .sbspf_lock{
879
+ margin-top: -4px;
880
+ }
881
+ #sbspf_admin .sbspf_layout_cell.sbspf_pro_only .sbspf_pro_tooltip {
882
+ margin-top: -38px;
883
+ left: 54px;
884
+ }
885
+ #sbspf_admin .sbspf_pro_only,
886
+ #sbspf_admin .sbspf_pro_only label,
887
+ #sbspf_admin .sbspf_pro_only input,
888
+ #sbspf_admin .sbspf_pro_only select,
889
+ #sbspf_admin .sbspf_pro_only_row,
890
+ #sbspf_admin .sbspf_pro_only_row label,
891
+ #sbspf_admin .sbspf_pro_only_row input,
892
+ #sbspf_admin .sbspf_pro_only_row select{
893
+ color: #999 !important;
894
+ }
895
+ #sbspf_admin tr.sbspf_pro_only{
896
+ background: #eacccc;
897
+ }
898
+ #sbspf_admin .sbspf_type_row.sbspf_pro_only input[type=text]{
899
+ opacity: 0.5;
900
+ background: white;
901
+ }
902
+ .sbspf_lock.sbspf_pro_lock {
903
+ background: rgba(255,255,255,0.8);
904
+ color: #666;
905
+ border: 1px solid #ccc;
906
+ margin-right: -34px;
907
+ }
908
+ .sbspf_lock.sbspf_pro_lock i {
909
+ margin-right: 8px;
910
+ }
911
+ #sbspf_admin .sbspf_pro_lock:hover,
912
+ #sbspf_admin .sbspf_pro_lock:hover{
913
+ background: #fff;
914
+ border: 1px solid #ccc;
915
+ color: #333;
916
+ box-shadow: 0 0 8px 0 rgba(0,0,0,0.15);
917
+ }
918
+ #sbspf_admin .sbspf_pro_tooltip{
919
+ text-align: center;
920
+ z-index:99;
921
+ display: none;
922
+ position: absolute;
923
+ bottom: 22px;
924
+ left: -8px;
925
+
926
+ background: #333;
927
+ color: #eee;
928
+ width: 90%;
929
+ padding: 8px 10px 10px 10px;
930
+ border-radius: 3px;
931
+ line-height: 1.3;
932
+ font-size: 12px;
933
+ width: 190px;
934
+ }
935
+ #sbspf_admin .sbspf_pro_tooltip .fa-caret-down {
936
+ position: absolute;
937
+ bottom: -12px;
938
+ font-size: 20px;
939
+ left: 49%;
940
+ color: #333;
941
+ }
942
+ #sbspf_admin .sbspf_layouts .sbspf_pro_tooltip,
943
+ #sbspf_admin .sbspf_sub_options .sbspf_pro_tooltip{
944
+ left: 284px;
945
+ top: -21px;
946
+ bottom: auto;
947
+ margin-left: -101px;
948
+ }
949
+ #sbspf_admin .sbspf_layouts .sbspf_layout_cell .sbspf_pro_tooltip{
950
+ left: 84px;
951
+ top: 32px;
952
+ }
953
+ #sbspf_admin .sbspf_table_key{
954
+ display: block;
955
+ float: left;
956
+ width: 11px;
957
+ height: 11px;
958
+ border: 1px solid #999;
959
+ background: #eacccc;
960
+ margin: 3px 6px 0 0;
961
+ }
962
+
963
+ /* SBY Specific */
964
+ #sbspf_admin .sby_mode_option {
965
+ position: relative;
966
+ margin-bottom: 20px;
967
+ }
968
+ #sbspf_admin .sby_mode_option label {
969
+ display: inline-block;
970
+ font-weight: bold;
971
+ }
972
+ #sbspf_admin .sby_mode_option .sbspf_note {
973
+ display: block;
974
+ margin-left: 0;
975
+ }
976
+ #sbspf_admin .sby_mode_option .sbspf_note,
977
+ #sbspf_admin .sby_mode_option label {
978
+ margin-bottom: 5px;
979
+ }
980
+ #sbspf_admin .sby_mode_option input[type=radio] {
981
+ position: absolute;
982
+ top: 6px;
983
+ }
984
+ #sbspf_admin .sby_mode_option_text {
985
+ margin-left: 22px;
986
+ }
987
+ #sbspf_admin .sby_mode_option.sbspf_fade .sby_important,
988
+ #sbspf_admin .sby_mode_option.sbspf_fade .sbspf_note {
989
+ opacity: 1;
990
+ }
991
+
992
+ /* Notices */
993
+ .sby_includes_pro_only .sbspf_lock {
994
+ left: 100px;
995
+ right: auto;
996
+ margin-top: -40px;
997
+ }
998
+ .sbspf_sub_options .sbspf_lock {
999
+ top: 38px;
1000
+ left: 260px;
1001
+ right: auto;
1002
+ }
1003
+ .sby_types_disabled_wrap .sbspf_lock {
1004
+ margin-top: -20px;
1005
+ }
1006
+ #sbspf_admin .sby_types_disabled_wrap .sbspf_pro_tooltip {
1007
+ top: 50%;
1008
+ margin-left: -112px;
1009
+ margin-top: -78px;
1010
+ bottom: auto;
1011
+ left: 50%;
1012
+ }
1013
+ @media screen and (max-width: 480px) {
1014
+ .sbspf_sub_options .sbspf_lock {
1015
+ top: 60px;
1016
+ left: 50%;
1017
+ margin-left: -40px;
1018
+ right: auto;
1019
+ }
1020
+ #sbspf_admin .sbspf_sub_options .sbspf_pro_tooltip {
1021
+ top: 0px;
1022
+ left: 50%;
1023
+ margin-left: -112px;
1024
+ }
1025
+ }
1026
+
1027
+ /* Lite Notice */
1028
+ @media screen and (max-width: 600px) {
1029
+ #sbspf-notice-bar {
1030
+ display:none !important
1031
+ }
1032
+ }
1033
+
1034
+ #sbspf-notice-bar {
1035
+ background-color: #DDDDDD;
1036
+ color: #777777;
1037
+ text-align: center;
1038
+ position: relative;
1039
+ padding: 7px;
1040
+ margin-bottom: 0;
1041
+ opacity: 1;
1042
+ transition: all .3s ease-in-out;
1043
+ max-height: 100px;
1044
+ overflow: hidden
1045
+ }
1046
+
1047
+ #sbspf-notice-bar.out {
1048
+ opacity: .5;
1049
+ max-height: 0
1050
+ }
1051
+
1052
+ #sbspf-notice-bar a {
1053
+ color: #e34f0e;
1054
+ }
1055
+
1056
+ #sbspf-notice-bar a:hover {
1057
+ color: #b85a1b
1058
+ }
1059
+
1060
+ #sbspf-notice-bar .dismiss {
1061
+ position: absolute;
1062
+ top: 0;
1063
+ right: 0;
1064
+ border: none;
1065
+ padding: 5px;
1066
+ margin-top: 1px;
1067
+ background: 0 0;
1068
+ color: #72777c;
1069
+ cursor: pointer
1070
+ }
1071
+
1072
+ #sbspf-notice-bar .dismiss:before {
1073
+ background: 0 0;
1074
+ color: #72777c;
1075
+ content: "\f335";
1076
+ display: block;
1077
+ font: normal 20px/20px dashicons;
1078
+ speak: none;
1079
+ height: 20px;
1080
+ text-align: center;
1081
+ width: 20px;
1082
+ -webkit-font-smoothing: antialiased
1083
+ }
trunk/css/sb-youtube.css ADDED
@@ -0,0 +1,1355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 * {
15
+ -webkit-box-sizing: border-box;
16
+ -moz-box-sizing: border-box;
17
+ box-sizing: border-box
18
+ }
19
+ [id^=sb_youtube_].sb_youtube:after{
20
+ content: "";
21
+ display: table;
22
+ clear: both;
23
+ }
24
+ [id^=sb_youtube_].sb_youtube iframe,
25
+ #sby_lightbox iframe{
26
+ pointer-events: all !important;
27
+ }
28
+
29
+ /*********************/
30
+ /*** STYLE OPTIONS ***/
31
+ /*********************/
32
+ [id^=sb_youtube_].sb_youtube.sby_fixed_height{
33
+ overflow: hidden;
34
+ overflow-y: auto;
35
+ -webkit-box-sizing: border-box;
36
+ -moz-box-sizing: border-box;
37
+ box-sizing: border-box;
38
+ }
39
+ [id^=sb_youtube_].sb_youtube .sby_items_wrap{
40
+ width: 100%;
41
+ float: left;
42
+ line-height: 0;
43
+
44
+ -webkit-box-sizing: border-box;
45
+ -moz-box-sizing: border-box;
46
+ box-sizing: border-box;
47
+ }
48
+
49
+ /* Items */
50
+ [id^=sb_youtube_].sb_youtube .sby_items_wrap .sby_item,
51
+ [id^=sb_youtube_].sb_youtube .sby_player_outer_wrap .sby_video_thumbnail_wrap,
52
+ [id^=sb_youtube_].sb_youtube .sby_player_wrap{
53
+ display: -moz-inline-stack;
54
+ display: inline-block;
55
+ vertical-align: top;
56
+ zoom: 1;
57
+ *display: inline;
58
+
59
+ max-height: 1000px;
60
+ padding: inherit !important;
61
+ text-decoration: none;
62
+ opacity: 1;
63
+ overflow: hidden;
64
+
65
+ -webkit-box-sizing: border-box;
66
+ -moz-box-sizing: border-box;
67
+ box-sizing: border-box;
68
+
69
+ -webkit-transition: all 0.5s ease;
70
+ -moz-transition: all 0.5s ease;
71
+ -o-transition: all 0.5s ease;
72
+ -ms-transition: all 0.5s ease;
73
+ transition: all 0.5s ease;
74
+ }
75
+ [id^=sb_youtube_].sb_youtube .sby_items_wrap .sby_item.sby_no_margin {
76
+ margin: 0 !important;
77
+ }
78
+ [id^=sb_youtube_].sb_youtube .sby_items_wrap .sby_item {
79
+ float: left;
80
+ }
81
+ /* Transition items in */
82
+ [id^=sb_youtube_].sb_youtube .sby_items_wrap .sby_item.sby_transition{
83
+ opacity: 0;
84
+ max-height: 0;
85
+ }
86
+
87
+ /* Cols */
88
+ [id^=sb_youtube_].sb_youtube.sby_col_0 .sby_items_wrap .sby_item{ width: 100%; }
89
+ [id^=sb_youtube_].sb_youtube.sby_col_1 .sby_items_wrap .sby_item{ width: 100%; }
90
+ [id^=sb_youtube_].sb_youtube.sby_col_2 .sby_items_wrap .sby_item{ width: 50%; }
91
+ [id^=sb_youtube_].sb_youtube.sby_col_3 .sby_items_wrap .sby_item{ width: 33.33%; }
92
+ [id^=sb_youtube_].sb_youtube.sby_col_4 .sby_items_wrap .sby_item{ width: 25%; }
93
+ [id^=sb_youtube_].sb_youtube.sby_col_5 .sby_items_wrap .sby_item{ width: 20%; }
94
+ [id^=sb_youtube_].sb_youtube.sby_col_6 .sby_items_wrap .sby_item{ width: 16.66%; }
95
+ [id^=sb_youtube_].sb_youtube.sby_col_7 .sby_items_wrap .sby_item{ width: 14.28%; }
96
+ [id^=sb_youtube_].sb_youtube.sby_col_8 .sby_items_wrap .sby_item{ width: 12.5%; }
97
+ [id^=sb_youtube_].sb_youtube.sby_col_9 .sby_items_wrap .sby_item{ width: 11.11%; }
98
+ [id^=sb_youtube_].sb_youtube.sby_col_10 .sby_items_wrap .sby_item{ width: 10%; }
99
+
100
+ /* Disable mobile layout */
101
+ /*
102
+ [id^=sb_youtube_].sb_youtube.sby_col_1.sby_disable_mobile .sby_items_wrap .sby_item{ width: 100%; }
103
+ [id^=sb_youtube_].sb_youtube.sby_col_2.sby_disable_mobile .sby_items_wrap .sby_item{ width: 50%; }
104
+ [id^=sb_youtube_].sb_youtube.sby_col_3.sby_disable_mobile .sby_items_wrap .sby_item{ width: 33.33%; }
105
+ [id^=sb_youtube_].sb_youtube.sby_col_4.sby_disable_mobile .sby_items_wrap .sby_item{ width: 25%; }
106
+ [id^=sb_youtube_].sb_youtube.sby_col_5.sby_disable_mobile .sby_items_wrap .sby_item{ width: 20%; }
107
+ [id^=sb_youtube_].sb_youtube.sby_col_6.sby_disable_mobile .sby_items_wrap .sby_item{ width: 16.66%; }
108
+ [id^=sb_youtube_].sb_youtube.sby_col_7.sby_disable_mobile .sby_items_wrap .sby_item{ width: 14.28%; }
109
+ [id^=sb_youtube_].sb_youtube.sby_col_8.sby_disable_mobile .sby_items_wrap .sby_item{ width: 12.5%; }
110
+ [id^=sb_youtube_].sb_youtube.sby_col_9.sby_disable_mobile .sby_items_wrap .sby_item{ width: 11.11%; }
111
+ [id^=sb_youtube_].sb_youtube.sby_col_10.sby_disable_mobile .sby_items_wrap .sby_item{ width: 10%; }
112
+ */
113
+ /* Photos */
114
+ .sby-screenreader{text-indent: -9999px !important;display: block !important;width: 0 !important;height: 0 !important;line-height: 0 !important;}
115
+ [id^=sb_youtube_].sb_youtube .sby_video_thumbnail_wrap,
116
+ [id^=sb_youtube_].sb_youtube .sby_player_outer_wrap {
117
+ width: 100%;
118
+ position: relative;
119
+ float: left;
120
+ }
121
+ [id^=sb_youtube_].sb_youtube .sby_video_thumbnail{
122
+ display: block;
123
+ position: relative;
124
+ text-decoration: none;
125
+ line-height: 0;
126
+ z-index: 5;
127
+ }
128
+ [id^=sb_youtube_].sb_youtube .sby_video_thumbnail img{
129
+ width: 100%;
130
+ height: auto;
131
+ border-radius: 0;
132
+ }
133
+ [id^=sb_youtube_].sb_youtube .sby_link{
134
+ display: none;
135
+ position: absolute;
136
+ z-index: 1;
137
+ top: 0;
138
+ right: 0;
139
+ bottom: 0;
140
+ left: 0;
141
+
142
+ width: 100%;
143
+ padding: 0;
144
+ background: #333;
145
+ background: rgba(0,0,0,0.6);
146
+ text-align: center;
147
+ color: #fff;
148
+ font-size: 12px;
149
+ line-height: 1.1;
150
+ overflow: hidden;
151
+ }
152
+ [id^=sb_youtube_].sb_youtube .sby_link.sby_default p,
153
+ [id^=sb_youtube_].sb_youtube .sby_link.sby_default span,
154
+ [id^=sb_youtube_].sb_youtube .sby_link.sby_default a{
155
+ text-shadow: 0px 0px 10px #000;
156
+ }
157
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_username a,
158
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_youtube_link,
159
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_hover_bottom,
160
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_playbtn,
161
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_lightbox_link,
162
+ [id^=sb_youtube_].sb_youtube .sby_link .svg-inline--fa.fa-play{
163
+ filter: alpha(opacity=90);
164
+ opacity: 0.9;
165
+ }
166
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_username a:hover,
167
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_youtube_link:hover,
168
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_playbtn:hover,
169
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_lightbox_link:hover,
170
+ [id^=sb_youtube_].sb_youtube .sby_link .svg-inline--fa.fa-play:hover{
171
+ filter: alpha(opacity=100);
172
+ opacity: 1;
173
+ }
174
+ [id^=sb_youtube_].sb_youtube .sby_link_area{
175
+ position: absolute;
176
+ top: 0;
177
+ right: 0;
178
+ bottom: 0;
179
+ left: 0;
180
+ z-index: 1;
181
+ }
182
+
183
+ [id^=sb_youtube_].sb_youtube .sby_link a{
184
+ padding: 0;
185
+ text-decoration: none;
186
+ color: #ddd;
187
+ color: rgba(255,255,255,0.7);
188
+ line-height: 1.1;
189
+ background: none;
190
+
191
+ display: -moz-inline-stack;
192
+ display: inline-block;
193
+ vertical-align: top;
194
+ zoom: 1;
195
+ *display: inline;
196
+ }
197
+ [id^=sb_youtube_].sb_youtube .sby_link a:hover,
198
+ [id^=sb_youtube_].sb_youtube .sby_link a:active{
199
+ color: #fff;
200
+ }
201
+
202
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_lightbox_link{
203
+ display: block;
204
+ /*display: none;*/
205
+ position: absolute;
206
+ z-index: 2;
207
+ top: 50%;
208
+ left: 50%;
209
+
210
+ margin-top: -24px;
211
+ margin-left: -21px;
212
+ padding: 0;
213
+ font-size: 49px;
214
+ font-style: normal !important;
215
+ }
216
+ [id^=sb_youtube_].sb_youtube .sby_type_video .sby_lightbox_link,
217
+ [id^=sb_youtube_].sb_youtube .sby_carousel_vid_first .sby_lightbox_link{
218
+ display: none;
219
+ }
220
+
221
+ [id^=sb_youtube_].sb_youtube .sby_link .sby_youtube_link{
222
+ /*float: right;*/
223
+ font-size: 30px;
224
+ position: absolute;
225
+ z-index: 100;
226
+ bottom: 0;
227
+ right: 2px;
228
+ padding: 8px;
229
+ }
230
+ [id^=sb_youtube_].sb_youtube .sby_link a:hover,
231
+ [id^=sb_youtube_].sb_youtube .sby_link a:focus{
232
+ text-decoration: underline;
233
+ }
234
+
235
+ /* Player */
236
+ [id^=sb_youtube_].sb_youtube .sby_player_wrap {
237
+ z-index: 1;
238
+ width: 100% !important;
239
+ height: 100% !important;
240
+ position: absolute;
241
+ top: 0;
242
+ left: 0;
243
+ }
244
+ [id^=sb_youtube_].sb_youtube .sby_player_wrap iframe {
245
+ width: 100% !important;
246
+ height: 100% !important;
247
+ }
248
+
249
+ /* Use CSS for lightbox fade instead of JS */
250
+ [id^=sb_youtube_].sb_youtube .sby_thumbnail_hover {
251
+ opacity: 0;
252
+ display: block;
253
+ position: absolute;
254
+ top: 0;
255
+ right: 0;
256
+ bottom: 0;
257
+ left: 0;
258
+ z-index: 10;
259
+ color: #fff;
260
+ background: #333;
261
+ background: rgba(0,0,0,.6);
262
+ transition: opacity .6s ease-in-out;
263
+ -moz-transition: opacity .6s ease-in-out;
264
+ -webkit-transition: opacity .6s ease-in-out;
265
+ }
266
+ [id^=sb_youtube_].sb_youtube.sby_layout_list .sby_thumbnail_hover {
267
+ display: none;
268
+ }
269
+ .sby_video_title {
270
+ display: inline-block;
271
+ height: 100%;
272
+ padding: 10px;
273
+ overflow: hidden;
274
+ font-size: 13px;
275
+ line-height: 1.2;
276
+ }
277
+ [id^=sb_youtube_].sb_youtube .sby_video_thumbnail:hover .sby_thumbnail_hover {
278
+ opacity: 1;
279
+ display: block;
280
+ transition: opacity .2s ease-in-out;
281
+ -moz-transition: opacity .2s ease-in-out;
282
+ -webkit-transition: opacity .2s ease-in-out;
283
+ }
284
+ [id^=sb_youtube_].sb_youtube.sby_layout_list .sby_video_thumbnail:hover .sby_thumbnail_hover {
285
+ opacity: 0;
286
+ display: none;
287
+ transition: none;
288
+ -moz-transition: none;
289
+ -webkit-transition: none;
290
+ }
291
+
292
+ /* Play Button */
293
+ [id^=sb_youtube_].sb_youtube .sby_video_thumbnail:hover .sby_play_btn {
294
+ opacity: .5;
295
+ }
296
+ [id^=sb_youtube_].sb_youtube .sby_play_btn {
297
+ position: absolute;
298
+ z-index: 1;
299
+ left: 50%;
300
+ bottom: 50%;
301
+ top: 50%;
302
+ right: 50%;
303
+ margin-top: -25px;
304
+ margin-left: -28px;
305
+ color: #fff;
306
+ width: 57px;
307
+ height: 50px;
308
+ opacity: 1;
309
+ transition: opacity .2s ease-in-out;
310
+ -moz-transition: opacity .2s ease-in-out;
311
+ -webkit-transition: opacity .2s ease-in-out;
312
+ }
313
+ [id^=sb_youtube_].sb_youtube .sby_play_btn_bg {
314
+ display: block;
315
+ position: absolute;
316
+ z-index: -1;
317
+ top: 17px;
318
+ left: 22px;
319
+ width: 0;
320
+ height: 0;
321
+ border: 0 solid transparent;
322
+ border-bottom-width: 9px;
323
+ border-top-width: 9px;
324
+ border-left: 16px solid #fff;
325
+ }
326
+ [id^=sb_youtube_].sb_youtube .sby_play_btn svg:not(:root).svg-inline--fa{
327
+ width: 57px;
328
+ height: auto;
329
+ opacity: 0.75;
330
+ }
331
+
332
+ [id^=sb_youtube_].sb_youtube .sby_play_btn svg,
333
+ [id^=sb_youtube_].sb_youtube .sby_play_btn i{
334
+ color: #000;
335
+ }
336
+ /* Medium */
337
+ [id^=sb_youtube_].sb_youtube.sby_medium .sby_play_btn {
338
+ margin-top: -20px;
339
+ margin-left: -22px;
340
+ width: 45px;
341
+ height: 40px;
342
+ }
343
+ [id^=sb_youtube_].sb_youtube.sby_medium .sby_play_btn_bg {
344
+ top: 13px;
345
+ left: 18px;
346
+ border-bottom-width: 7px;
347
+ border-top-width: 7px;
348
+ border-left: 12px solid #fff;
349
+ }
350
+ [id^=sb_youtube_].sb_youtube.sby_medium .sby_play_btn svg:not(:root).svg-inline--fa{
351
+ width: 45px;
352
+ }
353
+
354
+ /* Small */
355
+ [id^=sb_youtube_].sb_youtube.sby_small .sby_play_btn{
356
+ margin-top: -16px;
357
+ margin-left: -18px;
358
+ width: 36px;
359
+ height: 32px;
360
+ }
361
+ [id^=sb_youtube_].sb_youtube.sby_small .sby_play_btn_bg {
362
+ top: 10px;
363
+ left: 14px;
364
+ border-bottom-width: 6px;
365
+ border-top-width: 6px;
366
+ border-left: 10px solid #fff;
367
+ }
368
+ [id^=sb_youtube_].sb_youtube.sby_small .sby_play_btn svg:not(:root).svg-inline--fa{
369
+ width: 36px;
370
+ }
371
+
372
+ /* Loader */
373
+ [id^=sb_youtube_].sb_youtube .sby_loader{
374
+ width: 20px;
375
+ height: 20px;
376
+
377
+ position: relative;
378
+ top: 50%;
379
+ left: 50%;
380
+ margin: -10px 0 0 -10px;
381
+ background-color: #000;
382
+ background-color: rgba(0,0,0,0.5);
383
+
384
+ border-radius: 100%;
385
+ -webkit-animation: sby-sk-scaleout 1.0s infinite ease-in-out;
386
+ animation: sby-sk-scaleout 1.0s infinite ease-in-out;
387
+ }
388
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header br,
389
+ [id^=sb_youtube_].sb_youtube .sby_items_wrap br,
390
+ [id^=sb_youtube_].sb_youtube .sby_footer br{
391
+ display: none;
392
+ }
393
+ .sby_footer p {
394
+ display: inline;
395
+ padding: 0;
396
+ margin: 0;
397
+ }
398
+ /* Loader in button */
399
+ [id^=sb_youtube_].sb_youtube .sby_footer .sby_loader,
400
+ [id^=sb_youtube_].sb_youtube .sby_item .sby_loader,
401
+ [id^=sb_youtube_].sb_youtube .sby_player_outer_wrap .sby_loader{
402
+ position: absolute;
403
+ margin-top: -11px;
404
+ background-color: #fff;
405
+ }
406
+ [id^=sb_youtube_].sb_youtube .sby_item.sby_player_loading,
407
+ [id^=sb_youtube_].sb_youtube .sby_player_outer_wrap.sby_player_loading {
408
+ opacity: .8;
409
+ }
410
+ @-webkit-keyframes sby-sk-scaleout {
411
+ 0% { -webkit-transform: scale(0) }
412
+ 100% {
413
+ -webkit-transform: scale(1.0);
414
+ opacity: 0;
415
+ }
416
+ }
417
+ @keyframes sby-sk-scaleout {
418
+ 0% {
419
+ -webkit-transform: scale(0);
420
+ -ms-transform: scale(0);
421
+ transform: scale(0);
422
+ } 100% {
423
+ -webkit-transform: scale(1.0);
424
+ -ms-transform: scale(1.0);
425
+ transform: scale(1.0);
426
+ opacity: 0;
427
+ }
428
+ }
429
+
430
+ [id^=sb_youtube_].sb_youtube .fa-spin,
431
+ #sby_lightbox .fa-spin{
432
+ -webkit-animation: fa-spin 2s infinite linear;
433
+ animation: fa-spin 2s infinite linear
434
+ }
435
+
436
+ [id^=sb_youtube_].sb_youtube .fa-pulse,
437
+ #sby_lightbox .fa-pulse{
438
+ -webkit-animation: fa-spin 1s infinite steps(8);
439
+ animation: fa-spin 1s infinite steps(8)
440
+ }
441
+
442
+ @-webkit-keyframes fa-spin {
443
+ 0% {
444
+ -webkit-transform: rotate(0deg);
445
+ transform: rotate(0deg)
446
+ }
447
+ 100% {
448
+ -webkit-transform: rotate(359deg);
449
+ transform: rotate(359deg)
450
+ }
451
+ }
452
+
453
+ @keyframes fa-spin {
454
+ 0% {
455
+ -webkit-transform: rotate(0deg);
456
+ transform: rotate(0deg)
457
+ }
458
+ 100% {
459
+ -webkit-transform: rotate(359deg);
460
+ transform: rotate(359deg)
461
+ }
462
+ }
463
+
464
+ /* HEADER */
465
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header{
466
+ float: left;
467
+ clear: both;
468
+ margin: 0 0 15px 0;
469
+ padding: 0;
470
+ line-height: 1.2;
471
+ width: 100%;
472
+ }
473
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header a{
474
+ float: left;
475
+ display: block;
476
+ /*width: 100%;*/
477
+ min-width: 100%\9;
478
+ text-decoration: none;
479
+ transition: color 0.5s ease;
480
+ }
481
+ /** Medium Header */
482
+ /* Only use medium & large headers on devices above 480px */
483
+ @media all and (min-width: 480px){
484
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_img {
485
+ width: 80px;
486
+ height: 80px;
487
+ border-radius: 40px;
488
+ }
489
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_img img {
490
+ width: 80px;
491
+ height: 80px;
492
+ border-radius: 40px;
493
+ }
494
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text h3 {
495
+ font-size: 20px;
496
+ }
497
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text .sby_bio_info,
498
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text .sby_bio{
499
+ font-size: 14px;
500
+ }
501
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text h3,
502
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text .sby_bio_info,
503
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text .sby_bio{
504
+ margin-left: 95px !important;
505
+ line-height: 1.4
506
+ }
507
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text h3{
508
+ margin-right: -85px !important;
509
+ }
510
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text .sby_bio_info{
511
+ margin-top: 4px !important;
512
+ }
513
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_medium .sby_header_text.sby_no_bio h3{
514
+ padding-top: 20px !important;
515
+ }
516
+ /** Large Header */
517
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_img {
518
+ width: 120px;
519
+ height: 120px;
520
+ border-radius: 60px;
521
+ }
522
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_img img {
523
+ width: 120px;
524
+ height: 120px;
525
+ border-radius: 60px;
526
+ }
527
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text h3 {
528
+ font-size: 28px;
529
+ }
530
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text .sby_bio_info,
531
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text .sby_bio{
532
+ font-size: 16px;
533
+ }
534
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text h3,
535
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text .sby_bio_info,
536
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text .sby_bio{
537
+ margin-left: 140px !important;
538
+ line-height: 1.5;
539
+ }
540
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text h3{
541
+ margin-right: -120px !important;
542
+ }
543
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text .sby_bio_info{
544
+ margin-top: 12px !important;
545
+ }
546
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header.sby_large .sby_header_text.sby_no_bio h3{
547
+ padding-top: 32px !important;
548
+ }
549
+ }
550
+
551
+ /* Header profile pic */
552
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img{
553
+ float: left;
554
+ position: relative;
555
+ width: 50px;
556
+ margin: 0 0 0 -100% !important;
557
+ overflow: hidden;
558
+
559
+ -moz-border-radius: 40px;
560
+ -webkit-border-radius: 40px;
561
+ border-radius: 40px;
562
+ }
563
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img img{
564
+ float: left;
565
+ margin: 0 !important;
566
+ padding: 0 !important;
567
+ border: none !important;
568
+
569
+ -moz-border-radius: 40px;
570
+ -webkit-border-radius: 40px;
571
+ border-radius: 40px;
572
+ }
573
+ /* Profile pic hover */
574
+ /* Profile pic hover */
575
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img_hover{
576
+ opacity: 0;
577
+ position: absolute;
578
+ width: 100%;
579
+ top: 0;
580
+ bottom: 0;
581
+ left: 0;
582
+ text-align: center;
583
+ color: #fff;
584
+ background: rgba(0,0,0,0.75);
585
+ }
586
+
587
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img_hover .sby_new_logo{
588
+ position: absolute;
589
+ top: 50%;
590
+ left: 50%;
591
+ margin-top: -12px;
592
+ margin-left: -12px;
593
+ width: 24px;
594
+ height: 24px;
595
+ font-size: 24px;
596
+ }
597
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img_hover i {
598
+ overflow: hidden;
599
+ background: url('../img/small-logo.png') no-repeat 0 0;
600
+ }
601
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img_hover{
602
+ z-index: 2;
603
+ transition: opacity 0.4s ease-in-out;
604
+ }
605
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_fade_in{
606
+ opacity: 1;
607
+ transition: opacity 0.2s ease-in-out;
608
+ }
609
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_img_hover{
610
+ position: absolute;
611
+ width: 100%;
612
+ top: 0;
613
+ bottom: 0;
614
+ left: 0;
615
+ text-align: center;
616
+ color: #fff;
617
+ background: rgba(0,0,0,0.75);
618
+
619
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
620
+ filter: alpha(opacity=0);
621
+ -moz-opacity: 0;
622
+ -khtml-opacity: 0;
623
+ opacity: 0;
624
+ border-radius: 40px;
625
+ transition: opacity 0.2s;
626
+ }
627
+ /* Fade the Youtube icon in when hovering on the header */
628
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header a:hover .sby_header_img_hover,
629
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header a:focus .sby_header_img_hover{
630
+ opacity: 1;
631
+ }
632
+ /* Header text */
633
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text{
634
+ float: left;
635
+ width: 100%;
636
+ padding-top: 5px;
637
+ }
638
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header a{
639
+ text-decoration: none;
640
+ }
641
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text .sby_bio,
642
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text h3{
643
+ float: left;
644
+ clear: both;
645
+ width: auto;
646
+ margin: 0 0 0 60px !important;
647
+ padding: 0 !important;
648
+ }
649
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header h3{
650
+ font-size: 16px;
651
+ line-height: 1.3;
652
+ }
653
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header p{
654
+ font-size: 13px;
655
+ line-height: 1.3;
656
+ margin: 0;
657
+ padding: 0;
658
+ }
659
+ [id^=sb_youtube_].sb_youtube p:empty { display: none; }
660
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text img.emoji{
661
+ margin-right: 3px !important;
662
+ }
663
+
664
+ /* No bio */
665
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text.sby_no_bio h3{
666
+ padding-top: 9px !important;
667
+ }
668
+ [id^=sb_youtube_].sb_youtube .sb_youtube_header .sby_header_text.sby_no_bio .sby_bio_info{
669
+ clear: both;
670
+ }
671
+
672
+ /* Buttons */
673
+ [id^=sb_youtube_].sb_youtube .sby_footer{
674
+ float: left;
675
+ clear: both;
676
+ width: 100%;
677
+ text-align: center;
678
+ }
679
+ [id^=sb_youtube_].sb_youtube .sby_footer .fa-spinner{
680
+ display: none;
681
+ position: absolute;
682
+ top: 50%;
683
+ left: 50%;
684
+ margin: -8px 0 0 -7px;
685
+ font-size: 15px;
686
+ }
687
+ [id^=sb_youtube_].sb_youtube .sby_footer{
688
+ opacity: 1;
689
+ transition: all 0.5s ease-in;
690
+ }
691
+ [id^=sb_youtube_].sb_youtube .sby_load_btn .sby_btn_text, [id^=sb_youtube_].sb_youtube .sby_load_btn .sby_loader{
692
+ opacity: 1;
693
+ transition: all 0.1s ease-in;
694
+ }
695
+ [id^=sb_youtube_].sb_youtube .sby_hidden{
696
+ opacity: 0 !important;
697
+ }
698
+ [id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn,
699
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn a{
700
+ display: -moz-inline-stack;
701
+ display: inline-block;
702
+ vertical-align: top;
703
+ zoom: 1;
704
+ *display: inline;
705
+
706
+ padding: 7px 14px;
707
+ margin: 5px auto 0 auto;
708
+ background: #333;
709
+ color: #eee;
710
+ border: none;
711
+ color: #fff;
712
+ text-decoration: none;
713
+ font-size: 13px;
714
+ line-height: 1.5;
715
+
716
+ -moz-border-radius: 4px;
717
+ -webkit-border-radius: 4px;
718
+ border-radius: 4px;
719
+
720
+ -webkit-box-sizing: border-box;
721
+ -moz-box-sizing: border-box;
722
+ box-sizing: border-box;
723
+ }
724
+ [id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn {
725
+ position: relative;
726
+ }
727
+ /* Follow button */
728
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn{
729
+ display: -moz-inline-stack;
730
+ display: inline-block;
731
+ vertical-align: top;
732
+ zoom: 1;
733
+ *display: inline;
734
+ text-align: center;
735
+ }
736
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn.sby_top{
737
+ display: block;
738
+ margin-bottom: 5px;
739
+ }
740
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn a{
741
+ background: #408bd1;
742
+ color: #fff;
743
+ }
744
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn a,
745
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn a,
746
+ [id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn{
747
+ transition: all 0.1s ease-in;
748
+ }
749
+ /* Hover state for default colors */
750
+ [id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn:hover{
751
+ outline: none;
752
+ box-shadow: inset 0 0 20px 20px rgba(255,255,255,0.25);
753
+ }
754
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn a:hover,
755
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn a:focus{
756
+ outline: none;
757
+ box-shadow: inset 0 0 10px 20px #359dff;
758
+ }
759
+ /* If a custom color is applied then just use opacity for the hover effect */
760
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn.sby_custom a:hover,
761
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn.sby_custom a:focus,
762
+ [id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn.sby_custom:hover{
763
+ box-shadow: inset 0 0 20px 20px rgba(255,255,255,0.15);
764
+ }
765
+ /* Active state */
766
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn a:active,
767
+ [id^=sb_youtube_].sb_youtube .sby_footer .sby_load_btn:active{
768
+ box-shadow: inset 0 0 10px 20px rgba(0,0,0,0.3);
769
+ }
770
+
771
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn .fa,
772
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn svg{
773
+ margin-bottom: -1px;
774
+ margin-right: 7px;
775
+ font-size: 15px;
776
+ }
777
+ [id^=sb_youtube_].sb_youtube .sby_follow_btn svg{
778
+ vertical-align: -.125em;
779
+ }
780
+ [id^=sb_youtube_].sb_youtube .sby_footer .sby_follow_btn{
781
+ margin-left: 5px;
782
+ }
783
+
784
+ /* Media queries */
785
+ @media all and (max-width: 640px){
786
+ /* Make 3-6 cols into 2 col */
787
+ [id^=sb_youtube_].sb_youtube.sby_col_3.sby_mob_col_auto .sby_items_wrap .sby_item,
788
+ [id^=sb_youtube_].sb_youtube.sby_col_4.sby_mob_col_auto .sby_items_wrap .sby_item,
789
+ [id^=sb_youtube_].sb_youtube.sby_col_5.sby_mob_col_auto .sby_items_wrap .sby_item,
790
+ [id^=sb_youtube_].sb_youtube.sby_col_6.sby_mob_col_auto .sby_items_wrap .sby_item{
791
+ width: 50%;
792
+ }
793
+ /* Make 7-10 cols into 4 col */
794
+ [id^=sb_youtube_].sb_youtube.sby_col_7 .sby_items_wrap .sby_item,
795
+ [id^=sb_youtube_].sb_youtube.sby_col_8 .sby_items_wrap .sby_item,
796
+ [id^=sb_youtube_].sb_youtube.sby_col_9 .sby_items_wrap .sby_item,
797
+ [id^=sb_youtube_].sb_youtube.sby_col_10 .sby_items_wrap .sby_item,
798
+ [id^=sb_youtube_].sb_youtube.sby_col_7.sby_mob_col_auto .sby_items_wrap .sby_item,
799
+ [id^=sb_youtube_].sb_youtube.sby_col_8.sby_mob_col_auto .sby_items_wrap .sby_item,
800
+ [id^=sb_youtube_].sb_youtube.sby_col_9.sby_mob_col_auto .sby_items_wrap .sby_item,
801
+ [id^=sb_youtube_].sb_youtube.sby_col_10.sby_mob_col_auto .sby_items_wrap .sby_item{
802
+ width: 25%;
803
+ }
804
+ [id^=sb_youtube_].sb_youtube.sby_col_2 .sby_items_wrap .sby_item{ width: 50%; }
805
+ [id^=sb_youtube_].sb_youtube.sby_col_3 .sby_items_wrap .sby_item{ width: 33.33%; }
806
+ [id^=sb_youtube_].sb_youtube.sby_col_4 .sby_items_wrap .sby_item{ width: 25%; }
807
+ [id^=sb_youtube_].sb_youtube.sby_col_5 .sby_items_wrap .sby_item{ width: 20%; }
808
+ [id^=sb_youtube_].sb_youtube.sby_col_6 .sby_items_wrap .sby_item{ width: 16.66%; }
809
+ [id^=sb_youtube_].sb_youtube.sby_col_7 .sby_items_wrap .sby_item{ width: 14.28%; }
810
+ [id^=sb_youtube_].sb_youtube.sby_col_8 .sby_items_wrap .sby_item{ width: 12.5%; }
811
+ [id^=sb_youtube_].sb_youtube.sby_col_9 .sby_items_wrap .sby_item{ width: 11.11%; }
812
+ [id^=sb_youtube_].sb_youtube.sby_col_10 .sby_items_wrap .sby_item{ width: 10%; }
813
+ /* On mobile make the min-width 100% */
814
+ [id^=sb_youtube_].sb_youtube.sby_width_resp{
815
+ width: 100% !important;
816
+ }
817
+ }
818
+ @media all and (max-width: 480px){
819
+ /* Make all cols into 1 col */
820
+ [id^=sb_youtube_].sb_youtube.sby_col_3.sby_mob_col_auto .sby_items_wrap .sby_item,
821
+ [id^=sb_youtube_].sb_youtube.sby_col_4.sby_mob_col_auto .sby_items_wrap .sby_item,
822
+ [id^=sb_youtube_].sb_youtube.sby_col_5.sby_mob_col_auto .sby_items_wrap .sby_item,
823
+ [id^=sb_youtube_].sb_youtube.sby_col_6.sby_mob_col_auto .sby_items_wrap .sby_item,
824
+ [id^=sb_youtube_].sb_youtube.sby_col_7.sby_mob_col_auto .sby_items_wrap .sby_item,
825
+ [id^=sb_youtube_].sb_youtube.sby_col_8.sby_mob_col_auto .sby_items_wrap .sby_item,
826
+ [id^=sb_youtube_].sb_youtube.sby_col_9.sby_mob_col_auto .sby_items_wrap .sby_item,
827
+ [id^=sb_youtube_].sb_youtube.sby_col_10.sby_mob_col_auto .sby_items_wrap .sby_item,
828
+ [id^=sb_youtube_].sb_youtube.sby_mob_col_1 .sby_items_wrap .sby_item{
829
+ width: 100%;
830
+ }
831
+ [id^=sb_youtube_].sb_youtube.sby_mob_col_2 .sby_items_wrap .sby_item{ width: 50%; }
832
+ [id^=sb_youtube_].sb_youtube.sby_mob_col_3 .sby_items_wrap .sby_item{ width: 33.33%; }
833
+ [id^=sb_youtube_].sb_youtube.sby_mob_col_4 .sby_items_wrap .sby_item{ width: 25%; }
834
+ [id^=sb_youtube_].sb_youtube.sby_mob_col_5 .sby_items_wrap .sby_item{ width: 20%; }
835
+ [id^=sb_youtube_].sb_youtube.sby_mob_col_6 .sby_items_wrap .sby_item{ width: 16.66%; }
836
+ [id^=sb_youtube_].sb_youtube.sby_mob_col_7 .sby_items_wrap .sby_item{ width: 14.28%; }
837
+ }
838
+
839
+ /* --- Lightbox --- */
840
+
841
+ .sby_lightboxOverlay {
842
+ position: absolute;
843
+ top: 0;
844
+ left: 0;
845
+ z-index: 99999;
846
+ background-color: black;
847
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
848
+ opacity: 0.9;
849
+ display: none;
850
+ }
851
+ .sby_lightbox {
852
+ position: absolute;
853
+ left: 0;
854
+ width: 100%;
855
+ z-index: 100000;
856
+ line-height: 0;
857
+ font-weight: normal;
858
+ }
859
+ .sby_lightbox .sby_lb-image {
860
+ display: block;
861
+ height: auto;
862
+ max-width: inherit;
863
+ -webkit-border-radius: 3px;
864
+ -moz-border-radius: 3px;
865
+ -ms-border-radius: 3px;
866
+ -o-border-radius: 3px;
867
+ border-radius: 3px;
868
+ }
869
+ .sby_lightbox a:hover,
870
+ .sby_lightbox a:focus,
871
+ .sby_lightbox a:active{
872
+ outline: none;
873
+ }
874
+ .sby_lightbox a img {
875
+ border: none;
876
+ }
877
+ .sby_lb-outerContainer {
878
+ position: relative;
879
+ background-color: #000;
880
+ *zoom: 1;
881
+ width: 250px;
882
+ height: 250px;
883
+ margin: 0 auto 5px auto;
884
+ -webkit-border-radius: 3px;
885
+ -moz-border-radius: 3px;
886
+ -ms-border-radius: 3px;
887
+ -o-border-radius: 3px;
888
+ border-radius: 3px;
889
+ }
890
+ .sby_lb-outerContainer:after {
891
+ content: "";
892
+ display: table;
893
+ clear: both;
894
+ }
895
+ .sby_lb-container {
896
+ position: relative;
897
+ padding: 4px;
898
+ top: 0;
899
+ left: 0;
900
+ width: 100%;
901
+ height: 100%;
902
+ bottom: 0;
903
+ right: 0;
904
+
905
+ -webkit-border-radius: 3px;
906
+ -moz-border-radius: 3px;
907
+ -ms-border-radius: 3px;
908
+ -o-border-radius: 3px;
909
+ border-radius: 3px;
910
+ }
911
+ .sby_lb-loader {
912
+ position: absolute;
913
+ top: 43%;
914
+ left: 0;
915
+ height: 25%;
916
+ width: 100%;
917
+ text-align: center;
918
+ line-height: 0;
919
+ }
920
+ .sby_lb-cancel {
921
+ display: block;
922
+ width: 32px;
923
+ height: 32px;
924
+ margin: 0 auto;
925
+ background-color: #666;
926
+ background-color: rgba(255,255,255,0.5);
927
+
928
+ border-radius: 100%;
929
+ -webkit-animation: ctf-sk-scaleout 1.0s infinite ease-in-out;
930
+ animation: ctf-sk-scaleout 1.0s infinite ease-in-out;
931
+ }
932
+
933
+
934
+ .sby_lb-nav {
935
+ /*position: absolute;*/
936
+ top: 0;
937
+ left: 0;
938
+ /*height: 100%;*/
939
+ width: 100%;
940
+ z-index: 10;
941
+ /*pointer-events: none;*/
942
+ }
943
+ .sby_lb-container > .nav {
944
+ left: 0;
945
+ }
946
+ .sby_lb-nav a {
947
+ position: absolute;
948
+ z-index: 100;
949
+ top: 0;
950
+ height: 90%;
951
+ outline: none;
952
+ background-image: url('data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
953
+ }
954
+
955
+
956
+ /* Arrows */
957
+ .sby_lb-prev, .sby_lb-next {
958
+ height: 100%;
959
+ cursor: pointer;
960
+ display: block;
961
+ }
962
+ .sby_lb-nav a.sby_lb-prev {
963
+ /*width: 30%;*/
964
+ width: 50px;
965
+ left: -70px;
966
+ padding-left: 10px;
967
+ padding-right: 10px;
968
+ float: left;
969
+
970
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0.5);
971
+ opacity: 0.5;
972
+ -webkit-transition: opacity 0.2s;
973
+ -moz-transition: opacity 0.2;
974
+ -o-transition: opacity 0.2s;
975
+ transition: opacity 0.2s;
976
+
977
+ }
978
+
979
+ .sby_lb-nav a.sby_lb-prev:hover {
980
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
981
+ opacity: 1;
982
+ }
983
+
984
+ .sby_lb-nav a.sby_lb-next {
985
+ /*width: 30%;*/
986
+ width: 50px;
987
+ right: -70px;
988
+ padding-left: 10px;
989
+ padding-right: 10px;
990
+ float: right;
991
+
992
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0.5);
993
+ opacity: 0.5;
994
+ -webkit-transition: opacity 0.2s;
995
+ -moz-transition: opacity 0.2s;
996
+ -o-transition: opacity 0.2s;
997
+ transition: opacity 0.2s;
998
+
999
+ }
1000
+
1001
+ .sby_lb-nav a.sby_lb-next:hover {
1002
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
1003
+ opacity: 1;
1004
+ }
1005
+
1006
+ .sby_lb-nav span{
1007
+ display: block;
1008
+ top: 55%;
1009
+ position: absolute;
1010
+ left: 20px;
1011
+ width: 34px;
1012
+ height: 45px;
1013
+ margin: -25px 0 0 0;
1014
+ background: url(../img/sby-sprite.png) no-repeat;
1015
+ }
1016
+ .sby_lb-nav a.sby_lb-prev span{
1017
+ background-position: -53px 0;
1018
+ }
1019
+ .sby_lb-nav a.sby_lb-next span{
1020
+ left: auto;
1021
+ right: 20px;
1022
+ background-position: -18px 0;
1023
+ }
1024
+
1025
+
1026
+ .sby_lb-dataContainer {
1027
+ margin: 0 auto;
1028
+ padding-top: 5px;
1029
+ *zoom: 1;
1030
+ width: 100%;
1031
+ font-family: "Open Sans", Helvetica, Arial, sans-serif;
1032
+
1033
+ -moz-border-radius-bottomleft: 4px;
1034
+ -webkit-border-bottom-left-radius: 4px;
1035
+ border-bottom-left-radius: 4px;
1036
+ -moz-border-radius-bottomright: 4px;
1037
+ -webkit-border-bottom-right-radius: 4px;
1038
+ border-bottom-right-radius: 4px;
1039
+ }
1040
+ .sby_lb-dataContainer:after {
1041
+ content: "";
1042
+ display: table;
1043
+ clear: both;
1044
+ }
1045
+ .sby_lb-data {
1046
+ padding: 0 4px;
1047
+ color: #ccc;
1048
+ }
1049
+ .sby_lb-data .sby_lb-details {
1050
+ width: 85%;
1051
+ float: left;
1052
+ text-align: left;
1053
+ line-height: 1.1;
1054
+ }
1055
+ .sby_lb-data .sby_lb-caption {
1056
+ float: left;
1057
+ font-size: 13px;
1058
+ font-weight: normal;
1059
+ line-height: 1.3;
1060
+ padding-bottom: 3px;
1061
+ color: #ccc;
1062
+
1063
+ word-wrap: break-word;
1064
+ -webkit-hyphens: auto;
1065
+ -moz-hyphens: auto;
1066
+ hyphens: auto;
1067
+ }
1068
+ .sby_lb-data .sby_lb-caption a,
1069
+ .sby_lb-data .sby_lb-caption .ctf-screename-sep{
1070
+ color: #ccc;
1071
+ font-weight: bold;
1072
+ text-decoration: none;
1073
+ }
1074
+ .sby_lb-data .sby_lb-caption a:hover{
1075
+ color: #fff;
1076
+ text-decoration: underline;
1077
+ }
1078
+ .sby_lb-data .sby_lb-caption .sby_lightbox_username{
1079
+ float: left;
1080
+ width: 100%;
1081
+ color: #ccc;
1082
+ padding-bottom: 0;
1083
+ display: block;
1084
+ margin: 0 0 5px 0;
1085
+ }
1086
+ .sby_lb-data .sby_lb-caption .sby_lightbox_username{
1087
+ color: #ccc;
1088
+ }
1089
+ .sby_lb-data .sby_lb-caption .sby_lightbox_username:hover p{
1090
+ color: #fff;
1091
+ text-decoration: underline;
1092
+ }
1093
+ .sby_lightbox .sby_lightbox_username img {
1094
+ float: left;
1095
+ border: none;
1096
+ width: 48px;
1097
+ height: 48px;
1098
+ margin-right: 10px;
1099
+ background: #666;
1100
+
1101
+ -moz-border-radius: 5px;
1102
+ -webkit-border-radius: 5px;
1103
+ border-radius: 5px;
1104
+ }
1105
+ .sby_lightbox_username p{
1106
+ float: left;
1107
+ margin: 0;
1108
+ padding: 0;
1109
+ color: #ccc;
1110
+ line-height: 32px;
1111
+ font-weight: bold;
1112
+ font-size: 13px;
1113
+ text-align: left;
1114
+ }
1115
+
1116
+ .sby_lb-data .ctf-caption-text{
1117
+ width: 100%;
1118
+ margin-left: 58px;
1119
+ padding-top: 3px;
1120
+ }
1121
+ .sby_lb-data .sby_lb-caption .ctf-tweet-date,
1122
+ .sby_lb-data .sby_lb-caption .ctf-author-screenname{
1123
+ font-weight: normal;
1124
+ }
1125
+ .sby_lb-data .sby_lb-info{
1126
+ width: 100%;
1127
+ float: left;
1128
+ clear: both;
1129
+ }
1130
+ .sby_lb-data .sby_lb-number {
1131
+ display: block;
1132
+ float: left;
1133
+ clear: both;
1134
+ padding: 5px 0 15px 0;
1135
+ font-size: 12px;
1136
+ color: #999999;
1137
+ }
1138
+ .sby_lb-data .sby_lb-close {
1139
+ display: block;
1140
+ float: right;
1141
+ width: 30px;
1142
+ height: 30px;
1143
+ background: url(../img/close.png) top right no-repeat;
1144
+ text-align: right;
1145
+ outline: none;
1146
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70);
1147
+ opacity: 0.7;
1148
+ -webkit-transition: opacity 0.2s;
1149
+ -moz-transition: opacity 0.2s;
1150
+ -o-transition: opacity 0.2s;
1151
+ transition: opacity 0.2s;
1152
+ }
1153
+ .sby_lb-data .sby_lb-close:hover {
1154
+ cursor: pointer;
1155
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
1156
+ opacity: 1;
1157
+ }
1158
+
1159
+ /* Lightbox video - must go after lighbox CSS */
1160
+ /* Leave a gap at the bottom of the nav for video controls */
1161
+ .sby_lb-nav {
1162
+ height: auto;
1163
+ }
1164
+ /* Remove 4px padding from lightbox container so video lines up */
1165
+ .sby_lb-container{
1166
+ padding: 0;
1167
+ }
1168
+ .sby_lb-container iframe {
1169
+ position: absolute;
1170
+ top: 0;
1171
+ left:0;
1172
+ width: 100%;
1173
+ height: 100%;
1174
+ z-index: 1;
1175
+ }
1176
+ /* Lightbox action links */
1177
+ #sby_lightbox .sby_lightbox_action{
1178
+ float: left;
1179
+ /*clear: both;*/
1180
+ position: relative;
1181
+ padding: 0 0 0 10px;
1182
+ margin: 5px 0 0 10px;
1183
+ border-left: 1px solid #666;
1184
+ font-size: 12px;
1185
+ }
1186
+ #sby_lightbox .sby_lightbox_action a{
1187
+ display: block;
1188
+ float: left;
1189
+ color: #999;
1190
+ text-decoration: none;
1191
+ }
1192
+ #sby_lightbox .sby_lightbox_action a:hover,
1193
+ #sby_lightbox .sby_lightbox_action a:focus{
1194
+ color: #fff;
1195
+ }
1196
+ #sby_lightbox .sby_lightbox_action .fa,
1197
+ #sby_lightbox .sby_lightbox_action svg {
1198
+ margin-right: 5px;
1199
+ }
1200
+ #sby_lightbox .sby_lightbox_action.sby_youtube .fa {
1201
+ font-size: 13px;
1202
+ }
1203
+ #sby_lightbox .sby_tooltip_social a svg {
1204
+ font-size: 19px;
1205
+ padding: 3px 4px;
1206
+ margin: auto;
1207
+ }
1208
+ /* Lightbox tooltip */
1209
+ #sby_lightbox .sby_lightbox_tooltip{
1210
+ display: none;
1211
+ position: absolute;
1212
+ width: 100px;
1213
+ bottom: 22px;
1214
+ left: 0;
1215
+ padding: 5px 10px;
1216
+ margin: 0;
1217
+ background: rgba(255,255,255,0.9);
1218
+ color: #222;
1219
+ font-size: 12px;
1220
+ line-height: 1.3;
1221
+
1222
+ -moz-border-radius: 4px;
1223
+ -webkit-border-radius: 4px;
1224
+ border-radius: 4px;
1225
+
1226
+ box-shadow: 0 0 10px rgba(0,0,0,0.4);
1227
+ -moz-box-shadow: 0 0 10px rgba(0,0,0,0.4);
1228
+ -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.4);
1229
+
1230
+ -webkit-box-sizing: border-box;
1231
+ -moz-box-sizing: border-box;
1232
+ box-sizing: border-box;
1233
+ }
1234
+ #sby_lightbox .sby_lightbox_tooltip .fa-play{
1235
+ position: absolute;
1236
+ font-size: 8px;
1237
+ bottom: -6px;
1238
+ left: 36px;
1239
+ color: rgba(255,255,255,0.9);
1240
+ }
1241
+ #sby_lightbox .sby_tooltip_social a .fa{
1242
+ font-size: 16px;
1243
+ margin: 0;
1244
+ padding: 5px;
1245
+ }
1246
+ #sby_lightbox .sby_tooltip_social a#sby_facebook_icon .fa,
1247
+ #sby_lightbox .sby_tooltip_social a#sby_twitter_icon .fa,
1248
+ #sby_lightbox .sby_tooltip_social a#sby_pinterest_icon .fa{
1249
+ padding-top: 4px;
1250
+ font-size: 18px;
1251
+ }
1252
+
1253
+ /* Hide photos tooltip */
1254
+ #sby_lightbox #sby_mod_box{
1255
+ width: 280px;
1256
+ padding: 5px 10px 7px 10px;
1257
+ }
1258
+ /* Social icons tooltip */
1259
+ #sby_lightbox .sby_tooltip_social{
1260
+ width: 172px;
1261
+ padding: 5px 5px 4px 5px;
1262
+ }
1263
+ #sby_lightbox .sby_tooltip_social a{
1264
+ color: #333;
1265
+
1266
+ -moz-border-radius: 4px;
1267
+ -webkit-border-radius: 4px;
1268
+ border-radius: 4px;
1269
+ }
1270
+ #sby_lightbox .sby_lightbox_action #sby_facebook_icon:hover{ background: #3b5998; }
1271
+ #sby_lightbox .sby_lightbox_action #sby_twitter_icon:hover{ background: #00aced; }
1272
+ #sby_lightbox .sby_lightbox_action #sby_google_icon:hover{ background: #dd4b39; }
1273
+ #sby_lightbox .sby_lightbox_action #sby_linkedin_icon:hover{ background: #007bb6; }
1274
+ #sby_lightbox .sby_lightbox_action #sby_pinterest_icon:hover{ background: #cb2027; }
1275
+ #sby_lightbox .sby_lightbox_action #sby_email_icon:hover{ background: #333; }
1276
+
1277
+ .sby_lb-outerContainer, .sby_lb-dataContainer{
1278
+ min-width: 450px;
1279
+ }
1280
+ @media all and (max-width: 450px){
1281
+ .sby_lb-outerContainer, .sby_lb-dataContainer {
1282
+ min-width: 0; /* Remove min-width on lightbox on mobile */
1283
+ }
1284
+ }
1285
+ .sby_lightbox .sby_lb-image {
1286
+ display: block;
1287
+ height: auto;
1288
+ max-width: inherit;
1289
+ margin: 0 auto;
1290
+ -webkit-border-radius: 0;
1291
+ -moz-border-radius: 0;
1292
+ -ms-border-radius: 0;
1293
+ -o-border-radius: 0;
1294
+ border-radius: 0;
1295
+ }
1296
+
1297
+ /* Mod only error msgs */
1298
+ #sby_mod_error{
1299
+ display: none;
1300
+ border: 1px solid #ddd;
1301
+ background: #eee;
1302
+ color: #333;
1303
+ margin: 10px 0 0;
1304
+ padding: 10px 15px;
1305
+ font-size: 13px;
1306
+ text-align: center;
1307
+ clear: both;
1308
+ margin-bottom: 10px;
1309
+
1310
+ -moz-border-radius: 4px;
1311
+ -webkit-border-radius: 4px;
1312
+ border-radius: 4px;
1313
+ }
1314
+ #sby_mod_error p{
1315
+ padding: 5px 0 !important;
1316
+ margin: 0 !important;
1317
+ line-height: 1.3 !important;
1318
+ }
1319
+ #sby_mod_error ol,
1320
+ #sby_mod_error ul{
1321
+ padding: 5px 0 5px 20px !important;
1322
+ margin: 0 !important;
1323
+ }
1324
+ #sby_mod_error li{
1325
+ padding: 1px 0 !important;
1326
+ margin: 0 !important;
1327
+ }
1328
+ #sby_mod_error span{
1329
+ font-size: 12px;
1330
+ }
1331
+
1332
+ /* SVGs */
1333
+ [id^=sb_youtube_].sb_youtube svg:not(:root).svg-inline--fa,
1334
+ [id^=sb_youtube_].sb_youtube_lightbox svg:not(:root).svg-inline--fa{
1335
+ box-sizing: unset;
1336
+ overflow: visible;
1337
+ width: 1em;
1338
+ }
1339
+ [id^=sb_youtube_].sb_youtube .svg-inline--fa.fa-w-16,
1340
+ [id^=sb_youtube_].sb_youtube .svg-inline--fa.fa-w-16{
1341
+ width: 16px;
1342
+ }
1343
+ [id^=sb_youtube_].sb_youtube .svg-inline--fa,
1344
+ [id^=sb_youtube_].sb_youtube_lightbox .svg-inline--fa{
1345
+ display: inline-block;
1346
+ font-size: inherit;
1347
+ height: 1em;
1348
+ overflow: visible;
1349
+ vertical-align: -.125em;
1350
+ }
1351
+
1352
+ [id^=sb_youtube_].sb_youtube.sby_player_loaded .sby_player_outer_wrap .sby_video_thumbnail,
1353
+ [id^=sb_youtube_].sb_youtube.sby_player_loaded.sby_layout_list .sby_video_thumbnail{
1354
+ z-index: -1 !important;
1355
+ }
trunk/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 *{-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}#sby_lightbox iframe,[id^=sb_youtube_].sb_youtube iframe{pointer-events:all!important}[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_thumbnail_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_thumbnail_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_thumbnail_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_thumbnail_hover{opacity:0;display:none;transition:none;-moz-transition:none;-webkit-transition:none}[id^=sb_youtube_].sb_youtube .sby_video_thumbnail:hover .sby_play_btn{opacity:.5}[id^=sb_youtube_].sb_youtube .sby_play_btn{position:absolute;z-index:1;left:50%;bottom:50%;top:50%;right:50%;margin-top:-25px;margin-left:-28px;color:#fff;width:57px;height:50px;opacity:1;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_play_btn_bg{display:block;position:absolute;z-index:-1;top:17px;left:22px;width:0;height:0;border:0 solid transparent;border-bottom-width:9px;border-top-width:9px;border-left:16px solid #fff}[id^=sb_youtube_].sb_youtube .sby_play_btn svg:not(:root).svg-inline--fa{width:57px;height:auto;opacity:.75}[id^=sb_youtube_].sb_youtube .sby_play_btn i,[id^=sb_youtube_].sb_youtube .sby_play_btn svg{color:#000}[id^=sb_youtube_].sb_youtube.sby_medium .sby_play_btn{margin-top:-20px;margin-left:-22px;width:45px;height:40px}[id^=sb_youtube_].sb_youtube.sby_medium .sby_play_btn_bg{top:13px;left:18px;border-bottom-width:7px;border-top-width:7px;border-left:12px solid #fff}[id^=sb_youtube_].sb_youtube.sby_medium .sby_play_btn svg:not(:root).svg-inline--fa{width:45px}[id^=sb_youtube_].sb_youtube.sby_small .sby_play_btn{margin-top:-16px;margin-left:-18px;width:36px;height:32px}[id^=sb_youtube_].sb_youtube.sby_small .sby_play_btn_bg{top:10px;left:14px;border-bottom-width:6px;border-top-width:6px;border-left:10px solid #fff}[id^=sb_youtube_].sb_youtube.sby_small .sby_play_btn svg:not(:root).svg-inline--fa{width:36px}[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 .sb_youtube_header br,[id^=sb_youtube_].sb_youtube .sby_footer br,[id^=sb_youtube_].sb_youtube .sby_items_wrap 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:99999;background-color:#000;opacity:.9;display:none}.sby_lightbox{position:absolute;left:0;width:100%;z-index:100000;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;-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;background-image:url(data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==)}.sby_lb-next,.sby_lb-prev{height:100%;cursor:pointer;display:block}.sby_lb-nav a.sby_lb-prev{width:50px;left:-70px;padding-left:10px;padding-right:10px;float:left;opacity:.5;-webkit-transition:opacity .2s;-moz-transition:opacity .2;-o-transition:opacity .2s;transition:opacity .2s}.sby_lb-nav a.sby_lb-prev:hover{opacity:1}.sby_lb-nav a.sby_lb-next{width:50px;right:-70px;padding-left:10px;padding-right:10px;float:right;opacity:.5;-webkit-transition:opacity .2s;-moz-transition:opacity .2s;-o-transition:opacity .2s;transition:opacity .2s}.sby_lb-nav a.sby_lb-next:hover{opacity:1}.sby_lb-nav span{display:block;top:55%;position:absolute;left:20px;width:34px;height:45px;margin:-25px 0 0 0;background:url(../img/sby-sprite.png) no-repeat}.sby_lb-nav a.sby_lb-prev span{background-position:-53px 0}.sby_lb-nav a.sby_lb-next span{left:auto;right:20px;background-position:-18px 0}.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;margin-bottom:10px;-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}[id^=sb_youtube_].sb_youtube.sby_player_loaded .sby_player_outer_wrap .sby_video_thumbnail,[id^=sb_youtube_].sb_youtube.sby_player_loaded.sby_layout_list .sby_video_thumbnail{z-index:-1!important}
trunk/css/sby-blocks.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .sb_youtube {
2
+ pointer-events: none !important;
3
+ }
trunk/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
+ }
trunk/img/balloon.png ADDED
Binary file
trunk/img/carousel.png ADDED
Binary file
trunk/img/close.png ADDED
Binary file
trunk/img/gallery.png ADDED
Binary file
trunk/img/grid.png ADDED
Binary file
trunk/img/lightbox-placeholder-narrow.png ADDED
Binary file
trunk/img/lightbox-placeholder.png ADDED
Binary file
trunk/img/list.png ADDED
Binary file
trunk/img/next.png ADDED
Binary file
trunk/img/placeholder-narrow.png ADDED
Binary file
trunk/img/placeholder.png ADDED
Binary file
trunk/img/prev.png ADDED
Binary file
trunk/img/pro.png ADDED
Binary file
{img → trunk/img}/sby-icon-offer.png RENAMED
File without changes
trunk/img/sby-icon.png ADDED
Binary file
trunk/img/sby-sprite.png ADDED
Binary file
trunk/img/smash-balloon-logo-small.png ADDED
Binary file
trunk/inc/admin/admin-functions.php ADDED
@@ -0,0 +1,1007 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ $first_connected = sby_get_first_connected_account();
56
+ $first_channel_id = isset( $first_connected['channel_id'] ) ? $first_connected['channel_id'] : '';
57
+
58
+ $types = array(
59
+ array(
60
+ 'slug' => 'channel',
61
+ 'label' => __( 'Channel', SBY_TEXT_DOMAIN ),
62
+ 'input_type' => 'text',
63
+ 'default' => $first_channel_id,
64
+ 'note' => __( 'Eg: Channel ID or User Name', SBY_TEXT_DOMAIN ),
65
+ 'example' => 'smashballoon',
66
+ 'description' => __( 'Display videos from a YouTube channel (channel)', SBY_TEXT_DOMAIN ),
67
+ 'tooltip' => '<p>' . __( 'Enter any channel ID or user name to display all of an accounts latest videos starting with the most recently published.', SBY_TEXT_DOMAIN ) . '</p><p><ul>
68
+ <li><b>' . __( 'Channel ID or User Name', SBY_TEXT_DOMAIN ).'</b><br>
69
+ ' . __( '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>
70
+ ' . __( 'URL Format 1:', SBY_TEXT_DOMAIN ).' <code>https://www.youtube.com/channel/<span class="sbspf-highlight">UC1a2b3c4D5F6g7i8j9k</span></code>
71
+ <br>
72
+ ' . __( 'URL Format 2:', SBY_TEXT_DOMAIN ).' <code>https://www.youtube.com/user/<span class="sbspf-highlight">your_user_name</span></code>
73
+ </li>
74
+ </ul></p>'
75
+ ),
76
+ array(
77
+ 'slug' => 'playlist',
78
+ 'label' => __( 'Playlist', SBY_TEXT_DOMAIN ),
79
+ 'input_type' => 'text',
80
+ 'default' => '',
81
+ 'pro' => true,
82
+ 'note' => __( 'Eg: Playlist ID', SBY_TEXT_DOMAIN ),
83
+ 'example' => 'PLLLm1a2b3c4D6g7i8j9k_1a',
84
+ 'description' => __( 'Display videos from a specific playlist (playlist)', SBY_TEXT_DOMAIN ),
85
+ 'tooltip' => '<p>' . __( 'Enter any playlist ID to display videos from a playlist starting with the most recently published.', SBY_TEXT_DOMAIN ) . '</p><p><ul>
86
+ <li><b>' . __( 'Playlist ID', SBY_TEXT_DOMAIN ).'</b><br>
87
+ ' . __( 'You can find the ID of your YouTube playlist from the URL. The text you need to use is highlighted below:', SBY_TEXT_DOMAIN ).'<br><br>
88
+ <code>https://www.youtube.com/playlist?list=<span class="sbspf-highlight">PLLLm1a2b3c4D6g7i8j9k_1a2b3c4D57i8j9k</span></code>
89
+ </li>
90
+ </ul></p>'
91
+ ),
92
+ array(
93
+ 'slug' => 'favorites',
94
+ 'label' => __( 'Favorites', SBY_TEXT_DOMAIN ),
95
+ 'input_type' => 'text',
96
+ 'default' => '',
97
+ 'pro' => true,
98
+ 'note' => __( 'Eg: Channel ID or User Name', SBY_TEXT_DOMAIN ),
99
+ 'example' => 'smashballoon',
100
+ 'description' => __( 'Display the "favorites" playlist for a channel (favorites)', SBY_TEXT_DOMAIN ),
101
+ 'tooltip' => '<p>' . __( 'Displays all videos marked as "favorites" by a YouTube account starting with the most recently published.', SBY_TEXT_DOMAIN ) . '</p><p><ul>
102
+ <li><b>' . __( 'Channel ID or User Name', SBY_TEXT_DOMAIN ).'</b><br>
103
+ ' . __( '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>
104
+ ' . __( 'URL Format 1:', SBY_TEXT_DOMAIN ).' <code>https://www.youtube.com/channel/<span class="sbspf-highlight">UC1a2b3c4D5F6g7i8j9k</span></code>
105
+ <br>
106
+ ' . __( 'URL Format 2:', SBY_TEXT_DOMAIN ).' <code>https://www.youtube.com/user/<span class="sbspf-highlight">your_user_name</span></code>
107
+ </li>
108
+ </ul></p>'
109
+ ),
110
+ array(
111
+ 'slug' => 'search',
112
+ 'label' => __( 'Search', SBY_TEXT_DOMAIN ),
113
+ 'input_type' => 'text',
114
+ 'default' => '',
115
+ 'pro' => true,
116
+ 'note' => __( 'Eg: Search Term', SBY_TEXT_DOMAIN ),
117
+ 'example' => 'cats',
118
+ 'description' => __( 'Display a feed of matching search results (search)', SBY_TEXT_DOMAIN ),
119
+ 'tooltip' => '<p>' . __( 'Enter any search term or phrase. Separate multiple terms with commas. You can add your own additional query vars using the <a href="https://smashballoon.com/youtube-feed/custom-search-guide/" target="_blank" rel="noopener">guide on our website</a> and the input field above.', SBY_TEXT_DOMAIN ) . '</p>',
120
+ ),
121
+ array(
122
+ 'slug' => 'live',
123
+ 'label' => __( 'Live Streams', SBY_TEXT_DOMAIN ),
124
+ 'input_type' => 'text',
125
+ 'default' => '',
126
+ 'pro' => true,
127
+ 'note' => __( 'Eg: Channel ID', SBY_TEXT_DOMAIN ),
128
+ 'example' => 'UC1a2b3c4D5F6g7i8j9k',
129
+ 'description' => __( 'Display upcoming and currently playing live streams (live)', SBY_TEXT_DOMAIN ),
130
+ 'tooltip' => '<p>' . __( 'Displays upcoming and currently playing live streaming videos sorted by soonest scheduled broadcast.', SBY_TEXT_DOMAIN ) . '</p><p><ul>
131
+ <li><b>' . __( 'Channel ID', SBY_TEXT_DOMAIN ).'</b><br>
132
+ ' . __( 'You can find the ID of your YouTube Channel from the URL. The text you need to use is highlighted below:', SBY_TEXT_DOMAIN ).'<br><br>
133
+ <code>https://www.youtube.com/channel/<span class="sbspf-highlight">UC1a2b3c4D5F6g7i8j9k</span></code>
134
+ </li>
135
+ </ul></p>'
136
+ )
137
+ );
138
+ $admin->set_feed_types( $types );
139
+
140
+ $text_domain = SBY_TEXT_DOMAIN;
141
+ /* Layout */
142
+ $layouts = array(
143
+ array(
144
+ 'slug' => 'grid',
145
+ 'label' => __( 'Grid', $text_domain ),
146
+ 'image' => 'img/grid.png',
147
+ 'note' => __( 'Video thumbnails are displayed in columns and play in a lightbox when clicked.', $text_domain ),
148
+ 'options' => array(
149
+ array(
150
+ 'name' => 'cols',
151
+ 'callback' => 'select',
152
+ 'label' => __( 'Columns', $text_domain ),
153
+ 'min' => 1,
154
+ 'max' => 7,
155
+ 'default' => 3,
156
+ 'shortcode' => array(
157
+ 'example' => '3',
158
+ 'description' => __( 'Videos in carousel when 480px screen width or less.', $text_domain ),
159
+ )
160
+ ),
161
+ array(
162
+ 'name' => 'colsmobile',
163
+ 'callback' => 'select',
164
+ 'label' => __( 'Mobile Columns', $text_domain ),
165
+ 'min' => 1,
166
+ 'max' => 2,
167
+ 'default' => 2,
168
+ 'shortcode' => array(
169
+ 'example' => '2',
170
+ 'description' => __( 'Columns when 480px screen width or less.', $text_domain ),
171
+ )
172
+ ),
173
+ )
174
+ ),
175
+ array(
176
+ 'slug' => 'gallery',
177
+ 'label' => __( 'Gallery', $text_domain ),
178
+ 'image' => 'img/gallery.png',
179
+ 'note' => __( 'One large video that plays when clicked with thumbnails underneath to play more.', $text_domain ),
180
+ 'options' => array(
181
+ array(
182
+ 'name' => 'cols',
183
+ 'callback' => 'select',
184
+ 'label' => __( 'Columns', $text_domain ),
185
+ 'min' => 1,
186
+ 'max' => 7,
187
+ 'default' => 3,
188
+ 'shortcode' => array(
189
+ 'example' => '3',
190
+ 'description' => __( 'Videos in carousel when 480px screen width or less.', $text_domain ),
191
+ )
192
+ ),
193
+ array(
194
+ 'name' => 'colsmobile',
195
+ 'callback' => 'select',
196
+ 'label' => __( 'Mobile Columns', $text_domain ),
197
+ 'min' => 1,
198
+ 'max' => 2,
199
+ 'default' => 2,
200
+ 'shortcode' => array(
201
+ 'example' => '2',
202
+ 'description' => __( 'Columns when 480px screen width or less.', $text_domain ),
203
+ )
204
+ ),
205
+ )
206
+ ),
207
+ array(
208
+ 'slug' => 'list',
209
+ 'label' => __( 'List', $text_domain ),
210
+ 'image' => 'img/list.png',
211
+ 'note' => __( 'A single columns of videos that play when clicked.', $text_domain ),
212
+ ),
213
+ array(
214
+ 'slug' => 'carousel',
215
+ 'label' => __( 'Carousel', $text_domain ),
216
+ 'image' => 'img/carousel.png',
217
+ 'note' => __( 'Posts are displayed in a slideshow carousel.', $text_domain ),
218
+ 'pro' => true,
219
+ 'options' => array(
220
+ array(
221
+ 'name' => 'cols',
222
+ 'callback' => 'select',
223
+ 'label' => __( 'Columns', $text_domain ),
224
+ 'min' => 1,
225
+ 'max' => 7,
226
+ 'default' => 3,
227
+ 'shortcode' => array(
228
+ 'example' => '3',
229
+ 'description' => __( 'Videos in carousel when 480px screen width or less.', $text_domain ),
230
+ )
231
+ ),
232
+ array(
233
+ 'name' => 'colsmobile',
234
+ 'callback' => 'select',
235
+ 'label' => __( 'Mobile Columns', $text_domain ),
236
+ 'min' => 1,
237
+ 'max' => 2,
238
+ 'default' => 2,
239
+ 'shortcode' => array(
240
+ 'example' => '2',
241
+ 'description' => __( 'Columns when 480px screen width or less.', $text_domain ),
242
+ ) ),
243
+ array(
244
+ 'name' => 'rows',
245
+ 'callback' => 'select',
246
+ 'label' => __( 'Number of Rows', $text_domain ),
247
+ 'min' => 1,
248
+ 'max' => 2,
249
+ 'default' => 1,
250
+ 'shortcode' => array(
251
+ 'example' => '2',
252
+ 'description' => __( 'Choose 2 rows to show two posts in a single slide.', $text_domain ),
253
+ )
254
+ ),
255
+ array(
256
+ 'name' => 'loop',
257
+ 'callback' => 'select',
258
+ 'label' => __( 'Loop Type', $text_domain ),
259
+ 'options' => array(
260
+ array(
261
+ 'label' => __( 'Rewind', $text_domain ),
262
+ 'value' => 'rewind'
263
+ ),
264
+ array(
265
+ 'label' => __( 'Infinity', $text_domain ),
266
+ 'value' => 'infinity'
267
+ )
268
+ ),
269
+ 'default' => 'rewind',
270
+ 'shortcode' => array(
271
+ 'example' => 'infinity',
272
+ 'description' => __( 'What happens when the last slide is reached.', $text_domain ),
273
+ )
274
+ ),
275
+ array(
276
+ 'name' => 'arrows',
277
+ 'callback' => 'checkbox',
278
+ 'label' => __( 'Show Navigation Arrows', $text_domain ),
279
+ 'default' => true,
280
+ 'shortcode' => array(
281
+ 'example' => 'false',
282
+ 'description' => __( 'Show arrows on the sides to navigate posts.', $text_domain ),
283
+ )
284
+ ),
285
+ array(
286
+ 'name' => 'pag',
287
+ 'callback' => 'checkbox',
288
+ 'label' => __( 'Show Pagination', $text_domain ),
289
+ 'default' => true,
290
+ 'shortcode' => array(
291
+ 'example' => 'false',
292
+ 'description' => __( 'Show dots below carousel for an ordinal indication of which slide is being shown.', $text_domain ),
293
+ )
294
+ ),
295
+ array(
296
+ 'name' => 'autoplay',
297
+ 'callback' => 'checkbox',
298
+ 'label' => __( 'Enable Autoplay', $text_domain ),
299
+ 'default' => false,
300
+ 'shortcode' => array(
301
+ 'example' => 'true',
302
+ 'description' => __( 'Whether or not to change slides automatically on an interval.', $text_domain ),
303
+ )
304
+ ),
305
+ array(
306
+ 'name' => 'time',
307
+ 'callback' => 'text',
308
+ 'label' => __( 'Interval Time', $text_domain ),
309
+ 'default' => 5000,
310
+ 'shortcode' => array(
311
+ 'example' => '3000',
312
+ 'description' => __( 'Duration in milliseconds before the slide changes.', $text_domain ),
313
+ )
314
+ ),
315
+ )
316
+ ),
317
+
318
+ );
319
+ $admin->set_feed_layouts( $layouts );
320
+
321
+ $display_your_feed_table_headings = array(
322
+ array(
323
+ 'slug' => 'configure',
324
+ 'label' => __( 'Configure Options', SBY_TEXT_DOMAIN ),
325
+ ),
326
+ array(
327
+ 'slug' => 'customize',
328
+ 'label' => __( 'Customize Options', SBY_TEXT_DOMAIN ),
329
+ ),
330
+ array(
331
+ 'slug' => 'layout',
332
+ 'label' => __( 'Layout Options', SBY_TEXT_DOMAIN ),
333
+ ),
334
+ array(
335
+ 'slug' => 'experience',
336
+ 'label' => __( 'Video Experience Options', SBY_TEXT_DOMAIN ),
337
+ ),
338
+ array(
339
+ 'slug' => 'header',
340
+ 'label' => __( 'Header Options', SBY_TEXT_DOMAIN ),
341
+ ),
342
+ array(
343
+ 'slug' => 'button',
344
+ 'label' => __( '"Load More" Button Options', SBY_TEXT_DOMAIN ),
345
+ ),
346
+ array(
347
+ 'slug' => 'subscribe',
348
+ 'label' => __( '"Subscribe" Button Options', SBY_TEXT_DOMAIN ),
349
+ )
350
+ );
351
+ $admin->set_display_table_sections( $display_your_feed_table_headings );
352
+
353
+ $admin->init();
354
+ }
355
+
356
+ function sby_admin_style() {
357
+ wp_enqueue_style( SBY_SLUG . '_admin_notices_css', SBY_PLUGIN_URL . 'css/sby-notices.css', array(), SBYVER );
358
+ if ( ! sby_is_admin_page() ) {
359
+ return;
360
+ }
361
+ wp_enqueue_style( SBY_SLUG . '_admin_css', SBY_PLUGIN_URL . 'css/admin.css', array(), SBYVER );
362
+ wp_enqueue_style( 'sb_font_awesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' );
363
+ wp_enqueue_style( 'wp-color-picker' );
364
+ }
365
+ add_action( 'admin_enqueue_scripts', 'sby_admin_style' );
366
+
367
+ function sby_admin_scripts() {
368
+ if ( ! sby_is_admin_page() ) {
369
+ return;
370
+ }
371
+ wp_enqueue_script( SBY_SLUG . '_admin_js', SBY_PLUGIN_URL . 'js/admin.js', array(), SBYVER );
372
+ wp_localize_script( SBY_SLUG . '_admin_js', 'sbspf', array(
373
+ 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
374
+ 'nonce' => wp_create_nonce( 'sbspf_nonce' )
375
+ )
376
+ );
377
+ wp_enqueue_script('wp-color-picker' );
378
+ }
379
+ add_action( 'admin_enqueue_scripts', 'sby_admin_scripts' );
380
+
381
+ function sby_is_admin_page() {
382
+ if ( ! isset( $_GET['page'] ) ) {
383
+ return false;
384
+ } elseif ( strpos( sanitize_text_field( $_GET['page'] ), SBY_SLUG ) !== false ) {
385
+ return true;
386
+ }
387
+ return false;
388
+ }
389
+
390
+ function sby_admin_icon( $icon, $class = '' ) {
391
+ $class = ! empty( $class ) ? ' ' . $class : '';
392
+ if ( $icon === 'question-circle' ) {
393
+ 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>';
394
+ } elseif ( $icon === 'info-circle' ) {
395
+ 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>';
396
+ } elseif ( $icon === 'life-ring' ) {
397
+ 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>';
398
+ } elseif ( $icon === 'envelope' ) {
399
+ 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>';
400
+ } elseif ( $icon === 'chevron-right' ) {
401
+ 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>';
402
+ } elseif ( $icon === 'rocket' ) {
403
+ 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>';
404
+ } elseif ( $icon === 'minus-circle' ) {
405
+ 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>';
406
+ } elseif ( $icon === 'times' ) {
407
+ 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>';
408
+ } elseif ( $icon === 'cog' ) {
409
+ 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>';
410
+ } elseif ( $icon === 'ellipsis' ) {
411
+ 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>';
412
+ } else {
413
+ sby_icon( $icon );
414
+ }
415
+ }
416
+
417
+ function sby_delete_connected_account() {
418
+ if ( ! isset( $_POST['sbspf_nonce'] ) || ! isset( $_POST['account_id']) ) return;
419
+ $nonce = $_POST['sbspf_nonce'];
420
+ if ( ! wp_verify_nonce( $nonce, 'sbspf_nonce' ) ) {
421
+ die ( 'You did not do this the right way!' );
422
+ }
423
+
424
+ global $sby_settings;
425
+
426
+ $account_id = sanitize_text_field( $_POST['account_id'] );
427
+ $to_save = array();
428
+
429
+ foreach ( $sby_settings['connected_accounts'] as $connected_account ) {
430
+ if ( (string)$connected_account['channel_id'] !== (string)$account_id ) {
431
+ $to_save[ $connected_account['channel_id'] ] = $connected_account;
432
+ }
433
+ }
434
+
435
+ $sby_settings['connected_accounts'] = $to_save;
436
+ update_option( 'sby_settings', $sby_settings );
437
+
438
+ echo wp_json_encode( array( 'success' => true ) );
439
+
440
+ die();
441
+ }
442
+ add_action( 'wp_ajax_sby_ca_after_remove_clicked', 'sby_delete_connected_account' );
443
+
444
+ function sby_process_access_token() {
445
+ if ( ! isset( $_POST['sbspf_nonce'] ) || ! isset( $_POST['sby_access_token'] ) ) return;
446
+ $nonce = $_POST['sbspf_nonce'];
447
+ if ( ! wp_verify_nonce( $nonce, 'sbspf_nonce' ) ) {
448
+ die ( 'You did not do this the right way!' );
449
+ }
450
+
451
+ $account = sby_attempt_connection();
452
+
453
+ if ( $account ) {
454
+ global $sby_settings;
455
+
456
+ $options = $sby_settings;
457
+ $username = $account['username'] ? $account['username'] : $account['channel_id'];
458
+ if ( isset( $account['local_avatar'] ) && $account['local_avatar'] && isset( $options['favorlocal'] ) && $options['favorlocal' ] === 'on' ) {
459
+ $upload = wp_upload_dir();
460
+ $resized_url = trailingslashit( $upload['baseurl'] ) . trailingslashit( SBY_UPLOADS_NAME );
461
+ $profile_picture = '<img class="sbspf_ca_avatar" src="'.$resized_url . $account['username'].'.jpg" />'; //Could add placeholder avatar image
462
+ } else {
463
+ $profile_picture = $account['profile_picture'] ? '<img class="sbspf_ca_avatar" src="'.$account['profile_picture'].'" />' : ''; //Could add placeholder avatar image
464
+ }
465
+
466
+ $text_domain = SBY_TEXT_DOMAIN;
467
+ $slug = SBY_SLUG;
468
+ ob_start();
469
+ include trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/templates/single-connected-account.php';
470
+ if ( sby_notice_not_dismissed() ) {
471
+ include trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/templates/modal.php';
472
+ echo '<span class="sby_account_just_added"></span>';
473
+ }
474
+
475
+ $html = ob_get_contents();
476
+ ob_get_clean();
477
+
478
+ $return = array(
479
+ 'account_id' => $account['channel_id'],
480
+ 'html' => $html
481
+ );
482
+ } else {
483
+ $return = array(
484
+ 'error' => __( 'Could not connect your account. Please check to make sure this is a valid access token for the Smash Balloon YouTube App.'),
485
+ 'html' => ''
486
+ );
487
+ }
488
+
489
+ echo wp_json_encode( $return );
490
+
491
+ die();
492
+ }
493
+ add_action( 'wp_ajax_sby_process_access_token', 'sby_process_access_token' );
494
+
495
+ function sby_delete_wp_posts() {
496
+ if ( ! isset( $_POST['sbspf_nonce'] ) ) return;
497
+ $nonce = $_POST['sbspf_nonce'];
498
+ if ( ! wp_verify_nonce( $nonce, 'sbspf_nonce' ) ) {
499
+ die ( 'You did not do this the right way!' );
500
+ }
501
+
502
+ sby_clear_wp_posts();
503
+
504
+ echo '{}';
505
+
506
+ die();
507
+ }
508
+ add_action( 'wp_ajax_sby_delete_wp_posts', 'sby_delete_wp_posts' );
509
+
510
+ function sby_attempt_connection() {
511
+ if ( ! current_user_can( 'manage_youtube_feed_options' ) ) {
512
+ return false;
513
+ }
514
+ if ( isset( $_GET['sby_access_token'] ) ) {
515
+ $access_token = sanitize_text_field( urldecode( $_GET['sby_access_token'] ) );
516
+ $refresh_token = '';
517
+ } else {
518
+ $access_token = sanitize_text_field( $_POST['sby_access_token'] );
519
+ $refresh_token = '';
520
+ }
521
+
522
+ $account_info = array(
523
+ 'access_token' => $access_token,
524
+ 'refresh_token' => $refresh_token
525
+ );
526
+ $sby_api_connect = new SBY_API_Connect( $account_info, 'tokeninfo' );
527
+ $sby_api_connect->connect();
528
+
529
+ $data = $sby_api_connect->get_data();
530
+
531
+ if ( isset( $data['audience'] ) ) {
532
+ $expires = $data['expires_in'] + time();
533
+ $sby_api_connect = new SBY_API_Connect( $account_info, 'channels' );
534
+ $sby_api_connect->connect();
535
+ $data = $sby_api_connect->get_data();
536
+
537
+ if ( isset( $data['items'] ) ) {
538
+ $account_info['username'] = $data['items'][0]['snippet']['title'];
539
+ $account_info['channel_id'] = $data['items'][0]['id'];
540
+ $account_info['profile_picture'] = $data['items'][0]['snippet']['thumbnails']['default']['url'];
541
+ $account_info['privacy'] = '';
542
+ $account_info['expires'] = $expires;
543
+ //privacyStatus
544
+ SBY_Admin::connect_account( $account_info );
545
+
546
+ return $account_info;
547
+ }
548
+ }
549
+ return false;
550
+ }
551
+
552
+ function sbspf_account_search() {
553
+ if ( ! isset( $_POST['sbspf_nonce'] ) || ! isset( $_POST['term']) ) return;
554
+ $nonce = $_POST['sbspf_nonce'];
555
+ if ( ! wp_verify_nonce( $nonce, 'sbspf_nonce' ) ) {
556
+ die ( 'You did not do this the right way!' );
557
+ }
558
+
559
+ global $sby_settings;
560
+
561
+ $term = sanitize_text_field( $_POST['term'] );
562
+ $params = array(
563
+ 'q' => $term,
564
+ 'type' => 'channel'
565
+ );
566
+
567
+ $connected_account_for_term = array();
568
+ foreach ( $sby_settings['connected_accounts'] as $connected_account ) {
569
+ $connected_account_for_term = $connected_account;
570
+ }
571
+ if ( $connected_account_for_term['expires'] < time() + 5 ) {
572
+ $new_token_data = SBY_API_Connect::refresh_token( sby_get_account_bottom(), $connected_account_for_term['refresh_token'], sby_get_account_top() );
573
+
574
+ if ( isset( $new_token_data['access_token'] ) ) {
575
+ $connected_account_for_term['access_token'] = $new_token_data['access_token'];
576
+ $connected_accounts_for_feed[ $term ]['access_token'] = $new_token_data['access_token'];
577
+ $connected_account_for_term['expires'] = $new_token_data['expires_in'] + time();
578
+ $connected_accounts_for_feed[ $term ]['expires'] = $new_token_data['expires_in'] + time();
579
+
580
+ sby_update_or_connect_account( $connected_account_for_term );
581
+
582
+ }
583
+ }
584
+
585
+ $search = new SBY_API_Connect( $connected_account_for_term, 'search', $params );
586
+
587
+ $search->connect();
588
+
589
+
590
+ echo wp_json_encode( $search->get_data() );
591
+
592
+ die();
593
+ }
594
+ add_action( 'wp_ajax_sbspf_account_search', 'sbspf_account_search' );
595
+
596
+ function sby_reset_cron( $settings ) {
597
+ $sbi_caching_type = isset( $settings['caching_type'] ) ? $settings['caching_type'] : '';
598
+ $sbi_cache_cron_interval = isset( $settings['cache_cron_interval'] ) ? $settings['cache_cron_interval'] : '';
599
+ $sbi_cache_cron_time = isset( $settings['cache_cron_time'] ) ? $settings['cache_cron_time'] : '';
600
+ $sbi_cache_cron_am_pm = isset( $settings['cache_cron_am_pm'] ) ? $settings['cache_cron_am_pm'] : '';
601
+
602
+ if ( $sbi_caching_type === 'background' ) {
603
+ delete_option( 'sby_cron_report' );
604
+ SBY_Cron_Updater::start_cron_job( $sbi_cache_cron_interval, $sbi_cache_cron_time, $sbi_cache_cron_am_pm );
605
+ }
606
+ }
607
+ add_action( 'sby_settings_after_configure_save', 'sby_reset_cron', 10, 1 );
608
+
609
+ function sby_maybe_start_cron_clear_cache( $settings ) {
610
+ $sby_doing_cron_clear = isset( $settings['cronclear'] ) ? $settings['cronclear'] : false;
611
+
612
+ if ( $sby_doing_cron_clear ) {
613
+ wp_clear_scheduled_hook( 'sby_cron_job' );
614
+
615
+ wp_schedule_event( time(), 'hourly', 'sby_cron_job' );
616
+ }
617
+ }
618
+ add_action( 'sby_settings_after_customize_save', 'sby_maybe_start_cron_clear_cache', 10, 1 );
619
+
620
+ function sby_clear_wp_posts() {
621
+
622
+ global $wpdb;
623
+
624
+ $youtube_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type = '".SBY_CPT."';" );
625
+
626
+ $id_string = implode( ', ', $youtube_ids );
627
+ if ( ! empty( $id_string ) ) {
628
+ $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE post_id IN ($id_string);" );
629
+ $wpdb->query( "DELETE FROM $wpdb->posts WHERE post_type = '".SBY_CPT."';" );
630
+ }
631
+ }
632
+
633
+ /** Notices */
634
+
635
+ function sby_dismiss_at_warning_notice() {
636
+
637
+ update_user_meta( get_current_user_id(), 'sby_at_warning_notice', time() );
638
+
639
+ die();
640
+ }
641
+ add_action( 'wp_ajax_sby_dismiss_at_warning_notice', 'sby_dismiss_at_warning_notice' );
642
+
643
+ function sby_dismiss_connect_warning_notice() {
644
+
645
+ update_user_meta( get_current_user_id(), 'sby_connect_warning_notice', time() );
646
+
647
+ die();
648
+ }
649
+ add_action( 'wp_ajax_sby_dismiss_connect_warning_button', 'sby_dismiss_connect_warning_notice' );
650
+
651
+ function sby_notice_not_dismissed( $key = 'sby_at_warning_notice' ) {
652
+ $meta = get_user_meta( get_current_user_id(), $key, true );
653
+ return (int)$meta + DAY_IN_SECONDS < time();
654
+ }
655
+
656
+ function sby_access_token_warning_modal() {
657
+ if ( isset( $_GET['page'] ) && $_GET['page'] === SBY_SLUG && isset( $_GET['sby_access_token'] ) && sby_notice_not_dismissed() ) {
658
+ $text_domain = SBY_TEXT_DOMAIN;
659
+ include trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/templates/modal.php';
660
+ echo '<span class="sby_account_just_added"></span>';
661
+ }
662
+
663
+ }
664
+ add_action( 'admin_footer', 'sby_access_token_warning_modal', 1 );
665
+
666
+ function sby_get_current_time() {
667
+ $current_time = time();
668
+
669
+ // where to do tests
670
+ //$current_time = strtotime( 'November 25, 2020' ) + 1;
671
+
672
+ return $current_time;
673
+ }
674
+
675
+ // generates the html for the admin notices
676
+ function sby_notices_html() {
677
+
678
+ if ( function_exists( 'sbi_notices_html' ) || function_exists( 'cff_notices_html' || function_exists( 'ctf_notices_html' ) ) ) {
679
+ return;
680
+ }
681
+
682
+ $current_screen = get_current_screen();
683
+ $is_plugins_page = isset( $current_screen->id ) && $current_screen->id === 'plugins';
684
+ $page = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
685
+ //Only show to admins
686
+ if ( ! current_user_can( 'manage_options' ) ) {
687
+ return;
688
+ }
689
+
690
+ $sby_statuses_option = get_option( 'sby_statuses', array() );
691
+ $current_time = sby_get_current_time();
692
+ $sby_bfcm_discount_code = 'happysmashgiving' . date('Y', $current_time );
693
+
694
+ // reset everything for testing
695
+ if ( false ) {
696
+ global $current_user;
697
+ $user_id = $current_user->ID;
698
+ delete_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice' );
699
+ //delete_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
700
+ //$sby_statuses_option = array( 'first_install' => strtotime( 'December 8, 2019' ) );
701
+ //$sby_statuses_option = array( 'first_install' => time() );
702
+
703
+ //update_option( 'sby_statuses', $sby_statuses_option, false );
704
+ //delete_option( 'sby_rating_notice');
705
+ //delete_transient( 'instagram_feed_rating_notice_waiting' );
706
+
707
+ //set_transient( 'instagram_feed_rating_notice_waiting', 'waiting', 2 * WEEK_IN_SECONDS );
708
+ //update_option( 'sby_rating_notice', 'pending', false );
709
+ }
710
+
711
+ //$sby_statuses_option['rating_notice_dismissed'] = time();
712
+ //update_option( 'sby_statuses', $sby_statuses_option, false );
713
+ // rating notice logic
714
+ $sby_rating_notice_option = get_option( 'sby_rating_notice', false );
715
+ $sby_rating_notice_waiting = get_transient( 'feeds_for_youtube_rating_notice_waiting' );
716
+ $should_show_rating_notice = ($sby_rating_notice_waiting !== 'waiting' && $sby_rating_notice_option !== 'dismissed');
717
+
718
+ // black friday cyber monday logic
719
+ $thanksgiving_this_year = sby_get_future_date( 11, date('Y', $current_time ), 4, 4, 1 );
720
+ $one_week_before_black_friday_this_year = $thanksgiving_this_year - 7*24*60*60;
721
+ $one_day_after_cyber_monday_this_year = $thanksgiving_this_year + 5*24*60*60;
722
+ $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;
723
+
724
+ $could_show_bfcm_discount = ($current_time > $one_week_before_black_friday_this_year && $current_time < $one_day_after_cyber_monday_this_year);
725
+ $should_show_bfcm_discount = false;
726
+ if ( $could_show_bfcm_discount && $has_been_two_days_since_rating_dismissal ) {
727
+ global $current_user;
728
+ $user_id = $current_user->ID;
729
+
730
+ $ignore_bfcm_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice' );
731
+ $ignore_bfcm_sale_notice_meta = isset( $ignore_bfcm_sale_notice_meta[0] ) ? $ignore_bfcm_sale_notice_meta[0] : '';
732
+
733
+ /* Check that the user hasn't already clicked to ignore the message */
734
+ $should_show_bfcm_discount = ($ignore_bfcm_sale_notice_meta !== 'always' && $ignore_bfcm_sale_notice_meta !== date( 'Y', $current_time ));
735
+ }
736
+
737
+ // new user discount logic
738
+ $in_new_user_month_range = true;
739
+ $should_show_new_user_discount = false;
740
+ $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;
741
+
742
+ if ( isset( $sby_statuses_option['first_install'] ) && $sby_statuses_option['first_install'] === 'from_update' ) {
743
+ global $current_user;
744
+ $user_id = $current_user->ID;
745
+ $ignore_new_user_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
746
+ $ignore_new_user_sale_notice_meta = isset( $ignore_new_user_sale_notice_meta[0] ) ? $ignore_new_user_sale_notice_meta[0] : '';
747
+
748
+ if ( $ignore_new_user_sale_notice_meta !== 'always' ) {
749
+ $should_show_new_user_discount = true;
750
+ }
751
+ } elseif ( $in_new_user_month_range && $has_been_one_month_since_rating_dismissal ) {
752
+ global $current_user;
753
+ $user_id = $current_user->ID;
754
+ $ignore_new_user_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
755
+ $ignore_new_user_sale_notice_meta = isset( $ignore_new_user_sale_notice_meta[0] ) ? $ignore_new_user_sale_notice_meta[0] : '';
756
+
757
+ if ( $ignore_new_user_sale_notice_meta !== 'always'
758
+ && isset( $sby_statuses_option['first_install'] )
759
+ && $current_time > (int)$sby_statuses_option['first_install'] + 60*60*24*30 ) {
760
+ $should_show_new_user_discount = true;
761
+ }
762
+ }
763
+
764
+ // for debugging
765
+ if ( false ) {
766
+ global $current_user;
767
+ $user_id = $current_user->ID;
768
+ $ignore_bfcm_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice' );
769
+ $ignore_new_user_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
770
+
771
+ var_dump( 'new user rating option', $sby_rating_notice_option );
772
+ var_dump( 'new user rating transient', $sby_rating_notice_waiting );
773
+
774
+ var_dump( 'should show new user rating notice?', $should_show_rating_notice );
775
+
776
+ var_dump( 'new user discount month range?', $in_new_user_month_range );
777
+ var_dump( 'should show new user discount?', $should_show_new_user_discount );
778
+
779
+ var_dump( 'Thanksgiving this year?', date('m/d/Y', $thanksgiving_this_year ) );
780
+
781
+ var_dump( 'could show bfcm discount?', $could_show_bfcm_discount );
782
+ var_dump( 'rating was dismissed?', date('m/d/Y', $sby_statuses_option['rating_notice_dismissed'] ) );
783
+
784
+ var_dump( 'should show bfcm discount?', $should_show_bfcm_discount );
785
+
786
+ var_dump( 'ignore_bfcm_sale_notice_meta', $ignore_bfcm_sale_notice_meta );
787
+ var_dump( 'ignore_new_user_sale_notice_meta', $ignore_new_user_sale_notice_meta );
788
+
789
+ var_dump( $sby_statuses_option );
790
+ }
791
+
792
+
793
+ // no pro version yet, set these to false
794
+ $should_show_new_user_discount = false;
795
+ $should_show_bfcm_discount = false;
796
+
797
+ if ( $should_show_rating_notice ) {
798
+ $other_notice_html = '';
799
+ $dismiss_url = add_query_arg( 'sby_ignore_rating_notice_nag', '1' );
800
+ $later_url = add_query_arg( 'sby_ignore_rating_notice_nag', 'later' );
801
+ if ( $should_show_bfcm_discount ) {
802
+ $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 60% off the Pro version!', SBY_TEXT_DOMAIN ) . '</p>';
803
+
804
+ $dismiss_url = add_query_arg( array(
805
+ 'sby_ignore_rating_notice_nag' => '1',
806
+ 'sby_ignore_bfcm_sale_notice' => date( 'Y', $current_time )
807
+ )
808
+ );
809
+ $later_url = add_query_arg( array(
810
+ 'sby_ignore_rating_notice_nag' => 'later',
811
+ 'sby_ignore_bfcm_sale_notice' => date( 'Y', $current_time )
812
+ )
813
+ );
814
+ }
815
+
816
+ echo "
817
+ <div class='sby_notice sby_review_notice'>
818
+ <img src='". SBY_PLUGIN_URL . 'img/sby-icon.png' ."' alt='" . SBY_PLUGIN_NAME . "'>
819
+ <div class='sby-notice-text'>
820
+ <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>
821
+ <p class='links'";
822
+ if( $should_show_bfcm_discount ) echo " style='margin-top: 0 !important;'";
823
+ echo ">
824
+ <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>
825
+ &middot;
826
+ <a class='sby_notice_dismiss' href='" .esc_url( $dismiss_url ). "'>" . __( 'No thanks', SBY_TEXT_DOMAIN ) . "</a>
827
+ &middot;
828
+ <a class='sby_notice_dismiss' href='" .esc_url( $dismiss_url ). "'>" . __( 'I\'ve already given a review', SBY_TEXT_DOMAIN ) . "</a>
829
+ &middot;
830
+ <a class='sby_notice_dismiss' href='" .esc_url( $later_url ). "'>" . __( 'Ask Me Later', SBY_TEXT_DOMAIN ) . "</a>
831
+ </p>"
832
+ . $other_notice_html .
833
+ "</div>
834
+ <a class='sby_notice_close' href='" .esc_url( $dismiss_url ). "'><i class='fa fa-close'></i></a>
835
+ </div>";
836
+
837
+ } elseif ( $should_show_new_user_discount ) {
838
+ global $current_user;
839
+ $user_id = $current_user->ID;
840
+ $ignore_new_user_sale_notice_meta = get_user_meta( $user_id, 'sby_ignore_new_user_sale_notice' );
841
+ if ( $ignore_new_user_sale_notice_meta !== 'always' ) {
842
+
843
+ echo "
844
+ <div class='sby_notice sby_review_notice sby_new_user_sale_notice'>
845
+ <img src='" . SBY_PLUGIN_URL . 'img/sby-icon-offer.png' . "' alt='".SBY_PLUGIN_NAME."'>
846
+ <div class='sby-notice-text'>
847
+ <p>" . __( '<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;">60% off</b> our Pro version to all users of our free Feeds for YouTube plugin.', SBY_TEXT_DOMAIN ) . "</p>
848
+ <p class='sby-links'>
849
+ <a class='sby_notice_dismiss sby_offer_btn' href='https://smashballoon.com/youtube-feed/?utm_source=plugin-free&utm_campaign=sby&discount=youtubethankyou' target='_blank'><b>" . __( 'Get this offer', SBY_TEXT_DOMAIN ) . "</b></a>
850
+ <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>
851
+
852
+ </p>
853
+ </div>
854
+ <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>
855
+ </div>
856
+ ";
857
+ }
858
+
859
+ } elseif ( $should_show_bfcm_discount ) {
860
+
861
+ echo "
862
+ <div class='sby_notice sby_review_notice sby_bfcm_sale_notice'>
863
+ <img src='". SBY_PLUGIN_URL . 'img/sby-icon-offer.png' ."' alt='".SBY_PLUGIN_NAME."'>
864
+ <div class='sby-notice-text'>
865
+ <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;">60% off</b> the Pro version for all of our users.', SBY_TEXT_DOMAIN ), SBY_PLUGIN_NAME ) . "</p>
866
+ <p class='sby-links'>
867
+ <a class='sby_notice_dismiss sby_offer_btn' href='https://smashballoon.com/youtube-feed/?utm_source=plugin-free&utm_campaign=sby&discount=".$sby_bfcm_discount_code."' target='_blank'><b>" . __( 'Get this offer', SBY_TEXT_DOMAIN ) . "</b></a>
868
+ <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>
869
+ </p>
870
+ </div>
871
+ <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>
872
+ </div>
873
+ ";
874
+
875
+ }
876
+
877
+ }
878
+ add_action( 'admin_notices', 'sby_notices_html', 12 ); // priority 8 for Instagram, priority 10 for Facebook
879
+
880
+ function sby_process_nags() {
881
+
882
+ global $current_user;
883
+ $user_id = $current_user->ID;
884
+ $sby_statuses_option = get_option( 'sby_statuses', array() );
885
+
886
+ if ( isset( $_GET['sby_ignore_rating_notice_nag'] ) ) {
887
+ if ( (int)$_GET['sby_ignore_rating_notice_nag'] === 1 ) {
888
+ update_option( 'sby_rating_notice', 'dismissed', false );
889
+ $sby_statuses_option['rating_notice_dismissed'] = sby_get_current_time();
890
+ update_option( 'sby_statuses', $sby_statuses_option, false );
891
+
892
+ } elseif ( $_GET['sby_ignore_rating_notice_nag'] === 'later' ) {
893
+ set_transient( 'feeds_for_youtube_rating_notice_waiting', 'waiting', 2 * WEEK_IN_SECONDS );
894
+ update_option( 'sby_rating_notice', 'pending', false );
895
+ }
896
+ }
897
+
898
+ if ( isset( $_GET['sby_ignore_new_user_sale_notice'] ) ) {
899
+ $response = sanitize_text_field( $_GET['sby_ignore_new_user_sale_notice'] );
900
+ if ( $response === 'always' ) {
901
+ update_user_meta( $user_id, 'sby_ignore_new_user_sale_notice', 'always' );
902
+
903
+ $current_month_number = (int)date('n', sby_get_current_time() );
904
+ $not_early_in_the_year = ($current_month_number > 5);
905
+
906
+ if ( $not_early_in_the_year ) {
907
+ update_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice', date( 'Y', sby_get_current_time() ) );
908
+ }
909
+
910
+ }
911
+ }
912
+
913
+ if ( isset( $_GET['sby_ignore_bfcm_sale_notice'] ) ) {
914
+ $response = sanitize_text_field( $_GET['sby_ignore_bfcm_sale_notice'] );
915
+ if ( $response === 'always' ) {
916
+ update_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice', 'always' );
917
+ } elseif ( $response === date( 'Y', sby_get_current_time() ) ) {
918
+ update_user_meta( $user_id, 'sby_ignore_bfcm_sale_notice', date( 'Y', sby_get_current_time() ) );
919
+ }
920
+ update_user_meta( $user_id, 'sby_ignore_new_user_sale_notice', 'always' );
921
+ }
922
+
923
+ }
924
+ add_action( 'admin_init', 'sby_process_nags' );
925
+
926
+
927
+ function sby_lite_dismiss() {
928
+ if ( ! isset( $_POST['sbspf_nonce'] ) ) return;
929
+ $nonce = $_POST['sbspf_nonce'];
930
+ if ( ! wp_verify_nonce( $nonce, 'sbspf_nonce' ) ) {
931
+ die ( 'You did not do this the right way!' );
932
+ }
933
+
934
+ set_transient( 'youtube_feed_dismiss_lite', 'dismiss', 1 * WEEK_IN_SECONDS );
935
+
936
+ die();
937
+ }
938
+ add_action( 'wp_ajax_sby_lite_dismiss', 'sby_lite_dismiss' );
939
+
940
+ function sby_get_future_date( $month, $year, $week, $day, $direction ) {
941
+ if ( $direction > 0 ) {
942
+ $startday = 1;
943
+ } else {
944
+ $startday = date( 't', mktime(0, 0, 0, $month, 1, $year ) );
945
+ }
946
+
947
+ $start = mktime( 0, 0, 0, $month, $startday, $year );
948
+ $weekday = date( 'N', $start );
949
+
950
+ $offset = 0;
951
+ if ( $direction * $day >= $direction * $weekday ) {
952
+ $offset = -$direction * 7;
953
+ }
954
+
955
+ $offset += $direction * ($week * 7) + ($day - $weekday);
956
+ return mktime( 0, 0, 0, $month, $startday + $offset, $year );
957
+ }
958
+
959
+ function sby_admin_hide_unrelated_notices() {
960
+
961
+ // Bail if we're not on a Sby screen or page.
962
+ if ( ! sby_is_admin_page() ) {
963
+ return;
964
+ }
965
+
966
+ // Extra banned classes and callbacks from third-party plugins.
967
+ $blacklist = array(
968
+ 'classes' => array(),
969
+ 'callbacks' => array(
970
+ 'sbydb_admin_notice', // 'Database for Sby' plugin.
971
+ ),
972
+ );
973
+
974
+ global $wp_filter;
975
+
976
+ foreach ( array( 'user_admin_notices', 'admin_notices', 'all_admin_notices' ) as $notices_type ) {
977
+ if ( empty( $wp_filter[ $notices_type ]->callbacks ) || ! is_array( $wp_filter[ $notices_type ]->callbacks ) ) {
978
+ continue;
979
+ }
980
+ foreach ( $wp_filter[ $notices_type ]->callbacks as $priority => $hooks ) {
981
+ foreach ( $hooks as $name => $arr ) {
982
+ if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) {
983
+ unset( $wp_filter[ $notices_type ]->callbacks[ $priority ][ $name ] );
984
+ continue;
985
+ }
986
+ $class = ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) ? strtolower( get_class( $arr['function'][0] ) ) : '';
987
+ if (
988
+ ! empty( $class ) &&
989
+ strpos( $class, 'sby' ) !== false &&
990
+ ! in_array( $class, $blacklist['classes'], true )
991
+ ) {
992
+ continue;
993
+ }
994
+ if (
995
+ ! empty( $name ) && (
996
+ strpos( $name, 'sby' ) === false ||
997
+ in_array( $class, $blacklist['classes'], true ) ||
998
+ in_array( $name, $blacklist['callbacks'], true )
999
+ )
1000
+ ) {
1001
+ unset( $wp_filter[ $notices_type ]->callbacks[ $priority ][ $name ] );
1002
+ }
1003
+ }
1004
+ }
1005
+ }
1006
+ }
1007
+ add_action( 'admin_print_scripts', 'sby_admin_hide_unrelated_notices' );
trunk/inc/admin/class-sbspf-admin.php ADDED
@@ -0,0 +1,1045 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 $pro_only;
29
+
30
+ protected $types;
31
+
32
+ protected $layouts;
33
+
34
+ protected $false_fields;
35
+
36
+ protected $textarea_fields;
37
+
38
+ public function __construct( $vars, $base_path, $slug, $plugin_name, $capability, $icon, $position, $tabs, $settings, $active_tab = false, $option_name = 'sbspf_settings' ) {
39
+ $this->vars = $vars;
40
+ $this->base_path = $base_path;
41
+ $this->slug = $slug;
42
+ $this->plugin_name = $plugin_name;
43
+ $this->capability = $capability;
44
+ $this->icon = $icon;
45
+ $this->position = $position;
46
+
47
+ $this->tabs = $tabs;
48
+
49
+ if ( $active_tab ) {
50
+ $this->set_active_tab( $active_tab );
51
+ } else {
52
+ $this->set_active_tab( $tabs[0]['slug'] );
53
+ }
54
+ $this->settings = $settings;
55
+ $this->option_name = $option_name;
56
+ $this->pro_only = array();
57
+ $this->false_fields = array();
58
+ $this->textarea_fields = array();
59
+ $this->display_your_feed_sections = array();
60
+ }
61
+
62
+ public function get_vars() {
63
+ return $this->vars;
64
+ }
65
+
66
+ public function get_option_name() {
67
+ return $this->option_name;
68
+ }
69
+
70
+ public function verify_post( $post ) {
71
+ return wp_verify_nonce( $post[ $this->option_name . '_validate' ], $this->option_name . '_validate' );
72
+ }
73
+
74
+ public function hidden_fields_for_tab( $tab ) {
75
+ wp_nonce_field( $this->get_option_name() . '_validate', $this->get_option_name() . '_validate', true, true );
76
+ ?>
77
+ <input type="hidden" name="<?php echo $this->get_option_name() . '_tab_marker'; ?>" value="<?php echo esc_attr( $tab ); ?>"/>
78
+ <?php
79
+ }
80
+
81
+ public function init() {
82
+ add_action( 'admin_menu', array( $this, 'create_menus' ) );
83
+ add_action( 'admin_init', array( $this, 'settings_init' ) );
84
+ add_action( 'admin_init', array( $this, 'additional_settings_init' ) );
85
+
86
+ }
87
+
88
+ public function settings_init() {
89
+ $text_domain = $this->vars->text_domain();
90
+ /**
91
+ * Configure Tab
92
+ */
93
+ $args = array(
94
+ 'id' => 'sbspf_types',
95
+ 'tab' => 'configure',
96
+ 'save_after' => 'true'
97
+ );
98
+ $this->add_settings_section( $args );
99
+
100
+ /* Types */
101
+ $args = array(
102
+ 'name' => 'type',
103
+ 'section' => 'sbspf_types',
104
+ 'callback' => 'types',
105
+ 'title' => '<label>' . __( 'Feed Type', $text_domain ) .'</label>',
106
+ 'shortcode' => array(
107
+ 'key' => 'type',
108
+ 'example' => 'channel',
109
+ 'description' => __( 'Type of feed to display', $text_domain ) . ' e.g. channel, playlist, search, favorites, live',
110
+ 'display_section' => 'configure'
111
+ ),
112
+ 'types' => $this->types
113
+ );
114
+ $this->add_settings_field( $args );
115
+
116
+ /* Cache */
117
+ $args = array(
118
+ 'name' => 'cache',
119
+ 'section' => 'sbspf_types',
120
+ 'callback' => 'cache',
121
+ 'title' => __( 'Check for new posts', $text_domain )
122
+ );
123
+ $this->add_settings_field( $args );
124
+
125
+ /**
126
+ * Customize Tab
127
+ */
128
+ $args = array(
129
+ 'title' => __( 'General', $text_domain ),
130
+ 'id' => 'sbspf_general',
131
+ 'tab' => 'customize',
132
+ 'save_after' => 'true'
133
+ );
134
+ $this->add_settings_section( $args );
135
+
136
+ /* Width and Height */
137
+ $select_options = array(
138
+ array(
139
+ 'label' => '%',
140
+ 'value' => '%'
141
+ ),
142
+ array(
143
+ 'label' => 'px',
144
+ 'value' => 'px'
145
+ )
146
+ );
147
+
148
+ $args = array(
149
+ 'name' => 'width',
150
+ 'default' => '100',
151
+ 'section' => 'sbspf_general',
152
+ 'callback' => 'text',
153
+ 'min' => 1,
154
+ 'size' => 4,
155
+ 'title' => __( 'Width of Feed', $text_domain ),
156
+ 'shortcode' => array(
157
+ 'key' => 'width',
158
+ 'example' => '300px',
159
+ 'description' => __( 'The width of your feed. Any number with a unit like "px" or "%".', $text_domain ),
160
+ 'display_section' => 'customize'
161
+ ),
162
+ 'select_name' => 'widthunit',
163
+ 'select_options' => $select_options,
164
+ 'hidden' => array(
165
+ 'callback' => 'checkbox',
166
+ 'name' => 'width_responsive',
167
+ 'label' => __( 'Set to be 100% width on mobile?', $text_domain ),
168
+ 'before' => '<div id="sbspf_width_options">',
169
+ 'after' => '</div>',
170
+ '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 )
171
+ ),
172
+ );
173
+ $this->add_settings_field( $args );
174
+
175
+ $select_options = array(
176
+ array(
177
+ 'label' => '%',
178
+ 'value' => '%'
179
+ ),
180
+ array(
181
+ 'label' => 'px',
182
+ 'value' => 'px'
183
+ )
184
+ );
185
+ $args = array(
186
+ 'name' => 'height',
187
+ 'default' => '',
188
+ 'section' => 'sbspf_general',
189
+ 'callback' => 'text',
190
+ 'min' => 1,
191
+ 'size' => 4,
192
+ 'title' => __( 'Height of Feed', $text_domain ),
193
+ 'shortcode' => array(
194
+ 'key' => 'height',
195
+ 'example' => '500px',
196
+ 'description' => __( 'The height of your feed. Any number with a unit like "px" or "em".', $text_domain ),
197
+ 'display_section' => 'customize'
198
+ ),
199
+ 'select_name' => 'heightunit',
200
+ 'select_options' => $select_options,
201
+ );
202
+ $this->add_settings_field( $args );
203
+
204
+ $args = array(
205
+ 'name' => 'background',
206
+ 'default' => '',
207
+ 'section' => 'sbspf_general',
208
+ 'callback' => 'color',
209
+ 'title' => __( 'Background Color', $text_domain ),
210
+ 'shortcode' => array(
211
+ 'key' => 'background',
212
+ 'example' => '#f00',
213
+ 'description' => __( 'Background color for the feed. Any hex color code.', $text_domain ),
214
+ 'display_section' => 'customize'
215
+ ),
216
+ );
217
+ $this->add_settings_field( $args );
218
+
219
+ $args = array(
220
+ 'title' => __( 'Layout', $text_domain ),
221
+ 'id' => 'sbspf_layout',
222
+ 'tab' => 'customize',
223
+ 'save_after' => 'true'
224
+ );
225
+ $this->add_settings_section( $args );
226
+
227
+ $args = array(
228
+ 'name' => 'layout',
229
+ 'section' => 'sbspf_layout',
230
+ 'callback' => 'layout',
231
+ 'title' => __( 'Layout Type', $text_domain ),
232
+ 'layouts' => $this->layouts,
233
+ 'shortcode' => array(
234
+ 'key' => 'layout',
235
+ 'example' => 'list',
236
+ 'description' => __( 'How your posts are display visually.', $text_domain ),
237
+ 'display_section' => 'layout'
238
+ )
239
+ );
240
+ $this->add_settings_field( $args );
241
+ }
242
+
243
+ public function additional_settings_init() {
244
+
245
+ }
246
+
247
+ public function add_false_field( $name, $tab ) {
248
+ $this->false_fields[ $tab ][] = $name;
249
+ }
250
+
251
+ public function get_false_fields( $tab ) {
252
+ if ( isset( $this->false_fields[ $tab ] ) ) {
253
+ return $this->false_fields[ $tab ];
254
+ }
255
+
256
+ return array();
257
+ }
258
+
259
+ public function add_textarea_field( $name, $tab ) {
260
+ $this->textarea_fields[ $tab ][] = $name;
261
+ }
262
+
263
+ public function get_textarea_fields( $tab ) {
264
+ if ( isset( $this->textarea_fields[ $tab ] ) ) {
265
+ return $this->textarea_fields[ $tab ];
266
+ }
267
+
268
+ return array();
269
+ }
270
+
271
+ public function blank() {
272
+
273
+ }
274
+
275
+ public function add_settings_section( $args ) {
276
+ $title = isset( $args['title'] ) ? $args['title'] : '';
277
+ $callback = isset( $args['callback'] ) ? $args['callback'] : array( $this, 'blank' );
278
+ add_settings_section(
279
+ $args['id'],
280
+ $title,
281
+ $callback,
282
+ $args['id']
283
+ );
284
+
285
+ $save_after = isset( $args['save_after'] ) ? $args['save_after'] : false;
286
+ $pro = isset( $args['pro'] ) && ($args['pro'] !== false) ? $args['pro'] : false;
287
+ $this->settings_sections[ $args['tab'] ][] = array(
288
+ 'id' => $args['id'],
289
+ 'save_after' => $save_after,
290
+ 'pro' => $pro
291
+
292
+ );
293
+ }
294
+
295
+ public function add_settings_field( $args ) {
296
+ $title_after = '';
297
+ $shortcode = false;
298
+ if ( isset( $args['shortcode'] ) ) {
299
+ $title_after = isset( $args['shortcode']['after'] ) ? $args['shortcode']['after'] : '';
300
+ $shortcode = $args['shortcode'];
301
+ }
302
+
303
+ if ( $shortcode ) {
304
+ $this->display_your_feed_sections[ $shortcode['display_section'] ]['settings'][] = $shortcode;
305
+ if ( isset( $args['pro'] ) ) {
306
+ $this->pro_only[] = $args['name'];
307
+ }
308
+ }
309
+
310
+ if ( $args['callback'] === 'types' ) {
311
+ $formatted_label = '<label for="' . $this->option_name . '_' . $args['name'] . '">' . $args['title'] .'</label>';
312
+ $formatted_label .= '<code class="sbspf_shortcode">type'. "\n";
313
+ foreach ( $args['types'] as $type ) {
314
+ $shortcode = array(
315
+ 'key' => $type['slug'],
316
+ 'example' => $type['example'],
317
+ 'description' => $type['description'],
318
+ 'display_section' => 'configure'
319
+ );
320
+ $this->display_your_feed_sections[ $shortcode['display_section'] ]['settings'][] = $shortcode;
321
+ if ( isset( $type['pro'] ) ) {
322
+ $this->pro_only[] = $type['slug'];
323
+ }
324
+
325
+ $formatted_label .= 'Eg: type=' . $type['slug'] . '<br>';
326
+ $formatted_label .= $type['slug'] . '="' . substr( $type['example'], 0, 14) . '"<br>';
327
+
328
+ }
329
+ $formatted_label .= '</code><br>';
330
+
331
+ $title = $formatted_label;
332
+ } else {
333
+ $title = $this->format_title( $args['title'], $args['name'], $shortcode, $title_after );
334
+ }
335
+
336
+ if ( $args['callback'] === 'checkbox' || (isset( $args['falsefield'] ) && $args['falsefield'] === true) ) {
337
+ $tab = 'none';
338
+ foreach ( $this->settings_sections as $key => $settings_sections ) {
339
+ foreach ( $settings_sections as $this_tab_sections ) {
340
+ if ( $this_tab_sections['id'] === $args['section'] ) {
341
+ $tab = $key;
342
+ }
343
+ }
344
+
345
+ }
346
+ $this->add_false_field( $args['name'], $tab );
347
+ }
348
+
349
+ if ( $args['callback'] === 'layout' || $args['callback'] === 'sub_option' ) {
350
+ $tab = 'none';
351
+ foreach ( $this->settings_sections as $key => $settings_sections ) {
352
+ foreach ( $settings_sections as $this_tab_sections ) {
353
+ if ( $this_tab_sections['id'] === $args['section'] ) {
354
+ $tab = $key;
355
+ }
356
+ }
357
+
358
+ }
359
+ $sub_options = isset( $args['layouts'] ) ? $args['layouts'] : $args['sub_options'];
360
+ foreach ( $sub_options as $sub_option ) {
361
+ if ( isset( $sub_option['options'] ) ) {
362
+ foreach( $sub_option['options'] as $sub_sub_option ) {
363
+ if ( ! empty( $sub_sub_option['shortcode'] ) ) {
364
+ $key = ! empty( $sub_sub_option['shortcode']['key'] ) ? $sub_sub_option['shortcode']['key'] : $sub_option['slug'] . $sub_sub_option['name'];
365
+ $example = ! empty( $sub_sub_option['shortcode']['example'] ) ? $sub_sub_option['shortcode']['example'] : '';
366
+ $description = ! empty( $sub_sub_option['shortcode']['description'] ) ? $sub_sub_option['shortcode']['description'] : '';
367
+ $display_section = ! empty( $sub_sub_option['shortcode']['display_section'] ) ? $sub_sub_option['shortcode']['display_section'] : str_replace( 'sbspf_', '', $args['section'] );
368
+ $sub_shortcode = array(
369
+ 'key' => $key,
370
+ 'example' => $example,
371
+ 'description' => $description,
372
+ 'display_section' => $display_section
373
+ );
374
+ if ( isset( $this->display_your_feed_sections[ $display_section ] ) ) {
375
+ $this->display_your_feed_sections[ $display_section ]['settings'][] = $sub_shortcode;
376
+ if ( isset( $sub_sub_option['pro'] ) ) {
377
+ $this->pro_only[] = $key;
378
+ }
379
+ }
380
+ }
381
+ if ( $sub_sub_option['callback'] === 'checkbox' ) {
382
+ $this->add_false_field( $sub_option['slug'] . $sub_sub_option['name'], $tab );
383
+ }
384
+ }
385
+ }
386
+ }
387
+ }
388
+
389
+ if ( $args['callback'] === 'textarea' ) {
390
+ $tab = 'none';
391
+ foreach ( $this->settings_sections as $key => $settings_sections ) {
392
+ foreach ( $settings_sections as $this_tab_sections ) {
393
+ if ( $this_tab_sections['id'] === $args['section'] ) {
394
+ $tab = $key;
395
+ }
396
+ }
397
+
398
+ }
399
+ $this->add_textarea_field( $args['name'], $tab );
400
+ }
401
+
402
+ add_settings_field(
403
+ $args['name'],
404
+ $title,
405
+ array( $this, $args['callback'] ),
406
+ $args['section'],
407
+ $args['section'],
408
+ $args
409
+ );
410
+
411
+ if ( isset( $args['hidden'] ) ) {
412
+ if ( $args['hidden']['callback'] === 'checkbox' ) {
413
+ $tab = 'none';
414
+ foreach ( $this->settings_sections as $key => $settings_sections ) {
415
+ foreach ( $settings_sections as $this_tab_sections ) {
416
+ if ( $this_tab_sections['id'] === $args['section'] ) {
417
+ $tab = $key;
418
+ }
419
+ }
420
+
421
+ }
422
+ $this->add_false_field( $args['hidden']['name'], $tab );
423
+ }
424
+ }
425
+ }
426
+
427
+ public function set_feed_types( $types ) {
428
+ $this->types = $types;
429
+ }
430
+
431
+ public function set_feed_layouts( $layouts ) {
432
+ $this->layouts = $layouts;
433
+ }
434
+
435
+ public function set_display_table_sections( $headings ) {
436
+ foreach ( $headings as $heading ) {
437
+ $this->display_your_feed_sections[ $heading['slug'] ] = array(
438
+ 'label' => $heading['label'],
439
+ 'settings' => array()
440
+ );
441
+ }
442
+ }
443
+
444
+ public function checkbox( $args ) {
445
+ $default = isset( $args['default'] ) ? $args['default'] : false;
446
+ $selected = isset( $this->settings[ $args['name'] ] ) ? $this->settings[ $args['name'] ] : $default;
447
+ $label = isset( $args['label'] ) ? $args['label'] : __( 'Yes' );
448
+ $tooltip_text = isset( $args['tooltip_text'] ) ? $args['label'] : $this->default_tooltip_text();
449
+ $has_shortcode = isset( $args['has_shortcode'] ) && $args['has_shortcode'] && isset( $args['shortcode_example'] ) ? '1' : '';
450
+ $pro_flag = isset( $args['pro'] ) ? ' <span class="sbspf_pro_only"></span>' : '';
451
+ echo $pro_flag;
452
+ ?>
453
+ <input name="<?php echo $this->option_name .'['.esc_attr( $args['name'] ).']'; ?>" id="<?php echo $this->option_name . '_' . $args['name']; ?>" class="sbspf_single_checkbox" type="checkbox"<?php if ( $selected ) echo ' checked'; ?>/>
454
+ <label for="<?php echo $this->option_name . '_' . $args['name'] . $has_shortcode; ?>"><?php echo esc_html( $label ); ?></label><?php if ( $has_shortcode === '1' ) : ?><code class="sbspf_shortcode"> <?php echo $args['name'] . "\n"; ?>
455
+ Eg: <?php echo $args['name']; ?>=<?php echo $args['shortcode_example']; ?></code><br><?php endif; ?>
456
+ <?php if ( isset( $args['tooltip_info'] ) ) : ?>
457
+ <a class="sbspf_tooltip_link" href="JavaScript:void(0);"><?php echo $tooltip_text; ?></a>
458
+ <p class="sbspf_tooltip sbspf_more_info"><?php echo $args['tooltip_info']; ?></p>
459
+ <?php
460
+ endif;
461
+ }
462
+
463
+ public function multi_checkbox( $args ) {
464
+ $default = isset( $args['default'] ) ? $args['default'] : false;
465
+ $selection_array = isset( $this->settings[ $args['name'] ] ) ? (array)$this->settings[ $args['name'] ] : (array)$default;
466
+ $tooltip_text = isset( $args['tooltip_text'] ) ? $args['label'] : $this->default_tooltip_text();
467
+ $index = 0;
468
+ ?>
469
+ <?php foreach ( $args['select_options'] as $select_option ) :
470
+ $selected = in_array( $select_option['value'], $selection_array, true );
471
+ $pro_only = (isset( $select_option['pro'] ) && $select_option['pro']) ? ' sbspf_pro_only' : '';
472
+ $class = ! empty( $select_option['class'] ) ? ' ' . $select_option['class'] : '';
473
+ ?>
474
+ <div class="sbspf_multi_checkbox_option<?php echo $pro_only . $class; ?>">
475
+ <input name="<?php echo $this->option_name .'['.esc_attr( $args['name'] ).'][]'; ?>" id="<?php echo $this->option_name . '_' . $args['name']. '_' . $index; ?>" value="<?php echo esc_attr( $select_option['value'] ); ?>" type="checkbox"<?php if ( $selected ) echo ' checked'; ?>/>
476
+ <label for="<?php echo $this->option_name . '_' . $args['name'] . '_' . $index; ?>"><?php echo esc_html( $select_option['label'] ); ?></label>
477
+ </div>
478
+ <?php
479
+ $index++;
480
+ endforeach; ?>
481
+
482
+ <?php if ( isset( $args['tooltip_info'] ) ) : ?>
483
+ <a class="sbspf_tooltip_link" href="JavaScript:void(0);"><?php echo $tooltip_text; ?></a>
484
+ <p class="sbspf_tooltip sbspf_more_info"><?php echo $args['tooltip_info']; ?></p>
485
+ <?php
486
+ endif;
487
+ }
488
+
489
+ public function text( $args ) {
490
+ $default = isset( $args['default'] ) ? $args['default'] : '';
491
+ $value = isset( $this->settings[ $args['name'] ] ) ? $this->settings[ $args['name'] ] : $default;
492
+ $size = ( isset( $args['size'] ) ) ? ' size="'. $args['size'].'"' : '';
493
+ $class = isset( $args['class'] ) ? ' class="'. esc_attr( $args['class'] ) . '"' : '';
494
+
495
+ $tooltip_text = isset( $args['tooltip_text'] ) ? $args['label'] : $this->default_tooltip_text();
496
+ $pro_flag = isset( $args['pro'] ) ? ' <span class="sbspf_pro_only"></span>' : '';
497
+ echo $pro_flag;
498
+
499
+ if ( isset( $args['min'] ) ) :
500
+ $min = ( isset( $args['min'] ) ) ? ' min="'. $args['min'].'"' : '';
501
+ $max = ( isset( $args['max'] ) ) ? ' max="'. $args['max'].'"' : '';
502
+ $step = ( isset( $args['step'] ) ) ? ' step="'. $args['step'].'"' : '';
503
+ $class = isset( $args['class'] ) ? ' class="sbspf_number_field sbspf_size_' . $args['size'] . ' '. esc_attr( $args['class'] ) . '"' : ' class="sbspf_number_field sbspf_size_' . $args['size'] . '"';
504
+ ?>
505
+ <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 ); ?>" />
506
+ <?php elseif ( isset( $args['color'] ) ) : ?>
507
+ <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 ) ); ?>" />
508
+ <?php else: ?>
509
+ <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 ) ); ?>" />
510
+ <?php endif; ?>
511
+
512
+ <?php if ( isset( $args['select_options'] ) ) :
513
+ $value = isset( $this->settings[ $args['select_name'] ] ) ? $this->settings[ $args['select_name'] ] : $args['select_options'][0]['value'];
514
+ ?>
515
+ <select name="<?php echo $this->option_name.'['.$args['select_name'].']'; ?>" id="<?php echo $this->option_name . '_' . $args['select_name']; ?>">
516
+ <?php foreach ( $args['select_options'] as $select_option ) : ?>
517
+ <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>
518
+ <?php endforeach; ?>
519
+ </select>
520
+ <?php endif; ?>
521
+
522
+ <?php if ( isset( $args['hidden'] ) ) : ?>
523
+
524
+ <?php
525
+ if ( is_callable( array( $this, $args['hidden']['callback'] ) ) ){
526
+ echo $args['hidden']['before'];
527
+ call_user_func_array(
528
+ array( $this, $args['hidden']['callback'] ),
529
+ array( $args['hidden'] )
530
+ );
531
+ echo $args['hidden']['after'];
532
+ }
533
+ ?>
534
+ <?php endif; ?>
535
+
536
+ <?php if ( isset( $args['additional'] ) ) : ?>
537
+ <?php echo $args['additional']; ?>
538
+ <?php endif; ?>
539
+
540
+ <?php if ( isset( $args['tooltip_info'] ) ) : ?>
541
+ <a class="sbspf_tooltip_link" href="JavaScript:void(0);"><?php echo $tooltip_text; ?></a>
542
+ <p class="sbspf_tooltip sbspf_more_info"><?php echo $args['tooltip_info']; ?></p>
543
+ <?php
544
+ endif;
545
+ }
546
+
547
+ public function select( $args ) {
548
+ $default = isset( $args['default'] ) ? $args['default'] : $args['options'][0]['value'];
549
+ $value = isset( $this->settings[ $args['name'] ] ) ? $this->settings[ $args['name'] ] : $default;
550
+
551
+ if ( isset( $args['min'] ) && isset( $args['max'] ) && ((int)$args['min'] < (int)$args['max']) && empty( $args['options'] ) ) {
552
+ $args['options'] = array();
553
+ $i = (int)$args['min'];
554
+
555
+ while ( $i <= (int)$args['max'] ) {
556
+ $args['options'][] = array(
557
+ 'label' => $i,
558
+ 'value' => $i
559
+ );
560
+ $i++;
561
+ }
562
+ }
563
+
564
+ $tooltip_text = isset( $args['tooltip_text'] ) ? $args['label'] : $this->default_tooltip_text();
565
+ $pro_class = isset( $args['pro'] ) ? ' class="sbspf_pro_only"' : '';
566
+ ?>
567
+ <select<?php echo $pro_class; ?> name="<?php echo $this->option_name.'['.$args['name'].']'; ?>" id="<?php echo $this->option_name . '_' . $args['name']; ?>">
568
+ <?php foreach ( $args['options'] as $select_option ) : ?>
569
+ <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>
570
+ <?php endforeach; ?>
571
+ </select>
572
+
573
+ <?php if ( isset( $args['additional'] ) ) : ?>
574
+ <?php echo $args['additional']; ?>
575
+ <?php endif; ?>
576
+
577
+ <?php if ( isset( $args['tooltip_info'] ) ) : ?>
578
+ <a class="sbspf_tooltip_link" href="JavaScript:void(0);"><?php echo $tooltip_text; ?></a>
579
+ <p class="sbspf_tooltip sbspf_more_info"><?php echo $args['tooltip_info']; ?></p>
580
+ <?php endif;
581
+ }
582
+
583
+ public function textarea( $args ) {
584
+ $default = isset( $args['default'] ) ? $args['default'] : '';
585
+ $value = isset( $this->settings[ $args['name'] ] ) ? stripslashes( $this->settings[ $args['name'] ] ) : $default;
586
+ $pro_class = isset( $args['pro'] ) ? ' class="sbspf_pro_only"' : '';
587
+
588
+ if ( isset( $args['tooltip_info'] ) ) : ?>
589
+ <span><?php echo $args['tooltip_info']; ?></span><br>
590
+ <?php endif; ?>
591
+
592
+ <textarea<?php echo $pro_class; ?> name="<?php echo $this->option_name.'['.$args['name'].']'; ?>" id="<?php echo $this->option_name . '_' . $args['name']; ?>"rows="7"><?php echo $value; ?></textarea>
593
+
594
+ <?php if ( isset( $args['note'] ) ) : ?>
595
+ <br><span class="sbspf_note"><?php echo $args['note']; ?></span>
596
+ <?php endif;
597
+ }
598
+
599
+ public function color( $args ) {
600
+ $args['color'] = true;
601
+ $this->text( $args );
602
+ }
603
+
604
+ public function types( $args ) {
605
+ $type_selected = isset( $this->settings[ $args['name'] ] ) ? $this->settings[ $args['name'] ] : $args['types'][0]['slug'];
606
+
607
+ foreach ( $args['types'] as $type ) :
608
+ $input_type = isset( $type['input_type'] ) ? $type['input_type'] : 'connected_account';
609
+ $selected = ! empty( $this->settings[ $type['slug'] ] ) ? $this->settings[ $type['slug'] ] : $type['default'];
610
+ if ( $input_type === 'connected_account' ) {
611
+ $selected = isset( $this->settings[ $type['slug'] . '_ids' ] ) ? $this->settings[ $type['slug'] . '_ids' ] : array();
612
+ }
613
+ $on_select = isset( $type['onselect'] ) ? $type['onselect'] : false;
614
+ $pro_class = isset( $type['pro'] ) ? ' sbspf_pro_only' : '';
615
+ ?>
616
+ <div class="sbspf_row sbspf_type_row<?php echo $pro_class; ?>" style="min-height: 29px;">
617
+ <div class="sbspf_col sbspf_one">
618
+ <input type="radio" name="<?php echo $this->option_name.'['.esc_attr( $args['name'] ).']'; ?>" class="sbspf_type_input" id="sbspf_type_<?php echo esc_attr( $type['slug'] ); ?>" value="<?php echo esc_attr( $type['slug'] ); ?>"<?php if ( $type_selected === $type['slug'] ) echo 'checked'; ?>>
619
+ <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>
620
+ </div>
621
+ <div class="sbspf_col sbspf_two">
622
+ <?php if ( $input_type === 'text' ) :
623
+ $placeholder = isset( $type['note'] ) ? ' placeholder="' . esc_attr( $type['note'] ). '"' : '';
624
+ ?>
625
+ <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"<?php echo $placeholder; ?>>
626
+ <?php else :
627
+ $connected_accounts = $this->get_connected_accounts(); ?>
628
+ <div class="sbspf_<?php echo esc_attr( $type['slug'] ); ?>_feed_ids_wrap">
629
+ <?php foreach ( $connected_accounts as $connected_account ) : if ( in_array( $connected_account['channel_id'], $selected, true ) ) : ?>
630
+ <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">
631
+ <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'] ); ?>">
632
+ </div>
633
+ <?php endif; endforeach; ?>
634
+ </div>
635
+ <?php if ( empty( $selected ) ) : ?>
636
+ <p class="sbspf_no_accounts" style="margin-top: -3px; margin-right: 10px;"><?php _e( 'Connect an account above', $this->vars->text_domain() ); ?></p>
637
+ <?php endif; ?>
638
+
639
+ <?php endif; ?>
640
+ <?php if ( $input_type !== 'text' && isset( $type['note'] ) ) : ?>
641
+ <br><span class="sbspf_note"><?php echo $type['note']; ?></span>
642
+ <?php endif; ?>
643
+ </div>
644
+ <?php if ( $on_select ) : ?>
645
+ <div class="sbspf_onselect">
646
+ <?php call_user_func_array( array( $this, $on_select ), array( $type ) ); ?>
647
+ </div>
648
+ <?php endif; ?>
649
+
650
+ <div class="sbspf_tooltip sbspf_type_tooltip sbspf_more_info">
651
+ <?php if ( ! empty( $type['tooltip'] ) ) : ?>
652
+ <?php echo $type['tooltip']; ?>
653
+ <?php endif; ?>
654
+ </div>
655
+
656
+
657
+
658
+ </div>
659
+ <?php endforeach;
660
+ }
661
+
662
+ public function sub_option( $args ) {
663
+ $value = isset( $this->settings[ $args['name'] ] ) ? $this->settings[ $args['name'] ] : 'related';
664
+ $pro_flag = isset( $args['pro'] ) ? ' <span class="sbspf_pro_only"></span>' : '';
665
+ echo $pro_flag;
666
+ $cta_options = $args['sub_options'];
667
+ ?>
668
+ <?php if ( ! empty( $args['before'] ) ) {
669
+ echo $args['before'];
670
+ }?>
671
+
672
+ <div class="sbspf_sub_options">
673
+ <?php foreach ( $cta_options as $sub_option ) :
674
+ $pro_class = isset( $sub_option['pro'] ) ? ' sbspf_pro_only' : '';
675
+ ?>
676
+ <div class="sbspf_sub_option_cell<?php echo esc_attr( $pro_class ); ?>">
677
+ <input class="sbspf_sub_option_type" id="sbspf_sub_option_type_<?php echo esc_attr( $sub_option['slug'] ); ?>" name="<?php echo $this->option_name.'['.$args['name'].']'; ?>" type="radio" value="<?php echo esc_attr( $sub_option['slug'] ); ?>"<?php if ( $sub_option['slug'] === $value ) echo ' checked'?>><label for="sbspf_sub_option_type_<?php echo esc_attr( $sub_option['slug'] ); ?>"><span class="sbspf_label"><?php echo $sub_option['label']; ?></span></label>
678
+ </div>
679
+ <?php endforeach; ?>
680
+
681
+ <div class="sbspf_box_setting">
682
+ <?php if ( isset( $cta_options ) ) : foreach ( $cta_options as $sub_option ) :
683
+ $pro_class = isset( $sub_option['pro'] ) ? ' sbspf_pro_only' : '';
684
+ ?>
685
+ <div class="sbspf_sub_option_settings sbspf_sub_option_type_<?php echo esc_attr( $sub_option['slug'] ) . $pro_class; ?>">
686
+
687
+ <div class="sbspf_sub_option_setting">
688
+ <?php echo sby_admin_icon( 'info-circle', 'sbspf_small_svg' ); ?>&nbsp;&nbsp;&nbsp;<span class="sbspf_note" style="margin-left: 0;"><?php echo $sub_option['note']; ?></span>
689
+ </div>
690
+ <?php if ( ! empty( $sub_option['options'] ) ) : ?>
691
+ <?php foreach ( $sub_option['options'] as $option ) :
692
+ $option['name'] = $sub_option['slug'].$option['name'];
693
+ ?>
694
+ <div class="sbspf_sub_option_setting">
695
+ <?php if ( $option['callback'] !== 'checkbox' ) :
696
+ if ( isset( $option['shortcode'] ) ) : ?>
697
+ <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"; ?>
698
+ Eg: <?php echo $option['name']; ?>=<?php echo $option['shortcode']['example']; ?></code><br>
699
+ <?php else: ?>
700
+ <label><?php echo $option['label']; ?></label><br>
701
+ <?php endif; ?>
702
+ <?php else:
703
+ $option['shortcode_example'] = $option['shortcode']['example'];
704
+ $option['has_shortcode'] = true;
705
+ endif; ?>
706
+ <?php call_user_func_array( array( $this, $option['callback'] ), array( $option ) ); ?>
707
+
708
+ </div>
709
+
710
+ <?php endforeach; ?>
711
+ <?php endif; ?>
712
+
713
+ </div>
714
+
715
+ <?php endforeach; endif; ?>
716
+ </div>
717
+ </div>
718
+ <?php
719
+ }
720
+
721
+ public function cache( $args ) {
722
+ $social_network = $this->vars->social_network();
723
+ $type_selected = isset( $this->settings['caching_type'] ) ? $this->settings['caching_type'] : 'page';
724
+ $caching_time = isset( $this->settings['caching_time'] ) ? $this->settings['caching_time'] : 1;
725
+ $cache_time_unit_selected = isset( $this->settings['cache_time_unit'] ) ? $this->settings['cache_time_unit'] : 'hours';
726
+ $cache_cron_interval_selected = isset( $this->settings['cache_cron_interval'] ) ? $this->settings['cache_cron_interval'] : '';
727
+ $cache_cron_time = isset( $this->settings['cache_cron_time'] ) ? $this->settings['cache_cron_time'] : '';
728
+ $cache_cron_am_pm = isset( $this->settings['cache_cron_am_pm'] ) ? $this->settings['cache_cron_am_pm'] : '';
729
+
730
+ ?>
731
+ <div class="sbspf_cache_settings_wrap">
732
+ <div class="sbspf_row">
733
+ <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'?>>
734
+ <label class="sbspf_radio_label" for="sbspf_caching_type_page"><?php _e ( 'When the page loads', $this->vars->text_domain() ); ?></label>
735
+ <a class="sbspf_tooltip_link" href="JavaScript:void(0);" style="position: relative; top: 2px;"><?php echo $this->default_tooltip_text() ?></a>
736
+ <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>
737
+ <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 with a minimum time of 15 minutes. 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>
738
+ <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 ); ?>
739
+ </p>
740
+ </div>
741
+ <div class="sbspf_row sbspf-caching-page-options" style="display: none;">
742
+ <?php _e ( 'Every', $this->vars->text_domain() ); ?>:
743
+ <input name="<?php echo $this->option_name.'[caching_time]'; ?>" type="text" value="<?php echo esc_attr( $caching_time ); ?>" size="4">
744
+ <select name="<?php echo $this->option_name.'[caching_time_unit]'; ?>">
745
+ <option value="minutes"<?php if ( $cache_time_unit_selected === 'minutes' ) echo ' selected'?>><?php _e ( 'Minutes', $this->vars->text_domain() ); ?></option>
746
+ <option value="hours"<?php if ( $cache_time_unit_selected === 'hours' ) echo ' selected'?>><?php _e ( 'Hours', $this->vars->text_domain() ); ?></option>
747
+ <option value="days"<?php if ( $cache_time_unit_selected === 'days' ) echo ' selected'?>><?php _e ( 'Days', $this->vars->text_domain() ); ?></option>
748
+ </select>
749
+ <a class="sbspf_tooltip_link" href="JavaScript:void(0);"><?php _e ( 'What does this mean?', $this->vars->text_domain() ); ?></a>
750
+ <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>
751
+ </div>
752
+
753
+ <div class="sbspf_row">
754
+ <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'?>>
755
+ <label class="sbspf_radio_label" for="sbspf_caching_type_cron"><?php _e ( 'In the background', $this->vars->text_domain() ); ?></label>
756
+ </div>
757
+ <div class="sbspf_row sbspf-caching-cron-options" style="display: block;">
758
+
759
+ <select name="<?php echo $this->option_name.'[cache_cron_interval]'; ?>" id="sbspf_cache_cron_interval">
760
+ <option value="30mins"<?php if ( $cache_cron_interval_selected === '30mins' ) echo ' selected'?>><?php _e ( 'Every 30 minutes', $this->vars->text_domain() ); ?></option>
761
+ <option value="1hour"<?php if ( $cache_cron_interval_selected === '1hour' ) echo ' selected'?>><?php _e ( 'Every hour', $this->vars->text_domain() ); ?></option>
762
+ <option value="12hours"<?php if ( $cache_cron_interval_selected === '12hours' ) echo ' selected'?>><?php _e ( 'Every 12 hours', $this->vars->text_domain() ); ?></option>
763
+ <option value="24hours"<?php if ( $cache_cron_interval_selected === '24hours' ) echo ' selected'?>><?php _e ( 'Every 24 hours', $this->vars->text_domain() ); ?></option>
764
+ </select>
765
+
766
+ <div id="sbspf-caching-time-settings" style="">
767
+ <?php _e ( 'at', $this->vars->text_domain() ); ?>
768
+ <select name="<?php echo $this->option_name.'[cache_cron_time]'; ?>" style="width: 80px">
769
+ <option value="1"<?php if ( (int)$cache_cron_time === 1 ) echo ' selected'?>>1:00</option>
770
+ <option value="2"<?php if ( (int)$cache_cron_time === 2 ) echo ' selected'?>>2:00</option>
771
+ <option value="3"<?php if ( (int)$cache_cron_time === 3 ) echo ' selected'?>>3:00</option>
772
+ <option value="4"<?php if ( (int)$cache_cron_time === 4 ) echo ' selected'?>>4:00</option>
773
+ <option value="5"<?php if ( (int)$cache_cron_time === 5 ) echo ' selected'?>>5:00</option>
774
+ <option value="6"<?php if ( (int)$cache_cron_time === 6 ) echo ' selected'?>>6:00</option>
775
+ <option value="7"<?php if ( (int)$cache_cron_time === 7 ) echo ' selected'?>>7:00</option>
776
+ <option value="8"<?php if ( (int)$cache_cron_time === 8 ) echo ' selected'?>>8:00</option>
777
+ <option value="9"<?php if ( (int)$cache_cron_time === 9 ) echo ' selected'?>>9:00</option>
778
+ <option value="10"<?php if ( (int)$cache_cron_time === 10 ) echo ' selected'?>>10:00</option>
779
+ <option value="11"<?php if ( (int)$cache_cron_time === 11 ) echo ' selected'?>>11:00</option>
780
+ <option value="0"<?php if ( (int)$cache_cron_time === 0 ) echo ' selected'?>>12:00</option>
781
+ </select>
782
+
783
+ <select name="<?php echo $this->option_name.'[cache_cron_am_pm]'; ?>" style="width: 50px">
784
+ <option value="am"<?php if ( $cache_cron_am_pm === 'am' ) echo ' selected'?>><?php _e ( 'AM', $this->vars->text_domain() ); ?></option>
785
+ <option value="pm"<?php if ( $cache_cron_am_pm === 'pm' ) echo ' selected'?>><?php _e ( 'PM', $this->vars->text_domain() ); ?></option>
786
+ </select>
787
+ </div>
788
+
789
+ <?php
790
+ if ( wp_next_scheduled( 'sbspf_feed_update' ) ) {
791
+ $time_format = get_option( 'time_format' );
792
+ if ( ! $time_format ) {
793
+ $time_format = 'g:i a';
794
+ }
795
+ //
796
+ $schedule = wp_get_schedule( 'sbspf_feed_update' );
797
+ if ( $schedule == '30mins' ) $schedule = __( 'every 30 minutes', $this->vars->text_domain() );
798
+ if ( $schedule == 'twicedaily' ) $schedule = __( 'every 12 hours', $this->vars->text_domain() );
799
+ $sbspf_next_cron_event = wp_next_scheduled( 'sbspf_feed_update' );
800
+ 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>';
801
+ } else {
802
+ echo '<p style="font-size: 11px; color: #666;">' . __( 'Nothing currently scheduled', $this->vars->text_domain() ) . '</p>';
803
+ }
804
+ ?>
805
+ </div>
806
+ </div>
807
+ <?php
808
+ }
809
+
810
+ public function layout( $args ) {
811
+ $default = isset( $args['default'] ) ? $args['default'] : $args['layouts'][0]['slug'];
812
+ $value = isset( $this->settings[ $args['name'] ] ) ? $this->settings[ $args['name'] ] : $default;
813
+ ?>
814
+ <div class="sbspf_layouts">
815
+ <?php foreach ( $args['layouts'] as $layout ) :
816
+ $pro_class = isset( $layout['pro'] ) ? ' sbspf_pro_only' : '';
817
+ ?>
818
+ <div class="sbspf_layout_cell<?php echo $pro_class; ?>">
819
+ <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>
820
+ </div>
821
+ <?php endforeach; ?>
822
+
823
+ <div class="sbspf_layout_options_wrap">
824
+ <?php foreach ( $args['layouts'] as $layout ) :
825
+ $pro_class = isset( $layout['pro'] ) ? ' sbspf_pro_only' : '';
826
+ ?>
827
+ <div class="sbspf_layout_settings sbspf_layout_type_<?php echo esc_attr( $layout['slug'] ) . $pro_class; ?>">
828
+
829
+ <div class="sbspf_layout_setting">
830
+ <?php echo sby_admin_icon( 'info-circle' ); ?>&nbsp;&nbsp;&nbsp;<span class="sbspf_note" style="margin-left: 0;"><?php echo $layout['note']; ?></span>
831
+ </div>
832
+ <?php if ( ! empty( $layout['options'] ) ) : ?>
833
+ <?php foreach ( $layout['options'] as $option ) :
834
+ $option['name'] = $layout['slug'].$option['name'];
835
+ $option['shortcode']['example'] = isset( $option['shortcode']['example'] ) ? $option['shortcode']['example'] : $option['shortcode_example'];
836
+
837
+ ?>
838
+ <div class="sbspf_layout_setting">
839
+ <?php if ( $option['callback'] !== 'checkbox' ) : ?>
840
+ <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"; ?>
841
+ Eg: <?php echo $option['name']; ?>=<?php echo $option['shortcode']['example']; ?></code><br>
842
+ <?php else:
843
+
844
+ $option['has_shortcode'] = true;
845
+ endif; ?>
846
+ <?php call_user_func_array( array( $this, $option['callback'] ), array( $option ) ); ?>
847
+
848
+ </div>
849
+
850
+ <?php endforeach; ?>
851
+ <?php endif; ?>
852
+
853
+ </div>
854
+
855
+ <?php endforeach; ?>
856
+ </div>
857
+ </div>
858
+ <?php
859
+ }
860
+
861
+ public function instructions( $args ) {
862
+ ?>
863
+ <div class="sbspf_instructions_wrap">
864
+ <?php echo $args['instructions']?>
865
+ </div>
866
+ <?php
867
+ }
868
+
869
+ public function format_title( $label, $name, $shortcode_args = false, $after = '' ) {
870
+ $formatted_label = '<label for="' . $this->option_name . '_' . $name . '">' . $label .'</label>';
871
+ if ( $shortcode_args ) {
872
+ $formatted_label .= '<code class="sbspf_shortcode"> ' . $shortcode_args['key'] . "\n";
873
+ $formatted_label .= 'Eg: ' . $shortcode_args['key'] . '=' . $shortcode_args['example'] . '</code><br>';
874
+ }
875
+ $formatted_label .= $after;
876
+
877
+ return $formatted_label;
878
+ }
879
+
880
+ public function validate_options( $input, $tab ) {
881
+ $updated_options = get_option( $this->option_name, array() );
882
+ $false_if_empty_keys = $this->get_false_fields( $tab );
883
+ $textarea_keys = $this->get_textarea_fields( $tab );
884
+
885
+ foreach ( $false_if_empty_keys as $false_key ) {
886
+ $updated_options[ $false_key ] = false;
887
+ }
888
+
889
+ foreach ( $input as $key => $val ) {
890
+ if ( in_array( $key, $false_if_empty_keys ) ) {
891
+ $updated_options[ $key ] = ($val === 'on');
892
+ } elseif ( in_array( $key, $textarea_keys ) ) {
893
+ $updated_options[ $key ] = sanitize_textarea_field( $val );
894
+ } elseif ( is_array( $val ) ) {
895
+ $updated_options[ $key ] = array();
896
+ foreach ( $val as $key2 => $val2 ) {
897
+ $updated_options[ $key ][ $key2 ] = sanitize_text_field( $val2 );
898
+ }
899
+ } else {
900
+ $updated_options[ $key ] = sanitize_text_field( $val );
901
+ }
902
+ }
903
+
904
+
905
+ if ( $tab === 'configure' ) {
906
+ do_action( $this->option_name . '_after_configure_save', $updated_options );
907
+ } elseif ( $tab === 'customize' ) {
908
+ do_action( $this->option_name . '_after_customize_save', $updated_options );
909
+ }
910
+
911
+ return $updated_options;
912
+ }
913
+
914
+
915
+ public function update_options( $new_settings ) {
916
+ update_option( $this->get_option_name(), $new_settings );
917
+ $this->settings = $new_settings;
918
+ }
919
+
920
+ public function get_sections( $tab ) {
921
+ if ( isset( $this->settings_sections[ $tab ] ) ) {
922
+ return $this->settings_sections[ $tab ];
923
+ }
924
+ return array();
925
+ }
926
+
927
+ public function create_menus() {
928
+ add_menu_page(
929
+ $this->plugin_name,
930
+ $this->plugin_name,
931
+ $this->capability,
932
+ $this->slug,
933
+ array( $this, 'create_options_page' ),
934
+ $this->icon,
935
+ $this->position
936
+ );
937
+
938
+ foreach ( $this->tabs as $tab ) {
939
+ if ( $tab['slug'] !== 'configure' ) {
940
+ $title = isset( $tab['title'] ) ? $tab['title'] : '';
941
+ $capability = isset( $tab['capability'] ) ? $tab['capability'] : 'manage_options';
942
+ $slug = isset( $tab['slug'] ) ? $tab['slug'] : '';
943
+ $callback = isset( $tab['callback'] ) ? $tab['callback'] : array( $this, 'create_options_page' );
944
+
945
+ add_submenu_page(
946
+ $this->slug,
947
+ $title,
948
+ $title,
949
+ $capability,
950
+ $this->slug . '_' . $slug,
951
+ $callback
952
+ );
953
+ }
954
+ }
955
+
956
+ $this->after_create_menues();
957
+ }
958
+
959
+ public function after_create_menues() {
960
+
961
+ }
962
+
963
+ public function set_active_tab( $active_tab ) {
964
+ foreach ( $this->tabs as $tab ) {
965
+ if ( $tab['slug'] === $active_tab ) {
966
+ $this->active_tab = $tab['slug'];
967
+ }
968
+ }
969
+ }
970
+
971
+ public function get_tabs() {
972
+ return $this->tabs;
973
+ }
974
+
975
+ public function get_active_tab() {
976
+ return $this->active_tab;
977
+ }
978
+
979
+ public function get_slug() {
980
+ return $this->slug;
981
+ }
982
+
983
+ public function get_plugin_name() {
984
+ return $this->plugin_name;
985
+ }
986
+
987
+ public function get_path( $view ) {
988
+ return trailingslashit( $this->base_path ) . $view . '.php';
989
+ }
990
+
991
+ public function create_options_page() {
992
+ require_once trailingslashit( $this->base_path ) . 'main.php';
993
+ }
994
+
995
+ public function next_step() {
996
+ $return = array();
997
+ $i = 0;
998
+ foreach ( $this->tabs as $tab ) {
999
+ if ( $this->active_tab === $tab['slug'] && isset( $tab['next_step_instructions'] ) ) {
1000
+ $next_tab_slug = isset( $this->tabs[ $i + 1 ]['slug'] ) ? $this->tabs[ $i + 1 ]['slug'] : $tab['slug'];
1001
+ $return = array(
1002
+ 'instructions' => $tab['next_step_instructions'],
1003
+ 'next_tab' => $next_tab_slug
1004
+ );
1005
+ }
1006
+ $i++;
1007
+ }
1008
+ return $return;
1009
+ }
1010
+
1011
+ public function get_connected_accounts() {
1012
+ global $sbspf_settings;
1013
+
1014
+ if ( isset( $sbspf_settings['connected_accounts'] ) ) {
1015
+ return $sbspf_settings['connected_accounts'];
1016
+ }
1017
+ return array();
1018
+ }
1019
+
1020
+ public static function connect_account( $args ) {
1021
+ global $sbspf_settings;
1022
+
1023
+ // do connection
1024
+
1025
+ // random fake data
1026
+ $account_id = time();
1027
+
1028
+ $sbspf_settings['connected_accounts'][ $account_id ] = array(
1029
+ 'access_token' => 'at_' . str_shuffle( $account_id ),
1030
+ 'channel_id' => $account_id,
1031
+ 'username' => 'test' . $account_id,
1032
+ 'is_valid' => true,
1033
+ 'last_checked' => time(),
1034
+ 'profile_picture' => $args['profile_picture']
1035
+ );
1036
+
1037
+ update_option( 'sbspf_settings', $sbspf_settings );
1038
+
1039
+ return $sbspf_settings['connected_accounts'][ $account_id ];
1040
+ }
1041
+
1042
+ public function default_tooltip_text() {
1043
+ return '<span class="screen-reader-text">' . __( 'What does this mean?', $this->vars->text_domain() ) . '</span>' . sby_admin_icon( 'question-circle' );
1044
+ }
1045
+ }
trunk/inc/admin/class-sby-admin.php ADDED
@@ -0,0 +1,956 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( '-1' );
4
+ }
5
+
6
+ class SBY_Admin extends SB_YOUTUBE_Admin {
7
+
8
+ public function settings_init() {
9
+ $text_domain = $this->vars->text_domain();
10
+
11
+ $defaults = sby_settings_defaults();
12
+
13
+ /**
14
+ * Configure Tab
15
+ */
16
+ $args = array(
17
+ 'id' => 'sbspf_types',
18
+ 'tab' => 'configure',
19
+ 'save_after' => 'true'
20
+ );
21
+ $this->add_settings_section( $args );
22
+
23
+ /* Types */
24
+ $args = array(
25
+ 'name' => 'type',
26
+ 'section' => 'sbspf_types',
27
+ 'callback' => 'types',
28
+ 'title' => '<label>' . __( 'Feed Type', $text_domain ) .'</label>',
29
+ 'shortcode' => array(
30
+ 'key' => 'type',
31
+ 'example' => 'channel',
32
+ 'description' => __( 'Type of feed to display', $text_domain ) . ' e.g. channel, playlist, search, favorites, live',
33
+ 'display_section' => 'configure'
34
+ ),
35
+ 'types' => $this->types
36
+ );
37
+ $this->add_settings_field( $args );
38
+
39
+ $this->pro_only[] = 'type';
40
+
41
+
42
+ /* Cache */
43
+ $args = array(
44
+ 'name' => 'cache',
45
+ 'section' => 'sbspf_types',
46
+ 'callback' => 'cache',
47
+ 'title' => __( 'Check for new posts', $text_domain )
48
+ );
49
+ $this->add_settings_field( $args );
50
+
51
+
52
+ /**
53
+ * Customize Tab
54
+ */
55
+ $args = array(
56
+ 'title' => __( 'General', $text_domain ),
57
+ 'id' => 'sbspf_general',
58
+ 'tab' => 'customize',
59
+ 'save_after' => 'true'
60
+ );
61
+ $this->add_settings_section( $args );
62
+
63
+ /* Width and Height */
64
+ $select_options = array(
65
+ array(
66
+ 'label' => '%',
67
+ 'value' => '%'
68
+ ),
69
+ array(
70
+ 'label' => 'px',
71
+ 'value' => 'px'
72
+ )
73
+ );
74
+
75
+ $args = array(
76
+ 'name' => 'width',
77
+ 'default' => '100',
78
+ 'section' => 'sbspf_general',
79
+ 'callback' => 'text',
80
+ 'min' => 1,
81
+ 'size' => 4,
82
+ 'title' => __( 'Width of Feed', $text_domain ),
83
+ 'shortcode' => array(
84
+ 'key' => 'width',
85
+ 'example' => '300px',
86
+ 'description' => __( 'The width of your feed. Any number with a unit like "px" or "%".', $text_domain ),
87
+ 'display_section' => 'customize'
88
+ ),
89
+ 'select_name' => 'widthunit',
90
+ 'select_options' => $select_options,
91
+ 'hidden' => array(
92
+ 'callback' => 'checkbox',
93
+ 'name' => 'width_responsive',
94
+ 'label' => __( 'Set to be 100% width on mobile?', $text_domain ),
95
+ 'before' => '<div id="sbspf_width_options">',
96
+ 'after' => '</div>',
97
+ '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 )
98
+ ),
99
+ );
100
+ $this->add_settings_field( $args );
101
+
102
+ $select_options = array(
103
+ array(
104
+ 'label' => '%',
105
+ 'value' => '%'
106
+ ),
107
+ array(
108
+ 'label' => 'px',
109
+ 'value' => 'px'
110
+ )
111
+ );
112
+ $args = array(
113
+ 'name' => 'height',
114
+ 'default' => '',
115
+ 'section' => 'sbspf_general',
116
+ 'callback' => 'text',
117
+ 'min' => 1,
118
+ 'size' => 4,
119
+ 'title' => __( 'Height of Feed', $text_domain ),
120
+ 'shortcode' => array(
121
+ 'key' => 'height',
122
+ 'example' => '500px',
123
+ 'description' => __( 'The height of your feed. Any number with a unit like "px" or "em".', $text_domain ),
124
+ 'display_section' => 'customize'
125
+ ),
126
+ 'select_name' => 'heightunit',
127
+ 'select_options' => $select_options,
128
+ );
129
+ $this->add_settings_field( $args );
130
+
131
+ $args = array(
132
+ 'name' => 'background',
133
+ 'default' => '',
134
+ 'section' => 'sbspf_general',
135
+ 'callback' => 'color',
136
+ 'title' => __( 'Background Color', $text_domain ),
137
+ 'shortcode' => array(
138
+ 'key' => 'background',
139
+ 'example' => '#f00',
140
+ 'description' => __( 'Background color for the feed. Any hex color code.', $text_domain ),
141
+ 'display_section' => 'customize'
142
+ ),
143
+ );
144
+ $this->add_settings_field( $args );
145
+
146
+ $args = array(
147
+ 'title' => __( 'Layout', $text_domain ),
148
+ 'id' => 'sbspf_layout',
149
+ 'tab' => 'customize',
150
+ 'save_after' => 'true'
151
+ );
152
+ $this->add_settings_section( $args );
153
+
154
+ $args = array(
155
+ 'name' => 'layout',
156
+ 'section' => 'sbspf_layout',
157
+ 'callback' => 'layout',
158
+ 'title' => __( 'Layout Type', $text_domain ),
159
+ 'layouts' => $this->layouts,
160
+ 'shortcode' => array(
161
+ 'key' => 'layout',
162
+ 'example' => 'list',
163
+ 'description' => __( 'How your posts are displayed visually.', $text_domain ) . ' e.g. list, grid, gallery',
164
+ 'display_section' => 'layout'
165
+ )
166
+ );
167
+ $this->add_settings_field( $args );
168
+
169
+ $this->pro_only[] = 'carouselcols';
170
+ $this->pro_only[] = 'carouselcolsmobile';
171
+ $this->pro_only[] = 'carouselrows';
172
+ $this->pro_only[] = 'carouselloop';
173
+ $this->pro_only[] = 'carouselarrows';
174
+ $this->pro_only[] = 'carouselpag';
175
+ $this->pro_only[] = 'carouselautoplay';
176
+ $this->pro_only[] = 'carouseltime';
177
+
178
+ $select_options = array(
179
+ array(
180
+ 'label' => 'px',
181
+ 'value' => 'px'
182
+ ),
183
+ array(
184
+ 'label' => '%',
185
+ 'value' => '%'
186
+ )
187
+ );
188
+
189
+ $args = array(
190
+ 'name' => 'num',
191
+ 'default' => $defaults['num'],
192
+ 'section' => 'sbspf_layout',
193
+ 'callback' => 'text',
194
+ 'min' => 1,
195
+ 'max' => 50,
196
+ 'size' => 4,
197
+ 'title' => __( 'Number of Videos', $text_domain ),
198
+ 'additional' => '<span class="sby_note">' . __( 'Number of videos to show initially.', $text_domain ) . '</span>',
199
+ 'shortcode' => array(
200
+ 'key' => 'num',
201
+ 'example' => 5,
202
+ 'description' => __( 'The number of videos in the feed', $text_domain ),
203
+ 'display_section' => 'layout'
204
+ )
205
+ );
206
+ $this->add_settings_field( $args );
207
+
208
+ $include_options = array(
209
+ array(
210
+ 'label' => __( 'Play Icon', $text_domain ),
211
+ 'value' => 'icon'
212
+ ),
213
+ array(
214
+ 'label' => __( 'Title', $text_domain ),
215
+ 'value' => 'title',
216
+ 'pro' => true
217
+ ),
218
+ array(
219
+ 'label' => __( 'User Name', $text_domain ),
220
+ 'value' => 'user',
221
+ 'pro' => true
222
+ ),
223
+ array(
224
+ 'label' => __( 'Views', $text_domain ),
225
+ 'value' => 'views',
226
+ 'pro' => true
227
+ ),
228
+ array(
229
+ 'label' => __( 'Date', $text_domain ),
230
+ 'value' => 'date',
231
+ 'pro' => true
232
+ ),
233
+ array(
234
+ 'label' => __( 'Live Stream Countdown (when applies)', $text_domain ),
235
+ 'value' => 'countdown',
236
+ 'pro' => true
237
+ ),
238
+ array(
239
+ 'label' => __( 'Stats (like and comment counts)', $text_domain ),
240
+ 'value' => 'stats',
241
+ 'pro' => true
242
+ ),
243
+ array(
244
+ 'label' => __( 'Description', $text_domain ),
245
+ 'value' => 'description',
246
+ 'pro' => true
247
+ ),
248
+ );
249
+ $args = array(
250
+ 'name' => 'include',
251
+ 'default' => $defaults['include'],
252
+ 'section' => 'sbspf_layout',
253
+ 'callback' => 'multi_checkbox',
254
+ 'title' => __( 'Show/Hide', $text_domain ),
255
+ 'shortcode' => array(
256
+ 'key' => 'include',
257
+ 'example' => '"icon"',
258
+ 'description' => __( 'What video information will display in the feed. eg.', $text_domain ) . ' icon',
259
+ 'display_section' => 'customize'
260
+ ),
261
+ 'select_options' => $include_options,
262
+ );
263
+ $this->add_settings_field( $args );
264
+
265
+ $args = array(
266
+ 'name' => 'itemspacing',
267
+ 'default' => 5,
268
+ 'section' => 'sbspf_layout',
269
+ 'callback' => 'text',
270
+ 'min' => 0,
271
+ 'size' => 4,
272
+ 'title' => __( 'Spacing between videos', $text_domain ),
273
+ 'shortcode' => array(
274
+ 'key' => 'itemspacing',
275
+ 'example' => '5px',
276
+ 'description' => __( 'The spacing/padding around the videos in the feed. Any number with a unit like "px" or "em".', $text_domain ),
277
+ 'display_section' => 'layout'
278
+ ),
279
+ 'select_name' => 'itemspacingunit',
280
+ 'select_options' => $select_options,
281
+ );
282
+ $this->add_settings_field( $args );
283
+
284
+ $select_options = array(
285
+ array(
286
+ 'label' => __( 'Below video thumbnail', $text_domain ),
287
+ 'value' => 'below'
288
+ ),
289
+ array(
290
+ 'label' => __( 'Next to video thumbnail', $text_domain ),
291
+ 'value' => 'side'
292
+ )
293
+ );
294
+ $args = array(
295
+ 'name' => 'infoposition',
296
+ 'default' => 'below',
297
+ 'section' => 'sbspf_layout',
298
+ 'pro' => true,
299
+ 'callback' => 'select',
300
+ 'title' => __( 'Position', $text_domain ),
301
+ 'shortcode' => array(
302
+ 'key' => 'infoposition',
303
+ 'example' => 'side',
304
+ 'description' => __( 'Where the information (title, description, stats) will display. eg.', $text_domain ) . ' below, side, none',
305
+ 'display_section' => 'customize'
306
+ ),
307
+ 'options' => $select_options,
308
+ );
309
+ $this->add_settings_field( $args );
310
+
311
+ $args = array(
312
+ 'title' => __( 'Header', $text_domain ),
313
+ 'id' => 'sbspf_header',
314
+ 'tab' => 'customize',
315
+ );
316
+ $this->add_settings_section( $args );
317
+
318
+ $args = array(
319
+ 'name' => 'showheader',
320
+ 'section' => 'sbspf_header',
321
+ 'callback' => 'checkbox',
322
+ 'title' => __( 'Show Header', $text_domain ),
323
+ 'default' => true,
324
+ 'shortcode' => array(
325
+ 'key' => 'showheader',
326
+ 'example' => 'false',
327
+ 'description' => __( 'Include a header for this feed.', $text_domain ),
328
+ 'display_section' => 'header'
329
+ )
330
+ );
331
+ $this->add_settings_field( $args );
332
+
333
+ $args = array(
334
+ 'name' => 'showdescription',
335
+ 'section' => 'sbspf_header',
336
+ 'callback' => 'checkbox',
337
+ 'title' => __( 'Show Channel Description', $text_domain ),
338
+ 'default' => true,
339
+ 'shortcode' => array(
340
+ 'key' => 'showdescription',
341
+ 'example' => 'false',
342
+ 'description' => __( 'Include the channel description in the header.', $text_domain ),
343
+ 'display_section' => 'header'
344
+ )
345
+ );
346
+ $this->add_settings_field( $args );
347
+
348
+ $args = array(
349
+ 'name' => 'showsubscribers',
350
+ 'section' => 'sbspf_header',
351
+ 'callback' => 'checkbox',
352
+ 'pro' => true,
353
+ 'title' => __( 'Show Subscribers', $text_domain ),
354
+ 'default' => true,
355
+ 'shortcode' => array(
356
+ 'key' => 'showsubscribers',
357
+ 'example' => 'false',
358
+ 'description' => __( 'Include the number of subscribers in the header.', $text_domain ),
359
+ 'display_section' => 'header'
360
+ )
361
+ );
362
+ $this->add_settings_field( $args );
363
+
364
+ $args = array(
365
+ 'title' => __( '"Load More" Button', $text_domain ),
366
+ 'id' => 'sbspf_loadmore',
367
+ 'tab' => 'customize',
368
+ );
369
+ $this->add_settings_section( $args );
370
+
371
+ $args = array(
372
+ 'name' => 'showbutton',
373
+ 'section' => 'sbspf_loadmore',
374
+ 'callback' => 'checkbox',
375
+ 'title' => __( 'Show "Load More" Button', $text_domain ),
376
+ 'default' => true,
377
+ 'shortcode' => array(
378
+ 'key' => 'showbutton',
379
+ 'example' => 'false',
380
+ 'description' => __( 'Include a "Load More" button at the bottom of the feed to load more videos.', $text_domain ),
381
+ 'display_section' => 'button'
382
+ )
383
+ );
384
+ $this->add_settings_field( $args );
385
+
386
+ $args = array(
387
+ 'name' => 'buttoncolor',
388
+ 'default' => '',
389
+ 'section' => 'sbspf_loadmore',
390
+ 'callback' => 'color',
391
+ 'title' => __( 'Button Background Color', $text_domain ),
392
+ 'shortcode' => array(
393
+ 'key' => 'buttoncolor',
394
+ 'example' => '#0f0',
395
+ 'description' => __( 'Background color for the "Load More" button. Any hex color code.', $text_domain ),
396
+ 'display_section' => 'button'
397
+ ),
398
+ );
399
+ $this->add_settings_field( $args );
400
+
401
+ $args = array(
402
+ 'name' => 'buttontextcolor',
403
+ 'default' => '',
404
+ 'section' => 'sbspf_loadmore',
405
+ 'callback' => 'color',
406
+ 'title' => __( 'Button Text Color', $text_domain ),
407
+ 'shortcode' => array(
408
+ 'key' => 'buttontextcolor',
409
+ 'example' => '#00f',
410
+ 'description' => __( 'Text color for the "Load More" button. Any hex color code.', $text_domain ),
411
+ 'display_section' => 'button'
412
+ ),
413
+ );
414
+ $this->add_settings_field( $args );
415
+
416
+ $args = array(
417
+ 'name' => 'buttontext',
418
+ 'default' => __( 'Load More...', $text_domain ),
419
+ 'section' => 'sbspf_loadmore',
420
+ 'callback' => 'text',
421
+ 'title' => __( 'Button Text', $text_domain ),
422
+ 'shortcode' => array(
423
+ 'key' => 'buttontext',
424
+ 'example' => '"More Videos"',
425
+ 'description' => __( 'The text that appers on the "Load More" button.', $text_domain ),
426
+ 'display_section' => 'button'
427
+ )
428
+ );
429
+ $this->add_settings_field( $args );
430
+
431
+ /* Subscribe button */
432
+ $args = array(
433
+ 'title' => __( '"Subscribe" Button', $text_domain ),
434
+ 'id' => 'sbspf_subscribe',
435
+ 'tab' => 'customize',
436
+ 'save_after' => true
437
+ );
438
+ $this->add_settings_section( $args );
439
+
440
+ $args = array(
441
+ 'name' => 'showsubscribe',
442
+ 'section' => 'sbspf_subscribe',
443
+ 'callback' => 'checkbox',
444
+ 'title' => __( 'Show "Subscribe" Button', $text_domain ),
445
+ 'default' => true,
446
+ 'shortcode' => array(
447
+ 'key' => 'showsubscribe',
448
+ 'example' => 'false',
449
+ 'description' => __( 'Include a "Subscribe" button at the bottom of the feed to load more videos.', $text_domain ),
450
+ 'display_section' => 'subscribe'
451
+ )
452
+ );
453
+ $this->add_settings_field( $args );
454
+
455
+ $args = array(
456
+ 'name' => 'subscribecolor',
457
+ 'default' => '',
458
+ 'section' => 'sbspf_subscribe',
459
+ 'callback' => 'color',
460
+ 'title' => __( 'Subscribe Background Color', $text_domain ),
461
+ 'shortcode' => array(
462
+ 'key' => 'subscribecolor',
463
+ 'example' => '#0f0',
464
+ 'description' => __( 'Background color for the "Subscribe" button. Any hex color code.', $text_domain ),
465
+ 'display_section' => 'subscribe'
466
+ ),
467
+ );
468
+ $this->add_settings_field( $args );
469
+
470
+ $args = array(
471
+ 'name' => 'subscribetextcolor',
472
+ 'default' => '',
473
+ 'section' => 'sbspf_subscribe',
474
+ 'callback' => 'color',
475
+ 'title' => __( 'Subscribe Text Color', $text_domain ),
476
+ 'shortcode' => array(
477
+ 'key' => 'subscribetextcolor',
478
+ 'example' => '#00f',
479
+ 'description' => __( 'Text color for the "Subscribe" button. Any hex color code.', $text_domain ),
480
+ 'display_section' => 'subscribe'
481
+ ),
482
+ );
483
+ $this->add_settings_field( $args );
484
+
485
+ $args = array(
486
+ 'name' => 'subscribetext',
487
+ 'default' => __( 'Subscribe', $text_domain ),
488
+ 'section' => 'sbspf_subscribe',
489
+ 'callback' => 'text',
490
+ 'title' => __( 'Subscribe Text', $text_domain ),
491
+ 'shortcode' => array(
492
+ 'key' => 'subscribetext',
493
+ 'example' => '"Subscribe to My Channel"',
494
+ 'description' => __( 'The text that appers on the "Subscribe" button.', $text_domain ),
495
+ 'display_section' => 'subscribe'
496
+ )
497
+ );
498
+ $this->add_settings_field( $args );
499
+
500
+ $args = array(
501
+ 'title' => __( 'Video Experience', $text_domain ),
502
+ 'id' => 'sbspf_experience',
503
+ 'tab' => 'customize',
504
+ );
505
+ $this->add_settings_section( $args );
506
+
507
+ $select_options = array(
508
+ array(
509
+ 'label' => '9:16',
510
+ 'value' => '9:16'
511
+ ),
512
+ array(
513
+ 'label' => '3:4',
514
+ 'value' => '3:4'
515
+ ),
516
+ );
517
+ $args = array(
518
+ 'name' => 'playerratio',
519
+ 'default' => '9:16',
520
+ 'section' => 'sbspf_experience',
521
+ 'callback' => 'select',
522
+ 'title' => __( 'Player Size Ratio', $text_domain ),
523
+ 'shortcode' => array(
524
+ 'key' => 'playerratio',
525
+ 'example' => '9:16',
526
+ 'description' => __( 'Player height relative to width e.g.', $text_domain ) . ' 9:16, 3:4',
527
+ 'display_section' => 'experience'
528
+ ),
529
+ 'options' => $select_options,
530
+ 'tooltip_info' => __( 'A 9:16 ratio does not leave room for video title and playback tools while a 3:4 ratio does.', $text_domain )
531
+ );
532
+ $this->add_settings_field( $args );
533
+
534
+ $select_options = array(
535
+ array(
536
+ 'label' => __( 'Play when clicked', $text_domain ),
537
+ 'value' => 'onclick'
538
+ ),
539
+ array(
540
+ 'label' => 'Play automatically (desktop only)',
541
+ 'value' => 'automatically'
542
+ )
543
+ );
544
+ $args = array(
545
+ 'name' => 'playvideo',
546
+ 'default' => 'onclick',
547
+ 'section' => 'sbspf_experience',
548
+ 'callback' => 'select',
549
+ 'title' => __( 'When does video play?', $text_domain ),
550
+ 'shortcode' => array(
551
+ 'key' => 'playvideo',
552
+ 'example' => 'onclick',
553
+ 'description' => __( 'What the user needs to do to play a video. eg.', $text_domain ) . ' onclick, automatically',
554
+ 'display_section' => 'customize'
555
+ ),
556
+ 'options' => $select_options,
557
+ '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 )
558
+ );
559
+ $this->add_settings_field( $args );
560
+
561
+ $cta_options = array(
562
+ array(
563
+ 'label' => __( 'Related Videos', SBY_TEXT_DOMAIN ),
564
+ 'slug' => 'related',
565
+ 'pro' => true,
566
+ 'note' => __( 'Display video thumbnails from the feed that play on your site when clicked.', SBY_TEXT_DOMAIN )
567
+ ),
568
+ array(
569
+ 'label' => 'Custom Link',
570
+ 'slug' => 'link',
571
+ 'pro' => true,
572
+ 'note' => __( 'Display a button link to a custom URL.', SBY_TEXT_DOMAIN ),
573
+ 'options' => array(
574
+ array(
575
+ 'name' => 'instructions',
576
+ 'callback' => 'instructions',
577
+ 'instructions' => __( 'To set a link for each video individually, add the link and button text in the video description on YouTube in this format:', SBY_TEXT_DOMAIN ) . '<br><br><code>{Link: Button Text https://my-site.com/buy-now/my-product/}</code>',
578
+ 'label' => __( 'Custom link for each video', SBY_TEXT_DOMAIN ),
579
+ ),
580
+ array(
581
+ 'name' => 'url',
582
+ 'callback' => 'text',
583
+ 'label' => __( 'Default Link', SBY_TEXT_DOMAIN ),
584
+ 'class' => 'large-text',
585
+ 'default' => '',
586
+ 'shortcode' => array(
587
+ 'example' => 'https://my-site.com/buy-now/my-product/',
588
+ 'description' => __( 'URL for viewer to visit for the call to action.', $text_domain ),
589
+ )
590
+ ),
591
+ array(
592
+ 'name' => 'opentype',
593
+ 'callback' => 'select',
594
+ 'options' => array(
595
+ array(
596
+ 'label' => __( 'Same window', SBY_TEXT_DOMAIN ),
597
+ 'value' => 'same'
598
+ ),
599
+ array(
600
+ 'label' => __( 'New window', SBY_TEXT_DOMAIN ),
601
+ 'value' => 'newwindow'
602
+ )
603
+ ),
604
+ 'label' => __( 'Link Open Type', SBY_TEXT_DOMAIN ),
605
+ 'default' => 'same',
606
+ 'shortcode' => array(
607
+ 'example' => 'newwindow',
608
+ 'description' => __( 'Whether to open the page in a new window or the same window.', $text_domain ),
609
+ )
610
+ ),
611
+ array(
612
+ 'name' => 'text',
613
+ 'callback' => 'text',
614
+ 'label' => __( 'Default Button Text', SBY_TEXT_DOMAIN ),
615
+ 'default' => __( 'Learn More', SBY_TEXT_DOMAIN ),
616
+ 'shortcode' => array(
617
+ 'example' => 'Buy Now',
618
+ 'description' => __( 'Text that appears on the call-to-action button.', $text_domain ),
619
+ )
620
+ ),
621
+ array(
622
+ 'name' => 'color',
623
+ 'default' => '',
624
+ 'callback' => 'color',
625
+ 'label' => __( 'Button Background Color', SBY_TEXT_DOMAIN ),
626
+ 'shortcode' => array(
627
+ 'example' => '#0f0',
628
+ 'description' => __( 'Button background. Turns opaque on hover.', $text_domain ),
629
+ )
630
+ ),
631
+ array(
632
+ 'name' => 'textcolor',
633
+ 'default' => '',
634
+ 'callback' => 'color',
635
+ 'label' => __( 'Button Text Color', SBY_TEXT_DOMAIN ),
636
+ 'shortcode' => array(
637
+ 'example' => '#0f0',
638
+ 'description' => __( 'Color of the text on the call-to-action-button', $text_domain ),
639
+ )
640
+ )
641
+ )
642
+ ),
643
+ array(
644
+ 'label' => __( 'YouTube Default', SBY_TEXT_DOMAIN ),
645
+ 'slug' => 'default',
646
+ 'pro' => true,
647
+ 'note' => __( 'YouTube suggested videos from your channel that play on YouTube when clicked.', SBY_TEXT_DOMAIN )
648
+ ),
649
+ );
650
+ $this->pro_only[] = 'linkurl';
651
+ $this->pro_only[] = 'linkopentype';
652
+ $this->pro_only[] = 'linktext';
653
+ $this->pro_only[] = 'linkcolor';
654
+ $this->pro_only[] = 'linktextcolor';
655
+
656
+ $args = array(
657
+ 'name' => 'cta',
658
+ 'default' => 'related',
659
+ 'section' => 'sbspf_experience',
660
+ 'callback' => 'sub_option',
661
+ 'pro' => true,
662
+ 'sub_options' => $cta_options,
663
+ 'title' => __( 'Call to Action', $text_domain ),
664
+ 'before' => '<p style="margin-bottom: 10px">' . __( 'What the user sees when a video pauses or ends.', $text_domain ) . '</p>',
665
+ 'shortcode' => array(
666
+ 'key' => 'cta',
667
+ 'example' => 'link',
668
+ 'description' => __( 'What the user sees when a video pauses or ends. eg.', $text_domain ) . ' related, link',
669
+ 'display_section' => 'experience'
670
+ ),
671
+ 'tooltip_info' => __( 'Choose what will happen after a video is paused or completes.', $text_domain )
672
+ );
673
+ $this->add_settings_field( $args );
674
+
675
+ $args = array(
676
+ 'title' => __( 'Moderation', $text_domain ),
677
+ 'id' => 'sbspf_moderation',
678
+ 'tab' => 'customize',
679
+ 'pro' => __( 'Upgrade to Pro to enable Moderation settings', $text_domain ),
680
+ );
681
+ $this->add_settings_section( $args );
682
+
683
+ $args = array(
684
+ 'name' => 'includewords',
685
+ 'default' => '',
686
+ 'section' => 'sbspf_moderation',
687
+ 'callback' => 'text',
688
+ 'class' => 'large-text',
689
+ 'title' => __( 'Show videos containing these words or hashtags', $text_domain ),
690
+ 'shortcode' => array(
691
+ 'key' => 'includewords',
692
+ 'example' => '#filter',
693
+ 'description' => __( 'Show videos that have specific text in the title or description.', $text_domain ),
694
+ 'display_section' => 'customize'
695
+ ),
696
+ 'additional' => __( '"includewords" separate multiple words with commas, include "#" for hashtags', $text_domain )
697
+ );
698
+ $this->add_settings_field( $args );
699
+
700
+ $args = array(
701
+ 'name' => 'excludewords',
702
+ 'default' => '',
703
+ 'section' => 'sbspf_moderation',
704
+ 'callback' => 'text',
705
+ 'class' => 'large-text',
706
+ 'title' => __( 'Remove videos containing these words or hashtags', $text_domain ),
707
+ 'shortcode' => array(
708
+ 'key' => 'excludewords',
709
+ 'example' => '#filter',
710
+ 'description' => __( 'Remove videos that have specific text in the title or description.', $text_domain ),
711
+ 'display_section' => 'customize'
712
+ ),
713
+ 'additional' => __( '"excludewords" separate multiple words with commas, include "#" for hashtags', $text_domain )
714
+ );
715
+ $this->add_settings_field( $args );
716
+ $this->pro_only[] = 'includewords';
717
+ $this->pro_only[] = 'excludewords';
718
+
719
+ $args = array(
720
+ 'name' => 'hidevideos',
721
+ 'default' => '',
722
+ 'section' => 'sbspf_moderation',
723
+ 'callback' => 'textarea',
724
+ 'title' => __( 'Hide Specific Videos', $text_domain ),
725
+ 'options' => $select_options,
726
+ 'tooltip_info' => __( 'Separate IDs with commas.', $text_domain ) . '<a class="sbspf_tooltip_link" href="JavaScript:void(0);">'.$this->default_tooltip_text().'</a>
727
+ <p class="sbspf_tooltip sbspf_more_info">' . __( 'These are the specific ID numbers associated with a video or with a post. You can find the ID of a video by viewing the video on YouTube and copy/pasting the ID number from the end of the URL. ex. <code>https://www.youtube.com/watch?v=<span class="sbspf-highlight">Ij1KvL8eN</span></code>', $text_domain ) . '</p>'
728
+ );
729
+ $this->add_settings_field( $args );
730
+
731
+ $args = array(
732
+ 'title' => __( 'Custom Code Snippets', $text_domain ),
733
+ 'id' => 'sbspf_custom_snippets',
734
+ 'tab' => 'customize'
735
+ );
736
+ $this->add_settings_section( $args );
737
+
738
+ $args = array(
739
+ 'name' => 'custom_css',
740
+ 'default' => '',
741
+ 'section' => 'sbspf_custom_snippets',
742
+ 'callback' => 'textarea',
743
+ 'title' => __( 'Custom CSS', $text_domain ),
744
+ 'options' => $select_options,
745
+ 'tooltip_info' => __( 'Enter your own custom CSS in the box below', $text_domain )
746
+ );
747
+ $this->add_settings_field( $args );
748
+
749
+ $args = array(
750
+ 'name' => 'custom_js',
751
+ 'default' => '',
752
+ 'section' => 'sbspf_custom_snippets',
753
+ 'callback' => 'textarea',
754
+ 'title' => __( 'Custom JavaScript', $text_domain ),
755
+ 'options' => $select_options,
756
+ 'tooltip_info' => __( 'Enter your own custom JavaScript/jQuery in the box below', $text_domain ),
757
+ 'note' => __( 'Note: Custom JavaScript reruns every time more videos are loaded into the feed', $text_domain )
758
+ );
759
+ $this->add_settings_field( $args );
760
+
761
+ $args = array(
762
+ 'title' => __( 'Advanced', $text_domain ),
763
+ 'id' => 'sbspf_advanced',
764
+ 'tab' => 'customize',
765
+ 'save_after' => true
766
+ );
767
+ $this->add_settings_section( $args );
768
+
769
+ $args = array(
770
+ 'name' => 'preserve_settings',
771
+ 'section' => 'sbspf_advanced',
772
+ 'callback' => 'checkbox',
773
+ 'title' => __( 'Preserve settings when plugin is removed', $text_domain ),
774
+ 'default' => false,
775
+ '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 )
776
+ );
777
+ $this->add_settings_field( $args );
778
+
779
+ $select_options = array(
780
+ array(
781
+ 'label' => __( 'Background', $text_domain ),
782
+ 'value' => 'background'
783
+ ),
784
+ array(
785
+ 'label' => __( 'Page', $text_domain ),
786
+ 'value' => 'page'
787
+ ),
788
+ array(
789
+ 'label' => __( 'None', $text_domain ),
790
+ 'value' => 'none'
791
+ )
792
+ );
793
+ $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. Existing feeds will only have 15 or fewer videos available initially. Continue?', $text_domain ).'" style="margin-top: 1px;" type="submit" value="'.esc_attr( 'Clear YouTube Posts', $text_domain ).'">';
794
+ $args = array(
795
+ 'name' => 'storage_process',
796
+ 'default' => '',
797
+ 'section' => 'sbspf_advanced',
798
+ 'callback' => 'select',
799
+ 'title' => __( 'Local storage process', $text_domain ),
800
+ 'options' => $select_options,
801
+ 'additional' => $additional,
802
+ '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. Please note that changing this setting to "none" will limit the number of posts available in the feed to 15 or less.', $text_domain )
803
+ );
804
+ $this->add_settings_field( $args );
805
+
806
+ $args = array(
807
+ 'name' => 'cronclear',
808
+ 'section' => 'sbspf_advanced',
809
+ 'callback' => 'checkbox',
810
+ 'title' => __( 'Cron Clear Cache', $text_domain ),
811
+ 'default' => false,
812
+ 'tooltip_info' => __( 'If your YouTube feed is not updating, your WordPress installation may have a rare issue with clearing temporary data in your database. Enable this setting to use WordPress cron to clear your feed caches.', $text_domain )
813
+ );
814
+ $this->add_settings_field( $args );
815
+
816
+ $args = array(
817
+ 'name' => 'ajaxtheme',
818
+ 'section' => 'sbspf_advanced',
819
+ 'callback' => 'checkbox',
820
+ 'title' => __( 'Are you using an AJAX theme?', $text_domain ),
821
+ 'default' => false,
822
+ '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 )
823
+ );
824
+ $this->add_settings_field( $args );
825
+
826
+ $args = array(
827
+ 'name' => 'customtemplates',
828
+ 'section' => 'sbspf_advanced',
829
+ 'callback' => 'checkbox',
830
+ 'title' => __( 'Enable Custom Templates', $text_domain ),
831
+ 'default' => false,
832
+ 'tooltip_info' => __( 'The default HTML for the feed can be replaced with custom templates added to your theme\'s folder. Enable this setting to use these templates. See <a href="https://smashballoon.com/youtube-custom-templates/" target="_blank">this guide</a>', $text_domain )
833
+ );
834
+ $this->add_settings_field( $args );
835
+
836
+ $args = array(
837
+ 'name' => 'eagerload',
838
+ 'section' => 'sbspf_advanced',
839
+ 'callback' => 'checkbox',
840
+ 'title' => __( 'Load Iframes on Page Load', $text_domain ),
841
+ 'default' => false,
842
+ 'tooltip_info' => __( 'To optimize the performance of your site and feeds, the plugin loads iframes only after a visitor interacts with the feed. Enabling this setting will cause YouTube player iframes to load when the page loads. Some features may work differently when this is enabled.', $text_domain )
843
+ );
844
+ $this->add_settings_field( $args );
845
+
846
+ }
847
+
848
+ public function cache( $args ) {
849
+ $social_network = $this->vars->social_network();
850
+ $type_selected = isset( $this->settings['caching_type'] ) ? $this->settings['caching_type'] : 'page';
851
+ $caching_time = isset( $this->settings['caching_time'] ) ? $this->settings['caching_time'] : 1;
852
+ $cache_time_unit_selected = isset( $this->settings['cache_time_unit'] ) ? $this->settings['cache_time_unit'] : 'hours';
853
+
854
+ $cache_cron_interval_selected = isset( $this->settings['cache_cron_interval'] ) ? $this->settings['cache_cron_interval'] : '';
855
+ $cache_cron_time = isset( $this->settings['cache_cron_time'] ) ? $this->settings['cache_cron_time'] : '';
856
+ $cache_cron_am_pm = isset( $this->settings['cache_cron_am_pm'] ) ? $this->settings['cache_cron_am_pm'] : '';
857
+
858
+ ?>
859
+ <div class="sbspf_cache_settings_wrap">
860
+ <div class="sbspf_row">
861
+ <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'?>>
862
+ <label class="sbspf_radio_label" for="sbspf_caching_type_page"><?php _e ( 'When the page loads', $this->vars->text_domain() ); ?></label>
863
+ <a class="sbspf_tooltip_link" href="JavaScript:void(0);" style="position: relative; top: 2px;"><?php echo $this->default_tooltip_text() ?></a>
864
+ <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>
865
+ <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 with a minimum time of 15 minutes. 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>
866
+ <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 ); ?>
867
+ </p>
868
+ </div>
869
+ <div class="sbspf_row sbspf-caching-page-options" style="display: none;">
870
+ <?php _e ( 'Every', $this->vars->text_domain() ); ?>:
871
+ <input name="<?php echo $this->option_name.'[caching_time]'; ?>" type="text" value="<?php echo esc_attr( $caching_time ); ?>" size="4">
872
+ <select name="<?php echo $this->option_name.'[cache_time_unit]'; ?>">
873
+ <option value="minutes"<?php if ( $cache_time_unit_selected === 'minutes' ) echo ' selected'?>><?php _e ( 'Minutes', $this->vars->text_domain() ); ?></option>
874
+ <option value="hours"<?php if ( $cache_time_unit_selected === 'hours' ) echo ' selected'?>><?php _e ( 'Hours', $this->vars->text_domain() ); ?></option>
875
+ <option value="days"<?php if ( $cache_time_unit_selected === 'days' ) echo ' selected'?>><?php _e ( 'Days', $this->vars->text_domain() ); ?></option>
876
+ </select>
877
+ <a class="sbspf_tooltip_link" href="JavaScript:void(0);"><?php _e ( 'What does this mean?', $this->vars->text_domain() ); ?></a>
878
+ <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>
879
+ </div>
880
+
881
+ <div class="sbspf_row">
882
+ <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'?>>
883
+ <label class="sbspf_radio_label" for="sbspf_caching_type_cron"><?php _e ( 'In the background', $this->vars->text_domain() ); ?></label>
884
+ </div>
885
+ <div class="sbspf_row sbspf-caching-cron-options" style="display: block;">
886
+
887
+ <select name="<?php echo $this->option_name.'[cache_cron_interval]'; ?>" id="sbspf_cache_cron_interval">
888
+ <option value="30mins"<?php if ( $cache_cron_interval_selected === '30mins' ) echo ' selected'?>><?php _e ( 'Every 30 minutes', $this->vars->text_domain() ); ?></option>
889
+ <option value="1hour"<?php if ( $cache_cron_interval_selected === '1hour' ) echo ' selected'?>><?php _e ( 'Every hour', $this->vars->text_domain() ); ?></option>
890
+ <option value="12hours"<?php if ( $cache_cron_interval_selected === '12hours' ) echo ' selected'?>><?php _e ( 'Every 12 hours', $this->vars->text_domain() ); ?></option>
891
+ <option value="24hours"<?php if ( $cache_cron_interval_selected === '24hours' ) echo ' selected'?>><?php _e ( 'Every 24 hours', $this->vars->text_domain() ); ?></option>
892
+ </select>
893
+
894
+ <div id="sbspf-caching-time-settings" style="">
895
+ <?php _e ( 'at', $this->vars->text_domain() ); ?>
896
+ <select name="<?php echo $this->option_name.'[cache_cron_time]'; ?>" style="width: 80px">
897
+ <option value="1"<?php if ( (int)$cache_cron_time === 1 ) echo ' selected'?>>1:00</option>
898
+ <option value="2"<?php if ( (int)$cache_cron_time === 2 ) echo ' selected'?>>2:00</option>
899
+ <option value="3"<?php if ( (int)$cache_cron_time === 3 ) echo ' selected'?>>3:00</option>
900
+ <option value="4"<?php if ( (int)$cache_cron_time === 4 ) echo ' selected'?>>4:00</option>
901
+ <option value="5"<?php if ( (int)$cache_cron_time === 5 ) echo ' selected'?>>5:00</option>
902
+ <option value="6"<?php if ( (int)$cache_cron_time === 6 ) echo ' selected'?>>6:00</option>
903
+ <option value="7"<?php if ( (int)$cache_cron_time === 7 ) echo ' selected'?>>7:00</option>
904
+ <option value="8"<?php if ( (int)$cache_cron_time === 8 ) echo ' selected'?>>8:00</option>
905
+ <option value="9"<?php if ( (int)$cache_cron_time === 9 ) echo ' selected'?>>9:00</option>
906
+ <option value="10"<?php if ( (int)$cache_cron_time === 10 ) echo ' selected'?>>10:00</option>
907
+ <option value="11"<?php if ( (int)$cache_cron_time === 11 ) echo ' selected'?>>11:00</option>
908
+ <option value="0"<?php if ( (int)$cache_cron_time === 0 ) echo ' selected'?>>12:00</option>
909
+ </select>
910
+
911
+ <select name="<?php echo $this->option_name.'[cache_cron_am_pm]'; ?>" style="width: 50px">
912
+ <option value="am"<?php if ( $cache_cron_am_pm === 'am' ) echo ' selected'?>><?php _e ( 'AM', $this->vars->text_domain() ); ?></option>
913
+ <option value="pm"<?php if ( $cache_cron_am_pm === 'pm' ) echo ' selected'?>><?php _e ( 'PM', $this->vars->text_domain() ); ?></option>
914
+ </select>
915
+ </div>
916
+
917
+ <?php
918
+ if ( wp_next_scheduled( 'sbspf_feed_update' ) ) {
919
+ $time_format = get_option( 'time_format' );
920
+ if ( ! $time_format ) {
921
+ $time_format = 'g:i a';
922
+ }
923
+ //
924
+ $schedule = wp_get_schedule( 'sbspf_feed_update' );
925
+ if ( $schedule == '30mins' ) $schedule = __( 'every 30 minutes', $this->vars->text_domain() );
926
+ if ( $schedule == 'twicedaily' ) $schedule = __( 'every 12 hours', $this->vars->text_domain() );
927
+ $sbspf_next_cron_event = wp_next_scheduled( 'sbspf_feed_update' );
928
+ 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>';
929
+ } else {
930
+ echo '<p style="font-size: 11px; color: #666;">' . __( 'Nothing currently scheduled', $this->vars->text_domain() ) . '</p>';
931
+ }
932
+ ?>
933
+ </div>
934
+ </div>
935
+ <?php
936
+ }
937
+
938
+ public function get_connected_accounts() {
939
+ global $sby_settings;
940
+
941
+ if ( isset( $sby_settings['connected_accounts'] ) ) {
942
+ return $sby_settings['connected_accounts'];
943
+ }
944
+ return array();
945
+ }
946
+
947
+ public function access_token_listener() {
948
+ if ( isset( $_GET['page'] ) && $_GET['page'] === SBY_SLUG && isset( $_GET['sby_access_token'] ) ) {
949
+ sby_attempt_connection();
950
+ }
951
+ }
952
+
953
+ public static function connect_account( $args ) {
954
+ sby_update_or_connect_account( $args );
955
+ }
956
+ }
trunk/inc/admin/templates/configure.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h3><?php _e( 'Configure', $text_domain ); ?></h3>
2
+ <div id="sbspf_config">
3
+ <?php
4
+ $notice_not_dismissed = sby_notice_not_dismissed( 'sby_connect_warning_notice' );
5
+ $warning_data_att = $notice_not_dismissed ? ' data-show-warning="1"' : '';
6
+ ?>
7
+ <a href="<?php echo $oauth_processor_url . admin_url( 'admin.php?page=' . esc_attr( $slug ) ); ?>" id="sbspf_get_token"<?php echo $warning_data_att; ?>><?php echo sby_icon( $slug, 'sbspf_small_svg' ); ?> <?php echo sprintf( __( 'Connect to %s to Create a Feed', $text_domain ), $social_network ); ?></a>
8
+ <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>
9
+ </div>
10
+
11
+ <form method="post" action="">
12
+ <?php
13
+ $settings = $this->settings;
14
+ $api_key = isset( $settings['api_key'] ) ? $settings['api_key'] : '';
15
+ ?>
16
+ <table class="form-table sbspf_own_credentials_wrap" role="presentation">
17
+ <tbody>
18
+ <tr>
19
+ <th scope="row">
20
+ <label for="sby_app_id"><?php _e( "API Key", $text_domain ); ?></label>
21
+ <p class="sbspf_aside sbspf_red"><?php _e( "Recommended", $text_domain ); ?></p>
22
+ </th>
23
+ <td>
24
+ <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" />
25
+ <p class="sbspf_aside"><?php echo __( 'Entering an API key is <strong>optional</strong> but recommended. It allows the plugin to fetch older videos and prevents potential disruption in your feed. It only takes a few minutes: <a href="https://smashballoon.com/youtube-api-key/" target="_blank" rel="noopener">Get my API key.</a>', $text_domain ); ?></p>
26
+ </td>
27
+ </tr>
28
+
29
+ </tbody>
30
+ </table>
31
+ <?php $this->hidden_fields_for_tab( 'configure' ); ?>
32
+ <?php include_once $this->get_path( 'connected-accounts' ); ?>
33
+
34
+ <?php foreach ( $this->get_sections( 'configure' ) as $section ) : ?>
35
+
36
+ <?php do_settings_sections( $section['id'] ); // matches the section name ?>
37
+ <?php if ( $section['save_after'] ) : ?>
38
+ <p class="submit"><input class="button-primary" type="submit" name="save" value="<?php esc_attr_e( 'Save Changes' ); ?>" /></p>
39
+ <?php endif; ?>
40
+ <hr>
41
+ <?php endforeach; ?>
42
+ </form>
trunk/inc/admin/templates/connected-accounts.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <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>
37
+ </div>
38
+ </td>
39
+ </tr>
40
+ </tbody>
41
+ </table>
trunk/inc/admin/templates/customize.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ if ( $section['pro'] ) : ?>
7
+ <div class="sbspf_pro_section">
8
+ <p style="padding-bottom: 18px;" class="sbspf_pro_reveal">
9
+ <a href="https://smashballoon.com/youtube-feed/?utm_source=plugin-free&amp;utm_campaign=sby" target="_blank"><?php echo esc_html( $section['pro'] ); ?></a><br>
10
+ <a href="javascript:void(0);" class="button button-secondary sbspf-show-pro"><b>+</b> <?php _e( 'Show Pro Options', $text_domain ); ?></a>
11
+ </p>
12
+ <?php endif;
13
+ do_settings_sections( $section['id'] ); // matches the section name
14
+ if ( $section['pro'] ) {
15
+ echo '</div>';
16
+ }
17
+ if ( $section['save_after'] ) : ?>
18
+ <p class="submit"><input class="button-primary" type="submit" name="save" value="<?php esc_attr_e( 'Save Changes' ); ?>" /></p>
19
+ <?php endif; ?>
20
+ <hr>
21
+ <?php endforeach; ?>
22
+ </form>
trunk/inc/admin/templates/display.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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; ?> channel=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; ?> channel="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
+ <p><span class="sbspf_table_key"></span><?php _e( "Pro version only", $text_domain ); ?></p>
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
+ $pro_only_class = '';
27
+ if ( in_array( $setting['key'], $this->pro_only, true ) ) {
28
+ $pro_only_class = ' class="sbspf_pro_only"';
29
+ }
30
+ ?>
31
+ <tr<?php echo $pro_only_class; ?>>
32
+ <td><?php echo $setting['key']; ?></td>
33
+ <td><?php echo $setting['description']; ?></td>
34
+ <td><code>[<?php echo $slug; ?> <?php echo $setting['key']; ?>="<?php echo str_replace('"', '', $setting['example'] ); ?>"]</code></td>
35
+ </tr>
36
+ <?php endforeach; ?>
37
+
38
+ <?php endforeach; ?>
39
+
40
+ </tbody>
41
+ </table>
42
+ <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>
trunk/inc/admin/templates/main.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 sby_admin" data-sb-plugin="sbspf">
28
+ <?php
29
+ $lite_notice_dismissed = get_transient( 'youtube_feed_dismiss_lite' );
30
+
31
+ if ( ! $lite_notice_dismissed ) :
32
+ ?>
33
+ <div id="sbspf-notice-bar" style="display:none">
34
+ <span class="sbspf-notice-bar-message"><?php _e( 'You\'re using Feeds for YouTube Lite. To unlock more features consider <a href="https://smashballoon.com/youtube-feed/?utm_source=WordPress&utm_campaign=youtubeliteplugin&utm_medium=notice-bar" target="_blank" rel="noopener noreferrer">upgrading to Pro</a>.', $text_domain ); ?></span>
35
+ <button type="button" class="dismiss" title="<?php _e( 'Dismiss this message.', $text_domain ); ?>" data-page="overview">
36
+ </button>
37
+ </div>
38
+ <?php endif; ?>
39
+
40
+ <h1><?php echo esc_html( $plugin_name ); ?></h1>
41
+
42
+ <!-- Display the tabs along with styling for the 'active' tab -->
43
+ <h2 class="nav-tab-wrapper">
44
+ <?php
45
+ $i = 1;
46
+ foreach ( $tabs as $tab ) :
47
+ $title = isset( $tab['numbered_tab'] ) && ! $tab['numbered_tab'] ? __( $tab['title'], 'feeds-for-youtube' ) : $i . '. ' . __( $tab['title'], 'feeds-for-youtube' );
48
+ ?>
49
+ <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>
50
+ <?php
51
+ $i ++;
52
+ endforeach; ?>
53
+ </h2>
54
+ <?php
55
+ settings_errors();
56
+
57
+ include $this->get_path( $active_tab );
58
+
59
+ $next_step = $this->next_step();
60
+ if ( ! empty( $next_step ) ) : ?>
61
+ <p class="sbspf_footer_help">
62
+ <?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'], 'feeds-for-youtube' ) ); ?></a>
63
+ </p>
64
+ <?php endif; ?>
65
+
66
+ <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>
67
+
68
+ <div class="sbspf-quick-start">
69
+ <h3><?php echo sby_admin_icon( 'rocket', 'sbspf_small_svg' ); ?>&nbsp; <?php _e( 'Display your feed', $text_domain); ?></h3>
70
+ <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 ); ?>
71
+ <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>
72
+ <p><?php _e( "Find out how to display <a href='?page=".$slug."&tab=display'>multiple feeds</a>.", $text_domain ); ?></p>
73
+ </div>
74
+
75
+ <a href="https://smashballoon.com/youtube-feed/?utm_source=plugin-free&utm_campaign=sby" target="_blank" class="sbspf-pro-notice"><img src="<?php echo SBY_PLUGIN_URL . 'img/pro.png' ?>" alt="Pro" /></a>
76
+
77
+
78
+ </div>
79
+ <div class="wp-clearfix"></div>
trunk/inc/admin/templates/single-connected-account.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $just_updated = isset( $_GET['sby_access_token'] ) && $account['access_token'] === $_GET['sby_access_token'];
3
+ $just_updated_class = $just_updated ? ' sbspf_just_updated' : '';
4
+ ?>
5
+
6
+ <div class="sbspf_connected_account<?php echo $just_updated_class; ?>" 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'] ); ?>">
7
+
8
+ <div class="sbspf_ca_alert">
9
+ <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>
10
+ </div>
11
+ <?php if ( $just_updated ) : ?>
12
+ <div class="sbspf_ca_alert sbspf_ca_updated">
13
+ <span><?php _e( 'Successfully Connected', $text_domain ) ?></span>
14
+ </div>
15
+ <?php endif; ?>
16
+ <div class="sbspf_ca_info">
17
+
18
+ <div class="sbspf_ca_delete">
19
+ <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>
20
+ </div>
21
+
22
+ <div class="sbspf_ca_username">
23
+ <?php echo $profile_picture; ?>
24
+ <strong><?php echo $username; ?><span><?php _e('Channel ID:', $text_domain ); ?><?php echo ' ' . $account['channel_id']; ?></span></strong>
25
+ </div>
26
+
27
+ <div class="sbspf_ca_actions">
28
+ <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>
29
+ <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>
30
+ </div>
31
+
32
+ <div class="sbspf_ca_shortcode">
33
+
34
+ <p><?php _e('Copy and paste this shortcode into your page or widget area', $text_domain ); ?>:<br>
35
+ <?php if ( !empty( $account['username'] ) ) : ?>
36
+ <code>[<?php echo $slug; ?> channel="<?php echo $account['channel_id']; ?>"]</code>
37
+ <?php else : ?>
38
+ <code>[<?php echo $slug; ?> accesstoken="<?php echo $account['access_token']; ?>"]</code>
39
+ <?php endif; ?>
40
+ </p>
41
+
42
+ <p><?php _e('To add multiple channels in the same feed, simply separate them using commas', $text_domain); ?>:<br>
43
+ <code>[<?php echo $slug; ?> channel="<?php echo $account['channel_id']; ?>, a_second_channel, a_third_channel"]</code>
44
+
45
+ <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>
46
+ </div>
47
+
48
+ <div class="sbspf_ca_accesstoken">
49
+ <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>
50
+ <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>
51
+ </div>
52
+
53
+ </div>
54
+
55
+ </div>
trunk/inc/admin/templates/support.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ( $key !== 'connected_accounts' ) {
41
+ if ( is_array( $val ) ) {
42
+ foreach ( $val as $key2 => $val2 ) {
43
+ if ( is_array( $val2 ) ) {
44
+ foreach ( $val2 as $key3 => $val3 ) {
45
+ $label = $key . ':';
46
+ $value = isset( $val3 ) ? esc_attr( $val3 ) : 'unset';
47
+ echo str_pad( $label, 24 ) . $value ."\n";
48
+ }
49
+ } else {
50
+ $label = $key . ':';
51
+ $value = isset( $val2 ) ? esc_attr( $val2 ) : 'unset';
52
+ echo str_pad( $label, 24 ) . $value ."\n";
53
+ }
54
+ }
55
+ } else {
56
+ $label = $key . ':';
57
+ $value = isset( $val ) ? esc_attr( $val ) : 'unset';
58
+ echo str_pad( $label, 24 ) . $value ."\n";
59
+ }
60
+ }
61
+ }
62
+ ?>
63
+
64
+ ## Connected Accounts: ##
65
+ <?php
66
+ foreach ( $options['connected_accounts'] as $account ) {
67
+ foreach ( $account as $key2 => $val2 ) {
68
+ if ( is_array( $val2 ) ) {
69
+ foreach ( $val2 as $key3 => $val3 ) {
70
+ $label = $key3 . ':';
71
+ $value = isset( $val3 ) ? esc_attr( $val3 ) : 'unset';
72
+ echo str_pad( $label, 24 ) . $value ."\n";
73
+ }
74
+ } else {
75
+ $label = $key2 . ':';
76
+ $value = isset( $val2 ) ? esc_attr( $val2 ) : 'unset';
77
+ echo str_pad( $label, 24 ) . $value ."\n";
78
+ }
79
+ }
80
+ }
81
+ ?>
82
+
83
+ ## Cron Events: ##
84
+ <?php
85
+ $cron = _get_cron_array();
86
+ foreach ( $cron as $key => $data ) {
87
+ $is_target = false;
88
+ foreach ( $data as $key2 => $val ) {
89
+ if ( strpos( $key2, 'sby' ) !== false ) {
90
+ $is_target = true;
91
+ echo $key2;
92
+ echo "\n";
93
+ }
94
+ }
95
+ if ( $is_target) {
96
+ echo date( "Y-m-d H:i:s", $key );
97
+ echo "\n";
98
+ echo 'Next Scheduled: ' . ((int)$key - time())/60 . ' minutes';
99
+ echo "\n\n";
100
+ }
101
+ }
102
+ ?>
103
+ ## Cron Cache Report: ##
104
+ <?php $cron_report = get_option( 'sby_cron_report', array() );
105
+ if ( ! empty( $cron_report ) ) {
106
+ var_export( $cron_report );
107
+ }
108
+ echo "\n";
109
+ ?>
110
+
111
+ ## Error Log: ##
112
+ <?php
113
+ global $sby_posts_manager;
114
+ $errors = $sby_posts_manager->get_errors();
115
+ if ( ! empty( $errors ) ) :
116
+ foreach ( $errors as $type => $error ) :
117
+ echo $type . ': ' . str_replace( array( '<p>', '<b>', '</p>', '</b>' ), ' ', $error[1] ) . "\n";
118
+ endforeach;
119
+ endif;
120
+ ?>
121
+
122
+ </textarea>
trunk/inc/blocks/class-sby-blocks.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Instagram Feed block with live preview.
4
+ *
5
+ * @since 1.7.1
6
+ */
7
+ class SBY_Blocks {
8
+
9
+ /**
10
+ * Indicates if current integration is allowed to load.
11
+ *
12
+ * @since 1.8
13
+ *
14
+ * @return bool
15
+ */
16
+ public function allow_load() {
17
+ return function_exists( 'register_block_type' );
18
+ }
19
+
20
+ /**
21
+ * Loads an integration.
22
+ *
23
+ * @since 1.7.1
24
+ */
25
+ public function load() {
26
+ $this->hooks();
27
+ }
28
+
29
+ /**
30
+ * Integration hooks.
31
+ *
32
+ * @since 1.7.1
33
+ */
34
+ protected function hooks() {
35
+ add_action( 'init', array( $this, 'register_block' ) );
36
+ add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_block_editor_assets' ) );
37
+ }
38
+
39
+ /**
40
+ * Register Instagram Feed Gutenberg block on the backend.
41
+ *
42
+ * @since 1.7.1
43
+ */
44
+ public function register_block() {
45
+
46
+ wp_register_style(
47
+ 'sby-blocks-styles',
48
+ trailingslashit( SBY_PLUGIN_URL ) . 'css/sby-blocks.css',
49
+ array( 'wp-edit-blocks' ),
50
+ SBYVER
51
+ );
52
+
53
+ $attributes = array(
54
+ 'shortcodeSettings' => array(
55
+ 'type' => 'string',
56
+ ),
57
+ 'noNewChanges' => array(
58
+ 'type' => 'boolean',
59
+ ),
60
+ 'executed' => array(
61
+ 'type' => 'boolean',
62
+ )
63
+ );
64
+
65
+ register_block_type(
66
+ 'sby/sby-feed-block',
67
+ array(
68
+ 'attributes' => $attributes,
69
+ 'render_callback' => array( $this, 'get_feed_html' ),
70
+ )
71
+ );
72
+ }
73
+
74
+ /**
75
+ * Load Instagram Feed Gutenberg block scripts.
76
+ *
77
+ * @since 1.7.1
78
+ */
79
+ public function enqueue_block_editor_assets() {
80
+ sby_scripts_enqueue( true );
81
+
82
+ wp_enqueue_style( 'sby-blocks-styles' );
83
+ wp_enqueue_script(
84
+ 'sby-feed-block',
85
+ trailingslashit( SBY_PLUGIN_URL ) . 'js/sby-blocks.js',
86
+ array( 'wp-blocks', 'wp-i18n', 'wp-element' ),
87
+ SBYVER,
88
+ true
89
+ );
90
+
91
+ $shortcodeSettings = '';
92
+
93
+ $i18n = array(
94
+ 'addSettings' => esc_html__( 'Add Settings', SBY_TEXT_DOMAIN ),
95
+ 'shortcodeSettings' => esc_html__( 'Shortcode Settings', SBY_TEXT_DOMAIN ),
96
+ 'example' => esc_html__( 'Example', SBY_TEXT_DOMAIN ),
97
+ 'preview' => esc_html__( 'Apply Changes', SBY_TEXT_DOMAIN ),
98
+
99
+ );
100
+
101
+ wp_localize_script(
102
+ 'sby-feed-block',
103
+ 'sby_block_editor',
104
+ array(
105
+ 'wpnonce' => wp_create_nonce( 'sby-blocks' ),
106
+ 'canShowFeed' => true,
107
+ 'shortcodeSettings' => $shortcodeSettings,
108
+ 'i18n' => $i18n,
109
+ )
110
+ );
111
+ }
112
+
113
+ /**
114
+ * Get form HTML to display in a Instagram Feed Gutenberg block.
115
+ *
116
+ * @param array $attr Attributes passed by Instagram Feed Gutenberg block.
117
+ *
118
+ * @since 1.7.1
119
+ *
120
+ * @return string
121
+ */
122
+ public function get_feed_html( $attr ) {
123
+
124
+ $return = '';
125
+
126
+ $shortcode_settings = isset( $attr['shortcodeSettings'] ) ? $attr['shortcodeSettings'] : '';
127
+
128
+ $shortcode_settings = str_replace(array( '[youtube-feed', ']' ), '', $shortcode_settings );
129
+
130
+ $return .= do_shortcode( '[youtube-feed '.$shortcode_settings.']' );
131
+
132
+ return $return;
133
+
134
+ }
135
+
136
+ /**
137
+ * Checking if is Gutenberg REST API call.
138
+ *
139
+ * @since 1.7.1
140
+ *
141
+ * @return bool True if is Gutenberg REST API call.
142
+ */
143
+ public static function is_gb_editor() {
144
+
145
+ // TODO: Find a better way to check if is GB editor API call.
146
+ return defined( 'REST_REQUEST' ) && REST_REQUEST && ! empty( $_REQUEST['context'] ) && 'edit' === $_REQUEST['context']; // phpcs:ignore
147
+ }
148
+
149
+ }
trunk/inc/class-sby-api-connect.php ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ protected $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 ( is_array( $connected_account_or_url ) ) {
22
+ $this->set_url( $connected_account_or_url, $endpoint, $params );
23
+ } elseif ( strpos( $connected_account_or_url, 'https' ) !== false ) {
24
+ $this->url = $connected_account_or_url;
25
+ } else {
26
+ $this->url = '';
27
+ }
28
+ }
29
+
30
+ public function get_data() {
31
+ if (!is_wp_error($this->response) && !empty($this->response['data'])) {
32
+ return $this->response['data'];
33
+ } else {
34
+ return $this->response;
35
+ }
36
+ }
37
+
38
+ public function get_wp_error() {
39
+ if ( $this->is_wp_error() ) {
40
+ return array( 'response' => $this->response, 'url' => $this->url );
41
+ } else {
42
+ return false;
43
+ }
44
+ }
45
+
46
+ public function get_next_page( $params = false ) {
47
+ if ( ! empty( $this->response['nextPageToken'] ) ) {
48
+ return $this->response['nextPageToken'];
49
+ } else {
50
+ return '';
51
+ }
52
+ }
53
+
54
+ public function set_url_from_args( $url ) {
55
+ $this->url = $url;
56
+ }
57
+
58
+ public function get_url() {
59
+ return $this->url;
60
+ }
61
+
62
+ public function is_wp_error() {
63
+ return is_wp_error( $this->response );
64
+ }
65
+
66
+
67
+ public function is_youtube_error() {
68
+ return (is_wp_error( $this->response ) || isset( $this->response['error'] ));
69
+ }
70
+
71
+ public function connect() {
72
+ $args = array(
73
+ 'timeout' => 60,
74
+ 'sslverify' => false
75
+ );
76
+ $response = wp_remote_get( esc_url_raw( $this->url ), $args );
77
+
78
+ if ( ! is_wp_error( $response ) ) {
79
+ // certain ways of representing the html for double quotes causes errors so replaced here.
80
+ $response = json_decode( str_replace( '%22', '&rdquo;', $response['body'] ), true );
81
+ }
82
+
83
+ $this->response = $response;
84
+ }
85
+
86
+ public static function handle_youtube_error( $response, $error_connected_account, $request_type = '' ) {
87
+ //
88
+ if ( isset( $response['error'] ) ) {
89
+ if ( isset( $response['error']['errors'][0]['reason'] ) && $response['error']['errors'][0]['message'] === 'Invalid Credentials' ) {
90
+ $error_message = '<p><b>' . __( 'Reconnect to YouTube to show this feed.', 'custom-facebook-feed' ) . '</b></p>';
91
+ $error_message .= '<p>' . __( 'To create a new feed, first connect to YouTube using the "Connect to YouTube to Create a Feed" button on the settings page and connect any account.', SBY_TEXT_DOMAIN ) . '</p>';
92
+
93
+ if ( current_user_can( 'manage_youtube_feed_options' ) ) {
94
+ $error_message .= '<a href="' . admin_url( 'admin.php?page=youtube-feed' ) . '" target="blank" rel="noopener nofollow">' . __( 'Reconnect in the YouTube Feed Settings Area' ) . '</a>';
95
+ }
96
+ global $sby_posts_manager;
97
+
98
+ $sby_posts_manager->add_frontend_error( 'accesstoken', $error_message );
99
+ $sby_posts_manager->add_error( 'accesstoken', array( 'Trying to connect a new account', $error_message ) );
100
+
101
+ return false;
102
+ } elseif ( isset( $response['error']['errors'][0]['reason'] ) ) {
103
+ $error = $response['error']['errors'][0]['message'];
104
+
105
+ $error_message = '<p><b>'. sprintf( __( 'Error %s: %s.', 'instagram-feed' ), $response['error']['code'], $error ) .'</b></p>';
106
+ $error_message .= '<p>Domain code: ' . $response['error']['errors'][0]['domain'];
107
+ $error_message .= '<br>Reason code: ' . $response['error']['errors'][0]['reason'];
108
+ if ( current_user_can( 'manage_youtube_feed_options' ) ) {
109
+ if ( isset( $response['error']['errors'][0]['extendedHelp'] ) ) {
110
+ $error_message .= '<br>Extended Help Link: ' . $response['error']['errors'][0]['extendedHelp'];
111
+ }
112
+ $error_message .= '</p>';
113
+
114
+ $error_message .= '<a href="https://smashballoon.com/youtube-feed/docs/errors/" target="blank" rel="noopener nofollow">' . __( 'Directions on how to resolve this issue' ) . '</a>';
115
+ } else {
116
+ $error_message .= '</p>';
117
+ }
118
+
119
+ global $sby_posts_manager;
120
+
121
+ $sby_posts_manager->add_frontend_error( 'api', $error_message );
122
+ $sby_posts_manager->add_error( 'api', array( 'Error connecting', $error_message ) );
123
+
124
+ $sby_posts_manager->add_api_request_delay( 300 );
125
+ }
126
+ }
127
+ }
128
+
129
+ public static function handle_wp_remote_get_error( $response ) {
130
+ $message = sprintf( __( 'Error connecting to %s.', SBY_TEXT_DOMAIN ), $response['url'] ). ' ';
131
+ if ( isset( $response['response'] ) && isset( $response['response']->errors ) ) {
132
+ foreach ( $response['response']->errors as $key => $item ) {
133
+ $message .= ' '.$key . ' - ' . $item[0] . ' |';
134
+ }
135
+ }
136
+
137
+ global $sby_posts_manager;
138
+
139
+ $sby_posts_manager->add_api_request_delay( 300 );
140
+
141
+ $sby_posts_manager->add_error( 'connection', array( 'Error connecting', $message ) );
142
+ }
143
+
144
+ protected function set_url( $connected_account, $endpoint_slug, $params ) {
145
+ $num = ! empty( $params['num'] ) && isset( $connected_account['api_key'] ) ? (int)$params['num'] : 50;
146
+
147
+ if ( $endpoint_slug === 'tokeninfo' ) {
148
+ $url = 'https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=' . $connected_account['access_token'];
149
+ } elseif ( $endpoint_slug === 'channels' ) {
150
+ $channel_param = 'mine=true';
151
+ if ( isset( $params['channel_name'] ) ) {
152
+ $channel_param = 'forUsername=' . $params['channel_name'];
153
+ } elseif ( isset( $params['channel_id'] ) ) {
154
+ $channel_param = 'id=' . $params['channel_id'];
155
+ }
156
+
157
+ $access_credentials = isset( $connected_account['api_key'] ) ? 'key=' . $connected_account['api_key'] : 'access_token=' . $connected_account['access_token'];
158
+
159
+ $url = 'https://www.googleapis.com/youtube/v3/channels?part=id,snippet,contentDetails&'.$channel_param.'&' . $access_credentials;
160
+ } elseif ( $endpoint_slug === 'playlistItems' ) {
161
+ $access_credentials = isset( $connected_account['api_key'] ) ? 'key=' . $connected_account['api_key'] : 'access_token=' . $connected_account['access_token'];
162
+ $next_page = '';
163
+ if ( isset( $params['nextPageToken'] ) ) {
164
+ $next_page = '&pageToken=' . $params['nextPageToken'];
165
+ }
166
+
167
+ $url = 'https://www.googleapis.com/youtube/v3/playlistItems?part=id,snippet&maxResults='.$num.'&playlistId='.$params['playlist_id'].'&' . $access_credentials . $next_page;
168
+ } else {
169
+ $channel_param = 'mine=true';
170
+ if ( isset( $params['username'] ) ) {
171
+ $channel_param = 'forUsername=' . $params['username'];
172
+ } elseif ( isset( $params['channel_id'] ) ) {
173
+ $channel_param = 'id=' . $params['channel_id'];
174
+ }
175
+ $access_credentials = isset( $connected_account['api_key'] ) ? 'key=' . $connected_account['api_key'] : 'access_token=' . $connected_account['access_token'];
176
+
177
+ $url = 'https://www.googleapis.com/youtube/v3/channels?part=id,snippet&'.$channel_param.'&' . $access_credentials;
178
+ }
179
+
180
+ $this->set_url_from_args( $url );
181
+ }
182
+
183
+ public static function refresh_token( $client_id, $refresh_token, $client_secret ) {
184
+ $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' );
185
+
186
+ if ( $response['response']['code'] === 200 ) {
187
+ $return = json_decode( $response['body'], true );
188
+ } else {
189
+ $return = array();
190
+ }
191
+
192
+ return $return;
193
+ }
194
+
195
+ }
trunk/inc/class-sby-cron-update.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 1.0/1.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'] : array();
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( $database_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
+ $post_data = $youtube_feed->get_post_data();
132
+ $post_data = array_slice( $post_data, 0, $settings['num'] );
133
+
134
+ sby_process_post_set_caching( $post_data, $transient_name );
135
+
136
+ }
137
+
138
+ /**
139
+ * Retrieve option name column values for all feed cache transients
140
+ *
141
+ * @return array
142
+ *
143
+ * @since 1.0
144
+ */
145
+ public static function get_feed_cache_option_names() {
146
+ global $wpdb;
147
+ $feed_caches = array();
148
+
149
+ $results = $wpdb->get_results( "
150
+ SELECT option_name
151
+ FROM $wpdb->options
152
+ WHERE `option_name` LIKE ('%\_transient\_sby\_%')
153
+ AND `option_name` NOT LIKE ('%\_transient\_sby\_header%');", ARRAY_A );
154
+
155
+ if ( isset( $results[0] ) ) {
156
+ $feed_caches = $results;
157
+ }
158
+
159
+ return $feed_caches;
160
+ }
161
+
162
+ /**
163
+ * Start cron jobs based on user's settings for cron cache update frequency.
164
+ * This is triggered when settings are saved on the "Configure" tab.
165
+ *
166
+ * @param string $sby_cache_cron_interval arbitrary name from one of the
167
+ * settings on the "Configure" tab
168
+ * @param string $sby_cache_cron_time hour of the day (1 = 1:00)
169
+ * @param string $sby_cache_cron_am_pm am or pm (time of day)
170
+ *
171
+ * @since 1.0
172
+ */
173
+ public static function start_cron_job( $sby_cache_cron_interval, $sby_cache_cron_time, $sby_cache_cron_am_pm ) {
174
+ wp_clear_scheduled_hook( 'sby_feed_update' );
175
+
176
+ if ( $sby_cache_cron_interval === '12hours' || $sby_cache_cron_interval === '24hours' ) {
177
+ $relative_time_now = time() + sby_get_utc_offset();
178
+ $base_day = strtotime( date( 'Y-m-d', $relative_time_now ) );
179
+ $add_time = $sby_cache_cron_am_pm === 'pm' ? (int)$sby_cache_cron_time + 12 : (int)$sby_cache_cron_time;
180
+ $utc_start_time = $base_day + (($add_time * 60 * 60) - sby_get_utc_offset());
181
+
182
+ if ( $utc_start_time < time() ) {
183
+ if ( $sby_cache_cron_interval === '12hours' ) {
184
+ $utc_start_time += 60*60*12;
185
+ } else {
186
+ $utc_start_time += 60*60*24;
187
+ }
188
+ }
189
+
190
+ if ( $sby_cache_cron_interval === '12hours' ) {
191
+ wp_schedule_event( $utc_start_time, 'twicedaily', 'sby_feed_update' );
192
+ } else {
193
+ wp_schedule_event( $utc_start_time, 'daily', 'sby_feed_update' );
194
+ }
195
+
196
+ } else {
197
+ if ( $sby_cache_cron_interval === '30mins' ) {
198
+ wp_schedule_event( time(), 'sby30mins', 'sby_feed_update' );
199
+ } else {
200
+ wp_schedule_event( time(), 'hourly', 'sby_feed_update' );
201
+ }
202
+ }
203
+
204
+ }
205
+ }
trunk/inc/class-sby-display-elements.php ADDED
@@ -0,0 +1,369 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ if ( isset( $settings['descriptiontextsize'] ) && $settings['descriptiontextsize'] !== '13px' ) {
83
+ $style_settings['font-size'] = $settings['descriptiontextsize'];
84
+ }
85
+ } elseif ( $context === 'header' ) {
86
+ if ( $settings['itemspacing'] > 0 ) {
87
+ $style_settings['padding'] = $item_spacing_setting;
88
+ }
89
+ if ( $settings['itemspacing'] < 10 ) {
90
+ $style_settings['margin-bottom'] = '10px';
91
+ }
92
+ $style_settings['padding-bottom'] = '0';
93
+ }
94
+
95
+ if ( $context === 'player_outer_wrap' ) {
96
+ $style_settings['padding-bottom'] = 0;
97
+ }
98
+
99
+ $style_att = '';
100
+ if ( ! empty( $style_settings ) ) {
101
+ $style_att = ' style="';
102
+ foreach ( $style_settings as $prop => $val ) {
103
+ $style_att .= $prop . ': '. $val . ';';
104
+ }
105
+ $style_att .= '"';
106
+ }
107
+
108
+ return $style_att;
109
+ }
110
+
111
+ /**
112
+ * Returns the best media url for an image based on settings.
113
+ * By default a white placeholder image is loaded and replaced
114
+ * with the most optimal image size based on the actual dimensions
115
+ * of the image element in the feed.
116
+ *
117
+ * @param array $post data for an individual post
118
+ * @param array $settings
119
+ * @param array $resized_images (optional) not yet used but
120
+ * can pass in existing resized images to use in the source
121
+ *
122
+ * @return string
123
+ *
124
+ * @since 1.0
125
+ */
126
+ public static function get_optimum_media_url( $post, $settings, $resized_images = array() ) {
127
+ $media_url = '';
128
+ $optimum_res = $settings['imageres'];
129
+ $account_type = isset( $post['images'] ) ? 'personal' : 'business';
130
+
131
+ // only use the placeholder if it will be replaced using JS
132
+ if ( !$settings['disable_js_image_loading'] ) {
133
+ return trailingslashit( SBY_PLUGIN_URL ) . 'img/placeholder.png';
134
+ } else {
135
+ $optimum_res = 'full';
136
+ $settings['imageres'] = 'full';
137
+ }
138
+
139
+ $media_url = SBY_Parse::get_media_url( $post, 'lightbox' );
140
+
141
+ return $media_url;
142
+ }
143
+
144
+ /**
145
+ * Creates a style attribute that contains all of the styles for
146
+ * the main feed div.
147
+ *
148
+ * @param $settings
149
+ *
150
+ * @return string
151
+ */
152
+ public static function get_feed_style( $settings ) {
153
+
154
+ $styles = '';
155
+ $bg_color = str_replace( '#', '', $settings['background'] );
156
+
157
+ if ( ! empty( $settings['imagepadding'] )
158
+ || ! empty( $bg_color )
159
+ || ! empty( $settings['width'] )
160
+ || ! empty( $settings['height'] ) ) {
161
+ $styles = ' style="';
162
+ if ( ! empty( $settings['imagepadding'] ) ) {
163
+ $styles .= 'padding-bottom: ' . ((int)$settings['imagepadding'] * 2) . esc_attr( $settings['imagepaddingunit'] ) . ';';
164
+ }
165
+ if ( ! empty( $bg_color ) ) {
166
+ $styles .= 'background-color: rgb(' . esc_attr( sby_hextorgb( $bg_color ) ). ');';
167
+ }
168
+ if ( ! empty( $settings['width'] ) ) {
169
+ $styles .= 'width: ' . (int)$settings['width'] . esc_attr( $settings['widthunit'] ) . ';';
170
+ }
171
+ if ( ! empty( $settings['height'] ) ) {
172
+ $styles .= 'height: ' . (int)$settings['height'] . esc_attr( $settings['heightunit'] ) . ';';
173
+ }
174
+ $styles .= '"';
175
+ }
176
+ return $styles;
177
+ }
178
+
179
+ /**
180
+ * Creates a style attribute for the sby_images div
181
+ *
182
+ * @param $settings
183
+ *
184
+ * @return string
185
+ *
186
+ * @since 1.0
187
+ */
188
+ public static function get_items_wrap_style( $settings ) {
189
+ if ( ! empty ( $settings['imagepadding'] ) ) {
190
+ return 'style="padding: '.(int)$settings['imagepadding'] . esc_attr( $settings['imagepaddingunit'] ) . ';"';
191
+ }
192
+ return '';
193
+ }
194
+
195
+ /**
196
+ * Creates a style attribute for the header. Can be used in
197
+ * several places based on the header style
198
+ *
199
+ * @param $settings
200
+ *
201
+ * @return string
202
+ *
203
+ * @since 1.0
204
+ */
205
+ public static function get_header_text_color_styles( $settings ) {
206
+ $header_color = str_replace( '#', '', $settings['headercolor'] );
207
+
208
+ if ( ! empty( $header_color ) ) {
209
+ return 'style="color: rgb(' . esc_attr( sby_hextorgb( $header_color ) ). ');"';
210
+ }
211
+ return '';
212
+ }
213
+
214
+ /**
215
+ * Header icon and text size is styled using the class added here.
216
+ *
217
+ * @param $settings
218
+ *
219
+ * @return string
220
+ *
221
+ * @since 1.0
222
+ */
223
+ public static function get_header_size_class( $settings ) {
224
+ $header_size_class = in_array( strtolower( $settings['headersize'] ), array( 'medium', 'large' ) ) ? ' sby_'.strtolower( $settings['headersize'] ) : '';
225
+ return $header_size_class;
226
+ }
227
+
228
+ /**
229
+ * Creates a style attribute for the subscribe button. Can be in
230
+ * the feed footer or in a boxed header.
231
+ *
232
+ * @param $settings
233
+ *
234
+ * @return string
235
+ *
236
+ * @since 1.0
237
+ */
238
+ public static function get_subscribe_styles( $settings ) {
239
+ $styles = '';
240
+ $subscribe_color = str_replace( '#', '', $settings['subscribecolor'] );
241
+ $subscribe_text_color = str_replace( '#', '', $settings['subscribetextcolor'] );
242
+
243
+ if ( ! empty( $subscribe_color ) || ! empty( $subscribe_text_color ) ) {
244
+ $styles = 'style="';
245
+ if ( ! empty( $subscribe_color ) ) {
246
+ $styles .= 'background: rgb(' . esc_attr( sby_hextorgb( $subscribe_color ) ) . ');';
247
+ }
248
+ if ( ! empty( $subscribe_text_color ) ) {
249
+ $styles .= 'color: rgb(' . esc_attr( sby_hextorgb( $subscribe_text_color ) ). ');';
250
+ }
251
+ $styles .= '"';
252
+ }
253
+ return $styles;
254
+ }
255
+
256
+ /**
257
+ * Creates a style attribute for styling the load more button.
258
+ *
259
+ * @param $settings
260
+ *
261
+ * @return string
262
+ *
263
+ * @since 1.0
264
+ */
265
+ public static function get_load_button_styles( $settings ) {
266
+ $styles = '';
267
+ $button_color = str_replace( '#', '', $settings['buttoncolor'] );
268
+ $button_text_color = str_replace( '#', '', $settings['buttontextcolor'] );
269
+
270
+ if ( ! empty( $button_color ) || ! empty( $button_text_color ) ) {
271
+ $styles = 'style="';
272
+ if ( ! empty( $button_color ) ) {
273
+ $styles .= 'background: rgb(' . esc_attr( sby_hextorgb( $button_color ) ) . ');';
274
+ }
275
+ if ( ! empty( $button_text_color ) ) {
276
+ $styles .= 'color: rgb(' . esc_attr( sby_hextorgb( $button_text_color ) ). ');';
277
+ }
278
+ $styles .= '"';
279
+ }
280
+ return $styles;
281
+ }
282
+
283
+ /**
284
+ * A not very elegant but useful method to abstract out how the settings
285
+ * work for displaying certain elements in the feed.
286
+ *
287
+ * @param string $element specific key, view below for supported ones
288
+ * @param $settings
289
+ *
290
+ * @return bool
291
+ *
292
+ * @since 5.0
293
+ */
294
+ public static function should_show_element( $element, $context, $settings ) {
295
+ //user, views, date
296
+ if ( $context === 'item-hover' ) {
297
+ $include_array = is_array( $settings['hoverinclude'] ) ? $settings['hoverinclude'] : explode( ',', str_replace( ' ', '', $settings['hoverinclude'] ) );
298
+ } else {
299
+ $include_array = is_array( $settings['include'] ) ? $settings['include'] : explode( ',', str_replace( ' ', '', $settings['include'] ) );
300
+ }
301
+
302
+ if ( in_array( $element, $include_array, true ) ) {
303
+ return true;
304
+ }
305
+
306
+ return false;
307
+ }
308
+
309
+ /**
310
+ * Returns the html for an icon based on the kind requested
311
+ *
312
+ * @param string $type kind of icon needed (ex "video" is a play button)
313
+ * @param string $icon_type svg or font
314
+ *
315
+ * @return string
316
+ *
317
+ * @since 1.0
318
+ */
319
+ protected static function get_basic_icons( $type, $icon_type ) {
320
+ if ( $type === 'carousel' ) {
321
+ if ( $icon_type === 'svg' ) {
322
+ 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">
323
+ <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>
324
+ </svg>';
325
+ } else {
326
+ return '<i class="fa fa-clone sby_carousel_icon" aria-hidden="true"></i>';
327
+ }
328
+
329
+ } elseif ( $type === 'video' ) {
330
+ if ( $icon_type === 'svg' ) {
331
+ 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>';
332
+ } else {
333
+ return '<i class="fa fa-play sby_playbtn" aria-hidden="true"></i>';
334
+ }
335
+ } elseif ( $type === 'youtube' ) {
336
+ if ( $icon_type === 'svg' ) {
337
+ 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>';
338
+ } else {
339
+ return '<i aria-hidden="true" role="img" class="sby_new_logo fab fa-youtube"></i>';
340
+ }
341
+ } elseif ( $type === 'newlogo' ) {
342
+ if ( $icon_type === 'svg' ) {
343
+ 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>';
344
+ } else {
345
+ return '<i aria-hidden="true" role="img" class="sby_new_logo fab fa-youtube"></i>';
346
+ }
347
+ } elseif ( $type === 'play') {
348
+ if ( $icon_type === 'svg' ) {
349
+ 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>';
350
+ } else {
351
+ return '<i aria-hidden="true" role="img" class="fa fas fa-play"></i>';
352
+ }
353
+ } else {
354
+ return '';
355
+ }
356
+ }
357
+
358
+ public static function escaped_data_att_string( $atts ) {
359
+ if ( empty( $atts ) ) {
360
+ return '';
361
+ }
362
+ $string = '';
363
+ foreach ( $atts as $key => $value ) {
364
+ $string .= ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
365
+ }
366
+
367
+ return $string;
368
+ }
369
+ }
trunk/inc/class-sby-feed.php ADDED
@@ -0,0 +1,1634 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ die( '-1' );
5
+ }
6
+
7
+ class SBY_Feed
8
+ {
9
+ /**
10
+ * @var string
11
+ */
12
+ protected $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
+ protected $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
+ protected $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
+ protected $image_ids_post_set;
75
+
76
+ /**
77
+ * @var array
78
+ */
79
+ public $post_ids_with_no_details;
80
+
81
+ /**
82
+ * @var bool
83
+ */
84
+ private $should_use_backup;
85
+
86
+ /**
87
+ * @var array
88
+ */
89
+ private $report;
90
+
91
+ private $successful_video_api_request_made;
92
+
93
+ private $do_page_cache_all;
94
+
95
+ /**
96
+ * SBY_Feed constructor.
97
+ *
98
+ * @param string $transient_name ID of this feed
99
+ * generated in the SBY_Settings class
100
+ */
101
+ public function __construct( $transient_name ) {
102
+ $this->regular_feed_transient_name = $transient_name;
103
+ $this->backup_feed_transient_name = SBY_BACKUP_PREFIX . $transient_name;
104
+
105
+ $sby_header_transient_name = str_replace( 'sby_', 'sby_header_', $transient_name );
106
+ $sby_header_transient_name = substr($sby_header_transient_name, 0, 44);
107
+ $this->header_transient_name = $sby_header_transient_name;
108
+ $this->backup_header_transient_name = SBY_BACKUP_PREFIX . $sby_header_transient_name;
109
+
110
+ $this->channels_data = array();
111
+
112
+ $this->post_data = array();
113
+ $this->next_pages = array();
114
+ $this->should_paginate = true;
115
+
116
+ // this is a count of how many api calls have been made for each feed
117
+ // type and term.
118
+ // By default the limit is 10
119
+ $this->num_api_calls = 0;
120
+ $this->max_api_calls = apply_filters( 'sby_max_concurrent_api_calls', 10 );
121
+ $this->should_use_backup = false;
122
+
123
+ // used for errors and the sby_debug report
124
+ $this->report = array();
125
+ $this->successful_video_api_request_made = false;
126
+ $this->post_ids_with_no_details = array();
127
+ $this->do_page_cache_all = false;
128
+ }
129
+
130
+ /**
131
+ * @return array
132
+ *
133
+ * @since 1.0
134
+ */
135
+ public function get_post_data() {
136
+ return $this->post_data;
137
+ }
138
+
139
+ /**
140
+ * @return array
141
+ *
142
+ * @since 1.0
143
+ */
144
+ public function set_post_data( $post_data ) {
145
+ $this->post_data = $post_data;
146
+ }
147
+
148
+ public function get_misc_data( $feed_id, $posts ) {
149
+ return array();
150
+ }
151
+
152
+ /**
153
+ * @return array
154
+ *
155
+ * @since 1.0
156
+ */
157
+ public function get_next_pages() {
158
+ return $this->next_pages;
159
+ }
160
+
161
+ /**
162
+ * Checks the database option related the transient expiration
163
+ * to ensure it will be available when the page loads
164
+ *
165
+ * @return bool
166
+ *
167
+ * @since 2.0/4.0
168
+ */
169
+ public function regular_cache_exists() {
170
+ //Check whether the cache transient exists in the database and is available for more than one more minute
171
+ $transient_exists = get_transient( $this->regular_feed_transient_name );
172
+
173
+ return $transient_exists;
174
+ }
175
+
176
+ /**
177
+ * Checks the database option related the header transient
178
+ * expiration to ensure it will be available when the page loads
179
+ *
180
+ * @return bool
181
+ *
182
+ * @since 1.0
183
+ */
184
+ public function regular_header_cache_exists() {
185
+ $header_transient = get_transient( $this->header_transient_name );
186
+
187
+ return $header_transient;
188
+ }
189
+
190
+ public function get_channel_cache( $channel, $force_get_cache = false ) {
191
+ if ( $this->is_pageable() && ! $force_get_cache ) {
192
+ return false;
193
+ }
194
+
195
+ $maybe_cache = get_option( SBY_CHANNEL_CACHE_PREFIX . $channel );
196
+ if ( $maybe_cache !== false ) {
197
+ $maybe_cache = json_decode( $maybe_cache, true );
198
+ }
199
+
200
+ return $maybe_cache;
201
+ }
202
+
203
+ public function set_channel_cache( $channel, $cache ) {
204
+ if ( is_array( $cache ) ) {
205
+ $cache = wp_json_encode( $cache );
206
+ }
207
+
208
+ update_option( SBY_CHANNEL_CACHE_PREFIX . $channel, $cache, false );
209
+ }
210
+
211
+ /**
212
+ * @return bool
213
+ *
214
+ * @since 1.0
215
+ */
216
+ public function should_use_backup() {
217
+ return $this->should_use_backup || empty( $this->post_data );
218
+ }
219
+
220
+ /**
221
+ * The header is only displayed when the setting is enabled and
222
+ * an account has been connected
223
+ *
224
+ * Overwritten in the Pro version
225
+ *
226
+ * @param array $settings settings specific to this feed
227
+ * @param array $feed_types_and_terms organized settings related to feed data
228
+ * (ex. 'user' => array( 'smashballoon', 'customyoutubefeed' )
229
+ *
230
+ * @return bool
231
+ *
232
+ * @since 1.0
233
+ */
234
+ public function need_header( $settings, $feed_types_and_terms ) {
235
+ $showheader = ($settings['showheader'] === 'on' || $settings['showheader'] === 'true' || $settings['showheader'] === true);
236
+ return ($showheader && isset( $feed_types_and_terms['channels'] ));
237
+ }
238
+
239
+ /**
240
+ * Use the transient name to retrieve cached data for header
241
+ *
242
+ * @since 1.0
243
+ */
244
+ public function set_header_data_from_cache() {
245
+ $header_cache = get_transient( $this->header_transient_name );
246
+
247
+ $header_cache = json_decode( $header_cache, true );
248
+
249
+ if ( ! empty( $header_cache ) ) {
250
+ $this->header_data = $header_cache;
251
+ }
252
+ }
253
+
254
+ public function set_header_data( $header_data ) {
255
+ $this->header_data = $header_data;
256
+ }
257
+
258
+ /**
259
+ * @since 1.0
260
+ */
261
+ public function get_header_data() {
262
+ return $this->header_data;
263
+ }
264
+
265
+ /**
266
+ * Sets the post data, pagination data, shortcode atts used (cron cache),
267
+ * and timestamp of last retrieval from transient (cron cache)
268
+ *
269
+ * @param array $atts available for cron caching
270
+ *
271
+ * @since 1.0
272
+ */
273
+ public function set_post_data_from_cache( $atts = array() ) {
274
+ $transient_data = get_transient( $this->regular_feed_transient_name );
275
+
276
+ $transient_data = json_decode( $transient_data, true );
277
+
278
+ if ( $transient_data ) {
279
+ $post_data = isset( $transient_data['data'] ) ? $transient_data['data'] : array();
280
+ $this->post_data = $post_data;
281
+ $this->next_pages = isset( $transient_data['pagination'] ) ? $transient_data['pagination'] : array();
282
+
283
+ if ( isset( $transient_data['atts'] ) ) {
284
+ $this->transient_atts = $transient_data['atts'];
285
+ $this->last_retrieve = $transient_data['last_retrieve'];
286
+ }
287
+ }
288
+ }
289
+
290
+ /**
291
+ * Sets post data from a permanent database backup of feed
292
+ * if it was created
293
+ *
294
+ * @since 1.0
295
+ */
296
+ public function maybe_set_post_data_from_backup() {
297
+ $args = array(
298
+ 'post_type' => SBY_CPT,
299
+ 'post_status' => array( 'publish', 'pending', 'draft' ),
300
+ 'orderby' => 'date',
301
+ 'order' => 'DESC',
302
+ 'posts_per_page' => 50,
303
+ 'meta_query' => array(
304
+ array(
305
+ 'value' => sby_strip_after_hash( $this->regular_feed_transient_name ),
306
+ 'key' => 'sby_feed_id'
307
+ )
308
+ )
309
+ );
310
+ $feed_videos = new WP_Query( $args );
311
+
312
+ if ( $feed_videos->have_posts() ) {
313
+ $posts = array();
314
+ while ( $feed_videos->have_posts() ) {
315
+ $feed_videos->the_post();
316
+ $json = get_post_meta( get_the_ID(), 'sby_json', true );
317
+
318
+ if ( $json ) {
319
+ $posts[] = json_decode( $json, true );
320
+ }
321
+ }
322
+
323
+ wp_reset_postdata();
324
+
325
+ $this->post_data = $posts;
326
+ return true;
327
+ } else {
328
+ $this->add_report( 'no backup post data found' );
329
+ wp_reset_postdata();
330
+
331
+ return false;
332
+ }
333
+ }
334
+
335
+ /**
336
+ * Sets header data from a permanent database backup of feed
337
+ * if it was created
338
+ *
339
+ * @since 1.0
340
+ */
341
+ public function maybe_set_header_data_from_backup() {
342
+ $backup_header_data = get_option( $this->backup_header_transient_name, false );
343
+
344
+ if ( ! empty( $backup_header_data ) ) {
345
+ $backup_header_data = json_decode( $backup_header_data, true );
346
+ $this->header_data = $backup_header_data;
347
+
348
+ return true;
349
+ } else {
350
+ $this->add_report( 'no backup header data found' );
351
+
352
+ return false;
353
+ }
354
+ }
355
+
356
+ /**
357
+ * Returns recorded image IDs for this post set
358
+ * for use with image resizing
359
+ *
360
+ * @return array
361
+ *
362
+ * @since 1.0
363
+ */
364
+ public function get_image_ids_post_set() {
365
+ return $this->image_ids_post_set;
366
+ }
367
+
368
+ /**
369
+ * Cron caching needs additional data saved in the transient
370
+ * to work properly. This function checks to make sure it's present
371
+ *
372
+ * @return bool
373
+ *
374
+ * @since 1.0
375
+ */
376
+ public function need_to_start_cron_job() {
377
+ return (( ! empty( $this->post_data ) && ! isset( $this->transient_atts )) || empty( $this->post_data ));
378
+ }
379
+
380
+ /**
381
+ * Checks to see if there are enough posts available to create
382
+ * the current page of the feed
383
+ *
384
+ * @param int $num
385
+ * @param int $offset
386
+ *
387
+ * @return bool
388
+ *
389
+ * @since 1.0
390
+ */
391
+ public function need_posts( $num, $offset = 0 ) {
392
+ $num_existing_posts = is_array( $this->post_data ) ? count( $this->post_data ) : 0;
393
+ $num_needed_for_page = (int)$num + (int)$offset;
394
+
395
+ ($num_existing_posts < $num_needed_for_page) ? $this->add_report( 'need more posts' ) : $this->add_report( 'have enough posts' );
396
+
397
+ return ($num_existing_posts < $num_needed_for_page);
398
+ }
399
+
400
+ /**
401
+ * Checks to see if there are additional pages available for any of the
402
+ * accounts in the feed and that the max conccurrent api request limit
403
+ * has not been reached
404
+ *
405
+ * @return bool
406
+ *
407
+ * @since 1.0
408
+ */
409
+ public function can_get_more_posts() {
410
+ $one_type_and_term_has_more_ages = $this->next_pages !== false;
411
+ $max_concurrent_api_calls_not_met = $this->num_api_calls < $this->max_api_calls;
412
+ $max_concurrent_api_calls_not_met ? $this->add_report( 'max conccurrent requests not met' ) : $this->add_report( 'max concurrent met' );
413
+ $one_type_and_term_has_more_ages ? $this->add_report( 'more pages available' ) : $this->add_report( 'no next page' );
414
+
415
+ return ($one_type_and_term_has_more_ages && $max_concurrent_api_calls_not_met);
416
+ }
417
+
418
+ public function get_play_list_for_term( $type, $term, $connected_account_for_term, $params ) {
419
+
420
+ if ( $type === 'search' || $type === 'live' ) {
421
+ return false;
422
+ }
423
+ $existing_channel_cache = $this->get_channel_cache( $term );
424
+
425
+ if ( $existing_channel_cache ) {
426
+ $this->channels_data[ $term ] = $existing_channel_cache;
427
+ }
428
+
429
+ if ( empty( $this->channels_data[ $term ] ) ) {
430
+ if ( $connected_account_for_term['expires'] < time() + 5 ) {
431
+ $error_message = '<p><b>' . __( 'Reconnect to YouTube to show this feed.', 'custom-facebook-feed' ) . '</b></p>';
432
+ $error_message .= '<p>' . __( 'To create a new feed, first connect to YouTube using the "Connect to YouTube to Create a Feed" button on the settings page and connect any account.', SBY_TEXT_DOMAIN ) . '</p>';
433
+
434
+ if ( current_user_can( 'manage_youtube_feed_options' ) ) {
435
+ $error_message .= '<a href="' . admin_url( 'admin.php?page=youtube-feed' ) . '" target="blank" rel="noopener nofollow">' . __( 'Reconnect in the YouTube Feed Settings Area' ) . '</a>';
436
+ }
437
+ global $sby_posts_manager;
438
+
439
+ $sby_posts_manager->add_frontend_error( 'accesstoken', $error_message );
440
+ $sby_posts_manager->add_error( 'accesstoken', array( 'Trying to connect a new account', $error_message ) );
441
+
442
+ return false;
443
+ }
444
+ $channel_data = array();
445
+ $api_connect_channels = $this->make_api_connection( $connected_account_for_term, 'channels', $params );
446
+
447
+ $this->add_report( 'channel api call made for ' . $term . ' - ' . $type );
448
+
449
+ $api_connect_channels->connect();
450
+ if ( ! $api_connect_channels->is_wp_error() && ! $api_connect_channels->is_youtube_error() ) {
451
+ $channel_data = $api_connect_channels->get_data();
452
+ $channel_id = SBY_Parse::get_channel_id( $channel_data );
453
+ $this->set_channel_cache( $channel_id, $channel_data );
454
+
455
+ if ( isset( $params['channel_name'] ) ) {
456
+ sby_set_channel_id_from_channel_name( $params['channel_name'], $channel_id );
457
+ $this->set_channel_cache( $params['channel_name'], $channel_data );
458
+ }
459
+
460
+ $params = array( 'channel_id' => $channel_id );
461
+ $this->channels_data[ $channel_id ] = $channel_data;
462
+ $this->channels_data[ $term ] = $channel_data;
463
+ } else {
464
+ if ( ! $api_connect_channels->is_wp_error() ) {
465
+ $return = SBY_API_Connect::handle_youtube_error( $api_connect_channels->get_data(), $connected_account_for_term );
466
+ if ( $return && isset( $return['access_token'] ) ) {
467
+ $connected_account_for_term['access_token'] = $return['access_token'];
468
+ $connected_accounts_for_feed[ $term ]['access_token'] = $return['access_token'];
469
+ $connected_account_for_term['expires'] = $return['expires_in'] + time();
470
+ $connected_accounts_for_feed[ $term ]['expires'] = $return['expires_in'] + time();
471
+
472
+ sby_update_or_connect_account( $connected_account_for_term );
473
+ $this->add_report( 'refreshing access token for ' . $connected_account_for_term['channel_id'] );
474
+
475
+ $sby_api_connect_channel = $this->make_api_connection( $connected_account_for_term, 'channels', $params );
476
+ $sby_api_connect_channel->connect();
477
+ if ( ! $sby_api_connect_channel->is_youtube_error() ) {
478
+ $channel_data = $sby_api_connect_channel->get_data();
479
+ $channel_id = SBY_Parse::get_channel_id( $channel_data );
480
+ $this->set_channel_cache( $channel_id, $channel_data );
481
+
482
+ if ( isset( $params['channel_name'] ) ) {
483
+ sby_set_channel_id_from_channel_name( $params['channel_name'], $channel_id );
484
+ $this->set_channel_cache( $params['channel_name'], $channel_data );
485
+ }
486
+
487
+ $this->channels_data[ $channel_id ] = $channel_data;
488
+ $this->channels_data[ $term ] = $channel_data;
489
+
490
+ }
491
+ } else {
492
+ $this->add_report( 'error connecting to channel' );
493
+ }
494
+ } else {
495
+ $api_connect_channels->handle_wp_remote_get_error( $api_connect_channels->get_data() );
496
+ }
497
+ }
498
+ }
499
+
500
+ $playlist = isset( $this->channels_data[ $term ]['items'][0]['contentDetails']['relatedPlaylists']['uploads'] ) ? $this->channels_data[ $term ]['items'][0]['contentDetails']['relatedPlaylists']['uploads'] : false;
501
+
502
+ return $playlist;
503
+ }
504
+
505
+ public function maybe_refresh_token( $term, $connected_account_for_term ) {
506
+ return $connected_account_for_term;
507
+ }
508
+
509
+ public function is_efficient_type( $type ) {
510
+ return true;
511
+ }
512
+
513
+ public function requires_workaround_connection( $type ) {
514
+ return false;
515
+ }
516
+
517
+ public function make_workaround_connection( $connected_account_for_term, $type, $params ) {
518
+ return $this->make_api_connection( $connected_account_for_term, $type, $params );
519
+ }
520
+
521
+
522
+ /**
523
+ * Appends one filtered API request worth of posts for each feed term
524
+ *
525
+ * @param $settings
526
+ * @param array $feed_types_and_terms organized settings related to feed data
527
+ * (ex. 'user' => array( 'smashballoon', 'customyoutubefeed' )
528
+ * @param array $connected_accounts_for_feed connected account data for the
529
+ * feed types and terms
530
+ *
531
+ * @since 1.0
532
+ */
533
+
534
+ public function add_remote_posts( $settings, $feed_types_and_terms, $connected_accounts_for_feed ) {
535
+ $new_post_sets = array();
536
+ $next_pages = $this->next_pages;
537
+ global $sby_posts_manager;
538
+ $api_requests_delayed = $sby_posts_manager->are_current_api_request_delays();
539
+
540
+ /**
541
+ * Number of posts to retrieve in each API call
542
+ *
543
+ * @param int Minimum number of posts needed in each API request
544
+ * @param array $settings Settings for this feed
545
+ *
546
+ * @since 1.0
547
+ */
548
+ $num = apply_filters( 'sby_num_in_request', (int)$settings['minnum'], $settings );
549
+
550
+ $params = array(
551
+ 'num' => $num
552
+ );
553
+
554
+ $one_successful_connection = false;
555
+ $next_page_found = false;
556
+ $one_api_request_delayed = false;
557
+
558
+
559
+
560
+ foreach ( $feed_types_and_terms as $type => $terms ) {
561
+ if ( is_array( $terms ) && count( $terms ) > 5 ) {
562
+ shuffle( $terms );
563
+ }
564
+ foreach ( $terms as $term_and_params ) {
565
+
566
+ $term = $term_and_params['term'];
567
+ $params = array_merge( $params, $term_and_params['params'] );
568
+
569
+ $connected_accounts_for_feed[ $term ] = $this->maybe_refresh_token( $term, $connected_accounts_for_feed[ $term ] );
570
+ $connected_account_for_term = $connected_accounts_for_feed[ $term ];
571
+
572
+ $play_list = $this->get_play_list_for_term( $type, $term, $connected_account_for_term, $params );
573
+
574
+ if ( ! empty( $next_pages[ $term . '_' . $type ] ) ) {
575
+ $params['nextPageToken'] = $next_pages[ $term . '_' . $type ];
576
+ }
577
+
578
+ if ( $this->is_pageable() ) {
579
+ $this->add_remote_pageable_posts( $settings, $feed_types_and_terms, $connected_accounts_for_feed );
580
+ } else {
581
+ $this->add_remote_non_pageable( $settings, $feed_types_and_terms, $connected_accounts_for_feed );
582
+ }
583
+
584
+ if ( ! $this->is_efficient_type( $type ) && $this->is_pageable() ) {
585
+
586
+ if ( $this->requires_workaround_connection( $type ) ) {
587
+ $api_connect_playlist_items = $this->make_workaround_connection( $connected_account_for_term, $type, $params );
588
+ $this->add_report( 'Workaround API call made for ' . $term );
589
+
590
+ } else {
591
+ if ( $play_list ) {
592
+ $params['playlist_id'] = $play_list;
593
+ $api_connect_playlist_items = $this->make_api_connection( $connected_account_for_term, 'playlistItems', $params );
594
+ } else {
595
+ $api_connect_playlist_items = $this->make_api_connection( $connected_account_for_term, $type, $params );
596
+ }
597
+
598
+ $api_connect_playlist_items->connect();
599
+ $this->add_report( 'API call made for ' . $term );
600
+ }
601
+
602
+
603
+ if ( ! $api_connect_playlist_items->is_wp_error() && ! $api_connect_playlist_items->is_youtube_error() ) {
604
+ $one_successful_connection = true;
605
+ $data = $api_connect_playlist_items->get_data();
606
+
607
+ if ( isset( $data['items'][0] ) ) {
608
+ $post_set = $this->filter_posts( $data['items'], $settings );
609
+
610
+ $this->successful_video_api_request_made = true;
611
+
612
+ $new_post_sets[] = $post_set;
613
+ }
614
+
615
+ $next_page = $api_connect_playlist_items->get_next_page( $params );
616
+ $report = is_array( $next_page ) ? implode( ',', $next_page ) : $next_page;
617
+ $this->add_report( 'Next Page ' . $report );
618
+
619
+
620
+ if ( ! empty( $next_page ) ) {
621
+ $next_pages[ $term . '_' . $type ] = $next_page;
622
+ $next_page_found = true;
623
+ } else {
624
+ $next_pages[ $term . '_' . $type ] = false;
625
+ }
626
+ }
627
+
628
+
629
+ $this->num_api_calls++;
630
+
631
+ } else {
632
+
633
+ if ( ! $this->is_pageable() && (int)self::get_channel_status( $term ) !== 1 ) {
634
+ self::update_channel_status( $term, 1 );
635
+ $this->do_page_cache_all = true;
636
+ $play_list = $this->get_play_list_for_term( $type, $term, $connected_account_for_term, $params );
637
+
638
+ $channel_id = isset( $this->channels_data[ $term ] ) ? SBY_Parse::get_channel_id( $this->channels_data[ $term ] ) : '';
639
+ $params['channel_id'] = $channel_id;
640
+ $params['num'] = 50;
641
+
642
+ if ( $play_list ) {
643
+
644
+ $params['playlist_id'] = $play_list;
645
+ if ( ! empty( $next_pages[ $term . '_' . $type ] ) && $next_pages[ $term . '_' . $type ] !== 'rss' ) {
646
+ $params['nextPageToken'] = $next_pages[ $term . '_' . $type ];
647
+ }
648
+
649
+ self::update_channel_status( $term, 1 );
650
+ $this->do_page_cache_all = true;
651
+ $this->add_report( 'using API request to get first 50 videos' );
652
+
653
+ $api_connect_playlist_items = $this->make_api_connection( $connected_account_for_term, 'playlistItems', $params );
654
+
655
+ $api_connect_playlist_items->connect();
656
+
657
+ if ( ! $api_connect_playlist_items->is_wp_error() && ! $api_connect_playlist_items->is_youtube_error() ) {
658
+ $one_successful_connection = true;
659
+ $data = $api_connect_playlist_items->get_data();
660
+
661
+ if ( isset( $data['items'][0] ) ) {
662
+ $post_set = $this->filter_posts( $data['items'], $settings );
663
+
664
+ $this->successful_video_api_request_made = true;
665
+
666
+ $new_post_sets[] = $post_set;
667
+ }
668
+
669
+ $next_pages[ $term . '_' . $type ] = false;
670
+ }
671
+ } else {
672
+ $this->add_report( 'no first playlist' );
673
+ }
674
+
675
+ } elseif ( ! $this->is_pageable()
676
+ && isset( $params['channel_id'] )
677
+ && (! isset( $next_pages[ $term . '_' . $type ] ) || $next_pages[ $term . '_' . $type ] !== 'rss') ) {
678
+
679
+ $rss_connect_playlist_items = new SBY_RSS_Connect( 'playlistItems', $params );
680
+ $this->add_report( 'RSS call made for ' . $term );
681
+
682
+ $rss_connect_playlist_items->connect();
683
+
684
+ $one_successful_connection = true;
685
+
686
+ $data = $rss_connect_playlist_items->get_data();
687
+
688
+ if ( isset( $data[0] ) ) {
689
+ $data = array(
690
+ 'items' => $data
691
+ );
692
+ $post_set = $this->filter_posts( $data['items'], $settings );
693
+
694
+ $this->successful_video_api_request_made = true;
695
+
696
+ if ( count( $post_set ) > 14 ) {
697
+ if ( (int)self::get_channel_status( $term ) !== 1 ) {
698
+ $next_pages[ $term . '_' . $type ] = 'rss';
699
+ $next_page_found = true;
700
+ } else {
701
+ $this->add_report( 'RSS update only for ' . $term );
702
+ $post_set = $this->merge_cached_posts( $post_set, $term );
703
+ $next_pages[ $term . '_' . $type ] = false;
704
+ }
705
+ } else {
706
+ $next_pages[ $term . '_' . $type ] = false;
707
+ }
708
+
709
+ $new_post_sets[] = $post_set;
710
+
711
+ }
712
+ } elseif ( isset( $connected_account_for_term['rss_only'] ) ) {
713
+ $rss_connect_playlist_items = new SBY_RSS_Connect( 'playlistItems', $params );
714
+ $this->add_report( 'RSS Only call made for ' . $term );
715
+
716
+ $rss_connect_playlist_items->connect();
717
+
718
+ $one_successful_connection = true;
719
+
720
+ $data = $rss_connect_playlist_items->get_data();
721
+ $next_pages[ $term . '_' . $type ] = false;
722
+
723
+ if ( isset( $data[0] ) ) {
724
+ $data = array(
725
+ 'items' => $data
726
+ );
727
+ $post_set = $this->filter_posts( $data['items'], $settings );
728
+
729
+ $this->successful_video_api_request_made = true;
730
+ $new_post_sets[] = $post_set;
731
+ }
732
+ } else {
733
+
734
+ if ( ! $api_requests_delayed
735
+ && (! isset( $next_pages[ $term . '_' . $type ] ) || $next_pages[ $term . '_' . $type ] !== false) ) {
736
+
737
+ $play_list = $this->get_play_list_for_term( $type, $term, $connected_account_for_term, $params );
738
+
739
+ $channel_id = isset( $this->channels_data[ $term ] ) ? SBY_Parse::get_channel_id( $this->channels_data[ $term ] ) : '';
740
+ $params['channel_id'] = $channel_id;
741
+
742
+ if ( $play_list ) {
743
+
744
+ $params['playlist_id'] = $play_list;
745
+ if ( ! empty( $next_pages[ $term . '_' . $type ] ) && $next_pages[ $term . '_' . $type ] !== 'rss' ) {
746
+ $params['nextPageToken'] = $next_pages[ $term . '_' . $type ];
747
+ }
748
+
749
+ if ( isset( $next_pages[ $term . '_' . $type ] ) && $next_pages[ $term . '_' . $type ] === 'rss' ) {
750
+ self::update_channel_status( $term, 1 );
751
+ $this->do_page_cache_all = true;
752
+ $this->add_report( 'using API request to get first 50 videos' );
753
+ } else {
754
+ $this->add_report( 'using API request to get more videos' );
755
+ }
756
+
757
+ $api_connect_playlist_items = $this->make_api_connection( $connected_account_for_term, 'playlistItems', $params );
758
+
759
+ $api_connect_playlist_items->connect();
760
+
761
+ if ( ! $api_connect_playlist_items->is_wp_error() && ! $api_connect_playlist_items->is_youtube_error() ) {
762
+ $one_successful_connection = true;
763
+ $data = $api_connect_playlist_items->get_data();
764
+
765
+ if ( isset( $data['items'][0] ) ) {
766
+ $post_set = $this->filter_posts( $data['items'], $settings );
767
+
768
+ $this->successful_video_api_request_made = true;
769
+
770
+ $new_post_sets[] = $post_set;
771
+ }
772
+
773
+ $next_page = $this->is_pageable() ? $api_connect_playlist_items->get_next_page() : false;
774
+ if ( ! empty( $next_page ) ) {
775
+ $next_pages[ $term . '_' . $type ] = $next_page;
776
+ $next_page_found = true;
777
+ } else {
778
+ $next_pages[ $term . '_' . $type ] = false;
779
+ }
780
+ }
781
+ } else {
782
+ $this->add_report( 'no first playlist' );
783
+ }
784
+
785
+ if ( ! $this->is_pageable()
786
+ && empty( $next_pages[ $term . '_' . $type ] )
787
+ && ! empty( $params['channel_id'] ) ) {
788
+ $this->add_report( 'using RSS to get first 15' );
789
+
790
+ $rss_connect_playlist_items = new SBY_RSS_Connect( 'playlistItems', $params );
791
+
792
+ $rss_connect_playlist_items->connect();
793
+
794
+ $one_successful_connection = true;
795
+
796
+ $data = $rss_connect_playlist_items->get_data();
797
+
798
+ if ( isset( $data[0] ) ) {
799
+ $data = array(
800
+ 'items' => $data
801
+ );
802
+ $post_set = $this->filter_posts( $data['items'], $settings );
803
+
804
+ $this->successful_video_api_request_made = true;
805
+
806
+
807
+ if ( count( $post_set ) > 14 ) {
808
+ if ( (int)self::get_channel_status( $term ) !== 1 ) {
809
+ $next_pages[ $term . '_' . $type ] = 'rss';
810
+ $next_page_found = true;
811
+ } else {
812
+ $this->add_report( 'RSS Only' . $term );
813
+ $post_set = $this->merge_cached_posts( $post_set, $term );
814
+ $next_pages[ $term . '_' . $type ] = false;
815
+ }
816
+ } else {
817
+ $next_pages[ $term . '_' . $type ] = false;
818
+ }
819
+
820
+ $new_post_sets[] = $post_set;
821
+
822
+ }
823
+ } else {
824
+ $this->num_api_calls++;
825
+ }
826
+
827
+ }
828
+ }
829
+ }
830
+
831
+ }
832
+
833
+ }
834
+
835
+ if ( ! $one_successful_connection || ($one_api_request_delayed && empty( $new_post_sets )) ) {
836
+ $this->should_use_backup = true;
837
+ }
838
+ $posts = $this->merge_posts( $new_post_sets, $settings );
839
+
840
+ $posts = $this->sort_posts( $posts, $settings );
841
+
842
+ if ( ! empty( $this->post_data ) && is_array( $this->post_data ) ) {
843
+ $posts = array_merge( $this->post_data, $posts );
844
+ }
845
+
846
+ $this->post_data = $posts;
847
+
848
+ if ( isset( $next_page_found ) && $next_page_found ) {
849
+ $this->next_pages = $next_pages;
850
+ } else {
851
+ $this->next_pages = false;
852
+ }
853
+ }
854
+
855
+ public function add_remote_pageable_posts() {
856
+
857
+ }
858
+
859
+ public function add_remote_non_pageable() {
860
+
861
+ }
862
+
863
+ private function is_pageable() {
864
+ global $sby_settings;
865
+
866
+ return ! empty( $sby_settings['api_key'] );
867
+ }
868
+
869
+ public function merge_cached_posts( $current_posts, $channel_id ) {
870
+ $args = array(
871
+ 'post_type' => SBY_CPT,
872
+ 'post_status' => array( 'publish', 'pending', 'draft' ),
873
+ 'orderby' => 'date',
874
+ 'order' => 'DESC',
875
+ 'posts_per_page' => 80,
876
+ 'meta_query' => array(
877
+ array(
878
+ 'value' => $channel_id,
879
+ 'key' => 'sby_channel_id'
880
+ )
881
+ )
882
+ );
883
+ $feed_videos = new WP_Query( $args );
884
+
885
+ if ( $feed_videos->have_posts() ) {
886
+ $posts = array();
887
+ while ( $feed_videos->have_posts() ) {
888
+ $feed_videos->the_post();
889
+ $json = get_post_meta( get_the_ID(), 'sby_json', true );
890
+ if ( $json ) {
891
+ $posts[] = json_decode( $json, true );
892
+ }
893
+ }
894
+
895
+ wp_reset_postdata();
896
+ $this->add_report( 'merging cached posts' );
897
+
898
+ $posts = array_merge( $current_posts, $posts );
899
+
900
+ return $posts;
901
+ } else {
902
+ $this->add_report( 'no cached posts found' );
903
+ wp_reset_postdata();
904
+
905
+ return $current_posts;
906
+ }
907
+ }
908
+
909
+ /**
910
+ * Connects to the YouTube API and records returned data. Will use channel data if already
911
+ * set by the regular feed
912
+ *
913
+ * @param $settings
914
+ * @param array $feed_types_and_terms organized settings related to feed data
915
+ * (ex. 'user' => array( 'smashballoon', 'customyoutubefeed' )
916
+ * @param array $connected_accounts_for_feed connected account data for the
917
+ * feed types and terms
918
+ *
919
+ * @since 1.0
920
+ */
921
+ public function set_remote_header_data( $settings, $feed_types_and_terms, $connected_accounts_for_feed ) {
922
+ $first_user = $this->get_first_user( $feed_types_and_terms, $settings );
923
+ $this->header_data = false;
924
+ $existing_channel_cache = $this->get_channel_cache( $first_user );
925
+
926
+ if ( $existing_channel_cache ) {
927
+ $this->channels_data[ $first_user ] = $existing_channel_cache;
928
+ $this->add_report( 'header data for ' . $first_user . ' exists in cache' );
929
+ }
930
+
931
+ if ( isset( $this->channels_data[ $first_user ] ) && ! $this->is_pageable() ) {
932
+ $this->header_data = $this->channels_data[ $first_user ];
933
+ } elseif ( ! empty( $first_user ) ) {
934
+ $connected_account_for_term = sby_get_first_connected_account();
935
+ if ( $connected_account_for_term['expires'] < time() + 5 ) {
936
+ $error_message = '<p><b>' . __( 'Reconnect to YouTube to show this feed.', 'custom-facebook-feed' ) . '</b></p>';
937
+ $error_message .= '<p>' . __( 'To create a new feed, first connect to YouTube using the "Connect to YouTube to Create a Feed" button on the settings page and connect any account.', SBY_TEXT_DOMAIN ) . '</p>';
938
+
939
+ if ( current_user_can( 'manage_youtube_feed_options' ) ) {
940
+ $error_message .= '<a href="' . admin_url( 'admin.php?page=youtube-feed' ) . '" target="blank" rel="noopener nofollow">' . __( 'Reconnect in the YouTube Feed Settings Area' ) . '</a>';
941
+ }
942
+ global $sby_posts_manager;
943
+
944
+ $sby_posts_manager->add_frontend_error( 'accesstoken', $error_message );
945
+ $sby_posts_manager->add_error( 'accesstoken', array( 'Trying to connect a new account', $error_message ) );
946
+ } else {
947
+ $channel_params_type = strpos( $first_user, 'UC' ) !== 0 ? 'channel_name' : 'channel_id';
948
+ $params[ $channel_params_type ] = $first_user;
949
+ $connection = $this->make_api_connection( $connected_account_for_term, 'channels', $params );
950
+
951
+ $connection->connect();
952
+ $this->add_report( 'api call made for header - ' . $first_user );
953
+
954
+ if ( ! $connection->is_wp_error() && ! $connection->is_youtube_error() ) {
955
+ $this->header_data = $connection->get_data();
956
+ $channel_id = SBY_Parse::get_channel_id( $this->header_data );
957
+ $this->set_channel_cache( $channel_id, $this->header_data );
958
+ $this->channels_data[ $channel_id ] = $this->header_data;
959
+ $this->channels_data[ $first_user ] = $this->header_data;
960
+
961
+ if ( isset( $connected_accounts_for_feed[ $first_user ]['local_avatar'] ) && $connected_accounts_for_feed[ $first_user ]['local_avatar'] ) {
962
+ $upload = wp_upload_dir();
963
+ $resized_url = trailingslashit( $upload['baseurl'] ) . trailingslashit( SBY_UPLOADS_NAME );
964
+
965
+ $full_file_name = $resized_url . $this->header_data['username'] . '.jpg';
966
+ $this->header_data['local_avatar'] = $full_file_name;
967
+ }
968
+ } else {
969
+ if ( $connection->is_wp_error() ) {
970
+ SBY_API_Connect::handle_wp_remote_get_error( $connection->get_wp_error() );
971
+ } else {
972
+ SBY_API_Connect::handle_youtube_error( $connection->get_data(), $connected_accounts_for_feed[ $first_user ], 'header' );
973
+ }
974
+ }
975
+ }
976
+ }
977
+ }
978
+
979
+ /**
980
+ * Stores feed data in a transient for a specified time
981
+ *
982
+ * @param int $cache_time
983
+ *
984
+ * @since 1.0
985
+ */
986
+ public function cache_feed_data( $cache_time ) {
987
+ if ( ! empty( $this->post_data ) || ! empty( $this->next_pages ) ) {
988
+ $this->remove_duplicate_posts();
989
+ $this->trim_posts_to_max();
990
+
991
+ $post_data = $this->post_data;
992
+
993
+ if (! isset( $post_data[0]['iframe'] )) {
994
+ $to_cache = array(
995
+ 'data' => $this->post_data,
996
+ 'pagination' => $this->next_pages
997
+ );
998
+
999
+ set_transient( $this->regular_feed_transient_name, wp_json_encode( $to_cache ), $cache_time );
1000
+ } else {
1001
+ $this->add_report( 'iframe not caching' );
1002
+ }
1003
+
1004
+
1005
+ } else {
1006
+ $this->add_report( 'no data not caching' );
1007
+ }
1008
+ }
1009
+
1010
+ /**
1011
+ * Stores feed data with additional data specifically for cron caching
1012
+ *
1013
+ * @param array $to_cache feed data with additional things like the shortcode
1014
+ * settings, when the cache was last requested, when new posts were last retrieved
1015
+ * @param int $cache_time how long the cache will last
1016
+ *
1017
+ * @since 1.0
1018
+ */
1019
+ public function set_cron_cache( $to_cache, $cache_time ) {
1020
+ if ( ! empty( $this->post_data )
1021
+ || ! empty( $this->next_pages )
1022
+ || ! empty( $to_cache['data'] ) ) {
1023
+ $this->remove_duplicate_posts();
1024
+ $this->trim_posts_to_max();
1025
+
1026
+ $to_cache['data'] = isset( $to_cache['data'] ) ? $to_cache['data'] : $this->post_data;
1027
+ $to_cache['pagination'] = isset( $to_cache['next_pages'] ) ? $to_cache['next_pages'] : $this->next_pages;
1028
+ $to_cache['atts'] = isset( $to_cache['atts'] ) ? $to_cache['atts'] : $this->transient_atts;
1029
+ $to_cache['last_requested'] = isset( $to_cache['last_requested'] ) ? $to_cache['last_requested'] : time();
1030
+ $to_cache['last_retrieve'] = isset( $to_cache['last_retrieve'] ) ? $to_cache['last_retrieve'] : $this->last_retrieve;
1031
+
1032
+ set_transient( $this->regular_feed_transient_name, wp_json_encode( $to_cache ), $cache_time );
1033
+ } else {
1034
+ $this->add_report( 'no data not caching' );
1035
+ }
1036
+
1037
+ }
1038
+
1039
+ /**
1040
+ * Stores header data for a specified time as a transient
1041
+ *
1042
+ * @param int $cache_time
1043
+ * @param bool $save_backup
1044
+ *
1045
+ * @since 1.0
1046
+ */
1047
+ public function cache_header_data( $cache_time, $save_backup = true ) {
1048
+ if ( $this->header_data ) {
1049
+ set_transient( $this->header_transient_name, wp_json_encode( $this->header_data ), $cache_time );
1050
+
1051
+ if ( $save_backup ) {
1052
+ update_option( $this->backup_header_transient_name, wp_json_encode( $this->header_data ), false );
1053
+ }
1054
+ }
1055
+ }
1056
+
1057
+ /**
1058
+ * Used to randomly trigger an updating of the last requested data for cron caching
1059
+ *
1060
+ * @return bool
1061
+ *
1062
+ * @since 1.0
1063
+ */
1064
+ public function should_update_last_requested() {
1065
+ return (rand( 1, 20 ) === 20);
1066
+ }
1067
+
1068
+ /**
1069
+ * Determines if pagination can and should be used based on settings and available feed data
1070
+ *
1071
+ * @param array $settings
1072
+ * @param int $offset
1073
+ *
1074
+ * @return bool
1075
+ *
1076
+ * @since 1.0
1077
+ */
1078
+ public function should_use_pagination( $settings, $offset = 0 ) {
1079
+ $posts_available = count( $this->post_data ) - ($offset + $settings['num']);
1080
+ $show_loadmore_button_by_settings = ($settings['showbutton'] == 'on' || $settings['showbutton'] == 'true' || $settings['showbutton'] == true ) && $settings['showbutton'] !== 'false';
1081
+
1082
+ if ( $show_loadmore_button_by_settings ) {
1083
+ // used for permanent and whitelist feeds
1084
+ if ( $this->feed_is_complete( $settings, $offset ) ) {
1085
+ $this->add_report( 'no pagination, feed complete' );
1086
+ return false;
1087
+ }
1088
+ if ( $posts_available > 0 ) {
1089
+ $this->add_report( 'do pagination, posts available' );
1090
+ return true;
1091
+ }
1092
+ $pages = $this->next_pages;
1093
+
1094
+ if ( $pages && ! $this->should_use_backup() ) {
1095
+ foreach ( $pages as $page ) {
1096
+ if ( ! empty( $page ) ) {
1097
+ return true;
1098
+ }
1099
+ }
1100
+ }
1101
+
1102
+ }
1103
+
1104
+
1105
+ $this->add_report( 'no pagination, no posts available' );
1106
+
1107
+ return false;
1108
+ }
1109
+
1110
+ public static function get_channel_status( $channel ) {
1111
+ $channel_setting = get_option( 'sby_channel_status', array() );
1112
+
1113
+ if ( isset( $channel_setting[ $channel ] ) ) {
1114
+ return $channel_setting[ $channel ];
1115
+ }
1116
+
1117
+ return 0;
1118
+ }
1119
+
1120
+ public static function update_channel_status( $channel, $status ) {
1121
+ $channel_setting = get_option( 'sby_channel_status', array() );
1122
+
1123
+ $channel_setting[ $channel ] = $status;
1124
+
1125
+ update_option( 'sby_channel_status', $channel_setting, false );
1126
+ }
1127
+
1128
+ /**
1129
+ * Generates the HTML for the feed if post data is available. Although it seems
1130
+ * some of the variables ar not used they are set here to hide where they
1131
+ * come from when used in the feed templates.
1132
+ *
1133
+ * @param array $settings
1134
+ * @param array $atts
1135
+ * @param array $feed_types_and_terms organized settings related to feed data
1136
+ * (ex. 'user' => array( 'smashballoon', 'customyoutubefeed' )
1137
+ * @param array $connected_accounts_for_feed connected account data for the
1138
+ * feed types and terms
1139
+ *
1140
+ * @return false|string
1141
+ *
1142
+ * @since 1.0
1143
+ */
1144
+ public function get_the_feed_html( $settings, $atts, $feed_types_and_terms, $connected_accounts_for_feed ) {
1145
+ global $sby_posts_manager;
1146
+
1147
+ if ( empty( $this->post_data ) && ! empty( $connected_accounts_for_feed ) ) {
1148
+ $error = '<p><b>' . __( 'Error: No videos found.', SBY_TEXT_DOMAIN ) . '</b>';
1149
+ $error .= '<p>' . __( 'Make sure this is a valid channel ID and that the channel has videos available on youtube.com.', SBY_TEXT_DOMAIN ) . '</p>';
1150
+
1151
+ $sby_posts_manager->add_frontend_error( 'noposts', $error );
1152
+ }
1153
+
1154
+ $posts = array_slice( $this->post_data, 0, $settings['minnum'] );
1155
+ $header_data = ! empty( $this->header_data ) ? $this->header_data : false;
1156
+
1157
+ $first_username = false;
1158
+ if ( $header_data ) {
1159
+ $first_username = SBY_Parse::get_channel_id( $header_data );
1160
+ } elseif ( isset( $this->post_data[0] ) ) { // in case no connected account for feed
1161
+ $first_username = SBY_Parse::get_channel_id( $this->post_data[0] );
1162
+ }
1163
+
1164
+ $use_pagination = $this->should_use_pagination( $settings, 0 );
1165
+
1166
+ $feed_id = $this->regular_feed_transient_name;
1167
+ $shortcode_atts = ! empty( $atts ) ? wp_json_encode( $atts ) : '{}';
1168
+
1169
+ $settings['header_outside'] = false;
1170
+ $settings['header_inside'] = false;
1171
+ if ( $header_data && $settings['showheader'] ) {
1172
+ $settings['header_inside'] = true;
1173
+ }
1174
+
1175
+ $other_atts = '';
1176
+
1177
+ $classes = array();
1178
+ if ( empty( $settings['widthresp'] ) || $settings['widthresp'] == 'on' || $settings['widthresp'] == 'true' || $settings['widthresp'] === true ) {
1179
+ if ( $settings['widthresp'] !== 'false' ) {
1180
+ $classes[] = 'sby_width_resp';
1181
+ }
1182
+ }
1183
+ if ( ! empty( $settings['class'] ) ) {
1184
+ $classes[] = esc_attr( $settings['class'] );
1185
+ }
1186
+ if ( ! empty( $settings['height'] )
1187
+ && (((int)$settings['height'] < 100 && $settings['heightunit'] === '%') || $settings['heightunit'] === 'px') ) {
1188
+ $classes[] = 'sby_fixed_height';
1189
+ }
1190
+ if ( ! empty( $settings['disablemobile'] )
1191
+ && ($settings['disablemobile'] == 'on' || $settings['disablemobile'] == 'true' || $settings['disablemobile'] == true) ) {
1192
+ if ( $settings['disablemobile'] !== 'false' ) {
1193
+ $classes[] = 'sby_disable_mobile';
1194
+ }
1195
+ }
1196
+
1197
+ $additional_classes = '';
1198
+ if ( ! empty( $classes ) ) {
1199
+ $additional_classes = ' ' . implode( ' ', $classes );
1200
+ }
1201
+
1202
+ $other_atts = $this->add_other_atts( $other_atts, $settings );
1203
+
1204
+ $flags = array();
1205
+
1206
+ if ( $this->successful_video_api_request_made && ! empty( $posts ) ) {
1207
+ if ( $settings['storage_process'] === 'page' ) {
1208
+ $this_posts = $posts;
1209
+ if ( $this->do_page_cache_all ) {
1210
+ $this_posts = $this->post_data;
1211
+ }
1212
+ $this->add_report( 'Adding videos to wp_posts ' . count( $this_posts ) );
1213
+
1214
+ sby_process_post_set_caching( $this_posts, $feed_id );
1215
+ } elseif ( $settings['storage_process'] === 'background' ) {
1216
+ $flags[] = 'checkWPPosts';
1217
+ if ( $this->do_page_cache_all ) {
1218
+ $this->add_report( 'Flagging videos to wp_posts ' . count( $this->post_data ) );
1219
+ $flags[] = 'cacheAll';
1220
+ }
1221
+ }
1222
+ }
1223
+
1224
+ if ( $settings['disable_resize'] ) {
1225
+ $flags[] = 'resizeDisable';
1226
+ } elseif ( $settings['favor_local'] ) {
1227
+ $flags[] = 'favorLocal';
1228
+ }
1229
+
1230
+ if ( $settings['disable_js_image_loading'] ) {
1231
+ $flags[] = 'imageLoadDisable';
1232
+ }
1233
+ if ( $settings['ajax_post_load'] ) {
1234
+ $flags[] = 'ajaxPostLoad';
1235
+ }
1236
+ if ( $settings['playerratio'] === '3:4' ) {
1237
+ $flags[] = 'narrowPlayer';
1238
+ }
1239
+ if ( isset( $_GET['sby_debug'] ) ) {
1240
+ $flags[] = 'debug';
1241
+ }
1242
+
1243
+ if ( ! empty( $flags ) ) {
1244
+ $other_atts .= ' data-sby-flags="' . implode(',', $flags ) . '"';
1245
+ }
1246
+
1247
+ if ( $settings['layout'] === 'grid' || $settings['layout'] === 'carousel' ) {
1248
+ $other_atts .= ' data-sby-supports-lightbox="1"';
1249
+ }
1250
+ $icon_type = $settings['font_method'];
1251
+
1252
+ ob_start();
1253
+ include sby_get_feed_template_part( 'feed', $settings );
1254
+ $html = ob_get_contents();
1255
+ ob_get_clean();
1256
+
1257
+ if ( $settings['ajaxtheme'] ) {
1258
+ $html .= $this->get_ajax_page_load_html();
1259
+ }
1260
+
1261
+ return $html;
1262
+ }
1263
+
1264
+ /**
1265
+ * Generates HTML for individual sby_item elements
1266
+ *
1267
+ * @param array $settings
1268
+ * @param int $offset
1269
+ * @param array $feed_types_and_terms organized settings related to feed data
1270
+ * (ex. 'user' => array( 'smashballoon', 'customyoutubefeed' )
1271
+ * @param array $connected_accounts_for_feed connected account data for the
1272
+ * feed types and terms
1273
+ *
1274
+ * @return false|string
1275
+ *
1276
+ * @since 1.0
1277
+ */
1278
+ public function get_the_items_html( $settings, $offset, $feed_types_and_terms = array(), $connected_accounts_for_feed = array() ) {
1279
+ if ( empty( $this->post_data ) ) {
1280
+ ob_start();
1281
+ $html = ob_get_contents();
1282
+ ob_get_clean(); ?>
1283
+ <p><?php _e( 'No posts found.', SBY_TEXT_DOMAIN ); ?></p>
1284
+ <?php
1285
+ $html = ob_get_contents();
1286
+ ob_get_clean();
1287
+ return $html;
1288
+ }
1289
+
1290
+ $posts = array_slice( $this->post_data, $offset, $settings['num'] );
1291
+
1292
+ ob_start();
1293
+
1294
+ $this->posts_loop( $posts, $settings, $offset );
1295
+
1296
+ $html = ob_get_contents();
1297
+ ob_get_clean();
1298
+
1299
+ return $html;
1300
+ }
1301
+
1302
+ /**
1303
+ * Overwritten in the Pro version
1304
+ *
1305
+ * @return object
1306
+ */
1307
+ public function make_api_connection( $connected_account_or_page, $type = NULL, $params = NULL ) {
1308
+ return new SBY_API_Connect( $connected_account_or_page, $type, $params );
1309
+ }
1310
+
1311
+ /**
1312
+ * When the feed is loaded with AJAX, the JavaScript for the plugin
1313
+ * needs to be triggered again. This function is a workaround that adds
1314
+ * the file and settings to the page whenever the feed is generated.
1315
+ *
1316
+ * @return string
1317
+ *
1318
+ * @since 1.0
1319
+ */
1320
+ public static function get_ajax_page_load_html() {
1321
+ global $sby_settings;
1322
+
1323
+ $js_options = array(
1324
+ 'adminAjaxUrl' => admin_url( 'admin-ajax.php' ),
1325
+ 'placeholder' => trailingslashit( SBY_PLUGIN_URL ) . 'img/placeholder.png',
1326
+ 'placeholderNarrow' => trailingslashit( SBY_PLUGIN_URL ) . 'img/placeholder-narrow.png',
1327
+ 'lightboxPlaceholder' => trailingslashit( SBY_PLUGIN_URL ) . 'img/lightbox-placeholder.png',
1328
+ 'lightboxPlaceholderNarrow' => trailingslashit( SBY_PLUGIN_URL ) . 'img/lightbox-placeholder-narrow.png',
1329
+ 'autoplay' => $sby_settings['playvideo'] === 'automatically',
1330
+ 'semiEagerload' => $sby_settings['eagerload'],
1331
+ 'eagerload' => false
1332
+ );
1333
+
1334
+ $encoded_options = wp_json_encode( $js_options );
1335
+
1336
+ $js_option_html = '<script type="text/javascript">if (typeof sbyOptions === "undefined") var sbyOptions = ' . $encoded_options . ';</script>';
1337
+ $js_option_html .= "<script type='text/javascript' src='" . trailingslashit( SBY_PLUGIN_URL ) . 'js/sb-youtube.min.js?ver=' . SBYVER . "'></script>";
1338
+
1339
+ return $js_option_html;
1340
+ }
1341
+
1342
+ /**
1343
+ * Overwritten in the Pro version
1344
+ *
1345
+ * @param $feed_types_and_terms
1346
+ *
1347
+ * @return string
1348
+ *
1349
+ * @since 2.1/5.2
1350
+ */
1351
+ public function get_first_user( $feed_types_and_terms, $settings = array() ) {
1352
+ if ( isset( $feed_types_and_terms['channels'][0] ) ) {
1353
+ return $feed_types_and_terms['channels'][0]['term'];
1354
+ } else {
1355
+ return '';
1356
+ }
1357
+ }
1358
+
1359
+ public function do_page_cache_all() {
1360
+ return $this->do_page_cache_all;
1361
+ }
1362
+
1363
+ public function successful_video_api_request_made() {
1364
+ return $this->successful_video_api_request_made;
1365
+ }
1366
+
1367
+ /**
1368
+ * Adds recorded strings to an array
1369
+ *
1370
+ * @param $to_add
1371
+ *
1372
+ * @since 1.0
1373
+ */
1374
+ public function add_report( $to_add ) {
1375
+ $this->report[] = $to_add;
1376
+ }
1377
+
1378
+ /**
1379
+ * @return array
1380
+ *
1381
+ * @since 1.0
1382
+ */
1383
+ public function get_report() {
1384
+ return $this->report;
1385
+ }
1386
+
1387
+ /**
1388
+ * Additional options/settings added to the main div
1389
+ * for the feed
1390
+ *
1391
+ * Overwritten in the Pro version
1392
+ *
1393
+ * @param $other_atts
1394
+ * @param $settings
1395
+ *
1396
+ * @return string
1397
+ */
1398
+ protected function add_other_atts( $other_atts, $settings ) {
1399
+ return '';
1400
+ }
1401
+
1402
+ /**
1403
+ * Used for filtering a single API request worth of posts
1404
+ *
1405
+ * Overwritten in the Pro version
1406
+ *
1407
+ * @param array $post_set a single set of post data from the api
1408
+ *
1409
+ * @return mixed|array
1410
+ *
1411
+ * @since 1.0
1412
+ */
1413
+ protected function filter_posts( $post_set, $settings = array() ) {
1414
+ // array_unique( $post_set, SORT_REGULAR);
1415
+
1416
+ return $post_set;
1417
+ }
1418
+
1419
+ protected function remove_duplicate_posts() {
1420
+ $posts = $this->post_data;
1421
+ $ids_in_feed = array();
1422
+ $non_duplicate_posts = array();
1423
+ $removed = array();
1424
+
1425
+ foreach ( $posts as $post ) {
1426
+ $post_id = SBY_Parse::get_video_id( $post );
1427
+ if ( ! in_array( $post_id, $ids_in_feed, true ) ) {
1428
+ $ids_in_feed[] = $post_id;
1429
+ $non_duplicate_posts[] = $post;
1430
+ } else {
1431
+ $removed[] = $post_id;
1432
+ }
1433
+ }
1434
+
1435
+ $this->add_report( 'removed duplicates: ' . implode(', ', $removed ) );
1436
+ $this->set_post_data( $non_duplicate_posts );
1437
+ }
1438
+
1439
+ /**
1440
+ * Used for limiting the cache size
1441
+ *
1442
+ * @since 2.0/5.1.1
1443
+ */
1444
+ protected function trim_posts_to_max() {
1445
+ if ( ! is_array( $this->post_data ) ) {
1446
+ return;
1447
+ }
1448
+
1449
+ $max = apply_filters( 'sby_max_cache_size', 500 );
1450
+ $this->set_post_data( array_slice( $this->post_data , 0, $max ) );
1451
+
1452
+ }
1453
+
1454
+ /**
1455
+ * Used for permanent feeds or white list feeds to
1456
+ * stop pagination if all posts are already added
1457
+ *
1458
+ * Overwritten in the Pro version
1459
+ *
1460
+ * @param array $settings
1461
+ * @param int $offset
1462
+ *
1463
+ * @return bool
1464
+ *
1465
+ * @since 1.0
1466
+ */
1467
+ protected function feed_is_complete( $settings, $offset = 0 ) {
1468
+ return false;
1469
+ }
1470
+
1471
+ /**
1472
+ * Iterates through post data and tracks the index of the current post.
1473
+ * The actual post ids of the posts are stored in an array so the plugin
1474
+ * can search for local images that may be available.
1475
+ *
1476
+ * @param array $posts final filtered post data for the feed
1477
+ * @param array $settings
1478
+ * @param int $offset
1479
+ *
1480
+ * @since 1.0
1481
+ */
1482
+ protected function posts_loop( $posts, $settings, $offset = 0 ) {
1483
+
1484
+ $image_ids = array();
1485
+ $post_index = $offset;
1486
+ if ( ! isset( $settings['feed_id'] ) ) {
1487
+ $settings['feed_id'] = $this->regular_feed_transient_name;
1488
+ }
1489
+ $misc_data = $this->get_misc_data( $settings['feed_id'], $posts );
1490
+ $icon_type = $settings['font_method'];
1491
+
1492
+ foreach ( $posts as $post ) {
1493
+ $image_ids[] = SBY_Parse::get_post_id( $post );
1494
+ include sby_get_feed_template_part( 'item', $settings );
1495
+ $post_index++;
1496
+ }
1497
+
1498
+ $this->image_ids_post_set = $image_ids;
1499
+ }
1500
+
1501
+ /**
1502
+ * Uses array of API request results and merges them based on how
1503
+ * the feed should be sorted. Mixed feeds are always sorted alternating
1504
+ * since there is no post date for hashtag feeds.
1505
+ *
1506
+ * @param array $post_sets an array of single API request worth
1507
+ * of posts
1508
+ * @param array $settings
1509
+ *
1510
+ * @return array
1511
+ *
1512
+ * @since 1.0
1513
+ */
1514
+ private function merge_posts( $post_sets, $settings ) {
1515
+
1516
+ $merged_posts = array();
1517
+ if ( $settings['sortby'] === 'alternate' ) {
1518
+ // don't bother merging posts if there is only one post set
1519
+ if ( isset( $post_sets[1] ) ) {
1520
+ $min_cycles = max( 1, (int)$settings['num'] );
1521
+ for( $i = 0; $i <= $min_cycles; $i++ ) {
1522
+ foreach ( $post_sets as $post_set ) {
1523
+ if ( isset( $post_set[ $i ] ) && isset( $post_set[ $i ]['id'] ) ) {
1524
+ $merged_posts[] = $post_set[ $i ];
1525
+ }
1526
+ }
1527
+ }
1528
+ } else {
1529
+ $merged_posts = isset( $post_sets[0] ) ? $post_sets[0] : array();
1530
+ }
1531
+ } elseif ( $settings['sortby'] === 'api' ) {
1532
+ if ( isset( $post_sets[0] ) ) {
1533
+ foreach ( $post_sets as $post_set ) {
1534
+ $merged_posts = array_merge( $merged_posts, $post_set );
1535
+ }
1536
+ }
1537
+ } else {
1538
+ // don't bother merging posts if there is only one post set
1539
+ if ( isset( $post_sets[1] ) ) {
1540
+ foreach ( $post_sets as $post_set ) {
1541
+ if ( isset( $post_set[0]['id'] ) ) {
1542
+ $merged_posts = array_merge( $merged_posts, $post_set );
1543
+ }
1544
+ }
1545
+ } else {
1546
+ $merged_posts = isset( $post_sets[0] ) ? $post_sets[0] : array();
1547
+ }
1548
+ }
1549
+
1550
+
1551
+ return $merged_posts;
1552
+ }
1553
+
1554
+ /**
1555
+ * Sorts a post set based on sorting settings. Sorting by "alternate"
1556
+ * is done when merging posts for efficiency's sake so the post set is
1557
+ * just returned as it is.
1558
+ *
1559
+ * @param array $post_set
1560
+ * @param array $settings
1561
+ *
1562
+ * @return mixed|array
1563
+ *
1564
+ * @since 1.0
1565
+ */
1566
+ protected function sort_posts( $post_set, $settings ) {
1567
+ if ( empty( $post_set ) ) {
1568
+ return $post_set;
1569
+ }
1570
+
1571
+ // sorting done with "merge_posts" to be more efficient
1572
+ if ( $settings['sortby'] === 'alternate' || $settings['sortby'] === 'api' ) {
1573
+ $return_post_set = $post_set;
1574
+ } elseif ( $settings['sortby'] === 'random' ) {
1575
+ /*
1576
+ * randomly selects posts in a random order. Cache saves posts
1577
+ * in this random order so paginating does not cause some posts to show up
1578
+ * twice or not at all
1579
+ */
1580
+ usort($post_set, 'sby_rand_sort' );
1581
+ $return_post_set = $post_set;
1582
+
1583
+ } else {
1584
+ // compares posted on dates of posts
1585
+ usort($post_set, 'sby_date_sort' );
1586
+ $return_post_set = $post_set;
1587
+ }
1588
+
1589
+ /**
1590
+ * Apply a custom sorting of posts
1591
+ *
1592
+ * @param array $return_post_set Ordered set of filtered posts
1593
+ * @param array $settings Settings for this feed
1594
+ *
1595
+ * @since 1.0
1596
+ */
1597
+
1598
+ return apply_filters( 'sby_sorted_posts', $return_post_set, $settings );
1599
+ }
1600
+
1601
+ /**
1602
+ * Can trigger a second attempt at getting posts from the API
1603
+ *
1604
+ * Overwritten in the Pro version
1605
+ *
1606
+ * @param string $type
1607
+ * @param array $connected_account_with_error
1608
+ * @param int $attempts
1609
+ *
1610
+ * @return bool
1611
+ *
1612
+ * @since 1.0
1613
+ */
1614
+ protected function can_try_another_request( $type, $connected_account_with_error, $attempts = 0 ) {
1615
+ return false;
1616
+ }
1617
+
1618
+ /**
1619
+ * returns a second connected account if it exists
1620
+ *
1621
+ * Overwritten in the Pro version
1622
+ *
1623
+ * @param string $type
1624
+ * @param array $attempted_connected_accounts
1625
+ *
1626
+ * @return bool
1627
+ *
1628
+ * @since 1.0
1629
+ */
1630
+ protected function get_different_connected_account( $type, $attempted_connected_accounts ) {
1631
+ return false;
1632
+ }
1633
+
1634
+ }
trunk/inc/class-sby-parse.php ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ if ( isset( $post['id'] ) && ! is_array( $post['id'] ) ) {
18
+ return $post['id'];
19
+ } else {
20
+ return SBY_Parse::get_channel_id( $post ) . '_' . SBY_Parse::get_video_id( $post );
21
+ }
22
+ }
23
+
24
+ public static function get_video_id( $post ) {
25
+ if ( isset( $post['snippet']['resourceId']['videoId'] ) ) {
26
+ return $post['snippet']['resourceId']['videoId'];
27
+ } elseif ( isset( $post['id']['videoId'] ) ) {
28
+ return $post['id']['videoId'];
29
+ } elseif ( isset( $post['id']) ) {
30
+ return $post['id'];
31
+ }
32
+
33
+ return '';
34
+ }
35
+
36
+ /**
37
+ * @param $post array
38
+ *
39
+ * @return false|int
40
+ *
41
+ * @since 1.0
42
+ */
43
+ public static function get_timestamp( $post ) {
44
+ $timestamp = 0;
45
+ if ( isset( $post['snippet']['publishedAt'] ) ) {
46
+ $remove_extra = str_replace( array( 'T', '+00:00', '.000Z', '+' ), ' ', $post['snippet']['publishedAt'] );
47
+ $timestamp = strtotime( $remove_extra );
48
+ }
49
+
50
+ return $timestamp;
51
+ }
52
+
53
+ /**
54
+ * @param $post array
55
+ *
56
+ * @return mixed
57
+ *
58
+ * @since 1.0
59
+ */
60
+ public static function get_permalink( $post ) {
61
+ if ( isset( $post['snippet']['resourceId']['videoId'] ) ) {
62
+ return 'https://www.youtube.com/watch?v=' . $post['snippet']['resourceId']['videoId'];
63
+ } elseif ( isset( $post['snippet']['channelId'] ) ) {
64
+ return 'https://www.youtube.com/channel/' . $post['snippet']['channelId'];
65
+ }
66
+
67
+ return 'https://www.youtube.com/';
68
+ }
69
+
70
+ /**
71
+ * @param array $post
72
+ * @param string $resolution
73
+ *
74
+ * @return string
75
+ *
76
+ * @since 1.0
77
+ */
78
+ public static function get_media_url( $post, $resolution = 'lightbox' ) {
79
+ $thumbnail_key = 'standard';
80
+ switch ( $resolution ) {
81
+ case 'thumb' :
82
+ $thumbnail_key = 'default';
83
+ break;
84
+ case 'medium' :
85
+ $thumbnail_key = 'medium';
86
+ break;
87
+ case 'high' :
88
+ $thumbnail_key = 'high';
89
+ break;
90
+ case 'lightbox' :
91
+ $thumbnail_key = 'maxres';
92
+ break;
93
+ }
94
+
95
+ if ( isset( $post['snippet']['thumbnails'][ $thumbnail_key ]['url'] ) ) {
96
+ return $post['snippet']['thumbnails'][ $thumbnail_key ]['url'];
97
+ } elseif ( isset( $post['snippet']['thumbnails']['high']['url'] ) ) {
98
+ return $post['snippet']['thumbnails']['high']['url'];
99
+ } elseif ( isset( $post['snippet']['thumbnails']['medium']['url'] ) ) {
100
+ return $post['snippet']['thumbnails']['medium']['url'];
101
+ }
102
+
103
+ return '';
104
+ }
105
+
106
+ /**
107
+ * Uses the existing data for the individual YouTube post to
108
+ * set the best image sources for each resolution size. Due to
109
+ * random bugs or just how the API works, different post types
110
+ * need special treatment.
111
+ *
112
+ * @param array $post
113
+ * @param array $resized_images
114
+ *
115
+ * @return array
116
+ *
117
+ * @since 1.0
118
+ */
119
+ public static function get_media_src_set( $post, $resized_images = array() ) {
120
+ $media_urls = array();
121
+ $thumbnails = isset( $post['snippet']['thumbnails'] ) ? $post['snippet']['thumbnails'] : false;
122
+ $largest_found = '';
123
+
124
+ if ( $thumbnails ) {
125
+ if ( isset( $thumbnails['default']['url'] ) ) {
126
+ $media_urls['120'] = $thumbnails['default']['url'];
127
+ $largest_found = $thumbnails['default']['url'];
128
+ } else {
129
+ $media_urls['120'] = $largest_found;
130
+ }
131
+ if ( isset( $thumbnails['medium']['url'] ) ) {
132
+ $media_urls['320'] = $thumbnails['medium']['url'];
133
+ $largest_found = $thumbnails['medium']['url'];
134
+ } else {
135
+ $media_urls['320'] = $largest_found;
136
+ }
137
+ if ( isset( $thumbnails['high']['url'] ) ) {
138
+ $media_urls['480'] = $thumbnails['high']['url'];
139
+ $largest_found = $thumbnails['high']['url'];
140
+ } else {
141
+ $media_urls['480'] = $largest_found;
142
+ }
143
+ if ( isset( $thumbnails['standard']['url'] ) ) {
144
+ $media_urls['640'] = $thumbnails['standard']['url'];
145
+ } else {
146
+ $media_urls['640'] = $largest_found;
147
+ }
148
+ }
149
+
150
+
151
+ return $media_urls;
152
+ }
153
+
154
+ /**
155
+ * A default can be set in the case that the user doesn't use captions
156
+ * for posts as this is also used as the alt text for the image.
157
+ *
158
+ * @param $post
159
+ * @param string $default
160
+ *
161
+ * @return string
162
+ *
163
+ * @since 1.0
164
+ */
165
+ public static function get_caption( $post, $default = '' ) {
166
+ $caption = $default;
167
+ if ( isset( $post['snippet']['description'] ) ) {
168
+ $caption = $post['snippet']['description'];
169
+ }
170
+
171
+ return $caption;
172
+ }
173
+
174
+ public static function get_video_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
+ } else if ( isset( $channel_or_playlist_item_data['snippet']['title'] ) ) {
178
+ return $channel_or_playlist_item_data['snippet']['title'];
179
+ }
180
+ return '';
181
+ }
182
+
183
+ public static function get_channel_id( $channel_or_playlist_item_data ) {
184
+ if ( isset( $channel_or_playlist_item_data['items'][0]['id'] ) ) {
185
+ return $channel_or_playlist_item_data['items'][0]['id'];
186
+ } elseif ( isset( $channel_or_playlist_item_data['snippet']['channelId'] ) ) {
187
+ return $channel_or_playlist_item_data['snippet']['channelId'];
188
+ }
189
+ return '';
190
+ }
191
+
192
+ public static function get_channel_title( $channel_or_playlist_item_data ) {
193
+ if ( isset( $channel_or_playlist_item_data['items'][0]['snippet']['title'] ) ) {
194
+ return $channel_or_playlist_item_data['items'][0]['snippet']['title'];
195
+ } elseif ( isset( $channel_or_playlist_item_data['snippet']['channelTitle'] ) ) {
196
+ return $channel_or_playlist_item_data['snippet']['channelTitle'];
197
+ }
198
+ return '';
199
+ }
200
+
201
+ public static function get_channel_permalink( $channel_data ) {
202
+ return 'https://www.youtube.com/channel/' . SBY_Parse::get_channel_id( $channel_data ) . '/';
203
+ }
204
+
205
+ /**
206
+ * @param array $header_data
207
+ * @param array $settings
208
+ *
209
+ * @return string
210
+ *
211
+ * @since 1.0
212
+ */
213
+ public static function get_avatar( $header_data, $settings = array( 'favor_local' => false ) ) {
214
+ if ( $settings['favor_local'] && ! empty( $header_data['local_avatar'] ) ) {
215
+ return $header_data['local_avatar'];
216
+ } else {
217
+ if ( isset( $header_data['items'][0]['snippet']['thumbnails'] ) ) {
218
+ $header_size = isset( $settings['headersize'] ) ? $settings['headersize'] : '';
219
+ if ( $header_size === 'large' ) {
220
+ return $header_data['items'][0]['snippet']['thumbnails']['high']['url'];
221
+ } elseif ( $header_size === 'medium' ) {
222
+ return $header_data['items'][0]['snippet']['thumbnails']['medium']['url'];
223
+ } else {
224
+ return $header_data['items'][0]['snippet']['thumbnails']['default']['url'];
225
+ }
226
+ }
227
+ }
228
+ return '';
229
+ }
230
+
231
+ public static function get_item_avatar( $post, $avatars ) {
232
+ if ( empty ( $avatars ) ) {
233
+ return '';
234
+ } else {
235
+ $username = SBY_Parse::get_channel_id( $post );
236
+ if ( isset( $avatars[ $username ] ) ) {
237
+ return $avatars[ $username ];
238
+ }
239
+ }
240
+ return '';
241
+ }
242
+
243
+ /**
244
+ * Account bio/description used in header
245
+ *
246
+ * @param $header_data
247
+ *
248
+ * @return string
249
+ *
250
+ * @since 1.0
251
+ */
252
+ public static function get_channel_description( $header_data ) {
253
+ if ( isset( $header_data['items'][0]['snippet']['description'] ) ) {
254
+ return $header_data['items'][0]['snippet']['description'];
255
+ }
256
+ return '';
257
+ }
258
+ }
trunk/inc/class-sby-posts-manager.php ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ public function remove_all_errors() {
278
+ delete_option( $this->options_prefix . '_errors' );
279
+ }
280
+
281
+ /**
282
+ * @param $type
283
+ * @param $message
284
+ *
285
+ * @since 1.0
286
+ */
287
+ public function add_frontend_error( $type, $message ) {
288
+ $this->frontend_errors[ $type ] = $message;
289
+ }
290
+
291
+ /**
292
+ * @return array
293
+ *
294
+ * @since 1.0
295
+ */
296
+ public function get_frontend_errors() {
297
+ return $this->frontend_errors;
298
+ }
299
+
300
+ /**
301
+ * @return array
302
+ *
303
+ * @since 1.0
304
+ */
305
+ public function reset_frontend_errors() {
306
+ return $this->frontend_errors = array();
307
+ }
308
+
309
+ /**
310
+ * @since 1.0
311
+ */
312
+ public function add_api_request_delay( $time_in_seconds = 300, $account_id = false ) {
313
+ if ( $account_id ) {
314
+ set_transient( SBY_USE_BACKUP_PREFIX . $this->options_prefix . '_' . $account_id, '1', $time_in_seconds );
315
+ } else {
316
+ set_transient( SBY_USE_BACKUP_PREFIX . $this->options_prefix . '_delay_requests', '1', $time_in_seconds );
317
+ }
318
+ }
319
+
320
+ /**
321
+ * @since 1.0
322
+ */
323
+ public function are_current_api_request_delays( $account_id = false ) {
324
+ $is_delay = (get_transient( SBY_USE_BACKUP_PREFIX . $this->options_prefix . '_delay_requests' ) !== false);
325
+
326
+ return $is_delay;
327
+ }
328
+ }
trunk/inc/class-sby-rss-connect.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( '-1' );
4
+ }
5
+
6
+ class SBY_RSS_Connect
7
+ {
8
+ /**
9
+ * @var string
10
+ */
11
+ private $url;
12
+
13
+ /**
14
+ * @var object
15
+ */
16
+ private $response;
17
+
18
+ public function __construct( $endpoint = '', $params = array() ) {
19
+ $this->set_url( $endpoint, $params );
20
+ }
21
+
22
+ public function get_data() {
23
+ return $this->response;
24
+ }
25
+
26
+ public function set_url_from_args( $url ) {
27
+ $this->url = $url;
28
+ }
29
+
30
+ public function get_url() {
31
+ return $this->url;
32
+ }
33
+
34
+ public function connect() {
35
+
36
+ if ( ! ini_get( 'allow_url_fopen' ) ) {
37
+ $error_message = '<p><b>'. __( 'Unable to retrieve new videos without an API key.', 'youtube-feed' ) .'</b></p>';
38
+ if ( current_user_can( 'manage_youtube_feed_options' ) ) {
39
+ $error_message .= '<p>' . sprintf( __( 'Due to your server configuration, an API key is required to update your feed. See %sthis FAQ%s to set up an API key.', 'youtube-feed' ), '<a href="https://smashballoon.com/youtube-api-key/" target="_blank" rel="noopener nofollow">', '</a>' ) . '</p>';
40
+ }
41
+ global $sby_posts_manager;
42
+
43
+ $sby_posts_manager->add_frontend_error( 'api', $error_message );
44
+ $sby_posts_manager->add_error( 'api', array( 'Error connecting', $error_message ) );
45
+
46
+ $sby_posts_manager->add_api_request_delay( 300 );
47
+
48
+ return array();
49
+ }
50
+
51
+ if ( wp_remote_retrieve_response_code( wp_remote_get( $this->url ) ) === 404 ) {
52
+ $error_message = '<p><b>'. __( 'Cannot collect videos from this channel. Please make sure this is a valid channel ID.', 'youtube-feed' ) .'</b></p>';
53
+
54
+ global $sby_posts_manager;
55
+
56
+ $sby_posts_manager->add_frontend_error( 'api', $error_message );
57
+ $sby_posts_manager->add_error( 'api', array( 'Error connecting', $error_message ) );
58
+
59
+ $sby_posts_manager->add_api_request_delay( 300 );
60
+
61
+ return array();
62
+ }
63
+
64
+ $parsed_obj = new SimpleXMLElement( $this->url, null, true );
65
+
66
+ $items_array = array();
67
+ if ( isset( $parsed_obj->entry ) ) {
68
+ foreach ( $parsed_obj->entry as $video_xml ) {
69
+
70
+ $this_item_array = array();
71
+
72
+ $high_thumbnail_url = (string) $video_xml->children( 'http://search.yahoo.com/mrss/' )->group->thumbnail->attributes()->url;
73
+
74
+ $this_item_array['snippet'] = array(
75
+ 'publishedAt' => (string) $video_xml->published,
76
+ 'channelId' => (string) $video_xml->children( 'http://www.youtube.com/xml/schemas/2015' )->channelId,
77
+ 'title' => (string) $video_xml->title,
78
+ 'description' => (string) $video_xml->children( 'http://search.yahoo.com/mrss/' )->group->description,
79
+ 'thumbnails' => array(
80
+ 'default' => array(
81
+ 'url' => (string) str_replace( 'hqdefault.jpg', 'default.jpg', $high_thumbnail_url ),
82
+ ),
83
+ 'medium' => array(
84
+ 'url' => str_replace( 'hqdefault.jpg', 'mqdefault.jpg', $high_thumbnail_url ),
85
+ ),
86
+ 'high' => array(
87
+ 'url' => $high_thumbnail_url,
88
+ 'width' => (string) $video_xml->children( 'http://search.yahoo.com/mrss/' )->group->thumbnail->attributes()->width,
89
+ 'height' => (string) $video_xml->children( 'http://search.yahoo.com/mrss/' )->group->thumbnail->attributes()->height,
90
+ ),
91
+ 'standard' => array(
92
+ 'url' => str_replace( 'hqdefault.jpg', 'sddefault.jpg', $high_thumbnail_url ),
93
+ ),
94
+ 'maxres' => array(
95
+ 'url' => str_replace( 'hqdefault.jpg', 'maxresdefault.jpg', $high_thumbnail_url ),
96
+ ),
97
+ ),
98
+ 'channelTitle' => (string) $video_xml->author->name,
99
+ 'resourceId' => array(
100
+ 'videoId' => (string) $video_xml->children( 'http://www.youtube.com/xml/schemas/2015' )->videoId
101
+ ),
102
+ );
103
+ $this_item_array['statistics'] = array(
104
+ 'viewCount' => (int) $video_xml->children( 'http://search.yahoo.com/mrss/' )->group->community->statistics->attributes()->views,
105
+ 'starRating' => (float) $video_xml->children( 'http://search.yahoo.com/mrss/' )->group->community->starRating->attributes()->average,
106
+ );
107
+ $items_array[] = $this_item_array;
108
+
109
+ }
110
+ }
111
+
112
+
113
+ $this->response = $items_array;
114
+
115
+ }
116
+
117
+ protected function set_url( $endpoint_slug, $params ) {
118
+ $url = 'https://www.youtube.com/feeds/videos.xml?channel_id=' . $params['channel_id'];
119
+
120
+ $this->set_url_from_args( $url );
121
+ }
122
+
123
+ }
trunk/inc/class-sby-settings.php ADDED
@@ -0,0 +1,352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ( ! 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
+ if ( empty( $this->connected_accounts ) ) {
87
+ $this->settings['showheader'] = false;
88
+ $this->connected_accounts = array( 'rss_only' => true );
89
+ }
90
+
91
+ $this->settings['nummobile'] = $this->settings['num'];
92
+ $this->settings['minnum'] = $this->settings['num'];
93
+
94
+ $this->after_settings_set();
95
+ }
96
+
97
+ protected function after_settings_set() {
98
+
99
+ }
100
+
101
+ /**
102
+ * @return array
103
+ *
104
+ * @since 1.0
105
+ */
106
+ public function get_settings() {
107
+ return $this->settings;
108
+ }
109
+
110
+ /**
111
+ * The plugin will output settings on the frontend for debugging purposes.
112
+ * Safe settings to display are added here.
113
+ *
114
+ * Overwritten in the Pro version.
115
+ *
116
+ * @return array
117
+ *
118
+ * @since 1.0
119
+ */
120
+ public static function get_public_db_settings_keys() {
121
+ $public = array(
122
+ );
123
+
124
+ return $public;
125
+ }
126
+
127
+ /**
128
+ * @return array
129
+ *
130
+ * @since 1.0
131
+ */
132
+ public function get_connected_accounts() {
133
+ return $this->connected_accounts;
134
+ }
135
+
136
+ /**
137
+ * @return array|bool
138
+ *
139
+ * @since 1.0
140
+ */
141
+ public function get_connected_accounts_in_feed() {
142
+ if ( isset( $this->connected_accounts_in_feed ) ) {
143
+ return $this->connected_accounts_in_feed;
144
+ } else {
145
+ return false;
146
+ }
147
+ }
148
+
149
+ /**
150
+ * @return bool|string
151
+ *
152
+ * @since 1.0
153
+ */
154
+ public function get_transient_name() {
155
+ if ( isset( $this->transient_name ) ) {
156
+ return $this->transient_name;
157
+ } else {
158
+ return false;
159
+ }
160
+ }
161
+
162
+ /**
163
+ * Uses the feed types and terms as well as as some
164
+ * settings to create a semi-unique feed id used for
165
+ * caching and other features.
166
+ *
167
+ * Overwritten in the Pro version.
168
+ *
169
+ * @param string $transient_name
170
+ *
171
+ * @since 1.0
172
+ */
173
+ public function set_transient_name( $transient_name = '' ) {
174
+
175
+ if ( ! empty( $transient_name ) ) {
176
+ $this->transient_name = $transient_name;
177
+ } elseif ( ! empty( $this->settings['feedid'] ) ) {
178
+ $this->transient_name = 'sby_' . $this->settings['feedid'];
179
+ } else {
180
+ $feed_type_and_terms = $this->feed_type_and_terms;
181
+
182
+ $sby_transient_name = 'sby_';
183
+
184
+ if ( isset( $feed_type_and_terms['channels'] ) ) {
185
+ foreach ( $feed_type_and_terms['channels'] as $term_and_params ) {
186
+ $channel = $term_and_params['term'];
187
+ $sby_transient_name .= $channel;
188
+ }
189
+ }
190
+
191
+ $num = $this->settings['num'];
192
+
193
+ $num_length = strlen( $num ) + 1;
194
+
195
+ //Add both parts of the caching string together and make sure it doesn't exceed 45
196
+ $sby_transient_name = substr( $sby_transient_name, 0, 45 - $num_length );
197
+
198
+ $sby_transient_name .= '#' . $num;
199
+
200
+ $this->transient_name = $sby_transient_name;
201
+ }
202
+
203
+ }
204
+
205
+ /**
206
+ * @return array|bool
207
+ *
208
+ * @since 1.0
209
+ */
210
+ public function get_feed_type_and_terms() {
211
+ if ( isset( $this->feed_type_and_terms ) ) {
212
+ return $this->feed_type_and_terms;
213
+ } else {
214
+ return false;
215
+ }
216
+ }
217
+
218
+ /**
219
+ * Based on the settings related to retrieving post data from the API,
220
+ * this setting is used to make sure all endpoints needed for the feed are
221
+ * connected and stored for easily looping through when adding posts
222
+ *
223
+ * Overwritten in the Pro version.
224
+ *
225
+ * @since 1.0
226
+ */
227
+ public function set_feed_type_and_terms() {
228
+ //global $sby_posts_manager;
229
+
230
+ $connected_accounts_in_feed = array();
231
+ $feed_type_and_terms = array(
232
+ 'channels' => array()
233
+ );
234
+
235
+ if ( ! empty( $this->settings['id'] ) ) {
236
+ $channel_array = is_array( $this->settings['id'] ) ? $this->settings['id'] : explode( ',', str_replace( ' ', '', $this->settings['id'] ) );
237
+ foreach ( $channel_array as $channel ) {
238
+ if ( isset( $this->connected_accounts[ $channel ] ) ) {
239
+ $feed_type_and_terms['channels'][] = array(
240
+ 'term' => $this->connected_accounts[ $channel ]['channel_id'],
241
+ 'params' => array(
242
+ 'channel_id' => $this->connected_accounts[ $channel ]['channel_id']
243
+ )
244
+ );
245
+ $connected_accounts_in_feed[ $this->connected_accounts[ $channel ]['channel_id'] ] = $this->connected_accounts[ $channel ];
246
+ }
247
+ }
248
+
249
+ if ( empty( $connected_accounts_in_feed ) ) {
250
+ $an_account = array();
251
+ foreach ( $this->connected_accounts as $account ) {
252
+ if ( empty( $an_account ) ) {
253
+ $an_account = $account;
254
+ }
255
+ }
256
+
257
+ foreach ( $channel_array as $channel ) {
258
+ $feed_type_and_terms['channels'][] = array(
259
+ 'term' => $channel,
260
+ 'params' => array(
261
+ 'channel_id' => $channel
262
+ )
263
+ );
264
+ $connected_accounts_in_feed[ $channel ] = $an_account;
265
+ }
266
+ }
267
+
268
+ } elseif ( ! empty( $this->settings['channel'] ) ) {
269
+ $channel_array = is_array( $this->settings['channel'] ) ? $this->settings['channel'] : explode( ',', str_replace( ' ', '', $this->settings['channel'] ) );
270
+
271
+ $an_account = array();
272
+ foreach ( $this->connected_accounts as $account ) {
273
+ if ( empty( $an_account ) ) {
274
+ $an_account = $account;
275
+ }
276
+ }
277
+
278
+ foreach ( $channel_array as $channel ) {
279
+ if ( strpos( $channel, 'UC' ) !== 0 ) {
280
+ $channel_id = sby_get_channel_id_from_channel_name( $channel );
281
+ if ( $channel_id ) {
282
+ $feed_type_and_terms['channels'][] = array(
283
+ 'term' => $channel_id,
284
+ 'params' => array(
285
+ 'channel_id' => $channel_id
286
+ )
287
+ );
288
+ $connected_accounts_in_feed[ $channel_id ] = $an_account;
289
+ } else {
290
+ $feed_type_and_terms['channels'][] = array(
291
+ 'term' => $channel,
292
+ 'params' => array(
293
+ 'channel_name' => $channel
294
+ )
295
+ );
296
+ $connected_accounts_in_feed[ $channel ] = $an_account;
297
+ }
298
+
299
+ } else {
300
+ $feed_type_and_terms['channels'][] = array(
301
+ 'term' => $channel,
302
+ 'params' => array(
303
+ 'channel_id' => $channel
304
+ )
305
+ );
306
+ $connected_accounts_in_feed[ $channel ] = $an_account;
307
+ }
308
+ }
309
+
310
+ } else {
311
+ foreach ( $this->connected_accounts as $connected_account ) {
312
+ if ( empty( $feed_type_and_terms['channels'] ) ) {
313
+ $feed_type_and_terms['channels'][] = array(
314
+ 'term' => $connected_account['channel_id'],
315
+ 'params' => array(
316
+ 'channel_id' => $connected_account['channel_id']
317
+ )
318
+ );
319
+ $connected_accounts_in_feed[ $connected_account['channel_id'] ] = $connected_account;
320
+ }
321
+
322
+ }
323
+ }
324
+
325
+ $this->connected_accounts_in_feed = $connected_accounts_in_feed;
326
+ $this->feed_type_and_terms = $feed_type_and_terms;
327
+ }
328
+
329
+ /**
330
+ * @return float|int
331
+ *
332
+ * @since 1.0
333
+ */
334
+ public function get_cache_time_in_seconds() {
335
+ if ( $this->db['caching_type'] === 'background' ) {
336
+ return SBY_CRON_UPDATE_CACHE_TIME;
337
+ } else {
338
+ //If the caching time doesn't exist in the database then set it to be 1 hour
339
+ $cache_time = isset( $this->settings['cache_time'] ) ? (int)$this->settings['cache_time'] : 1;
340
+ $cache_time_unit = isset( $this->settings['cache_time_unit'] ) ? $this->settings['cache_time_unit'] : 'hours';
341
+
342
+ //Calculate the cache time in seconds
343
+ if ( $cache_time_unit == 'minutes' ) $cache_time_unit = 60;
344
+ if ( $cache_time_unit == 'hours' ) $cache_time_unit = 60*60;
345
+ if ( $cache_time_unit == 'days' ) $cache_time_unit = 60*60*24;
346
+
347
+ $cache_time = max( 900, $cache_time * $cache_time_unit );
348
+
349
+ return $cache_time;
350
+ }
351
+ }
352
+ }
trunk/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
+ }
trunk/inc/class-sby-wp-post.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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( $status = 'draft' ) {
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' => $status
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 . 'description', SBY_Parse::get_caption( $this->youtube_api_data ) );
52
+ update_post_meta( $this->wp_post_id, $prefix . 'last_updated', date( 'Y-m-d H:i:s' ) );
53
+ update_post_meta( $this->wp_post_id, $prefix . 'thumbnails', SBY_Parse::get_media_src_set( $this->youtube_api_data ) );
54
+ 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 ) ) );
55
+
56
+ if ( class_exists( 'SBY_Parse_Pro' ) ) {
57
+ update_post_meta( $this->wp_post_id, $prefix . 'live_broadcast_content', SBY_Parse_Pro::get_live_broadcast_content( $this->youtube_api_data ) );
58
+ }
59
+
60
+ $post_array = $this->youtube_api_data;
61
+
62
+ array_walk_recursive( $post_array, 'sby_replace_double_quotes' );
63
+
64
+ update_post_meta( $this->wp_post_id, $prefix . 'json', esc_sql( wp_json_encode( $post_array ) ) );
65
+
66
+ return true;
67
+ }
68
+
69
+ public function post_content_description_is_incomplete() {
70
+ $content = get_the_content( '', false, $this->get_wp_post_id() );
71
+
72
+ return (strpos( $content, '<!-- sby:description-incomplete -->' ) !== false);
73
+ }
74
+
75
+ public function update_video_details() {
76
+ if ( empty( $this->youtube_api_data['statistics'] ) ) {
77
+ return false;
78
+ }
79
+
80
+ $post_id = $this->get_wp_post_id();
81
+
82
+ if ( $post_id ) {
83
+ $prefix = 'sby_';
84
+
85
+ if ( class_exists( 'SBY_Parse_Pro' ) ) {
86
+ update_post_meta( $post_id, $prefix . 'comment_count', SBY_Parse_Pro::get_comment_count( $this->youtube_api_data ) );
87
+ update_post_meta( $post_id, $prefix . 'view_count', SBY_Parse_Pro::get_view_count( $this->youtube_api_data ) );
88
+ update_post_meta( $post_id, $prefix . 'like_count', SBY_Parse_Pro::get_like_count( $this->youtube_api_data ) );
89
+ update_post_meta( $post_id, $prefix . 'scheduled_start_time', date( 'Y-m-d H:i:s', SBY_Parse_Pro::get_scheduled_start_timestamp( $this->youtube_api_data ) ) );
90
+ update_post_meta( $post_id, $prefix . 'actual_start_time', date( 'Y-m-d H:i:s', SBY_Parse_Pro::get_actual_start_timestamp( $this->youtube_api_data ) ) );
91
+ update_post_meta( $post_id, $prefix . 'actual_end_time', date( 'Y-m-d H:i:s', SBY_Parse_Pro::get_actual_end_timestamp( $this->youtube_api_data ) ) );
92
+ }
93
+
94
+ update_post_meta( $post_id, $prefix . 'last_details_check_time', date( 'Y-m-d H:i:s' ) );
95
+ $description = SBY_Parse::get_caption( $this->youtube_api_data );
96
+ if ( ! empty( $description ) ) {
97
+ update_post_meta( $post_id, $prefix . 'description', $description );
98
+ if ( $this->post_content_description_is_incomplete() ) {
99
+ $this->update_content();
100
+ }
101
+ }
102
+ return true;
103
+ }
104
+
105
+ return false;
106
+ }
107
+ public function update_content() {
108
+ $my_post = array();
109
+ $my_post['ID'] = $this->get_wp_post_id();
110
+ $my_post['post_content'] = $this->get_post_content( true );
111
+
112
+ wp_update_post( $my_post );
113
+ }
114
+
115
+ public static function maybe_get_channel_id_for_name( $name ) {
116
+
117
+ }
118
+
119
+ public static function maybe_get_channel_id_for_channel_title( $title ) {
120
+ global $wpdb;
121
+
122
+ $channel_id = $wpdb->get_col( $wpdb->prepare( "
123
+ SELECT Max(CASE
124
+ WHEN m.meta_key = 'sby_channel_id' THEN m.meta_value
125
+ ELSE NULL
126
+ END) AS sby_channel_id
127
+ FROM $wpdb->postmeta as m
128
+ WHERE m.post_id IN (SELECT m2.post_id FROM $wpdb->postmeta as m2 WHERE m2.meta_key = 'sby_channel_title' AND m2.meta_value = %s )
129
+ GROUP BY m.post_id
130
+ LIMIT 1", $title ) );
131
+
132
+ if ( isset( $channel_id[0] ) ) {
133
+ return $channel_id[0];
134
+ }
135
+ return false;
136
+ }
137
+
138
+ public function get_wp_post_id() {
139
+ if ( isset( $this->wp_post_id ) ) {
140
+ return $this->wp_post_id;
141
+ }
142
+
143
+ $video_id = SBY_Parse::get_video_id( $this->youtube_api_data );
144
+
145
+ global $wpdb;
146
+ $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 );
147
+
148
+ if ( isset( $results[0] ) ) {
149
+ $this->wp_post_id = $results[0]['post_id'];
150
+
151
+ return $results[0]['post_id'];
152
+ } else {
153
+ return false;
154
+ }
155
+ }
156
+
157
+ protected function get_post_content( $override = false ) {
158
+ $description = SBY_Parse::get_caption( $this->youtube_api_data );
159
+ $flag = '';
160
+ if ( ! $override && substr( $description, -3 ) === '...' ) {
161
+ $flag = '<!-- sby:description-incomplete -->';
162
+ }
163
+
164
+ return '['.SBY_SLUG.'-single]<!-- sby:description-start -->' . wp_kses_post( $description ) . '<!-- sby:description-end -->' . $flag;
165
+ }
166
+ }
trunk/inc/sby-functions.php ADDED
@@ -0,0 +1,868 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ $database_settings = sby_get_database_settings();
8
+ if ( !$database_settings['ajaxtheme'] ) {
9
+ wp_enqueue_script( 'sby_scripts' );
10
+ }
11
+
12
+ if ( $database_settings['enqueue_css_in_shortcode'] ) {
13
+ wp_enqueue_style( 'sby_styles' );
14
+ }
15
+
16
+ $youtube_feed_settings = new SBY_Settings( $atts, $database_settings );
17
+ $youtube_feed_settings->set_feed_type_and_terms();
18
+ $youtube_feed_settings->set_transient_name();
19
+ $transient_name = $youtube_feed_settings->get_transient_name();
20
+ $settings = $youtube_feed_settings->get_settings();
21
+ $feed_type_and_terms = $youtube_feed_settings->get_feed_type_and_terms();
22
+
23
+ if ( empty( $database_settings['connected_accounts'] )
24
+ && empty( $database_settings['api_key'] )
25
+ && ! isset( $feed_type_and_terms['channels'][0]['channel_id'] ) ) {
26
+ $style = current_user_can( 'manage_youtube_feed_options' ) ? ' style="display: block;"' : '';
27
+ ob_start(); ?>
28
+ <div id="sbi_mod_error" <?php echo $style; ?>>
29
+ <span><?php _e('This error message is only visible to WordPress admins', 'feeds-for-youtube' ); ?></span><br />
30
+ <p><b><?php _e( 'Error: No connected account or API key.', 'feeds-for-youtube' ); ?></b>
31
+ <p><?php _e( 'Please go to the YouTube Feed settings page to enter an API key or connect an account.', 'youtube-feed' ); ?></p>
32
+ </div>
33
+ <?php
34
+ $html = ob_get_contents();
35
+ ob_get_clean();
36
+ return $html;
37
+ }
38
+
39
+ $youtube_feed = new SBY_Feed( $transient_name );
40
+
41
+ if ( $database_settings['caching_type'] === 'background' ) {
42
+ $youtube_feed->add_report( 'background caching used' );
43
+ if ( $youtube_feed->regular_cache_exists() ) {
44
+ $youtube_feed->add_report( 'setting posts from cache' );
45
+ $youtube_feed->set_post_data_from_cache();
46
+ }
47
+
48
+ if ( $youtube_feed->need_to_start_cron_job() ) {
49
+ $youtube_feed->add_report( 'setting up feed for cron cache' );
50
+ $to_cache = array(
51
+ 'atts' => $atts,
52
+ 'last_requested' => time(),
53
+ );
54
+
55
+ $youtube_feed->set_cron_cache( $to_cache, $youtube_feed_settings->get_cache_time_in_seconds() );
56
+
57
+ SBY_Cron_Updater::do_single_feed_cron_update( $youtube_feed_settings, $to_cache, $atts, false );
58
+
59
+ $youtube_feed->set_post_data_from_cache();
60
+
61
+ } elseif ( $youtube_feed->should_update_last_requested() ) {
62
+ $youtube_feed->add_report( 'updating last requested' );
63
+ $to_cache = array(
64
+ 'last_requested' => time(),
65
+ );
66
+
67
+ $youtube_feed->set_cron_cache( $to_cache, $youtube_feed_settings->get_cache_time_in_seconds() );
68
+ }
69
+
70
+ } elseif ( $youtube_feed->regular_cache_exists() ) {
71
+ $youtube_feed->add_report( 'page load caching used and regular cache exists' );
72
+ $youtube_feed->set_post_data_from_cache();
73
+
74
+ if ( $youtube_feed->need_posts( $settings['num'] ) && $youtube_feed->can_get_more_posts() ) {
75
+ while ( $youtube_feed->need_posts( $settings['num'] ) && $youtube_feed->can_get_more_posts() ) {
76
+ $youtube_feed->add_remote_posts( $settings, $feed_type_and_terms, $youtube_feed_settings->get_connected_accounts_in_feed() );
77
+ }
78
+ $youtube_feed->cache_feed_data( $youtube_feed_settings->get_cache_time_in_seconds() );
79
+ }
80
+
81
+ } else {
82
+ $youtube_feed->add_report( 'no feed cache found' );
83
+
84
+ while ( $youtube_feed->need_posts( $settings['num'] ) && $youtube_feed->can_get_more_posts() ) {
85
+ $youtube_feed->add_remote_posts( $settings, $feed_type_and_terms, $youtube_feed_settings->get_connected_accounts_in_feed() );
86
+ }
87
+
88
+ if ( ! $youtube_feed->should_use_backup() ) {
89
+ $youtube_feed->cache_feed_data( $youtube_feed_settings->get_cache_time_in_seconds() );
90
+ }
91
+
92
+ }
93
+
94
+ if ( $youtube_feed->should_use_backup() ) {
95
+ $youtube_feed->add_report( 'trying to use backup' );
96
+ $youtube_feed->maybe_set_post_data_from_backup();
97
+ $youtube_feed->maybe_set_header_data_from_backup();
98
+ }
99
+
100
+ // if need a header
101
+ if ( $youtube_feed->need_header( $settings, $feed_type_and_terms ) && ! $youtube_feed->should_use_backup() ) {
102
+ if ( $database_settings['caching_type'] === 'background' ) {
103
+ $youtube_feed->add_report( 'background header caching used' );
104
+ $youtube_feed->set_header_data_from_cache();
105
+ } elseif ( $youtube_feed->regular_header_cache_exists() ) {
106
+ // set_post_data_from_cache
107
+ $youtube_feed->add_report( 'page load caching used and regular header cache exists' );
108
+ $youtube_feed->set_header_data_from_cache();
109
+ } else {
110
+ $youtube_feed->add_report( 'no header cache exists' );
111
+ $youtube_feed->set_remote_header_data( $settings, $feed_type_and_terms, $youtube_feed_settings->get_connected_accounts_in_feed() );
112
+
113
+ $youtube_feed->cache_header_data( $youtube_feed_settings->get_cache_time_in_seconds(), $settings['backup_cache_enabled'] );
114
+ }
115
+ } else {
116
+ $youtube_feed->add_report( 'no header needed' );
117
+ }
118
+
119
+ 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() );
120
+ }
121
+
122
+ /**
123
+ * Outputs an organized error report for the front end.
124
+ * This hooks into the end of the feed before the closing div
125
+ *
126
+ * @param object $youtube_feed
127
+ * @param string $feed_id
128
+ */
129
+ function sby_error_report( $youtube_feed, $feed_id ) {
130
+ global $sby_posts_manager;
131
+
132
+ $style = current_user_can( 'manage_youtube_feed_options' ) ? ' style="display: block;"' : '';
133
+
134
+ $error_messages = $sby_posts_manager->get_frontend_errors();
135
+ if ( ! empty( $error_messages ) ) {?>
136
+ <div id="sby_mod_error"<?php echo $style; ?>>
137
+ <span><?php _e('This error message is only visible to WordPress admins', SBY_TEXT_DOMAIN ); ?></span><br />
138
+ <?php foreach ( $error_messages as $error_message ) {
139
+ echo $error_message;
140
+ } ?>
141
+ </div>
142
+ <?php
143
+ }
144
+
145
+ $sby_posts_manager->reset_frontend_errors();
146
+ }
147
+ add_action( 'sby_before_feed_end', 'sby_error_report', 10, 2 );
148
+
149
+ /**
150
+ * Called after the load more button is clicked using admin-ajax.php
151
+ */
152
+ function sby_get_next_post_set() {
153
+ if ( ! isset( $_POST['feed_id'] ) || strpos( $_POST['feed_id'], 'sby' ) === false ) {
154
+ die( 'invalid feed ID');
155
+ }
156
+
157
+ $feed_id = sanitize_text_field( $_POST['feed_id'] );
158
+ $atts_raw = isset( $_POST['atts'] ) ? json_decode( stripslashes( $_POST['atts'] ), true ) : array();
159
+ if ( is_array( $atts_raw ) ) {
160
+ array_map( 'sanitize_text_field', $atts_raw );
161
+ } else {
162
+ $atts_raw = array();
163
+ }
164
+ $atts = $atts_raw; // now sanitized
165
+
166
+ $offset = isset( $_POST['offset'] ) ? (int)$_POST['offset'] : 0;
167
+
168
+ $database_settings = sby_get_database_settings();
169
+ $youtube_feed_settings = new SBY_Settings( $atts, $database_settings );
170
+
171
+ if ( empty( $database_settings['connected_accounts'] ) && empty( $database_settings['api_key'] ) ) {
172
+ die( 'error no connected account' );
173
+ }
174
+
175
+ $youtube_feed_settings->set_feed_type_and_terms();
176
+ $youtube_feed_settings->set_transient_name( $feed_id );
177
+ $transient_name = $youtube_feed_settings->get_transient_name();
178
+
179
+ if ( $transient_name !== $feed_id ) {
180
+ die( 'id does not match' );
181
+ }
182
+
183
+ $settings = $youtube_feed_settings->get_settings();
184
+
185
+ $feed_type_and_terms = $youtube_feed_settings->get_feed_type_and_terms();
186
+
187
+ $youtube_feed = new SBY_Feed( $transient_name );
188
+
189
+ if ( $settings['caching_type'] === 'permanent' && empty( $settings['doingModerationMode'] ) ) {
190
+ $youtube_feed->add_report( 'trying to use permanent cache' );
191
+ $youtube_feed->maybe_set_post_data_from_backup();
192
+ } elseif ( $settings['caching_type'] === 'background' ) {
193
+ $youtube_feed->add_report( 'background caching used' );
194
+ if ( $youtube_feed->regular_cache_exists() ) {
195
+ $youtube_feed->add_report( 'setting posts from cache' );
196
+ $youtube_feed->set_post_data_from_cache();
197
+ }
198
+
199
+ if ( $youtube_feed->need_posts( $settings['num'], $offset ) && $youtube_feed->can_get_more_posts() ) {
200
+ while ( $youtube_feed->need_posts( $settings['num'], $offset ) && $youtube_feed->can_get_more_posts() ) {
201
+ $youtube_feed->add_remote_posts( $settings, $feed_type_and_terms, $youtube_feed_settings->get_connected_accounts_in_feed() );
202
+ }
203
+
204
+ if ( $youtube_feed->need_to_start_cron_job() ) {
205
+ $youtube_feed->add_report( 'needed to start cron job' );
206
+ $to_cache = array(
207
+ 'atts' => $atts,
208
+ 'last_requested' => time(),
209
+ );
210
+
211
+ $youtube_feed->set_cron_cache( $to_cache, $youtube_feed_settings->get_cache_time_in_seconds() );
212
+
213
+ } else {
214
+ $youtube_feed->add_report( 'updating last requested and adding to cache' );
215
+ $to_cache = array(
216
+ 'last_requested' => time(),
217
+ );
218
+
219
+ $youtube_feed->set_cron_cache( $to_cache, $youtube_feed_settings->get_cache_time_in_seconds(), $settings['backup_cache_enabled'] );
220
+ }
221
+ }
222
+
223
+ } elseif ( $youtube_feed->regular_cache_exists() ) {
224
+ $youtube_feed->add_report( 'regular cache exists' );
225
+ $youtube_feed->set_post_data_from_cache();
226
+
227
+ if ( $youtube_feed->need_posts( $settings['num'], $offset ) && $youtube_feed->can_get_more_posts() ) {
228
+ while ( $youtube_feed->need_posts( $settings['num'], $offset ) && $youtube_feed->can_get_more_posts() ) {
229
+ $youtube_feed->add_remote_posts( $settings, $feed_type_and_terms, $youtube_feed_settings->get_connected_accounts_in_feed() );
230
+ }
231
+
232
+ $youtube_feed->add_report( 'adding to cache' );
233
+ $youtube_feed->cache_feed_data( $youtube_feed_settings->get_cache_time_in_seconds(), $settings['backup_cache_enabled'] );
234
+ }
235
+
236
+
237
+ } else {
238
+ $youtube_feed->add_report( 'no feed cache found' );
239
+
240
+ while ( $youtube_feed->need_posts( $settings['num'], $offset ) && $youtube_feed->can_get_more_posts() ) {
241
+ $youtube_feed->add_remote_posts( $settings, $feed_type_and_terms, $youtube_feed_settings->get_connected_accounts_in_feed() );
242
+ }
243
+
244
+ if ( $youtube_feed->should_use_backup() ) {
245
+ $youtube_feed->add_report( 'trying to use a backup cache' );
246
+ $youtube_feed->maybe_set_post_data_from_backup();
247
+ } else {
248
+ $youtube_feed->add_report( 'transient gone, adding to cache' );
249
+ $youtube_feed->cache_feed_data( $youtube_feed_settings->get_cache_time_in_seconds(), $settings['backup_cache_enabled'] );
250
+ }
251
+ }
252
+
253
+ $feed_status = array( 'shouldPaginate' => $youtube_feed->should_use_pagination( $settings, $offset ), );
254
+
255
+ $feed_status['cacheAll'] = $youtube_feed->do_page_cache_all();
256
+
257
+ $post_data = $youtube_feed->get_post_data();
258
+
259
+ if ( $youtube_feed->successful_video_api_request_made() && ! empty( $post_data ) ) {
260
+ if ( $settings['storage_process'] === 'page' ) {
261
+ foreach ( $youtube_feed->get_post_data() as $post ) {
262
+ $wp_post = new SBY_WP_Post( $post, $this->regular_feed_transient_name );
263
+ $wp_post->update_post();
264
+ }
265
+ } elseif ( $settings['storage_process'] === 'background' ) {
266
+ $feed_status['checkWPPosts'] = true;
267
+ $feed_status['cacheAll'] = true;
268
+ }
269
+ }
270
+
271
+ /*if ( $settings['disable_js_image_loading'] || $settings['imageres'] !== 'auto' ) {
272
+ global $sby_posts_manager;
273
+ $post_data = array_slice( $youtube_feed->get_post_data(), $offset, $settings['minnum'] );
274
+
275
+ if ( ! $sby_posts_manager->image_resizing_disabled() ) {
276
+ $image_ids = array();
277
+ foreach ( $post_data as $post ) {
278
+ $image_ids[] = SBY_Parse::get_post_id( $post );
279
+ }
280
+ $resized_images = SBY_Feed::get_resized_images_source_set( $image_ids, 0, $feed_id );
281
+
282
+ $youtube_feed->set_resized_images( $resized_images );
283
+ }
284
+ }*/
285
+
286
+ $return = array(
287
+ '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() ),
288
+ 'feedStatus' => $feed_status,
289
+ 'report' => $youtube_feed->get_report(),
290
+ 'resizedImages' => array()
291
+ //'resizedImages' => SBY_Feed::get_resized_images_source_set( $youtube_feed->get_image_ids_post_set(), 0, $feed_id )
292
+ );
293
+
294
+ //SBY_Feed::update_last_requested( $youtube_feed->get_image_ids_post_set() );
295
+
296
+ echo wp_json_encode( $return );
297
+
298
+ global $sby_posts_manager;
299
+
300
+ $sby_posts_manager->update_successful_ajax_test();
301
+
302
+ die();
303
+ }
304
+ add_action( 'wp_ajax_sby_load_more_clicked', 'sby_get_next_post_set' );
305
+ add_action( 'wp_ajax_nopriv_sby_load_more_clicked', 'sby_get_next_post_set' );
306
+
307
+ /**
308
+ * Posts that need resized images are processed after being sent to the server
309
+ * using AJAX
310
+ *
311
+ * @return string
312
+ */
313
+ function sby_process_wp_posts() {
314
+ if ( ! isset( $_POST['feed_id'] ) || strpos( $_POST['feed_id'], 'sby' ) === false ) {
315
+ die( 'invalid feed ID');
316
+ }
317
+
318
+ $feed_id = sanitize_text_field( $_POST['feed_id'] );
319
+
320
+ $atts_raw = isset( $_POST['atts'] ) ? json_decode( stripslashes( $_POST['atts'] ), true ) : array();
321
+ if ( is_array( $atts_raw ) ) {
322
+ array_map( 'sanitize_text_field', $atts_raw );
323
+ } else {
324
+ $atts_raw = array();
325
+ }
326
+ $atts = $atts_raw; // now sanitized
327
+
328
+ $offset = isset( $_POST['offset'] ) ? (int)$_POST['offset'] : 0;
329
+
330
+ $cache_all = isset( $_POST['cache_all'] ) ? $_POST['cache_all'] === 'true' : false;
331
+
332
+ if ( $cache_all ) {
333
+ $database_settings = sby_get_database_settings();
334
+ $youtube_feed_settings = new SBY_Settings( $atts, $database_settings );
335
+ $youtube_feed_settings->set_feed_type_and_terms();
336
+ $youtube_feed_settings->set_transient_name( $feed_id );
337
+ $transient_name = $youtube_feed_settings->get_transient_name();
338
+
339
+ $feed_id = $transient_name;
340
+ }
341
+
342
+ $database_settings = sby_get_database_settings();
343
+ $sby_settings = new SBY_Settings( $atts, $database_settings );
344
+
345
+ $settings = $sby_settings->get_settings();
346
+
347
+ $youtube_feed = new SBY_Feed( $feed_id );
348
+ if ( $youtube_feed->regular_cache_exists() ) {
349
+ $youtube_feed->set_post_data_from_cache();
350
+
351
+ if ( !$cache_all ) {
352
+ $posts = array_slice( $youtube_feed->get_post_data(), max( 0, $offset - $settings['minnum'] ), $settings['minnum'] );
353
+ } else {
354
+ $posts = $youtube_feed->get_post_data();
355
+ }
356
+
357
+ foreach ( $posts as $post ) {
358
+ $wp_post = new SBY_WP_Post( $post, $feed_id );
359
+ $wp_post->update_post();
360
+ }
361
+ }
362
+
363
+
364
+
365
+ //global $sby_posts_manager;
366
+
367
+ //$sby_posts_manager->update_successful_ajax_test();
368
+ if ( $cache_all ) {
369
+ die( 'cache all' );
370
+ }
371
+ die( 'check success' );
372
+ }
373
+ add_action( 'wp_ajax_sby_check_wp_submit', 'sby_process_wp_posts' );
374
+ add_action( 'wp_ajax_nopriv_sby_check_wp_submit', 'sby_process_wp_posts' );
375
+
376
+ function sby_process_post_set_caching( $posts, $feed_id ) {
377
+
378
+ // if is an array of video ids already, don't need to get them
379
+ if ( isset( $posts[0] ) && SBY_Parse::get_video_id( $posts[0] ) === '' ) {
380
+ $vid_ids = $posts;
381
+ } else {
382
+ $vid_ids = array();
383
+ foreach ( $posts as $post ) {
384
+ $vid_ids[] = SBY_Parse::get_video_id( $post );
385
+ $wp_post = new SBY_WP_Post( $post, $feed_id );
386
+ $sby_video_settings = SBY_CPT::get_sby_cpt_settings();
387
+ $wp_post->update_post( $sby_video_settings['post_status'] );
388
+ }
389
+ }
390
+
391
+ return array();
392
+ }
393
+
394
+ function sby_debug_report( $youtube_feed, $feed_id ) {
395
+
396
+ if ( ! isset( $_GET['sby_debug'] ) ) {
397
+ return;
398
+ }
399
+
400
+ ?>
401
+ <p>Status</p>
402
+ <ul>
403
+ <li>Time: <?php echo date( "Y-m-d H:i:s", time() ); ?></li>
404
+ <?php foreach ( $youtube_feed->get_report() as $item ) : ?>
405
+ <li><?php echo esc_html( $item ); ?></li>
406
+ <?php endforeach; ?>
407
+
408
+ </ul>
409
+
410
+ <?php
411
+ $database_settings = sby_get_database_settings();
412
+
413
+ $public_settings_keys = SBY_Settings::get_public_db_settings_keys();
414
+ ?>
415
+ <p>Settings</p>
416
+ <ul>
417
+ <?php foreach ( $public_settings_keys as $key ) : if ( isset( $database_settings[ $key ] ) ) : ?>
418
+ <li>
419
+ <small><?php echo esc_html( $key ); ?>:</small>
420
+ <?php if ( ! is_array( $database_settings[ $key ] ) ) :
421
+ echo $database_settings[ $key ];
422
+ else : ?>
423
+ <pre>
424
+ <?php var_export( $database_settings[ $key ] ); ?>
425
+ </pre>
426
+ <?php endif; ?>
427
+ </li>
428
+
429
+ <?php endif; endforeach; ?>
430
+ </ul>
431
+ <?php
432
+ }
433
+ add_action( 'sby_before_feed_end', 'sby_debug_report', 11, 2 );
434
+
435
+ function sby_clear_cache() {
436
+ //Delete all transients
437
+ global $wpdb;
438
+ $table_name = $wpdb->prefix . "options";
439
+ $wpdb->query( "
440
+ DELETE
441
+ FROM $table_name
442
+ WHERE `option_name` LIKE ('%\_transient\_sby\_%')
443
+ " );
444
+ $wpdb->query( "
445
+ DELETE
446
+ FROM $table_name
447
+ WHERE `option_name` LIKE ('%\_transient\_timeout\_sby\_%')
448
+ " );
449
+ $wpdb->query( "
450
+ DELETE
451
+ FROM $table_name
452
+ WHERE `option_name` LIKE ('%\_transient\_&sby\_%')
453
+ " );
454
+ $wpdb->query( "
455
+ DELETE
456
+ FROM $table_name
457
+ WHERE `option_name` LIKE ('%\_transient\_timeout\_&sby\_%')
458
+ " );
459
+ $wpdb->query( "
460
+ DELETE
461
+ FROM $table_name
462
+ WHERE `option_name` LIKE ('%\_transient\_\$sby\_%')
463
+ " );
464
+ $wpdb->query( "
465
+ DELETE
466
+ FROM $table_name
467
+ WHERE `option_name` LIKE ('%\_transient\_timeout\_\$sby\_%')
468
+ " );
469
+
470
+ sby_clear_page_caches();
471
+ }
472
+ add_action( 'sby_settings_after_configure_save', 'sby_clear_cache' );
473
+
474
+ function sby_maybe_clear_cache_using_cron() {
475
+ global $sby_settings;
476
+ $sby_doing_cron_clear = isset( $sby_settings['cronclear'] ) ? $sby_settings['cronclear'] : false;
477
+
478
+ if ( $sby_doing_cron_clear ) {
479
+ sby_clear_cache();
480
+ }
481
+ }
482
+ add_action( 'sby_cron_job', 'sby_maybe_clear_cache_using_cron' );
483
+
484
+ /**
485
+ * When certain events occur, page caches need to
486
+ * clear or errors occur or changes will not be seen
487
+ */
488
+ function sby_clear_page_caches() {
489
+ if ( isset( $GLOBALS['wp_fastest_cache'] ) && method_exists( $GLOBALS['wp_fastest_cache'], 'deleteCache' ) ){
490
+ /* Clear WP fastest cache*/
491
+ $GLOBALS['wp_fastest_cache']->deleteCache();
492
+ }
493
+
494
+ if ( function_exists( 'wp_cache_clear_cache' ) ) {
495
+ wp_cache_clear_cache();
496
+ }
497
+
498
+ if ( class_exists('W3_Plugin_TotalCacheAdmin') ) {
499
+ $plugin_totalcacheadmin = & w3_instance('W3_Plugin_TotalCacheAdmin');
500
+
501
+ $plugin_totalcacheadmin->flush_all();
502
+ }
503
+
504
+ if ( function_exists( 'rocket_clean_domain' ) ) {
505
+ rocket_clean_domain();
506
+ }
507
+
508
+ if ( class_exists( 'autoptimizeCache' ) ) {
509
+ /* Clear autoptimize */
510
+ autoptimizeCache::clearall();
511
+ }
512
+ }
513
+
514
+ /**
515
+ * Triggered by a cron event to update feeds
516
+ */
517
+ function sby_cron_updater() {
518
+ global $sby_settings;
519
+
520
+ if ( $sby_settings['caching_type'] === 'background' ) {
521
+ SBY_Cron_Updater::do_feed_updates();
522
+ }
523
+
524
+ }
525
+ add_action( 'sby_feed_update', 'sby_cron_updater' );
526
+
527
+ function sby_update_or_connect_account( $args ) {
528
+ global $sby_settings;
529
+ $account_id = $args['channel_id'];
530
+ $sby_settings['connected_accounts'][ $account_id ] = array(
531
+ 'access_token' => $args['access_token'],
532
+ 'refresh_token' => $args['refresh_token'],
533
+ 'channel_id' => $args['channel_id'],
534
+ 'username' => $args['username'],
535
+ 'is_valid' => true,
536
+ 'last_checked' => time(),
537
+ 'profile_picture' => $args['profile_picture'],
538
+ 'privacy' => $args['privacy'],
539
+ 'expires' => $args['expires']
540
+ );
541
+
542
+ update_option( 'sby_settings', $sby_settings );
543
+
544
+ return $sby_settings['connected_accounts'][ $account_id ];
545
+ }
546
+
547
+ function sby_get_first_connected_account() {
548
+ global $sby_settings;
549
+ $an_account = array();
550
+
551
+ if ( ! empty( $sby_settings['api_key'] ) ) {
552
+ $an_account = array(
553
+ 'access_token' => '',
554
+ 'refresh_token' => '',
555
+ 'channel_id' => '',
556
+ 'username' => '',
557
+ 'is_valid' => true,
558
+ 'last_checked' => '',
559
+ 'profile_picture' => '',
560
+ 'privacy' => '',
561
+ 'expires' => '2574196927',
562
+ 'api_key' => $sby_settings['api_key']
563
+ );
564
+ } else {
565
+ $connected_accounts = $sby_settings['connected_accounts'];
566
+ foreach ( $connected_accounts as $account ) {
567
+ if ( empty( $an_account ) ) {
568
+ $an_account = $account;
569
+ }
570
+ }
571
+ }
572
+
573
+ if ( empty( $an_account ) ) {
574
+ $an_account = array( 'rss_only' => true );
575
+ }
576
+
577
+ return $an_account;
578
+ }
579
+
580
+ function sby_get_feed_template_part( $part, $settings = array() ) {
581
+ $file = '';
582
+
583
+ $using_custom_templates_in_theme = apply_filters( 'sby_use_theme_templates', $settings['customtemplates'] );
584
+ $generic_path = trailingslashit( SBY_PLUGIN_DIR ) . 'templates/';
585
+
586
+ if ( $using_custom_templates_in_theme ) {
587
+ $custom_header_template = locate_template( 'sby/header.php', false, false );
588
+ $custom_player_template = locate_template( 'sby/player.php', false, false );
589
+ $custom_item_template = locate_template( 'sby/item.php', false, false );
590
+ $custom_footer_template = locate_template( 'sby/footer.php', false, false );
591
+ $custom_feed_template = locate_template( 'sby/feed.php', false, false );
592
+ } else {
593
+ $custom_header_template = false;
594
+ $custom_player_template = false;
595
+ $custom_item_template = false;
596
+ $custom_footer_template = false;
597
+ $custom_feed_template = false;
598
+ }
599
+
600
+ if ( $part === 'header' ) {
601
+ if ( $custom_header_template ) {
602
+ $file = $custom_header_template;
603
+ } else {
604
+ $file = $generic_path . 'header.php';
605
+ }
606
+ } elseif ( $part === 'player' ) {
607
+ if ( $custom_player_template ) {
608
+ $file = $custom_player_template;
609
+ } else {
610
+ $file = $generic_path . 'player.php';
611
+ }
612
+ } elseif ( $part === 'item' ) {
613
+ if ( $custom_item_template ) {
614
+ $file = $custom_item_template;
615
+ } else {
616
+ $file = $generic_path . 'item.php';
617
+ }
618
+ } elseif ( $part === 'footer' ) {
619
+ if ( $custom_footer_template ) {
620
+ $file = $custom_footer_template;
621
+ } else {
622
+ $file = $generic_path . 'footer.php';
623
+ }
624
+ } elseif ( $part === 'feed' ) {
625
+ if ( $custom_feed_template ) {
626
+ $file = $custom_feed_template;
627
+ } else {
628
+ $file = $generic_path . 'feed.php';
629
+ }
630
+ }
631
+
632
+ return $file;
633
+ }
634
+
635
+ /**
636
+ * Get the settings in the database with defaults
637
+ *
638
+ * @return array
639
+ */
640
+ function sby_get_database_settings() {
641
+ global $sby_settings;
642
+
643
+ $defaults = sby_settings_defaults();
644
+
645
+ return array_merge( $defaults, $sby_settings );
646
+ }
647
+
648
+
649
+ function sby_get_channel_id_from_channel_name( $channel_name ) {
650
+ $channel_ids = get_option( 'sby_channel_ids', array() );
651
+
652
+ if ( isset( $channel_ids[ strtolower( $channel_name ) ] ) ) {
653
+ return $channel_ids[ strtolower( $channel_name ) ];
654
+ }
655
+
656
+ return false;
657
+ }
658
+
659
+ function sby_set_channel_id_from_channel_name( $channel_name, $channel_id ) {
660
+ $channel_ids = get_option( 'sby_channel_ids', array() );
661
+
662
+ $channel_ids[ strtolower( $channel_name ) ] = $channel_id;
663
+
664
+ update_option( 'sby_channel_ids', $channel_ids, false );
665
+ }
666
+
667
+ function sby_icon( $icon, $class = '' ) {
668
+ $class = ! empty( $class ) ? ' ' . trim( $class ) : '';
669
+ if ( $icon === SBY_SLUG ) {
670
+ 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>';
671
+ } else {
672
+ return '<i aria-hidden="true" role="img" class="fab fa-youtube"></i>';
673
+ }
674
+ }
675
+
676
+
677
+ /**
678
+ * @param $a
679
+ * @param $b
680
+ *
681
+ * @return false|int
682
+ */
683
+ function sby_date_sort( $a, $b ) {
684
+ $time_stamp_a = SBY_Parse::get_timestamp( $a );
685
+ $time_stamp_b = SBY_Parse::get_timestamp( $b );
686
+
687
+ if ( isset( $time_stamp_a ) ) {
688
+ return $time_stamp_b - $time_stamp_a;
689
+ } else {
690
+ return rand ( -1, 1 );
691
+ }
692
+ }
693
+
694
+ /**
695
+ * @param $a
696
+ * @param $b
697
+ *
698
+ * @return false|int
699
+ */
700
+ function sby_rand_sort( $a, $b ) {
701
+ return rand ( -1, 1 );
702
+ }
703
+
704
+ /**
705
+ * Converts a hex code to RGB so opacity can be
706
+ * applied more easily
707
+ *
708
+ * @param $hex
709
+ *
710
+ * @return string
711
+ */
712
+ function sby_hextorgb( $hex ) {
713
+ // allows someone to use rgb in shortcode
714
+ if ( strpos( $hex, ',' ) !== false ) {
715
+ return $hex;
716
+ }
717
+
718
+ $hex = str_replace( '#', '', $hex );
719
+
720
+ if ( strlen( $hex ) === 3 ) {
721
+ $r = hexdec( substr( $hex,0,1 ).substr( $hex,0,1 ) );
722
+ $g = hexdec( substr( $hex,1,1 ).substr( $hex,1,1 ) );
723
+ $b = hexdec( substr( $hex,2,1 ).substr( $hex,2,1 ) );
724
+ } else {
725
+ $r = hexdec( substr( $hex,0,2 ) );
726
+ $g = hexdec( substr( $hex,2,2 ) );
727
+ $b = hexdec( substr( $hex,4,2 ) );
728
+ }
729
+ $rgb = array( $r, $g, $b );
730
+
731
+ return implode( ',', $rgb ); // returns the rgb values separated by commas
732
+ }
733
+
734
+ function sby_get_utc_offset() {
735
+ return get_option( 'gmt_offset', 0 ) * HOUR_IN_SECONDS;
736
+ }
737
+
738
+ function sby_is_pro_version() {
739
+ return defined( 'SBY_PLUGIN_EDD_NAME' );
740
+ }
741
+
742
+ function sby_strip_after_hash( $string ) {
743
+ $string_array = explode( '#', $string );
744
+ $finished_string = $string_array[0];
745
+
746
+ return $finished_string;
747
+ }
748
+
749
+ function sby_get_account_bottom() {
750
+ return '';
751
+ }
752
+
753
+ function sby_get_account_top() {
754
+ return '';
755
+ }
756
+
757
+ function sby_replace_double_quotes( &$element, $index ) {
758
+ $element = str_replace( '"', "&quot;", $element );
759
+ }
760
+
761
+ /**
762
+ * Adds the ajax url and custom JavaScript to the page
763
+ */
764
+ function sby_custom_js() {
765
+ global $sby_settings;
766
+
767
+ $js = isset( $sby_settings['custom_js'] ) ? trim( $sby_settings['custom_js'] ) : '';
768
+
769
+ echo '<!-- YouTube Feed JS -->';
770
+ echo "\r\n";
771
+ echo '<script type="text/javascript">';
772
+ echo "\r\n";
773
+
774
+ if ( ! empty( $js ) ) {
775
+ echo "\r\n";
776
+ echo "jQuery( document ).ready(function($) {";
777
+ echo "\r\n";
778
+ echo "window.sbyCustomJS = function(){";
779
+ echo "\r\n";
780
+ echo stripslashes($js);
781
+ echo "\r\n";
782
+ echo "}";
783
+ echo "\r\n";
784
+ echo "});";
785
+ }
786
+
787
+ echo "\r\n";
788
+ echo '</script>';
789
+ echo "\r\n";
790
+ }
791
+ add_action( 'wp_footer', 'sby_custom_js' );
792
+
793
+ //Custom CSS
794
+ add_action( 'wp_head', 'sby_custom_css' );
795
+ function sby_custom_css() {
796
+ global $sby_settings;
797
+
798
+ $css = isset( $sby_settings['custom_css'] ) ? trim( $sby_settings['custom_css'] ) : '';
799
+
800
+ //Show CSS if an admin (so can see Hide Photos link), if including Custom CSS or if hiding some photos
801
+ if ( current_user_can( 'manage_youtube_feed_options' ) || current_user_can( 'manage_options' ) || ! empty( $css ) ) {
802
+
803
+ echo '<!-- Instagram Feed CSS -->';
804
+ echo "\r\n";
805
+ echo '<style type="text/css">';
806
+
807
+ if ( ! empty( $css ) ){
808
+ echo "\r\n";
809
+ echo stripslashes($css);
810
+ }
811
+
812
+ if ( current_user_can( 'manage_youtube_feed_options' ) || current_user_can( 'manage_options' ) ){
813
+ echo "\r\n";
814
+ echo "#sby_mod_link, #sby_mod_error{ display: block !important; width: 100%; float: left; box-sizing: border-box; }";
815
+ }
816
+
817
+ echo "\r\n";
818
+ echo '</style>';
819
+ echo "\r\n";
820
+ }
821
+
822
+ }
823
+
824
+ /**
825
+ * Makes the JavaScript file available and enqueues the stylesheet
826
+ * for the plugin
827
+ */
828
+ function sby_scripts_enqueue( $enqueue = false ) {
829
+ //Register the script to make it available
830
+
831
+ //Options to pass to JS file
832
+ global $sby_settings;
833
+
834
+ $js_file = 'js/sb-youtube.min.js';
835
+ if ( isset( $_GET['sby_debug'] ) ) {
836
+ $js_file = 'js/sb-youtube.js';
837
+ }
838
+
839
+ if ( isset( $sby_settings['enqueue_js_in_head'] ) && $sby_settings['enqueue_js_in_head'] ) {
840
+ wp_enqueue_script( 'sby_scripts', trailingslashit( SBY_PLUGIN_URL ) . $js_file, array('jquery'), SBYVER, false );
841
+ } else {
842
+ wp_register_script( 'sby_scripts', trailingslashit( SBY_PLUGIN_URL ) . $js_file, array('jquery'), SBYVER, true );
843
+ }
844
+
845
+ if ( isset( $sby_settings['enqueue_css_in_shortcode'] ) && $sby_settings['enqueue_css_in_shortcode'] ) {
846
+ wp_register_style( 'sby_styles', trailingslashit( SBY_PLUGIN_URL ) . 'css/sb-youtube.min.css', array(), SBYVER );
847
+ } else {
848
+ wp_enqueue_style( 'sby_styles', trailingslashit( SBY_PLUGIN_URL ) . 'css/sb-youtube.min.css', array(), SBYVER );
849
+ }
850
+ $data = array(
851
+ 'adminAjaxUrl' => admin_url( 'admin-ajax.php' ),
852
+ 'placeholder' => trailingslashit( SBY_PLUGIN_URL ) . 'img/placeholder.png',
853
+ 'placeholderNarrow' => trailingslashit( SBY_PLUGIN_URL ) . 'img/placeholder-narrow.png',
854
+ 'lightboxPlaceholder' => trailingslashit( SBY_PLUGIN_URL ) . 'img/lightbox-placeholder.png',
855
+ 'lightboxPlaceholderNarrow' => trailingslashit( SBY_PLUGIN_URL ) . 'img/lightbox-placeholder-narrow.png',
856
+ 'autoplay' => $sby_settings['playvideo'] === 'automatically',
857
+ 'semiEagerload' => false,
858
+ 'eagerload' => $sby_settings['eagerload']
859
+ );
860
+ //Pass option to JS file
861
+ wp_localize_script('sby_scripts', 'sbyOptions', $data );
862
+
863
+ if ( $enqueue ) {
864
+ wp_enqueue_style( 'sby_styles' );
865
+ wp_enqueue_script( 'sby_scripts' );
866
+ }
867
+ }
868
+ add_action( 'wp_enqueue_scripts', 'sby_scripts_enqueue', 2 );
trunk/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' );
trunk/js/admin.js ADDED
@@ -0,0 +1,880 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+ function SbspfAdmin(plugin,$adminEl) {
3
+ this.plugin = plugin;
4
+ this.$adminEl = $adminEl;
5
+ this.accesstokenSplitter = 'access_token=';
6
+ }
7
+
8
+ SbspfAdmin.prototype = {
9
+ init: function() {
10
+ var self = this,
11
+ id = '#'+this.plugin,
12
+ cla = '.'+this.plugin;
13
+ this.addAccessTokenListener();
14
+ $('.'+this.plugin +'_connected_accounts_wrap .'+this.plugin +'_connected_account').each(function() {
15
+ self.initClickRemove($(this));
16
+ self.initInfoToggle($('.'+self.plugin +'_connected_accounts_wrap').last());
17
+ });
18
+ this.$adminEl.find('.sbspf_type_input').change(function() {
19
+ self.updateOnSelect($(this));
20
+ });self.updateOnSelect();
21
+
22
+
23
+ self.initAppCredToggle();
24
+
25
+ self.initWidthResponsiveToggle();
26
+ self.initActionButtons();
27
+
28
+ this.addManualAccessTokenListener();
29
+
30
+ $(id + '_search_submit').click(function(event) {
31
+ event.preventDefault();
32
+
33
+ var submitData = {
34
+ 'term' : $(id + '_channel_search').val(),
35
+ 'action' : self.plugin + '_account_search',
36
+ 'sbspf_nonce' : sbspf.nonce
37
+ };
38
+ var onSuccess = function (data) {
39
+ if (data.trim().indexOf('{') === 0) {
40
+ var returnObj = JSON.parse(data.trim());
41
+
42
+ var html = '';
43
+ $.each(returnObj.items,function(index,value){
44
+ });
45
+ }
46
+ };
47
+ sbAjax(submitData,onSuccess);
48
+ });
49
+
50
+ // color picker
51
+ var $ctfColorpicker = $(cla+'_colorpicker');
52
+
53
+ if($ctfColorpicker.length > 0){
54
+ $ctfColorpicker.wpColorPicker();
55
+ }
56
+
57
+ // shortcode tooltips
58
+ var $adminLabel = $(id +'_admin label');
59
+
60
+ $adminLabel.click(function(){
61
+ var $shortcode = $(this).siblings(cla + '_shortcode');
62
+ if($shortcode.is(':visible')){
63
+ $shortcode.hide();
64
+ } else {
65
+ $shortcode.show();
66
+ }
67
+ });
68
+ $adminLabel.hover(function(){
69
+ if($(this).siblings(cla + '_shortcode').length && ! $(this).find(cla + '_shortcode_symbol').length){
70
+ $(this).append('<code class="'+self.plugin+'_shortcode_symbol">[]</code>');
71
+ }
72
+ }, function(){
73
+ $(this).find(cla + '_shortcode_symbol').remove();
74
+ });
75
+ $(cla + '_shortcode').hide();
76
+
77
+ //Scroll to hash for quick links
78
+ $(id + '_admin a').click(function() {
79
+ if(location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
80
+ var target = $(this.hash);
81
+ target = target.length ? target : this.hash.slice(1);
82
+ if(target.length) {
83
+ $('html,body').animate({
84
+ scrollTop: target.offset().top
85
+ }, 500);
86
+ return false;
87
+ }
88
+ }
89
+ });
90
+
91
+ //Caching options
92
+ if( $(id+'_caching_type_page').is(':checked') ) {
93
+ $(cla+'-caching-cron-options').hide();
94
+ $(cla+'-caching-page-options').show();
95
+ } else {
96
+ $(cla+'-caching-page-options').hide();
97
+ $(cla+'-caching-cron-options').show();
98
+ }
99
+
100
+ $('.'+self.plugin+'_caching_type_input').change(function() {
101
+ if (this.value == 'page') {
102
+ $(cla+'-caching-cron-options').slideUp();
103
+ $(cla+'-caching-page-options').slideDown();
104
+ }
105
+ else if (this.value == 'background') {
106
+ $(cla+'-caching-page-options').slideUp();
107
+ $(cla+'-caching-cron-options').slideDown();
108
+ }
109
+ });
110
+
111
+ //Should we show the caching time settings?
112
+ var sbspf_cache_cron_interval = $(id+'_cache_cron_interval').val(),
113
+ $sbspf_caching_time_settings = $(id+'-caching-time-settings');
114
+
115
+ //Should we show anything initially?
116
+ if(sbspf_cache_cron_interval == '30mins' || sbspf_cache_cron_interval == '1hour') $sbspf_caching_time_settings.hide();
117
+
118
+ $(id+'_cache_cron_interval').change(function(){
119
+ sbspf_cache_cron_interval = $(id+'_cache_cron_interval').val();
120
+
121
+ if(sbspf_cache_cron_interval == '30mins' || sbspf_cache_cron_interval == '1hour'){
122
+ $sbspf_caching_time_settings.hide();
123
+ } else {
124
+ $sbspf_caching_time_settings.show();
125
+ }
126
+ });
127
+ sbspf_cache_cron_interval = $(id+'_cache_cron_interval').val();
128
+
129
+ if(sbspf_cache_cron_interval == '30mins' || sbspf_cache_cron_interval == '1hour'){
130
+ $sbspf_caching_time_settings.hide();
131
+ } else {
132
+ $sbspf_caching_time_settings.show();
133
+ }
134
+
135
+ self.updateLayoutOptionsDisplay();
136
+ $(cla + '_layout_type').change(function() {
137
+ self.updateLayoutOptionsDisplay()
138
+ });
139
+ $(cla + '_sub_option_type').change(function() {
140
+ self.updateBoxSelectionDisplay()
141
+ });
142
+ self.updateBoxSelectionDisplay();
143
+
144
+ // tooltips
145
+ $(id +'_admin '+ cla + '_tooltip_link').click(function(){
146
+ $(this).closest('tr, h3, '+ cla + '_tooltip_wrap').find(cla + '_tooltip').slideToggle();
147
+ });
148
+
149
+ $(id +'_admin '+ cla + '_type_tooltip_link').click(function(){
150
+ $(this).closest(cla + '_row').find(cla + '_tooltip').slideToggle();
151
+ });
152
+
153
+ //Mobile width
154
+ var $feedWidth = $(id+'_admin '+id+'_settings_width'),
155
+ $widthUnit = $(id+'_admin '+id+'_settings_width_unit');
156
+ if ($feedWidth.length) {
157
+ $feedWidth.change(function(){
158
+ self.updateFeedWidthDisplay();
159
+ });
160
+ $widthUnit.change(function(){
161
+ self.updateFeedWidthDisplay();
162
+ });
163
+ self.updateFeedWidthDisplay();
164
+ }
165
+
166
+ this.afterInit();
167
+ },
168
+ afterInit: function() {
169
+
170
+ },
171
+ addAccessTokenListener: function() {
172
+ var self = this;
173
+ if (window.location.hash.length > 5 && window.location.hash.indexOf(this.accesstokenSplitter) > -1) {
174
+ var accessToken = window.location.hash.split(this.accesstokenSplitter);
175
+ // clear access token from hash
176
+ window.location.hash = '';
177
+ var submitData = {
178
+ 'access_token' : accessToken[1],
179
+ 'action' : this.plugin + '_process_access_token',
180
+ 'sbspf_nonce' : sbspf.nonce
181
+ };
182
+ var onSuccess = function (data) {
183
+ if (data.trim().indexOf('{') === 0) {
184
+ var returnObj = JSON.parse(data.trim());
185
+ $('.'+self.plugin +'_connected_accounts_wrap').prepend(returnObj.html);
186
+ self.initClickRemove($('.'+self.plugin +'_connected_accounts_wrap').last());
187
+ self.initInfoToggle($('.'+self.plugin +'_connected_accounts_wrap').last());
188
+ }
189
+ };
190
+ sbAjax(submitData,onSuccess);
191
+ }
192
+ },
193
+ initClickRemove: function(el) {
194
+ var self = this;
195
+ el.find('.'+this.plugin +'_delete_account').click(function() {
196
+ if (!$(this).closest('.'+self.plugin +'_connected_accounts_wrap').hasClass(self.plugin +'-waiting')) {
197
+ $(this).closest('.'+self.plugin +'_connected_accounts_wrap').addClass(self.plugin +'-waiting');
198
+ var $connectedAccount = $(this).closest('.'+self.plugin +'_connected_account'),
199
+ accountID = $connectedAccount.attr('data-userid');
200
+
201
+ if (window.confirm("Delete this connected account?")) {
202
+ $('#'+self.plugin +'_user_feed_id_' + accountID).remove();
203
+ $('#'+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');
204
+
205
+ var submitData = {
206
+ 'account_id' : accountID,
207
+ 'action' : self.getAction( 'ca_after_remove_clicked' ),
208
+ 'sbspf_nonce' : sbspf.nonce
209
+ };
210
+ var onSuccess = function (data) {
211
+ if (data.trim().indexOf('{') === 0) {
212
+ var returnObj = JSON.parse(data.trim());
213
+ $('.'+self.plugin +'-waiting').removeClass(self.plugin +'-waiting');
214
+ $connectedAccount.fadeOut(300, function() { $(this).remove(); });
215
+ self.afterConnectedAccountRemoved(accountID);
216
+ }
217
+ };
218
+ sbAjax(submitData,onSuccess);
219
+ } else {
220
+ $('.'+self.plugin +'-waiting').removeClass(self.plugin +'-waiting');
221
+ }
222
+ }
223
+
224
+ });
225
+ },
226
+ initInfoToggle: function(el) {
227
+ var self = this;
228
+ el.find('.'+self.plugin +'_ca_show_token').off().click(function() {
229
+ $(this).closest('.'+self.plugin +'_ca_info').find('.'+self.plugin +'_ca_accesstoken').slideToggle(200);
230
+ });
231
+
232
+ el.find('.'+self.plugin +'_ca_token_shortcode').off().click(function() {
233
+ $(this).closest('.'+self.plugin +'_ca_info').find('.'+self.plugin +'_ca_shortcode').slideToggle(200);
234
+ });
235
+ },
236
+ initAppCredToggle: function() {
237
+ var self = this;
238
+ $('#'+self.plugin +'_have_own_tokens').click(function() {
239
+ if ($(this).is(':checked')) {
240
+ $(this).closest('form').find('.'+self.plugin +'_own_credentials_wrap').slideDown();
241
+ } else {
242
+ $(this).closest('form').find('.'+self.plugin +'_own_credentials_wrap').slideUp();
243
+ }
244
+ });
245
+
246
+ if ($('#'+self.plugin +'_have_own_tokens').is(':checked')) {
247
+ $('#'+self.plugin +'_have_own_tokens').closest('form').find('.'+self.plugin +'_own_credentials_wrap').slideDown();
248
+ } else {
249
+ $('#'+self.plugin +'_have_own_tokens').closest('form').find('.'+self.plugin +'_own_credentials_wrap').slideUp();
250
+ }
251
+ },
252
+ initWidthResponsiveToggle: function() {
253
+ //Mobile width
254
+ var feedWidth = $('#sby_settings_width').length ? $('#sby_settings_width').val() : '100',
255
+ widthUnit = $('#sby_settings_widthunit').length ? $('#sby_settings_widthunit').val() : '%',
256
+ $widthOptions = $('#sbspf_width_options');
257
+
258
+ if ($('#sby_settings_widthunit').length) {
259
+
260
+ //Show initially if a width is set
261
+ if (feedWidth !== '100' && widthUnit === '%') {
262
+ $widthOptions.slideDown();
263
+ } else {
264
+ $widthOptions.slideUp();
265
+ }
266
+
267
+ $('#sby_settings_width_unit, #sby_settings_width').change(function(){
268
+ feedWidth = $('#sby_settings_width').length ? $('#sby_settings_width').val() : '100';
269
+ widthUnit = $('#sby_settings_widthunit').length ? $('#sby_settings_widthunit').val() : '%';
270
+
271
+ if (feedWidth !== '100' && widthUnit === '%') {
272
+ $widthOptions.slideDown();
273
+ } else {
274
+ $widthOptions.slideUp();
275
+ }
276
+
277
+ });
278
+
279
+ }
280
+ },
281
+ initActionButtons: function() {
282
+ $('#sbspf_admin .sbspf-button-action').each(function(){
283
+ $(this).click(function() {
284
+ event.preventDefault();
285
+ $(this).next('.sbspf_success').remove();
286
+
287
+ var doAction = typeof $(this).attr('data-sby-action') !== 'undefined' ? $(this).attr('data-sby-action') : '',
288
+ confirmMessage = typeof $(this).attr('data-sby-confirm') !== 'undefined' ? $(this).attr('data-sby-confirm') : false,
289
+ $targetWaitingEl = typeof $(this).attr('data-sby-waiter') !== 'undefined' ? $($(this).attr('data-sby-waiter')) : $(this),
290
+ $self = $(this);
291
+ if (!confirmMessage || window.confirm(confirmMessage)) {
292
+ $(this).attr('disabled',true);
293
+ $targetWaitingEl.after('<div class="spinner sbspf_spinner" style="display:inline-block;visibility: visible;"></div>');
294
+
295
+ var submitData = {
296
+ 'action' : doAction,
297
+ 'sbspf_nonce' : sbspf.nonce
298
+ };
299
+ var onSuccess = function (data) {
300
+ $self.removeAttr('disabled');
301
+ $targetWaitingEl.next('.spinner').fadeOut('slow',function(){
302
+ $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>');
303
+ });
304
+
305
+ if (data.trim().indexOf('{') === 0) {
306
+ var returnObj = JSON.parse(data.trim());
307
+ console.log(returnObj);
308
+
309
+ }
310
+ };
311
+ sbAjax(submitData,onSuccess);
312
+ } else {
313
+ $('.'+self.plugin +'-waiting').removeClass(self.plugin +'-waiting');
314
+ }
315
+ });
316
+ });
317
+ },
318
+ getAction(action) {
319
+ return self.plugin + '_' + action
320
+ },
321
+ addManualAccessTokenListener: function() {
322
+ var self = this,
323
+ id = '#'+this.plugin,
324
+ cla = '.'+this.plugin;
325
+
326
+ $(cla+'_manually_connect_wrap').hide();
327
+ $(cla+'_manually_connect').click(function(event) {
328
+ event.preventDefault();
329
+ if ( $(cla+'_manually_connect_wrap').is(':visible') ) {
330
+ $(cla+'_manually_connect_wrap').slideUp(200);
331
+ } else {
332
+ $(cla+'_manually_connect_wrap').slideDown(200);
333
+ $(id+'_manual_at').focus();
334
+ }
335
+ });
336
+
337
+ $(id+'_manual_submit').click(function(event) {
338
+ event.preventDefault();
339
+ var $self = $(this);
340
+ var accessToken = $(id+'_manual_at').val(),
341
+ error = false;
342
+
343
+ if (accessToken.length < 15) {
344
+ if (!$(cla+'_manually_connect_wrap').find(cla+'_user_id_error').length) {
345
+ $(cla+'_manually_connect_wrap').show().prepend('<div class="'+self.plugin+'_user_id_error" style="display:block;">Please enter a valid access token</div>');
346
+ }
347
+ } else if (! error) {
348
+ $(this).attr('disabled',true);
349
+ $(this).closest(cla+'_manually_connect_wrap').fadeOut();
350
+ $(cla+'_connected_accounts_wrap').fadeTo("slow" , 0.5).find(cla+'_user_id_error').remove();
351
+
352
+ var submitData = {
353
+ 'access_token' : accessToken,
354
+ 'action' : self.plugin + '_process_access_token',
355
+ 'sbspf_nonce' : sbspf.nonce
356
+ };
357
+ var onSuccess = function (data) {
358
+ $(cla+'_connected_accounts_wrap').fadeTo("slow" , 1);
359
+ $self.removeAttr('disabled');
360
+ var returnObj = JSON.parse(data.trim());
361
+ $('.'+self.plugin +'_connected_accounts_wrap').prepend(returnObj.html);
362
+ self.initClickRemove($('.'+self.plugin +'_connected_accounts_wrap').last());
363
+ self.initInfoToggle($('.'+self.plugin +'_connected_accounts_wrap').last());
364
+ };
365
+ sbAjax(submitData,onSuccess);
366
+ }
367
+
368
+ });
369
+ },
370
+ afterConnectedAccountRemoved: function(accountID) {
371
+
372
+ },
373
+ updateLayoutOptionsDisplay: function() {
374
+ self = this;
375
+ setTimeout(function(){
376
+ $('.'+self.plugin+'_layout_settings').hide();
377
+ $('.'+self.plugin+'_layout_settings.'+self.plugin+'_layout_type_'+$('.'+self.plugin+'_layout_type:checked').val()).show();
378
+ }, 1);
379
+ },
380
+ updateBoxSelectionDisplay: function() {
381
+ self = this;
382
+ setTimeout(function(){
383
+ $('.'+self.plugin+'_sub_option_settings').hide();
384
+ $('.'+self.plugin+'_sub_option_settings.'+self.plugin+'_sub_option_type_'+$('.'+self.plugin+'_sub_option_type:checked').val()).show();
385
+ }, 1);
386
+ },
387
+ updateFeedWidthDisplay: function() {
388
+ self = this;
389
+ var sbspfFeedWidth = $('#'+self.plugin+'_admin '+'#'+self.plugin+'_settings_width').val(),
390
+ sbspfWidthUnit = $('#'+self.plugin+'_admin '+'#'+self.plugin+'_settings_width_unit').val(),
391
+ $sbspfWidthOptions = $('#'+self.plugin+'_admin '+'#'+self.plugin+'_width_options');
392
+
393
+ if( sbspfFeedWidth.length < 2 || (sbspfFeedWidth == '100' && sbspfWidthUnit == '%') ) {
394
+ $sbspfWidthOptions.slideUp();
395
+ } else {
396
+ $sbspfWidthOptions.slideDown();
397
+ }
398
+ },
399
+ updateOnSelect: function($changed) {
400
+ this.$adminEl.find('.sbspf_type_input').each(function() {
401
+ if ($(this).is(':checked')) {
402
+ $(this).closest('.sbspf_type_row').find('.sbspf_onselect').show();
403
+ } else {
404
+ $(this).closest('.sbspf_type_row').find('.sbspf_onselect').hide();
405
+ }
406
+ });
407
+ //console.log($changed.is(':checked'),$changed.closest('.sbspf_type_row').find('.sbspf_onselect').length)
408
+
409
+ },
410
+ encodeHTML: function(raw) {
411
+ // make sure passed variable is defined
412
+ if (typeof raw === 'undefined') {
413
+ return '';
414
+ }
415
+ // replace greater than and less than symbols with html entity to disallow html in comments
416
+ var encoded = raw.replace(/(>)/g,'&gt;'),
417
+ encoded = encoded.replace(/(<)/g,'&lt;');
418
+ encoded = encoded.replace(/(&lt;br\/&gt;)/g,'<br>');
419
+ encoded = encoded.replace(/(&lt;br&gt;)/g,'<br>');
420
+
421
+ return encoded;
422
+ },
423
+ };
424
+
425
+ window.sbspf_admin_init = function() {
426
+ var plugin = typeof $('.sbspf-admin').attr('data-sb-plugin') !== 'undefined' ? $('.sbspf-admin').attr('data-sb-plugin') : 'sbspf',
427
+ $adminEl = $('#sbspf_admin.sby_admin');
428
+ window.sb = new SbspfAdmin(plugin,$adminEl);
429
+ window.sb.init();
430
+ };
431
+
432
+ function sbAjax(submitData,onSuccess) {
433
+ $.ajax({
434
+ url: sbspf.ajaxUrl,
435
+ type: 'post',
436
+ data: submitData,
437
+ success: onSuccess
438
+ });
439
+ }
440
+
441
+ function SbYoutubeAdmin(plugin,$adminEl) {
442
+ SbspfAdmin.call(this, plugin,$adminEl);
443
+ this.afterInit = function() {
444
+ var self = this,
445
+ id = '#'+this.plugin,
446
+ cla = '.'+this.plugin;
447
+
448
+ // notices
449
+
450
+ if (jQuery('#sbspf-notice-bar').length) {
451
+ jQuery('#wpadminbar').after(jQuery('#sbspf-notice-bar'));
452
+ jQuery('#wpcontent').css('padding-left', 0);
453
+ jQuery('#wpbody').css('padding-left', '20px');
454
+ jQuery('#sbspf-notice-bar').show();
455
+ }
456
+
457
+ jQuery('#sbspf-notice-bar .dismiss').click(function(e) {
458
+ e.preventDefault();
459
+ jQuery('#sbspf-notice-bar').remove();
460
+ var submitData = {
461
+ 'action' : 'sby_lite_dismiss',
462
+ 'sbspf_nonce' : sbspf.nonce
463
+ };
464
+ var onSuccess = function (data) {
465
+ };
466
+ sbAjax(submitData,onSuccess);
467
+ });
468
+
469
+ $('#sbspf_usecustomsearch').change(function() {
470
+ if ($(this).is(':checked')) {
471
+ $('#sbspf_usecustomsearch_reveal').show();
472
+ } else {
473
+ $('#sbspf_usecustomsearch_reveal').hide();
474
+ }
475
+ });
476
+
477
+ if ($('#sbspf_usecustomsearch').is(':checked')) {
478
+ $('#sbspf_usecustomsearch_reveal').show();
479
+ } else {
480
+ $('#sbspf_usecustomsearch_reveal').hide();
481
+ }
482
+
483
+
484
+ $('.sbspf_dismiss_button').click(function() {
485
+ event.preventDefault();
486
+ $('#sbspf_modal_overlay').remove();
487
+ var submitData = {
488
+ 'action' : $(this).attr('data-action')
489
+ };
490
+ sbAjax(submitData,function() {});
491
+ });
492
+
493
+ $('.sbspf_dismiss_at_warning_button').click(function() {
494
+ event.preventDefault();
495
+ $('#sbspf_modal_overlay').remove();
496
+ var submitData = {
497
+ 'action' : $(this).attr('data-action')
498
+ };
499
+ sbAjax(submitData,function() {});
500
+ });
501
+
502
+ $('.sby_api_key_needed').each(function() {
503
+ $(this).find('label').append('<span class="sby_api_key_needed_message"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="key" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-key fa-w-16"><path fill="currentColor" d="M512 176.001C512 273.203 433.202 352 336 352c-11.22 0-22.19-1.062-32.827-3.069l-24.012 27.014A23.999 23.999 0 0 1 261.223 384H224v40c0 13.255-10.745 24-24 24h-40v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24v-78.059c0-6.365 2.529-12.47 7.029-16.971l161.802-161.802C163.108 213.814 160 195.271 160 176 160 78.798 238.797.001 335.999 0 433.488-.001 512 78.511 512 176.001zM336 128c0 26.51 21.49 48 48 48s48-21.49 48-48-21.49-48-48-48-48 21.49-48 48z" class=""></path></svg> API Key Needed</span>');
504
+ });
505
+
506
+ var proJustHoverHTML = '<a href="https://smashballoon.com/youtube-feed/?utm_source=plugin-free&amp;utm_campaign=sby" target="_blank" class="sbspf_lock sbspf_pro_lock"><i class="fa fa-rocket"></i>Pro</a>',
507
+ proLockHTML = '<p class="sbspf_pro_tooltip" style="display: none;">Upgrade to the Pro version to unlock this feature<i class="fa fa-caret-down" aria-hidden="true"></i></p>' + proJustHoverHTML,
508
+ proAvailableHTML = '<span class="sbspf_note"> - <a href="https://smashballoon.com/youtube-feed/?utm_source=plugin-free&amp;utm_campaign=sby" target="_blank">Available in Pro version</a></span>';
509
+
510
+ $('.sbspf_pro_only').each(function() {
511
+ if (jQuery(this).closest('td').find('.sbspf_sub_options').length) {
512
+ if (!jQuery(this).closest('td').find('.sbspf_lock').length) {
513
+ jQuery(this).closest('td').find('.sbspf_sub_options').append(proLockHTML);
514
+ }
515
+ jQuery(this).closest('td').find('input,select,textarea').each(function() {
516
+ if (typeof jQuery(this).attr('name') !== 'undefined') {
517
+ jQuery(this).attr('name',jQuery(this).attr('name').replace('sb','demosb'));
518
+ }
519
+ });
520
+ if (jQuery(this).html() === '') {
521
+ jQuery(this).closest('tr').addClass('sbspf_pro_only_row');
522
+ if (jQuery(this).html() === '') {
523
+ jQuery(this).remove();
524
+ }
525
+ }
526
+ } else if (jQuery(this).hasClass('sbspf_layout_cell')) {
527
+ if (!jQuery(this).find('.sbspf_lock').length) {
528
+ jQuery(this).append(proJustHoverHTML);
529
+ jQuery(this).find('img').css('opacity', .4);
530
+ }
531
+ } else if (jQuery(this).hasClass('sbspf_layout_settings')){
532
+ if (!jQuery(this).find('.sbspf_lock').length) {
533
+ jQuery(this).find('.sbspf_layout_setting').first().append('<span class="sbspf_note"><a href="https://smashballoon.com/youtube-feed/?utm_source=plugin-free&amp;utm_campaign=sby" target="_blank">Upgrade to Pro to enable the carousel layout</a></span>');
534
+ jQuery(this).find('input,select,textarea').attr('disabled','true');
535
+ }
536
+ } else {
537
+ if (jQuery(this).closest('td').find('.sbspf_single_checkbox').length
538
+ && ! jQuery(this).closest('td').find('.sbspf_lock').length){
539
+ jQuery(this).closest('tr').addClass('sbspf_pro_only_row');
540
+ jQuery(this).closest('tr').find('.sbspf_single_checkbox').next('label').after(proAvailableHTML);
541
+ if (jQuery(this).html() === '') {
542
+ jQuery(this).remove();
543
+ }
544
+ } else if (jQuery(this).closest('td').find('select.sbspf_pro_only').length
545
+ && ! jQuery(this).closest('td').find('.sbspf_lock').length){
546
+ jQuery(this).closest('tr').addClass('sbspf_pro_only_row');
547
+ jQuery(this).closest('tr').find('select.sbspf_pro_only').after(proAvailableHTML);
548
+ if (jQuery(this).html() === '') {
549
+ jQuery(this).remove();
550
+ }
551
+ }else if (jQuery(this).find('input[type=checkbox]').length) {
552
+ var $closestTD = jQuery(this).closest('td');
553
+ jQuery(this).find('input').attr('disabled','true');
554
+ if (jQuery(this).find('input').is(':checked')) {
555
+ var $clone = jQuery(this).find('input').clone();
556
+ $clone.removeAttr('disabled').removeAttr('checked').attr('type','hidden');
557
+ jQuery(this).append($clone);
558
+ }
559
+ jQuery(this).find('input').removeAttr('checked');
560
+ if (!$closestTD.find('.sbspf_disabled_wrap').length) {
561
+ $closestTD.append('<div class="sbspf_disabled_wrap sby_includes_pro_only"></div>');
562
+ $closestTD.find('.sby_includes_pro_only').append('<span class="sbspf_note"><a href="https://smashballoon.com/youtube-feed/?utm_source=plugin-free&amp;utm_campaign=sby" target="_blank">Upgrade to Pro to display video descriptions, dates, statistics, live streaming information, and more.</a></span>');
563
+ }
564
+ }
565
+
566
+ }
567
+ });
568
+
569
+ var $closestTD = $('.sbspf_row.sbspf_type_row').first().closest('td');
570
+ $closestTD.append('<div class="sbspf_disabled_wrap sby_types_disabled_wrap">'+proLockHTML+'</div>');
571
+
572
+ $('.sbspf_type_row').each(function() {
573
+ if ($(this).find('.sbspf_type_input').attr('value') !== 'channel') {
574
+ $('.sbspf_disabled_wrap').append($(this));
575
+ $(this).find('input').attr('disabled',true);
576
+ } else {
577
+ $(this).find('input').removeAttr('disabled');
578
+ }
579
+ });
580
+
581
+ $('.sbspf_pro_section').each(function() {
582
+ if ($(this).find('.sbspf_pro_reveal').length) {
583
+ $(this).find('h2').first().after($(this).find('.sbspf_pro_reveal'));
584
+ $(this).find('tr').addClass('sbspf_pro_only_row');
585
+ var $table = $(this).find('table');
586
+ $table.hide();
587
+ $(this).find('.sbspf-show-pro').click(function(event){
588
+ event.preventDefault();
589
+ $table.toggle();
590
+ });
591
+ jQuery(this).find('input,select,textarea').each(function() {
592
+ if (typeof jQuery(this).attr('name') !== 'undefined') {
593
+ jQuery(this).attr('name',jQuery(this).attr('name').replace('sb','demosb'));
594
+ }
595
+ });
596
+ }
597
+ });
598
+
599
+ jQuery('.sbspf_pro_lock').hover(function(){
600
+ jQuery(this).siblings('.sbspf_pro_tooltip').show();
601
+ }, function(){
602
+ jQuery('.sbspf_pro_tooltip').hide();
603
+ });
604
+
605
+ if (typeof $('#sbspf_get_token').attr('data-show-warning') !== 'undefined') {
606
+ $('#sbspf_get_token').click(function(event) {
607
+ event.preventDefault();
608
+ var html = self.getModal();
609
+ $('#sbspf_admin').append(html);
610
+ $('#sbspf_admin').find('.sbspf_modal_close').click(function() {
611
+ $('#sbspf_admin').find('#sbspf_modal_overlay').remove();
612
+ });
613
+
614
+ var submitData = {
615
+ 'action' : 'sby_dismiss_connect_warning_button'
616
+ };
617
+ sbAjax(submitData,function() {});
618
+ })
619
+ }
620
+
621
+ };
622
+
623
+ this.toggleCustomDateField = function() {
624
+ if ($('#sby_settings_dateformat').val() === 'custom') {
625
+ $('.sby_customdate_wrap').slideDown();
626
+ } else {
627
+ $('.sby_customdate_wrap').slideUp();
628
+ }
629
+ };
630
+
631
+ this.toggleAPIKeyWarnings = function() {
632
+ if ($('#sby_api_key').val() !== '') {
633
+ if ($('.sby_disabled_wrap').length) {
634
+ var $closestTD = $('.sbspf_row.sbspf_type_row').first().closest('td');
635
+ $('.sbspf_type_row').each(function() {
636
+ if ($(this).find('.sbspf_type_input').attr('value') !== 'channel') {
637
+ $closestTD.append($(this));
638
+ $(this).find('input').removeAttr('disabled');
639
+ }
640
+ });
641
+ $('.sby_disabled_wrap').remove();
642
+ }
643
+
644
+
645
+ } else if (!$('.sby_disabled_wrap').length) {
646
+ var $closestTD = $('.sbspf_row.sbspf_type_row').first().closest('td');
647
+ $closestTD.append('<div class="sby_disabled_wrap sbspf_fade"><div class="sbspf_lock"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="key" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-key fa-w-16"><path fill="currentColor" d="M512 176.001C512 273.203 433.202 352 336 352c-11.22 0-22.19-1.062-32.827-3.069l-24.012 27.014A23.999 23.999 0 0 1 261.223 384H224v40c0 13.255-10.745 24-24 24h-40v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24v-78.059c0-6.365 2.529-12.47 7.029-16.971l161.802-161.802C163.108 213.814 160 195.271 160 176 160 78.798 238.797.001 335.999 0 433.488-.001 512 78.511 512 176.001zM336 128c0 26.51 21.49 48 48 48s48-21.49 48-48-21.49-48-48-48-48 21.49-48 48z" class=""></path></svg>API Key Needed</div></div>');
648
+
649
+ $('.sbspf_type_row').each(function() {
650
+ if ($(this).find('.sbspf_type_input').attr('value') !== 'channel') {
651
+ $('.sby_disabled_wrap').append($(this));
652
+ $(this).find('input').attr('disabled',true);
653
+ } else {
654
+ $(this).find('input').removeAttr('disabled');
655
+ }
656
+ });
657
+ }
658
+
659
+ };
660
+
661
+ this.getModal = function () {
662
+
663
+ var modal = '<div id="sbspf_modal_overlay">' +
664
+ '<div class="sbspf_modal">' +
665
+ '<div class="sbspf_modal_message">' +
666
+ ' <div class="sby_before_connection">' +
667
+ ' <p>The Feeds for YouTube plugin requires <strong>"read only"</strong> access to your YouTube account in order to retrieve data from the YouTube API.</p>' +
668
+ ' <p><strong>Please note:</strong> The plugin is only able to read public data from your account and cannot be used to edit or write to your YouTube account in any way.</p>' +
669
+ ' <p class="sbspf_submit">' +
670
+ ' <a href="'+$('#sbspf_get_token').attr('href')+'" class="button button-primary sbspf_dismiss_connect_warning_button" data-action="sby_dismiss_connect_warning_notice">Continue</a>' +
671
+ ' </p>' +
672
+ ' <a href="JavaScript:void(0);" class="sbspf_modal_close sbspf_dismiss_connect_warning_button" data-action="sby_dismiss_connect_warning_notice"><i class="fa fa-times"></i></a>' +
673
+ '' +
674
+ ' </div>' +
675
+ '</div>' +
676
+ '' +
677
+ '</div>' +
678
+ '</div>';
679
+
680
+ return modal;
681
+ };
682
+
683
+ this.toggleAccessTokenDisclaimer = function () {
684
+ var self = this;
685
+ if ($('.sby_account_just_added').length) {
686
+ $('.sby_api_needed').remove();
687
+ $('.sby_after_connection').show();
688
+ } else {
689
+ $('.sby_after_connection').remove();
690
+ $('.sby_api_needed').show();
691
+ }
692
+ };
693
+
694
+ this.addAccessTokenListener = function () {
695
+ var self = this;
696
+ if (window.location.hash.length > 5 && window.location.hash.indexOf(this.accesstokenSplitter) > -1) {
697
+ var accessToken = window.location.hash.split(this.accesstokenSplitter);
698
+ // clear access token from hash
699
+ window.location.hash = '';
700
+ var submitData = {
701
+ 'access_token' : accessToken[1],
702
+ 'action' : 'sby_process_access_token',
703
+ 'sbspf_nonce' : sbspf.nonce
704
+ };
705
+ var onSuccess = function (data) {
706
+ if (data.trim().indexOf('{') === 0) {
707
+ var returnObj = JSON.parse(data.trim());
708
+ $('.'+self.plugin +'_connected_accounts_wrap').prepend(returnObj.html);
709
+ self.initClickRemove($('.'+self.plugin +'_connected_accounts_wrap').last());
710
+ self.initInfoToggle($('.'+self.plugin +'_connected_accounts_wrap').last());
711
+ }
712
+ };
713
+ sbAjax(submitData,onSuccess);
714
+ }
715
+ };
716
+
717
+ this.addManualAccessTokenListener = function() {
718
+ var self = this,
719
+ id = '#'+this.plugin,
720
+ cla = '.'+this.plugin;
721
+
722
+ $(cla+'_manually_connect_wrap').hide();
723
+ $(cla+'_manually_connect').click(function(event) {
724
+ event.preventDefault();
725
+ if ( $(cla+'_manually_connect_wrap').is(':visible') ) {
726
+ $(cla+'_manually_connect_wrap').slideUp(200);
727
+ } else {
728
+ $(cla+'_manually_connect_wrap').slideDown(200);
729
+ $(id+'_manual_at').focus();
730
+ }
731
+ });
732
+
733
+ $(id+'_manual_submit').click(function(event) {
734
+ event.preventDefault();
735
+ var $self = $(this);
736
+ var accessToken = $(id+'_manual_at').val(),
737
+ refreshToken = $(id+'_manual_rt').val(),
738
+ error = false;
739
+
740
+ if (accessToken.length < 15) {
741
+ if (!$(cla+'_manually_connect_wrap').find(cla+'_user_id_error').length) {
742
+ $(cla+'_manually_connect_wrap').show().prepend('<div class="'+self.plugin+'_user_id_error" style="display:block;">Please enter a valid access token</div>');
743
+ }
744
+ } else if (! error) {
745
+ $(this).attr('disabled',true);
746
+ $(this).closest(cla+'_manually_connect_wrap').fadeOut();
747
+ $(cla+'_connected_accounts_wrap').fadeTo("slow" , 0.5).find(cla+'_user_id_error').remove();
748
+
749
+ var submitData = {
750
+ 'sby_access_token' : accessToken,
751
+ 'sby_refresh_token' : refreshToken,
752
+ 'action' : 'sby_process_access_token',
753
+ 'sbspf_nonce' : sbspf.nonce
754
+ };
755
+ var onSuccess = function (data) {
756
+ $(cla+'_connected_accounts_wrap').fadeTo("slow" , 1);
757
+ $self.removeAttr('disabled');
758
+ if (data.trim().indexOf('{') === 0) {
759
+ var returnObj = JSON.parse(data.trim());
760
+ if (typeof returnObj.error === 'undefined') {
761
+ if (!$('#sbspf_connected_account_'+returnObj.account_id).length) {
762
+ $('.'+self.plugin +'_connected_accounts_wrap').prepend(returnObj.html);
763
+ self.initClickRemove($('.'+self.plugin +'_connected_accounts_wrap').last());
764
+ self.initInfoToggle($('.'+self.plugin +'_connected_accounts_wrap').last());
765
+ console.log('added');
766
+ } else {
767
+ $('#sbspf_connected_account_'+returnObj.account_id).replaceWith(returnObj.html);
768
+ self.initClickRemove($('#sbspf_connected_account_'+returnObj.account_id));
769
+ self.initInfoToggle($('#sbspf_connected_account_'+returnObj.account_id));
770
+ console.log('updated');
771
+ }
772
+ } else {
773
+ alert(returnObj.error);
774
+ }
775
+ }
776
+
777
+ };
778
+ sbAjax(submitData,onSuccess);
779
+ }
780
+
781
+ });
782
+ };
783
+ this.addManualAccessTokenListener = function() {
784
+ var self = this,
785
+ id = '#'+this.plugin,
786
+ cla = '.'+this.plugin;
787
+
788
+ $(cla+'_manually_connect_wrap').hide();
789
+ $(cla+'_manually_connect').click(function(event) {
790
+ event.preventDefault();
791
+ if ( $(cla+'_manually_connect_wrap').is(':visible') ) {
792
+ $(cla+'_manually_connect_wrap').slideUp(200);
793
+ } else {
794
+ $(cla+'_manually_connect_wrap').slideDown(200);
795
+ $(id+'_manual_at').focus();
796
+ }
797
+ });
798
+
799
+ $(id+'_manual_submit').click(function(event) {
800
+ event.preventDefault();
801
+ var $self = $(this);
802
+ var accessToken = $(id+'_manual_at').val(),
803
+ refreshToken = $(id+'_manual_rt').val(),
804
+ error = false;
805
+
806
+ if (accessToken.length < 15) {
807
+ if (!$(cla+'_manually_connect_wrap').find(cla+'_user_id_error').length) {
808
+ $(cla+'_manually_connect_wrap').show().prepend('<div class="'+self.plugin+'_user_id_error" style="display:block;">Please enter a valid access token</div>');
809
+ }
810
+ } else if (! error) {
811
+ $(this).attr('disabled',true);
812
+ $(this).closest(cla+'_manually_connect_wrap').fadeOut();
813
+ $(cla+'_connected_accounts_wrap').fadeTo("slow" , 0.5).find(cla+'_user_id_error').remove();
814
+
815
+ var submitData = {
816
+ 'sby_access_token' : accessToken,
817
+ 'sby_refresh_token' : refreshToken,
818
+ 'action' : 'sby_process_access_token',
819
+ 'sbspf_nonce' : sbspf.nonce
820
+ };
821
+ var onSuccess = function (data) {
822
+ $(cla+'_connected_accounts_wrap').fadeTo("slow" , 1);
823
+ $self.removeAttr('disabled');
824
+ if (data.trim().indexOf('{') === 0) {
825
+ var returnObj = JSON.parse(data.trim());
826
+ if (typeof returnObj.error === 'undefined') {
827
+ if (!$('#sbspf_connected_account_'+returnObj.account_id).length) {
828
+ $('.'+self.plugin +'_connected_accounts_wrap').prepend(returnObj.html);
829
+ self.initClickRemove($('.'+self.plugin +'_connected_accounts_wrap').last());
830
+ self.initInfoToggle($('.'+self.plugin +'_connected_accounts_wrap').last());
831
+ console.log('added');
832
+ } else {
833
+ $('#sbspf_connected_account_'+returnObj.account_id).replaceWith(returnObj.html);
834
+ self.initClickRemove($('#sbspf_connected_account_'+returnObj.account_id));
835
+ self.initInfoToggle($('#sbspf_connected_account_'+returnObj.account_id));
836
+ console.log('updated');
837
+ }
838
+ } else {
839
+ alert(returnObj.error);
840
+ }
841
+ }
842
+
843
+ self.toggleAccessTokenDisclaimer();
844
+ $('.sbspf_dismiss_at_warning_button').click(function() {
845
+ event.preventDefault();
846
+ $('#sbspf_modal_overlay').remove();
847
+ var submitData = {
848
+ 'action' : $(this).attr('data-action')
849
+ };
850
+ sbAjax(submitData,function() {});
851
+ });
852
+
853
+ };
854
+ sbAjax(submitData,onSuccess);
855
+ }
856
+
857
+ });
858
+ };
859
+ this.getAction = function(action) {
860
+ return 'sby_' + action;
861
+ };
862
+
863
+
864
+ }
865
+
866
+ SbYoutubeAdmin.prototype = Object.create(SbspfAdmin.prototype);
867
+
868
+
869
+ window.sby_admin_init = function() {
870
+ var plugin = typeof $('.sbspf-admin').attr('data-sb-plugin') !== 'undefined' ? $('.sbspf-admin').attr('data-sb-plugin') : 'sbspf',
871
+ $adminEl = $('#sbspf_admin.sby_admin');
872
+ window.sb = new SbYoutubeAdmin(plugin,$adminEl);
873
+ window.sb.init();
874
+ };
875
+
876
+ })(jQuery);
877
+
878
+ jQuery(document).ready(function($) {
879
+ sby_admin_init();
880
+ });
trunk/js/sb-youtube.js ADDED
@@ -0,0 +1,1805 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 sbyAddImgLiquid() {
12
+ /*! imgLiquid v0.9.944 / 03-05-2013 https://github.com/karacas/imgLiquid */
13
+ var sby_imgLiquid = sby_imgLiquid || {VER: "0.9.944"};
14
+ sby_imgLiquid.bgs_Available = !1, sby_imgLiquid.bgs_CheckRunned = !1, function (i) {
15
+ function t() {
16
+ if (!sby_imgLiquid.bgs_CheckRunned) {
17
+ sby_imgLiquid.bgs_CheckRunned = !0;
18
+ var t = i('<span style="background-size:cover" />');
19
+ i("body").append(t), !function () {
20
+ var i = t[0];
21
+ if (i && window.getComputedStyle) {
22
+ var e = window.getComputedStyle(i, null);
23
+ e && e.backgroundSize && (sby_imgLiquid.bgs_Available = "cover" === e.backgroundSize)
24
+ }
25
+ }(), t.remove()
26
+ }
27
+ }
28
+
29
+ i.fn.extend({
30
+ sby_imgLiquid: function (e) {
31
+ this.defaults = {
32
+ fill: !0,
33
+ verticalAlign: "center",
34
+ horizontalAlign: "center",
35
+ useBackgroundSize: !0,
36
+ useDataHtmlAttr: !0,
37
+ responsive: !0,
38
+ delay: 0,
39
+ fadeInTime: 0,
40
+ removeBoxBackground: !0,
41
+ hardPixels: !0,
42
+ responsiveCheckTime: 500,
43
+ timecheckvisibility: 500,
44
+ onStart: null,
45
+ onFinish: null,
46
+ onItemStart: null,
47
+ onItemFinish: null,
48
+ onItemError: null
49
+ }, t();
50
+ var a = this;
51
+ return this.options = e, this.settings = i.extend({}, this.defaults, this.options), this.settings.onStart && this.settings.onStart(), this.each(function (t) {
52
+ function e() {
53
+ -1 === u.css("background-image").indexOf(encodeURI(c.attr("src"))) && u.css({"background-image": 'url("' + encodeURI(c.attr("src")) + '")'}), u.css({
54
+ "background-size": g.fill ? "cover" : "contain",
55
+ "background-position": (g.horizontalAlign + " " + g.verticalAlign).toLowerCase(),
56
+ "background-repeat": "no-repeat"
57
+ }), i("a:first", u).css({
58
+ display: "block",
59
+ width: "100%",
60
+ height: "100%"
61
+ }), i("img", u).css({display: "none"}), g.onItemFinish && g.onItemFinish(t, u, c), u.addClass("sby_imgLiquid_bgSize"), u.addClass("sby_imgLiquid_ready"), l()
62
+ }
63
+
64
+ function o() {
65
+ function e() {
66
+ c.data("sby_imgLiquid_error") || c.data("sby_imgLiquid_loaded") || c.data("sby_imgLiquid_oldProcessed") || (u.is(":visible") && c[0].complete && c[0].width > 0 && c[0].height > 0 ? (c.data("sby_imgLiquid_loaded", !0), setTimeout(r, t * g.delay)) : setTimeout(e, g.timecheckvisibility))
67
+ }
68
+
69
+ if (c.data("oldSrc") && c.data("oldSrc") !== c.attr("src")) {
70
+ var a = c.clone().removeAttr("style");
71
+ return a.data("sby_imgLiquid_settings", c.data("sby_imgLiquid_settings")), c.parent().prepend(a), c.remove(), c = a, c[0].width = 0, void setTimeout(o, 10)
72
+ }
73
+ return c.data("sby_imgLiquid_oldProcessed") ? void r() : (c.data("sby_imgLiquid_oldProcessed", !1), c.data("oldSrc", c.attr("src")), i("img:not(:first)", u).css("display", "none"), u.css({overflow: "hidden"}), c.fadeTo(0, 0).removeAttr("width").removeAttr("height").css({
74
+ visibility: "visible",
75
+ "max-width": "none",
76
+ "max-height": "none",
77
+ width: "auto",
78
+ height: "auto",
79
+ display: "block"
80
+ }), c.on("error", n), c[0].onerror = n, e(), void d())
81
+ }
82
+
83
+ function d() {
84
+ (g.responsive || c.data("sby_imgLiquid_oldProcessed")) && c.data("sby_imgLiquid_settings") && (g = c.data("sby_imgLiquid_settings"), u.actualSize = u.get(0).offsetWidth + u.get(0).offsetHeight / 1e4, u.sizeOld && u.actualSize !== u.sizeOld && r(), u.sizeOld = u.actualSize, setTimeout(d, g.responsiveCheckTime))
85
+ }
86
+
87
+ function n() {
88
+ c.data("sby_imgLiquid_error", !0), u.addClass("sby_imgLiquid_error"), g.onItemError && g.onItemError(t, u, c), l()
89
+ }
90
+
91
+ function s() {
92
+ var i = {};
93
+ if (a.settings.useDataHtmlAttr) {
94
+ var t = u.attr("data-sby_imgLiquid-fill"),
95
+ e = u.attr("data-sby_imgLiquid-horizontalAlign"),
96
+ o = u.attr("data-sby_imgLiquid-verticalAlign");
97
+ ("true" === t || "false" === t) && (i.fill = Boolean("true" === t)), void 0 === e || "left" !== e && "center" !== e && "right" !== e && -1 === e.indexOf("%") || (i.horizontalAlign = e), void 0 === o || "top" !== o && "bottom" !== o && "center" !== o && -1 === o.indexOf("%") || (i.verticalAlign = o)
98
+ }
99
+ return sby_imgLiquid.isIE && a.settings.ieFadeInDisabled && (i.fadeInTime = 0), i
100
+ }
101
+
102
+ function r() {
103
+ var i, e, a, o, d, n, s, r, m = 0, h = 0, f = u.width(), v = u.height();
104
+ void 0 === c.data("owidth") && c.data("owidth", c[0].width), void 0 === c.data("oheight") && c.data("oheight", c[0].height), g.fill === f / v >= c.data("owidth") / c.data("oheight") ? (i = "100%", e = "auto", a = Math.floor(f), o = Math.floor(f * (c.data("oheight") / c.data("owidth")))) : (i = "auto", e = "100%", a = Math.floor(v * (c.data("owidth") / c.data("oheight"))), o = Math.floor(v)), d = g.horizontalAlign.toLowerCase(), s = f - a, "left" === d && (h = 0), "center" === d && (h = .5 * s), "right" === d && (h = s), -1 !== d.indexOf("%") && (d = parseInt(d.replace("%", ""), 10), d > 0 && (h = s * d * .01)), n = g.verticalAlign.toLowerCase(), r = v - o, "left" === n && (m = 0), "center" === n && (m = .5 * r), "bottom" === n && (m = r), -1 !== n.indexOf("%") && (n = parseInt(n.replace("%", ""), 10), n > 0 && (m = r * n * .01)), g.hardPixels && (i = a, e = o), c.css({
105
+ width: i,
106
+ height: e,
107
+ "margin-left": Math.floor(h),
108
+ "margin-top": Math.floor(m)
109
+ }), c.data("sby_imgLiquid_oldProcessed") || (c.fadeTo(g.fadeInTime, 1), c.data("sby_imgLiquid_oldProcessed", !0), g.removeBoxBackground && u.css("background-image", "none"), u.addClass("sby_imgLiquid_nobgSize"), u.addClass("sby_imgLiquid_ready")), g.onItemFinish && g.onItemFinish(t, u, c), l()
110
+ }
111
+
112
+ function l() {
113
+ t === a.length - 1 && a.settings.onFinish && a.settings.onFinish()
114
+ }
115
+
116
+ var g = a.settings, u = i(this), c = i("img:first", u);
117
+ return c.length ? (c.data("sby_imgLiquid_settings") ? (u.removeClass("sby_imgLiquid_error").removeClass("sby_imgLiquid_ready"), g = i.extend({}, c.data("sby_imgLiquid_settings"), a.options)) : g = i.extend({}, a.settings, s()), c.data("sby_imgLiquid_settings", g), g.onItemStart && g.onItemStart(t, u, c), void (sby_imgLiquid.bgs_Available && g.useBackgroundSize ? e() : o())) : void n()
118
+ })
119
+ }
120
+ })
121
+ }(jQuery);
122
+
123
+ // Use imagefill to set the images as backgrounds so they can be square
124
+ !function () {
125
+ var css = sby_imgLiquid.injectCss,
126
+ head = document.getElementsByTagName('head')[0],
127
+ style = document.createElement('style');
128
+ style.type = 'text/css';
129
+ if (style.styleSheet) {
130
+ style.styleSheet.cssText = css;
131
+ } else {
132
+ style.appendChild(document.createTextNode(css));
133
+ }
134
+ head.appendChild(style);
135
+ }();
136
+ }
137
+
138
+ function sbyAddVisibilityListener() {
139
+ /* Detect when element becomes visible. Used for when the feed is initially hidden, in a tab for example. https://github.com/shaunbowe/jquery.visibilityChanged */
140
+ !function (i) {
141
+ var n = {
142
+ callback: function () {
143
+ }, runOnLoad: !0, frequency: 100, sbyPreviousVisibility: null
144
+ }, c = {};
145
+ c.sbyCheckVisibility = function (i, n) {
146
+ if (jQuery.contains(document, i[0])) {
147
+ var e = n.sbyPreviousVisibility, t = i.is(":visible");
148
+ n.sbyPreviousVisibility = t, null == e ? n.runOnLoad && n.callback(i, t) : e !== t && n.callback(i, t), setTimeout(function () {
149
+ c.sbyCheckVisibility(i, n)
150
+ }, n.frequency)
151
+ }
152
+ }, i.fn.sbyVisibilityChanged = function (e) {
153
+ var t = i.extend({}, n, e);
154
+ return this.each(function () {
155
+ c.sbyCheckVisibility(i(this), t)
156
+ })
157
+ }
158
+ }(jQuery);
159
+ }
160
+
161
+ function Sby() {
162
+ this.feeds = {};
163
+ this.options = sbyOptions;
164
+ this.isTouch = sbyIsTouch();
165
+ }
166
+
167
+ Sby.prototype = {
168
+ createPage: function (createFeeds, createFeedsArgs) {
169
+ if (typeof window.sbyajaxurl === 'undefined' || window.sbyajaxurl.indexOf(window.location.hostname) === -1) {
170
+ window.sbyajaxurl = window.location.hostname + '/wp-admin/admin-ajax.php';
171
+ }
172
+
173
+ $('.sby_no_js_error_message').remove();
174
+ $('.sby_no_js').removeClass('sby_no_js');
175
+ var youtubeScriptId = "youtube-api";
176
+ var youtubeScript = document.getElementById(youtubeScriptId);
177
+
178
+ if (youtubeScript === null) {
179
+ var tag = document.createElement("script");
180
+ var firstScript = document.getElementsByTagName("script")[0];
181
+
182
+ tag.src = "https://www.youtube.com/iframe_api";
183
+ tag.id = youtubeScriptId;
184
+ firstScript.parentNode.insertBefore(tag, firstScript);
185
+
186
+ }
187
+ createFeeds(createFeedsArgs);
188
+ },
189
+ createLightbox: function() {
190
+ var lbBuilder = sbyGetlightboxBuilder();
191
+ var sby_lb_delay = (function () {
192
+ var sby_timer = 0;
193
+ return function (sby_callback, sby_ms) {
194
+ clearTimeout(sby_timer);
195
+ sby_timer = setTimeout(sby_callback, sby_ms);
196
+ };
197
+ })();
198
+ jQuery(window).resize(function () {
199
+ sby_lb_delay(function () {
200
+ lbBuilder.afterResize();
201
+ }, 200);
202
+ });
203
+ /* Lightbox v2.7.1 by Lokesh Dhakar - http://lokeshdhakar.com/projects/lightbox2/ - Heavily modified specifically for this plugin */
204
+ (function() {
205
+ var a = jQuery,
206
+ b = function() {
207
+ function a() {
208
+ this.fadeDuration = 500, this.fitImagesInViewport = !0, this.resizeDuration = 700, this.positionFromTop = 50, this.showImageNumberLabel = !0, this.alwaysShowNavOnTouchDevices = !1, this.wrapAround = !1
209
+ }
210
+ return a.prototype.albumLabel = function(a, b) {
211
+ return a + " / " + b
212
+ }, a
213
+ }(),
214
+ c = function() {
215
+ function b(a) {
216
+ this.options = a, this.album = [], this.currentImageIndex = void 0, this.init()
217
+ }
218
+ return b.prototype.init = function() {
219
+ this.enable(), this.build()
220
+ }, b.prototype.enable = function() {
221
+ var b = this;
222
+ a("body").on("click", "a[data-sby-lightbox]", function(c) {
223
+ return b.start(a(c.currentTarget)), !1
224
+ })
225
+ }, b.prototype.build = function() {
226
+ var b = this;
227
+ a(""+
228
+ lbBuilder.template()).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() {
229
+ return b.end(), !1
230
+ }), jQuery(document).on('click', function(event, b, c) {
231
+ //Fade out the lightbox if click anywhere outside of the two elements defined below
232
+ if (!jQuery(event.target).closest('.sby_lb-outerContainer').length) {
233
+ if (!jQuery(event.target).closest('.sby_lb-dataContainer').length) {
234
+ //Fade out lightbox
235
+ if (typeof window.sbyLightboxPlayer !== 'undefined') { YT.get('sby_lb-player').pauseVideo(); }
236
+
237
+ jQuery('#sby_lightboxOverlay, #sby_lightbox').fadeOut();
238
+ }
239
+ }
240
+ }), this.$lightbox.hide(),
241
+ jQuery('#sby_lightboxOverlay').on("click", function(c) {
242
+ if (typeof window.sbyLightboxPlayer !== 'undefined') { YT.get('sby_lb-player').pauseVideo(); }
243
+
244
+ return "sby_lightbox" === a(c.target).attr("id") && b.end(), !1
245
+ }), this.$lightbox.find(".sby_lb-prev").on("click", function() {
246
+
247
+ if (typeof window.sbyLightboxPlayer !== 'undefined') { YT.get('sby_lb-player').pauseVideo(); }
248
+
249
+ return b.changeImage(0 === b.currentImageIndex ? b.album.length - 1 : b.currentImageIndex - 1), !1
250
+ }), this.$lightbox.find(".sby_lb-container").on("swiperight", function() {
251
+
252
+ if (typeof window.sbyLightboxPlayer !== 'undefined') { YT.get('sby_lb-player').pauseVideo(); }
253
+
254
+ return b.changeImage(0 === b.currentImageIndex ? b.album.length - 1 : b.currentImageIndex - 1), !1
255
+ }), this.$lightbox.find(".sby_lb-next").on("click", function() {
256
+
257
+ if (typeof window.sbyLightboxPlayer !== 'undefined') { YT.get('sby_lb-player').pauseVideo(); }
258
+
259
+ return b.changeImage(b.currentImageIndex === b.album.length - 1 ? 0 : b.currentImageIndex + 1), !1
260
+ }), this.$lightbox.find(".sby_lb-container").on("swipeleft", function() {
261
+
262
+ if (typeof window.sbyLightboxPlayer !== 'undefined') { YT.get('sby_lb-player').pauseVideo(); }
263
+
264
+ return b.changeImage(b.currentImageIndex === b.album.length - 1 ? 0 : b.currentImageIndex + 1), !1
265
+ }), this.$lightbox.find(".sby_lb-loader, .sby_lb-close").on("click", function() {
266
+
267
+ if (typeof window.sbyLightboxPlayer !== 'undefined') { YT.get('sby_lb-player').pauseVideo(); }
268
+
269
+ return b.end(), !1
270
+ })
271
+ }, b.prototype.start = function(b) {
272
+ function c(a) {
273
+ d.album.push(lbBuilder.getData(a))
274
+ }
275
+ var d = this,
276
+ e = a(window);
277
+ e.on("resize", a.proxy(this.sizeOverlay, this)), a("select, object, embed").css({
278
+ visibility: "hidden"
279
+ }), this.sizeOverlay(), this.album = [];
280
+ var f, g = 0,
281
+ h = b.attr("data-sby-lightbox");
282
+ if (h) {
283
+ f = a(b.prop("tagName") + '[data-sby-lightbox="' + h + '"]');
284
+ for (var i = 0; i < f.length; i = ++i) c(a(f[i])), f[i] === b[0] && (g = i)
285
+ } else if ("lightbox" === b.attr("rel")) c(b);
286
+ else {
287
+ f = a(b.prop("tagName") + '[rel="' + b.attr("rel") + '"]');
288
+ for (var j = 0; j < f.length; j = ++j) c(a(f[j])), f[j] === b[0] && (g = j)
289
+ }
290
+ var k = e.scrollTop() + this.options.positionFromTop,
291
+ l = e.scrollLeft();
292
+ this.$lightbox.css({
293
+ top: k + "px",
294
+ left: l + "px"
295
+ }).fadeIn(this.options.fadeDuration), this.changeImage(g)
296
+ }, b.prototype.changeImage = function(b) {
297
+ var c = this;
298
+ this.disableKeyboardNav();
299
+ var d = this.$lightbox.find(".sby_lb-image");
300
+ 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");
301
+ var e = new Image;
302
+ e.onload = function() {
303
+ var f, g, h, i, j, k, l;
304
+ var sbyArrowWidth = 100;
305
+ 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 - sbyArrowWidth, 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())
306
+ }, e.src = this.album[b].link, this.currentImageIndex = b
307
+ }, b.prototype.sizeOverlay = function() {
308
+ this.$overlay.width(a(window).width()).height(a(document).height())
309
+ }, b.prototype.sizeContainer = function(a, b) {
310
+ function c() {
311
+ 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()
312
+ }
313
+ var d = this,
314
+ e = this.$outerContainer.outerWidth(),
315
+ f = this.$outerContainer.outerHeight(),
316
+ g = a + this.containerLeftPadding + this.containerRightPadding,
317
+ h = b + this.containerTopPadding + this.containerBottomPadding;
318
+ e !== g || f !== h ? this.$outerContainer.animate({
319
+ width: g,
320
+ height: h
321
+ }, this.options.resizeDuration, "swing", function() {
322
+ c()
323
+ }) : c()
324
+ }, b.prototype.showImage = function() {
325
+ this.$lightbox.find(".sby_lb-loader").hide(), this.$lightbox.find(".sby_lb-image").fadeIn("slow"), this.updateNav(), this.updateDetails(), this.preloadNeighboringImages(), this.enableKeyboardNav()
326
+ }, b.prototype.updateNav = function() {
327
+ var a = !1;
328
+ try {
329
+ document.createEvent("TouchEvent"), a = this.options.alwaysShowNavOnTouchDevices ? !0 : !1
330
+ } catch (b) {}
331
+ 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"))))
332
+ }, b.prototype.updateDetails = function() {
333
+ var b = this;
334
+
335
+ /** NEW PHOTO ACTION **/
336
+ if(jQuery('iframe.sby_lb-player-loaded').length) {
337
+ jQuery('.sby_lb-player-placeholder').replaceWith(jQuery('iframe.sby_lb-player-loaded'));
338
+ jQuery('iframe.sby_lb-player-loaded').removeClass('sby_lb-player-loaded').show();
339
+ }
340
+ //Switch video when either a new popup or navigating to new one
341
+ var feed = window.sby.feeds[this.album[this.currentImageIndex].feedIndex];
342
+ lbBuilder.beforePlayerSetup(this.$lightbox,this.album[this.currentImageIndex],this.currentImageIndex,this.album,feed);
343
+
344
+ if( sby_supports_video() ){
345
+ jQuery('#sby_lightbox').removeClass('sby_video_lightbox');
346
+ if (this.album[this.currentImageIndex].video.length){
347
+ var playerID = 'sby_lb-player';
348
+ jQuery('#sby_lightbox').addClass('sby_video_lightbox');
349
+
350
+ var videoID = this.album[this.currentImageIndex].video,
351
+ autoplay = sbyOptions.autoplay;
352
+ if (typeof window.sbyLightboxPlayer === 'undefined') {
353
+ var args = {
354
+ host: window.location.protocol + '//www.youtube-nocookie.com',
355
+ videoId: videoID,
356
+ playerVars: {
357
+ modestbranding: 1,
358
+ rel: 0,
359
+ autoplay: autoplay
360
+ },
361
+ events: {
362
+ 'onStateChange': function(data) {
363
+ var videoID = data.target.getVideoData()['video_id'];
364
+ feed.afterStateChange(playerID,videoID,data,$('#' + playerID).closest('.sby_video_thumbnail_wrap'));
365
+ }
366
+ }
367
+ };
368
+ feed.maybeAddCTA(playerID);
369
+
370
+ window.sbyLightboxPlayer = new window.YT.Player(playerID, args);
371
+ } else {
372
+ window.sbyLightboxPlayer.loadVideoById(videoID);
373
+ }
374
+
375
+ lbBuilder.afterPlayerSetup(this.$lightbox,this.album[this.currentImageIndex],this.currentImageIndex,this.album);
376
+
377
+ if (this.album.length > 1 && this.options.showImageNumberLabel) {
378
+ this.$lightbox.find(".sby_lb-number").text(this.options.albumLabel(this.currentImageIndex + 1, this.album.length)).fadeIn("fast");
379
+ } else {
380
+ this.$lightbox.find(".sby_lb-number").hide();
381
+ }
382
+ this.$outerContainer.removeClass("animating");
383
+ this.$lightbox.find(".sby_lb-dataContainer").fadeIn(this.options.resizeDuration, function() {
384
+ return b.sizeOverlay()
385
+ });
386
+
387
+ setTimeout(function() {
388
+ $('#sby_lightbox .sby_lb-player').css({
389
+ 'height' : $('#sby_lightbox .sby_lb-outerContainer').height()+'px',
390
+ 'width' : $('#sby_lightbox .sby_lb-outerContainer').width()+'px',
391
+ 'top': 0
392
+ });
393
+ },400);
394
+
395
+ }
396
+ }
397
+ }, b.prototype.preloadNeighboringImages = function() {
398
+ if (this.album.length > this.currentImageIndex + 1) {
399
+ var a = new Image;
400
+ a.src = this.album[this.currentImageIndex + 1].link
401
+ }
402
+ if (this.currentImageIndex > 0) {
403
+ var b = new Image;
404
+ b.src = this.album[this.currentImageIndex - 1].link
405
+ }
406
+ }, b.prototype.enableKeyboardNav = function() {
407
+ a(document).on("keyup.keyboard", a.proxy(this.keyboardAction, this))
408
+ }, b.prototype.disableKeyboardNav = function() {
409
+ a(document).off(".keyboard")
410
+ }, b.prototype.keyboardAction = function(a) {
411
+
412
+ var KEYCODE_ESC = 27;
413
+ var KEYCODE_LEFTARROW = 37;
414
+ var KEYCODE_RIGHTARROW = 39;
415
+
416
+ var keycode = event.keyCode;
417
+ var key = String.fromCharCode(keycode).toLowerCase();
418
+ if (keycode === KEYCODE_ESC || key.match(/x|o|c/)) {
419
+ if( sby_supports_video() ) $('#sby_lightbox video.sby_video')[0].pause();
420
+ $('#sby_lightbox iframe').attr('src', '');
421
+ this.end();
422
+ } else if (key === 'p' || keycode === KEYCODE_LEFTARROW) {
423
+ if (this.currentImageIndex !== 0) {
424
+ this.changeImage(this.currentImageIndex - 1);
425
+ } else if (this.options.wrapAround && this.album.length > 1) {
426
+ this.changeImage(this.album.length - 1);
427
+ }
428
+
429
+ if( sby_supports_video() ) $('#sby_lightbox video.sby_video')[0].pause();
430
+ $('#sby_lightbox iframe').attr('src', '');
431
+
432
+ } else if (key === 'n' || keycode === KEYCODE_RIGHTARROW) {
433
+ if (this.currentImageIndex !== this.album.length - 1) {
434
+ this.changeImage(this.currentImageIndex + 1);
435
+ } else if (this.options.wrapAround && this.album.length > 1) {
436
+ this.changeImage(0);
437
+ }
438
+
439
+ if (typeof window.sbyLightboxPlayer !== 'undefined') { YT.get('sby_lb-player').pauseVideo(); }
440
+ }
441
+
442
+ }, b.prototype.end = function() {
443
+ 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({
444
+ visibility: "visible"
445
+ })
446
+ }, b
447
+ }();
448
+ a(function() {
449
+ {
450
+ var a = new b;
451
+ new c(a)
452
+
453
+ //Lightbox hide photo function
454
+ $('.sby_lightbox_action a').unbind().bind('click', function(){
455
+ $(this).parent().find('.sby_lightbox_tooltip').toggle();
456
+ });
457
+ }
458
+ })
459
+ }).call(this);
460
+ },
461
+ createFeeds: function (args) {
462
+ window.sby.createLightbox();
463
+ args.whenFeedsCreated(
464
+ $('.sb_youtube').each(function (index) {
465
+ $(this).attr('data-sby-index', index + 1);
466
+ $(this).find('.sby_player').replaceWith('<div id="sby_player'+index+'"></div>');
467
+ var $self = $(this),
468
+ flags = typeof $self.attr('data-sby-flags') !== 'undefined' ? $self.attr('data-sby-flags').split(',') : [],
469
+ general = typeof $self.attr('data-options') !== 'undefined' ? JSON.parse($self.attr('data-options')) : {};
470
+ if (flags.indexOf('testAjax') > -1) {
471
+ window.sby.triggeredTest = true;
472
+ var submitData = {
473
+ 'action' : 'sby_on_ajax_test_trigger'
474
+ },
475
+ onSuccess = function(data) {
476
+ console.log('did test');
477
+ };
478
+ sbyAjax(submitData,onSuccess)
479
+ }
480
+ var feedOptions = {
481
+ cols : $self.attr('data-cols'),
482
+ colsmobile : $self.attr('data-colsmobile') !== 'same' ? $self.attr('data-colsmobile') : $self.attr('data-cols'),
483
+ num : $self.attr('data-num'),
484
+ imgRes : $self.attr('data-res'),
485
+ feedID : $self.attr('data-feedid'),
486
+ shortCodeAtts : $self.attr('data-shortcode-atts'),
487
+ resizingEnabled : (flags.indexOf('resizeDisable') === -1),
488
+ imageLoadEnabled : (flags.indexOf('imageLoadDisable') === -1),
489
+ debugEnabled : (flags.indexOf('debug') > -1),
490
+ favorLocal : (flags.indexOf('favorLocal') > -1),
491
+ ajaxPostLoad : (flags.indexOf('ajaxPostLoad') > -1),
492
+ checkWPPosts : (flags.indexOf('checkWPPosts') > -1),
493
+ cacheAll : (flags.indexOf('cacheAll') > -1),
494
+ lightboxEnabled : typeof $self.attr('data-sby-supports-lightbox') !== 'undefined',
495
+ autoMinRes : 1,
496
+ general : general
497
+ };
498
+
499
+ window.sby.feeds[index] = sbyGetNewFeed(this, index, feedOptions);
500
+ if (typeof window.sbyAPIReady !== 'undefined') {
501
+ window.sby.feeds[index].playerAPIReady = true;
502
+ }
503
+ window.sby.feeds[index].setResizedImages();
504
+ window.sby.feeds[index].init();
505
+
506
+ var evt = jQuery.Event('sbyafterfeedcreate');
507
+ evt.feed = window.sby.feeds[index];
508
+ jQuery(window).trigger(evt);
509
+
510
+ })
511
+ );
512
+ },
513
+ afterFeedsCreated: function () {
514
+ // enable header hover action
515
+ $('.sb_instagram_header').each(function () {
516
+ var $thisHeader = $(this);
517
+ $thisHeader.find('.sby_header_link').hover(function () {
518
+ $thisHeader.find('.sby_header_img_hover').addClass('sby_fade_in');
519
+ }, function () {
520
+ $thisHeader.find('.sby_header_img_hover').removeClass('sby_fade_in');
521
+ });
522
+ });
523
+
524
+ },
525
+ encodeHTML: function(raw) {
526
+ // make sure passed variable is defined
527
+ if (typeof raw === 'undefined') {
528
+ return '';
529
+ }
530
+ // replace greater than and less than symbols with html entity to disallow html in comments
531
+ var encoded = raw.replace(/(>)/g,'&gt;'),
532
+ encoded = encoded.replace(/(<)/g,'&lt;');
533
+ encoded = encoded.replace(/(&lt;br\/&gt;)/g,'<br>');
534
+ encoded = encoded.replace(/(&lt;br&gt;)/g,'<br>');
535
+
536
+ return encoded;
537
+ },
538
+ urlDetect: function(text) {
539
+ var urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g;
540
+ return text.match(urlRegex);
541
+ }
542
+ };
543
+
544
+ function SbyFeed(el, index, settings) {
545
+ this.el = el;
546
+ this.index = index;
547
+ this.settings = settings;
548
+ this.placeholderURL = window.sby.options.placeholder;
549
+ if (settings.narrowPlayer) {
550
+ this.placeholderURL = window.sby.options.placeholderNarrow
551
+ }
552
+ this.playerAPIReady = false;
553
+ this.consentGiven = true;
554
+ this.players = {};
555
+ this.minImageWidth = 0;
556
+ this.imageResolution = 150;
557
+ this.resizedImages = {};
558
+ this.needsResizing = [];
559
+ this.outOfPages = false;
560
+ this.isInitialized = false;
561
+ this.mostRecentlyLoadedPosts = [];
562
+ }
563
+
564
+ SbyFeed.prototype = {
565
+ init: function() {
566
+ var feed = this;
567
+ if ($(this.el).find('#sby_mod_error').length) {
568
+ $(this.el).prepend($(this.el).find('#sby_mod_error'));
569
+ }
570
+ if (this.settings.ajaxPostLoad) {
571
+ this.getNewPostSet();
572
+ } else {
573
+ this.afterInitialImagesLoaded();
574
+ //Only check the width once the resize event is over
575
+ }
576
+ var sby_delay = (function () {
577
+ var sby_timer = 0;
578
+ return function (sby_callback, sby_ms) {
579
+ clearTimeout(sby_timer);
580
+ sby_timer = setTimeout(sby_callback, sby_ms);
581
+ };
582
+ })();
583
+ jQuery(window).resize(function () {
584
+ sby_delay(function () {
585
+ feed.afterResize();
586
+ }, 500);
587
+ });
588
+ },
589
+ initLayout: function() {
590
+ this.initGalleryLayout();
591
+ this.initGrid();
592
+
593
+ },
594
+ initGalleryLayout: function() {
595
+ var $self = $(this.el),
596
+ feed = this;
597
+ if ($self.hasClass('sby_layout_gallery') && $self.find('.sby_player_outer_wrap').length) {
598
+ this.maybeRaiseSingleImageResolution($self.find('.sby_player_outer_wrap'), 0, true);
599
+ $self.find('.sby_player_outer_wrap .sby_video_thumbnail').off().click(function (event) {
600
+ event.preventDefault();
601
+ feed.onThumbnailClick($(this), true);
602
+ });
603
+
604
+ $self.mouseenter(function() {
605
+ if (!feed.canCreatePlayer()) {
606
+ return;
607
+ }
608
+ if (!$self.find('.sby_player_outer_wrap iframe').length) {
609
+ $self.addClass('sby_player_added').find('.sby_player_outer_wrap').addClass('sby_player_loading');
610
+ $self.find('.sby_player_outer_wrap .sby_video_thumbnail').find('.sby_loader').show().removeClass('sby_hidden');
611
+ feed.createPlayer('sby_player'+feed.index);
612
+ } else if (typeof feed.player === 'undefined' && feed.playerEagerLoaded()) {
613
+ feed.createPlayer('sby_player'+feed.index);
614
+ }
615
+ });
616
+
617
+ if (window.sbySemiEagerLoading) {
618
+ feed.createPlayer('sby_player'+feed.index);
619
+ }
620
+
621
+ }
622
+ },
623
+ initGrid: function() {
624
+ if (window.sbySemiEagerLoading && jQuery('#sby_lightbox').length) {
625
+ var feed = this;
626
+ playerID = 'sby_lb-player';
627
+ jQuery('#sby_lightbox').addClass('sby_video_lightbox');
628
+
629
+ var videoID = $(this.el).find('sby_item').first().attr('data-video-id'),
630
+ autoplay = sbyOptions.autoplay;
631
+ if (typeof window.sbyLightboxPlayer === 'undefined') {
632
+ var args = {
633
+ host: window.location.protocol + '//www.youtube-nocookie.com',
634
+ videoId: videoID,
635
+ playerVars: {
636
+ modestbranding: 1,
637
+ rel: 0,
638
+ autoplay: autoplay
639
+ },
640
+ events: {
641
+ 'onStateChange': function (data) {
642
+ var videoID = data.target.getVideoData()['video_id'];
643
+ feed.afterStateChange(playerID, videoID, data, $('#' + playerID).closest('.sby_video_thumbnail_wrap'));
644
+ }
645
+ }
646
+ };
647
+ feed.maybeAddCTA(playerID);
648
+
649
+ window.sbyLightboxPlayer = new window.YT.Player(playerID, args);
650
+ }
651
+ }
652
+ },
653
+ createPlayer: function(playerID,videoID,autoplay,args) {
654
+ var $self = $(this.el),
655
+ feed = this;
656
+ videoID = typeof videoID !== 'undefined' ? videoID : this.getVideoID($self.find('.sby_item').first());
657
+ autoplay = typeof autoplay !== 'undefined' ? autoplay : 0;
658
+
659
+ if (typeof args === 'undefined') {
660
+ args = {
661
+ host: window.location.protocol + '//www.youtube-nocookie.com',
662
+ videoId: videoID,
663
+ playerVars: {
664
+ modestbranding: 1,
665
+ rel: 0,
666
+ autoplay: autoplay
667
+ },
668
+ }
669
+ }
670
+ if (typeof args.events === 'undefined') {
671
+ args.events = {
672
+ 'onReady': function () {
673
+ $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');
674
+ if ($('#' + playerID).length && $('#' + playerID).closest('.sby_video_thumbnail_wrap').find('.sby_video_thumbnail').length) {
675
+ $('#' + playerID).closest('.sby_video_thumbnail_wrap').find('.sby_video_thumbnail').fadeTo(0, 'slow', function () {
676
+ $(this).css('z-index', -1);
677
+ $(this).find('.sby_loader').hide().addClass('sby_hidden');
678
+ $(this).closest('.sby_item').removeClass('sby_player_loading');
679
+ });
680
+ }
681
+ },
682
+ 'onStateChange': function(data) {
683
+ $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');
684
+ feed.afterStateChange(playerID,videoID,data,$('#' + playerID).closest('.sby_video_thumbnail_wrap'));
685
+ if (data.data !== 1) return;
686
+ if (typeof feed.players !== 'undefined') {
687
+ $self.find('.sby_item').each(function() {
688
+ var itemVidID = feed.getVideoID($(this));
689
+ if ($(this).find('iframe').length && (itemVidID !== videoID)) {
690
+ if (typeof feed.players[itemVidID] !== 'undefined' && typeof feed.players[itemVidID].pauseVideo === 'function') {
691
+ feed.players[itemVidID].pauseVideo();
692
+ }
693
+ }
694
+ });
695
+ }
696
+
697
+ },
698
+ }
699
+ }
700
+ if (window.sbyEagerLoading) {
701
+ var newPlayer = YT.get(playerID);
702
+ } else {
703
+ var newPlayer = new window.YT.Player(playerID, args);
704
+ }
705
+
706
+ this.maybeAddCTA(playerID);
707
+
708
+ if ($self.hasClass('sby_layout_list') && typeof this.players[videoID] === 'undefined') {
709
+ this.players[videoID] = newPlayer;
710
+ } else if (typeof this.player === 'undefined') {
711
+ this.player = newPlayer;
712
+ }
713
+
714
+ return newPlayer;
715
+ },
716
+ afterStateChange: function(playerID,videoID,data,$player) {
717
+ },
718
+ afterInitialImagesLoaded: function() {
719
+ this.initLayout();
720
+ this.loadMoreButtonInit();
721
+ this.hideExtraItemsForWidth();
722
+ this.beforeNewImagesRevealed();
723
+ this.revealNewImages();
724
+ this.afterNewImagesRevealed();
725
+ this.afterFeedSet();
726
+ this.sizePlayer();
727
+ this.sizeItems();
728
+ },
729
+ afterResize: function() {
730
+ this.setImageHeight();
731
+ this.setImageResolution();
732
+ this.maybeRaiseImageResolution();
733
+ this.setImageSizeClass();
734
+ this.sizePlayer();
735
+ this.sizeItems();
736
+ },
737
+ afterLoadMoreClicked: function($button) {
738
+ $button.find('.sby_loader').removeClass('sby_hidden');
739
+ $button.find('.sby_btn_text').addClass('sby_hidden');
740
+ $button.closest('.sb_youtube').find('.sby_num_diff_hide').addClass('sby_transition').removeClass('sby_num_diff_hide');
741
+ },
742
+ afterNewImagesLoaded: function() {
743
+ var $self = $(this.el),
744
+ feed = this;
745
+ this.beforeNewImagesRevealed();
746
+ this.revealNewImages();
747
+ this.afterNewImagesRevealed();
748
+ this.sizePlayer();
749
+ this.sizeItems();
750
+ setTimeout(function () {
751
+ //Hide the loader in the load more button
752
+ $self.find('.sby_loader').addClass('sby_hidden');
753
+ $self.find('.sby_btn_text').removeClass('sby_hidden');
754
+ feed.maybeRaiseImageResolution();
755
+ }, 500);
756
+ },
757
+ beforeNewImagesRevealed: function() {
758
+ this.setImageHeight();
759
+ this.maybeRaiseImageResolution(true);
760
+ this.setImageSizeClass();
761
+ },
762
+ afterFeedSet: function() {
763
+
764
+ },
765
+ sizePlayer: function() {
766
+ var $self = $(this.el),
767
+ feed = this;
768
+ if ($self.hasClass('sby_layout_gallery')) {
769
+ $playerThumbnail = $self.find('.sby_player_item').find('.sby_player_video_thumbnail');
770
+ var playerWidth = $playerThumbnail.innerWidth(),
771
+ newPlayerHeight = Math.floor(playerWidth * 9 / 16);
772
+ if (feed.settings.narrowPlayer) {
773
+ newPlayerHeight = Math.floor(playerWidth * 3 / 4);
774
+ }
775
+ $playerThumbnail.css('height',newPlayerHeight+'px').css('overflow','hidden');
776
+
777
+ } else if ($self.hasClass('sby_layout_list')) {
778
+ $self.find('.sby_item').each(function(){
779
+ $playerThumbnail = $(this).find('.sby_item_video_thumbnail');
780
+ var playerWidth = $playerThumbnail.innerWidth(),
781
+ newPlayerHeight = Math.floor(playerWidth * 9 / 16);
782
+ if (feed.settings.narrowPlayer) {
783
+ newPlayerHeight = Math.floor(playerWidth * 3 / 4);
784
+ }
785
+ $playerThumbnail.css('height',newPlayerHeight+'px').css('overflow','hidden');
786
+ });
787
+ }
788
+ },
789
+ sizeItems: function() {
790
+ var $self = $(this.el),
791
+ feed = this;
792
+ if (!$self.hasClass('sby_layout_list')) {
793
+ $self.find('.sby_item').find('.sby_item_video_thumbnail').each(function() {
794
+ if ($(this).hasClass('sby_imgLiquid_ready')) {
795
+ var thumbWidth = $(this).innerWidth(),
796
+ newThumbHeight = Math.floor(thumbWidth * 9 / 16);
797
+ $(this).css('height',newThumbHeight+'px').css('overflow','hidden');
798
+ }
799
+
800
+ });
801
+ }
802
+ },
803
+ revealNewImages: function() {
804
+ var $self = $(this.el),
805
+ feed = this;
806
+ this.applyImageLiquid();
807
+
808
+ // Call Custom JS if it exists
809
+ if (typeof sbyCustomJS == 'function') setTimeout(function(){ sbyCustomJS(); }, 100);
810
+
811
+ $self.find('.sby-screenreader').find('img').remove();
812
+
813
+ $self.find('.sby_item.sby_new').each(function (index) {
814
+ var $self = jQuery(this);
815
+
816
+ //Photo links
817
+ //If lightbox is disabled
818
+ $self.find('.sby_video_thumbnail').hover(function () {
819
+ jQuery(this).fadeTo(200, 0.85);
820
+ }, function () {
821
+ jQuery(this).stop().fadeTo(500, 1);
822
+ });
823
+ videoID = $self.attr('data-video-id');
824
+
825
+ if (window.sbyEagerLoading && feed.canCreatePlayer() && $('#sby_player_'+videoID).length) {
826
+ player = new YT.Player('sby_player_'+videoID, {
827
+ height: '100',
828
+ width: '100',
829
+ videoId: videoID,
830
+ playerVars: {
831
+ modestbranding: 1,
832
+ rel: 0,
833
+ autoplay: 0
834
+ },
835
+ events: {
836
+ 'onStateChange': function(data) {
837
+ var videoID = data.target.getVideoData()['video_id'];
838
+ if (data.data !== 1) return;
839
+ $self.find('.sby_item').each(function() {
840
+ var itemVidID = jQuery(this).attr('data-video-id');
841
+
842
+ if (jQuery(this).find('iframe').length && jQuery(data.target.a).attr('id') !== jQuery(this).find('iframe').attr('id')) {
843
+ YT.get('sby_player_'+itemVidID).pauseVideo();
844
+ }
845
+ });
846
+ }
847
+ }
848
+ });
849
+ }
850
+
851
+ $self.find('.sby_video_thumbnail').mouseenter(function() {
852
+ feed.onThumbnailEnter($(this), false);
853
+ });
854
+ $self.find('.sby_player_wrap').mouseleave(function() {
855
+ feed.onThumbnailLeave($(this), false);
856
+ });
857
+ //init click
858
+ $self.find('.sby_video_thumbnail').click(function(event) {
859
+ event.preventDefault();
860
+ feed.onThumbnailClick($(this), false);
861
+ });
862
+
863
+ // lightbox
864
+ if (feed.settings.lightboxEnabled) {
865
+ $self.find('.sby_video_thumbnail').attr('data-sby-lightbox',feed.index);
866
+ if (typeof sbyOptions !== 'undefined' && typeof sbyOptions.lightboxPlaceholder !== 'undefined') {
867
+ if (feed.settings.narrowPlayer) {
868
+ $self.find('.sby_video_thumbnail').attr('href',sbyOptions.lightboxPlaceholderNarrow);
869
+ } else {
870
+ $self.find('.sby_video_thumbnail').attr('href',sbyOptions.lightboxPlaceholder);
871
+ }
872
+ }
873
+ }
874
+ feed.afterItemRevealed($self);
875
+
876
+ // no info
877
+ if ($self.find('.sby_info_item').text().trim() === '') {
878
+ $self.find('.sby_info_item').addClass('sby_no_space');
879
+ }
880
+ }); //End .sby_item each
881
+
882
+ $self.find('.sby_player_item').each(function (index) {
883
+ var $self = jQuery(this);
884
+
885
+ feed.afterItemRevealed($self);
886
+ }); //End .sby_item each
887
+
888
+ //Remove the new class after 500ms, once the sorting is done
889
+ setTimeout(function () {
890
+ $self.find('.sby_item.sby_new').removeClass('sby_new');
891
+ //Loop through items and remove class to reveal them
892
+ var time = 10,
893
+ num = $self.find('.sby_transition').length;
894
+ $self.find('.sby_transition').each(function(index) {
895
+ var $sby_item_transition_el = jQuery(this);
896
+
897
+ setTimeout( function(){
898
+ $sby_item_transition_el.removeClass('sby_transition');
899
+ }, time);
900
+ time += 10;
901
+ });
902
+ }, 500);
903
+
904
+
905
+ },
906
+ afterItemRevealed: function() {
907
+
908
+ },
909
+ afterNewImagesRevealed: function() {
910
+ this.listenForVisibilityChange();
911
+ this.sendNeedsResizingToServer();
912
+ this.sendCheckWPPostsToServer();
913
+ if (!this.settings.imageLoadEnabled) {
914
+ $('.sby_no_resraise').removeClass('sby_no_resraise');
915
+ }
916
+
917
+ var evt = $.Event('sbyafterimagesloaded');
918
+ evt.el = $(this.el);
919
+ $(window).trigger(evt);
920
+ },
921
+ setResizedImages: function () {
922
+ if ($(this.el).find('.sby_resized_image_data').length
923
+ && typeof $(this.el).find('.sby_resized_image_data').attr('data-resized') !== 'undefined'
924
+ && $(this.el).find('.sby_resized_image_data').attr('data-resized').indexOf('{"') === 0) {
925
+ this.resizedImages = JSON.parse($(this.el).find('.sby_resized_image_data').attr('data-resized'));
926
+ $(this.el).find('.sby_resized_image_data').remove();
927
+ }
928
+ },
929
+ sendNeedsResizingToServer: function() {
930
+ var feed = this;
931
+ if (feed.needsResizing.length > 0 && feed.settings.resizingEnabled) {
932
+ var itemOffset = $(this.el).find('.sby_item').length;
933
+
934
+ var submitData = {
935
+ action: 'sby_resized_images_submit',
936
+ needs_resizing: feed.needsResizing,
937
+ offset: itemOffset,
938
+ feed_id: feed.settings.feedID,
939
+ atts: feed.settings.shortCodeAtts,
940
+ };
941
+ var onSuccess = function(data) {
942
+ if (data.trim().indexOf('{') === 0) {
943
+ var response = JSON.parse(data);
944
+ if (feed.settings.debugEnabled) {
945
+ console.log(response);
946
+ }
947
+ }
948
+ };
949
+ sbyAjax(submitData,onSuccess);
950
+ }
951
+ },
952
+ sendCheckWPPostsToServer: function() {
953
+ var feed = this;
954
+ if (feed.settings.checkWPPosts || feed.settings.singleCheckPosts) {
955
+ var feedID = typeof feed.settings.feedID !== 'undefined' ? feed.settings.feedID : 'sby_single',
956
+ posts = feed.mostRecentlyLoadedPosts;
957
+ feed.mostRecentlyLoadedPosts = [];
958
+ var submitData = {
959
+ action: 'sby_check_wp_submit',
960
+ feed_id: feedID,
961
+ atts: feed.settings.shortCodeAtts,
962
+ offset: ! $(this.el).hasClass('sby_layout_carousel') ? $(this.el).find('.sby_item').length : Math.floor(($(this.el).find('.sby_item').length / 2) -1),
963
+ posts: posts,
964
+ cache_all : feed.settings.cacheAll
965
+ };
966
+ var onSuccess = function(data) {
967
+ if (data.trim().indexOf('{') === 0) {
968
+ var response = JSON.parse(data);
969
+ if (feed.settings.debugEnabled) {
970
+ console.log(response);
971
+ }
972
+ feed.afterSendCheckWPPostsToServer(response);
973
+
974
+ }
975
+ };
976
+ sbyAjax(submitData,onSuccess);
977
+ }
978
+ },
979
+ afterSendCheckWPPostsToServer: function (response) {
980
+
981
+ },
982
+ loadMoreButtonInit: function () {
983
+ var $self = $(this.el),
984
+ feed = this;
985
+ $self.find('.sby_footer .sby_load_btn').off().on('click', function () {
986
+ feed.afterLoadMoreClicked(jQuery(this));
987
+ feed.getNewPostSet();
988
+ }); //End click event
989
+ },
990
+ getNewPostSet: function () {
991
+ var $self = $(this.el),
992
+ feed = this;
993
+ var itemOffset = $self.find('.sby_item').length,
994
+ submitData = {
995
+ action: 'sby_load_more_clicked',
996
+ offset: itemOffset,
997
+ feed_id: feed.settings.feedID,
998
+ atts: feed.settings.shortCodeAtts,
999
+ current_resolution: feed.imageResolution
1000
+ };
1001
+ var onSuccess = function (data) {
1002
+ if (data.trim().indexOf('{') === 0) {
1003
+ var response = JSON.parse(data),
1004
+ checkWPPosts = typeof response.feedStatus.checkWPPosts !== 'undefined' ? response.feedStatus.checkWPPosts : false;;
1005
+ if (feed.settings.debugEnabled) {
1006
+ console.log(response);
1007
+ }
1008
+ if (checkWPPosts) {
1009
+ feed.settings.checkWPPosts = true;
1010
+ } else {
1011
+ feed.settings.checkWPPosts = false;
1012
+ }
1013
+ feed.appendNewPosts(response.html);
1014
+ feed.addResizedImages(response.resizedImages);
1015
+ if (feed.settings.ajaxPostLoad) {
1016
+ feed.settings.ajaxPostLoad = false;
1017
+ feed.afterInitialImagesLoaded();
1018
+ } else {
1019
+ feed.afterNewImagesLoaded();
1020
+ }
1021
+
1022
+ if (!response.feedStatus.shouldPaginate) {
1023
+ feed.outOfPages = true;
1024
+ $self.find('.sby_load_btn').hide();
1025
+ } else {
1026
+ feed.outOfPages = false;
1027
+ }
1028
+
1029
+ $('.sby_no_js').removeClass('sby_no_js');
1030
+ }
1031
+
1032
+ };
1033
+ sbyAjax(submitData, onSuccess);
1034
+ },
1035
+ appendNewPosts: function (newPostsHtml) {
1036
+ var $self = $(this.el),
1037
+ feed = this;
1038
+ if ($self.find('.sby_items_wrap .sby_item').length) {
1039
+ $self.find('.sby_items_wrap .sby_item').last().after(newPostsHtml);
1040
+ } else {
1041
+ $self.find('.sby_items_wrap').append(newPostsHtml);
1042
+ }
1043
+ },
1044
+ addResizedImages: function (resizedImagesToAdd) {
1045
+ for (var imageID in resizedImagesToAdd) {
1046
+ this.resizedImages[imageID] = resizedImagesToAdd[imageID];
1047
+ }
1048
+ },
1049
+ setImageHeight: function() {
1050
+ },
1051
+ maybeRaiseSingleImageResolution: function ($item, index, forceChange) {
1052
+ var feed = this,
1053
+ imgSrcSet = feed.getImageUrls($item),
1054
+ currentUrl = $item.find('.sby_video_thumbnail > img').attr('src'),
1055
+ currentRes = 150,
1056
+ aspectRatio = 1, // all thumbnails are oriented the same so the best calculation uses 1
1057
+ forceChange = typeof forceChange !== 'undefined' ? forceChange : false;
1058
+
1059
+ if ($item.hasClass('sby_no_resraise')) {
1060
+ return;
1061
+ }
1062
+
1063
+ $.each(imgSrcSet, function (index, value) {
1064
+ if (value === currentUrl) {
1065
+ currentRes = parseInt(index);
1066
+ // If the image has already been changed to an existing real source, don't force the change
1067
+ forceChange = false;
1068
+ }
1069
+ });
1070
+ //Image res
1071
+ var newRes = 640;
1072
+ switch (feed.settings.imgRes) {
1073
+ case 'thumb':
1074
+ newRes = 120;
1075
+ break;
1076
+ case 'medium':
1077
+ newRes = 320;
1078
+ break;
1079
+ case 'large':
1080
+ newRes = 480;
1081
+ break;
1082
+ case 'full':
1083
+ newRes = 640;
1084
+ break;
1085
+ default:
1086
+ var minImageWidth = Math.max(feed.settings.autoMinRes,$item.find('.sby_video_thumbnail').innerWidth()),
1087
+ thisImageReplace = feed.getBestResolutionForAuto(minImageWidth, aspectRatio, $(this.el).find('sby_item').first());
1088
+ switch (thisImageReplace) {
1089
+ case 480:
1090
+ newRes = 480;
1091
+ break;
1092
+ case 320:
1093
+ newRes = 320;
1094
+ break;
1095
+ case 120:
1096
+ newRes = 120;
1097
+ break;
1098
+ }
1099
+ break;
1100
+ }
1101
+
1102
+ if (newRes > currentRes || currentUrl === feed.placeholderURL || forceChange) {
1103
+ if (feed.settings.debugEnabled) {
1104
+ var reason = currentUrl === feed.placeholderURL ? 'was placeholder' : 'too small';
1105
+ console.log('rais res for ' + currentUrl, reason);
1106
+ }
1107
+ var newUrl = imgSrcSet[newRes];
1108
+ $item.find('.sby_video_thumbnail > img').attr('src', newUrl);
1109
+ if ($item.find('.sby_video_thumbnail').hasClass('sby_imgLiquid_ready')) {
1110
+ $item.find('.sby_video_thumbnail').css('background-image', 'url("' + newUrl + '")');
1111
+ }
1112
+ }
1113
+
1114
+ $item.find('img').on('error', function () {
1115
+ if (!$(this).hasClass('sby_img_error')) {
1116
+ $(this).addClass('sby_img_error');
1117
+ var sourceFromAPI = ($(this).attr('src').indexOf('i.ytimg.com') > -1);
1118
+
1119
+ if (!sourceFromAPI) {
1120
+ if (typeof $(this).closest('.sby_video_thumbnail').attr('data-full-res') !== 'undefined') {
1121
+ //$(this).attr('src', $(this).closest('.sby_video_thumbnail').attr('data-full-res'));
1122
+ //$(this).closest('.sby_video_thumbnail').css('background-image', 'url(' + $(this).closest('.sby_video_thumbnail').attr('data-full-res') + ')');
1123
+ } else if ($(this).closest('.sby_video_thumbnail').attr('href') !== 'undefined') {
1124
+ //$(this).attr('src', $(this).closest('.sby_video_thumbnail').attr('href') + 'media?size=l');
1125
+ //$(this).closest('.sby_video_thumbnail').css('background-image', 'url(' + $(this).closest('.sby_video_thumbnail').attr('href') + 'media?size=l)');
1126
+ }
1127
+ } else {
1128
+ feed.settings.favorLocal = true;
1129
+ var srcSet = feed.getImageUrls($(this).closest('.sby_item'));
1130
+ if (typeof srcSet[640] !== 'undefined') {
1131
+ //$(this).attr('src', srcSet[640]);
1132
+ //$(this).closest('.sby_video_thumbnail').css('background-image', 'url(' + srcSet[640] + ')');
1133
+ }
1134
+ }
1135
+ setTimeout(function() {
1136
+ feed.afterResize();
1137
+ }, 1500)
1138
+ } else {
1139
+ console.log('unfixed error ' + $(this).attr('src'));
1140
+ }
1141
+ });
1142
+ },
1143
+ maybeRaiseImageResolution: function (justNew) {
1144
+ var feed = this,
1145
+ itemsSelector = typeof justNew !== 'undefined' && justNew === true ? '.sby_item.sby_new' : '.sby_item',
1146
+ forceChange = !feed.isInitialized ? true : false;
1147
+ $(feed.el).find(itemsSelector).each(function (index) {
1148
+ if (!$(this).hasClass('sby_num_diff_hide')
1149
+ && $(this).find('.sby_video_thumbnail').length
1150
+ && typeof $(this).find('.sby_video_thumbnail').attr('data-img-src-set') !== 'undefined') {
1151
+ feed.maybeRaiseSingleImageResolution($(this),index,forceChange);
1152
+ }
1153
+ }); //End .sby_item each
1154
+ feed.isInitialized = true;
1155
+ },
1156
+ getBestResolutionForAuto: function(colWidth, aspectRatio, $item) {
1157
+ if (isNaN(aspectRatio) || aspectRatio < 1) {
1158
+ aspectRatio = 1;
1159
+ }
1160
+ var bestWidth = colWidth * aspectRatio,
1161
+ bestWidthRounded = Math.ceil(bestWidth / 10) * 10,
1162
+ customSizes = [120, 320, 480, 640];
1163
+
1164
+ if ($item.hasClass('sby_highlighted')) {
1165
+ bestWidthRounded = bestWidthRounded *2;
1166
+ }
1167
+
1168
+ if (customSizes.indexOf(parseInt(bestWidthRounded)) === -1) {
1169
+ var done = false;
1170
+ $.each(customSizes, function (index, item) {
1171
+ if (item > parseInt(bestWidthRounded) && !done) {
1172
+ bestWidthRounded = item;
1173
+ done = true;
1174
+ }
1175
+ });
1176
+ }
1177
+
1178
+ return bestWidthRounded;
1179
+ },
1180
+ hideExtraItemsForWidth: function() {
1181
+ if (this.layout === 'carousel') {
1182
+ return;
1183
+ }
1184
+ var $self = $(this.el),
1185
+ num = typeof $self.attr('data-num') !== 'undefined' && $self.attr('data-num') !== '' ? parseInt($self.attr('data-num')) : 1,
1186
+ nummobile = typeof $self.attr('data-nummobile') !== 'undefined' && $self.attr('data-nummobile') !== '' ? parseInt($self.attr('data-nummobile')) : num;
1187
+
1188
+ if (!$self.hasClass('.sby_layout_carousel')) {
1189
+ if ($(window).width() < 480) {
1190
+ if (nummobile < $self.find('.sby_item').length) {
1191
+ $self.find('.sby_item').slice(nummobile - $self.find('.sby_item').length).addClass('sby_num_diff_hide');
1192
+ }
1193
+ } else {
1194
+ if (num < $self.find('.sby_item').length) {
1195
+ $self.find('.sby_item').slice(num - $self.find('.sby_item').length).addClass('sby_num_diff_hide');
1196
+ }
1197
+ }
1198
+ }
1199
+
1200
+ },
1201
+ setImageSizeClass: function () {
1202
+ var $self = $(this.el);
1203
+ $self.removeClass('sby_small sby_medium');
1204
+ var feedWidth = $self.innerWidth(),
1205
+ photoPadding = parseInt(($self.find('.sby_items_wrap').outerWidth() - $self.find('.sby_items_wrap').width())) / 2,
1206
+ cols = this.getColumnCount(),
1207
+ feedWidthSansPadding = feedWidth - (photoPadding * (cols+2)),
1208
+ colWidth = (feedWidthSansPadding / cols);
1209
+
1210
+ if (colWidth > 140 && colWidth < 240) {
1211
+ $self.addClass('sby_medium');
1212
+ } else if (colWidth <= 140) {
1213
+ $self.addClass('sby_small');
1214
+ }
1215
+ },
1216
+ setMinImageWidth: function () {
1217
+ if ($(this.el).find('.sby_item .sby_video_thumbnail').first().length) {
1218
+ this.minImageWidth = $(this.el).find('.sby_item .sby_video_thumbnail').first().innerWidth();
1219
+ } else {
1220
+ this.minImageWidth = 150;
1221
+ }
1222
+ },
1223
+ setImageResolution: function () {
1224
+ if (this.settings.imgRes === 'auto') {
1225
+ this.imageResolution = 'auto';
1226
+ } else {
1227
+ switch (this.settings.imgRes) {
1228
+ case 'thumb':
1229
+ this.imageResolution = 150;
1230
+ break;
1231
+ case 'medium':
1232
+ this.imageResolution = 320;
1233
+ break;
1234
+ default:
1235
+ this.imageResolution = 640;
1236
+ }
1237
+ }
1238
+ },
1239
+ getImageUrls: function ($item) {
1240
+ var srcSet = JSON.parse($item.find('.sby_video_thumbnail').attr('data-img-src-set').replace(/\\\//g, '/')),
1241
+ id = $item.attr('id').replace('sby_', '').replace('player_','');
1242
+ if (typeof this.resizedImages[id] !== 'undefined'
1243
+ && this.resizedImages[id] !== 'video'
1244
+ && this.resizedImages[id] !== 'pending'
1245
+ && this.resizedImages[id].id !== 'error'
1246
+ && this.resizedImages[id].id !== 'video'
1247
+ && this.resizedImages[id].id !== 'pending') {
1248
+
1249
+ if (typeof this.resizedImages[id]['sizes'] !== 'undefined') {
1250
+ var foundSizes = [];
1251
+ if (typeof this.resizedImages[id]['sizes']['full'] !== 'undefined') {
1252
+ foundSizes.push(640);
1253
+ srcSet[640] = sbyOptions.resized_url + this.resizedImages[id].id + 'full.jpg';
1254
+ $item.find('.sby_link_area').attr( 'href', sbyOptions.resized_url + this.resizedImages[id].id + 'full.jpg' );
1255
+ $item.find('.sby_video_thumbnail').attr( 'data-full-res', sbyOptions.resized_url + this.resizedImages[id].id + 'full.jpg' );
1256
+ }
1257
+ if (typeof this.resizedImages[id]['sizes']['low'] !== 'undefined') {
1258
+ foundSizes.push(320);
1259
+ srcSet[320] = sbyOptions.resized_url + this.resizedImages[id].id + 'low.jpg';
1260
+ if (this.settings.favorLocal && typeof this.resizedImages[id]['sizes']['full'] === 'undefined') {
1261
+ $item.find('.sby_link_area').attr( 'href', sbyOptions.resized_url + this.resizedImages[id].id + 'low.jpg' );
1262
+ $item.find('.sby_video_thumbnail').attr( 'data-full-res', sbyOptions.resized_url + this.resizedImages[id].id + 'low.jpg' );
1263
+ }
1264
+ }
1265
+ if (typeof this.resizedImages[id]['sizes']['thumb'] !== 'undefined') {
1266
+ foundSizes.push(150);
1267
+ srcSet[150] = sbyOptions.resized_url + this.resizedImages[id].id + 'thumb.jpg';
1268
+ }
1269
+ if (this.settings.favorLocal) {
1270
+ if (foundSizes.indexOf(640) === -1) {
1271
+ if (foundSizes.indexOf(320) > -1) {
1272
+ srcSet[640] = sbyOptions.resized_url + this.resizedImages[id].id + 'low.jpg';
1273
+ }
1274
+ }
1275
+ if (foundSizes.indexOf(320) === -1) {
1276
+ if (foundSizes.indexOf(640) > -1) {
1277
+ srcSet[320] = sbyOptions.resized_url + this.resizedImages[id].id + 'full.jpg';
1278
+ } else if (foundSizes.indexOf(150) > -1) {
1279
+ srcSet[320] = sbyOptions.resized_url + this.resizedImages[id].id + 'thumb.jpg';
1280
+ }
1281
+ }
1282
+ if (foundSizes.indexOf(150) === -1) {
1283
+ if (foundSizes.indexOf(320) > -1) {
1284
+ srcSet[150] = sbyOptions.resized_url + this.resizedImages[id].id + 'low.jpg';
1285
+ } else if (foundSizes.indexOf(640) > -1) {
1286
+ srcSet[150] = sbyOptions.resized_url + this.resizedImages[id].id + 'full.jpg';
1287
+ }
1288
+ }
1289
+ }
1290
+ }
1291
+ } else if (typeof this.resizedImages[id] === 'undefined'
1292
+ || (typeof this.resizedImages[id]['id'] !== 'undefined' && this.resizedImages[id]['id'] !== 'pending' && this.resizedImages[id]['id'] !== 'error')) {
1293
+ this.addToNeedsResizing(id);
1294
+ }
1295
+
1296
+ return srcSet;
1297
+ },
1298
+ getVideoID: function ($el) {
1299
+ if ($el.hasClass('sby_item') || $el.hasClass('sby_player_item')) {
1300
+ if (typeof $el.find('.sby_video_thumbnail').attr('data-video-id') !== 'undefined') {
1301
+ return $el.find('.sby_video_thumbnail').attr('data-video-id');
1302
+ }
1303
+ } else if ($el.closest('sby_item').length || $el.closest('sby_player_item').length) {
1304
+ var $targeEl = $el.closest('sby_item').length ? $el.closest('sby_item') : $el.closest('sby_player_item');
1305
+ if (typeof $targeEl.find('.sby_video_thumbnail').attr('data-video-id') !== 'undefined') {
1306
+ return $targeEl.find('.sby_video_thumbnail').attr('data-video-id');
1307
+ }
1308
+ } else if ($el.hasClass('sb_youtube')) {
1309
+ return $el.find('.sby_item').first().find('.sby_video_thumbnail').attr('data-video-id');
1310
+ } else if ($(this.el).find('.sby_video_thumbnail').first().length && typeof $(this.el).find('.sby_video_thumbnail').first().attr('data-video-id') !== 'undefined'){
1311
+ return $(this.el).find('.sby_video_thumbnail').first().attr('data-video-id');
1312
+ }
1313
+ return '';
1314
+ },
1315
+ getAvatarUrl: function (username,favorType) {
1316
+ if (username === '') {
1317
+ return '';
1318
+ }
1319
+
1320
+ var availableAvatars = this.settings.general.avatars,
1321
+ favorType = typeof favorType !== 'undefined' ? favorType : 'local';
1322
+
1323
+ if (favorType === 'local') {
1324
+ if (typeof availableAvatars['LCL'+username] !== 'undefined' && parseInt(availableAvatars['LCL'+username]) === 1) {
1325
+ return sbyOptions.resized_url + username + '.jpg';
1326
+ } else if (typeof availableAvatars[username] !== 'undefined') {
1327
+ return availableAvatars[username];
1328
+ } else {
1329
+ return '';
1330
+ }
1331
+ } else {
1332
+ if (typeof availableAvatars[username] !== 'undefined') {
1333
+ return availableAvatars[username];
1334
+ } else if (typeof availableAvatars['LCL'+username] !== 'undefined' && parseInt(availableAvatars['LCL'+username]) === 1) {
1335
+ return sbyOptions.resized_url + username + '.jpg';
1336
+ } else {
1337
+ return '';
1338
+ }
1339
+ }
1340
+ },
1341
+ addToNeedsResizing: function (id) {
1342
+ if (this.needsResizing.indexOf(id) === -1) {
1343
+ this.needsResizing.push(id);
1344
+ }
1345
+ },
1346
+ applyImageLiquid: function () {
1347
+ var $self = $(this.el),
1348
+ feed = this;
1349
+ sbyAddImgLiquid();
1350
+ if (typeof $self.find(".sby_player_item").sby_imgLiquid == 'function') {
1351
+ if ($self.find('.sby_player_item').length) {
1352
+ $self.find(".sby_player_item .sby_player_video_thumbnail").sby_imgLiquid({fill: true});
1353
+ }
1354
+ $self.find(".sby_item .sby_item_video_thumbnail").sby_imgLiquid({fill: true});
1355
+ }
1356
+ },
1357
+ listenForVisibilityChange: function() {
1358
+ var feed = this;
1359
+ sbyAddVisibilityListener();
1360
+ if (typeof $(this.el).filter(':hidden').sbyVisibilityChanged == 'function') {
1361
+ //If the feed is initially hidden (in a tab for example) then check for when it becomes visible and set then set the height
1362
+ $(this.el).filter(':hidden').sbyVisibilityChanged({
1363
+ callback: function (element, visible) {
1364
+ feed.afterResize();
1365
+ },
1366
+ runOnLoad: false
1367
+ });
1368
+ }
1369
+ },
1370
+ getColumnCount: function() {
1371
+ var $self = $(this.el),
1372
+ cols = this.settings.cols,
1373
+ colsmobile = this.settings.colsmobile,
1374
+ returnCols = cols;
1375
+
1376
+ sbyWindowWidth = window.innerWidth;
1377
+
1378
+ if ($self.hasClass('sby_mob_col_auto')) {
1379
+ if (sbyWindowWidth < 640 && (parseInt(cols) > 2 && parseInt(cols) < 7)) returnCols = 2;
1380
+ if (sbyWindowWidth < 640 && (parseInt(cols) > 6 && parseInt(cols) < 11)) returnCols = 4;
1381
+ if (sbyWindowWidth <= 480 && parseInt(cols) > 2) returnCols = 1;
1382
+ } else if (sbyWindowWidth <= 480) {
1383
+ returnCols = colsmobile;
1384
+ }
1385
+
1386
+ return parseInt(returnCols);
1387
+ },
1388
+ onThumbnailClick: function($clicked,isPlayer,videoID) {
1389
+ if (!this.canCreatePlayer()) {
1390
+ return;
1391
+ }
1392
+ var $self = $(this.el);
1393
+ if ($self.hasClass('sby_layout_gallery')) {
1394
+
1395
+ $self.addClass('sby_player_added').find('.sby_player_outer_wrap').addClass('sby_player_loading');
1396
+ $self.find('.sby_player_outer_wrap .sby_video_thumbnail').find('.sby_loader').show().removeClass('sby_hidden');
1397
+ if (!$self.find('.sby_player_outer_wrap iframe').length) {
1398
+ if (isPlayer) {
1399
+ this.createPlayer('sby_player'+this.index);
1400
+ } else {
1401
+ var videoID = typeof videoID === 'undefined' ? this.getVideoID($clicked.closest('.sby_item')) : videoID;
1402
+ this.createPlayer('sby_player'+this.index,videoID);
1403
+ }
1404
+ } else {
1405
+ if (isPlayer) {
1406
+ var videoID = typeof videoID === 'undefined' ? this.getVideoID($self.find('.sby_item').first()) : videoID;
1407
+
1408
+ this.playVideoInPlayer(videoID);
1409
+ } else {
1410
+ var videoID = typeof videoID === 'undefined' ? this.getVideoID($clicked.closest('.sby_item')) : videoID;
1411
+
1412
+ this.changePlayerInfo($clicked.closest('.sby_item'));
1413
+ this.playVideoInPlayer(videoID);
1414
+ this.afterVideoChanged();
1415
+ }
1416
+ }
1417
+
1418
+ } else if ($(this.el).hasClass('sby_layout_grid') || $(this.el).hasClass('sby_layout_carousel')) {
1419
+ var $sbyItem = $clicked.closest('.sby_item'),
1420
+ videoID = typeof videoID === 'undefined' ? this.getVideoID($sbyItem) : videoID;
1421
+ this.playVideoInPlayer(videoID);
1422
+ this.afterVideoChanged();
1423
+ } else if ($(this.el).hasClass('sby_layout_list')) {
1424
+ var $sbyItem = $clicked.closest('.sby_item'),
1425
+ videoID = typeof videoID === 'undefined' ? this.getVideoID($sbyItem) : videoID;
1426
+ if ($sbyItem.length && !$sbyItem.find('iframe').length) {
1427
+ $sbyItem.find('.sby_loader').show().removeClass('sby_hidden');
1428
+ $sbyItem.addClass('sby_player_loading sby_player_loaded');
1429
+ this.createPlayer('sby_player_'+videoID,videoID);
1430
+ } else {
1431
+ this.playVideoInPlayer(videoID,$sbyItem.attr('data-video-id'));
1432
+ this.afterVideoChanged();
1433
+ }
1434
+ }
1435
+ },
1436
+ onThumbnailEnter: function($hovered) {
1437
+ if (!this.canCreatePlayer()) {
1438
+ return;
1439
+ }
1440
+ var $self = $(this.el);
1441
+ if ($self.hasClass('sby_layout_list')) {
1442
+ var $sbyItem = $hovered.closest('.sby_item'),
1443
+ videoID = this.getVideoID($sbyItem);
1444
+ if (!$sbyItem.find('iframe').length) {
1445
+ $sbyItem.find('.sby_loader').show().removeClass('sby_hidden');
1446
+ $sbyItem.addClass('sby_player_loading sby_player_loaded');
1447
+ this.createPlayer('sby_player_'+videoID,videoID,0);
1448
+ }
1449
+ }
1450
+ },
1451
+ onThumbnailLeave: function($hovered) {
1452
+ },
1453
+ changePlayerInfo: function($newItem) {
1454
+
1455
+ },
1456
+ playerEagerLoaded: function() {
1457
+ if (typeof this.player !== 'undefined' || $(this.el).hasClass('sby_player_loaded')) {
1458
+ return true;
1459
+ }
1460
+ },
1461
+ canCreatePlayer: function() {
1462
+ if ($(this.el).find('#sby_blank').length) {
1463
+ return false;
1464
+ }
1465
+ return this.playerEagerLoaded() || (this.playerAPIReady && this.consentGiven) || (window.sbyAPIReady && this.consentGiven);
1466
+ },
1467
+ playVideoInPlayer: function(videoID,playerID) {
1468
+ if (typeof this.player !== 'undefined' && typeof this.player.loadVideoById !== 'undefined') {
1469
+ this.player.loadVideoById(videoID);
1470
+ } else if (typeof window.sbyLightboxPlayer !== 'undefined'
1471
+ && typeof window.sbyLightboxPlayer.loadVideoById !== 'undefined') {
1472
+ window.sbyLightboxPlayer.loadVideoById(videoID);
1473
+ } else if (typeof playerID !== 'undefined'
1474
+ && typeof this.players !== 'undefined'
1475
+ && typeof this.players[playerID] !== 'undefined'
1476
+ && typeof this.players[playerID].loadVideoById !== 'undefined') {
1477
+ this.players[playerID].loadVideoById(videoID);
1478
+ }
1479
+ },
1480
+ afterVideoChanged: function() {
1481
+ if ($(this.el).hasClass('sby_layout_gallery')) {
1482
+ $(this.el).find('.sby_player_outer_wrap').removeClass('sby_player_loading');
1483
+ $(this.el).find('.sby_player_outer_wrap .sby_video_thumbnail').find('.sby_loader').hide().addClass('sby_hidden');
1484
+
1485
+ if ($(window).width() < 480) {
1486
+ $('html, body').animate({
1487
+ scrollTop: $(this.el).find('.sby_player_outer_wrap').offset().top
1488
+ }, 300);
1489
+ }
1490
+
1491
+ }
1492
+ },
1493
+ maybeAddCTA: function(playerID,$el) {
1494
+ }
1495
+ };
1496
+
1497
+ function SbyLightboxBuilder() {}
1498
+
1499
+ SbyLightboxBuilder.prototype = {
1500
+ getData: function(a){
1501
+ var closestFeedIndex = parseInt(a.closest('.sb_youtube').attr('data-sby-index')-1);
1502
+ return {
1503
+ feedIndex : closestFeedIndex,
1504
+ link: a.attr("href"),
1505
+ video: a.attr("data-video-id")
1506
+ }
1507
+ },
1508
+ template: function () {
1509
+ return "<div id='sby_lightboxOverlay' class='sby_lightboxOverlay'></div>"+
1510
+ "<div id='sby_lightbox' class='sby_lightbox'>"+
1511
+ "<div class='sby_lb-outerContainer'>"+
1512
+ "<div class='sby_lb-container'>"+
1513
+ "<img class='sby_lb-image' alt='Lightbox image placeholder' src='' />"+
1514
+ "<div class='sby_lb-player sby_lb-player-placeholder' id='sby_lb-player'></div>" +
1515
+ "<div class='sby_lb-nav'><a class='sby_lb-prev' href='#' ><p class='sby-screenreader'>Previous Slide</p><span></span></a><a class='sby_lb-next' href='#' ><p class='sby-screenreader'>Next Slide</p><span></span></a></div>"+
1516
+ "<div class='sby_lb-loader'><a class='sby_lb-cancel'></a></div>"+
1517
+ "</div>"+
1518
+ "</div>"+
1519
+ "<div class='sby_lb-dataContainer'>"+
1520
+ "<div class='sby_lb-data'>"+
1521
+ "<div class='sby_lb-details'>"+
1522
+ "<div class='sby_lb-caption'></div>"+
1523
+ "<div class='sby_lb-info'>"+
1524
+ "<div class='sby_lb-number'></div>"+
1525
+ "</div>"+
1526
+ "</div>"+
1527
+ "<div class='sby_lb-closeContainer'><a class='sby_lb-close'></a></div>"+
1528
+ "</div>"+
1529
+ "</div>"+
1530
+ "</div>";
1531
+ },
1532
+ beforePlayerSetup: function($lightbox,data,index,album,feed){
1533
+
1534
+ },
1535
+ afterPlayerSetup: function ($lightbox,data,index,album) {
1536
+ },
1537
+ afterResize: function(){
1538
+ var playerHeight = $('#sby_lightbox .sby_lb-player').height();
1539
+
1540
+ if (playerHeight > 100) {
1541
+ var heightDif = $('#sby_lightbox .sby_lb-outerContainer').height() - playerHeight;
1542
+ if (heightDif > 10) {
1543
+ $('#sby_lightbox .sby_lb-player').css('top',heightDif/2);
1544
+ }
1545
+ }
1546
+ },
1547
+ pausePlayer: function () {
1548
+ if (typeof YT.get('sby_lb-player') !== 'undefined' && typeof YT.get('sby_lb-player').pauseVideo === 'function') {
1549
+ YT.get('sby_lb-player').pauseVideo()
1550
+ } else if (typeof window.sbyLightboxPlayer !== 'undefined' && typeof window.sbyLightboxPlayer.pauseVideo === 'function') {
1551
+ window.sbyLightboxPlayer.pauseVideo();
1552
+ }
1553
+
1554
+ }
1555
+ };
1556
+
1557
+ window.sby_init = function() {
1558
+ window.sby = new Sby();
1559
+ window.sby.createPage( window.sby.createFeeds, {whenFeedsCreated: window.sby.afterFeedsCreated});
1560
+ };
1561
+
1562
+ function sbyGetNewFeed(feed,index,feedOptions) {
1563
+ return new SbyFeed(feed,index,feedOptions);
1564
+ }
1565
+
1566
+ function sbyGetlightboxBuilder() {
1567
+ return new SbyLightboxBuilder();
1568
+ }
1569
+
1570
+ function sbyAjax(submitData,onSuccess) {
1571
+ $.ajax({
1572
+ url: sbyOptions.adminAjaxUrl,
1573
+ type: 'post',
1574
+ data: submitData,
1575
+ success: onSuccess
1576
+ });
1577
+ }
1578
+
1579
+ function sbyIsTouch() {
1580
+ if ("ontouchstart" in document.documentElement) {
1581
+ return true;
1582
+ }
1583
+ return false;
1584
+ }
1585
+
1586
+ })(jQuery);
1587
+
1588
+ if (typeof window.sbyEagerLoading === 'undefined') {
1589
+ window.sbyEagerLoading = typeof window.sbyOptions !== 'undefined' ? window.sbyOptions.eagerload : false;
1590
+ if (jQuery('div[data-vc-video-bg]').length) {
1591
+ window.sbyEagerLoading = true;
1592
+ }
1593
+ }
1594
+ if (typeof window.sbySemiEagerLoading === 'undefined') {
1595
+ window.sbySemiEagerLoading = typeof window.sbyOptions !== 'undefined' ? window.sbyOptions.semiEagerload : false;
1596
+ if (jQuery('div[data-vc-video-bg]').length || window.sbyEagerLoading) {
1597
+ window.sbySemiEagerLoading = false;
1598
+ }
1599
+ }
1600
+
1601
+ jQuery(document).ready(function($) {
1602
+ if (!window.sbySemiEagerLoading) {
1603
+ sby_init();
1604
+ }
1605
+ });
1606
+
1607
+ } // if sby_js_exists
1608
+
1609
+ if (window.sbySemiEagerLoading) {
1610
+ var sbyYScriptId = "sby-youtube-api";
1611
+ var sbyYScript = document.getElementById(sbyYScriptId);
1612
+
1613
+ if (sbyYScript === null) {
1614
+ var tag = document.createElement("script");
1615
+ var firstScript = document.getElementsByTagName("script")[0];
1616
+
1617
+ tag.src = "https://www.youtube.com/iframe_api";
1618
+ tag.id = sbyYScriptId;
1619
+ firstScript.parentNode.insertBefore(tag, firstScript);
1620
+
1621
+ }
1622
+ }
1623
+
1624
+ window.onYouTubeIframeAPIReady = function() {
1625
+ var numFeeds = document.getElementsByClassName('sb_youtube').length;
1626
+ if (numFeeds > 0) {
1627
+ if (window.sbySemiEagerLoading) {
1628
+ if (typeof window.sby !== 'undefined') {
1629
+ for (var i = 0; i < numFeeds; i++) {
1630
+ window.sby.feeds[i].playerAPIReady = true;
1631
+ }
1632
+ } else {
1633
+ window.sbyAPIReady = true;
1634
+ }
1635
+ sby_init();
1636
+ } else {
1637
+ jQuery('.sb_youtube').each(function(index) {
1638
+ var $self = jQuery(this);
1639
+ if ($self.find('.sby_live_player').length) {
1640
+ player = new YT.Player($self.find('.sby_live_player').attr('id'), {
1641
+ events: {
1642
+ 'onReady': function () {
1643
+ $self.find('.sby_live_player').hide();
1644
+ $self.find('.sby_item').remove();
1645
+ var videoID = YT.get($self.find('.sby_live_player').attr('id')).getVideoData().video_id;
1646
+ $self.find('.sby_player_video_thumbnail').attr('data-video-id',videoID).css('z-index',-1);
1647
+ var itemOffset = $self.find('.sby_item').length,
1648
+ submitData = {
1649
+ action: 'sby_live_retrieve',
1650
+ video_id: videoID,
1651
+ feed_id: $self.attr('data-feedid'),
1652
+ atts: $self.attr('data-shortcode-atts'),
1653
+ };
1654
+ var onSuccess = function (data) {
1655
+ if (data.trim().indexOf('{') === 0) {
1656
+ var feed = window.sby.feeds[index],
1657
+ response = JSON.parse(data),
1658
+ checkWPPosts = typeof response.feedStatus.checkWPPosts !== 'undefined' ? response.feedStatus.checkWPPosts : false;
1659
+ if (feed.settings.debugEnabled) {
1660
+ console.log(response);
1661
+ }
1662
+ if (checkWPPosts) {
1663
+ feed.settings.checkWPPosts = true;
1664
+ } else {
1665
+ feed.settings.checkWPPosts = false;
1666
+ }
1667
+ feed.appendNewPosts(response.html);
1668
+ feed.addResizedImages(response.resizedImages);
1669
+
1670
+ feed.afterInitialImagesLoaded();
1671
+
1672
+ if (!response.feedStatus.shouldPaginate) {
1673
+ feed.outOfPages = true;
1674
+ $self.find('.sby_load_btn').hide();
1675
+ } else {
1676
+ feed.outOfPages = false;
1677
+ }
1678
+
1679
+ jQuery('.sby_no_js').removeClass('sby_no_js');
1680
+ $self.find('.sby_live_player').remove();
1681
+ if ($self.hasClass('sby_layout_gallery')) {
1682
+ feed.createPlayer('sby_player'+feed.index);
1683
+ }
1684
+ $self.find('.sby_player_item').css('opacity',1);
1685
+ $self.find('.sby_item').css('opacity',1);
1686
+ $self.find('.sby_player_loading').removeClass('sby_player_loading');
1687
+ if ($self.hasClass('sby_layout_list')) {
1688
+ $self.find('.sby_item_video_thumbnail').mouseenter(function() {
1689
+ jQuery(this).css('z-index',-1);
1690
+ })
1691
+ }
1692
+
1693
+ }
1694
+
1695
+ };
1696
+ jQuery.ajax({
1697
+ url: sbyOptions.adminAjaxUrl,
1698
+ type: 'post',
1699
+ data: submitData,
1700
+ success: onSuccess
1701
+ });
1702
+ }
1703
+ }
1704
+ });
1705
+ }
1706
+ });
1707
+
1708
+ if (window.sbyEagerLoading) {
1709
+ var flagLightbox = false,
1710
+ autoplay = false;
1711
+
1712
+ jQuery('.sb_youtube').each(function(index) {
1713
+ var $self = jQuery(this);
1714
+
1715
+ if ($self.hasClass('sby_layout_list')) {
1716
+ jQuery(this).addClass('sby_player_loaded');
1717
+
1718
+ $self.find('.sby_item').each(function() {
1719
+ videoID = jQuery(this).attr('data-video-id');
1720
+ //this.createPlayer(,videoID,0);
1721
+ player = new YT.Player('sby_player_'+videoID, {
1722
+ height: '100',
1723
+ width: '100',
1724
+ videoId: videoID,
1725
+ playerVars: {
1726
+ modestbranding: 1,
1727
+ rel: 0,
1728
+ autoplay: autoplay
1729
+ },
1730
+ events: {
1731
+ 'onStateChange': function(data) {
1732
+ var videoID = data.target.getVideoData()['video_id'];
1733
+ if (data.data !== 1) return;
1734
+ $self.find('.sby_item').each(function() {
1735
+ var itemVidID = jQuery(this).attr('data-video-id');
1736
+
1737
+ if (jQuery(this).find('iframe').length && itemVidID !== jQuery(this).find('iframe').attr('id').replace('sby_player_','')) {
1738
+ YT.get('sby_player_'+itemVidID).pauseVideo();
1739
+ }
1740
+ });
1741
+ }
1742
+ }
1743
+ });
1744
+ });
1745
+
1746
+ } else if ($self.hasClass('sby_layout_gallery')) {
1747
+ jQuery(this).addClass('sby_player_loaded');
1748
+
1749
+ player = new YT.Player('sby_player'+index, {
1750
+ height: '100',
1751
+ width: '100',
1752
+ videoId: jQuery(this).find('.sby_item').first().attr('data-video-id'),
1753
+ playerVars: {
1754
+ modestbranding: 1,
1755
+ rel: 0,
1756
+ autoplay: autoplay
1757
+ },
1758
+ events: {
1759
+ 'onStateChange': function(data) {
1760
+ var videoID = data.target.getVideoData()['video_id'];
1761
+ if (data.data !== 1) return;
1762
+ $self.find('.sby_item').each(function() {
1763
+ var itemVidID = jQuery(this).attr('data-video-id');
1764
+
1765
+ if (jQuery(this).find('iframe').length && jQuery(data.target.a).attr('id') !== jQuery(this).find('iframe').attr('id')) {
1766
+ YT.get('sby_player_'+itemVidID).pauseVideo();
1767
+ }
1768
+ });
1769
+ }
1770
+ }
1771
+ });
1772
+ } else {
1773
+ flagLightbox = true;
1774
+ }
1775
+ });
1776
+
1777
+ } else if (typeof window.sby !== 'undefined') {
1778
+ for (var i = 0; i < numFeeds; i++) {
1779
+ window.sby.feeds[i].playerAPIReady = true;
1780
+ }
1781
+ } else {
1782
+ window.sbyAPIReady = true;
1783
+ }
1784
+ }
1785
+
1786
+ if (flagLightbox) {
1787
+ if (!jQuery('#sby_lb-player').length) {
1788
+ jQuery('.sb_youtube').first().append('<div class="sby_lb-player-loaded sby_lb-player" id="sby_lb-player" style="display: none;"></div>');
1789
+ }
1790
+ player = new YT.Player('sby_lb-player', {
1791
+ height: '100',
1792
+ width: '100',
1793
+ videoId: jQuery(this).find('.sby_item').first().attr('data-video-id'),
1794
+ playerVars: {
1795
+ modestbranding: 1,
1796
+ rel: 0,
1797
+ autoplay: autoplay
1798
+ }
1799
+ });
1800
+ window.sbyLightboxPlayer = player;
1801
+ }
1802
+
1803
+ }
1804
+
1805
+ };
trunk/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(){var e,i,t,s=s||{VER:"0.9.944"};s.bgs_Available=!1,s.bgs_CheckRunned=!1,function(e){e.fn.extend({sby_imgLiquid:function(i){this.defaults={fill:!0,verticalAlign:"center",horizontalAlign:"center",useBackgroundSize:!0,useDataHtmlAttr:!0,responsive:!0,delay:0,fadeInTime:0,removeBoxBackground:!0,hardPixels:!0,responsiveCheckTime:500,timecheckvisibility:500,onStart:null,onFinish:null,onItemStart:null,onItemFinish:null,onItemError:null},function(){if(!s.bgs_CheckRunned){s.bgs_CheckRunned=!0;var i=e('<span style="background-size:cover" />');e("body").append(i),function(){var e=i[0];if(e&&window.getComputedStyle){var t=window.getComputedStyle(e,null);t&&t.backgroundSize&&(s.bgs_Available="cover"===t.backgroundSize)}}(),i.remove()}}();var t=this;return this.options=i,this.settings=e.extend({},this.defaults,this.options),this.settings.onStart&&this.settings.onStart(),this.each(function(i){function a(){(r.responsive||h.data("sby_imgLiquid_oldProcessed"))&&h.data("sby_imgLiquid_settings")&&(r=h.data("sby_imgLiquid_settings"),l.actualSize=l.get(0).offsetWidth+l.get(0).offsetHeight/1e4,l.sizeOld&&l.actualSize!==l.sizeOld&&o(),l.sizeOld=l.actualSize,setTimeout(a,r.responsiveCheckTime))}function n(){h.data("sby_imgLiquid_error",!0),l.addClass("sby_imgLiquid_error"),r.onItemError&&r.onItemError(i,l,h),d()}function o(){var e,t,s,a,n,o,y,b,u=0,g=0,_=l.width(),f=l.height();void 0===h.data("owidth")&&h.data("owidth",h[0].width),void 0===h.data("oheight")&&h.data("oheight",h[0].height),r.fill===_/f>=h.data("owidth")/h.data("oheight")?(e="100%",t="auto",s=Math.floor(_),a=Math.floor(_*(h.data("oheight")/h.data("owidth")))):(e="auto",t="100%",s=Math.floor(f*(h.data("owidth")/h.data("oheight"))),a=Math.floor(f)),y=_-s,"left"===(n=r.horizontalAlign.toLowerCase())&&(g=0),"center"===n&&(g=.5*y),"right"===n&&(g=y),-1!==n.indexOf("%")&&((n=parseInt(n.replace("%",""),10))>0&&(g=y*n*.01)),b=f-a,"left"===(o=r.verticalAlign.toLowerCase())&&(u=0),"center"===o&&(u=.5*b),"bottom"===o&&(u=b),-1!==o.indexOf("%")&&((o=parseInt(o.replace("%",""),10))>0&&(u=b*o*.01)),r.hardPixels&&(e=s,t=a),h.css({width:e,height:t,"margin-left":Math.floor(g),"margin-top":Math.floor(u)}),h.data("sby_imgLiquid_oldProcessed")||(h.fadeTo(r.fadeInTime,1),h.data("sby_imgLiquid_oldProcessed",!0),r.removeBoxBackground&&l.css("background-image","none"),l.addClass("sby_imgLiquid_nobgSize"),l.addClass("sby_imgLiquid_ready")),r.onItemFinish&&r.onItemFinish(i,l,h),d()}function d(){i===t.length-1&&t.settings.onFinish&&t.settings.onFinish()}var r=t.settings,l=e(this),h=e("img:first",l);return h.length?(h.data("sby_imgLiquid_settings")?(l.removeClass("sby_imgLiquid_error").removeClass("sby_imgLiquid_ready"),r=e.extend({},h.data("sby_imgLiquid_settings"),t.options)):r=e.extend({},t.settings,function(){var e={};if(t.settings.useDataHtmlAttr){var i=l.attr("data-sby_imgLiquid-fill"),a=l.attr("data-sby_imgLiquid-horizontalAlign"),n=l.attr("data-sby_imgLiquid-verticalAlign");("true"===i||"false"===i)&&(e.fill=Boolean("true"===i)),void 0===a||"left"!==a&&"center"!==a&&"right"!==a&&-1===a.indexOf("%")||(e.horizontalAlign=a),void 0===n||"top"!==n&&"bottom"!==n&&"center"!==n&&-1===n.indexOf("%")||(e.verticalAlign=n)}return s.isIE&&t.settings.ieFadeInDisabled&&(e.fadeInTime=0),e}()),h.data("sby_imgLiquid_settings",r),r.onItemStart&&r.onItemStart(i,l,h),void(s.bgs_Available&&r.useBackgroundSize?(-1===l.css("background-image").indexOf(encodeURI(h.attr("src")))&&l.css({"background-image":'url("'+encodeURI(h.attr("src"))+'")'}),l.css({"background-size":r.fill?"cover":"contain","background-position":(r.horizontalAlign+" "+r.verticalAlign).toLowerCase(),"background-repeat":"no-repeat"}),e("a:first",l).css({display:"block",width:"100%",height:"100%"}),e("img",l).css({display:"none"}),r.onItemFinish&&r.onItemFinish(i,l,h),l.addClass("sby_imgLiquid_bgSize"),l.addClass("sby_imgLiquid_ready"),d()):function t(){if(h.data("oldSrc")&&h.data("oldSrc")!==h.attr("src")){var s=h.clone().removeAttr("style");return s.data("sby_imgLiquid_settings",h.data("sby_imgLiquid_settings")),h.parent().prepend(s),h.remove(),(h=s)[0].width=0,void setTimeout(t,10)}return h.data("sby_imgLiquid_oldProcessed")?void o():(h.data("sby_imgLiquid_oldProcessed",!1),h.data("oldSrc",h.attr("src")),e("img:not(:first)",l).css("display","none"),l.css({overflow:"hidden"}),h.fadeTo(0,0).removeAttr("width").removeAttr("height").css({visibility:"visible","max-width":"none","max-height":"none",width:"auto",height:"auto",display:"block"}),h.on("error",n),h[0].onerror=n,function e(){h.data("sby_imgLiquid_error")||h.data("sby_imgLiquid_loaded")||h.data("sby_imgLiquid_oldProcessed")||(l.is(":visible")&&h[0].complete&&h[0].width>0&&h[0].height>0?(h.data("sby_imgLiquid_loaded",!0),setTimeout(o,i*r.delay)):setTimeout(e,r.timecheckvisibility))}(),void a())}())):void n()})}})}(jQuery),e=s.injectCss,i=document.getElementsByTagName("head")[0],(t=document.createElement("style")).type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),i.appendChild(t)}function t(){this.feeds={},this.options=sbyOptions,this.isTouch=function(){if("ontouchstart"in document.documentElement)return!0;return!1}()}function s(e,i,t){this.el=e,this.index=i,this.settings=t,this.placeholderURL=window.sby.options.placeholder,t.narrowPlayer&&(this.placeholderURL=window.sby.options.placeholderNarrow),this.playerAPIReady=!1,this.consentGiven=!0,this.players={},this.minImageWidth=0,this.imageResolution=150,this.resizedImages={},this.needsResizing=[],this.outOfPages=!1,this.isInitialized=!1,this.mostRecentlyLoadedPosts=[]}function a(){}function n(i,t){e.ajax({url:sbyOptions.adminAjaxUrl,type:"post",data:i,success:t})}t.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="https://www.youtube.com/iframe_api",s.id="youtube-api",a.parentNode.insertBefore(s,a)}i(t)},createLightbox:function(){var i,t=new a,s=(i=0,function(e,t){clearTimeout(i),i=setTimeout(e,t)});jQuery(window).resize(function(){s(function(){t.afterResize()},200)}),function(){var i=jQuery,s=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}(),a=function(){function s(e){this.options=e,this.album=[],this.currentImageIndex=void 0,this.init()}return s.prototype.init=function(){this.enable(),this.build()},s.prototype.enable=function(){var e=this;i("body").on("click","a[data-sby-lightbox]",function(t){return e.start(i(t.currentTarget)),!1})},s.prototype.build=function(){var e=this;i(""+t.template()).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&&YT.get("sby_lb-player").pauseVideo(),jQuery("#sby_lightboxOverlay, #sby_lightbox").fadeOut())}),this.$lightbox.hide(),jQuery("#sby_lightboxOverlay").on("click",function(t){return void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").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&&YT.get("sby_lb-player").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&&YT.get("sby_lb-player").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&&YT.get("sby_lb-player").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&&YT.get("sby_lb-player").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&&YT.get("sby_lb-player").pauseVideo(),e.end(),!1})},s.prototype.start=function(e){function s(e){a.album.push(t.getData(e))}var a=this,n=i(window);n.on("resize",i.proxy(this.sizeOverlay,this)),i("select, object, embed").css({visibility:"hidden"}),this.sizeOverlay(),this.album=[];var o,d=0,r=e.attr("data-sby-lightbox");if(r){o=i(e.prop("tagName")+'[data-sby-lightbox="'+r+'"]');for(var l=0;l<o.length;l=++l)s(i(o[l])),o[l]===e[0]&&(d=l)}else if("lightbox"===e.attr("rel"))s(e);else{o=i(e.prop("tagName")+'[rel="'+e.attr("rel")+'"]');for(var h=0;h<o.length;h=++h)s(i(o[h])),o[h]===e[0]&&(d=h)}var y=n.scrollTop()+this.options.positionFromTop,b=n.scrollLeft();this.$lightbox.css({top:y+"px",left:b+"px"}).fadeIn(this.options.fadeDuration),this.changeImage(d)},s.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-100,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},s.prototype.sizeOverlay=function(){this.$overlay.width(i(window).width()).height(i(document).height())},s.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()},s.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()},s.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"))))},s.prototype.updateDetails=function(){var i=this;jQuery("iframe.sby_lb-player-loaded").length&&(jQuery(".sby_lb-player-placeholder").replaceWith(jQuery("iframe.sby_lb-player-loaded")),jQuery("iframe.sby_lb-player-loaded").removeClass("sby_lb-player-loaded").show());var s=window.sby.feeds[this.album[this.currentImageIndex].feedIndex];if(t.beforePlayerSetup(this.$lightbox,this.album[this.currentImageIndex],this.currentImageIndex,this.album,s),sby_supports_video()&&(jQuery("#sby_lightbox").removeClass("sby_video_lightbox"),this.album[this.currentImageIndex].video.length)){var a="sby_lb-player";jQuery("#sby_lightbox").addClass("sby_video_lightbox");var n=this.album[this.currentImageIndex].video,o=sbyOptions.autoplay;if(void 0===window.sbyLightboxPlayer){var d={host:window.location.protocol+"//www.youtube-nocookie.com",videoId:n,playerVars:{modestbranding:1,rel:0,autoplay:o},events:{onStateChange:function(i){var t=i.target.getVideoData().video_id;s.afterStateChange(a,t,i,e("#"+a).closest(".sby_video_thumbnail_wrap"))}}};s.maybeAddCTA(a),window.sbyLightboxPlayer=new window.YT.Player(a,d)}else window.sbyLightboxPlayer.loadVideoById(n);t.afterPlayerSetup(this.$lightbox,this.album[this.currentImageIndex],this.currentImageIndex,this.album),this.album.length>1&&this.options.showImageNumberLabel?this.$lightbox.find(".sby_lb-number").text(this.options.albumLabel(this.currentImageIndex+1,this.album.length)).fadeIn("fast"):this.$lightbox.find(".sby_lb-number").hide(),this.$outerContainer.removeClass("animating"),this.$lightbox.find(".sby_lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return i.sizeOverlay()}),setTimeout(function(){e("#sby_lightbox .sby_lb-player").css({height:e("#sby_lightbox .sby_lb-outerContainer").height()+"px",width:e("#sby_lightbox .sby_lb-outerContainer").width()+"px",top:0})},400)}},s.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)},s.prototype.enableKeyboardNav=function(){i(document).on("keyup.keyboard",i.proxy(this.keyboardAction,this))},s.prototype.disableKeyboardNav=function(){i(document).off(".keyboard")},s.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&&YT.get("sby_lb-player").pauseVideo())},s.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"})},s}();i(function(){var i=new s;new a(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 t=e(this),a=void 0!==t.attr("data-sby-flags")?t.attr("data-sby-flags").split(","):[],o=void 0!==t.attr("data-options")?JSON.parse(t.attr("data-options")):{};if(a.indexOf("testAjax")>-1){window.sby.triggeredTest=!0;n({action:"sby_on_ajax_test_trigger"},function(e){console.log("did test")})}var d={cols:t.attr("data-cols"),colsmobile:"same"!==t.attr("data-colsmobile")?t.attr("data-colsmobile"):t.attr("data-cols"),num:t.attr("data-num"),imgRes:t.attr("data-res"),feedID:t.attr("data-feedid"),shortCodeAtts:t.attr("data-shortcode-atts"),resizingEnabled:-1===a.indexOf("resizeDisable"),imageLoadEnabled:-1===a.indexOf("imageLoadDisable"),debugEnabled:a.indexOf("debug")>-1,favorLocal:a.indexOf("favorLocal")>-1,ajaxPostLoad:a.indexOf("ajaxPostLoad")>-1,checkWPPosts:a.indexOf("checkWPPosts")>-1,cacheAll:a.indexOf("cacheAll")>-1,lightboxEnabled:void 0!==t.attr("data-sby-supports-lightbox"),autoMinRes:1,general:o};window.sby.feeds[i]=function(e,i,t){return new s(e,i,t)}(this,i,d),void 0!==window.sbyAPIReady&&(window.sby.feeds[i].playerAPIReady=!0),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)}},s.prototype={init:function(){var i=this;e(this.el).find("#sby_mod_error").length&&e(this.el).prepend(e(this.el).find("#sby_mod_error")),this.settings.ajaxPostLoad?this.getNewPostSet():this.afterInitialImagesLoaded();var t,s=(t=0,function(e,i){clearTimeout(t),t=setTimeout(e,i)});jQuery(window).resize(function(){s(function(){i.afterResize()},500)})},initLayout:function(){this.initGalleryLayout(),this.initGrid()},initGalleryLayout: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?void 0===t.player&&t.playerEagerLoaded()&&t.createPlayer("sby_player"+t.index):(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)))}),window.sbySemiEagerLoading&&t.createPlayer("sby_player"+t.index))},initGrid:function(){if(window.sbySemiEagerLoading&&jQuery("#sby_lightbox").length){var i=this;playerID="sby_lb-player",jQuery("#sby_lightbox").addClass("sby_video_lightbox");var t=e(this.el).find("sby_item").first().attr("data-video-id"),s=sbyOptions.autoplay;if(void 0===window.sbyLightboxPlayer){var a={host:window.location.protocol+"//www.youtube-nocookie.com",videoId:t,playerVars:{modestbranding:1,rel:0,autoplay:s},events:{onStateChange:function(t){var s=t.target.getVideoData().video_id;i.afterStateChange(playerID,s,t,e("#"+playerID).closest(".sby_video_thumbnail_wrap"))}}};i.maybeAddCTA(playerID),window.sbyLightboxPlayer=new window.YT.Player(playerID,a)}}},createPlayer:function(i,t,s,a){var n=e(this.el),o=this;if(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(s){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"),o.afterStateChange(i,t,s,e("#"+i).closest(".sby_video_thumbnail_wrap")),1===s.data&&void 0!==o.players&&n.find(".sby_item").each(function(){var i=o.getVideoID(e(this));e(this).find("iframe").length&&i!==t&&void 0!==o.players[i]&&"function"==typeof o.players[i].pauseVideo&&o.players[i].pauseVideo()})}}),window.sbyEagerLoading)var d=YT.get(i);else d=new window.YT.Player(i,a);return this.maybeAddCTA(i),n.hasClass("sby_layout_list")&&void 0===this.players[t]?this.players[t]=d:void 0===this.player&&(this.player=d),d},afterStateChange:function(e,i,t,s){},afterInitialImagesLoaded:function(){this.initLayout(),this.loadMoreButtonInit(),this.hideExtraItemsForWidth(),this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed(),this.afterFeedSet(),this.sizePlayer(),this.sizeItems()},afterResize:function(){this.setImageHeight(),this.setImageResolution(),this.maybeRaiseImageResolution(),this.setImageSizeClass(),this.sizePlayer(),this.sizeItems()},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(),this.sizePlayer(),this.sizeItems(),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()},afterFeedSet:function(){},sizePlayer:function(){var i=e(this.el),t=this;if(i.hasClass("sby_layout_gallery")){$playerThumbnail=i.find(".sby_player_item").find(".sby_player_video_thumbnail");var s=$playerThumbnail.innerWidth(),a=Math.floor(9*s/16);t.settings.narrowPlayer&&(a=Math.floor(3*s/4)),$playerThumbnail.css("height",a+"px").css("overflow","hidden")}else i.hasClass("sby_layout_list")&&i.find(".sby_item").each(function(){$playerThumbnail=e(this).find(".sby_item_video_thumbnail");var i=$playerThumbnail.innerWidth(),s=Math.floor(9*i/16);t.settings.narrowPlayer&&(s=Math.floor(3*i/4)),$playerThumbnail.css("height",s+"px").css("overflow","hidden")})},sizeItems:function(){var i=e(this.el);i.hasClass("sby_layout_list")||i.find(".sby_item").find(".sby_item_video_thumbnail").each(function(){if(e(this).hasClass("sby_imgLiquid_ready")){var i=e(this).innerWidth(),t=Math.floor(9*i/16);e(this).css("height",t+"px").css("overflow","hidden")}})},revealNewImages:function(){var i=e(this.el),t=this;this.applyImageLiquid(),"function"==typeof sbyCustomJS&&setTimeout(function(){sbyCustomJS()},100),i.find(".sby-screenreader").find("img").remove(),i.find(".sby_item.sby_new").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)}),videoID=s.attr("data-video-id"),window.sbyEagerLoading&&t.canCreatePlayer()&&e("#sby_player_"+videoID).length&&(player=new YT.Player("sby_player_"+videoID,{height:"100",width:"100",videoId:videoID,playerVars:{modestbranding:1,rel:0,autoplay:0},events:{onStateChange:function(e){e.target.getVideoData().video_id;1===e.data&&s.find(".sby_item").each(function(){var i=jQuery(this).attr("data-video-id");jQuery(this).find("iframe").length&&jQuery(e.target.a).attr("id")!==jQuery(this).find("iframe").attr("id")&&YT.get("sby_player_"+i).pauseVideo()})}}})),s.find(".sby_video_thumbnail").mouseenter(function(){t.onThumbnailEnter(e(this),!1)}),s.find(".sby_player_wrap").mouseleave(function(){t.onThumbnailLeave(e(this),!1)}),s.find(".sby_video_thumbnail").click(function(i){i.preventDefault(),t.onThumbnailClick(e(this),!1)}),t.settings.lightboxEnabled&&(s.find(".sby_video_thumbnail").attr("data-sby-lightbox",t.index),"undefined"!=typeof sbyOptions&&void 0!==sbyOptions.lightboxPlaceholder&&(t.settings.narrowPlayer?s.find(".sby_video_thumbnail").attr("href",sbyOptions.lightboxPlaceholderNarrow):s.find(".sby_video_thumbnail").attr("href",sbyOptions.lightboxPlaceholder))),t.afterItemRevealed(s),""===s.find(".sby_info_item").text().trim()&&s.find(".sby_info_item").addClass("sby_no_space")}),i.find(".sby_player_item").each(function(e){var i=jQuery(this);t.afterItemRevealed(i)}),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)},afterItemRevealed:function(){},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;n({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||i.settings.singleCheckPosts){var t=void 0!==i.settings.feedID?i.settings.feedID:"sby_single",s=i.mostRecentlyLoadedPosts;i.mostRecentlyLoadedPosts=[];n({action:"sby_check_wp_submit",feed_id:t,atts:i.settings.shortCodeAtts,offset:e(this.el).hasClass("sby_layout_carousel")?Math.floor(e(this.el).find(".sby_item").length/2-1):e(this.el).find(".sby_item").length,posts:s,cache_all:i.settings.cacheAll},function(e){if(0===e.trim().indexOf("{")){var t=JSON.parse(e);i.settings.debugEnabled&&console.log(t),i.afterSendCheckWPPostsToServer(t)}})}},afterSendCheckWPPostsToServer:function(e){},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;n({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),n=void 0!==a.feedStatus.checkWPPosts&&a.feedStatus.checkWPPosts;t.settings.debugEnabled&&console.log(a),t.settings.checkWPPosts=!!n,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===a.placeholderURL||s){if(a.settings.debugEnabled){var h=o===a.placeholderURL?"was placeholder":"too small";console.log("rais res for "+o,h)}var y=n[r];i.find(".sby_video_thumbnail > img").attr("src",y),i.find(".sby_video_thumbnail").hasClass("sby_imgLiquid_ready")&&i.find(".sby_video_thumbnail").css("background-image",'url("'+y+'")')}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;i.hasClass(".sby_layout_carousel")||(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>140&&n<240?i.addClass("sby_medium"):n<=140&&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(i){if(i.hasClass("sby_item")||i.hasClass("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(i.closest("sby_item").length||i.closest("sby_player_item").length){var t=i.closest("sby_item").length?i.closest("sby_item"):i.closest("sby_player_item");if(void 0!==t.find(".sby_video_thumbnail").attr("data-video-id"))return t.find(".sby_video_thumbnail").attr("data-video-id")}else{if(i.hasClass("sb_youtube"))return i.find(".sby_item").first().find(".sby_video_thumbnail").attr("data-video-id");if(e(this.el).find(".sby_video_thumbnail").first().length&&void 0!==e(this.el).find(".sby_video_thumbnail").first().attr("data-video-id"))return e(this.el).find(".sby_video_thumbnail").first().attr("data-video-id")}return""},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)},applyImageLiquid:function(){var t=e(this.el);i(),"function"==typeof t.find(".sby_player_item").sby_imgLiquid&&(t.find(".sby_player_item").length&&t.find(".sby_player_item .sby_player_video_thumbnail").sby_imgLiquid({fill:!0}),t.find(".sby_item .sby_item_video_thumbnail").sby_imgLiquid({fill:!0}))},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,s){if(this.canCreatePlayer()){var a=e(this.el);if(a.hasClass("sby_layout_gallery"))if(a.addClass("sby_player_added").find(".sby_player_outer_wrap").addClass("sby_player_loading"),a.find(".sby_player_outer_wrap .sby_video_thumbnail").find(".sby_loader").show().removeClass("sby_hidden"),a.find(".sby_player_outer_wrap iframe").length)if(t){s=void 0===s?this.getVideoID(a.find(".sby_item").first()):s;this.playVideoInPlayer(s)}else{s=void 0===s?this.getVideoID(i.closest(".sby_item")):s;this.changePlayerInfo(i.closest(".sby_item")),this.playVideoInPlayer(s),this.afterVideoChanged()}else if(t)this.createPlayer("sby_player"+this.index);else{var s=void 0===s?this.getVideoID(i.closest(".sby_item")):s;this.createPlayer("sby_player"+this.index,s)}else if(e(this.el).hasClass("sby_layout_grid")||e(this.el).hasClass("sby_layout_carousel")){var n=i.closest(".sby_item");s=void 0===s?this.getVideoID(n):s;this.playVideoInPlayer(s),this.afterVideoChanged()}else if(e(this.el).hasClass("sby_layout_list")){n=i.closest(".sby_item"),s=void 0===s?this.getVideoID(n):s;n.length&&!n.find("iframe").length?(n.find(".sby_loader").show().removeClass("sby_hidden"),n.addClass("sby_player_loading sby_player_loaded"),this.createPlayer("sby_player_"+s,s)):(this.playVideoInPlayer(s,n.attr("data-video-id")),this.afterVideoChanged())}}},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){},changePlayerInfo:function(e){},playerEagerLoaded:function(){if(void 0!==this.player||e(this.el).hasClass("sby_player_loaded"))return!0},canCreatePlayer:function(){return!e(this.el).find("#sby_blank").length&&(this.playerEagerLoaded()||this.playerAPIReady&&this.consentGiven||window.sbyAPIReady&&this.consentGiven)},playVideoInPlayer:function(e,i){void 0!==this.player&&void 0!==this.player.loadVideoById?this.player.loadVideoById(e):void 0!==window.sbyLightboxPlayer&&void 0!==window.sbyLightboxPlayer.loadVideoById?window.sbyLightboxPlayer.loadVideoById(e):void 0!==i&&void 0!==this.players&&void 0!==this.players[i]&&void 0!==this.players[i].loadVideoById&&this.players[i].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))},maybeAddCTA:function(e,i){}},a.prototype={getData:function(e){return{feedIndex:parseInt(e.closest(".sb_youtube").attr("data-sby-index")-1),link:e.attr("href"),video:e.attr("data-video-id")}},template:function(){return"<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 sby_lb-player-placeholder' id='sby_lb-player'></div><div class='sby_lb-nav'><a class='sby_lb-prev' href='#' ><p class='sby-screenreader'>Previous Slide</p><span></span></a><a class='sby_lb-next' href='#' ><p class='sby-screenreader'>Next Slide</p><span></span></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></div><div class='sby_lb-closeContainer'><a class='sby_lb-close'></a></div></div></div></div>"},beforePlayerSetup:function(e,i,t,s,a){},afterPlayerSetup:function(e,i,t,s){},afterResize:function(){var i=e("#sby_lightbox .sby_lb-player").height();if(i>100){var t=e("#sby_lightbox .sby_lb-outerContainer").height()-i;t>10&&e("#sby_lightbox .sby_lb-player").css("top",t/2)}},pausePlayer:function(){void 0!==YT.get("sby_lb-player")&&"function"==typeof YT.get("sby_lb-player").pauseVideo?YT.get("sby_lb-player").pauseVideo():void 0!==window.sbyLightboxPlayer&&"function"==typeof window.sbyLightboxPlayer.pauseVideo&&window.sbyLightboxPlayer.pauseVideo()}},window.sby_init=function(){window.sby=new t,window.sby.createPage(window.sby.createFeeds,{whenFeedsCreated:window.sby.afterFeedsCreated})}}(jQuery),void 0===window.sbyEagerLoading&&(window.sbyEagerLoading=void 0!==window.sbyOptions&&window.sbyOptions.eagerload,jQuery("div[data-vc-video-bg]").length&&(window.sbyEagerLoading=!0)),void 0===window.sbySemiEagerLoading&&(window.sbySemiEagerLoading=void 0!==window.sbyOptions&&window.sbyOptions.semiEagerload,(jQuery("div[data-vc-video-bg]").length||window.sbyEagerLoading)&&(window.sbySemiEagerLoading=!1)),jQuery(document).ready(function(e){window.sbySemiEagerLoading||sby_init()})}if(window.sbySemiEagerLoading){var sbyYScriptId="sby-youtube-api",sbyYScript=document.getElementById(sbyYScriptId);if(null===sbyYScript){var tag=document.createElement("script"),firstScript=document.getElementsByTagName("script")[0];tag.src="https://www.youtube.com/iframe_api",tag.id=sbyYScriptId,firstScript.parentNode.insertBefore(tag,firstScript)}}window.onYouTubeIframeAPIReady=function(){var e=document.getElementsByClassName("sb_youtube").length;if(e>0){if(window.sbySemiEagerLoading){if(void 0!==window.sby)for(var i=0;i<e;i++)window.sby.feeds[i].playerAPIReady=!0;else window.sbyAPIReady=!0;sby_init()}else if(jQuery(".sb_youtube").each(function(e){var i=jQuery(this);i.find(".sby_live_player").length&&(player=new YT.Player(i.find(".sby_live_player").attr("id"),{events:{onReady:function(){i.find(".sby_live_player").hide(),i.find(".sby_item").remove();var t=YT.get(i.find(".sby_live_player").attr("id")).getVideoData().video_id;i.find(".sby_player_video_thumbnail").attr("data-video-id",t).css("z-index",-1);i.find(".sby_item").length;var s={action:"sby_live_retrieve",video_id:t,feed_id:i.attr("data-feedid"),atts:i.attr("data-shortcode-atts")};jQuery.ajax({url:sbyOptions.adminAjaxUrl,type:"post",data:s,success:function(t){if(0===t.trim().indexOf("{")){var s=window.sby.feeds[e],a=JSON.parse(t),n=void 0!==a.feedStatus.checkWPPosts&&a.feedStatus.checkWPPosts;s.settings.debugEnabled&&console.log(a),s.settings.checkWPPosts=!!n,s.appendNewPosts(a.html),s.addResizedImages(a.resizedImages),s.afterInitialImagesLoaded(),a.feedStatus.shouldPaginate?s.outOfPages=!1:(s.outOfPages=!0,i.find(".sby_load_btn").hide()),jQuery(".sby_no_js").removeClass("sby_no_js"),i.find(".sby_live_player").remove(),i.hasClass("sby_layout_gallery")&&s.createPlayer("sby_player"+s.index),i.find(".sby_player_item").css("opacity",1),i.find(".sby_item").css("opacity",1),i.find(".sby_player_loading").removeClass("sby_player_loading"),i.hasClass("sby_layout_list")&&i.find(".sby_item_video_thumbnail").mouseenter(function(){jQuery(this).css("z-index",-1)})}}})}}}))}),window.sbyEagerLoading){var t=!1,s=!1;jQuery(".sb_youtube").each(function(e){var i=jQuery(this);i.hasClass("sby_layout_list")?(jQuery(this).addClass("sby_player_loaded"),i.find(".sby_item").each(function(){videoID=jQuery(this).attr("data-video-id"),player=new YT.Player("sby_player_"+videoID,{height:"100",width:"100",videoId:videoID,playerVars:{modestbranding:1,rel:0,autoplay:s},events:{onStateChange:function(e){e.target.getVideoData().video_id;1===e.data&&i.find(".sby_item").each(function(){var e=jQuery(this).attr("data-video-id");jQuery(this).find("iframe").length&&e!==jQuery(this).find("iframe").attr("id").replace("sby_player_","")&&YT.get("sby_player_"+e).pauseVideo()})}}})})):i.hasClass("sby_layout_gallery")?(jQuery(this).addClass("sby_player_loaded"),player=new YT.Player("sby_player"+e,{height:"100",width:"100",videoId:jQuery(this).find(".sby_item").first().attr("data-video-id"),playerVars:{modestbranding:1,rel:0,autoplay:s},events:{onStateChange:function(e){e.target.getVideoData().video_id;1===e.data&&i.find(".sby_item").each(function(){var i=jQuery(this).attr("data-video-id");jQuery(this).find("iframe").length&&jQuery(e.target.a).attr("id")!==jQuery(this).find("iframe").attr("id")&&YT.get("sby_player_"+i).pauseVideo()})}}})):t=!0})}else if(void 0!==window.sby)for(i=0;i<e;i++)window.sby.feeds[i].playerAPIReady=!0;else window.sbyAPIReady=!0;t&&(jQuery("#sby_lb-player").length||jQuery(".sb_youtube").first().append('<div class="sby_lb-player-loaded sby_lb-player" id="sby_lb-player" style="display: none;"></div>'),player=new YT.Player("sby_lb-player",{height:"100",width:"100",videoId:jQuery(this).find(".sby_item").first().attr("data-video-id"),playerVars:{modestbranding:1,rel:0,autoplay:s}}),window.sbyLightboxPlayer=player)}};
trunk/js/sby-blocks.js ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+
3
+ (function () {
4
+ var _wp = wp,
5
+ _wp$serverSideRender = _wp.serverSideRender,
6
+ createElement = wp.element.createElement,
7
+ ServerSideRender = _wp$serverSideRender === void 0 ? wp.components.ServerSideRender : _wp$serverSideRender,
8
+ _ref = wp.blockEditor || wp.editor,
9
+ InspectorControls = _ref.InspectorControls,
10
+ _wp$components = wp.components,
11
+ TextareaControl = _wp$components.TextareaControl,
12
+ Button = _wp$components.Button,
13
+ PanelBody = _wp$components.PanelBody,
14
+ Placeholder = _wp$components.Placeholder,
15
+ registerBlockType = wp.blocks.registerBlockType;
16
+
17
+ var sbyIcon = createElement('svg', {
18
+ width: 20,
19
+ height: 20,
20
+ viewBox: '0 0 576 512',
21
+ className: 'dashicon'
22
+ }, createElement('path', {
23
+ fill: 'currentColor',
24
+ 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'
25
+ }));
26
+
27
+ registerBlockType('sby/sby-feed-block', {
28
+ title: 'Feeds for YouTube',
29
+ icon: sbyIcon,
30
+ category: 'widgets',
31
+ attributes: {
32
+ noNewChanges: {
33
+ type: 'boolean',
34
+ },
35
+ shortcodeSettings: {
36
+ type: 'string',
37
+ },
38
+ executed: {
39
+ type: 'boolean'
40
+ }
41
+ },
42
+ edit: function edit(props) {
43
+ var _props = props,
44
+ setAttributes = _props.setAttributes,
45
+ _props$attributes = _props.attributes,
46
+ _props$attributes$sho = _props$attributes.shortcodeSettings,
47
+ shortcodeSettings = _props$attributes$sho === void 0 ? sby_block_editor.shortcodeSettings : _props$attributes$sho,
48
+ _props$attributes$cli = _props$attributes.noNewChanges,
49
+ noNewChanges = _props$attributes$cli === void 0 ? true : _props$attributes$cli,
50
+ _props$attributes$exe = _props$attributes.executed,
51
+ executed = _props$attributes$exe === void 0 ? false : _props$attributes$exe;
52
+
53
+ function setState(shortcodeSettingsContent) {
54
+ setAttributes({
55
+ noNewChanges: false,
56
+ shortcodeSettings: shortcodeSettingsContent
57
+ });
58
+ }
59
+
60
+ function previewClick(content) {
61
+ setAttributes({
62
+ noNewChanges: true,
63
+ executed: false,
64
+ });
65
+ }
66
+ function afterRender() {
67
+ // no way to run a script after AJAX call to get feed so we just try to execute it on a few intervals
68
+ if (! executed
69
+ || typeof window.sbyGB === 'undefined') {
70
+ window.sbyGB = true;
71
+ setTimeout(function() { if (typeof sby_init !== 'undefined') {sby_init();}},1000);
72
+ setTimeout(function() { if (typeof sby_init !== 'undefined') {sby_init();}},2000);
73
+ setTimeout(function() { if (typeof sby_init !== 'undefined') {sby_init();}},3000);
74
+ setTimeout(function() { if (typeof sby_init !== 'undefined') {sby_init();}},5000);
75
+ setTimeout(function() { if (typeof sby_init !== 'undefined') {sby_init();}},10000);
76
+ }
77
+ setAttributes({
78
+ executed: true,
79
+ });
80
+ }
81
+
82
+ var jsx = [React.createElement(InspectorControls, {
83
+ key: "sby-gutenberg-setting-selector-inspector-controls"
84
+ }, React.createElement(PanelBody, {
85
+ title: sby_block_editor.i18n.addSettings
86
+ }, React.createElement(TextareaControl, {
87
+ key: "sby-gutenberg-settings",
88
+ className: "sby-gutenberg-settings",
89
+ label: sby_block_editor.i18n.shortcodeSettings,
90
+ help: sby_block_editor.i18n.example + ": 'channel=\"GoProCamera\" showbutton=\"true\"'",
91
+ value: shortcodeSettings,
92
+ onChange: setState
93
+ }), React.createElement(Button, {
94
+ key: "sby-gutenberg-preview",
95
+ className: "sby-gutenberg-preview",
96
+ onClick: previewClick,
97
+ isDefault: true
98
+ }, sby_block_editor.i18n.preview)))];
99
+
100
+ if (noNewChanges) {
101
+ afterRender();
102
+ jsx.push(React.createElement(ServerSideRender, {
103
+ key: "feeds-for-youtube/feeds-for-youtube",
104
+ block: "sby/sby-feed-block",
105
+ attributes: props.attributes,
106
+ }));
107
+ } else {
108
+ props.attributes.noNewChanges = false;
109
+ jsx.push(React.createElement(Placeholder, {
110
+ key: "sby-gutenberg-setting-selector-select-wrap",
111
+ className: "sby-gutenberg-setting-selector-select-wrap"
112
+ }, React.createElement(Button, {
113
+ key: "sby-gutenberg-preview",
114
+ className: "sby-gutenberg-preview",
115
+ onClick: previewClick,
116
+ isDefault: true
117
+ }, sby_block_editor.i18n.preview)));
118
+ }
119
+
120
+ return jsx;
121
+ },
122
+ save: function save() {
123
+ return null;
124
+ }
125
+ });
126
+ })();
trunk/languages/feeds-for-youtube-de_DE.mo ADDED
Binary file
trunk/languages/feeds-for-youtube-de_DE.po ADDED
@@ -0,0 +1,989 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "POT-Creation-Date: 2020-02-04 15:53-0600\n"
5
+ "PO-Revision-Date: 2020-02-04 15:53-0600\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: \n"
8
+ "Language: de_DE\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 "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:61
43
+ msgid "Channel"
44
+ msgstr ""
45
+
46
+ #: inc/admin/admin-functions.php:64
47
+ msgid "Eg: Channel ID or User Name"
48
+ msgstr ""
49
+
50
+ #: inc/admin/admin-functions.php:66
51
+ msgid "Channel ID or User Name"
52
+ msgstr ""
53
+
54
+ #: inc/admin/admin-functions.php:67
55
+ msgid ""
56
+ "You can find the ID or User Name of your YouTube Channel from the URL. In "
57
+ "each URL format, the text you need to use is highlighted below:"
58
+ msgstr ""
59
+
60
+ #: inc/admin/admin-functions.php:68
61
+ msgid "URL Format 1:"
62
+ msgstr ""
63
+
64
+ #: inc/admin/admin-functions.php:70
65
+ msgid "URL Format 2:"
66
+ msgstr ""
67
+
68
+ #: inc/admin/admin-functions.php:83
69
+ msgid "List"
70
+ msgstr ""
71
+
72
+ #: inc/admin/admin-functions.php:85
73
+ msgid "A single columns of videos that play when clicked."
74
+ msgstr ""
75
+
76
+ #: inc/admin/admin-functions.php:89
77
+ msgid "Grid"
78
+ msgstr ""
79
+
80
+ #: inc/admin/admin-functions.php:91
81
+ msgid ""
82
+ "Video thumbnails are displayed in columns and play in a lightbox when "
83
+ "clicked."
84
+ msgstr ""
85
+
86
+ #: inc/admin/admin-functions.php:96 inc/admin/admin-functions.php:122
87
+ msgid "Columns"
88
+ msgstr ""
89
+
90
+ #: inc/admin/admin-functions.php:105 inc/admin/admin-functions.php:131
91
+ msgid "Mobile Columns"
92
+ msgstr ""
93
+
94
+ #: inc/admin/admin-functions.php:115
95
+ msgid "Gallery"
96
+ msgstr ""
97
+
98
+ #: inc/admin/admin-functions.php:117
99
+ msgid ""
100
+ "One large video that plays when clicked with thumbnails underneath to play "
101
+ "more."
102
+ msgstr ""
103
+
104
+ #: inc/admin/admin-functions.php:146
105
+ msgid "Configure Options"
106
+ msgstr ""
107
+
108
+ #: inc/admin/admin-functions.php:150
109
+ msgid "Customize Options"
110
+ msgstr ""
111
+
112
+ #: inc/admin/admin-functions.php:154
113
+ msgid "Layout Options"
114
+ msgstr ""
115
+
116
+ #: inc/admin/admin-functions.php:158
117
+ msgid "Header Options"
118
+ msgstr ""
119
+
120
+ #: inc/admin/admin-functions.php:162
121
+ msgid "\"Load More\" Button Options"
122
+ msgstr ""
123
+
124
+ #: inc/admin/admin-functions.php:166
125
+ msgid "\"Subscribe\" Button Options"
126
+ msgstr ""
127
+
128
+ #: inc/admin/admin-functions.php:297
129
+ msgid ""
130
+ "Could not connect your account. Please check to make sure this is a valid "
131
+ "access token for the Smash Balloon YouTube App."
132
+ msgstr ""
133
+
134
+ #: inc/admin/admin-functions.php:572
135
+ msgid ""
136
+ "PS. We currently have a <a href=\"https://smashballoon.com/video-feed/?"
137
+ "utm_source=plugin-free&utm_campaign=sby&discount="
138
+ msgstr ""
139
+
140
+ #: inc/admin/admin-functions.php:590
141
+ #, php-format
142
+ msgid ""
143
+ "It's great to see that you've been using the %s plugin for a while now. "
144
+ "Hopefully you're happy with it!&nbsp; If so, would you consider leaving a "
145
+ "positive review? It really helps to support the plugin and helps others to "
146
+ "discover it too!"
147
+ msgstr ""
148
+
149
+ #: inc/admin/admin-functions.php:594
150
+ msgid "Sure, I'd love to!"
151
+ msgstr ""
152
+
153
+ #: inc/admin/admin-functions.php:596
154
+ msgid "No thanks"
155
+ msgstr ""
156
+
157
+ #: inc/admin/admin-functions.php:598
158
+ msgid "I've already given a review"
159
+ msgstr ""
160
+
161
+ #: inc/admin/admin-functions.php:600
162
+ msgid "Ask Me Later"
163
+ msgstr ""
164
+
165
+ #: inc/admin/admin-functions.php:617
166
+ #, php-format
167
+ msgid ""
168
+ "<b style=\"font-weight: 700;\">Exclusive offer!</b> We don't run promotions "
169
+ "very often, but for a limited time we're offering <b style=\"font-weight: "
170
+ "700;\">20% off</b> our Pro version to all users of our free %s plugin."
171
+ msgstr ""
172
+
173
+ #: inc/admin/admin-functions.php:619 inc/admin/admin-functions.php:637
174
+ msgid "Get this offer"
175
+ msgstr ""
176
+
177
+ #: inc/admin/admin-functions.php:620 inc/admin/admin-functions.php:638
178
+ msgid "I'm not interested"
179
+ msgstr ""
180
+
181
+ #: inc/admin/admin-functions.php:635
182
+ #, php-format
183
+ msgid ""
184
+ "<b style=\"font-weight: 700;\">Black Friday/Cyber Monday Deal!</b> Thank you "
185
+ "for using our free %s plugin. For a limited time, we're offering <b style="
186
+ "\"font-weight: 700;\">20% off</b> the Pro version for all of our users."
187
+ msgstr ""
188
+
189
+ #: inc/admin/class-sbspf-admin.php:228
190
+ msgid "Yes"
191
+ msgstr ""
192
+
193
+ #: inc/admin/class-sbspf-admin.php:409
194
+ msgid "Connect an account above"
195
+ msgstr ""
196
+
197
+ #: inc/admin/class-sbspf-admin.php:448 inc/admin/class-sby-admin.php:578
198
+ msgid "When the page loads"
199
+ msgstr ""
200
+
201
+ #: inc/admin/class-sbspf-admin.php:450 inc/admin/class-sby-admin.php:580
202
+ #, php-format
203
+ msgid ""
204
+ "Your %s data is temporarily cached by the plugin in your WordPress database. "
205
+ "There are two ways that you can set the plugin to check for new data:"
206
+ "<br><br>\n"
207
+ " <b>1. When the page loads</b><br>Selecting this option means "
208
+ "that when the cache expires then the plugin will check %s for new posts the "
209
+ "next time that the feed is loaded. You can choose how long this data should "
210
+ "be cached for with a minimum time of 15 minutes. If you set the time to 60 "
211
+ "minutes then the plugin will clear the cached data after that length of "
212
+ "time, and the next time the page is viewed it will check for new data. "
213
+ "<b>Tip:</b> If you're experiencing an issue with the plugin not updating "
214
+ "automatically then try enabling the setting labeled <b>'Force cache to clear "
215
+ "on interval'</b> which is located on the 'Customize' tab.<br><br>\n"
216
+ " <b>2. In the background</b><br>Selecting this option means "
217
+ "that the plugin will check for new data in the background so that the feed "
218
+ "is updated behind the scenes. You can select at what time and how often the "
219
+ "plugin should check for new data using the settings below. <b>Please note</"
220
+ "b> that the plugin will initially check for data from Instagram when the "
221
+ "page first loads, but then after that will check in the background on the "
222
+ "schedule selected - unless the cache is cleared."
223
+ msgstr ""
224
+
225
+ #: inc/admin/class-sbspf-admin.php:456 inc/admin/class-sby-admin.php:586
226
+ msgid "Every"
227
+ msgstr ""
228
+
229
+ #: inc/admin/class-sbspf-admin.php:459 inc/admin/class-sby-admin.php:589
230
+ msgid "Minutes"
231
+ msgstr ""
232
+
233
+ #: inc/admin/class-sbspf-admin.php:460 inc/admin/class-sby-admin.php:590
234
+ msgid "Hours"
235
+ msgstr ""
236
+
237
+ #: inc/admin/class-sbspf-admin.php:461 inc/admin/class-sby-admin.php:591
238
+ msgid "Days"
239
+ msgstr ""
240
+
241
+ #: inc/admin/class-sbspf-admin.php:463 inc/admin/class-sbspf-admin.php:736
242
+ #: inc/admin/class-sby-admin.php:593
243
+ msgid "What does this mean?"
244
+ msgstr ""
245
+
246
+ #: inc/admin/class-sbspf-admin.php:464 inc/admin/class-sby-admin.php:594
247
+ #, php-format
248
+ msgid ""
249
+ "Your %s posts are temporarily cached by the plugin in your WordPress "
250
+ "database. You can choose how long the posts should be cached for. If you set "
251
+ "the time to 1 hour then the plugin will clear the cache after that length of "
252
+ "time and check %s for posts again."
253
+ msgstr ""
254
+
255
+ #: inc/admin/class-sbspf-admin.php:469 inc/admin/class-sby-admin.php:599
256
+ msgid "In the background"
257
+ msgstr ""
258
+
259
+ #: inc/admin/class-sbspf-admin.php:474 inc/admin/class-sby-admin.php:604
260
+ #: youtube-feed.php:187
261
+ msgid "Every 30 minutes"
262
+ msgstr ""
263
+
264
+ #: inc/admin/class-sbspf-admin.php:475 inc/admin/class-sby-admin.php:605
265
+ msgid "Every hour"
266
+ msgstr ""
267
+
268
+ #: inc/admin/class-sbspf-admin.php:476 inc/admin/class-sby-admin.php:606
269
+ msgid "Every 12 hours"
270
+ msgstr ""
271
+
272
+ #: inc/admin/class-sbspf-admin.php:477 inc/admin/class-sby-admin.php:607
273
+ msgid "Every 24 hours"
274
+ msgstr ""
275
+
276
+ #: inc/admin/class-sbspf-admin.php:481 inc/admin/class-sby-admin.php:611
277
+ msgid "at"
278
+ msgstr ""
279
+
280
+ #: inc/admin/class-sbspf-admin.php:498 inc/admin/class-sby-admin.php:628
281
+ msgid "AM"
282
+ msgstr ""
283
+
284
+ #: inc/admin/class-sbspf-admin.php:499 inc/admin/class-sby-admin.php:629
285
+ msgid "PM"
286
+ msgstr ""
287
+
288
+ #: inc/admin/class-sbspf-admin.php:511 inc/admin/class-sby-admin.php:641
289
+ msgid "every 30 minutes"
290
+ msgstr ""
291
+
292
+ #: inc/admin/class-sbspf-admin.php:512 inc/admin/class-sby-admin.php:642
293
+ msgid "every 12 hours"
294
+ msgstr ""
295
+
296
+ #: inc/admin/class-sbspf-admin.php:514 inc/admin/class-sby-admin.php:644
297
+ msgid "Next check"
298
+ msgstr ""
299
+
300
+ #: inc/admin/class-sbspf-admin.php:514 inc/admin/class-sby-admin.php:644
301
+ msgid ""
302
+ "Note: Saving the settings on this page will clear the cache and reset this "
303
+ "schedule"
304
+ msgstr ""
305
+
306
+ #: inc/admin/class-sbspf-admin.php:516 inc/admin/class-sby-admin.php:646
307
+ msgid "Nothing currently scheduled"
308
+ msgstr ""
309
+
310
+ #: inc/admin/class-sbspf-admin.php:549
311
+ msgid "Click for shortcode option"
312
+ msgstr ""
313
+
314
+ #: inc/admin/class-sby-admin.php:28
315
+ msgid "Feed Type"
316
+ msgstr ""
317
+
318
+ #: inc/admin/class-sby-admin.php:32
319
+ msgid "Display videos from a YouTube channel (channel)"
320
+ msgstr ""
321
+
322
+ #: inc/admin/class-sby-admin.php:44
323
+ msgid "Check for new posts"
324
+ msgstr ""
325
+
326
+ #: inc/admin/class-sby-admin.php:52
327
+ msgid "Preserve settings when plugin is removed"
328
+ msgstr ""
329
+
330
+ #: inc/admin/class-sby-admin.php:54
331
+ msgid ""
332
+ "When removing the plugin your settings are automatically erased. Checking "
333
+ "this box will prevent any settings from being deleted. This means that you "
334
+ "can uninstall and reinstall the plugin without losing your settings."
335
+ msgstr ""
336
+
337
+ #: inc/admin/class-sby-admin.php:62
338
+ msgid "General"
339
+ msgstr ""
340
+
341
+ #: inc/admin/class-sby-admin.php:88
342
+ msgid "Width of Feed"
343
+ msgstr ""
344
+
345
+ #: inc/admin/class-sby-admin.php:92
346
+ msgid "The width of your feed. Any number with a unit like \"px\" or \"%\"."
347
+ msgstr ""
348
+
349
+ #: inc/admin/class-sby-admin.php:100
350
+ msgid "Set to be 100% width on mobile?"
351
+ msgstr ""
352
+
353
+ #: inc/admin/class-sby-admin.php:103
354
+ #, php-format
355
+ msgid ""
356
+ "If you set a width on the feed then this will be used on mobile as well as "
357
+ "desktop. Check this setting to set the feed width to be 100% on mobile so "
358
+ "that it is responsive."
359
+ msgstr ""
360
+
361
+ #: inc/admin/class-sby-admin.php:125
362
+ msgid "Height of Feed"
363
+ msgstr ""
364
+
365
+ #: inc/admin/class-sby-admin.php:129
366
+ msgid "The height of your feed. Any number with a unit like \"px\" or \"em\"."
367
+ msgstr ""
368
+
369
+ #: inc/admin/class-sby-admin.php:142
370
+ msgid "Background Color"
371
+ msgstr ""
372
+
373
+ #: inc/admin/class-sby-admin.php:146
374
+ msgid "Background color for the feed. Any hex color code."
375
+ msgstr ""
376
+
377
+ #: inc/admin/class-sby-admin.php:153
378
+ msgid "Layout"
379
+ msgstr ""
380
+
381
+ #: inc/admin/class-sby-admin.php:164
382
+ msgid "Layout Type"
383
+ msgstr ""
384
+
385
+ #: inc/admin/class-sby-admin.php:169
386
+ msgid "How your posts are display visually."
387
+ msgstr ""
388
+
389
+ #: inc/admin/class-sby-admin.php:194
390
+ msgid "Number of Videos"
391
+ msgstr ""
392
+
393
+ #: inc/admin/class-sby-admin.php:195
394
+ msgid "Number of videos to show initially."
395
+ msgstr ""
396
+
397
+ #: inc/admin/class-sby-admin.php:199
398
+ msgid "The number of videos in the feed"
399
+ msgstr ""
400
+
401
+ #: inc/admin/class-sby-admin.php:207
402
+ msgid "Play Icon"
403
+ msgstr ""
404
+
405
+ #: inc/admin/class-sby-admin.php:211
406
+ msgid "Title"
407
+ msgstr ""
408
+
409
+ #: inc/admin/class-sby-admin.php:216
410
+ msgid "User Name"
411
+ msgstr ""
412
+
413
+ #: inc/admin/class-sby-admin.php:221
414
+ msgid "Views"
415
+ msgstr ""
416
+
417
+ #: inc/admin/class-sby-admin.php:226
418
+ msgid "Date"
419
+ msgstr ""
420
+
421
+ #: inc/admin/class-sby-admin.php:231
422
+ msgid "Live Stream Countdown (when applies)"
423
+ msgstr ""
424
+
425
+ #: inc/admin/class-sby-admin.php:236
426
+ msgid "Stats (like and comment counts)"
427
+ msgstr ""
428
+
429
+ #: inc/admin/class-sby-admin.php:241 inc/admin/templates/display.php:19
430
+ msgid "Description"
431
+ msgstr ""
432
+
433
+ #: inc/admin/class-sby-admin.php:251
434
+ msgid "Show/Hide"
435
+ msgstr ""
436
+
437
+ #: inc/admin/class-sby-admin.php:255
438
+ msgid ""
439
+ "Comma separated list of what video information (title, description, stats) "
440
+ "will display in the feed. eg."
441
+ msgstr ""
442
+
443
+ #: inc/admin/class-sby-admin.php:269
444
+ msgid "Spacing between videos"
445
+ msgstr ""
446
+
447
+ #: inc/admin/class-sby-admin.php:273
448
+ msgid ""
449
+ "The spacing/padding around the videos in the feed. Any number with a unit "
450
+ "like \"px\" or \"em\"."
451
+ msgstr ""
452
+
453
+ #: inc/admin/class-sby-admin.php:282
454
+ msgid "Header"
455
+ msgstr ""
456
+
457
+ #: inc/admin/class-sby-admin.php:292
458
+ msgid "Show Header"
459
+ msgstr ""
460
+
461
+ #: inc/admin/class-sby-admin.php:297
462
+ msgid "Include a header for this feed."
463
+ msgstr ""
464
+
465
+ #: inc/admin/class-sby-admin.php:307
466
+ msgid "Show Channel Description"
467
+ msgstr ""
468
+
469
+ #: inc/admin/class-sby-admin.php:312
470
+ msgid "Include the channel description in the header."
471
+ msgstr ""
472
+
473
+ #: inc/admin/class-sby-admin.php:319
474
+ msgid "\"Load More\" Button"
475
+ msgstr ""
476
+
477
+ #: inc/admin/class-sby-admin.php:329
478
+ msgid "Show \"Load More\" Button"
479
+ msgstr ""
480
+
481
+ #: inc/admin/class-sby-admin.php:334
482
+ msgid ""
483
+ "Include a \"Load More\" button at the bottom of the feed to load more videos."
484
+ msgstr ""
485
+
486
+ #: inc/admin/class-sby-admin.php:345
487
+ msgid "Button Background Color"
488
+ msgstr ""
489
+
490
+ #: inc/admin/class-sby-admin.php:349
491
+ msgid "Background color for the \"Load More\" button. Any hex color code."
492
+ msgstr ""
493
+
494
+ #: inc/admin/class-sby-admin.php:360
495
+ msgid "Button Text Color"
496
+ msgstr ""
497
+
498
+ #: inc/admin/class-sby-admin.php:364
499
+ msgid "Text color for the \"Load More\" button. Any hex color code."
500
+ msgstr ""
501
+
502
+ #: inc/admin/class-sby-admin.php:372 youtube-feed.php:457
503
+ msgid "Load More..."
504
+ msgstr "Mehr laden…"
505
+
506
+ #: inc/admin/class-sby-admin.php:375
507
+ msgid "Button Text"
508
+ msgstr ""
509
+
510
+ #: inc/admin/class-sby-admin.php:379
511
+ msgid "The text that appers on the \"Load More\" button."
512
+ msgstr ""
513
+
514
+ #: inc/admin/class-sby-admin.php:387
515
+ msgid "\"Subscribe\" Button"
516
+ msgstr ""
517
+
518
+ #: inc/admin/class-sby-admin.php:398
519
+ msgid "Show \"Subscribe\" Button"
520
+ msgstr ""
521
+
522
+ #: inc/admin/class-sby-admin.php:403
523
+ msgid ""
524
+ "Include a \"Subscribe\" button at the bottom of the feed to load more videos."
525
+ msgstr ""
526
+
527
+ #: inc/admin/class-sby-admin.php:414
528
+ msgid "Subscribe Background Color"
529
+ msgstr ""
530
+
531
+ #: inc/admin/class-sby-admin.php:418
532
+ msgid "Background color for the \"Subscribe\" button. Any hex color code."
533
+ msgstr ""
534
+
535
+ #: inc/admin/class-sby-admin.php:429
536
+ msgid "Subscribe Text Color"
537
+ msgstr ""
538
+
539
+ #: inc/admin/class-sby-admin.php:433
540
+ msgid "Text color for the \"Subscribe\" button. Any hex color code."
541
+ msgstr ""
542
+
543
+ #: inc/admin/class-sby-admin.php:441 youtube-feed.php:458
544
+ msgid "Subscribe"
545
+ msgstr "Abonnieren"
546
+
547
+ #: inc/admin/class-sby-admin.php:444
548
+ msgid "Subscribe Text"
549
+ msgstr ""
550
+
551
+ #: inc/admin/class-sby-admin.php:448
552
+ msgid "The text that appers on the \"Subscribe\" button."
553
+ msgstr ""
554
+
555
+ #: inc/admin/class-sby-admin.php:455
556
+ msgid "Video Experience"
557
+ msgstr ""
558
+
559
+ #: inc/admin/class-sby-admin.php:463
560
+ msgid "Play when clicked"
561
+ msgstr ""
562
+
563
+ #: inc/admin/class-sby-admin.php:476
564
+ msgid "When does video play?"
565
+ msgstr ""
566
+
567
+ #: inc/admin/class-sby-admin.php:480
568
+ msgid "What the user needs to do to play a video. eg."
569
+ msgstr ""
570
+
571
+ #: inc/admin/class-sby-admin.php:484
572
+ msgid ""
573
+ "List layout will not play automatically. Choose whether to play the video "
574
+ "automatically in the player or wait until the user clicks the play button "
575
+ "after the video is loaded."
576
+ msgstr ""
577
+
578
+ #: inc/admin/class-sby-admin.php:489
579
+ msgid "Custom Code Snippets"
580
+ msgstr ""
581
+
582
+ #: inc/admin/class-sby-admin.php:500
583
+ msgid "Custom CSS"
584
+ msgstr ""
585
+
586
+ #: inc/admin/class-sby-admin.php:502
587
+ msgid "Enter your own custom CSS in the box below"
588
+ msgstr ""
589
+
590
+ #: inc/admin/class-sby-admin.php:511
591
+ msgid "Custom JavaScript"
592
+ msgstr ""
593
+
594
+ #: inc/admin/class-sby-admin.php:513
595
+ msgid "Enter your own custom JavaScript/jQuery in the box below"
596
+ msgstr ""
597
+
598
+ #: inc/admin/class-sby-admin.php:514
599
+ msgid ""
600
+ "Note: Custom JavaScript reruns every time more videos are loaded into the "
601
+ "feed"
602
+ msgstr ""
603
+
604
+ #: inc/admin/class-sby-admin.php:519
605
+ msgid "Advanced"
606
+ msgstr ""
607
+
608
+ #: inc/admin/class-sby-admin.php:528
609
+ msgid "Background"
610
+ msgstr ""
611
+
612
+ #: inc/admin/class-sby-admin.php:532
613
+ msgid "Page"
614
+ msgstr ""
615
+
616
+ #: inc/admin/class-sby-admin.php:536
617
+ msgid "None"
618
+ msgstr ""
619
+
620
+ #: inc/admin/class-sby-admin.php:546
621
+ msgid "Local storage process"
622
+ msgstr ""
623
+
624
+ #: inc/admin/class-sby-admin.php:549
625
+ msgid ""
626
+ "To preserve your feeds and videos even if the YouTube API is unavailable, a "
627
+ "record of each video is added to the wp_posts table in the WordPress "
628
+ "database. Please note that changing this setting to \"none\" will limit the "
629
+ "number of posts available in the feed to 15 or less."
630
+ msgstr ""
631
+
632
+ #: inc/admin/class-sby-admin.php:557
633
+ msgid "Are you using an AJAX theme?"
634
+ msgstr ""
635
+
636
+ #: inc/admin/class-sby-admin.php:559
637
+ msgid ""
638
+ "When navigating your site, if your theme uses Ajax to load content into your "
639
+ "pages (meaning your page doesn't refresh) then check this setting. If you're "
640
+ "not sure then it's best to leave this setting unchecked while checking with "
641
+ "your theme author, otherwise checking it may cause a problem."
642
+ msgstr ""
643
+
644
+ #: inc/admin/templates/configure.php:3
645
+ #, php-format
646
+ msgid "Log in to %s and connect an account"
647
+ msgstr "Melden Sie sich bei %s an und verbinden Sie ein Konto"
648
+
649
+ #: inc/admin/templates/configure.php:4
650
+ msgid "Button not working?"
651
+ msgstr ""
652
+
653
+ #: inc/admin/templates/configure.php:16
654
+ msgid "API Key"
655
+ msgstr ""
656
+
657
+ #: inc/admin/templates/configure.php:17
658
+ msgid "Recommended"
659
+ msgstr ""
660
+
661
+ #: inc/admin/templates/configure.php:21
662
+ msgid ""
663
+ "Entering an API key is <strong>optional</strong> but recommended. It allows "
664
+ "the plugin to fetch older videos and prevents potential disruption in your "
665
+ "feed. It only takes a few minutes: <a href=\"https://smashballoon.com/"
666
+ "youtube-api-key/\" target=\"_blank\" rel=\"noopener\">Get my API key.</a>"
667
+ msgstr ""
668
+
669
+ #: inc/admin/templates/configure.php:34 inc/admin/templates/customize.php:8
670
+ msgid "Save Changes"
671
+ msgstr ""
672
+
673
+ #: inc/admin/templates/connected-accounts.php:10
674
+ #, php-format
675
+ msgid "%s Accounts"
676
+ msgstr ""
677
+
678
+ #: inc/admin/templates/connected-accounts.php:11
679
+ #, php-format
680
+ msgid "Use the button above to connect %s account"
681
+ msgstr ""
682
+
683
+ #: inc/admin/templates/connected-accounts.php:15
684
+ #, php-format
685
+ msgid "No %s accounts connected. Click the button above to connect an account."
686
+ msgstr ""
687
+
688
+ #: inc/admin/templates/connected-accounts.php:34
689
+ msgid "Manually Connect a Primary Account"
690
+ msgstr ""
691
+
692
+ #: inc/admin/templates/connected-accounts.php:36
693
+ msgid "Enter a valid Access Token"
694
+ msgstr ""
695
+
696
+ #: inc/admin/templates/connected-accounts.php:37
697
+ msgid "Enter a valid Refresh Token"
698
+ msgstr ""
699
+
700
+ #: inc/admin/templates/connected-accounts.php:38
701
+ msgid "Connect This Account"
702
+ msgstr ""
703
+
704
+ #: inc/admin/templates/display.php:1
705
+ msgid "Display your Feed"
706
+ msgstr ""
707
+
708
+ #: inc/admin/templates/display.php:2
709
+ msgid ""
710
+ "Copy and paste the following shortcode directly into the page, post or "
711
+ "widget where you'd like the feed to show up:"
712
+ msgstr ""
713
+
714
+ #: inc/admin/templates/display.php:3 inc/admin/templates/main.php:59
715
+ #: inc/admin/templates/single-connected-account.php:39
716
+ #: inc/admin/templates/single-connected-account.php:40
717
+ #: inc/admin/templates/single-connected-account.php:41
718
+ msgid "To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)."
719
+ msgstr ""
720
+
721
+ #: inc/admin/templates/display.php:5
722
+ msgid "Multiple Feeds"
723
+ msgstr ""
724
+
725
+ #: inc/admin/templates/display.php:6
726
+ msgid ""
727
+ "If you'd like to display multiple feeds then you can set different settings "
728
+ "directly in the shortcode like so:"
729
+ msgstr ""
730
+
731
+ #: inc/admin/templates/display.php:8
732
+ msgid ""
733
+ "You can display as many different feeds as you like, on either the same page "
734
+ "or on different pages, by just using the shortcode options below. For "
735
+ "example:"
736
+ msgstr ""
737
+
738
+ #: inc/admin/templates/display.php:13
739
+ msgid "See the table below for a full list of available shortcode options:"
740
+ msgstr ""
741
+
742
+ #: inc/admin/templates/display.php:18
743
+ msgid "Shortcode option"
744
+ msgstr ""
745
+
746
+ #: inc/admin/templates/display.php:20
747
+ msgid "Example"
748
+ msgstr ""
749
+
750
+ #: inc/admin/templates/display.php:37 inc/admin/templates/support.php:1
751
+ msgid "Need help?"
752
+ msgstr ""
753
+
754
+ #: inc/admin/templates/display.php:37
755
+ msgid "Get Support"
756
+ msgstr ""
757
+
758
+ #: inc/admin/templates/main.php:17
759
+ msgid "Settings saved."
760
+ msgstr ""
761
+
762
+ #: inc/admin/templates/main.php:50
763
+ msgid "Next Step"
764
+ msgstr ""
765
+
766
+ #: inc/admin/templates/main.php:54
767
+ msgid "Need help setting up the plugin? Check out our <a href=\""
768
+ msgstr ""
769
+
770
+ #: inc/admin/templates/main.php:58
771
+ msgid ""
772
+ "Copy and paste this shortcode directly into the page, post or widget where "
773
+ "you'd like to display the feed:"
774
+ msgstr ""
775
+
776
+ #: inc/admin/templates/main.php:60
777
+ msgid "Find out how to display <a href='?page="
778
+ msgstr ""
779
+
780
+ #: inc/admin/templates/single-connected-account.php:4
781
+ msgid ""
782
+ "The Access Token for this account is expired or invalid. Click the button "
783
+ "above to attempt to renew it."
784
+ msgstr ""
785
+
786
+ #: inc/admin/templates/single-connected-account.php:9
787
+ msgid "Remove"
788
+ msgstr ""
789
+
790
+ #: inc/admin/templates/single-connected-account.php:14
791
+ msgid "Channel ID:"
792
+ msgstr ""
793
+
794
+ #: inc/admin/templates/single-connected-account.php:18
795
+ msgid "Add to another Feed"
796
+ msgstr ""
797
+
798
+ #: inc/admin/templates/single-connected-account.php:19
799
+ msgid "Show access token and account info"
800
+ msgstr ""
801
+
802
+ #: inc/admin/templates/single-connected-account.php:24
803
+ msgid "Copy and paste this shortcode into your page or widget area"
804
+ msgstr ""
805
+
806
+ #: inc/admin/templates/single-connected-account.php:32
807
+ msgid ""
808
+ "To add multiple channels in the same feed, simply separate them using commas"
809
+ msgstr ""
810
+
811
+ #: inc/admin/templates/single-connected-account.php:35
812
+ #, php-format
813
+ msgid "Click on the %s tab to learn more about shortcodes"
814
+ msgstr ""
815
+
816
+ #: inc/admin/templates/single-connected-account.php:35
817
+ msgid "Display Your Feed"
818
+ msgstr ""
819
+
820
+ #: inc/admin/templates/single-connected-account.php:39
821
+ msgid "Access Token"
822
+ msgstr ""
823
+
824
+ #: inc/admin/templates/single-connected-account.php:40
825
+ msgid "Refresh Token"
826
+ msgstr ""
827
+
828
+ #: inc/admin/templates/single-connected-account.php:41
829
+ msgid "Channel ID"
830
+ msgstr ""
831
+
832
+ #: inc/admin/templates/support.php:3
833
+ msgid "Check out our "
834
+ msgstr ""
835
+
836
+ #: inc/admin/templates/support.php:3
837
+ msgid "setup directions"
838
+ msgstr ""
839
+
840
+ #: inc/admin/templates/support.php:3
841
+ msgid "for a step-by-step guide on how to setup and use the plugin"
842
+ msgstr ""
843
+
844
+ #: inc/admin/templates/support.php:5
845
+ msgid "Have a problem? Submit a "
846
+ msgstr ""
847
+
848
+ #: inc/admin/templates/support.php:5
849
+ msgid "support ticket"
850
+ msgstr ""
851
+
852
+ #: inc/admin/templates/support.php:5
853
+ msgid "on our website"
854
+ msgstr ""
855
+
856
+ #: inc/admin/templates/support.php:5
857
+ msgid "Please include your <b>System Info</b> below with all support requests."
858
+ msgstr ""
859
+
860
+ #: inc/admin/templates/support.php:8
861
+ msgid "System Info"
862
+ msgstr ""
863
+
864
+ #: inc/admin/templates/support.php:8
865
+ msgid "Click the text below to select all"
866
+ msgstr ""
867
+
868
+ #: inc/class-sby-api-connect.php:104
869
+ #, php-format
870
+ msgid "Error: %s."
871
+ msgstr ""
872
+
873
+ #: inc/class-sby-api-connect.php:106
874
+ msgid ""
875
+ "There's an issue with the YouTube API Key that you are using. Please check "
876
+ "to make sure that this is a valid API Key."
877
+ msgstr ""
878
+
879
+ #: inc/class-sby-api-connect.php:120
880
+ #, php-format
881
+ msgid "Error connecting to %s."
882
+ msgstr ""
883
+
884
+ #: inc/class-sby-feed.php:971
885
+ msgid "Error: No videos found."
886
+ msgstr ""
887
+
888
+ #: inc/class-sby-feed.php:972
889
+ msgid ""
890
+ "Make sure this is a valid channel ID and that the channel has videos "
891
+ "available on youtube.com."
892
+ msgstr ""
893
+
894
+ #: inc/class-sby-feed.php:1102
895
+ msgid "No posts found."
896
+ msgstr ""
897
+
898
+ #: inc/class-sby-posts-manager.php:235
899
+ msgid "There was an error creating the folder for storing resized images."
900
+ msgstr ""
901
+
902
+ #: inc/class-sby-posts-manager.php:323
903
+ msgid "Notice: API requests are being delayed for 5 minutes."
904
+ msgstr ""
905
+
906
+ #: inc/class-sby-posts-manager.php:323
907
+ msgid "Feed will not update."
908
+ msgstr ""
909
+
910
+ #: inc/class-sby-posts-manager.php:332
911
+ msgid ""
912
+ "There may be an issue with the YouTube access token that you are using. Your "
913
+ "server might also be unable to connect to YouTube at this time."
914
+ msgstr ""
915
+
916
+ #: inc/sby-functions.php:29 inc/sby-functions.php:137
917
+ msgid "This error message is only visible to WordPress admins"
918
+ msgstr ""
919
+
920
+ #: inc/sby-functions.php:30
921
+ msgid "Error: No connected account or API key."
922
+ msgstr ""
923
+
924
+ #: inc/sby-functions.php:31
925
+ msgid ""
926
+ "Please go to the YouTube Feed settings page to enter an API key or connect "
927
+ "an account."
928
+ msgstr ""
929
+
930
+ #: inc/widget.php:13
931
+ msgid "YouTube Feed"
932
+ msgstr ""
933
+
934
+ #: inc/widget.php:14
935
+ msgid "Display your YouTube feed"
936
+ msgstr ""
937
+
938
+ #: inc/widget.php:40
939
+ msgid "Title:"
940
+ msgstr ""
941
+
942
+ #: templates/item.php:23 templates/player.php:10
943
+ msgid "Image for post"
944
+ msgstr ""
945
+
946
+ #: templates/item.php:35 templates/player.php:17
947
+ #, php-format
948
+ msgid "YouTube Video %s"
949
+ msgstr ""
950
+
951
+ #: youtube-feed.php:97
952
+ msgid "Feeds for YouTube"
953
+ msgstr ""
954
+
955
+ #: youtube-feed.php:100
956
+ msgid "a"
957
+ msgstr ""
958
+
959
+ #: youtube-feed.php:103
960
+ msgid "YouTube"
961
+ msgstr ""
962
+
963
+ #: youtube-feed.php:154
964
+ msgid "Videos"
965
+ msgstr ""
966
+
967
+ #: youtube-feed.php:155
968
+ msgid " "
969
+ msgstr ""
970
+
971
+ #: youtube-feed.php:156 youtube-feed.php:157
972
+ msgid "Add New Video"
973
+ msgstr ""
974
+
975
+ #: youtube-feed.php:158
976
+ msgid "Edit Video"
977
+ msgstr ""
978
+
979
+ #: youtube-feed.php:159
980
+ msgid "View Video"
981
+ msgstr ""
982
+
983
+ #: youtube-feed.php:160
984
+ msgid "All Videos"
985
+ msgstr ""
986
+
987
+ #: youtube-feed.php:487
988
+ msgid "Settings"
989
+ msgstr ""
trunk/languages/feeds-for-youtube-fr_FR.mo ADDED
Binary file
trunk/languages/feeds-for-youtube-fr_FR.po ADDED
@@ -0,0 +1,989 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "POT-Creation-Date: 2020-02-04 15:53-0600\n"
5
+ "PO-Revision-Date: 2020-02-04 15:53-0600\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: \n"
8
+ "Language: fr_FR\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 "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:61
43
+ msgid "Channel"
44
+ msgstr ""
45
+
46
+ #: inc/admin/admin-functions.php:64
47
+ msgid "Eg: Channel ID or User Name"
48
+ msgstr ""
49
+
50
+ #: inc/admin/admin-functions.php:66
51
+ msgid "Channel ID or User Name"
52
+ msgstr ""
53
+
54
+ #: inc/admin/admin-functions.php:67
55
+ msgid ""
56
+ "You can find the ID or User Name of your YouTube Channel from the URL. In "
57
+ "each URL format, the text you need to use is highlighted below:"
58
+ msgstr ""
59
+
60
+ #: inc/admin/admin-functions.php:68
61
+ msgid "URL Format 1:"
62
+ msgstr ""
63
+
64
+ #: inc/admin/admin-functions.php:70
65
+ msgid "URL Format 2:"
66
+ msgstr ""
67
+
68
+ #: inc/admin/admin-functions.php:83
69
+ msgid "List"
70
+ msgstr ""
71
+
72
+ #: inc/admin/admin-functions.php:85
73
+ msgid "A single columns of videos that play when clicked."
74
+ msgstr ""
75
+
76
+ #: inc/admin/admin-functions.php:89
77
+ msgid "Grid"
78
+ msgstr ""
79
+
80
+ #: inc/admin/admin-functions.php:91
81
+ msgid ""
82
+ "Video thumbnails are displayed in columns and play in a lightbox when "
83
+ "clicked."
84
+ msgstr ""
85
+
86
+ #: inc/admin/admin-functions.php:96 inc/admin/admin-functions.php:122
87
+ msgid "Columns"
88
+ msgstr ""
89
+
90
+ #: inc/admin/admin-functions.php:105 inc/admin/admin-functions.php:131
91
+ msgid "Mobile Columns"
92
+ msgstr ""
93
+
94
+ #: inc/admin/admin-functions.php:115
95
+ msgid "Gallery"
96
+ msgstr ""
97
+
98
+ #: inc/admin/admin-functions.php:117
99
+ msgid ""
100
+ "One large video that plays when clicked with thumbnails underneath to play "
101
+ "more."
102
+ msgstr ""
103
+
104
+ #: inc/admin/admin-functions.php:146
105
+ msgid "Configure Options"
106
+ msgstr ""
107
+
108
+ #: inc/admin/admin-functions.php:150
109
+ msgid "Customize Options"
110
+ msgstr ""
111
+
112
+ #: inc/admin/admin-functions.php:154
113
+ msgid "Layout Options"
114
+ msgstr ""
115
+
116
+ #: inc/admin/admin-functions.php:158
117
+ msgid "Header Options"
118
+ msgstr ""
119
+
120
+ #: inc/admin/admin-functions.php:162
121
+ msgid "\"Load More\" Button Options"
122
+ msgstr ""
123
+
124
+ #: inc/admin/admin-functions.php:166
125
+ msgid "\"Subscribe\" Button Options"
126
+ msgstr ""
127
+
128
+ #: inc/admin/admin-functions.php:297
129
+ msgid ""
130
+ "Could not connect your account. Please check to make sure this is a valid "
131
+ "access token for the Smash Balloon YouTube App."
132
+ msgstr ""
133
+
134
+ #: inc/admin/admin-functions.php:572
135
+ msgid ""
136
+ "PS. We currently have a <a href=\"https://smashballoon.com/video-feed/?"
137
+ "utm_source=plugin-free&utm_campaign=sby&discount="
138
+ msgstr ""
139
+
140
+ #: inc/admin/admin-functions.php:590
141
+ #, php-format
142
+ msgid ""
143
+ "It's great to see that you've been using the %s plugin for a while now. "
144
+ "Hopefully you're happy with it!&nbsp; If so, would you consider leaving a "
145
+ "positive review? It really helps to support the plugin and helps others to "
146
+ "discover it too!"
147
+ msgstr ""
148
+
149
+ #: inc/admin/admin-functions.php:594
150
+ msgid "Sure, I'd love to!"
151
+ msgstr ""
152
+
153
+ #: inc/admin/admin-functions.php:596
154
+ msgid "No thanks"
155
+ msgstr ""
156
+
157
+ #: inc/admin/admin-functions.php:598
158
+ msgid "I've already given a review"
159
+ msgstr ""
160
+
161
+ #: inc/admin/admin-functions.php:600
162
+ msgid "Ask Me Later"
163
+ msgstr ""
164
+
165
+ #: inc/admin/admin-functions.php:617
166
+ #, php-format
167
+ msgid ""
168
+ "<b style=\"font-weight: 700;\">Exclusive offer!</b> We don't run promotions "
169
+ "very often, but for a limited time we're offering <b style=\"font-weight: "
170
+ "700;\">20% off</b> our Pro version to all users of our free %s plugin."
171
+ msgstr ""
172
+
173
+ #: inc/admin/admin-functions.php:619 inc/admin/admin-functions.php:637
174
+ msgid "Get this offer"
175
+ msgstr ""
176
+
177
+ #: inc/admin/admin-functions.php:620 inc/admin/admin-functions.php:638
178
+ msgid "I'm not interested"
179
+ msgstr ""
180
+
181
+ #: inc/admin/admin-functions.php:635
182
+ #, php-format
183
+ msgid ""
184
+ "<b style=\"font-weight: 700;\">Black Friday/Cyber Monday Deal!</b> Thank you "
185
+ "for using our free %s plugin. For a limited time, we're offering <b style="
186
+ "\"font-weight: 700;\">20% off</b> the Pro version for all of our users."
187
+ msgstr ""
188
+
189
+ #: inc/admin/class-sbspf-admin.php:228
190
+ msgid "Yes"
191
+ msgstr ""
192
+
193
+ #: inc/admin/class-sbspf-admin.php:409
194
+ msgid "Connect an account above"
195
+ msgstr ""
196
+
197
+ #: inc/admin/class-sbspf-admin.php:448 inc/admin/class-sby-admin.php:578
198
+ msgid "When the page loads"
199
+ msgstr ""
200
+
201
+ #: inc/admin/class-sbspf-admin.php:450 inc/admin/class-sby-admin.php:580
202
+ #, php-format
203
+ msgid ""
204
+ "Your %s data is temporarily cached by the plugin in your WordPress database. "
205
+ "There are two ways that you can set the plugin to check for new data:"
206
+ "<br><br>\n"
207
+ " <b>1. When the page loads</b><br>Selecting this option means "
208
+ "that when the cache expires then the plugin will check %s for new posts the "
209
+ "next time that the feed is loaded. You can choose how long this data should "
210
+ "be cached for with a minimum time of 15 minutes. If you set the time to 60 "
211
+ "minutes then the plugin will clear the cached data after that length of "
212
+ "time, and the next time the page is viewed it will check for new data. "
213
+ "<b>Tip:</b> If you're experiencing an issue with the plugin not updating "
214
+ "automatically then try enabling the setting labeled <b>'Force cache to clear "
215
+ "on interval'</b> which is located on the 'Customize' tab.<br><br>\n"
216
+ " <b>2. In the background</b><br>Selecting this option means "
217
+ "that the plugin will check for new data in the background so that the feed "
218
+ "is updated behind the scenes. You can select at what time and how often the "
219
+ "plugin should check for new data using the settings below. <b>Please note</"
220
+ "b> that the plugin will initially check for data from Instagram when the "
221
+ "page first loads, but then after that will check in the background on the "
222
+ "schedule selected - unless the cache is cleared."
223
+ msgstr ""
224
+
225
+ #: inc/admin/class-sbspf-admin.php:456 inc/admin/class-sby-admin.php:586
226
+ msgid "Every"
227
+ msgstr ""
228
+
229
+ #: inc/admin/class-sbspf-admin.php:459 inc/admin/class-sby-admin.php:589
230
+ msgid "Minutes"
231
+ msgstr ""
232
+
233
+ #: inc/admin/class-sbspf-admin.php:460 inc/admin/class-sby-admin.php:590
234
+ msgid "Hours"
235
+ msgstr ""
236
+
237
+ #: inc/admin/class-sbspf-admin.php:461 inc/admin/class-sby-admin.php:591
238
+ msgid "Days"
239
+ msgstr ""
240
+
241
+ #: inc/admin/class-sbspf-admin.php:463 inc/admin/class-sbspf-admin.php:736
242
+ #: inc/admin/class-sby-admin.php:593
243
+ msgid "What does this mean?"
244
+ msgstr ""
245
+
246
+ #: inc/admin/class-sbspf-admin.php:464 inc/admin/class-sby-admin.php:594
247
+ #, php-format
248
+ msgid ""
249
+ "Your %s posts are temporarily cached by the plugin in your WordPress "
250
+ "database. You can choose how long the posts should be cached for. If you set "
251
+ "the time to 1 hour then the plugin will clear the cache after that length of "
252
+ "time and check %s for posts again."
253
+ msgstr ""
254
+
255
+ #: inc/admin/class-sbspf-admin.php:469 inc/admin/class-sby-admin.php:599
256
+ msgid "In the background"
257
+ msgstr ""
258
+
259
+ #: inc/admin/class-sbspf-admin.php:474 inc/admin/class-sby-admin.php:604
260
+ #: youtube-feed.php:187
261
+ msgid "Every 30 minutes"
262
+ msgstr ""
263
+
264
+ #: inc/admin/class-sbspf-admin.php:475 inc/admin/class-sby-admin.php:605
265
+ msgid "Every hour"
266
+ msgstr ""
267
+
268
+ #: inc/admin/class-sbspf-admin.php:476 inc/admin/class-sby-admin.php:606
269
+ msgid "Every 12 hours"
270
+ msgstr ""
271
+
272
+ #: inc/admin/class-sbspf-admin.php:477 inc/admin/class-sby-admin.php:607
273
+ msgid "Every 24 hours"
274
+ msgstr ""
275
+
276
+ #: inc/admin/class-sbspf-admin.php:481 inc/admin/class-sby-admin.php:611
277
+ msgid "at"
278
+ msgstr ""
279
+
280
+ #: inc/admin/class-sbspf-admin.php:498 inc/admin/class-sby-admin.php:628
281
+ msgid "AM"
282
+ msgstr ""
283
+
284
+ #: inc/admin/class-sbspf-admin.php:499 inc/admin/class-sby-admin.php:629
285
+ msgid "PM"
286
+ msgstr ""
287
+
288
+ #: inc/admin/class-sbspf-admin.php:511 inc/admin/class-sby-admin.php:641
289
+ msgid "every 30 minutes"
290
+ msgstr ""
291
+
292
+ #: inc/admin/class-sbspf-admin.php:512 inc/admin/class-sby-admin.php:642
293
+ msgid "every 12 hours"
294
+ msgstr ""
295
+
296
+ #: inc/admin/class-sbspf-admin.php:514 inc/admin/class-sby-admin.php:644
297
+ msgid "Next check"
298
+ msgstr ""
299
+
300
+ #: inc/admin/class-sbspf-admin.php:514 inc/admin/class-sby-admin.php:644
301
+ msgid ""
302
+ "Note: Saving the settings on this page will clear the cache and reset this "
303
+ "schedule"
304
+ msgstr ""
305
+
306
+ #: inc/admin/class-sbspf-admin.php:516 inc/admin/class-sby-admin.php:646
307
+ msgid "Nothing currently scheduled"
308
+ msgstr ""
309
+
310
+ #: inc/admin/class-sbspf-admin.php:549
311
+ msgid "Click for shortcode option"
312
+ msgstr ""
313
+
314
+ #: inc/admin/class-sby-admin.php:28
315
+ msgid "Feed Type"
316
+ msgstr ""
317
+
318
+ #: inc/admin/class-sby-admin.php:32
319
+ msgid "Display videos from a YouTube channel (channel)"
320
+ msgstr ""
321
+
322
+ #: inc/admin/class-sby-admin.php:44
323
+ msgid "Check for new posts"
324
+ msgstr ""
325
+
326
+ #: inc/admin/class-sby-admin.php:52
327
+ msgid "Preserve settings when plugin is removed"
328
+ msgstr ""
329
+
330
+ #: inc/admin/class-sby-admin.php:54
331
+ msgid ""
332
+ "When removing the plugin your settings are automatically erased. Checking "
333
+ "this box will prevent any settings from being deleted. This means that you "
334
+ "can uninstall and reinstall the plugin without losing your settings."
335
+ msgstr ""
336
+
337
+ #: inc/admin/class-sby-admin.php:62
338
+ msgid "General"
339
+ msgstr ""
340
+
341
+ #: inc/admin/class-sby-admin.php:88
342
+ msgid "Width of Feed"
343
+ msgstr ""
344
+
345
+ #: inc/admin/class-sby-admin.php:92
346
+ msgid "The width of your feed. Any number with a unit like \"px\" or \"%\"."
347
+ msgstr ""
348
+
349
+ #: inc/admin/class-sby-admin.php:100
350
+ msgid "Set to be 100% width on mobile?"
351
+ msgstr ""
352
+
353
+ #: inc/admin/class-sby-admin.php:103
354
+ #, php-format
355
+ msgid ""
356
+ "If you set a width on the feed then this will be used on mobile as well as "
357
+ "desktop. Check this setting to set the feed width to be 100% on mobile so "
358
+ "that it is responsive."
359
+ msgstr ""
360
+
361
+ #: inc/admin/class-sby-admin.php:125
362
+ msgid "Height of Feed"
363
+ msgstr ""
364
+
365
+ #: inc/admin/class-sby-admin.php:129
366
+ msgid "The height of your feed. Any number with a unit like \"px\" or \"em\"."
367
+ msgstr ""
368
+
369
+ #: inc/admin/class-sby-admin.php:142
370
+ msgid "Background Color"
371
+ msgstr ""
372
+
373
+ #: inc/admin/class-sby-admin.php:146
374
+ msgid "Background color for the feed. Any hex color code."
375
+ msgstr ""
376
+
377
+ #: inc/admin/class-sby-admin.php:153
378
+ msgid "Layout"
379
+ msgstr ""
380
+
381
+ #: inc/admin/class-sby-admin.php:164
382
+ msgid "Layout Type"
383
+ msgstr ""
384
+
385
+ #: inc/admin/class-sby-admin.php:169
386
+ msgid "How your posts are display visually."
387
+ msgstr ""
388
+
389
+ #: inc/admin/class-sby-admin.php:194
390
+ msgid "Number of Videos"
391
+ msgstr ""
392
+
393
+ #: inc/admin/class-sby-admin.php:195
394
+ msgid "Number of videos to show initially."
395
+ msgstr ""
396
+
397
+ #: inc/admin/class-sby-admin.php:199
398
+ msgid "The number of videos in the feed"
399
+ msgstr ""
400
+
401
+ #: inc/admin/class-sby-admin.php:207
402
+ msgid "Play Icon"
403
+ msgstr ""
404
+
405
+ #: inc/admin/class-sby-admin.php:211
406
+ msgid "Title"
407
+ msgstr ""
408
+
409
+ #: inc/admin/class-sby-admin.php:216
410
+ msgid "User Name"
411
+ msgstr ""
412
+
413
+ #: inc/admin/class-sby-admin.php:221
414
+ msgid "Views"
415
+ msgstr ""
416
+
417
+ #: inc/admin/class-sby-admin.php:226
418
+ msgid "Date"
419
+ msgstr ""
420
+
421
+ #: inc/admin/class-sby-admin.php:231
422
+ msgid "Live Stream Countdown (when applies)"
423
+ msgstr ""
424
+
425
+ #: inc/admin/class-sby-admin.php:236
426
+ msgid "Stats (like and comment counts)"
427
+ msgstr ""
428
+
429
+ #: inc/admin/class-sby-admin.php:241 inc/admin/templates/display.php:19
430
+ msgid "Description"
431
+ msgstr ""
432
+
433
+ #: inc/admin/class-sby-admin.php:251
434
+ msgid "Show/Hide"
435
+ msgstr ""
436
+
437
+ #: inc/admin/class-sby-admin.php:255
438
+ msgid ""
439
+ "Comma separated list of what video information (title, description, stats) "
440
+ "will display in the feed. eg."
441
+ msgstr ""
442
+
443
+ #: inc/admin/class-sby-admin.php:269
444
+ msgid "Spacing between videos"
445
+ msgstr ""
446
+
447
+ #: inc/admin/class-sby-admin.php:273
448
+ msgid ""
449
+ "The spacing/padding around the videos in the feed. Any number with a unit "
450
+ "like \"px\" or \"em\"."
451
+ msgstr ""
452
+
453
+ #: inc/admin/class-sby-admin.php:282
454
+ msgid "Header"
455
+ msgstr ""
456
+
457
+ #: inc/admin/class-sby-admin.php:292
458
+ msgid "Show Header"
459
+ msgstr ""
460
+
461
+ #: inc/admin/class-sby-admin.php:297
462
+ msgid "Include a header for this feed."
463
+ msgstr ""
464
+
465
+ #: inc/admin/class-sby-admin.php:307
466
+ msgid "Show Channel Description"
467
+ msgstr ""
468
+
469
+ #: inc/admin/class-sby-admin.php:312
470
+ msgid "Include the channel description in the header."
471
+ msgstr ""
472
+
473
+ #: inc/admin/class-sby-admin.php:319
474
+ msgid "\"Load More\" Button"
475
+ msgstr ""
476
+
477
+ #: inc/admin/class-sby-admin.php:329
478
+ msgid "Show \"Load More\" Button"
479
+ msgstr ""
480
+
481
+ #: inc/admin/class-sby-admin.php:334
482
+ msgid ""
483
+ "Include a \"Load More\" button at the bottom of the feed to load more videos."
484
+ msgstr ""
485
+
486
+ #: inc/admin/class-sby-admin.php:345
487
+ msgid "Button Background Color"
488
+ msgstr ""
489
+
490
+ #: inc/admin/class-sby-admin.php:349
491
+ msgid "Background color for the \"Load More\" button. Any hex color code."
492
+ msgstr ""
493
+
494
+ #: inc/admin/class-sby-admin.php:360
495
+ msgid "Button Text Color"
496
+ msgstr ""
497
+
498
+ #: inc/admin/class-sby-admin.php:364
499
+ msgid "Text color for the \"Load More\" button. Any hex color code."
500
+ msgstr ""
501
+
502
+ #: inc/admin/class-sby-admin.php:372 youtube-feed.php:457
503
+ msgid "Load More..."
504
+ msgstr "Charger plus…"
505
+
506
+ #: inc/admin/class-sby-admin.php:375
507
+ msgid "Button Text"
508
+ msgstr ""
509
+
510
+ #: inc/admin/class-sby-admin.php:379
511
+ msgid "The text that appers on the \"Load More\" button."
512
+ msgstr ""
513
+
514
+ #: inc/admin/class-sby-admin.php:387
515
+ msgid "\"Subscribe\" Button"
516
+ msgstr ""
517
+
518
+ #: inc/admin/class-sby-admin.php:398
519
+ msgid "Show \"Subscribe\" Button"
520
+ msgstr ""
521
+
522
+ #: inc/admin/class-sby-admin.php:403
523
+ msgid ""
524
+ "Include a \"Subscribe\" button at the bottom of the feed to load more videos."
525
+ msgstr ""
526
+
527
+ #: inc/admin/class-sby-admin.php:414
528
+ msgid "Subscribe Background Color"
529
+ msgstr ""
530
+
531
+ #: inc/admin/class-sby-admin.php:418
532
+ msgid "Background color for the \"Subscribe\" button. Any hex color code."
533
+ msgstr ""
534
+
535
+ #: inc/admin/class-sby-admin.php:429
536
+ msgid "Subscribe Text Color"
537
+ msgstr ""
538
+
539
+ #: inc/admin/class-sby-admin.php:433
540
+ msgid "Text color for the \"Subscribe\" button. Any hex color code."
541
+ msgstr ""
542
+
543
+ #: inc/admin/class-sby-admin.php:441 youtube-feed.php:458
544
+ msgid "Subscribe"
545
+ msgstr "S'abonner"
546
+
547
+ #: inc/admin/class-sby-admin.php:444
548
+ msgid "Subscribe Text"
549
+ msgstr ""
550
+
551
+ #: inc/admin/class-sby-admin.php:448
552
+ msgid "The text that appers on the \"Subscribe\" button."
553
+ msgstr ""
554
+
555
+ #: inc/admin/class-sby-admin.php:455
556
+ msgid "Video Experience"
557
+ msgstr ""
558
+
559
+ #: inc/admin/class-sby-admin.php:463
560
+ msgid "Play when clicked"
561
+ msgstr ""
562
+
563
+ #: inc/admin/class-sby-admin.php:476
564
+ msgid "When does video play?"
565
+ msgstr ""
566
+
567
+ #: inc/admin/class-sby-admin.php:480
568
+ msgid "What the user needs to do to play a video. eg."
569
+ msgstr ""
570
+
571
+ #: inc/admin/class-sby-admin.php:484
572
+ msgid ""
573
+ "List layout will not play automatically. Choose whether to play the video "
574
+ "automatically in the player or wait until the user clicks the play button "
575
+ "after the video is loaded."
576
+ msgstr ""
577
+
578
+ #: inc/admin/class-sby-admin.php:489
579
+ msgid "Custom Code Snippets"
580
+ msgstr ""
581
+
582
+ #: inc/admin/class-sby-admin.php:500
583
+ msgid "Custom CSS"
584
+ msgstr ""
585
+
586
+ #: inc/admin/class-sby-admin.php:502
587
+ msgid "Enter your own custom CSS in the box below"
588
+ msgstr ""
589
+
590
+ #: inc/admin/class-sby-admin.php:511
591
+ msgid "Custom JavaScript"
592
+ msgstr ""
593
+
594
+ #: inc/admin/class-sby-admin.php:513
595
+ msgid "Enter your own custom JavaScript/jQuery in the box below"
596
+ msgstr ""
597
+
598
+ #: inc/admin/class-sby-admin.php:514
599
+ msgid ""
600
+ "Note: Custom JavaScript reruns every time more videos are loaded into the "
601
+ "feed"
602
+ msgstr ""
603
+
604
+ #: inc/admin/class-sby-admin.php:519
605
+ msgid "Advanced"
606
+ msgstr ""
607
+
608
+ #: inc/admin/class-sby-admin.php:528
609
+ msgid "Background"
610
+ msgstr ""
611
+
612
+ #: inc/admin/class-sby-admin.php:532
613
+ msgid "Page"
614
+ msgstr ""
615
+
616
+ #: inc/admin/class-sby-admin.php:536
617
+ msgid "None"
618
+ msgstr ""
619
+
620
+ #: inc/admin/class-sby-admin.php:546
621
+ msgid "Local storage process"
622
+ msgstr ""
623
+
624
+ #: inc/admin/class-sby-admin.php:549
625
+ msgid ""
626
+ "To preserve your feeds and videos even if the YouTube API is unavailable, a "
627
+ "record of each video is added to the wp_posts table in the WordPress "
628
+ "database. Please note that changing this setting to \"none\" will limit the "
629
+ "number of posts available in the feed to 15 or less."
630
+ msgstr ""
631
+
632
+ #: inc/admin/class-sby-admin.php:557
633
+ msgid "Are you using an AJAX theme?"
634
+ msgstr ""
635
+
636
+ #: inc/admin/class-sby-admin.php:559
637
+ msgid ""
638
+ "When navigating your site, if your theme uses Ajax to load content into your "
639
+ "pages (meaning your page doesn't refresh) then check this setting. If you're "
640
+ "not sure then it's best to leave this setting unchecked while checking with "
641
+ "your theme author, otherwise checking it may cause a problem."
642
+ msgstr ""
643
+
644
+ #: inc/admin/templates/configure.php:3
645
+ #, php-format
646
+ msgid "Log in to %s and connect an account"
647
+ msgstr ""
648
+
649
+ #: inc/admin/templates/configure.php:4
650
+ msgid "Button not working?"
651
+ msgstr ""
652
+
653
+ #: inc/admin/templates/configure.php:16
654
+ msgid "API Key"
655
+ msgstr ""
656
+
657
+ #: inc/admin/templates/configure.php:17
658
+ msgid "Recommended"
659
+ msgstr ""
660
+
661
+ #: inc/admin/templates/configure.php:21
662
+ msgid ""
663
+ "Entering an API key is <strong>optional</strong> but recommended. It allows "
664
+ "the plugin to fetch older videos and prevents potential disruption in your "
665
+ "feed. It only takes a few minutes: <a href=\"https://smashballoon.com/"
666
+ "youtube-api-key/\" target=\"_blank\" rel=\"noopener\">Get my API key.</a>"
667
+ msgstr ""
668
+
669
+ #: inc/admin/templates/configure.php:34 inc/admin/templates/customize.php:8
670
+ msgid "Save Changes"
671
+ msgstr ""
672
+
673
+ #: inc/admin/templates/connected-accounts.php:10
674
+ #, php-format
675
+ msgid "%s Accounts"
676
+ msgstr ""
677
+
678
+ #: inc/admin/templates/connected-accounts.php:11
679
+ #, php-format
680
+ msgid "Use the button above to connect %s account"
681
+ msgstr ""
682
+
683
+ #: inc/admin/templates/connected-accounts.php:15
684
+ #, php-format
685
+ msgid "No %s accounts connected. Click the button above to connect an account."
686
+ msgstr ""
687
+
688
+ #: inc/admin/templates/connected-accounts.php:34
689
+ msgid "Manually Connect a Primary Account"
690
+ msgstr ""
691
+
692
+ #: inc/admin/templates/connected-accounts.php:36
693
+ msgid "Enter a valid Access Token"
694
+ msgstr ""
695
+
696
+ #: inc/admin/templates/connected-accounts.php:37
697
+ msgid "Enter a valid Refresh Token"
698
+ msgstr ""
699
+
700
+ #: inc/admin/templates/connected-accounts.php:38
701
+ msgid "Connect This Account"
702
+ msgstr ""
703
+
704
+ #: inc/admin/templates/display.php:1
705
+ msgid "Display your Feed"
706
+ msgstr ""
707
+
708
+ #: inc/admin/templates/display.php:2
709
+ msgid ""
710
+ "Copy and paste the following shortcode directly into the page, post or "
711
+ "widget where you'd like the feed to show up:"
712
+ msgstr ""
713
+
714
+ #: inc/admin/templates/display.php:3 inc/admin/templates/main.php:59
715
+ #: inc/admin/templates/single-connected-account.php:39
716
+ #: inc/admin/templates/single-connected-account.php:40
717
+ #: inc/admin/templates/single-connected-account.php:41
718
+ msgid "To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)."
719
+ msgstr ""
720
+
721
+ #: inc/admin/templates/display.php:5
722
+ msgid "Multiple Feeds"
723
+ msgstr ""
724
+
725
+ #: inc/admin/templates/display.php:6
726
+ msgid ""
727
+ "If you'd like to display multiple feeds then you can set different settings "
728
+ "directly in the shortcode like so:"
729
+ msgstr ""
730
+
731
+ #: inc/admin/templates/display.php:8
732
+ msgid ""
733
+ "You can display as many different feeds as you like, on either the same page "
734
+ "or on different pages, by just using the shortcode options below. For "
735
+ "example:"
736
+ msgstr ""
737
+
738
+ #: inc/admin/templates/display.php:13
739
+ msgid "See the table below for a full list of available shortcode options:"
740
+ msgstr ""
741
+
742
+ #: inc/admin/templates/display.php:18
743
+ msgid "Shortcode option"
744
+ msgstr ""
745
+
746
+ #: inc/admin/templates/display.php:20
747
+ msgid "Example"
748
+ msgstr ""
749
+
750
+ #: inc/admin/templates/display.php:37 inc/admin/templates/support.php:1
751
+ msgid "Need help?"
752
+ msgstr ""
753
+
754
+ #: inc/admin/templates/display.php:37
755
+ msgid "Get Support"
756
+ msgstr ""
757
+
758
+ #: inc/admin/templates/main.php:17
759
+ msgid "Settings saved."
760
+ msgstr ""
761
+
762
+ #: inc/admin/templates/main.php:50
763
+ msgid "Next Step"
764
+ msgstr ""
765
+
766
+ #: inc/admin/templates/main.php:54
767
+ msgid "Need help setting up the plugin? Check out our <a href=\""
768
+ msgstr ""
769
+
770
+ #: inc/admin/templates/main.php:58
771
+ msgid ""
772
+ "Copy and paste this shortcode directly into the page, post or widget where "
773
+ "you'd like to display the feed:"
774
+ msgstr ""
775
+
776
+ #: inc/admin/templates/main.php:60
777
+ msgid "Find out how to display <a href='?page="
778
+ msgstr ""
779
+
780
+ #: inc/admin/templates/single-connected-account.php:4
781
+ msgid ""
782
+ "The Access Token for this account is expired or invalid. Click the button "
783
+ "above to attempt to renew it."
784
+ msgstr ""
785
+
786
+ #: inc/admin/templates/single-connected-account.php:9
787
+ msgid "Remove"
788
+ msgstr ""
789
+
790
+ #: inc/admin/templates/single-connected-account.php:14
791
+ msgid "Channel ID:"
792
+ msgstr ""
793
+
794
+ #: inc/admin/templates/single-connected-account.php:18
795
+ msgid "Add to another Feed"
796
+ msgstr ""
797
+
798
+ #: inc/admin/templates/single-connected-account.php:19
799
+ msgid "Show access token and account info"
800
+ msgstr ""
801
+
802
+ #: inc/admin/templates/single-connected-account.php:24
803
+ msgid "Copy and paste this shortcode into your page or widget area"
804
+ msgstr ""
805
+
806
+ #: inc/admin/templates/single-connected-account.php:32
807
+ msgid ""
808
+ "To add multiple channels in the same feed, simply separate them using commas"
809
+ msgstr ""
810
+
811
+ #: inc/admin/templates/single-connected-account.php:35
812
+ #, php-format
813
+ msgid "Click on the %s tab to learn more about shortcodes"
814
+ msgstr ""
815
+
816
+ #: inc/admin/templates/single-connected-account.php:35
817
+ msgid "Display Your Feed"
818
+ msgstr ""
819
+
820
+ #: inc/admin/templates/single-connected-account.php:39
821
+ msgid "Access Token"
822
+ msgstr ""
823
+
824
+ #: inc/admin/templates/single-connected-account.php:40
825
+ msgid "Refresh Token"
826
+ msgstr ""
827
+
828
+ #: inc/admin/templates/single-connected-account.php:41
829
+ msgid "Channel ID"
830
+ msgstr ""
831
+
832
+ #: inc/admin/templates/support.php:3
833
+ msgid "Check out our "
834
+ msgstr ""
835
+
836
+ #: inc/admin/templates/support.php:3
837
+ msgid "setup directions"
838
+ msgstr ""
839
+
840
+ #: inc/admin/templates/support.php:3
841
+ msgid "for a step-by-step guide on how to setup and use the plugin"
842
+ msgstr ""
843
+
844
+ #: inc/admin/templates/support.php:5
845
+ msgid "Have a problem? Submit a "
846
+ msgstr ""
847
+
848
+ #: inc/admin/templates/support.php:5
849
+ msgid "support ticket"
850
+ msgstr ""
851
+
852
+ #: inc/admin/templates/support.php:5
853
+ msgid "on our website"
854
+ msgstr ""
855
+
856
+ #: inc/admin/templates/support.php:5
857
+ msgid "Please include your <b>System Info</b> below with all support requests."
858
+ msgstr ""
859
+
860
+ #: inc/admin/templates/support.php:8
861
+ msgid "System Info"
862
+ msgstr ""
863
+
864
+ #: inc/admin/templates/support.php:8
865
+ msgid "Click the text below to select all"
866
+ msgstr ""
867
+
868
+ #: inc/class-sby-api-connect.php:104
869
+ #, php-format
870
+ msgid "Error: %s."
871
+ msgstr ""
872
+
873
+ #: inc/class-sby-api-connect.php:106
874
+ msgid ""
875
+ "There's an issue with the YouTube API Key that you are using. Please check "
876
+ "to make sure that this is a valid API Key."
877
+ msgstr ""
878
+
879
+ #: inc/class-sby-api-connect.php:120
880
+ #, php-format
881
+ msgid "Error connecting to %s."
882
+ msgstr ""
883
+
884
+ #: inc/class-sby-feed.php:971
885
+ msgid "Error: No videos found."
886
+ msgstr ""
887
+
888
+ #: inc/class-sby-feed.php:972
889
+ msgid ""
890
+ "Make sure this is a valid channel ID and that the channel has videos "
891
+ "available on youtube.com."
892
+ msgstr ""
893
+
894
+ #: inc/class-sby-feed.php:1102
895
+ msgid "No posts found."
896
+ msgstr ""
897
+
898
+ #: inc/class-sby-posts-manager.php:235
899
+ msgid "There was an error creating the folder for storing resized images."
900
+ msgstr ""
901
+
902
+ #: inc/class-sby-posts-manager.php:323
903
+ msgid "Notice: API requests are being delayed for 5 minutes."
904
+ msgstr ""
905
+
906
+ #: inc/class-sby-posts-manager.php:323
907
+ msgid "Feed will not update."
908
+ msgstr ""
909
+
910
+ #: inc/class-sby-posts-manager.php:332
911
+ msgid ""
912
+ "There may be an issue with the YouTube access token that you are using. Your "
913
+ "server might also be unable to connect to YouTube at this time."
914
+ msgstr ""
915
+
916
+ #: inc/sby-functions.php:29 inc/sby-functions.php:137
917
+ msgid "This error message is only visible to WordPress admins"
918
+ msgstr ""
919
+
920
+ #: inc/sby-functions.php:30
921
+ msgid "Error: No connected account or API key."
922
+ msgstr ""
923
+
924
+ #: inc/sby-functions.php:31
925
+ msgid ""
926
+ "Please go to the YouTube Feed settings page to enter an API key or connect "
927
+ "an account."
928
+ msgstr ""
929
+
930
+ #: inc/widget.php:13
931
+ msgid "YouTube Feed"
932
+ msgstr ""
933
+
934
+ #: inc/widget.php:14
935
+ msgid "Display your YouTube feed"
936
+ msgstr ""
937
+
938
+ #: inc/widget.php:40
939
+ msgid "Title:"
940
+ msgstr ""
941
+
942
+ #: templates/item.php:23 templates/player.php:10
943
+ msgid "Image for post"
944
+ msgstr ""
945
+
946
+ #: templates/item.php:35 templates/player.php:17
947
+ #, php-format
948
+ msgid "YouTube Video %s"
949
+ msgstr ""
950
+
951
+ #: youtube-feed.php:97
952
+ msgid "Feeds for YouTube"
953
+ msgstr ""
954
+
955
+ #: youtube-feed.php:100
956
+ msgid "a"
957
+ msgstr ""
958
+
959
+ #: youtube-feed.php:103
960
+ msgid "YouTube"
961
+ msgstr ""
962
+
963
+ #: youtube-feed.php:154
964
+ msgid "Videos"
965
+ msgstr ""
966
+
967
+ #: youtube-feed.php:155
968
+ msgid " "
969
+ msgstr ""
970
+
971
+ #: youtube-feed.php:156 youtube-feed.php:157
972
+ msgid "Add New Video"
973
+ msgstr ""
974
+
975
+ #: youtube-feed.php:158
976
+ msgid "Edit Video"
977
+ msgstr ""
978
+
979
+ #: youtube-feed.php:159
980
+ msgid "View Video"
981
+ msgstr ""
982
+
983
+ #: youtube-feed.php:160
984
+ msgid "All Videos"
985
+ msgstr ""
986
+
987
+ #: youtube-feed.php:487
988
+ msgid "Settings"
989
+ msgstr ""
trunk/languages/feeds-for-youtube.pot ADDED
@@ -0,0 +1,990 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #, fuzzy
2
+ msgid ""
3
+ msgstr ""
4
+ "Project-Id-Version: \n"
5
+ "POT-Creation-Date: 2020-02-04 15:53-0600\n"
6
+ "PO-Revision-Date: 2019-11-29 14:35-0600\n"
7
+ "Last-Translator: \n"
8
+ "Language-Team: \n"
9
+ "Language: en_US\n"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Generator: Poedit 2.2.4\n"
14
+ "X-Poedit-Basepath: ..\n"
15
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
+ "X-Poedit-KeywordsList: __;_e;esc_html__;esc_html_e;esc_attr_e;esc_attr__\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ #: inc/admin/admin-functions.php:17 inc/admin/templates/configure.php:1
20
+ msgid "Configure"
21
+ msgstr ""
22
+
23
+ #: inc/admin/admin-functions.php:20
24
+ msgid "Customize your feed"
25
+ msgstr ""
26
+
27
+ #: inc/admin/admin-functions.php:23
28
+ msgid "Customize"
29
+ msgstr ""
30
+
31
+ #: inc/admin/admin-functions.php:26 inc/admin/templates/main.php:57
32
+ msgid "Display your feed"
33
+ msgstr ""
34
+
35
+ #: inc/admin/admin-functions.php:29
36
+ msgid "Display"
37
+ msgstr ""
38
+
39
+ #: inc/admin/admin-functions.php:34
40
+ msgid "Support"
41
+ msgstr ""
42
+
43
+ #: inc/admin/admin-functions.php:61
44
+ msgid "Channel"
45
+ msgstr ""
46
+
47
+ #: inc/admin/admin-functions.php:64
48
+ msgid "Eg: Channel ID or User Name"
49
+ msgstr ""
50
+
51
+ #: inc/admin/admin-functions.php:66
52
+ msgid "Channel ID or User Name"
53
+ msgstr ""
54
+
55
+ #: inc/admin/admin-functions.php:67
56
+ msgid ""
57
+ "You can find the ID or User Name of your YouTube Channel from the URL. In "
58
+ "each URL format, the text you need to use is highlighted below:"
59
+ msgstr ""
60
+
61
+ #: inc/admin/admin-functions.php:68
62
+ msgid "URL Format 1:"
63
+ msgstr ""
64
+
65
+ #: inc/admin/admin-functions.php:70
66
+ msgid "URL Format 2:"
67
+ msgstr ""
68
+
69
+ #: inc/admin/admin-functions.php:83
70
+ msgid "List"
71
+ msgstr ""
72
+
73
+ #: inc/admin/admin-functions.php:85
74
+ msgid "A single columns of videos that play when clicked."
75
+ msgstr ""
76
+
77
+ #: inc/admin/admin-functions.php:89
78
+ msgid "Grid"
79
+ msgstr ""
80
+
81
+ #: inc/admin/admin-functions.php:91
82
+ msgid ""
83
+ "Video thumbnails are displayed in columns and play in a lightbox when "
84
+ "clicked."
85
+ msgstr ""
86
+
87
+ #: inc/admin/admin-functions.php:96 inc/admin/admin-functions.php:122
88
+ msgid "Columns"
89
+ msgstr ""
90
+
91
+ #: inc/admin/admin-functions.php:105 inc/admin/admin-functions.php:131
92
+ msgid "Mobile Columns"
93
+ msgstr ""
94
+
95
+ #: inc/admin/admin-functions.php:115
96
+ msgid "Gallery"
97
+ msgstr ""
98
+
99
+ #: inc/admin/admin-functions.php:117
100
+ msgid ""
101
+ "One large video that plays when clicked with thumbnails underneath to play "
102
+ "more."
103
+ msgstr ""
104
+
105
+ #: inc/admin/admin-functions.php:146
106
+ msgid "Configure Options"
107
+ msgstr ""
108
+
109
+ #: inc/admin/admin-functions.php:150
110
+ msgid "Customize Options"
111
+ msgstr ""
112
+
113
+ #: inc/admin/admin-functions.php:154
114
+ msgid "Layout Options"
115
+ msgstr ""
116
+
117
+ #: inc/admin/admin-functions.php:158
118
+ msgid "Header Options"
119
+ msgstr ""
120
+
121
+ #: inc/admin/admin-functions.php:162
122
+ msgid "\"Load More\" Button Options"
123
+ msgstr ""
124
+
125
+ #: inc/admin/admin-functions.php:166
126
+ msgid "\"Subscribe\" Button Options"
127
+ msgstr ""
128
+
129
+ #: inc/admin/admin-functions.php:297
130
+ msgid ""
131
+ "Could not connect your account. Please check to make sure this is a valid "
132
+ "access token for the Smash Balloon YouTube App."
133
+ msgstr ""
134
+
135
+ #: inc/admin/admin-functions.php:572
136
+ msgid ""
137
+ "PS. We currently have a <a href=\"https://smashballoon.com/video-feed/?"
138
+ "utm_source=plugin-free&utm_campaign=sby&discount="
139
+ msgstr ""
140
+
141
+ #: inc/admin/admin-functions.php:590
142
+ #, php-format
143
+ msgid ""
144
+ "It's great to see that you've been using the %s plugin for a while now. "
145
+ "Hopefully you're happy with it!&nbsp; If so, would you consider leaving a "
146
+ "positive review? It really helps to support the plugin and helps others to "
147
+ "discover it too!"
148
+ msgstr ""
149
+
150
+ #: inc/admin/admin-functions.php:594
151
+ msgid "Sure, I'd love to!"
152
+ msgstr ""
153
+
154
+ #: inc/admin/admin-functions.php:596
155
+ msgid "No thanks"
156
+ msgstr ""
157
+
158
+ #: inc/admin/admin-functions.php:598
159
+ msgid "I've already given a review"
160
+ msgstr ""
161
+
162
+ #: inc/admin/admin-functions.php:600
163
+ msgid "Ask Me Later"
164
+ msgstr ""
165
+
166
+ #: inc/admin/admin-functions.php:617
167
+ #, php-format
168
+ msgid ""
169
+ "<b style=\"font-weight: 700;\">Exclusive offer!</b> We don't run promotions "
170
+ "very often, but for a limited time we're offering <b style=\"font-weight: "
171
+ "700;\">20% off</b> our Pro version to all users of our free %s plugin."
172
+ msgstr ""
173
+
174
+ #: inc/admin/admin-functions.php:619 inc/admin/admin-functions.php:637
175
+ msgid "Get this offer"
176
+ msgstr ""
177
+
178
+ #: inc/admin/admin-functions.php:620 inc/admin/admin-functions.php:638
179
+ msgid "I'm not interested"
180
+ msgstr ""
181
+
182
+ #: inc/admin/admin-functions.php:635
183
+ #, php-format
184
+ msgid ""
185
+ "<b style=\"font-weight: 700;\">Black Friday/Cyber Monday Deal!</b> Thank you "
186
+ "for using our free %s plugin. For a limited time, we're offering <b style="
187
+ "\"font-weight: 700;\">20% off</b> the Pro version for all of our users."
188
+ msgstr ""
189
+
190
+ #: inc/admin/class-sbspf-admin.php:228
191
+ msgid "Yes"
192
+ msgstr ""
193
+
194
+ #: inc/admin/class-sbspf-admin.php:409
195
+ msgid "Connect an account above"
196
+ msgstr ""
197
+
198
+ #: inc/admin/class-sbspf-admin.php:448 inc/admin/class-sby-admin.php:578
199
+ msgid "When the page loads"
200
+ msgstr ""
201
+
202
+ #: inc/admin/class-sbspf-admin.php:450 inc/admin/class-sby-admin.php:580
203
+ #, php-format
204
+ msgid ""
205
+ "Your %s data is temporarily cached by the plugin in your WordPress database. "
206
+ "There are two ways that you can set the plugin to check for new data:"
207
+ "<br><br>\n"
208
+ " <b>1. When the page loads</b><br>Selecting this option means "
209
+ "that when the cache expires then the plugin will check %s for new posts the "
210
+ "next time that the feed is loaded. You can choose how long this data should "
211
+ "be cached for with a minimum time of 15 minutes. If you set the time to 60 "
212
+ "minutes then the plugin will clear the cached data after that length of "
213
+ "time, and the next time the page is viewed it will check for new data. "
214
+ "<b>Tip:</b> If you're experiencing an issue with the plugin not updating "
215
+ "automatically then try enabling the setting labeled <b>'Force cache to clear "
216
+ "on interval'</b> which is located on the 'Customize' tab.<br><br>\n"
217
+ " <b>2. In the background</b><br>Selecting this option means "
218
+ "that the plugin will check for new data in the background so that the feed "
219
+ "is updated behind the scenes. You can select at what time and how often the "
220
+ "plugin should check for new data using the settings below. <b>Please note</"
221
+ "b> that the plugin will initially check for data from Instagram when the "
222
+ "page first loads, but then after that will check in the background on the "
223
+ "schedule selected - unless the cache is cleared."
224
+ msgstr ""
225
+
226
+ #: inc/admin/class-sbspf-admin.php:456 inc/admin/class-sby-admin.php:586
227
+ msgid "Every"
228
+ msgstr ""
229
+
230
+ #: inc/admin/class-sbspf-admin.php:459 inc/admin/class-sby-admin.php:589
231
+ msgid "Minutes"
232
+ msgstr ""
233
+
234
+ #: inc/admin/class-sbspf-admin.php:460 inc/admin/class-sby-admin.php:590
235
+ msgid "Hours"
236
+ msgstr ""
237
+
238
+ #: inc/admin/class-sbspf-admin.php:461 inc/admin/class-sby-admin.php:591
239
+ msgid "Days"
240
+ msgstr ""
241
+
242
+ #: inc/admin/class-sbspf-admin.php:463 inc/admin/class-sbspf-admin.php:736
243
+ #: inc/admin/class-sby-admin.php:593
244
+ msgid "What does this mean?"
245
+ msgstr ""
246
+
247
+ #: inc/admin/class-sbspf-admin.php:464 inc/admin/class-sby-admin.php:594
248
+ #, php-format
249
+ msgid ""
250
+ "Your %s posts are temporarily cached by the plugin in your WordPress "
251
+ "database. You can choose how long the posts should be cached for. If you set "
252
+ "the time to 1 hour then the plugin will clear the cache after that length of "
253
+ "time and check %s for posts again."
254
+ msgstr ""
255
+
256
+ #: inc/admin/class-sbspf-admin.php:469 inc/admin/class-sby-admin.php:599
257
+ msgid "In the background"
258
+ msgstr ""
259
+
260
+ #: inc/admin/class-sbspf-admin.php:474 inc/admin/class-sby-admin.php:604
261
+ #: youtube-feed.php:187
262
+ msgid "Every 30 minutes"
263
+ msgstr ""
264
+
265
+ #: inc/admin/class-sbspf-admin.php:475 inc/admin/class-sby-admin.php:605
266
+ msgid "Every hour"
267
+ msgstr ""
268
+
269
+ #: inc/admin/class-sbspf-admin.php:476 inc/admin/class-sby-admin.php:606
270
+ msgid "Every 12 hours"
271
+ msgstr ""
272
+
273
+ #: inc/admin/class-sbspf-admin.php:477 inc/admin/class-sby-admin.php:607
274
+ msgid "Every 24 hours"
275
+ msgstr ""
276
+
277
+ #: inc/admin/class-sbspf-admin.php:481 inc/admin/class-sby-admin.php:611
278
+ msgid "at"
279
+ msgstr ""
280
+
281
+ #: inc/admin/class-sbspf-admin.php:498 inc/admin/class-sby-admin.php:628
282
+ msgid "AM"
283
+ msgstr ""
284
+
285
+ #: inc/admin/class-sbspf-admin.php:499 inc/admin/class-sby-admin.php:629
286
+ msgid "PM"
287
+ msgstr ""
288
+
289
+ #: inc/admin/class-sbspf-admin.php:511 inc/admin/class-sby-admin.php:641
290
+ msgid "every 30 minutes"
291
+ msgstr ""
292
+
293
+ #: inc/admin/class-sbspf-admin.php:512 inc/admin/class-sby-admin.php:642
294
+ msgid "every 12 hours"
295
+ msgstr ""
296
+
297
+ #: inc/admin/class-sbspf-admin.php:514 inc/admin/class-sby-admin.php:644
298
+ msgid "Next check"
299
+ msgstr ""
300
+
301
+ #: inc/admin/class-sbspf-admin.php:514 inc/admin/class-sby-admin.php:644
302
+ msgid ""
303
+ "Note: Saving the settings on this page will clear the cache and reset this "
304
+ "schedule"
305
+ msgstr ""
306
+
307
+ #: inc/admin/class-sbspf-admin.php:516 inc/admin/class-sby-admin.php:646
308
+ msgid "Nothing currently scheduled"
309
+ msgstr ""
310
+
311
+ #: inc/admin/class-sbspf-admin.php:549
312
+ msgid "Click for shortcode option"
313
+ msgstr ""
314
+
315
+ #: inc/admin/class-sby-admin.php:28
316
+ msgid "Feed Type"
317
+ msgstr ""
318
+
319
+ #: inc/admin/class-sby-admin.php:32
320
+ msgid "Display videos from a YouTube channel (channel)"
321
+ msgstr ""
322
+
323
+ #: inc/admin/class-sby-admin.php:44
324
+ msgid "Check for new posts"
325
+ msgstr ""
326
+
327
+ #: inc/admin/class-sby-admin.php:52
328
+ msgid "Preserve settings when plugin is removed"
329
+ msgstr ""
330
+
331
+ #: inc/admin/class-sby-admin.php:54
332
+ msgid ""
333
+ "When removing the plugin your settings are automatically erased. Checking "
334
+ "this box will prevent any settings from being deleted. This means that you "
335
+ "can uninstall and reinstall the plugin without losing your settings."
336
+ msgstr ""
337
+
338
+ #: inc/admin/class-sby-admin.php:62
339
+ msgid "General"
340
+ msgstr ""
341
+
342
+ #: inc/admin/class-sby-admin.php:88
343
+ msgid "Width of Feed"
344
+ msgstr ""
345
+
346
+ #: inc/admin/class-sby-admin.php:92
347
+ msgid "The width of your feed. Any number with a unit like \"px\" or \"%\"."
348
+ msgstr ""
349
+
350
+ #: inc/admin/class-sby-admin.php:100
351
+ msgid "Set to be 100% width on mobile?"
352
+ msgstr ""
353
+
354
+ #: inc/admin/class-sby-admin.php:103
355
+ #, php-format
356
+ msgid ""
357
+ "If you set a width on the feed then this will be used on mobile as well as "
358
+ "desktop. Check this setting to set the feed width to be 100% on mobile so "
359
+ "that it is responsive."
360
+ msgstr ""
361
+
362
+ #: inc/admin/class-sby-admin.php:125
363
+ msgid "Height of Feed"
364
+ msgstr ""
365
+
366
+ #: inc/admin/class-sby-admin.php:129
367
+ msgid "The height of your feed. Any number with a unit like \"px\" or \"em\"."
368
+ msgstr ""
369
+
370
+ #: inc/admin/class-sby-admin.php:142
371
+ msgid "Background Color"
372
+ msgstr ""
373
+
374
+ #: inc/admin/class-sby-admin.php:146
375
+ msgid "Background color for the feed. Any hex color code."
376
+ msgstr ""
377
+
378
+ #: inc/admin/class-sby-admin.php:153
379
+ msgid "Layout"
380
+ msgstr ""
381
+
382
+ #: inc/admin/class-sby-admin.php:164
383
+ msgid "Layout Type"
384
+ msgstr ""
385
+
386
+ #: inc/admin/class-sby-admin.php:169
387
+ msgid "How your posts are display visually."
388
+ msgstr ""
389
+
390
+ #: inc/admin/class-sby-admin.php:194
391
+ msgid "Number of Videos"
392
+ msgstr ""
393
+
394
+ #: inc/admin/class-sby-admin.php:195
395
+ msgid "Number of videos to show initially."
396
+ msgstr ""
397
+
398
+ #: inc/admin/class-sby-admin.php:199
399
+ msgid "The number of videos in the feed"
400
+ msgstr ""
401
+
402
+ #: inc/admin/class-sby-admin.php:207
403
+ msgid "Play Icon"
404
+ msgstr ""
405
+
406
+ #: inc/admin/class-sby-admin.php:211
407
+ msgid "Title"
408
+ msgstr ""
409
+
410
+ #: inc/admin/class-sby-admin.php:216
411
+ msgid "User Name"
412
+ msgstr ""
413
+
414
+ #: inc/admin/class-sby-admin.php:221
415
+ msgid "Views"
416
+ msgstr ""
417
+
418
+ #: inc/admin/class-sby-admin.php:226
419
+ msgid "Date"
420
+ msgstr ""
421
+
422
+ #: inc/admin/class-sby-admin.php:231
423
+ msgid "Live Stream Countdown (when applies)"
424
+ msgstr ""
425
+
426
+ #: inc/admin/class-sby-admin.php:236
427
+ msgid "Stats (like and comment counts)"
428
+ msgstr ""
429
+
430
+ #: inc/admin/class-sby-admin.php:241 inc/admin/templates/display.php:19
431
+ msgid "Description"
432
+ msgstr ""
433
+
434
+ #: inc/admin/class-sby-admin.php:251
435
+ msgid "Show/Hide"
436
+ msgstr ""
437
+
438
+ #: inc/admin/class-sby-admin.php:255
439
+ msgid ""
440
+ "Comma separated list of what video information (title, description, stats) "
441
+ "will display in the feed. eg."
442
+ msgstr ""
443
+
444
+ #: inc/admin/class-sby-admin.php:269
445
+ msgid "Spacing between videos"
446
+ msgstr ""
447
+
448
+ #: inc/admin/class-sby-admin.php:273
449
+ msgid ""
450
+ "The spacing/padding around the videos in the feed. Any number with a unit "
451
+ "like \"px\" or \"em\"."
452
+ msgstr ""
453
+
454
+ #: inc/admin/class-sby-admin.php:282
455
+ msgid "Header"
456
+ msgstr ""
457
+
458
+ #: inc/admin/class-sby-admin.php:292
459
+ msgid "Show Header"
460
+ msgstr ""
461
+
462
+ #: inc/admin/class-sby-admin.php:297
463
+ msgid "Include a header for this feed."
464
+ msgstr ""
465
+
466
+ #: inc/admin/class-sby-admin.php:307
467
+ msgid "Show Channel Description"
468
+ msgstr ""
469
+
470
+ #: inc/admin/class-sby-admin.php:312
471
+ msgid "Include the channel description in the header."
472
+ msgstr ""
473
+
474
+ #: inc/admin/class-sby-admin.php:319
475
+ msgid "\"Load More\" Button"
476
+ msgstr ""
477
+
478
+ #: inc/admin/class-sby-admin.php:329
479
+ msgid "Show \"Load More\" Button"
480
+ msgstr ""
481
+
482
+ #: inc/admin/class-sby-admin.php:334
483
+ msgid ""
484
+ "Include a \"Load More\" button at the bottom of the feed to load more videos."
485
+ msgstr ""
486
+
487
+ #: inc/admin/class-sby-admin.php:345
488
+ msgid "Button Background Color"
489
+ msgstr ""
490
+
491
+ #: inc/admin/class-sby-admin.php:349
492
+ msgid "Background color for the \"Load More\" button. Any hex color code."
493
+ msgstr ""
494
+
495
+ #: inc/admin/class-sby-admin.php:360
496
+ msgid "Button Text Color"
497
+ msgstr ""
498
+
499
+ #: inc/admin/class-sby-admin.php:364
500
+ msgid "Text color for the \"Load More\" button. Any hex color code."
501
+ msgstr ""
502
+
503
+ #: inc/admin/class-sby-admin.php:372 youtube-feed.php:457
504
+ msgid "Load More..."
505
+ msgstr ""
506
+
507
+ #: inc/admin/class-sby-admin.php:375
508
+ msgid "Button Text"
509
+ msgstr ""
510
+
511
+ #: inc/admin/class-sby-admin.php:379
512
+ msgid "The text that appers on the \"Load More\" button."
513
+ msgstr ""
514
+
515
+ #: inc/admin/class-sby-admin.php:387
516
+ msgid "\"Subscribe\" Button"
517
+ msgstr ""
518
+
519
+ #: inc/admin/class-sby-admin.php:398
520
+ msgid "Show \"Subscribe\" Button"
521
+ msgstr ""
522
+
523
+ #: inc/admin/class-sby-admin.php:403
524
+ msgid ""
525
+ "Include a \"Subscribe\" button at the bottom of the feed to load more videos."
526
+ msgstr ""
527
+
528
+ #: inc/admin/class-sby-admin.php:414
529
+ msgid "Subscribe Background Color"
530
+ msgstr ""
531
+
532
+ #: inc/admin/class-sby-admin.php:418
533
+ msgid "Background color for the \"Subscribe\" button. Any hex color code."
534
+ msgstr ""
535
+
536
+ #: inc/admin/class-sby-admin.php:429
537
+ msgid "Subscribe Text Color"
538
+ msgstr ""
539
+
540
+ #: inc/admin/class-sby-admin.php:433
541
+ msgid "Text color for the \"Subscribe\" button. Any hex color code."
542
+ msgstr ""
543
+
544
+ #: inc/admin/class-sby-admin.php:441 youtube-feed.php:458
545
+ msgid "Subscribe"
546
+ msgstr ""
547
+
548
+ #: inc/admin/class-sby-admin.php:444
549
+ msgid "Subscribe Text"
550
+ msgstr ""
551
+
552
+ #: inc/admin/class-sby-admin.php:448
553
+ msgid "The text that appers on the \"Subscribe\" button."
554
+ msgstr ""
555
+
556
+ #: inc/admin/class-sby-admin.php:455
557
+ msgid "Video Experience"
558
+ msgstr ""
559
+
560
+ #: inc/admin/class-sby-admin.php:463
561
+ msgid "Play when clicked"
562
+ msgstr ""
563
+
564
+ #: inc/admin/class-sby-admin.php:476
565
+ msgid "When does video play?"
566
+ msgstr ""
567
+
568
+ #: inc/admin/class-sby-admin.php:480
569
+ msgid "What the user needs to do to play a video. eg."
570
+ msgstr ""
571
+
572
+ #: inc/admin/class-sby-admin.php:484
573
+ msgid ""
574
+ "List layout will not play automatically. Choose whether to play the video "
575
+ "automatically in the player or wait until the user clicks the play button "
576
+ "after the video is loaded."
577
+ msgstr ""
578
+
579
+ #: inc/admin/class-sby-admin.php:489
580
+ msgid "Custom Code Snippets"
581
+ msgstr ""
582
+
583
+ #: inc/admin/class-sby-admin.php:500
584
+ msgid "Custom CSS"
585
+ msgstr ""
586
+
587
+ #: inc/admin/class-sby-admin.php:502
588
+ msgid "Enter your own custom CSS in the box below"
589
+ msgstr ""
590
+
591
+ #: inc/admin/class-sby-admin.php:511
592
+ msgid "Custom JavaScript"
593
+ msgstr ""
594
+
595
+ #: inc/admin/class-sby-admin.php:513
596
+ msgid "Enter your own custom JavaScript/jQuery in the box below"
597
+ msgstr ""
598
+
599
+ #: inc/admin/class-sby-admin.php:514
600
+ msgid ""
601
+ "Note: Custom JavaScript reruns every time more videos are loaded into the "
602
+ "feed"
603
+ msgstr ""
604
+
605
+ #: inc/admin/class-sby-admin.php:519
606
+ msgid "Advanced"
607
+ msgstr ""
608
+
609
+ #: inc/admin/class-sby-admin.php:528
610
+ msgid "Background"
611
+ msgstr ""
612
+
613
+ #: inc/admin/class-sby-admin.php:532
614
+ msgid "Page"
615
+ msgstr ""
616
+
617
+ #: inc/admin/class-sby-admin.php:536
618
+ msgid "None"
619
+ msgstr ""
620
+
621
+ #: inc/admin/class-sby-admin.php:546
622
+ msgid "Local storage process"
623
+ msgstr ""
624
+
625
+ #: inc/admin/class-sby-admin.php:549
626
+ msgid ""
627
+ "To preserve your feeds and videos even if the YouTube API is unavailable, a "
628
+ "record of each video is added to the wp_posts table in the WordPress "
629
+ "database. Please note that changing this setting to \"none\" will limit the "
630
+ "number of posts available in the feed to 15 or less."
631
+ msgstr ""
632
+
633
+ #: inc/admin/class-sby-admin.php:557
634
+ msgid "Are you using an AJAX theme?"
635
+ msgstr ""
636
+
637
+ #: inc/admin/class-sby-admin.php:559
638
+ msgid ""
639
+ "When navigating your site, if your theme uses Ajax to load content into your "
640
+ "pages (meaning your page doesn't refresh) then check this setting. If you're "
641
+ "not sure then it's best to leave this setting unchecked while checking with "
642
+ "your theme author, otherwise checking it may cause a problem."
643
+ msgstr ""
644
+
645
+ #: inc/admin/templates/configure.php:3
646
+ #, php-format
647
+ msgid "Log in to %s and connect an account"
648
+ msgstr ""
649
+
650
+ #: inc/admin/templates/configure.php:4
651
+ msgid "Button not working?"
652
+ msgstr ""
653
+
654
+ #: inc/admin/templates/configure.php:16
655
+ msgid "API Key"
656
+ msgstr ""
657
+
658
+ #: inc/admin/templates/configure.php:17
659
+ msgid "Recommended"
660
+ msgstr ""
661
+
662
+ #: inc/admin/templates/configure.php:21
663
+ msgid ""
664
+ "Entering an API key is <strong>optional</strong> but recommended. It allows "
665
+ "the plugin to fetch older videos and prevents potential disruption in your "
666
+ "feed. It only takes a few minutes: <a href=\"https://smashballoon.com/"
667
+ "youtube-api-key/\" target=\"_blank\" rel=\"noopener\">Get my API key.</a>"
668
+ msgstr ""
669
+
670
+ #: inc/admin/templates/configure.php:34 inc/admin/templates/customize.php:8
671
+ msgid "Save Changes"
672
+ msgstr ""
673
+
674
+ #: inc/admin/templates/connected-accounts.php:10
675
+ #, php-format
676
+ msgid "%s Accounts"
677
+ msgstr ""
678
+
679
+ #: inc/admin/templates/connected-accounts.php:11
680
+ #, php-format
681
+ msgid "Use the button above to connect %s account"
682
+ msgstr ""
683
+
684
+ #: inc/admin/templates/connected-accounts.php:15
685
+ #, php-format
686
+ msgid "No %s accounts connected. Click the button above to connect an account."
687
+ msgstr ""
688
+
689
+ #: inc/admin/templates/connected-accounts.php:34
690
+ msgid "Manually Connect a Primary Account"
691
+ msgstr ""
692
+
693
+ #: inc/admin/templates/connected-accounts.php:36
694
+ msgid "Enter a valid Access Token"
695
+ msgstr ""
696
+
697
+ #: inc/admin/templates/connected-accounts.php:37
698
+ msgid "Enter a valid Refresh Token"
699
+ msgstr ""
700
+
701
+ #: inc/admin/templates/connected-accounts.php:38
702
+ msgid "Connect This Account"
703
+ msgstr ""
704
+
705
+ #: inc/admin/templates/display.php:1
706
+ msgid "Display your Feed"
707
+ msgstr ""
708
+
709
+ #: inc/admin/templates/display.php:2
710
+ msgid ""
711
+ "Copy and paste the following shortcode directly into the page, post or "
712
+ "widget where you'd like the feed to show up:"
713
+ msgstr ""
714
+
715
+ #: inc/admin/templates/display.php:3 inc/admin/templates/main.php:59
716
+ #: inc/admin/templates/single-connected-account.php:39
717
+ #: inc/admin/templates/single-connected-account.php:40
718
+ #: inc/admin/templates/single-connected-account.php:41
719
+ msgid "To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)."
720
+ msgstr ""
721
+
722
+ #: inc/admin/templates/display.php:5
723
+ msgid "Multiple Feeds"
724
+ msgstr ""
725
+
726
+ #: inc/admin/templates/display.php:6
727
+ msgid ""
728
+ "If you'd like to display multiple feeds then you can set different settings "
729
+ "directly in the shortcode like so:"
730
+ msgstr ""
731
+
732
+ #: inc/admin/templates/display.php:8
733
+ msgid ""
734
+ "You can display as many different feeds as you like, on either the same page "
735
+ "or on different pages, by just using the shortcode options below. For "
736
+ "example:"
737
+ msgstr ""
738
+
739
+ #: inc/admin/templates/display.php:13
740
+ msgid "See the table below for a full list of available shortcode options:"
741
+ msgstr ""
742
+
743
+ #: inc/admin/templates/display.php:18
744
+ msgid "Shortcode option"
745
+ msgstr ""
746
+
747
+ #: inc/admin/templates/display.php:20
748
+ msgid "Example"
749
+ msgstr ""
750
+
751
+ #: inc/admin/templates/display.php:37 inc/admin/templates/support.php:1
752
+ msgid "Need help?"
753
+ msgstr ""
754
+
755
+ #: inc/admin/templates/display.php:37
756
+ msgid "Get Support"
757
+ msgstr ""
758
+
759
+ #: inc/admin/templates/main.php:17
760
+ msgid "Settings saved."
761
+ msgstr ""
762
+
763
+ #: inc/admin/templates/main.php:50
764
+ msgid "Next Step"
765
+ msgstr ""
766
+
767
+ #: inc/admin/templates/main.php:54
768
+ msgid "Need help setting up the plugin? Check out our <a href=\""
769
+ msgstr ""
770
+
771
+ #: inc/admin/templates/main.php:58
772
+ msgid ""
773
+ "Copy and paste this shortcode directly into the page, post or widget where "
774
+ "you'd like to display the feed:"
775
+ msgstr ""
776
+
777
+ #: inc/admin/templates/main.php:60
778
+ msgid "Find out how to display <a href='?page="
779
+ msgstr ""
780
+
781
+ #: inc/admin/templates/single-connected-account.php:4
782
+ msgid ""
783
+ "The Access Token for this account is expired or invalid. Click the button "
784
+ "above to attempt to renew it."
785
+ msgstr ""
786
+
787
+ #: inc/admin/templates/single-connected-account.php:9
788
+ msgid "Remove"
789
+ msgstr ""
790
+
791
+ #: inc/admin/templates/single-connected-account.php:14
792
+ msgid "Channel ID:"
793
+ msgstr ""
794
+
795
+ #: inc/admin/templates/single-connected-account.php:18
796
+ msgid "Add to another Feed"
797
+ msgstr ""
798
+
799
+ #: inc/admin/templates/single-connected-account.php:19
800
+ msgid "Show access token and account info"
801
+ msgstr ""
802
+
803
+ #: inc/admin/templates/single-connected-account.php:24
804
+ msgid "Copy and paste this shortcode into your page or widget area"
805
+ msgstr ""
806
+
807
+ #: inc/admin/templates/single-connected-account.php:32
808
+ msgid ""
809
+ "To add multiple channels in the same feed, simply separate them using commas"
810
+ msgstr ""
811
+
812
+ #: inc/admin/templates/single-connected-account.php:35
813
+ #, php-format
814
+ msgid "Click on the %s tab to learn more about shortcodes"
815
+ msgstr ""
816
+
817
+ #: inc/admin/templates/single-connected-account.php:35
818
+ msgid "Display Your Feed"
819
+ msgstr ""
820
+
821
+ #: inc/admin/templates/single-connected-account.php:39
822
+ msgid "Access Token"
823
+ msgstr ""
824
+
825
+ #: inc/admin/templates/single-connected-account.php:40
826
+ msgid "Refresh Token"
827
+ msgstr ""
828
+
829
+ #: inc/admin/templates/single-connected-account.php:41
830
+ msgid "Channel ID"
831
+ msgstr ""
832
+
833
+ #: inc/admin/templates/support.php:3
834
+ msgid "Check out our "
835
+ msgstr ""
836
+
837
+ #: inc/admin/templates/support.php:3
838
+ msgid "setup directions"
839
+ msgstr ""
840
+
841
+ #: inc/admin/templates/support.php:3
842
+ msgid "for a step-by-step guide on how to setup and use the plugin"
843
+ msgstr ""
844
+
845
+ #: inc/admin/templates/support.php:5
846
+ msgid "Have a problem? Submit a "
847
+ msgstr ""
848
+
849
+ #: inc/admin/templates/support.php:5
850
+ msgid "support ticket"
851
+ msgstr ""
852
+
853
+ #: inc/admin/templates/support.php:5
854
+ msgid "on our website"
855
+ msgstr ""
856
+
857
+ #: inc/admin/templates/support.php:5
858
+ msgid "Please include your <b>System Info</b> below with all support requests."
859
+ msgstr ""
860
+
861
+ #: inc/admin/templates/support.php:8
862
+ msgid "System Info"
863
+ msgstr ""
864
+
865
+ #: inc/admin/templates/support.php:8
866
+ msgid "Click the text below to select all"
867
+ msgstr ""
868
+
869
+ #: inc/class-sby-api-connect.php:104
870
+ #, php-format
871
+ msgid "Error: %s."
872
+ msgstr ""
873
+
874
+ #: inc/class-sby-api-connect.php:106
875
+ msgid ""
876
+ "There's an issue with the YouTube API Key that you are using. Please check "
877
+ "to make sure that this is a valid API Key."
878
+ msgstr ""
879
+
880
+ #: inc/class-sby-api-connect.php:120
881
+ #, php-format
882
+ msgid "Error connecting to %s."
883
+ msgstr ""
884
+
885
+ #: inc/class-sby-feed.php:971
886
+ msgid "Error: No videos found."
887
+ msgstr ""
888
+
889
+ #: inc/class-sby-feed.php:972
890
+ msgid ""
891
+ "Make sure this is a valid channel ID and that the channel has videos "
892
+ "available on youtube.com."
893
+ msgstr ""
894
+
895
+ #: inc/class-sby-feed.php:1102
896
+ msgid "No posts found."
897
+ msgstr ""
898
+
899
+ #: inc/class-sby-posts-manager.php:235
900
+ msgid "There was an error creating the folder for storing resized images."
901
+ msgstr ""
902
+
903
+ #: inc/class-sby-posts-manager.php:323
904
+ msgid "Notice: API requests are being delayed for 5 minutes."
905
+ msgstr ""
906
+
907
+ #: inc/class-sby-posts-manager.php:323
908
+ msgid "Feed will not update."
909
+ msgstr ""
910
+
911
+ #: inc/class-sby-posts-manager.php:332
912
+ msgid ""
913
+ "There may be an issue with the YouTube access token that you are using. Your "
914
+ "server might also be unable to connect to YouTube at this time."
915
+ msgstr ""
916
+
917
+ #: inc/sby-functions.php:29 inc/sby-functions.php:137
918
+ msgid "This error message is only visible to WordPress admins"
919
+ msgstr ""
920
+
921
+ #: inc/sby-functions.php:30
922
+ msgid "Error: No connected account or API key."
923
+ msgstr ""
924
+
925
+ #: inc/sby-functions.php:31
926
+ msgid ""
927
+ "Please go to the YouTube Feed settings page to enter an API key or connect "
928
+ "an account."
929
+ msgstr ""
930
+
931
+ #: inc/widget.php:13
932
+ msgid "YouTube Feed"
933
+ msgstr ""
934
+
935
+ #: inc/widget.php:14
936
+ msgid "Display your YouTube feed"
937
+ msgstr ""
938
+
939
+ #: inc/widget.php:40
940
+ msgid "Title:"
941
+ msgstr ""
942
+
943
+ #: templates/item.php:23 templates/player.php:10
944
+ msgid "Image for post"
945
+ msgstr ""
946
+
947
+ #: templates/item.php:35 templates/player.php:17
948
+ #, php-format
949
+ msgid "YouTube Video %s"
950
+ msgstr ""
951
+
952
+ #: youtube-feed.php:97
953
+ msgid "Feeds for YouTube"
954
+ msgstr ""
955
+
956
+ #: youtube-feed.php:100
957
+ msgid "a"
958
+ msgstr ""
959
+
960
+ #: youtube-feed.php:103
961
+ msgid "YouTube"
962
+ msgstr ""
963
+
964
+ #: youtube-feed.php:154
965
+ msgid "Videos"
966
+ msgstr ""
967
+
968
+ #: youtube-feed.php:155
969
+ msgid " "
970
+ msgstr ""
971
+
972
+ #: youtube-feed.php:156 youtube-feed.php:157
973
+ msgid "Add New Video"
974
+ msgstr ""
975
+
976
+ #: youtube-feed.php:158
977
+ msgid "Edit Video"
978
+ msgstr ""
979
+
980
+ #: youtube-feed.php:159
981
+ msgid "View Video"
982
+ msgstr ""
983
+
984
+ #: youtube-feed.php:160
985
+ msgid "All Videos"
986
+ msgstr ""
987
+
988
+ #: youtube-feed.php:487
989
+ msgid "Settings"
990
+ msgstr ""
trunk/languages/youtube-feed-de_DE.mo ADDED
Binary file
trunk/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 ""
trunk/languages/youtube-feed-fr_FR.mo ADDED
Binary file
trunk/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 ""
trunk/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 ""
trunk/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-cols="<?php echo esc_attr( $cols_setting ); ?>" data-colsmobile="<?php echo esc_attr( $mobile_cols_setting ); ?>" 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>
trunk/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'], 'feeds-for-youtube' );
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'], 'feeds-for-youtube' );
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>
trunk/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>
trunk/templates/item.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ $context = 'item';
15
+ $classes = SBY_Display_Elements::get_item_classes( $settings, $offset );
16
+ $post_id = SBY_Parse::get_post_id( $post );
17
+ $timestamp = SBY_Parse::get_timestamp( $post );
18
+ $video_id = SBY_Parse::get_video_id( $post );
19
+ $media_url = SBY_Display_Elements::get_optimum_media_url( $post, $settings );
20
+ $media_full_res = SBY_Parse::get_media_url( $post );
21
+ $media_all_sizes_json = SBY_Parse::get_media_src_set( $post );
22
+ $permalink = SBY_Parse::get_permalink( $post );
23
+ $img_alt = SBY_Parse::get_caption( $post, __( 'Image for post' ) . ' ' . $post_id );
24
+ $items_style_attr = SBY_Display_Elements::get_style_att( 'item', $settings );
25
+ $title = SBY_Parse::get_video_title( $post );
26
+
27
+ $additional_atts = apply_filters( 'sby_item_additional_data_atts', array(), $post, array() );
28
+ $additional_atts_string = SBY_Display_Elements::escaped_data_att_string( $additional_atts );
29
+ ?>
30
+ <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; ?><?php echo $additional_atts_string; ?>>
31
+ <div class="sby_video_thumbnail_wrap">
32
+ <a class="sby_video_thumbnail sby_item_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 ); ?>">
33
+ <img src="<?php echo esc_url( $media_url ); ?>" alt="<?php echo esc_attr( $img_alt ); ?>">
34
+
35
+ <div class="sby_thumbnail_hover">
36
+ <span class="sby_video_title"><?php echo esc_html( $title ); ?></span>
37
+ </div>
38
+
39
+ <span class="sby-screenreader"><?php echo sprintf( __( 'YouTube Video %s', 'feeds-for-youtube' ), $post_id ); ?></span>
40
+ <?php if ( SBY_Display_Elements::should_show_element( 'icon', $context, $settings ) ) : ?>
41
+ <div class="sby_play_btn">
42
+ <span class="sby_play_btn_bg"></span>
43
+ <?php echo SBY_Display_Elements::get_icon( 'play', 'svg' ); ?>
44
+ </div>
45
+ <?php endif; ?>
46
+ <span class="sby_loader sby_hidden" style="background-color: rgb(255, 255, 255);"></span>
47
+ </a>
48
+
49
+ <?php if ( $settings['layout'] === 'list' ) : ?>
50
+ <div id="sby_player_<?php echo esc_html( $video_id ); ?>" class="sby_player_wrap"></div>
51
+ <?php endif; ?>
52
+
53
+ </div>
54
+ </div>
trunk/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 sby_player_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', 'feeds-for-youtube' ), $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>
trunk/uninstall.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_channel_ids' );
20
+ delete_option( 'sby_channel_status' );
21
+ delete_option( 'sby_cron_report' );
22
+ delete_option( 'sby_errors' );
23
+ delete_option( 'sby_ajax_status' );
24
+ delete_option( 'sby_db_version' );
25
+
26
+ // delete role
27
+ global $wp_roles;
28
+ $wp_roles->remove_cap( 'administrator', 'manage_youtube_feed_options' );
29
+
30
+ // delete all custom post type data
31
+ global $wpdb;
32
+
33
+ $youtube_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type = 'sby_videos';" );
34
+
35
+ $id_string = implode( ', ', $youtube_ids );
36
+ if ( ! empty( $id_string ) ) {
37
+ $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE post_id IN ($id_string);" );
38
+ $wpdb->query( "DELETE FROM $wpdb->posts WHERE post_type = 'sby_videos';" );
39
+ }
40
+
41
+ // delete transients and backup data
42
+ $table_name = $wpdb->prefix . "options";
43
+ $wpdb->query( "
44
+ DELETE
45
+ FROM $table_name
46
+ WHERE `option_name` LIKE ('%\!sby\_%')
47
+ " );
48
+ $wpdb->query( "
49
+ DELETE
50
+ FROM $table_name
51
+ WHERE `option_name` LIKE ('%\~sby\_%')
52
+ " );
53
+ $wpdb->query( "
54
+ DELETE
55
+ FROM $table_name
56
+ WHERE `option_name` LIKE ('%\_transient\_sby\_%')
57
+ " );
58
+ $wpdb->query( "
59
+ DELETE
60
+ FROM $table_name
61
+ WHERE `option_name` LIKE ('%\_transient\_timeout\_sby\_%')
62
+ " );
63
+ $wpdb->query( "
64
+ DELETE
65
+ FROM $table_name
66
+ WHERE `option_name` LIKE ('%\_transient\_&sby\_%')
67
+ " );
68
+ $wpdb->query( "
69
+ DELETE
70
+ FROM $table_name
71
+ WHERE `option_name` LIKE ('%\_transient\_timeout\_&sby\_%')
72
+ " );
73
+ $wpdb->query( "
74
+ DELETE
75
+ FROM $table_name
76
+ WHERE `option_name` LIKE ('%\_transient\_\$sby\_%')
77
+ " );
78
+ $wpdb->query( "
79
+ DELETE
80
+ FROM $table_name
81
+ WHERE `option_name` LIKE ('%\_transient\_timeout\_\$sby\_%')
82
+ " );
83
+
84
+ //delete image resizing related things
85
+ $posts_table_name = $wpdb->prefix . 'sby_items';
86
+ $feeds_posts_table_name = esc_sql( $wpdb->prefix . 'sby_items_feeds' );
87
+
88
+ $upload = wp_upload_dir();
89
+ $wpdb->query( "DROP TABLE IF EXISTS $posts_table_name" );
90
+ $wpdb->query( "DROP TABLE IF EXISTS $feeds_posts_table_name" );
91
+
92
+ $image_files = glob( trailingslashit( $upload['basedir'] ) . trailingslashit( 'sby-local-media' ) . '*' ); // get all file names
93
+ foreach ( $image_files as $file ) { // iterate files
94
+ if ( is_file( $file ) ) {
95
+ unlink( $file );
96
+ } // delete file
97
+ }
98
+
99
+ global $wp_filesystem;
100
+
101
+ $wp_filesystem->delete( trailingslashit( $upload['basedir'] ) . trailingslashit( 'sby-local-media' ) , true );
102
+ }
103
+
104
+
trunk/youtube-feed.php ADDED
@@ -0,0 +1,636 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 customizable YouTube feeds from any YouTube channel.
6
+ Version: 1.2.3
7
+ Author: Smash Balloon YouTube Team
8
+ Author URI: http://smashballoon.com/
9
+ Text Domain: feeds-for-youtube
10
+ */
11
+ /*
12
+ Copyright 2020 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.2.3' );
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
+ // Plugin Folder Path.
51
+ if ( ! defined( 'SBY_PLUGIN_DIR' ) ) {
52
+ define( 'SBY_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
53
+ }
54
+ // Plugin Folder URL.
55
+ if ( ! defined( 'SBY_PLUGIN_URL' ) ) {
56
+ define( 'SBY_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
57
+ }
58
+
59
+ if ( function_exists( 'sby_init' ) ) {
60
+ wp_die( "Please deactivate Feeds for YouTube.<br /><br />Back to the WordPress <a href='".get_admin_url( null, 'plugins.php' )."'>Plugins page</a>." );
61
+ } else {
62
+ /**
63
+ * Define constants and load plugin files
64
+ *
65
+ * @since 2.0
66
+ */
67
+ function sby_init() {
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
+ if ( ! defined( 'SBY_CHANNEL_CACHE_PREFIX' ) ) {
84
+ define( 'SBY_CHANNEL_CACHE_PREFIX', '~sby_' );
85
+ }
86
+ // Max Records in Database for Image Resizing
87
+ if ( ! defined( 'SBY_MAX_RECORDS' ) ) {
88
+ define( 'SBY_MAX_RECORDS', 100 );
89
+ }
90
+ if ( ! defined( 'SBY_TEXT_DOMAIN' ) ) {
91
+ define( 'SBY_TEXT_DOMAIN', 'feeds-for-youtube' );
92
+ }
93
+ if ( ! defined( 'SBY_SLUG' ) ) {
94
+ define( 'SBY_SLUG', 'youtube-feed' );
95
+ }
96
+ if ( ! defined( 'SBY_PLUGIN_NAME' ) ) {
97
+ define( 'SBY_PLUGIN_NAME', __( 'Feeds for YouTube', SBY_TEXT_DOMAIN ) );
98
+ }
99
+ if ( ! defined( 'SBY_INDEF_ART' ) ) {
100
+ define( 'SBY_INDEF_ART', __( 'a', SBY_TEXT_DOMAIN ) );
101
+ }
102
+ if ( ! defined( 'SBY_SOCIAL_NETWORK' ) ) {
103
+ define( 'SBY_SOCIAL_NETWORK', __( 'YouTube', SBY_TEXT_DOMAIN ) );
104
+ }
105
+ if ( ! defined( 'SBY_SETUP_URL' ) ) {
106
+ define( 'SBY_SETUP_URL', 'https://smashballoon.com/youtube-feed/free');
107
+ }
108
+ if ( ! defined( 'SBY_SUPPORT_URL' ) ) {
109
+ define( 'SBY_SUPPORT_URL', 'https://smashballoon.com/youtube-feed/support');
110
+ }
111
+ if ( ! defined( 'SBY_OAUTH_PROCESSOR_URL' ) ) {
112
+ define( 'SBY_OAUTH_PROCESSOR_URL', 'https://smashballoon.com/youtube-login/?return_uri=');
113
+ }
114
+ if ( ! defined( 'SBY_DEMO_URL' ) ) {
115
+ define( 'SBY_DEMO_URL', 'https://smashballoon.com/youtube-feed/demo' );
116
+ }
117
+ if ( ! defined( 'SBY_PRO_LOGO' ) ) {
118
+ define( 'SBY_PRO_LOGO', SBY_PLUGIN_URL . '/img/smash-balloon-logo-small.png' );
119
+ }
120
+
121
+ global $sby_settings;
122
+ $sby_settings = get_option( 'sby_settings', array() );
123
+ $sby_settings = wp_parse_args( $sby_settings, sby_settings_defaults() );
124
+
125
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-vars.php';
126
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/sby-functions.php';
127
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-api-connect.php';
128
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-cron-update.php';
129
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-display-elements.php';
130
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-feed.php';
131
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-parse.php';
132
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-posts-manager.php';
133
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-rss-connect.php';
134
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-settings.php';
135
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-wp-post.php';
136
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/widget.php';
137
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/blocks/class-sby-blocks.php';
138
+
139
+ $sby_blocks = new SBY_Blocks();
140
+
141
+ if ( $sby_blocks->allow_load() ) {
142
+ $sby_blocks->load();
143
+ }
144
+
145
+ if ( is_admin() ) {
146
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/admin-functions.php';
147
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/class-sbspf-admin.php';
148
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/class-sby-admin.php';
149
+ sby_admin_init();
150
+ }
151
+
152
+ global $sby_posts_manager;
153
+ $sby_posts_manager = new SBY_Posts_Manager( 'sby', get_option( 'sby_errors', array() ), get_option( 'sby_ajax_status', array( 'tested' => false, 'successful' => false ) ) );
154
+ }
155
+ add_action( 'plugins_loaded', 'sby_init' );
156
+
157
+ function sby_register_cpt() {
158
+ register_post_type( SBY_CPT, array(
159
+ 'label' => SBY_SOCIAL_NETWORK,
160
+ 'labels' => array(
161
+ 'name' => SBY_SOCIAL_NETWORK . ' ' . __( 'Videos', SBY_TEXT_DOMAIN ),
162
+ 'singular_name' => __( SBY_SOCIAL_NETWORK . ' ' . 'Video', SBY_TEXT_DOMAIN ),
163
+ 'add_new' => __( 'Add New Video', SBY_TEXT_DOMAIN ),
164
+ 'add_new_item' => __( 'Add New Video', SBY_TEXT_DOMAIN ),
165
+ 'edit_item' => __( 'Edit Video', SBY_TEXT_DOMAIN ),
166
+ 'view_item' => __( 'View Video', SBY_TEXT_DOMAIN ),
167
+ 'all_items' => __( 'All Videos', SBY_TEXT_DOMAIN ),
168
+ ),
169
+ 'public' => false,
170
+ 'show_ui' => false,
171
+ 'show_in_menu' => false,
172
+ 'query_var' => false,
173
+ 'rewrite' => false,
174
+ 'has_archive' => false,
175
+ 'hierarchical' => false,
176
+ 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'author' ) //'comments'
177
+ ) );
178
+ }
179
+
180
+ add_action( 'init', 'sby_register_cpt' );
181
+
182
+ /**
183
+ * Add the custom interval of 30 minutes for cron caching
184
+ *
185
+ * @param array $schedules current list of cron intervals
186
+ *
187
+ * @return array
188
+ *
189
+ * @since 2.0
190
+ */
191
+ function sby_cron_custom_interval( $schedules ) {
192
+ $schedules['sby30mins'] = array(
193
+ 'interval' => 30 * 60,
194
+ 'display' => __( 'Every 30 minutes' )
195
+ );
196
+
197
+ return $schedules;
198
+ }
199
+
200
+ add_filter( 'cron_schedules', 'sby_cron_custom_interval' );
201
+
202
+ /**
203
+ * Create database tables, schedule cron events, initiate capabilities
204
+ *
205
+ * @param bool $network_wide is a multisite network activation
206
+ *
207
+ * @since 2.0 database tables and capabilties created
208
+ * @since 1.0
209
+ */
210
+ function sby_activate( $network_wide ) {
211
+ include_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/sby-functions.php';
212
+
213
+ //Clear page caching plugins and autoptomize
214
+ if ( is_callable( 'sby_clear_page_caches' ) ) {
215
+ sby_clear_page_caches();
216
+ }
217
+
218
+ //Run cron twice daily when plugin is first activated for new users
219
+ if ( ! wp_next_scheduled( 'sby_cron_job' ) ) {
220
+ wp_schedule_event( time(), 'twicedaily', 'sby_cron_job' );
221
+ }
222
+
223
+ $sby_settings = get_option( 'sby_settings', array() );
224
+ if ( isset( $sby_settings['caching_type'] ) && $sby_settings['caching_type'] === 'background' ) {
225
+ require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'inc/class-sby-cron-update.php';
226
+ require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'inc/sby-functions.php';
227
+
228
+ SBY_Cron_Updater::start_cron_job( $sby_settings['cache_cron_interval'], $sby_settings['cache_cron_time'], $sby_settings['cache_cron_am_pm'] );
229
+ }
230
+
231
+ if ( is_multisite() && $network_wide && function_exists( 'get_sites' ) && class_exists( 'WP_Site_Query' ) ) {
232
+ // Get all blogs in the network and activate plugin on each one
233
+ $sites = get_sites();
234
+ foreach ( $sites as $site ) {
235
+ switch_to_blog( $site->blog_id );
236
+ $upload = wp_upload_dir();
237
+ $upload_dir = $upload['basedir'];
238
+ $upload_dir = trailingslashit( $upload_dir ) . SBY_UPLOADS_NAME;
239
+ if ( ! file_exists( $upload_dir ) ) {
240
+ $created = wp_mkdir_p( $upload_dir );
241
+ }
242
+ restore_current_blog();
243
+ }
244
+
245
+ } else {
246
+ $upload = wp_upload_dir();
247
+ $upload_dir = $upload['basedir'];
248
+ $upload_dir = trailingslashit( $upload_dir ) . SBY_UPLOADS_NAME;
249
+ if ( ! file_exists( $upload_dir ) ) {
250
+ $created = wp_mkdir_p( $upload_dir );
251
+ }
252
+ }
253
+
254
+ global $wp_roles;
255
+ $wp_roles->add_cap( 'administrator', 'manage_youtube_feed_options' );
256
+ }
257
+ register_activation_hook( __FILE__, 'sby_activate' );
258
+
259
+ /**
260
+ * Stop cron events when deactivated
261
+ *
262
+ * @since 1.0
263
+ */
264
+ function sby_deactivate() {
265
+ wp_clear_scheduled_hook( 'sby_cron_job' );
266
+ }
267
+ register_deactivation_hook( __FILE__, 'sby_deactivate' );
268
+
269
+
270
+ /**
271
+ * Compares previous plugin version and updates database related
272
+ * items as needed
273
+ *
274
+ * @since 2.0
275
+ */
276
+ function sby_check_for_db_updates() {
277
+
278
+ $db_ver = get_option( 'sby_db_version', 0 );
279
+
280
+ if ( (float) $db_ver < 1.0 ) {
281
+ update_option( 'sby_db_version', SBY_DBVERSION );
282
+ }
283
+
284
+ if ( (float) $db_ver < 1.1 ) {
285
+
286
+ $sby_statuses_option = get_option( 'sby_statuses', array() );
287
+
288
+ if ( ! isset( $sby_statuses_option['first_install'] ) ) {
289
+
290
+ $options_set = get_option( 'sby_settings', false );
291
+
292
+ if ( $options_set ) {
293
+ $sby_statuses_option['first_install'] = 'from_update';
294
+ } else {
295
+ $sby_statuses_option['first_install'] = time();
296
+ }
297
+
298
+ $sby_rating_notice_option = get_option( 'sby_rating_notice', false );
299
+
300
+ if ( $sby_rating_notice_option === 'dismissed' ) {
301
+ $sby_statuses_option['rating_notice_dismissed'] = time();
302
+ }
303
+
304
+ $sby_rating_notice_waiting = get_transient( 'feeds_for_youtube_rating_notice_waiting' );
305
+
306
+ if ( $sby_rating_notice_waiting === false
307
+ && $sby_rating_notice_option === false ) {
308
+ $time = 2 * WEEK_IN_SECONDS;
309
+ set_transient( 'feeds_for_youtube_rating_notice_waiting', 'waiting', $time );
310
+ update_option( 'sby_rating_notice', 'pending', false );
311
+ }
312
+
313
+ update_option( 'sby_statuses', $sby_statuses_option, false );
314
+
315
+ }
316
+
317
+ update_option( 'sby_db_version', SBY_DBVERSION );
318
+ }
319
+
320
+ if ( (float) $db_ver < 1.2 ) {
321
+ sby_add_caps();
322
+
323
+ update_option( 'sby_db_version', SBY_DBVERSION );
324
+ }
325
+
326
+ }
327
+ add_action( 'wp_loaded', 'sby_check_for_db_updates' );
328
+
329
+ function sby_add_caps() {
330
+ global $wp_roles;
331
+
332
+ $pto = get_post_type_object( SBY_CPT );
333
+
334
+ $admin_caps = array(
335
+ 'edit_' . SBY_CPT,
336
+ 'read_' . SBY_CPT,
337
+ 'delete_' . SBY_CPT,
338
+ 'edit_' . SBY_CPT,
339
+ 'edit_others_' . SBY_CPT,
340
+ 'publish_' . SBY_CPT,
341
+ 'read_private_' . SBY_CPT,
342
+ 'read',
343
+ 'delete_' . SBY_CPT,
344
+ 'delete_private_' . SBY_CPT,
345
+ 'delete_published_' . SBY_CPT,
346
+ 'delete_others_' . SBY_CPT,
347
+ 'edit_private_' . SBY_CPT,
348
+ 'edit_published_' . SBY_CPT,
349
+ );
350
+ $author_caps = array(
351
+ 'edit_' . SBY_CPT,
352
+ 'read_' . SBY_CPT,
353
+ 'delete_' . SBY_CPT,
354
+ 'edit_' . SBY_CPT,
355
+ 'publish_' . SBY_CPT,
356
+ 'read',
357
+ 'delete_' . SBY_CPT,
358
+ 'delete_published_' . SBY_CPT,
359
+ 'edit_published_' . SBY_CPT,
360
+ );
361
+
362
+ if ( ! empty( $pto ) ) {
363
+ foreach ( array( 'administrator', 'editor' ) as $role_id ) {
364
+ foreach ( $admin_caps as $cap ) {
365
+ $wp_roles->add_cap( $role_id, $cap );
366
+ }
367
+ }
368
+ foreach ( $author_caps as $cap ) {
369
+ $wp_roles->add_cap( 'author', $cap );
370
+ }
371
+ }
372
+ }
373
+
374
+ /**
375
+ * Deletes saved data for the plugin unless setting to preserve
376
+ * settings is enabled
377
+ *
378
+ * @since 2.0 custom tables, custom images, and image directory deleted
379
+ * @since 1.0
380
+ */
381
+ function sby_uninstall() {
382
+ if ( ! current_user_can( 'activate_plugins' ) ) {
383
+ return;
384
+ }
385
+
386
+ //If the user is preserving the settings then don't delete them
387
+ $options = get_option( 'sby_settings' );
388
+ $preserve_settings = $options['preserve_settings'];
389
+ if ( $preserve_settings ) {
390
+ return;
391
+ }
392
+
393
+ //Settings
394
+ delete_option( 'sby_settings' );
395
+ delete_option( 'sby_ver' );
396
+ delete_option( 'sby_db_version' );
397
+ delete_option( 'sby_cron_report' );
398
+ delete_option( 'sby_errors' );
399
+ delete_option( 'sby_ajax_status' );
400
+ delete_option( 'sby_statuses' );
401
+
402
+ // Clear backup caches
403
+ global $wpdb;
404
+ $table_name = $wpdb->prefix . "options";
405
+ $wpdb->query( "
406
+ DELETE
407
+ FROM $table_name
408
+ WHERE `option_name` LIKE ('%!sb\_%')
409
+ " );
410
+
411
+ //image resizing
412
+ $upload = wp_upload_dir();
413
+ $posts_table_name = $wpdb->prefix . 'sby_items';
414
+ $feeds_posts_table_name = esc_sql( $wpdb->prefix . 'sby_items_feeds' );
415
+
416
+ $image_files = glob( trailingslashit( $upload['basedir'] ) . trailingslashit( 'sby-local-media' ) . '*' ); // get all file names
417
+ foreach ( $image_files as $file ) { // iterate files
418
+ if ( is_file( $file ) ) {
419
+ unlink( $file );
420
+ } // delete file
421
+ }
422
+
423
+ global $wp_filesystem;
424
+ $wp_filesystem->delete( trailingslashit( $upload['basedir'] ) . trailingslashit( 'sby-local-media' ) , true );
425
+ //Delete tables
426
+ $wpdb->query( "DROP TABLE IF EXISTS $posts_table_name" );
427
+ $wpdb->query( "DROP TABLE IF EXISTS $feeds_posts_table_name" );
428
+
429
+
430
+ global $wp_roles;
431
+ $wp_roles->remove_cap( 'administrator', 'manage_youtube_feed_options' );
432
+
433
+ $pto = get_post_type_object( 'sby_videos' );
434
+
435
+ $admin_caps = array(
436
+ 'edit_sby_videos',
437
+ 'read_sby_videos',
438
+ 'delete_sby_videos',
439
+ 'edit_sby_videos',
440
+ 'edit_others_sby_videos',
441
+ 'publish_sby_videos',
442
+ 'read_private_sby_videos',
443
+ 'read',
444
+ 'delete_sby_videos',
445
+ 'delete_private_sby_videos',
446
+ 'delete_published_sby_videos',
447
+ 'delete_others_sby_videos',
448
+ 'edit_private_sby_videos',
449
+ 'edit_published_sby_videos',
450
+ );
451
+ $author_caps = array(
452
+ 'edit_sby_videos',
453
+ 'read_sby_videos',
454
+ 'delete_sby_videos',
455
+ 'edit_sby_videos',
456
+ 'publish_sby_videos',
457
+ 'read',
458
+ 'delete_sby_videos',
459
+ 'delete_published_sby_videos',
460
+ 'edit_published_sby_videos',
461
+ );
462
+
463
+ if ( ! empty( $pto ) ) {
464
+ foreach ( array( 'administrator', 'editor' ) as $role_id ) {
465
+ foreach ( $admin_caps as $cap ) {
466
+ $wp_roles->remove_cap( $role_id, $cap );
467
+ }
468
+ }
469
+ foreach ( $author_caps as $cap ) {
470
+ $wp_roles->remove_cap( 'author', $cap );
471
+ }
472
+ }
473
+
474
+ $admin_caps = array(
475
+ 'edit_sby_video',
476
+ 'read_sby_video',
477
+ 'delete_sby_video',
478
+ 'edit_sby_video',
479
+ 'edit_others_sby_video',
480
+ 'publish_sby_video',
481
+ 'read_private_sby_video',
482
+ 'read',
483
+ 'delete_sby_video',
484
+ 'delete_private_sby_video',
485
+ 'delete_published_sby_video',
486
+ 'delete_others_sby_video',
487
+ 'edit_private_sby_video',
488
+ 'edit_published_sby_video',
489
+ );
490
+ $author_caps = array(
491
+ 'edit_sby_video',
492
+ 'read_sby_video',
493
+ 'delete_sby_video',
494
+ 'edit_sby_video',
495
+ 'publish_sby_video',
496
+ 'read',
497
+ 'delete_sby_video',
498
+ 'delete_published_sby_video',
499
+ 'edit_published_sby_video',
500
+ );
501
+
502
+ if ( ! empty( $pto ) ) {
503
+ foreach ( array( 'administrator', 'editor' ) as $role_id ) {
504
+ foreach ( $admin_caps as $cap ) {
505
+ $wp_roles->remove_cap( $role_id, $cap );
506
+ }
507
+ }
508
+ foreach ( $author_caps as $cap ) {
509
+ $wp_roles->remove_cap( 'author', $cap );
510
+ }
511
+ }
512
+ }
513
+
514
+ register_uninstall_hook( __FILE__, 'sby_uninstall' );
515
+
516
+ /**
517
+ * Create database tables for sub-site if multisite
518
+ *
519
+ * @param int $blog_id
520
+ * @param int $user_id
521
+ * @param string $domain
522
+ * @param string $path
523
+ * @param string $site_id
524
+ * @param array $meta
525
+ *
526
+ * @since 2.0
527
+ */
528
+ function sby_on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
529
+ if ( is_plugin_active_for_network( 'youtube-feed/youtube-feed.php' ) ) {
530
+ switch_to_blog( $blog_id );
531
+ restore_current_blog();
532
+ }
533
+ }
534
+
535
+ add_action( 'wpmu_new_blog', 'sby_on_create_blog', 10, 6 );
536
+
537
+ /**
538
+ * Delete custom tables if not preserving settings
539
+ *
540
+ * @param array $tables tables to drop
541
+ *
542
+ * @return array
543
+ *
544
+ * @since 2.0
545
+ */
546
+ function sby_on_delete_blog( $tables ) {
547
+ $options = get_option( 'sby_settings' );
548
+ $preserve_settings = $options['preserve_settings'];
549
+ if ( $preserve_settings ) {
550
+ return;
551
+ }
552
+
553
+ global $wpdb;
554
+ $tables[] = $wpdb->prefix . 'sby_items';
555
+ $tables[] = $wpdb->prefix . 'sby_items_feeds';
556
+
557
+ return $tables;
558
+ }
559
+
560
+ add_filter( 'wpmu_drop_tables', 'sby_on_delete_blog' );
561
+
562
+ function sby_settings_defaults() {
563
+ $defaults = array(
564
+ 'connected_accounts' => array(),
565
+ 'type' => 'channel',
566
+ 'channel' => '',
567
+ 'num' => 9,
568
+ 'nummobile' => 9,
569
+ 'minnum' => 9,
570
+ 'widthresp' => true,
571
+ 'class' => '',
572
+ 'height' => '',
573
+ 'heightunit' => '%',
574
+ 'disablemobile' => false,
575
+ 'itemspacing' => 5,
576
+ 'itemspacingunit' => 'px',
577
+ 'background' => '',
578
+ 'headercolor' => '',
579
+ 'subscribecolor' => '',
580
+ 'subscribetextcolor' => '',
581
+ 'buttoncolor' => '',
582
+ 'buttontextcolor' => '',
583
+ 'layout' => 'grid',
584
+ 'playvideo' => 'automatically',
585
+ 'sortby' => 'none',
586
+ 'imageres' => 'auto',
587
+ 'showheader' => true,
588
+ 'showdescription' => true,
589
+ 'showbutton' => true,
590
+ 'headersize' => 'small',
591
+ 'headeroutside' => false,
592
+ 'showsubscribe' => true,
593
+ 'buttontext' => __( 'Load More...', 'feeds-for-youtube' ),
594
+ 'subscribetext' => __( 'Subscribe', 'feeds-for-youtube' ),
595
+ 'caching_type' => 'page',
596
+ 'cache_time' => 1,
597
+ 'cache_time_unit' => 'hours',
598
+ 'backup_cache_enabled' => true,
599
+ 'resizeprocess' => 'background',
600
+ 'disable_resize' => true,
601
+ 'storage_process' => 'background',
602
+ 'favor_local' => false,
603
+ 'disable_js_image_loading' => false,
604
+ 'ajax_post_load' => false,
605
+ 'ajaxtheme' => false,
606
+ 'enqueue_css_in_shortcode' => false,
607
+ 'font_method' => 'svg',
608
+ 'customtemplates' => false,
609
+ 'gallerycols' => 3,
610
+ 'gallerycolsmobile' => 2,
611
+ 'gridcols' => 3,
612
+ 'gridcolsmobile' => 2,
613
+ 'include' => array( 'title', 'icon', 'user', 'views', 'date', 'countdown' ),
614
+ 'hoverinclude' => array( 'description', 'stats' ),
615
+ 'playerratio' => '9:16',
616
+ 'eagerload' => false
617
+ );
618
+
619
+ return $defaults;
620
+ }
621
+
622
+ // Add a Settings link to the plugin on the Plugins page
623
+ $plugin_file = 'youtube-feed/youtube-feed.php';
624
+ add_filter( "plugin_action_links_{$plugin_file}", 'sby_add_settings_link', 10, 2 );
625
+ function sby_add_settings_link( $links, $file ) {
626
+ $sby_settings_link = '<a href="' . admin_url( 'admin.php?page=youtube-feed' ) . '">' . __( 'Settings' ) . '</a>';
627
+ array_unshift( $links, $sby_settings_link );
628
+ return $links;
629
+ }
630
+
631
+ function sby_text_domain() {
632
+ load_plugin_textdomain( 'feeds-for-youtube', false, basename( dirname(__FILE__) ) . '/languages' );
633
+ }
634
+ add_action( 'plugins_loaded', 'sby_text_domain' );
635
+ }
636
+
uninstall.php CHANGED
@@ -23,6 +23,9 @@ if ( ! $sby_preserve_settings ) {
23
  delete_option( 'sby_ajax_status' );
24
  delete_option( 'sby_db_version' );
25
 
 
 
 
26
  // delete role
27
  global $wp_roles;
28
  $wp_roles->remove_cap( 'administrator', 'manage_youtube_feed_options' );
23
  delete_option( 'sby_ajax_status' );
24
  delete_option( 'sby_db_version' );
25
 
26
+ delete_option( 'sby_rating_notice' );
27
+ delete_option( 'sby_notifications' );
28
+
29
  // delete role
30
  global $wp_roles;
31
  $wp_roles->remove_cap( 'administrator', 'manage_youtube_feed_options' );
youtube-feed.php CHANGED
@@ -3,7 +3,7 @@
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 customizable YouTube feeds from any YouTube channel.
6
- Version: 1.2.3
7
  Author: Smash Balloon YouTube Team
8
  Author URI: http://smashballoon.com/
9
  Text Domain: feeds-for-youtube
@@ -26,10 +26,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
27
 
28
  if ( ! defined( 'SBYVER' ) ) {
29
- define( 'SBYVER', '1.2.3' );
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' ) ) {
@@ -147,6 +147,17 @@ if ( function_exists( 'sby_init' ) ) {
147
  require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/class-sbspf-admin.php';
148
  require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/class-sby-admin.php';
149
  sby_admin_init();
 
 
 
 
 
 
 
 
 
 
 
150
  }
151
 
152
  global $sby_posts_manager;
@@ -193,6 +204,10 @@ if ( function_exists( 'sby_init' ) ) {
193
  'interval' => 30 * 60,
194
  'display' => __( 'Every 30 minutes' )
195
  );
 
 
 
 
196
 
197
  return $schedules;
198
  }
@@ -219,6 +234,13 @@ if ( function_exists( 'sby_init' ) ) {
219
  if ( ! wp_next_scheduled( 'sby_cron_job' ) ) {
220
  wp_schedule_event( time(), 'twicedaily', 'sby_cron_job' );
221
  }
 
 
 
 
 
 
 
222
 
223
  $sby_settings = get_option( 'sby_settings', array() );
224
  if ( isset( $sby_settings['caching_type'] ) && $sby_settings['caching_type'] === 'background' ) {
@@ -263,6 +285,9 @@ if ( function_exists( 'sby_init' ) ) {
263
  */
264
  function sby_deactivate() {
265
  wp_clear_scheduled_hook( 'sby_cron_job' );
 
 
 
266
  }
267
  register_deactivation_hook( __FILE__, 'sby_deactivate' );
268
 
@@ -323,6 +348,18 @@ if ( function_exists( 'sby_init' ) ) {
323
  update_option( 'sby_db_version', SBY_DBVERSION );
324
  }
325
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  }
327
  add_action( 'wp_loaded', 'sby_check_for_db_updates' );
328
 
@@ -398,6 +435,8 @@ if ( function_exists( 'sby_init' ) ) {
398
  delete_option( 'sby_errors' );
399
  delete_option( 'sby_ajax_status' );
400
  delete_option( 'sby_statuses' );
 
 
401
 
402
  // Clear backup caches
403
  global $wpdb;
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 customizable YouTube feeds from any YouTube channel.
6
+ Version: 1.2.4
7
  Author: Smash Balloon YouTube Team
8
  Author URI: http://smashballoon.com/
9
  Text Domain: feeds-for-youtube
26
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
27
 
28
  if ( ! defined( 'SBYVER' ) ) {
29
+ define( 'SBYVER', '1.2.4' );
30
  }
31
  if ( ! defined( 'SBY_DBVERSION' ) ) {
32
+ define( 'SBY_DBVERSION', 1.3 );
33
  }
34
  // Upload folder name for local image files for posts
35
  if ( ! defined( 'SBY_UPLOADS_NAME' ) ) {
147
  require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/class-sbspf-admin.php';
148
  require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/class-sby-admin.php';
149
  sby_admin_init();
150
+
151
+ if ( version_compare( PHP_VERSION, '5.3.0' ) >= 0
152
+ && version_compare( get_bloginfo('version'), '4.6' , '>' ) ) {
153
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/class-sby-notifications.php';
154
+ $sby_notifications = new SBY_Notifications();
155
+ $sby_notifications->init();
156
+
157
+ require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/admin/class-sby-new-user.php';
158
+ $sby_notifications = new SBY_New_User();
159
+ $sby_notifications->init();
160
+ }
161
  }
162
 
163
  global $sby_posts_manager;
204
  'interval' => 30 * 60,
205
  'display' => __( 'Every 30 minutes' )
206
  );
207
+ $schedules['sbyweekly'] = array(
208
+ 'interval' => 3600 * 24 * 7,
209
+ 'display' => __( 'Weekly' )
210
+ );
211
 
212
  return $schedules;
213
  }
234
  if ( ! wp_next_scheduled( 'sby_cron_job' ) ) {
235
  wp_schedule_event( time(), 'twicedaily', 'sby_cron_job' );
236
  }
237
+ if ( ! wp_next_scheduled( 'sby_notification_update' ) ) {
238
+ $timestamp = strtotime( 'next monday' );
239
+ $timestamp = $timestamp + (3600 * 24 * 7);
240
+ $six_am_local = $timestamp + sby_get_utc_offset() + (6*60*60);
241
+
242
+ wp_schedule_event( $six_am_local, 'sbyweekly', 'sby_notification_update' );
243
+ }
244
 
245
  $sby_settings = get_option( 'sby_settings', array() );
246
  if ( isset( $sby_settings['caching_type'] ) && $sby_settings['caching_type'] === 'background' ) {
285
  */
286
  function sby_deactivate() {
287
  wp_clear_scheduled_hook( 'sby_cron_job' );
288
+ wp_clear_scheduled_hook( 'sby_notification_update' );
289
+ wp_clear_scheduled_hook( 'sby_feed_update' );
290
+ wp_clear_scheduled_hook( 'sby_usage_tracking_cron' );
291
  }
292
  register_deactivation_hook( __FILE__, 'sby_deactivate' );
293
 
348
  update_option( 'sby_db_version', SBY_DBVERSION );
349
  }
350
 
351
+ if ( (float) $db_ver < 1.3 ) {
352
+ if ( ! wp_next_scheduled( 'sby_notification_update' ) ) {
353
+ $timestamp = strtotime( 'next monday' );
354
+ $timestamp = $timestamp + (3600 * 24 * 7);
355
+ $six_am_local = $timestamp + sby_get_utc_offset() + (6*60*60);
356
+
357
+ wp_schedule_event( $six_am_local, 'sbyweekly', 'sby_notification_update' );
358
+ }
359
+
360
+ update_option( 'sby_db_version', SBY_DBVERSION );
361
+ }
362
+
363
  }
364
  add_action( 'wp_loaded', 'sby_check_for_db_updates' );
365
 
435
  delete_option( 'sby_errors' );
436
  delete_option( 'sby_ajax_status' );
437
  delete_option( 'sby_statuses' );
438
+ delete_option( 'sby_notifications' );
439
+ delete_option( 'sby_newuser_notifications' );
440
 
441
  // Clear backup caches
442
  global $wpdb;