Version Description
- Updated: social plugins embed
Download this release
Release Info
Developer | poxtron |
Plugin | WP Embed Facebook |
Version | 2.1.1 |
Comparing to | |
See all releases |
Code changes from version 2.1.0 to 2.1.1
- lang/wp-embed-facebook.pot +299 -130
- lib/admin/admin.css +22 -55
- lib/base_facebook.php +2 -2
- lib/class-wef-comments.php +163 -0
- lib/class-wef-magic-embeds.php +137 -0
- lib/class-wef-social-plugins.php +534 -63
- lib/class-wp-embed-fb-admin.php +474 -250
- lib/class-wp-embed-fb-plugin.php +139 -124
- lib/class-wp-embed-fb.php +214 -193
- lib/js/fb.js +13 -0
- lib/js/fb.min.js +1 -1
- lib/js/wpembedfb.js +4 -3
- lib/js/wpembedfb.min.js +1 -1
- lib/lightbox2/css/lightbox.css +1 -1
- lib/lightbox2/css/lightbox.sass +126 -127
- lib/lightbox2/js/lightbox.js +482 -1
- lib/lightbox2/js/lightbox.min.js +1 -1
- readme.txt +17 -13
- templates/classic/com-page.php +1 -1
- templates/classic/page.php +1 -1
- templates/classic/post.php +1 -1
- templates/classic/profile.php +1 -1
- templates/classic/social-plugin.php +11 -7
- templates/comments.php +5 -0
- templates/default/album.php +1 -1
- templates/default/com-page.php +1 -1
- templates/default/page.php +1 -1
- templates/default/post.php +1 -1
- templates/default/profile.php +1 -1
- templates/default/social-plugin.php +4 -4
- wp-embed-facebook.php +26 -28
lang/wp-embed-facebook.pot
CHANGED
@@ -5,7 +5,7 @@ msgstr ""
|
|
5 |
"Project-Id-Version: WP Embed Facebook 2.1.0\n"
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/wp-embed-facebook\n"
|
8 |
-
"POT-Creation-Date: 2016-06-
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -27,347 +27,514 @@ msgstr ""
|
|
27 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
28 |
"X-Poedit-Wpheader: wp-embed-facebook/.php\n"
|
29 |
|
30 |
-
#: lib/class-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
msgid "Settings"
|
32 |
msgstr ""
|
33 |
|
34 |
-
#: lib/class-wp-embed-fb-admin.php:
|
35 |
-
msgid "
|
|
|
|
|
|
|
|
|
36 |
msgstr ""
|
37 |
|
38 |
-
#: lib/class-wp-embed-fb-admin.php:
|
39 |
msgid "Custom Embeds"
|
40 |
msgstr ""
|
41 |
|
42 |
-
#: lib/class-wp-embed-fb-admin.php:
|
43 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
msgstr ""
|
45 |
|
46 |
-
#: lib/class-wp-embed-fb-admin.php:
|
47 |
-
msgid "
|
48 |
msgstr ""
|
49 |
|
50 |
-
#: lib/class-wp-embed-fb-admin.php:
|
|
|
|
|
|
|
|
|
51 |
msgid "Maximum width in pixels"
|
52 |
msgstr ""
|
53 |
|
54 |
-
#: lib/class-wp-embed-fb-admin.php:
|
55 |
-
msgid "
|
56 |
msgstr ""
|
57 |
|
58 |
-
#: lib/class-wp-embed-fb-admin.php:
|
59 |
-
msgid "
|
60 |
msgstr ""
|
61 |
|
62 |
-
#: lib/class-wp-embed-fb-admin.php:
|
63 |
-
msgid "
|
|
|
|
|
|
|
64 |
msgstr ""
|
65 |
|
66 |
-
#: lib/class-wp-embed-fb-admin.php:
|
67 |
-
msgid "
|
68 |
msgstr ""
|
69 |
|
70 |
-
#: lib/class-wp-embed-fb-admin.php:
|
71 |
-
msgid "
|
72 |
msgstr ""
|
73 |
|
74 |
-
#: lib/class-wp-embed-fb-admin.php:
|
75 |
-
msgid "
|
76 |
msgstr ""
|
77 |
|
78 |
-
#: lib/class-wp-embed-fb-admin.php:
|
79 |
-
msgid "
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: lib/class-wp-embed-fb-admin.php:
|
83 |
-
msgid "
|
84 |
msgstr ""
|
85 |
|
86 |
-
#: lib/class-wp-embed-fb-admin.php:
|
87 |
-
msgid "
|
88 |
msgstr ""
|
89 |
|
90 |
-
#: lib/class-wp-embed-fb-admin.php:
|
91 |
-
msgid "
|
92 |
msgstr ""
|
93 |
|
94 |
-
#: lib/class-wp-embed-fb-admin.php:
|
95 |
-
msgid "
|
96 |
msgstr ""
|
97 |
|
98 |
-
#: lib/class-wp-embed-fb-admin.php:
|
99 |
msgid ""
|
100 |
-
"
|
101 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: lib/class-wp-embed-fb-admin.php:
|
105 |
-
msgid "
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: lib/class-wp-embed-fb-admin.php:
|
109 |
-
msgid "
|
110 |
msgstr ""
|
111 |
|
112 |
-
#: lib/class-wp-embed-fb-admin.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
msgid "App ID"
|
114 |
msgstr ""
|
115 |
|
116 |
-
#: lib/class-wp-embed-fb-admin.php:
|
117 |
msgid "App Secret"
|
118 |
msgstr ""
|
119 |
|
120 |
-
#: lib/class-wp-embed-fb-admin.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
msgid "Albums"
|
122 |
msgstr ""
|
123 |
|
124 |
-
#: lib/class-wp-embed-fb-admin.php:
|
125 |
msgid "Number of Photos"
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: lib/class-wp-embed-fb-admin.php:
|
129 |
msgid "Events"
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: lib/class-wp-embed-fb-admin.php:
|
133 |
-
msgid "Use
|
134 |
msgstr ""
|
135 |
|
136 |
-
#: lib/class-wp-embed-fb-admin.php:
|
137 |
msgid "Pages"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: lib/class-wp-embed-fb-admin.php:
|
141 |
-
#: lib/class-wp-embed-fb-admin.php:
|
142 |
-
msgid "
|
143 |
msgstr ""
|
144 |
|
145 |
-
#: lib/class-wp-embed-fb-admin.php:
|
146 |
msgid "Show like button"
|
147 |
msgstr ""
|
148 |
|
149 |
-
#: lib/class-wp-embed-fb-admin.php:
|
150 |
msgid "Number of posts"
|
151 |
msgstr ""
|
152 |
|
153 |
-
#: lib/class-wp-embed-fb-admin.php:
|
154 |
msgid "Photos"
|
155 |
msgstr ""
|
156 |
|
157 |
-
#: lib/class-wp-embed-fb-admin.php:
|
158 |
msgid "Posts"
|
159 |
msgstr ""
|
160 |
|
161 |
-
#: lib/class-wp-embed-fb-admin.php:
|
162 |
msgid "Videos"
|
163 |
msgstr ""
|
164 |
|
165 |
-
#: lib/class-wp-embed-fb-admin.php:
|
166 |
msgid "Force 16:9 ratio"
|
167 |
msgstr ""
|
168 |
|
169 |
-
#: lib/class-wp-embed-fb-admin.php:
|
170 |
msgid "Profiles"
|
171 |
msgstr ""
|
172 |
|
173 |
-
#: lib/class-wp-embed-fb-admin.php:
|
174 |
msgid "Show follow button"
|
175 |
msgstr ""
|
176 |
|
177 |
-
#: lib/class-wp-embed-fb-admin.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
msgid "Lightbox Options"
|
179 |
msgstr ""
|
180 |
|
181 |
-
#: lib/class-wp-embed-fb-admin.php:
|
182 |
msgid "Show Image Number Label"
|
183 |
msgstr ""
|
184 |
|
185 |
-
#: lib/class-wp-embed-fb-admin.php:
|
186 |
msgid "Album Label"
|
187 |
msgstr ""
|
188 |
|
189 |
-
#: lib/class-wp-embed-fb-admin.php:
|
190 |
msgid "Fade Duration"
|
191 |
msgstr ""
|
192 |
|
193 |
-
#: lib/class-wp-embed-fb-admin.php:
|
194 |
msgid "Resize Duration"
|
195 |
msgstr ""
|
196 |
|
197 |
-
#: lib/class-wp-embed-fb-admin.php:
|
198 |
msgid "Position From Top"
|
199 |
msgstr ""
|
200 |
|
201 |
-
#: lib/class-wp-embed-fb-admin.php:
|
202 |
msgid "Max Height"
|
203 |
msgstr ""
|
204 |
|
205 |
-
#: lib/class-wp-embed-fb-admin.php:
|
206 |
msgid "Max Width"
|
207 |
msgstr ""
|
208 |
|
209 |
-
#: lib/class-wp-embed-fb-admin.php:
|
210 |
msgid "Always Show Nav On TouchDevices"
|
211 |
msgstr ""
|
212 |
|
213 |
-
#: lib/class-wp-embed-fb-admin.php:
|
214 |
msgid "Fit Images In Viewport"
|
215 |
msgstr ""
|
216 |
|
217 |
-
#: lib/class-wp-embed-fb-admin.php:
|
218 |
msgid "Disable Scrolling"
|
219 |
msgstr ""
|
220 |
|
221 |
-
#: lib/class-wp-embed-fb-admin.php:
|
222 |
msgid "Loop Through Album"
|
223 |
msgstr ""
|
224 |
|
225 |
-
#: lib/class-wp-embed-fb-admin.php:
|
226 |
msgid "Enqueue styles and scripts"
|
227 |
msgstr ""
|
228 |
|
229 |
-
#: lib/class-wp-embed-fb-admin.php:
|
230 |
msgid "Only when there is an embed present"
|
231 |
msgstr ""
|
232 |
|
233 |
-
#: lib/class-wp-embed-fb-admin.php:
|
234 |
msgid "Facebook SDK"
|
235 |
msgstr ""
|
236 |
|
237 |
-
#: lib/class-wp-embed-fb-admin.php:
|
238 |
msgid "Template Styles"
|
239 |
msgstr ""
|
240 |
|
241 |
-
#: lib/class-wp-embed-fb-admin.php:
|
242 |
msgid "Adaptive social plugins script"
|
243 |
msgstr ""
|
244 |
|
245 |
-
#: lib/class-wp-embed-fb-admin.php:
|
246 |
-
msgid "
|
|
|
|
|
|
|
|
|
247 |
msgstr ""
|
248 |
|
249 |
-
#: lib/class-wp-embed-fb-admin.php:
|
250 |
msgid "Other Options"
|
251 |
msgstr ""
|
252 |
|
253 |
-
#: lib/class-wp-embed-fb-admin.php:
|
254 |
msgid "Add fb-root on top of content"
|
255 |
msgstr ""
|
256 |
|
257 |
-
#: lib/class-wp-embed-fb-admin.php:
|
258 |
msgid "Force Facebook SDK script on all site"
|
259 |
msgstr ""
|
260 |
|
261 |
-
#: lib/class-wp-embed-fb-admin.php:
|
262 |
msgid "Force app token"
|
263 |
msgstr ""
|
264 |
|
265 |
-
#: lib/class-wp-embed-fb-admin.php:
|
266 |
-
msgid "Save"
|
267 |
-
msgstr ""
|
268 |
-
|
269 |
-
#: lib/class-wp-embed-fb-admin.php:397
|
270 |
-
msgid ""
|
271 |
-
"All options can be overwritten using the [facebook url ] <a "
|
272 |
-
"href=\"%s\">shortcode</a>"
|
273 |
msgstr ""
|
274 |
|
275 |
-
#: lib/class-wp-embed-fb-admin.php:
|
276 |
msgid "Restore default values?"
|
277 |
msgstr ""
|
278 |
|
279 |
-
#: lib/class-wp-embed-fb-admin.php:
|
280 |
msgid "Restore defaults"
|
281 |
msgstr ""
|
282 |
|
283 |
-
#: lib/class-wp-embed-fb-admin.php:
|
284 |
msgid "Premium Extension Available"
|
285 |
msgstr ""
|
286 |
|
287 |
-
#: lib/class-wp-embed-fb-admin.php:
|
288 |
msgid "Shortcodes for embedding a full event or page."
|
289 |
msgstr ""
|
290 |
|
291 |
-
#: lib/class-wp-embed-fb-admin.php:
|
292 |
msgid "Default event template shows admins and address."
|
293 |
msgstr ""
|
294 |
|
295 |
-
#: lib/class-wp-embed-fb-admin.php:
|
296 |
msgid "Albums with more that 100 photos."
|
297 |
msgstr ""
|
298 |
|
299 |
-
#: lib/class-wp-embed-fb-admin.php:
|
300 |
msgid "One Year Premium Support"
|
301 |
msgstr ""
|
302 |
|
303 |
-
#: lib/class-wp-embed-fb-admin.php:
|
304 |
msgid "Check it out"
|
305 |
msgstr ""
|
306 |
|
307 |
-
#: lib/class-wp-embed-fb-admin.php:
|
308 |
msgid "Plus new features cooking"
|
309 |
msgstr ""
|
310 |
|
311 |
-
#: lib/class-wp-embed-fb-admin.php:
|
312 |
msgid ""
|
313 |
"Embed personal data, shortcode creator, widgets, special templates for "
|
314 |
"albums and pages"
|
315 |
msgstr ""
|
316 |
|
317 |
-
#: lib/class-wp-embed-fb-admin.php:
|
318 |
-
msgid "
|
319 |
msgstr ""
|
320 |
|
321 |
-
#: lib/class-wp-embed-fb-admin.php:
|
322 |
msgid "Rate it"
|
323 |
msgstr ""
|
324 |
|
325 |
-
#: lib/class-wp-embed-fb-admin.php:
|
326 |
msgid "Donate"
|
327 |
msgstr ""
|
328 |
|
329 |
-
#: lib/class-wp-embed-fb-admin.php:
|
330 |
msgid "More information"
|
331 |
msgstr ""
|
332 |
|
333 |
-
#: lib/class-wp-embed-fb
|
334 |
-
msgid ""
|
335 |
-
"To embed albums, events, profiles and video as HTML5 you will need a <a "
|
336 |
-
"target=\"_blank\" href=\"%s\">Facebook App</a>"
|
337 |
-
msgstr ""
|
338 |
-
|
339 |
-
#: lib/class-wp-embed-fb-plugin.php:348
|
340 |
-
msgid ""
|
341 |
-
"This free plugin has taken <strong>thousands of hours</strong> to develop "
|
342 |
-
"and maintain consider making a <a target=\"_blank\" "
|
343 |
-
"href=\"%s\">donation</a> or leaving a <a target=\"_blank\" "
|
344 |
-
"href=\"%s\">review</a> <strong>do not let us loose faith</strong> in "
|
345 |
-
"humanity."
|
346 |
msgstr ""
|
347 |
|
348 |
-
#: lib/class-wp-embed-fb.php:
|
349 |
msgid "Error: Try embedding this post as a social plugin (only visible to admins)"
|
350 |
msgstr ""
|
351 |
|
352 |
-
#: lib/class-wp-embed-fb.php:
|
353 |
msgid "Code"
|
354 |
msgstr ""
|
355 |
|
356 |
-
#: lib/class-wp-embed-fb.php:
|
357 |
-
#: lib/class-wp-embed-fb.php:
|
358 |
msgid "Error"
|
359 |
msgstr ""
|
360 |
|
361 |
-
#: lib/class-wp-embed-fb.php:
|
362 |
msgid ""
|
363 |
"<small>To embed this type of content you need to setup a facebook app on <a "
|
364 |
"href=\"%s\" title=\"WP Embed Facebook Settings\">settings</a></small>"
|
365 |
msgstr ""
|
366 |
|
367 |
-
#: lib/class-wp-embed-fb.php:484
|
368 |
-
msgid "This is not a valid facebook url"
|
369 |
-
msgstr ""
|
370 |
-
|
371 |
#: templates/classic/com-page.php:20 templates/classic/page.php:34
|
372 |
#: templates/classic/post.php:21 templates/default/com-page.php:20
|
373 |
#: templates/default/page.php:34 templates/default/post.php:21
|
@@ -390,6 +557,7 @@ msgstr ""
|
|
390 |
msgid "Creator: "
|
391 |
msgstr ""
|
392 |
|
|
|
393 |
#: templates/default/social-plugin.php:15
|
394 |
msgid "Download this video"
|
395 |
msgstr ""
|
@@ -404,10 +572,11 @@ msgstr ""
|
|
404 |
|
405 |
#. Description of the plugin/theme
|
406 |
msgid ""
|
407 |
-
"Embed any public Facebook video, photo, album, event, page,
|
408 |
-
"post.
|
409 |
-
"
|
410 |
-
"
|
|
|
411 |
msgstr ""
|
412 |
|
413 |
#. Author of the plugin/theme
|
5 |
"Project-Id-Version: WP Embed Facebook 2.1.0\n"
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/wp-embed-facebook\n"
|
8 |
+
"POT-Creation-Date: 2016-06-22 18:07:38+00:00\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
27 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
28 |
"X-Poedit-Wpheader: wp-embed-facebook/.php\n"
|
29 |
|
30 |
+
#: lib/class-wef-magic-embeds.php:100
|
31 |
+
msgid "Shortcode used:"
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: lib/class-wef-magic-embeds.php:105
|
35 |
+
msgid "Final code:"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: lib/class-wef-magic-embeds.php:110
|
39 |
+
msgid "More information:"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: lib/class-wef-social-plugins.php:500
|
43 |
+
msgid "Invalid Facebook plugin type use it like this: [fb_plugin like]"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: lib/class-wp-embed-fb-admin.php:36
|
47 |
+
msgid ""
|
48 |
+
"To embed albums, events, profiles and video as HTML5 you will need a <a "
|
49 |
+
"target=\"_blank\" href=\"%s\">Facebook App</a>"
|
50 |
+
msgstr ""
|
51 |
+
|
52 |
+
#: lib/class-wp-embed-fb-admin.php:41
|
53 |
+
msgid ""
|
54 |
+
"This free plugin has taken <strong>thousands of hours</strong> to develop "
|
55 |
+
"and maintain consider making a <a target=\"_blank\" "
|
56 |
+
"href=\"%s\">donation</a> or leaving a <a target=\"_blank\" "
|
57 |
+
"href=\"%s\">review</a> <strong>do not let us loose faith</strong> in "
|
58 |
+
"humanity."
|
59 |
+
msgstr ""
|
60 |
+
|
61 |
+
#: lib/class-wp-embed-fb-admin.php:135
|
62 |
msgid "Settings"
|
63 |
msgstr ""
|
64 |
|
65 |
+
#: lib/class-wp-embed-fb-admin.php:318
|
66 |
+
msgid "Magic Embeds"
|
67 |
+
msgstr ""
|
68 |
+
|
69 |
+
#: lib/class-wp-embed-fb-admin.php:319
|
70 |
+
msgid "Social Plugins"
|
71 |
msgstr ""
|
72 |
|
73 |
+
#: lib/class-wp-embed-fb-admin.php:320
|
74 |
msgid "Custom Embeds"
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: lib/class-wp-embed-fb-admin.php:321 lib/class-wp-embed-fb-admin.php:596
|
78 |
+
msgid "Lightbox"
|
79 |
+
msgstr ""
|
80 |
+
|
81 |
+
#: lib/class-wp-embed-fb-admin.php:322
|
82 |
+
msgid "Advanced"
|
83 |
+
msgstr ""
|
84 |
+
|
85 |
+
#: lib/class-wp-embed-fb-admin.php:338
|
86 |
+
msgid ""
|
87 |
+
"Auto embeds understand the url you are entering and return a social plugin "
|
88 |
+
"or a custom embed. <br>They can be activated by <a "
|
89 |
+
"href=\"https://codex.wordpress.org/Embeds\" title=\"WordPress Embeds\" "
|
90 |
+
"target=\"_blank\">pasting the url on the editor</a> or by the [facebook url "
|
91 |
+
"] <a href=\"%s\" title=\"[facebook] Shortcode attributes and examples\" "
|
92 |
+
"target=\"_blank\">shortcode</a>."
|
93 |
msgstr ""
|
94 |
|
95 |
+
#: lib/class-wp-embed-fb-admin.php:339
|
96 |
+
msgid "Auto Embeds"
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: lib/class-wp-embed-fb-admin.php:340
|
100 |
+
msgid "Auto embed url's on editor "
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#: lib/class-wp-embed-fb-admin.php:341
|
104 |
msgid "Maximum width in pixels"
|
105 |
msgstr ""
|
106 |
|
107 |
+
#: lib/class-wp-embed-fb-admin.php:342
|
108 |
+
msgid "Embed video as post"
|
109 |
msgstr ""
|
110 |
|
111 |
+
#: lib/class-wp-embed-fb-admin.php:343
|
112 |
+
msgid "%sDownload link under video"
|
113 |
msgstr ""
|
114 |
|
115 |
+
#: lib/class-wp-embed-fb-admin.php:345
|
116 |
+
msgid ""
|
117 |
+
"The quote plugin lets people select text on your page and add it to their "
|
118 |
+
"share.<br><a href=\"%s\" target=\"_blank\" title=\"WP Embed "
|
119 |
+
"Facebook\">Demo</a>"
|
120 |
msgstr ""
|
121 |
|
122 |
+
#: lib/class-wp-embed-fb-admin.php:345
|
123 |
+
msgid "Quote Plugin"
|
124 |
msgstr ""
|
125 |
|
126 |
+
#: lib/class-wp-embed-fb-admin.php:346 lib/class-wp-embed-fb-admin.php:351
|
127 |
+
msgid "Active"
|
128 |
msgstr ""
|
129 |
|
130 |
+
#: lib/class-wp-embed-fb-admin.php:347 lib/class-wp-embed-fb-admin.php:352
|
131 |
+
msgid "Post types"
|
132 |
msgstr ""
|
133 |
|
134 |
+
#: lib/class-wp-embed-fb-admin.php:348 lib/class-wp-embed-fb-admin.php:353
|
135 |
+
msgid "Coma separated post types i.e. post,page,attachment"
|
136 |
msgstr ""
|
137 |
|
138 |
+
#: lib/class-wp-embed-fb-admin.php:350
|
139 |
+
msgid "Comments"
|
140 |
msgstr ""
|
141 |
|
142 |
+
#: lib/class-wp-embed-fb-admin.php:354
|
143 |
+
msgid "Sync comment count"
|
144 |
msgstr ""
|
145 |
|
146 |
+
#: lib/class-wp-embed-fb-admin.php:357
|
147 |
+
msgid "Add open graph meta"
|
148 |
msgstr ""
|
149 |
|
150 |
+
#: lib/class-wp-embed-fb-admin.php:358
|
151 |
+
msgid "Needed to moderate comments"
|
152 |
msgstr ""
|
153 |
|
154 |
+
#: lib/class-wp-embed-fb-admin.php:358
|
155 |
msgid ""
|
156 |
+
"Disable this if you already have another plugin adding <a "
|
157 |
+
"title=\"Moderation Setup Instructions\" target=\"_blank\" href=\"%s\">the "
|
158 |
+
"fb:app_id meta</a>"
|
159 |
+
msgstr ""
|
160 |
+
|
161 |
+
#: lib/class-wp-embed-fb-admin.php:359
|
162 |
+
msgid "To enable comments moderation setup your App ID"
|
163 |
+
msgstr ""
|
164 |
+
|
165 |
+
#: lib/class-wp-embed-fb-admin.php:362
|
166 |
+
msgid ""
|
167 |
+
"If you cant see the \"Moderate comment\" link above each comment you will "
|
168 |
+
"need to <a title=\"Sharing Debugger\" target=\"_blank\" href=\"%s\">scrape "
|
169 |
+
"the url</a>"
|
170 |
+
msgstr ""
|
171 |
+
|
172 |
+
#: lib/class-wp-embed-fb-admin.php:366
|
173 |
+
msgid "Notes:"
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: lib/class-wp-embed-fb-admin.php:368
|
177 |
+
msgid "Facebook settings"
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: lib/class-wp-embed-fb-admin.php:369
|
181 |
+
msgid "Social Plugins Language"
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: lib/class-wp-embed-fb-admin.php:372
|
185 |
+
msgid ""
|
186 |
+
"Creating a Facebook app is easy view the <a href=\"%s\" target=\"_blank\" "
|
187 |
+
"title=\"WP Embed FB documentation\">step by step guide</a> or view <a "
|
188 |
+
"href=\"%s\" target=\"_blank\" title=\"Facebook Apps\">your apps</a>."
|
189 |
+
msgstr ""
|
190 |
+
|
191 |
+
#: lib/class-wp-embed-fb-admin.php:379
|
192 |
msgid "App ID"
|
193 |
msgstr ""
|
194 |
|
195 |
+
#: lib/class-wp-embed-fb-admin.php:381
|
196 |
msgid "App Secret"
|
197 |
msgstr ""
|
198 |
|
199 |
+
#: lib/class-wp-embed-fb-admin.php:393
|
200 |
+
msgid ""
|
201 |
+
"<a title=\"Facebook Social Plugins\" href=\"%s\" rel=\"nofollow\" "
|
202 |
+
"target=\"_blank\">Social plugins</a> are pieces of code that Facebook "
|
203 |
+
"developers created for us mortals."
|
204 |
+
msgstr ""
|
205 |
+
|
206 |
+
#: lib/class-wp-embed-fb-admin.php:395 lib/class-wp-embed-fb-admin.php:532
|
207 |
+
msgid "Example:"
|
208 |
+
msgstr ""
|
209 |
+
|
210 |
+
#: lib/class-wp-embed-fb-admin.php:397
|
211 |
+
msgid "Embed a like button for the curent page:"
|
212 |
+
msgstr ""
|
213 |
+
|
214 |
+
#: lib/class-wp-embed-fb-admin.php:400
|
215 |
+
msgid "add debug=1 to debug the result."
|
216 |
+
msgstr ""
|
217 |
+
|
218 |
+
#: lib/class-wp-embed-fb-admin.php:407
|
219 |
+
msgid "Page plugin"
|
220 |
+
msgstr ""
|
221 |
+
|
222 |
+
#: lib/class-wp-embed-fb-admin.php:414
|
223 |
+
msgid "Comma separated tabs i.e. timeline,events,messages"
|
224 |
+
msgstr ""
|
225 |
+
|
226 |
+
#: lib/class-wp-embed-fb-admin.php:421
|
227 |
+
msgid "Post plugin"
|
228 |
+
msgstr ""
|
229 |
+
|
230 |
+
#: lib/class-wp-embed-fb-admin.php:428
|
231 |
+
msgid "Video"
|
232 |
+
msgstr ""
|
233 |
+
|
234 |
+
#: lib/class-wp-embed-fb-admin.php:435
|
235 |
+
msgid "Single comment"
|
236 |
+
msgstr ""
|
237 |
+
|
238 |
+
#: lib/class-wp-embed-fb-admin.php:439
|
239 |
+
msgid "Activate them on all your posts on the \"Magic embeds\" section"
|
240 |
+
msgstr ""
|
241 |
+
|
242 |
+
#: lib/class-wp-embed-fb-admin.php:439
|
243 |
+
msgid "Comments plugin"
|
244 |
+
msgstr ""
|
245 |
+
|
246 |
+
#: lib/class-wp-embed-fb-admin.php:446
|
247 |
+
msgid "Activate it on all your posts on the \"Magic embeds\" section"
|
248 |
+
msgstr ""
|
249 |
+
|
250 |
+
#: lib/class-wp-embed-fb-admin.php:446
|
251 |
+
msgid "Quote plugin"
|
252 |
+
msgstr ""
|
253 |
+
|
254 |
+
#: lib/class-wp-embed-fb-admin.php:449
|
255 |
+
msgid "Save button"
|
256 |
+
msgstr ""
|
257 |
+
|
258 |
+
#: lib/class-wp-embed-fb-admin.php:452
|
259 |
+
msgid "Like button"
|
260 |
+
msgstr ""
|
261 |
+
|
262 |
+
#: lib/class-wp-embed-fb-admin.php:461
|
263 |
+
msgid "Send button"
|
264 |
+
msgstr ""
|
265 |
+
|
266 |
+
#: lib/class-wp-embed-fb-admin.php:465
|
267 |
+
msgid "Share button"
|
268 |
+
msgstr ""
|
269 |
+
|
270 |
+
#: lib/class-wp-embed-fb-admin.php:469
|
271 |
+
msgid "Follow button"
|
272 |
+
msgstr ""
|
273 |
+
|
274 |
+
#: lib/class-wp-embed-fb-admin.php:479
|
275 |
+
msgid "Adaptive view"
|
276 |
+
msgstr ""
|
277 |
+
|
278 |
+
#: lib/class-wp-embed-fb-admin.php:491
|
279 |
+
msgid "General"
|
280 |
+
msgstr ""
|
281 |
+
|
282 |
+
#: lib/class-wp-embed-fb-admin.php:503
|
283 |
msgid "Albums"
|
284 |
msgstr ""
|
285 |
|
286 |
+
#: lib/class-wp-embed-fb-admin.php:504
|
287 |
msgid "Number of Photos"
|
288 |
msgstr ""
|
289 |
|
290 |
+
#: lib/class-wp-embed-fb-admin.php:506
|
291 |
msgid "Events"
|
292 |
msgstr ""
|
293 |
|
294 |
+
#: lib/class-wp-embed-fb-admin.php:507
|
295 |
+
msgid "Use WP time to calculate the date"
|
296 |
msgstr ""
|
297 |
|
298 |
+
#: lib/class-wp-embed-fb-admin.php:509
|
299 |
msgid "Pages"
|
300 |
msgstr ""
|
301 |
|
302 |
+
#: lib/class-wp-embed-fb-admin.php:510 lib/class-wp-embed-fb-admin.php:515
|
303 |
+
#: lib/class-wp-embed-fb-admin.php:518 lib/class-wp-embed-fb-admin.php:521
|
304 |
+
msgid "Use by default on \"Auto Embeds\""
|
305 |
msgstr ""
|
306 |
|
307 |
+
#: lib/class-wp-embed-fb-admin.php:511
|
308 |
msgid "Show like button"
|
309 |
msgstr ""
|
310 |
|
311 |
+
#: lib/class-wp-embed-fb-admin.php:512
|
312 |
msgid "Number of posts"
|
313 |
msgstr ""
|
314 |
|
315 |
+
#: lib/class-wp-embed-fb-admin.php:514
|
316 |
msgid "Photos"
|
317 |
msgstr ""
|
318 |
|
319 |
+
#: lib/class-wp-embed-fb-admin.php:517
|
320 |
msgid "Posts"
|
321 |
msgstr ""
|
322 |
|
323 |
+
#: lib/class-wp-embed-fb-admin.php:520
|
324 |
msgid "Videos"
|
325 |
msgstr ""
|
326 |
|
327 |
+
#: lib/class-wp-embed-fb-admin.php:522
|
328 |
msgid "Force 16:9 ratio"
|
329 |
msgstr ""
|
330 |
|
331 |
+
#: lib/class-wp-embed-fb-admin.php:524
|
332 |
msgid "Profiles"
|
333 |
msgstr ""
|
334 |
|
335 |
+
#: lib/class-wp-embed-fb-admin.php:525
|
336 |
msgid "Show follow button"
|
337 |
msgstr ""
|
338 |
|
339 |
+
#: lib/class-wp-embed-fb-admin.php:530
|
340 |
+
msgid ""
|
341 |
+
"Custom embeds can be accessed using the [facebook url] or [embed] "
|
342 |
+
"shortcodes also by activating \"Auto Embeds\" on Magic Embeds section."
|
343 |
+
msgstr ""
|
344 |
+
|
345 |
+
#: lib/class-wp-embed-fb-admin.php:537
|
346 |
+
msgid ""
|
347 |
+
"<a href=\"%s\" title=\"WP Embed Facebook Shortcode\" target=\"_blank\">Read "
|
348 |
+
"More</a>"
|
349 |
+
msgstr ""
|
350 |
+
|
351 |
+
#: lib/class-wp-embed-fb-admin.php:544 lib/class-wp-embed-fb-admin.php:576
|
352 |
+
msgid "By default you can only embed public pages, videos, photos and posts."
|
353 |
+
msgstr ""
|
354 |
+
|
355 |
+
#: lib/class-wp-embed-fb-admin.php:545 lib/class-wp-embed-fb-admin.php:577
|
356 |
+
msgid ""
|
357 |
+
"To embed albums, events, profiles and video as HTML5 you will need to setup "
|
358 |
+
"a Facebook App on Magic Embeds section"
|
359 |
+
msgstr ""
|
360 |
+
|
361 |
+
#: lib/class-wp-embed-fb-admin.php:558
|
362 |
msgid "Lightbox Options"
|
363 |
msgstr ""
|
364 |
|
365 |
+
#: lib/class-wp-embed-fb-admin.php:559
|
366 |
msgid "Show Image Number Label"
|
367 |
msgstr ""
|
368 |
|
369 |
+
#: lib/class-wp-embed-fb-admin.php:560
|
370 |
msgid "Album Label"
|
371 |
msgstr ""
|
372 |
|
373 |
+
#: lib/class-wp-embed-fb-admin.php:561
|
374 |
msgid "Fade Duration"
|
375 |
msgstr ""
|
376 |
|
377 |
+
#: lib/class-wp-embed-fb-admin.php:562
|
378 |
msgid "Resize Duration"
|
379 |
msgstr ""
|
380 |
|
381 |
+
#: lib/class-wp-embed-fb-admin.php:563
|
382 |
msgid "Position From Top"
|
383 |
msgstr ""
|
384 |
|
385 |
+
#: lib/class-wp-embed-fb-admin.php:564
|
386 |
msgid "Max Height"
|
387 |
msgstr ""
|
388 |
|
389 |
+
#: lib/class-wp-embed-fb-admin.php:565
|
390 |
msgid "Max Width"
|
391 |
msgstr ""
|
392 |
|
393 |
+
#: lib/class-wp-embed-fb-admin.php:566
|
394 |
msgid "Always Show Nav On TouchDevices"
|
395 |
msgstr ""
|
396 |
|
397 |
+
#: lib/class-wp-embed-fb-admin.php:567
|
398 |
msgid "Fit Images In Viewport"
|
399 |
msgstr ""
|
400 |
|
401 |
+
#: lib/class-wp-embed-fb-admin.php:568
|
402 |
msgid "Disable Scrolling"
|
403 |
msgstr ""
|
404 |
|
405 |
+
#: lib/class-wp-embed-fb-admin.php:569
|
406 |
msgid "Loop Through Album"
|
407 |
msgstr ""
|
408 |
|
409 |
+
#: lib/class-wp-embed-fb-admin.php:590
|
410 |
msgid "Enqueue styles and scripts"
|
411 |
msgstr ""
|
412 |
|
413 |
+
#: lib/class-wp-embed-fb-admin.php:591
|
414 |
msgid "Only when there is an embed present"
|
415 |
msgstr ""
|
416 |
|
417 |
+
#: lib/class-wp-embed-fb-admin.php:592
|
418 |
msgid "Facebook SDK"
|
419 |
msgstr ""
|
420 |
|
421 |
+
#: lib/class-wp-embed-fb-admin.php:593
|
422 |
msgid "Template Styles"
|
423 |
msgstr ""
|
424 |
|
425 |
+
#: lib/class-wp-embed-fb-admin.php:594
|
426 |
msgid "Adaptive social plugins script"
|
427 |
msgstr ""
|
428 |
|
429 |
+
#: lib/class-wp-embed-fb-admin.php:597
|
430 |
+
msgid "Enqueue script"
|
431 |
+
msgstr ""
|
432 |
+
|
433 |
+
#: lib/class-wp-embed-fb-admin.php:598
|
434 |
+
msgid "Attribute"
|
435 |
msgstr ""
|
436 |
|
437 |
+
#: lib/class-wp-embed-fb-admin.php:600
|
438 |
msgid "Other Options"
|
439 |
msgstr ""
|
440 |
|
441 |
+
#: lib/class-wp-embed-fb-admin.php:601
|
442 |
msgid "Add fb-root on top of content"
|
443 |
msgstr ""
|
444 |
|
445 |
+
#: lib/class-wp-embed-fb-admin.php:602
|
446 |
msgid "Force Facebook SDK script on all site"
|
447 |
msgstr ""
|
448 |
|
449 |
+
#: lib/class-wp-embed-fb-admin.php:603
|
450 |
msgid "Force app token"
|
451 |
msgstr ""
|
452 |
|
453 |
+
#: lib/class-wp-embed-fb-admin.php:621
|
454 |
+
msgid "Save all settings"
|
|
|
|
|
|
|
|
|
|
|
|
|
455 |
msgstr ""
|
456 |
|
457 |
+
#: lib/class-wp-embed-fb-admin.php:626
|
458 |
msgid "Restore default values?"
|
459 |
msgstr ""
|
460 |
|
461 |
+
#: lib/class-wp-embed-fb-admin.php:629
|
462 |
msgid "Restore defaults"
|
463 |
msgstr ""
|
464 |
|
465 |
+
#: lib/class-wp-embed-fb-admin.php:637
|
466 |
msgid "Premium Extension Available"
|
467 |
msgstr ""
|
468 |
|
469 |
+
#: lib/class-wp-embed-fb-admin.php:641
|
470 |
msgid "Shortcodes for embedding a full event or page."
|
471 |
msgstr ""
|
472 |
|
473 |
+
#: lib/class-wp-embed-fb-admin.php:643
|
474 |
msgid "Default event template shows admins and address."
|
475 |
msgstr ""
|
476 |
|
477 |
+
#: lib/class-wp-embed-fb-admin.php:645
|
478 |
msgid "Albums with more that 100 photos."
|
479 |
msgstr ""
|
480 |
|
481 |
+
#: lib/class-wp-embed-fb-admin.php:647
|
482 |
msgid "One Year Premium Support"
|
483 |
msgstr ""
|
484 |
|
485 |
+
#: lib/class-wp-embed-fb-admin.php:651
|
486 |
msgid "Check it out"
|
487 |
msgstr ""
|
488 |
|
489 |
+
#: lib/class-wp-embed-fb-admin.php:655
|
490 |
msgid "Plus new features cooking"
|
491 |
msgstr ""
|
492 |
|
493 |
+
#: lib/class-wp-embed-fb-admin.php:658
|
494 |
msgid ""
|
495 |
"Embed personal data, shortcode creator, widgets, special templates for "
|
496 |
"albums and pages"
|
497 |
msgstr ""
|
498 |
|
499 |
+
#: lib/class-wp-embed-fb-admin.php:663
|
500 |
+
msgid "This free plugin has taken thousands of hours to maintain and develop"
|
501 |
msgstr ""
|
502 |
|
503 |
+
#: lib/class-wp-embed-fb-admin.php:668
|
504 |
msgid "Rate it"
|
505 |
msgstr ""
|
506 |
|
507 |
+
#: lib/class-wp-embed-fb-admin.php:676
|
508 |
msgid "Donate"
|
509 |
msgstr ""
|
510 |
|
511 |
+
#: lib/class-wp-embed-fb-admin.php:681
|
512 |
msgid "More information"
|
513 |
msgstr ""
|
514 |
|
515 |
+
#: lib/class-wp-embed-fb.php:47
|
516 |
+
msgid "This is not a valid facebook url"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
517 |
msgstr ""
|
518 |
|
519 |
+
#: lib/class-wp-embed-fb.php:173
|
520 |
msgid "Error: Try embedding this post as a social plugin (only visible to admins)"
|
521 |
msgstr ""
|
522 |
|
523 |
+
#: lib/class-wp-embed-fb.php:176 lib/class-wp-embed-fb.php:215
|
524 |
msgid "Code"
|
525 |
msgstr ""
|
526 |
|
527 |
+
#: lib/class-wp-embed-fb.php:178 lib/class-wp-embed-fb.php:217
|
528 |
+
#: lib/class-wp-embed-fb.php:418
|
529 |
msgid "Error"
|
530 |
msgstr ""
|
531 |
|
532 |
+
#: lib/class-wp-embed-fb.php:425
|
533 |
msgid ""
|
534 |
"<small>To embed this type of content you need to setup a facebook app on <a "
|
535 |
"href=\"%s\" title=\"WP Embed Facebook Settings\">settings</a></small>"
|
536 |
msgstr ""
|
537 |
|
|
|
|
|
|
|
|
|
538 |
#: templates/classic/com-page.php:20 templates/classic/page.php:34
|
539 |
#: templates/classic/post.php:21 templates/default/com-page.php:20
|
540 |
#: templates/default/page.php:34 templates/default/post.php:21
|
557 |
msgid "Creator: "
|
558 |
msgstr ""
|
559 |
|
560 |
+
#: templates/classic/social-plugin.php:15
|
561 |
#: templates/default/social-plugin.php:15
|
562 |
msgid "Download this video"
|
563 |
msgstr ""
|
572 |
|
573 |
#. Description of the plugin/theme
|
574 |
msgid ""
|
575 |
+
"Embed any public Facebook video, photo, album, event, page, comment, "
|
576 |
+
"profile, or post. Add Facebook comments to all your site, insert facebook "
|
577 |
+
"social plugins (like, save, send, share, follow, quote, comments) anywhere "
|
578 |
+
"on your site. View the <a href=\"http://www.wpembedfb.com/demo-site/\" "
|
579 |
+
"title=\"plugin website\" target=\"_blank\">demo site</a>."
|
580 |
msgstr ""
|
581 |
|
582 |
#. Author of the plugin/theme
|
lib/admin/admin.css
CHANGED
@@ -1,10 +1,4 @@
|
|
1 |
-
|
2 |
-
padding:1px 22px 22px 22px;
|
3 |
-
background: #fff;
|
4 |
-
border:1px solid #ccc;
|
5 |
-
border-top:0;
|
6 |
-
margin-bottom: 20px;
|
7 |
-
}
|
8 |
section {
|
9 |
display:none;
|
10 |
}
|
@@ -13,75 +7,48 @@ section:first-child {
|
|
13 |
display:block;
|
14 |
}
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
display:none;
|
19 |
}
|
20 |
-
|
21 |
-
|
22 |
-
border-top:1px solid #ccc;
|
23 |
-
margin-top:22px;
|
24 |
}
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
margin-top:22px;
|
29 |
-
padding-top:22px;
|
30 |
}
|
31 |
|
32 |
-
.
|
33 |
-
|
34 |
-
|
35 |
-
border:
|
36 |
}
|
37 |
-
.
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
.ui-widget-content th {
|
42 |
-
font-weight: normal;
|
43 |
-
padding-right: 10px;
|
44 |
-
}
|
45 |
-
|
46 |
-
.settings-col {
|
47 |
-
width: 50% !important;
|
48 |
-
padding-right: 2% !important;
|
49 |
-
text-align: left !important;
|
50 |
-
}
|
51 |
-
|
52 |
-
.welcome-panel-last {
|
53 |
-
width: 47% !important;
|
54 |
text-align: center;
|
|
|
|
|
55 |
}
|
56 |
|
57 |
@media (max-width: 870px) {
|
58 |
-
.
|
59 |
-
width: 100% !important;
|
60 |
-
}
|
61 |
-
|
62 |
-
.welcome-panel-last {
|
63 |
width: 100% !important;
|
64 |
}
|
65 |
}
|
66 |
-
.
|
67 |
background: #D2002C none repeat scroll 0 0;
|
68 |
border-color: #AA0012;
|
69 |
box-shadow: 0 1px 0 rgba(230, 14, 23, 0.5) inset, 0 1px 0 rgba(173, 173, 173, 0.15);
|
70 |
color: #FFF;
|
71 |
text-decoration: none;
|
72 |
}
|
73 |
-
.
|
74 |
background: #AB1F42 none repeat scroll 0 0;
|
75 |
border-color: #AA0012;
|
76 |
box-shadow: 0 1px 0 rgba(230, 14, 23, 0.5) inset;
|
77 |
-
color: #FFF;
|
78 |
}
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
margin: 0;
|
83 |
-
padding: 0 0 16px;
|
84 |
-
}
|
85 |
-
.welcome-panel-last h4 {
|
86 |
-
padding: 0 0 10px;
|
87 |
}
|
1 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
section {
|
3 |
display:none;
|
4 |
}
|
7 |
display:block;
|
8 |
}
|
9 |
|
10 |
+
th{
|
11 |
+
text-align: right;
|
|
|
12 |
}
|
13 |
+
th h3 {
|
14 |
+
text-align: left;
|
|
|
|
|
15 |
}
|
16 |
|
17 |
+
td {
|
18 |
+
padding-left: 10px;
|
|
|
|
|
19 |
}
|
20 |
|
21 |
+
.wef-content{
|
22 |
+
width: 72%;
|
23 |
+
float: left;
|
24 |
+
/*border-right: 1px solid gray;*/
|
25 |
}
|
26 |
+
.wef-sidebar{
|
27 |
+
width: 28%;
|
28 |
+
float: left;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
text-align: center;
|
30 |
+
/*border-left: 1px solid gray;*/
|
31 |
+
/*padding: 0 10px;*/
|
32 |
}
|
33 |
|
34 |
@media (max-width: 870px) {
|
35 |
+
.wef-sidebar, .wef-content {
|
|
|
|
|
|
|
|
|
36 |
width: 100% !important;
|
37 |
}
|
38 |
}
|
39 |
+
.wef-sidebar .button-red {
|
40 |
background: #D2002C none repeat scroll 0 0;
|
41 |
border-color: #AA0012;
|
42 |
box-shadow: 0 1px 0 rgba(230, 14, 23, 0.5) inset, 0 1px 0 rgba(173, 173, 173, 0.15);
|
43 |
color: #FFF;
|
44 |
text-decoration: none;
|
45 |
}
|
46 |
+
.wef-sidebar .button-red:focus, .wef-sidebar .button-red:hover {
|
47 |
background: #AB1F42 none repeat scroll 0 0;
|
48 |
border-color: #AA0012;
|
49 |
box-shadow: 0 1px 0 rgba(230, 14, 23, 0.5) inset;
|
|
|
50 |
}
|
51 |
+
|
52 |
+
h3 small {
|
53 |
+
font-size: 0.7em;
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
lib/base_facebook.php
CHANGED
@@ -16,10 +16,10 @@
|
|
16 |
*/
|
17 |
|
18 |
if (!function_exists('curl_init')) {
|
19 |
-
|
20 |
}
|
21 |
if (!function_exists('json_decode')) {
|
22 |
-
|
23 |
}
|
24 |
|
25 |
|
16 |
*/
|
17 |
|
18 |
if (!function_exists('curl_init')) {
|
19 |
+
wp_die('Facebook needs the CURL PHP extension.');
|
20 |
}
|
21 |
if (!function_exists('json_decode')) {
|
22 |
+
wp_die('Facebook needs the JSON PHP extension.');
|
23 |
}
|
24 |
|
25 |
|
lib/class-wef-comments.php
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Handles comments auto embeds and comment count synchronization. It includes all actions and filters. Comments plugin
|
5 |
+
* can also be invoked using the [fb_plugin comments] shortocode.
|
6 |
+
*
|
7 |
+
* @see WEF_Social_Plugins
|
8 |
+
*/
|
9 |
+
class WEF_Comments extends WP_Embed_FB_Plugin {
|
10 |
+
static function hooks() {
|
11 |
+
|
12 |
+
/** @see WEF_Comments::comments_template */
|
13 |
+
add_filter( 'comments_template', __CLASS__ . '::comments_template' );
|
14 |
+
|
15 |
+
if ( self::get_option( 'comments_count_active' ) === 'true' ) {
|
16 |
+
|
17 |
+
/** @see WEF_Comments::get_comments_number */
|
18 |
+
add_filter( 'get_comments_number', __CLASS__ . '::get_comments_number', 10, 2 );
|
19 |
+
|
20 |
+
/** @see WEF_Comments::save_post */
|
21 |
+
add_filter( 'save_post', __CLASS__ . '::save_post', 10, 3 );
|
22 |
+
|
23 |
+
/** @see WEF_Comments::pre_get_posts */
|
24 |
+
add_action( 'pre_get_posts', __CLASS__ . '::pre_get_posts' );
|
25 |
+
|
26 |
+
/** @see WEF_Comments::wpemfb_comments */
|
27 |
+
add_filter( 'wp_ajax_wpemfb_comments', __CLASS__ . '::wpemfb_comments' );
|
28 |
+
add_filter( 'wp_ajax_nopriv_wpemfb_comments', __CLASS__ . '::wpemfb_comments' );
|
29 |
+
|
30 |
+
}
|
31 |
+
|
32 |
+
if ( self::get_option( 'comments_open_graph' ) === 'true' ) {
|
33 |
+
/** @see WEF_Comments::wp_head */
|
34 |
+
add_action( 'wp_head', __CLASS__ . '::wp_head' );
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Adds FB open graph app_id meta tag to head
|
40 |
+
*/
|
41 |
+
static function wp_head() {
|
42 |
+
$app_id = self::get_option( 'app_id' );
|
43 |
+
if ( ! empty( $app_id ) ) {
|
44 |
+
echo '<meta property="fb:app_id" content="' . $app_id . '" />' . PHP_EOL;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Replace theme template for FB comments.
|
50 |
+
*
|
51 |
+
* @param $template
|
52 |
+
*
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
static function comments_template( $template ) {
|
56 |
+
$array = self::string_to_array( self::get_option( 'auto_comments_post_types' ) );
|
57 |
+
if ( in_array( $GLOBALS['post']->post_type, $array ) ) {
|
58 |
+
$template = self::get_path() . 'templates/comments.php';
|
59 |
+
}
|
60 |
+
|
61 |
+
return $template;
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* @see get_comments_number
|
67 |
+
*
|
68 |
+
* @param string $number Number of comments on WP
|
69 |
+
* @param int $post_id
|
70 |
+
*
|
71 |
+
* @return mixed|string
|
72 |
+
*/
|
73 |
+
static function get_comments_number(
|
74 |
+
/** @noinspection PhpUnusedParameterInspection */
|
75 |
+
$number, $post_id
|
76 |
+
) {
|
77 |
+
$count = get_post_meta( $post_id, '_wef_comment_count', true );
|
78 |
+
if ( $count ) {
|
79 |
+
return $count;
|
80 |
+
}
|
81 |
+
|
82 |
+
return '0';
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Update the comment count on post update
|
87 |
+
*
|
88 |
+
* @param $post_id
|
89 |
+
* @param $post
|
90 |
+
* @param $update
|
91 |
+
*/
|
92 |
+
static function save_post( $post_id, $post, $update ) {
|
93 |
+
if ( wp_is_post_revision( $post_id ) || ! $update ) {
|
94 |
+
return;
|
95 |
+
}
|
96 |
+
$options = self::get_option();
|
97 |
+
$array = self::string_to_array( $options['auto_comments_post_types'] );
|
98 |
+
//https://graph.facebook.com/?id=http://t-underboot.sigami.net/?p=4
|
99 |
+
if ( in_array( $post->post_type, $array ) ) {
|
100 |
+
$args = array(
|
101 |
+
'fields' => 'share{comment_count}',
|
102 |
+
'id' => home_url( "/?p=$post_id" )
|
103 |
+
);
|
104 |
+
$url = "https://graph.facebook.com/{$options[ 'sdk_version' ]}/?" . http_build_query( $args );
|
105 |
+
$request = wp_remote_get( $url );
|
106 |
+
$response = wp_remote_retrieve_body( $request );
|
107 |
+
if ( ! is_wp_error( $request ) && ! empty( $response ) ) {
|
108 |
+
$data = json_decode( $response, true );
|
109 |
+
// print_r($data);die();
|
110 |
+
if ( is_array( $data ) && isset( $data['share'] ) && isset( $data['share']['comment_count'] ) ) {
|
111 |
+
update_post_meta( $post->ID, '_wef_comment_count', intval( $data['share']['comment_count'] ) );
|
112 |
+
}
|
113 |
+
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Alter order by 'comment_count' to use _wef_comment_count meta instead
|
120 |
+
*
|
121 |
+
* @param WP_Query $query
|
122 |
+
*
|
123 |
+
* @return WP_Query
|
124 |
+
*/
|
125 |
+
static function pre_get_posts( $query ) {
|
126 |
+
if ( isset( $query->query_vars['orderby'] ) && $query->query_vars['orderby'] == 'comment_count' ) {
|
127 |
+
$query->set(
|
128 |
+
'meta_query',
|
129 |
+
array(
|
130 |
+
'relation' => 'OR',
|
131 |
+
array(
|
132 |
+
'key' => '_wef_comment_count',
|
133 |
+
'compare' => 'NOT EXISTS'
|
134 |
+
),
|
135 |
+
array(
|
136 |
+
'key' => '_wef_comment_count',
|
137 |
+
'compare' => 'EXISTS'
|
138 |
+
)
|
139 |
+
)
|
140 |
+
);
|
141 |
+
$query->set( 'orderby', 'meta_value_num' );
|
142 |
+
}
|
143 |
+
|
144 |
+
return $query;
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Ajax function for updating comment count
|
149 |
+
*/
|
150 |
+
static function wpemfb_comments() {
|
151 |
+
if ( isset( $_POST['response'] ) && isset( $_POST['response']['href'] ) ) {
|
152 |
+
$post_id = url_to_postid( $_POST['response']['href'] );
|
153 |
+
$count = self::get_comments_number( '', $post_id );
|
154 |
+
if ( isset( $_POST['response']['message'] ) ) {
|
155 |
+
$count ++;
|
156 |
+
} else {
|
157 |
+
$count --;
|
158 |
+
}
|
159 |
+
update_post_meta( $post_id, '_wef_comment_count', intval( $count ) );
|
160 |
+
}
|
161 |
+
wp_die();
|
162 |
+
}
|
163 |
+
}
|
lib/class-wef-magic-embeds.php
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Where all the embedding happens.
|
5 |
+
*
|
6 |
+
* @uses WP_Embed_FB
|
7 |
+
* @uses WEF_Social_Plugins
|
8 |
+
* @uses WP_Embed_FB_Plugin
|
9 |
+
*/
|
10 |
+
class WEF_Magic_Embeds extends WP_Embed_FB_Plugin {
|
11 |
+
static function hooks() {
|
12 |
+
|
13 |
+
/** @see WEF_Magic_Embeds::plugins_loaded */
|
14 |
+
if ( self::get_option( 'auto_embed_active' ) == 'true' ) {
|
15 |
+
add_filter( 'plugins_loaded', __CLASS__ . '::plugins_loaded' );
|
16 |
+
}
|
17 |
+
|
18 |
+
/** @see WEF_Magic_Embeds::the_content */
|
19 |
+
add_filter( 'the_content', __CLASS__ . '::the_content' );
|
20 |
+
|
21 |
+
/** @see WP_Embed_FB::shortcode */
|
22 |
+
add_shortcode( 'facebook', 'WP_Embed_FB::shortcode' );
|
23 |
+
|
24 |
+
/** @see WEF_Social_Plugins::shortcode */
|
25 |
+
add_shortcode( 'fb_plugin', 'WEF_Social_Plugins::shortcode' );
|
26 |
+
|
27 |
+
//TODO add content filter and option to force embed when it fails for weirb reasons
|
28 |
+
//TODO do some magic with [facebook] JetPack shortcode.
|
29 |
+
|
30 |
+
// PLUGIN ACTIONS AND FILTERS
|
31 |
+
/** @see WEF_Social_Plugins::shortcode */
|
32 |
+
add_filter( 'wef_sp_defaults', __CLASS__ . '::wef_sp_defaults', 10, 2 );
|
33 |
+
add_filter( 'wef_sp_shortcode_filter', __CLASS__ . '::wef_sp_shortcode_filter',10,4 );
|
34 |
+
add_action( 'wef_sp_shortcode_action', __CLASS__ . '::wef_sp_shortcode_action' );
|
35 |
+
//wef_sp_embed
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Adds fb_foot to top and quote plugin
|
40 |
+
*
|
41 |
+
* @param string $the_content Post content
|
42 |
+
*
|
43 |
+
* @return string
|
44 |
+
*/
|
45 |
+
static function the_content( $the_content ) {
|
46 |
+
if ( self::get_option( 'fb_root' ) === 'true' ) {
|
47 |
+
$the_content = '<div id="fb-root"></div>' . PHP_EOL . $the_content;
|
48 |
+
}
|
49 |
+
if ( is_single() && ( self::get_option( 'quote_plugin_active' ) === 'true' ) ) {
|
50 |
+
$array = self::string_to_array( self::get_option( 'quote_post_types' ) );
|
51 |
+
if ( in_array( $GLOBALS['post']->post_type, $array ) ) {
|
52 |
+
$the_content .= WEF_Social_Plugins::get( 'quote' );
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
return $the_content;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Adds Embed register handler
|
61 |
+
*/
|
62 |
+
static function plugins_loaded() {
|
63 |
+
wp_embed_register_handler( "wpembedfb", "/(http|https):\/\/www\.facebook\.com\/([^<\s]*)/", 'WP_Embed_FB::embed_register_handler' );
|
64 |
+
}
|
65 |
+
|
66 |
+
static function wef_sp_defaults( $defaults, $type ) {
|
67 |
+
$options = self::get_option();
|
68 |
+
foreach ( $defaults as $key => $value ) {
|
69 |
+
if ( in_array( $key, self::$link_types ) ) {
|
70 |
+
$defaults[ $key ] = home_url( '/?p=' . get_queried_object_id() );
|
71 |
+
} else {
|
72 |
+
$defaults[ $key ] = $options["{$type}_$key"];
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
return $defaults;
|
77 |
+
}
|
78 |
+
|
79 |
+
static function wef_sp_shortcode_filter($ret,$type,$atts,$defaults) {
|
80 |
+
if ( isset( $defaults[ $type ]['width'] ) && $type != 'comments' && $type != 'page' ) {
|
81 |
+
$default_width = $defaults[ $type ]['width'];
|
82 |
+
if ( isset( $atts['adaptive'] ) ) {
|
83 |
+
if ( $atts['adaptive'] == 'true' ) {
|
84 |
+
$ret .= self::add_adaptive( $default_width, $atts );
|
85 |
+
}
|
86 |
+
} elseif ( self::get_option( 'adaptive_fb_plugin' ) == 'true' ) {
|
87 |
+
$ret .= self::add_adaptive( $default_width, $atts );
|
88 |
+
}
|
89 |
+
}
|
90 |
+
if ( isset( $atts['debug'] ) ) {
|
91 |
+
$atts_raw = $atts;
|
92 |
+
$debug = '';
|
93 |
+
$atts_raw_string = '';
|
94 |
+
unset( $atts_raw['debug'] );
|
95 |
+
foreach ( $atts_raw as $key => $value ) {
|
96 |
+
$atts_raw_string .= "$key=$value ";
|
97 |
+
}
|
98 |
+
$debug .= '<br><pre>';
|
99 |
+
$debug .= '<strong>';
|
100 |
+
$debug .= __( 'Shortcode used:', 'wp-embed-facebook' ) . "<br>";
|
101 |
+
$debug .= '</strong>';
|
102 |
+
$debug .= esc_html( htmlentities( "[fb_plugin $type $atts_raw_string]" ) );
|
103 |
+
$debug .= '<br>';
|
104 |
+
$debug .= '<strong>';
|
105 |
+
$debug .= __( 'Final code:', 'wp-embed-facebook' ) . "<br>";
|
106 |
+
$debug .= '</strong>';
|
107 |
+
$debug .= esc_html( htmlentities( $ret, ENT_QUOTES ) );
|
108 |
+
$debug .= '<br>';
|
109 |
+
$debug .= '<strong>';
|
110 |
+
$debug .= __( 'More information:', 'wp-embed-facebook' );
|
111 |
+
$debug .= '</strong>';
|
112 |
+
$debug .= WEF_Social_Plugins::get_links( $type );
|
113 |
+
$debug .= '</pre>';
|
114 |
+
$ret .= $debug;
|
115 |
+
}
|
116 |
+
return $ret;
|
117 |
+
}
|
118 |
+
static function wef_sp_shortcode_action() {
|
119 |
+
if ( ( self::get_option( 'enq_when_needed' ) == 'true' ) && ( self::get_option( 'enq_fbjs' ) == 'true' ) ) {
|
120 |
+
wp_enqueue_script( 'wpemfb-fbjs' );
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
private static function add_adaptive( $default_width, $atts ) {
|
125 |
+
$width = isset( $atts['width'] ) ? $atts['width'] : $default_width;
|
126 |
+
wp_enqueue_script( 'wpemfb' );
|
127 |
+
$ret = '';
|
128 |
+
$ret .= '<div class="wef-measure"';
|
129 |
+
if ( ! empty( $width ) ) {
|
130 |
+
$ret .= ' style="max-width: ' . $width . 'px;"';
|
131 |
+
}
|
132 |
+
$ret .= '></div>';
|
133 |
+
return $ret;
|
134 |
+
}
|
135 |
+
|
136 |
+
}
|
137 |
+
//delete_option('wpemfb_options');
|
lib/class-wef-social-plugins.php
CHANGED
@@ -1,57 +1,536 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* Group of static functions to render facebook social plugins.
|
6 |
*
|
|
|
7 |
*/
|
8 |
class WEF_Social_Plugins {
|
9 |
/**
|
10 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
*
|
12 |
* @return string
|
13 |
*/
|
14 |
-
static function
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
/**
|
19 |
* @param string $href
|
20 |
-
* @param
|
21 |
*
|
22 |
* @return string
|
|
|
|
|
|
|
|
|
23 |
*/
|
24 |
static function like_btn( $href, $options = array() ) {
|
25 |
-
|
26 |
-
'colorscheme' => 'light',//dark
|
27 |
-
'share' => 'false',
|
28 |
-
'layout' => 'standard',//"standard", "button_count", "button" or "box_count".
|
29 |
-
'show_faces' => 'false',
|
30 |
-
);
|
31 |
-
$options = wp_parse_args( $options, $defaults );
|
32 |
-
$string = '';
|
33 |
-
foreach ( $options as $data => $value ) {
|
34 |
-
$string .= " data-" . str_replace( '_', '-', $data ) . "=$value";
|
35 |
-
}
|
36 |
|
37 |
-
return '
|
38 |
}
|
39 |
|
40 |
/**
|
41 |
-
* @param
|
42 |
* @param array $options
|
43 |
*
|
44 |
* @return string
|
|
|
|
|
|
|
45 |
*/
|
46 |
static function follow_btn( $href, $options = array() ) {
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
'show_faces' => 'false',
|
51 |
-
);
|
52 |
-
$options = wp_parse_args( $options, $defaults );
|
53 |
-
|
54 |
-
return '<div class="fb-follow" data-href="' . $href . '" data-colorscheme="' . $options['colorscheme'] . '" data-layout="' . $options['layout'] . '" data-show-faces="' . $options['show_faces'] . '" ></div>';
|
55 |
}
|
56 |
|
57 |
/**
|
@@ -59,67 +538,59 @@ class WEF_Social_Plugins {
|
|
59 |
* @param string $layout Can be one of "box_count", "button_count", "button", "link", "icon_link", or "icon".
|
60 |
*
|
61 |
* @return string
|
|
|
|
|
|
|
62 |
*/
|
63 |
static function share_btn( $href, $layout = 'icon_link' ) {
|
64 |
-
|
|
|
|
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
* @param string $href
|
69 |
-
* @param int
|
70 |
-
* @param array
|
71 |
*
|
72 |
* @return string
|
|
|
|
|
|
|
73 |
*/
|
74 |
static function page_plugin( $href, $width, $options = array() ) {
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
'show_posts' => WP_Embed_FB_Plugin::get_option( 'page_show_posts' ),
|
79 |
-
'small_header' => WP_Embed_FB_Plugin::get_option( 'page_small_header' ),
|
80 |
-
'height' => WP_Embed_FB_Plugin::get_option( 'page_height' ),
|
81 |
-
);
|
82 |
-
$options = wp_parse_args( $options, $defaults );
|
83 |
-
|
84 |
-
return '<div class="fb-page" data-href="' . $href . '" data-width="' . $width . '" data-hide-cover="' . $options["hide_cover"] . '" data-show-facepile="' . $options["show_facepile"] . '" data-show-posts="' . $options["show_posts"] . '" date-small-header="' . $options["small_header"] . '" data-height="' . $options["height"] . '"></div>';
|
85 |
}
|
86 |
|
87 |
/**
|
88 |
* @param string $href
|
89 |
-
* @param int
|
90 |
*
|
91 |
* @return string
|
|
|
|
|
|
|
92 |
*/
|
93 |
static function embedded_post( $href, $width ) {
|
94 |
-
|
95 |
-
}
|
96 |
|
97 |
-
|
98 |
-
* @param string $href
|
99 |
-
* @param int $width
|
100 |
-
*
|
101 |
-
* @return string
|
102 |
-
*/
|
103 |
-
static function embedded_video( $href, $width ) {
|
104 |
-
return '<div class="fb-video" data-href="' . $href . '" data-width="' . $width . '"></div>';
|
105 |
}
|
106 |
|
107 |
/**
|
108 |
* @param string $href
|
109 |
-
* @param int
|
110 |
-
* @param array $options colorscheme,num_posts,order_by
|
111 |
*
|
112 |
* @return string
|
|
|
|
|
|
|
113 |
*/
|
114 |
-
static function
|
115 |
-
|
116 |
-
'colorscheme' => 'light',//dark
|
117 |
-
'num_posts' => '10',
|
118 |
-
'order_by' => 'social',//Can be "social", "reverse_time", or "time".
|
119 |
-
);
|
120 |
-
$options = wp_parse_args( $options, $defaults );
|
121 |
|
122 |
-
return
|
123 |
}
|
124 |
-
|
125 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
+
* Group of static functions to render facebook social plugins on WordPress it has no dependencies.
|
|
|
|
|
5 |
*
|
6 |
+
* @author Miguel Sirvent
|
7 |
*/
|
8 |
class WEF_Social_Plugins {
|
9 |
/**
|
10 |
+
* Quote Plugin
|
11 |
+
*
|
12 |
+
* The quote plugin lets people select text on your page and add it to their share, so they can tell a more
|
13 |
+
* expressive story.
|
14 |
+
*
|
15 |
+
* <code>
|
16 |
+
*
|
17 |
+
* href: The absolute URL of the page that will be quoted.
|
18 |
+
* layout:
|
19 |
+
* quote: On text selection, a button with a blue Facebook icon and "Share Quote" text is shown as an
|
20 |
+
* overlay. When a person clicks it, it will open a share dialog with the highlighted text as
|
21 |
+
* a quote.
|
22 |
+
* button: Behaves the same as the "quote" option but has just a blue Facebook icon in the button.
|
23 |
+
*
|
24 |
+
* </code>
|
25 |
+
*
|
26 |
+
* @link https://developers.facebook.com/docs/plugins/quote
|
27 |
+
*/
|
28 |
+
static $quote = array(
|
29 |
+
'href' => '',
|
30 |
+
'layout' => array( 'quote', 'button' )
|
31 |
+
);
|
32 |
+
/**
|
33 |
+
* Save Button
|
34 |
+
*
|
35 |
+
* The save button lets people save items or services to a private list on Facebook, share it with friends, and
|
36 |
+
* receive relevant notifications. For example, a person can save an item of clothing, trip, or link that they're
|
37 |
+
* thinking about and go back to that list for future consumption, or get notified when that item or trip has a
|
38 |
+
* promotional deal.
|
39 |
+
*
|
40 |
+
* <code>
|
41 |
+
*
|
42 |
+
* uri: The absolute link of the page that will be saved.
|
43 |
+
* size: large or small
|
44 |
+
*
|
45 |
+
* </code>
|
46 |
+
*
|
47 |
+
* @link https://developers.facebook.com/docs/plugins/save
|
48 |
+
*/
|
49 |
+
static $save = array(
|
50 |
+
'uri' => '',
|
51 |
+
'size' => array( 'large', 'small' )
|
52 |
+
);
|
53 |
+
/**
|
54 |
+
* Like Button
|
55 |
+
*
|
56 |
+
* A single click on the Like button will 'like' pieces of content on the web and share them on Facebook. You can
|
57 |
+
* also display a Share button next to the Like button to let people add a personal message and customize who they
|
58 |
+
* share with.
|
59 |
+
*
|
60 |
+
* <code>
|
61 |
+
*
|
62 |
+
* action: The verb to display on the button.
|
63 |
+
* like
|
64 |
+
* recommend
|
65 |
+
* colorscheme: The color scheme used by the plugin for any text outside of the button itself.
|
66 |
+
* light
|
67 |
+
* dark
|
68 |
+
* href: The absolute URL of the page that will be quoted.
|
69 |
+
* kid-directed-site: TIf your web site or online service, or a portion of your service, is directed to children
|
70 |
+
* under 13 you must enable this
|
71 |
+
* layout: Selects one of the different layouts that are available for the plugin.
|
72 |
+
* standard
|
73 |
+
* button_count
|
74 |
+
* button
|
75 |
+
* box_count
|
76 |
+
* ref: A label for tracking referrals which must be less than 50 characters and can contain alphanumeric
|
77 |
+
* characters and some punctuation (currently +/=-.:_).
|
78 |
+
* share: Specifies whether to include a share button beside the Like button. This only works with the XFBML
|
79 |
+
* version.
|
80 |
+
* show_faces: Specifies whether to display profile photos below the button (standard layout only). You must not
|
81 |
+
* enable this on child-directed sites.
|
82 |
+
* width: The width of the plugin (standard layout only), which is subject to the minimum and default width.
|
83 |
+
* default 450 minimum 225
|
84 |
+
*
|
85 |
+
* </code>
|
86 |
+
*
|
87 |
+
* @link https://developers.facebook.com/docs/plugins/like-button
|
88 |
+
*/
|
89 |
+
static $like = array(
|
90 |
+
'action' => array( 'like', 'recommend' ),
|
91 |
+
'colorscheme' => array( 'light', 'dark' ),
|
92 |
+
'href' => '',
|
93 |
+
'kid-directed-site' => array( 'false', 'true' ),
|
94 |
+
'layout' => array( 'standard', 'button_count', 'button', 'box_count' ),
|
95 |
+
'ref' => '',
|
96 |
+
'share' => array( 'false', 'true' ),
|
97 |
+
'show-faces' => array( 'true', 'false' ),
|
98 |
+
'width' => '450'
|
99 |
+
);
|
100 |
+
/**
|
101 |
+
* Share Button
|
102 |
+
*
|
103 |
+
* The Share button lets people add a personalized message to links before sharing on their timeline, in groups, or
|
104 |
+
* to their friends via a Facebook Message.
|
105 |
+
*
|
106 |
+
* <code>
|
107 |
+
*
|
108 |
+
* href: The absolute URL of the page that will be quoted.
|
109 |
+
* layout: Selects one of the different layouts that are available for the plugin.
|
110 |
+
* link
|
111 |
+
* icon_link
|
112 |
+
* icon
|
113 |
+
* button_count
|
114 |
+
* button
|
115 |
+
* box_count
|
116 |
+
* mobile_iframe: If set to true, the share button will open the share dialog in an iframe (instead of a popup) on
|
117 |
+
* top of your website on mobile. This option is only available for mobile, not desktop.
|
118 |
+
* characters and some punctuation (currently +/=-.:_).
|
119 |
+
*
|
120 |
+
* </code>
|
121 |
+
*
|
122 |
+
* @link https://developers.facebook.com/docs/plugins/share-button/
|
123 |
+
*/
|
124 |
+
static $share = array(
|
125 |
+
'href' => '',
|
126 |
+
'layout' => array( 'icon_link', 'link', 'icon', 'button_count', 'button', 'box_count' ),
|
127 |
+
'mobile_iframe' => array( 'false', 'true' ),
|
128 |
+
);
|
129 |
+
/**
|
130 |
+
* Send Button
|
131 |
+
*
|
132 |
+
* The Send button lets people privately send content on your site to one or more friends in a Facebook message.
|
133 |
+
*
|
134 |
+
* <code>
|
135 |
+
*
|
136 |
+
* href: The absolute URL of the page that will be quoted.
|
137 |
+
* colorscheme: The color scheme used by the plugin.
|
138 |
+
* light
|
139 |
+
* dark
|
140 |
+
* kid-directed-site: TIf your web site or online service, or a portion of your service, is directed to children
|
141 |
+
* under 13 you must enable this
|
142 |
+
* ref: A label for tracking referrals which must be less than 50 characters and can contain alphanumeric
|
143 |
+
* characters and some punctuation (currently +/=-.:_).
|
144 |
+
*
|
145 |
+
* </code>
|
146 |
+
*
|
147 |
+
* @link https://developers.facebook.com/docs/plugins/send-button
|
148 |
+
*/
|
149 |
+
static $send = array(
|
150 |
+
'colorscheme' => array( 'light', 'dark' ),
|
151 |
+
'href' => '',
|
152 |
+
'kid-directed-site' => array( 'false', 'true' ),
|
153 |
+
'ref' => '',
|
154 |
+
);
|
155 |
+
/**
|
156 |
+
* Embedded Comments
|
157 |
+
*
|
158 |
+
* Embedded comments are a simple way to put public post comments - by a Page or a person on Facebook - into the
|
159 |
+
* content of your web site or web page. Only public comments from Facebook Pages and profiles can be embedded.
|
160 |
+
*
|
161 |
+
* <code>
|
162 |
+
*
|
163 |
+
* href: The absolute URL of the comment.
|
164 |
+
* width: The width of the embedded comment container. Min. 220px.
|
165 |
+
* include-parent: Set to true to include parent comment (if URL is a reply).
|
166 |
+
*
|
167 |
+
* </code>
|
168 |
+
*
|
169 |
+
* @link https://developers.facebook.com/docs/plugins/embedded-comments/
|
170 |
+
*
|
171 |
+
* fb-comment-comment ?
|
172 |
+
*/
|
173 |
+
static $comment = array(
|
174 |
+
'href' => '',
|
175 |
+
'width' => '560',
|
176 |
+
'include-parent' => array( 'false', 'true' )
|
177 |
+
);
|
178 |
+
/**
|
179 |
+
* Embedded Video & Live Video Player
|
180 |
+
*
|
181 |
+
* With the embedded video player you can easily add Facebook videos and Facebook live videos to your website. You
|
182 |
+
* can use any public video post by a Page or a person as video or live video source.
|
183 |
+
*
|
184 |
+
* <code>
|
185 |
+
*
|
186 |
+
* href: The absolute URL of the page that will be quoted.
|
187 |
+
* allowfullscreen: Allow the video to be played in fullscreen mode.
|
188 |
+
* autoplay: Automatically start playing the video when the page loads. The video will be played without sound
|
189 |
+
* (muted). People can turn on sound via the video player controls. This setting does not apply to mobile
|
190 |
+
* devices.
|
191 |
+
* width: The width of the video container. Min. 220px.
|
192 |
+
* show-text: Set to true to include the text from the Facebook post associated with the video, if any.
|
193 |
+
* show-captions: Set to true to show captions (if available) by default. Captions are only available on desktop.
|
194 |
+
*
|
195 |
+
* </code>
|
196 |
+
*
|
197 |
+
* @link https://developers.facebook.com/docs/plugins/embedded-video-player/
|
198 |
+
*
|
199 |
+
* @link https://developers.facebook.com/docs/plugins/embedded-video-player/#how-to-get-a-video-posts-url
|
200 |
+
*/
|
201 |
+
static $video = array(
|
202 |
+
'href' => '',
|
203 |
+
'allowfullscreen' => array( 'false', 'true' ),
|
204 |
+
'autoplay' => array( 'false', 'true' ),
|
205 |
+
'width' => '',
|
206 |
+
'show-text' => array( 'false', 'true' ),
|
207 |
+
'show-captions' => array( 'true', 'false' ),
|
208 |
+
);
|
209 |
+
/**
|
210 |
+
* Page Plugin
|
211 |
+
*
|
212 |
+
* The Page plugin lets you easily embed and promote any Facebook Page on your website. Just like on Facebook, your
|
213 |
+
* visitors can like and share the Page without leaving your site.
|
214 |
+
*
|
215 |
+
* <code>
|
216 |
+
*
|
217 |
+
* href: The absolute URL of the page that will be quoted.
|
218 |
+
* width: The pixel width of the plugin. Min. is 180 & Max. is 500
|
219 |
+
* height: The pixel height of the plugin. Min. is 70
|
220 |
+
* tabs: Tabs to render i.e. timeline, events, messages. Use a comma-separated list to add multiple tabs, i.e.
|
221 |
+
* timeline, events. hide_cover: Tabs to render i.e. timeline, events, messages. Use a comma-separated list to
|
222 |
+
* add multiple tabs, i.e. timeline, events.
|
223 |
+
* hide-cover: Hide cover photo in the header
|
224 |
+
* show-facepile: Show profile photos when friends like this
|
225 |
+
* hide-cta: Hide the custom call to action button (if available)
|
226 |
+
* small-header: Use the small header instead
|
227 |
+
* adapt-container-width: Try to fit inside the container width
|
228 |
+
*
|
229 |
+
* </code>
|
230 |
+
*
|
231 |
+
* @link https://developers.facebook.com/docs/plugins/page-plugin/
|
232 |
+
*/
|
233 |
+
static $page = array(
|
234 |
+
'href' => '',
|
235 |
+
'width' => '340',
|
236 |
+
'height' => '500',
|
237 |
+
'tabs' => '',
|
238 |
+
'hide-cover' => array( 'false', 'true' ),
|
239 |
+
'show-facepile' => array( 'true', 'false' ),
|
240 |
+
'hide-cta' => array( 'false', 'true' ),
|
241 |
+
'small-header' => array( 'false', 'true' ),
|
242 |
+
'adapt-container-width' => array( 'true', 'false' ),
|
243 |
+
);
|
244 |
+
/**
|
245 |
+
* Comments Plugin
|
246 |
+
*
|
247 |
+
* The comments plugin lets people comment on content on your site using their Facebook account. People can choose
|
248 |
+
* to share their comment activity with their friends (and friends of their friends) on Facebook as well. The
|
249 |
+
* comments plugin also includes built-in moderation tools and social relevance ranking.
|
250 |
+
*
|
251 |
+
* <code>
|
252 |
+
*
|
253 |
+
* colorscheme: The color scheme used by the comments plugin.
|
254 |
+
* dark
|
255 |
+
* light
|
256 |
+
* href: The absolute URL of the page that will be quoted.
|
257 |
+
* mobile: A boolean value that specifies whether to show the mobile-optimized version or not.
|
258 |
+
* num_posts: The number of comments to show by default. The minimum value is 1
|
259 |
+
* order_by: The order to use when displaying comments.
|
260 |
+
* social
|
261 |
+
* reverse_time
|
262 |
+
* time
|
263 |
+
* width: The width of the comments plugin on the webpage. This can be either a pixel value or a percentage (such
|
264 |
+
* as 100%) for fluid width. The mobile version of the comments plugin ignores the width parameter and
|
265 |
+
* instead has a fluid width of 100%. The minimum width supported by the comments plugin is 320px.
|
266 |
+
*
|
267 |
+
* </code>
|
268 |
+
*
|
269 |
+
* @link https://developers.facebook.com/docs/plugins/comments/
|
270 |
+
*/
|
271 |
+
static $comments = array(
|
272 |
+
'colorscheme' => array( 'light', 'dark' ),
|
273 |
+
'href' => '',
|
274 |
+
'mobile' => array( 'false', 'true' ),
|
275 |
+
'num_posts' => '10',
|
276 |
+
'order_by' => array( 'social', 'reverse_time', 'time' ),
|
277 |
+
'width' => '550px',
|
278 |
+
);
|
279 |
+
static $comments_count = array(
|
280 |
+
'href' => ''
|
281 |
+
);
|
282 |
+
/**
|
283 |
+
* Embedded Posts
|
284 |
+
*
|
285 |
+
* Embedded Posts are a simple way to put public posts - by a Page or a person on Facebook - into the content of
|
286 |
+
* your web site or web page. Only public posts from Facebook Pages and profiles can be embedded.
|
287 |
+
*
|
288 |
+
* <code>
|
289 |
+
*
|
290 |
+
* href: The absolute URL of the post to be embedded.
|
291 |
+
* width: The width of the plugin. (between 350 and 750)
|
292 |
+
* show-text: show te post content (it was not documented Õ..õ )
|
293 |
+
*
|
294 |
+
* </code>
|
295 |
+
*
|
296 |
+
* @link https://developers.facebook.com/docs/plugins/embedded-posts/
|
297 |
+
*/
|
298 |
+
static $post = array(
|
299 |
+
'href' => '',
|
300 |
+
'width' => '500',
|
301 |
+
'show-text' => array( 'true', 'false' ),
|
302 |
+
);
|
303 |
+
/**
|
304 |
+
* Follow Button
|
305 |
+
*
|
306 |
+
* The Follow button lets people subscribe to the public updates of others on Facebook.
|
307 |
+
*
|
308 |
+
* <code>
|
309 |
+
*
|
310 |
+
* colorscheme: The color scheme used by the comments plugin.
|
311 |
+
* dark
|
312 |
+
* light
|
313 |
+
* href: The absolute URL of the page that will be quoted.
|
314 |
+
* kid-directed-site: TIf your web site or online service, or a portion of your service, is directed to children
|
315 |
+
* under 13 you must enable this
|
316 |
+
* layout: Selects one of the different layouts that are available for the plugin.
|
317 |
+
* standard
|
318 |
+
* button_count
|
319 |
+
* box_count
|
320 |
+
* show-faces: Specifies whether to display profile photos below the button (standard layout only).
|
321 |
+
* width: The width of the plugin. The layout you choose affects the minimum and default widths you can use.
|
322 |
+
* default 450 minimum 225
|
323 |
+
*
|
324 |
+
* </code>
|
325 |
+
*
|
326 |
+
* @link https://developers.facebook.com/docs/plugins/follow-button/
|
327 |
+
*
|
328 |
+
*/
|
329 |
+
static $follow = array(
|
330 |
+
'colorscheme' => array( 'light', 'dark' ),
|
331 |
+
'href' => '',
|
332 |
+
'kid-directed-site' => array( 'false', 'true' ),
|
333 |
+
'layout' => array( 'standard', 'button_count', 'box_count' ),
|
334 |
+
'show-faces' => array( 'true', 'false' ),
|
335 |
+
'width' => '450',
|
336 |
+
);
|
337 |
+
/**
|
338 |
+
* Associative array with the default variables interpreted by fb
|
339 |
+
*/
|
340 |
+
private static $defaults = null;
|
341 |
+
/**
|
342 |
+
* Associative array containing links for demos and documentation
|
343 |
+
*/
|
344 |
+
private static $links = array(
|
345 |
+
'quote' => array(
|
346 |
+
'docs' => 'https://developers.facebook.com/docs/plugins/quote',
|
347 |
+
'demo' => 'http://www.wpembedfb.com/demo-site/?p=99'
|
348 |
+
),
|
349 |
+
'save' => array(
|
350 |
+
'docs' => 'https://developers.facebook.com/docs/plugins/save',
|
351 |
+
'demo' => 'http://www.wpembedfb.com/demo-site/?p=41'
|
352 |
+
),
|
353 |
+
'like' => array(
|
354 |
+
'docs' => 'https://developers.facebook.com/docs/plugins/like-button',
|
355 |
+
'demo' => 'http://www.wpembedfb.com/demo-site/?p=26'
|
356 |
+
),
|
357 |
+
'share' => array(
|
358 |
+
'docs' => 'https://developers.facebook.com/docs/plugins/share-button/',
|
359 |
+
'demo' => 'http://www.wpembedfb.com/demo-site/?p=36'
|
360 |
+
),
|
361 |
+
'send' => array(
|
362 |
+
'docs' => 'https://developers.facebook.com/docs/plugins/send-button',
|
363 |
+
'demo' => 'http://www.wpembedfb.com/demo-site/?p=46'
|
364 |
+
),
|
365 |
+
'comment' => array(
|
366 |
+
'docs' => 'https://developers.facebook.com/docs/plugins/embedded-comments/',
|
367 |
+
'demo' => 'http://www.wpembedfb.com/demo-site/?p=50'
|
368 |
+
),
|
369 |
+
'video' => array(
|
370 |
+
'docs' => 'https://developers.facebook.com/docs/plugins/embedded-video-player/',
|
371 |
+
'demo' => 'http://www.wpembedfb.com/demo-site/?p=62'
|
372 |
+
),
|
373 |
+
'page' => array(
|
374 |
+
'docs' => 'https://developers.facebook.com/docs/plugins/page-plugin/',
|
375 |
+
'demo' => 'http://www.wpembedfb.com/demo-site/?p=70'
|
376 |
+
),
|
377 |
+
'comments' => array(
|
378 |
+
'docs' => 'https://developers.facebook.com/docs/plugins/comments/',
|
379 |
+
'demo' => 'http://www.wpembedfb.com/demo-site/?p=105'
|
380 |
+
),
|
381 |
+
'post' => array(
|
382 |
+
'docs' => 'https://developers.facebook.com/docs/plugins/embedded-posts/',
|
383 |
+
'demo' => 'http://www.wpembedfb.com/demo-site/?p=94'
|
384 |
+
),
|
385 |
+
'follow' => array(
|
386 |
+
'docs' => 'https://developers.facebook.com/docs/plugins/follow-button/',
|
387 |
+
'demo' => 'http://www.wpembedfb.com/demo-site/?p=89'
|
388 |
+
)
|
389 |
+
);
|
390 |
+
|
391 |
+
static function get_links( $type, $link = true ) {
|
392 |
+
$ret = '';
|
393 |
+
if ( isset( self::$links[ $type ] ) ) {
|
394 |
+
if ( $link ) {
|
395 |
+
$ret = '<small>';
|
396 |
+
$ret .= '<a href="' . self::$links[ $type ]['demo'] . '" target="_blank" title="WP Embed Facebook Demo">Demo</a> ';
|
397 |
+
$ret .= '<a href="' . self::$links[ $type ]['docs'] . '" target="_blank" title="Official FB documentation">Info</a>';
|
398 |
+
$ret .= '</small>';
|
399 |
+
} else {
|
400 |
+
$ret = self::$links[ $type ];
|
401 |
+
}
|
402 |
+
|
403 |
+
}
|
404 |
+
|
405 |
+
return $ret;
|
406 |
+
}
|
407 |
+
|
408 |
+
static function get_defaults() {
|
409 |
+
|
410 |
+
if ( self::$defaults === null ) {
|
411 |
+
$vars = get_class_vars( __CLASS__ );
|
412 |
+
unset( $vars['defaults'] );
|
413 |
+
unset( $vars['links'] );
|
414 |
+
foreach ( $vars as $type => $options ) {
|
415 |
+
foreach ( $options as $option => $default ) {
|
416 |
+
if ( is_array( $default ) ) {
|
417 |
+
$vars[ $type ][ $option ] = $default[0];
|
418 |
+
}
|
419 |
+
}
|
420 |
+
}
|
421 |
+
self::$defaults = $vars;
|
422 |
+
}
|
423 |
+
|
424 |
+
return self::$defaults;
|
425 |
+
}
|
426 |
+
|
427 |
+
/**
|
428 |
+
* Gets the HTML code of any social plugin if
|
429 |
+
*
|
430 |
+
* @param string $type = quote|save|like|share|send|comment|video|page|comments|post|follow
|
431 |
+
* @param array $options Defaults are WEF_Social_Plugin::$type
|
432 |
+
*
|
433 |
+
* @see WEF_Social_Plugins::$quote
|
434 |
+
* @see WEF_Social_Plugins::$save
|
435 |
+
* @see WEF_Social_Plugins::$like
|
436 |
+
* @see WEF_Social_Plugins::$share
|
437 |
+
* @see WEF_Social_Plugins::$send
|
438 |
+
* @see WEF_Social_Plugins::$comment
|
439 |
+
* @see WEF_Social_Plugins::$video
|
440 |
+
* @see WEF_Social_Plugins::$page
|
441 |
+
* @see WEF_Social_Plugins::$comments
|
442 |
+
* @see WEF_Social_Plugins::$post
|
443 |
+
* @see WEF_Social_Plugins::$follow
|
444 |
*
|
445 |
* @return string
|
446 |
*/
|
447 |
+
static function get( $type = 'like', $options = array() ) {
|
448 |
+
if ( $type == 'comment' ) {
|
449 |
+
$type_clean = 'comment-embed';
|
450 |
+
} elseif ( $type == 'comments_count' ) {
|
451 |
+
$type_clean = 'comments-count';
|
452 |
+
} elseif ( $type == 'share' ) {
|
453 |
+
$type_clean = 'share-button';
|
454 |
+
} else {
|
455 |
+
$type_clean = $type;
|
456 |
+
}
|
457 |
+
|
458 |
+
do_action( 'wef_sp_get_action' );
|
459 |
+
|
460 |
+
$defaults = self::get_defaults();
|
461 |
+
$filtered_options = apply_filters( 'wef_sp_defaults', $defaults[ $type ], $type );
|
462 |
+
$extra = '';
|
463 |
+
$real_options = array();
|
464 |
+
foreach ( $defaults[ $type ] as $option => $def_value ) {
|
465 |
+
if ( isset( $options[ $option ] ) && ( $options[ $option ] != $def_value ) ) {
|
466 |
+
$real_options[ $option ] = $options[ $option ];
|
467 |
+
} elseif ( isset( $filtered_options[ $option ] ) && ( $filtered_options[ $option ] != $def_value ) ) {
|
468 |
+
$real_options[ $option ] = $filtered_options[ $option ];
|
469 |
+
}
|
470 |
+
if ( isset( $real_options[ $option ] ) && ( $real_options[ $option ] == $def_value ) ) {
|
471 |
+
unset( $real_options[ $option ] );
|
472 |
+
}
|
473 |
+
}
|
474 |
+
|
475 |
+
foreach ( $real_options as $option => $value ) {
|
476 |
+
$extra .= "data-$option=\"$value\" ";
|
477 |
+
}
|
478 |
+
|
479 |
+
return apply_filters( 'wef_sp_get_filter', "<div class=\"fb-$type_clean\" $extra></div>", $type, $options, $defaults );
|
480 |
}
|
481 |
|
482 |
+
static function shortcode( $atts = array() ) {
|
483 |
+
$type = array_shift( $atts );
|
484 |
+
if ( $type == 'comments-count' ) {
|
485 |
+
$type = 'comments_count';
|
486 |
+
}
|
487 |
+
$defaults = self::get_defaults();
|
488 |
+
|
489 |
+
if ( isset( $defaults[ $type ] ) ) {
|
490 |
+
|
491 |
+
$data = shortcode_atts( $defaults[ $type ], $atts );
|
492 |
+
|
493 |
+
$ret = self::get( $type, $data );
|
494 |
+
|
495 |
+
do_action( 'wef_sp_shortcode_action' );
|
496 |
+
|
497 |
+
return apply_filters( 'wef_sp_shortcode_filter', $ret, $type, $atts, $defaults );
|
498 |
+
}
|
499 |
+
|
500 |
+
return __( 'Invalid Facebook plugin type use it like this: [fb_plugin like]', 'wp-embed-facebook' );
|
501 |
+
}
|
502 |
+
|
503 |
+
/* DEPRECATED FUNCTIONS TO BE REMOVED ON v2.2 */
|
504 |
+
|
505 |
/**
|
506 |
* @param string $href
|
507 |
+
* @param $options array colorscheme | share | layout | show_faces
|
508 |
*
|
509 |
* @return string
|
510 |
+
*
|
511 |
+
* @deprecated
|
512 |
+
*
|
513 |
+
* @see WEF_Social_Plugins::get()
|
514 |
*/
|
515 |
static function like_btn( $href, $options = array() ) {
|
516 |
+
_deprecated_function( __CLASS__ . '::' . __FUNCTION__ . '()', '2.1.1', __CLASS__ . '::' . 'get(\'like\')' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
517 |
|
518 |
+
return self::get( 'like', array( 'href' => $href ) + $options );
|
519 |
}
|
520 |
|
521 |
/**
|
522 |
+
* @param $href
|
523 |
* @param array $options
|
524 |
*
|
525 |
* @return string
|
526 |
+
*
|
527 |
+
* @deprecated
|
528 |
+
* @see WEF_Social_Plugins::get()
|
529 |
*/
|
530 |
static function follow_btn( $href, $options = array() ) {
|
531 |
+
_deprecated_function( __CLASS__ . '::' . __FUNCTION__ . '()', '2.1.1', __CLASS__ . '::' . 'get(\'follow\')' );
|
532 |
+
|
533 |
+
return self::get( 'follow', array( 'href' => $href ) + $options );
|
|
|
|
|
|
|
|
|
|
|
534 |
}
|
535 |
|
536 |
/**
|
538 |
* @param string $layout Can be one of "box_count", "button_count", "button", "link", "icon_link", or "icon".
|
539 |
*
|
540 |
* @return string
|
541 |
+
*
|
542 |
+
* @deprecated
|
543 |
+
* @see WEF_Social_Plugins::get()
|
544 |
*/
|
545 |
static function share_btn( $href, $layout = 'icon_link' ) {
|
546 |
+
_deprecated_function( __CLASS__ . '::' . __FUNCTION__ . '()', '2.1.1', __CLASS__ . '::' . 'get(\'share\')' );
|
547 |
+
|
548 |
+
return self::get( 'share', array( 'href' => $href, 'layout' => $layout ) );
|
549 |
}
|
550 |
|
551 |
/**
|
552 |
* @param string $href
|
553 |
+
* @param int $width
|
554 |
+
* @param array $options hide_cover,show_facepile,show_posts,small_header,height
|
555 |
*
|
556 |
* @return string
|
557 |
+
*
|
558 |
+
* @deprecated
|
559 |
+
* @see WEF_Social_Plugins::get()
|
560 |
*/
|
561 |
static function page_plugin( $href, $width, $options = array() ) {
|
562 |
+
_deprecated_function( __CLASS__ . '::' . __FUNCTION__ . '()', '2.1.1', __CLASS__ . '::' . 'get(\'page\')' );
|
563 |
+
|
564 |
+
return self::get( 'page', array( 'href' => $href, 'width' => $width ) + $options );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
565 |
}
|
566 |
|
567 |
/**
|
568 |
* @param string $href
|
569 |
+
* @param int $width
|
570 |
*
|
571 |
* @return string
|
572 |
+
*
|
573 |
+
* @deprecated
|
574 |
+
* @see WEF_Social_Plugins::get()
|
575 |
*/
|
576 |
static function embedded_post( $href, $width ) {
|
577 |
+
_deprecated_function( __CLASS__ . '::' . __FUNCTION__ . '()', '2.1.1', __CLASS__ . '::' . 'get(\'post\')' );
|
|
|
578 |
|
579 |
+
return self::get( 'post', array( 'href' => $href, 'width' => $width ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
}
|
581 |
|
582 |
/**
|
583 |
* @param string $href
|
584 |
+
* @param int $width
|
|
|
585 |
*
|
586 |
* @return string
|
587 |
+
*
|
588 |
+
* @deprecated
|
589 |
+
* @see WEF_Social_Plugins::get()
|
590 |
*/
|
591 |
+
static function embedded_video( $href, $width ) {
|
592 |
+
_deprecated_function( __CLASS__ . '::' . __FUNCTION__ . '()', '2.1.1', __CLASS__ . '::' . 'get(\'video\')' );
|
|
|
|
|
|
|
|
|
|
|
593 |
|
594 |
+
return self::get( 'video', array( 'href' => $href, 'width' => $width ) );
|
595 |
}
|
|
|
596 |
}
|
lib/class-wp-embed-fb-admin.php
CHANGED
@@ -1,6 +1,71 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class WP_Embed_FB_Admin {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
/**
|
5 |
* Add WP Embed Facebook page to Settings
|
6 |
*/
|
@@ -18,11 +83,11 @@ class WP_Embed_FB_Admin {
|
|
18 |
*/
|
19 |
static function admin_enqueue_scripts( $hook_suffix ) {
|
20 |
if ( $hook_suffix == 'settings_page_embedfacebook' ) {
|
21 |
-
wp_enqueue_style( 'wpemfb-admin-css',
|
22 |
}
|
23 |
-
wp_enqueue_style( 'wpemfb-default',
|
24 |
-
wp_enqueue_style( 'wpemfb-classic',
|
25 |
-
wp_enqueue_style( 'wpemfb-lightbox',
|
26 |
}
|
27 |
|
28 |
static function in_admin_footer() {
|
@@ -47,7 +112,7 @@ class WP_Embed_FB_Admin {
|
|
47 |
</script>
|
48 |
<?php
|
49 |
endif;
|
50 |
-
if (
|
51 |
?>
|
52 |
<script type="text/javascript">
|
53 |
jQuery(document).on('click', '.wpemfb_warning .notice-dismiss', function () {
|
@@ -76,19 +141,20 @@ class WP_Embed_FB_Admin {
|
|
76 |
* Add template editor style to the embeds.
|
77 |
*/
|
78 |
static function admin_init() {
|
79 |
-
|
80 |
-
add_editor_style(
|
81 |
}
|
82 |
|
83 |
/**
|
84 |
* Render form sections
|
85 |
*
|
86 |
-
* @param string $title
|
87 |
*/
|
88 |
static function section( $title = '' ) {
|
89 |
-
if (
|
|
|
|
|
90 |
?>
|
91 |
-
<h3><?php echo $title ?></h3>
|
92 |
<table>
|
93 |
<tbody>
|
94 |
<?php
|
@@ -103,15 +169,15 @@ class WP_Embed_FB_Admin {
|
|
103 |
/**
|
104 |
* Render form fields
|
105 |
*
|
106 |
-
* @param string $type
|
107 |
-
* @param string $name
|
108 |
* @param string $label Input Label
|
109 |
-
* @param array
|
110 |
-
* @param array
|
111 |
-
* TODO add $help = null
|
112 |
*/
|
113 |
static function field( $type, $name = '', $label = '', $args = array(), $atts = array() ) {
|
114 |
-
|
|
|
115 |
$attsString = '';
|
116 |
if ( ! empty( $atts ) ) {
|
117 |
foreach ( $atts as $att => $val ) {
|
@@ -124,7 +190,8 @@ class WP_Embed_FB_Admin {
|
|
124 |
ob_start();
|
125 |
?>
|
126 |
<tr valign="middle">
|
127 |
-
<th<?php echo ( $name == 'video_download' ) ? ' style="width: 60%;"' : ''
|
|
|
128 |
for="<?php echo $name ?>"><?php echo $label ?></label></th>
|
129 |
<td>
|
130 |
<input type="checkbox" id="<?php echo $name ?>"
|
@@ -141,9 +208,13 @@ class WP_Embed_FB_Admin {
|
|
141 |
<tr valign="middle">
|
142 |
<th><label for="<?php echo $name ?>"><?php echo $label ?></label></th>
|
143 |
<td>
|
144 |
-
<!--suppress HtmlFormInputWithoutLabel -->
|
145 |
<select name="<?php echo $name ?>" <?php echo $attsString ?>>
|
146 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
147 |
<option
|
148 |
value="<?php echo $value ?>" <?php echo $option == $value ? 'selected' : '' ?>><?php echo $name ?></option>
|
149 |
<?php endforeach; ?>
|
@@ -174,7 +245,7 @@ class WP_Embed_FB_Admin {
|
|
174 |
<tr valign="middle">
|
175 |
<th><?php echo $label ?></th>
|
176 |
<td>
|
177 |
-
|
178 |
</td>
|
179 |
</tr>
|
180 |
<?php
|
@@ -184,13 +255,13 @@ class WP_Embed_FB_Admin {
|
|
184 |
ob_start();
|
185 |
?>
|
186 |
<tr valign="middle">
|
187 |
-
<th><?php echo $label ?></th>
|
188 |
<td>
|
189 |
-
<!--suppress HtmlFormInputWithoutLabel -->
|
190 |
<input id="<?php echo $name ?>"
|
191 |
type="<?php echo $type ?>"
|
192 |
name="<?php echo $name ?>" <?php echo isset( $args['required'] ) ? 'required' : '' ?>
|
193 |
-
value="<?php echo $options[ $name ] ?>" <?php echo $attsString
|
|
|
194 |
</td>
|
195 |
</tr>
|
196 |
<?php
|
@@ -202,24 +273,26 @@ class WP_Embed_FB_Admin {
|
|
202 |
/**
|
203 |
* Gets $_POST variables and saves them to the database
|
204 |
*/
|
205 |
-
static function
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
if ( $
|
210 |
-
|
211 |
-
$options[ $option ] = 'true';
|
212 |
-
} else {
|
213 |
-
$options[ $option ] = 'false';
|
214 |
-
}
|
215 |
} else {
|
216 |
-
|
217 |
-
|
218 |
-
|
|
|
|
|
|
|
219 |
}
|
220 |
}
|
221 |
-
WP_Embed_FB_Plugin::set_options( $options );
|
222 |
}
|
|
|
|
|
|
|
|
|
223 |
}
|
224 |
|
225 |
/**
|
@@ -227,239 +300,390 @@ class WP_Embed_FB_Admin {
|
|
227 |
*/
|
228 |
static function wpemfb_page() {
|
229 |
if ( isset( $_POST['save-data'] ) && wp_verify_nonce( $_POST['save-data'], 'W7ziLKoLoj' ) ) {
|
230 |
-
self::
|
231 |
}
|
232 |
if ( isset( $_POST['restore-data'] ) && wp_verify_nonce( $_POST['restore-data'], 'W7ziLKoLojka' ) ) {
|
233 |
-
|
234 |
}
|
235 |
?>
|
236 |
-
<style>
|
237 |
-
input[type="text"], input[type="search"], input[type="password"], input[type="email"], input[type="number"], tr, tbody, table, select {
|
238 |
-
width: 100%;
|
239 |
-
}
|
240 |
-
|
241 |
-
th {
|
242 |
-
min-width: 40%;
|
243 |
-
}
|
244 |
-
</style>
|
245 |
<div class="wrap">
|
246 |
<h2>WP Embed Facebook</h2>
|
247 |
|
248 |
-
<div class="
|
249 |
-
<
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
self::section();
|
331 |
-
self::section( __( "Pages", 'wp-embed-facebook' ) );
|
332 |
-
self::field( 'checkbox', 'raw_page', __( 'Enable by default', 'wp-embed-facebook' ) );
|
333 |
-
self::field( 'checkbox', 'show_like', __( 'Show like button', 'wp-embed-facebook' ) );
|
334 |
-
self::field( 'number', 'max_posts', __( 'Number of posts', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
|
335 |
-
self::section();
|
336 |
-
self::section( __( "Photos", 'wp-embed-facebook' ) );
|
337 |
-
self::field( 'checkbox', 'raw_photo', __( 'Enable by default', 'wp-embed-facebook' ) );
|
338 |
-
self::section();
|
339 |
-
self::section( __( "Posts", 'wp-embed-facebook' ) );
|
340 |
-
self::field( 'checkbox', 'raw_post', __( 'Enable by default', 'wp-embed-facebook' ) );
|
341 |
-
self::section();
|
342 |
-
self::section( __( "Videos", 'wp-embed-facebook' ) );
|
343 |
-
self::field( 'checkbox', 'raw_video', __( 'Enable by default', 'wp-embed-facebook' ) );
|
344 |
-
self::field( 'checkbox', 'video_ratio', __( 'Force 16:9 ratio', 'wp-embed-facebook' ) );
|
345 |
-
self::section();
|
346 |
-
self::section( __( "Profiles", 'wp-embed-facebook' ) );
|
347 |
-
self::field( 'checkbox', 'show_follow', __( 'Show follow button', 'wp-embed-facebook' ) );
|
348 |
-
self::section();
|
349 |
-
echo ! $has_app ? '</div><br><p>You need a facebook app to use custom embeds</p>' : '';
|
350 |
-
?>
|
351 |
-
|
352 |
-
</section>
|
353 |
-
<?php do_action( 'wpemfb_options' ); ?>
|
354 |
-
<section class="sections">
|
355 |
-
<?php
|
356 |
-
self::section( __( "Lightbox Options", 'wp-embed-facebook' ) );
|
357 |
-
self::field( 'checkbox', 'LB_showImageNumberLabel', __( 'Show Image Number Label', 'wp-embed-facebook' ) );
|
358 |
-
self::field( 'text', 'LB_albumLabel', __( 'Album Label', 'wp-embed-facebook' ) );
|
359 |
-
self::field( 'number', 'LB_fadeDuration', __( 'Fade Duration', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
|
360 |
-
self::field( 'number', 'LB_resizeDuration', __( 'Resize Duration', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
|
361 |
-
self::field( 'number', 'LB_positionFromTop', __( 'Position From Top', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
|
362 |
-
self::field( 'number', 'LB_maxHeight', __( 'Max Height', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
|
363 |
-
self::field( 'number', 'LB_maxWidth', __( 'Max Width', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
|
364 |
-
self::field( 'checkbox', 'LB_alwaysShowNavOnTouchDevices', __( 'Always Show Nav On TouchDevices', 'wp-embed-facebook' ) );
|
365 |
-
self::field( 'checkbox', 'LB_fitImagesInViewport', __( 'Fit Images In Viewport', 'wp-embed-facebook' ) );
|
366 |
-
self::field( 'checkbox', 'LB_disableScrolling', __( 'Disable Scrolling', 'wp-embed-facebook' ) );
|
367 |
-
self::field( 'checkbox', 'LB_wrapAround', __( 'Loop Through Album', 'wp-embed-facebook' ) );
|
368 |
-
self::section();
|
369 |
-
self::section( __( 'Enqueue styles and scripts', 'wp-embed-facebook' ) );
|
370 |
-
self::field( 'checkbox', 'enq_when_needed', __( 'Only when there is an embed present', 'wp-embed-facebook' ) );
|
371 |
-
self::field( 'checkbox', 'enq_fbjs', __( 'Facebook SDK', 'wp-embed-facebook' ) );
|
372 |
-
self::field( 'checkbox', 'enqueue_style', __( 'Template Styles', 'wp-embed-facebook' ) );
|
373 |
-
self::field( 'checkbox', 'enq_wpemfb', __( 'Adaptive social plugins script', 'wp-embed-facebook' ) );
|
374 |
-
self::field( 'checkbox', 'enq_lightbox', __( 'Lightbox Script', 'wp-embed-facebook' ) );
|
375 |
-
self::section();
|
376 |
-
self::section( __( 'Other Options' ) );
|
377 |
-
self::field( 'checkbox', 'fb_root', __( 'Add fb-root on top of content', 'wp-embed-facebook' ) );
|
378 |
-
self::field( 'checkbox', 'enq_fbjs_global', __( 'Force Facebook SDK script on all site', 'wp-embed-facebook' ) );
|
379 |
-
self::field( 'checkbox', 'force_app_token', __( 'Force app token', 'wp-embed-facebook' ) );
|
380 |
-
$versions = array(
|
381 |
-
'v2.0' => '2.0',
|
382 |
-
'v2.1' => '2.1',
|
383 |
-
'v2.2' => '2.2',
|
384 |
-
'v2.3' => '2.3',
|
385 |
-
'v2.4' => '2.4',
|
386 |
-
'v2.5' => '2.5',
|
387 |
-
'v2.6' => '2.6',
|
388 |
-
);
|
389 |
-
self::field( 'select', 'sdk_version', 'Facebook SDK Version', $versions );
|
390 |
-
self::section();
|
391 |
-
?>
|
392 |
-
<input type="hidden" name="close_warning2" value="true">
|
393 |
-
</section>
|
394 |
-
<input type="submit" name="submit" class="button button-primary alignright"
|
395 |
-
value="<?php _e( 'Save', 'wp-embed-facebook' ) ?>"/>
|
396 |
-
|
397 |
-
<p><?php sprintf( __( 'All options can be overwritten using the [facebook url ] <a href="%s">shortcode</a>', 'wp-embed-facebook' ), 'http://www.wpembedfb.com/shortcode-attributes-and-examples/' ) ?>
|
398 |
-
</p>
|
399 |
-
<br>
|
400 |
-
<br>
|
401 |
-
</form>
|
402 |
-
<form method="post"
|
403 |
-
onsubmit="return confirm('<?php _e( 'Restore default values?', 'wp-embed-facebook' ) ?>');">
|
404 |
-
<input type="submit" name="restore" class="button alignleft"
|
405 |
-
value="<?php _e( 'Restore defaults', 'wp-embed-facebook' ) ?>"/>
|
406 |
-
<br>
|
407 |
-
<?php wp_nonce_field( 'W7ziLKoLojka', 'restore-data' ); ?>
|
408 |
-
<br>
|
409 |
-
</form>
|
410 |
-
</div>
|
411 |
-
<div class="welcome-panel-column welcome-panel-last">
|
412 |
-
<?php ob_start(); ?>
|
413 |
-
<h1><?php _e( 'Premium Extension Available', 'wp-embed-facebook' ) ?></h1>
|
414 |
<br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
415 |
|
416 |
-
|
417 |
-
|
|
|
418 |
|
419 |
-
|
|
|
|
|
420 |
|
421 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
422 |
|
423 |
-
|
|
|
|
|
424 |
|
425 |
-
|
426 |
-
|
427 |
-
href="http://www.wpembedfb.com/premium"><?php _e( 'Check it out', 'wp-embed-facebook' ) ?></a>
|
428 |
-
</p>
|
429 |
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
<p>
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
|
|
|
|
448 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
458 |
</div>
|
459 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
461 |
</div>
|
462 |
</div>
|
463 |
<?php
|
464 |
}
|
465 |
-
}
|
1 |
<?php
|
2 |
|
3 |
+
class WP_Embed_FB_Admin extends WP_Embed_FB_Plugin {
|
4 |
+
|
5 |
+
static function hooks() {
|
6 |
+
//Donate or review notice
|
7 |
+
add_action( 'admin_notices', __CLASS__ . '::admin_notices' );
|
8 |
+
add_action( 'wp_ajax_wpemfb_close_warning', __CLASS__ . '::wpemfb_close_warning' );
|
9 |
+
add_action( 'wp_ajax_wpemfb_video_down', __CLASS__ . '::wpemfb_video_down' );
|
10 |
+
|
11 |
+
//settings page
|
12 |
+
add_action( 'admin_menu', __CLASS__ . '::add_page' );
|
13 |
+
add_action( 'in_admin_footer', __CLASS__ . '::in_admin_footer' );
|
14 |
+
|
15 |
+
//editor style
|
16 |
+
add_action( 'admin_init', __CLASS__ . '::admin_init' );
|
17 |
+
|
18 |
+
//register styles and scripts
|
19 |
+
add_action( 'admin_enqueue_scripts', __CLASS__ . '::admin_enqueue_scripts' );
|
20 |
+
}
|
21 |
+
|
22 |
+
static function admin_notices() {
|
23 |
+
if ( ( self::get_option( 'close_warning2' ) == 'false' ) ) :
|
24 |
+
?>
|
25 |
+
<div class="notice wpemfb_warning is-dismissible">
|
26 |
+
<h2>WP Embed Facebook</h2>
|
27 |
+
|
28 |
+
<p>Hey! The last step.</p>
|
29 |
+
|
30 |
+
<p><img style="position:relative; top: 5px;" height="20px" width="auto"
|
31 |
+
src="<?php echo self::get_url() . 'lib/admin/ic_setting.png' ?>"> Turn on <a
|
32 |
+
id="wef-video-down" href="<?php echo admin_url( "options-general.php?page=embedfacebook" ) ?>">Video
|
33 |
+
Download Option</a> in settings.</p>
|
34 |
+
<small>
|
35 |
+
<?php
|
36 |
+
printf( __( 'To embed albums, events, profiles and video as HTML5 you will need a <a target="_blank" href="%s">Facebook App</a>', 'wp-embed-facebook' ), 'https://developers.facebook.com/apps' )
|
37 |
+
?>
|
38 |
+
</small>
|
39 |
+
<p>
|
40 |
+
<?php
|
41 |
+
printf( __( 'This free plugin has taken <strong>thousands of hours</strong> to develop and maintain consider making a <a target="_blank" href="%s">donation</a> or leaving a <a target="_blank" href="%s">review</a> <strong>do not let us loose faith</strong> in humanity.', 'wp-embed-facebook' ), 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R8Q85GT3Q8Q26', 'https://wordpress.org/support/view/plugin-reviews/wp-embed-facebook' )
|
42 |
+
?>
|
43 |
+
</p>
|
44 |
+
|
45 |
+
</div>
|
46 |
+
<?php
|
47 |
+
endif;
|
48 |
+
}
|
49 |
+
|
50 |
+
static function wpemfb_close_warning() {
|
51 |
+
if ( current_user_can( 'manage_options' ) ) {
|
52 |
+
$options = self::get_option();
|
53 |
+
$options['close_warning2'] = 'true';
|
54 |
+
self::set_options( $options );
|
55 |
+
}
|
56 |
+
die;
|
57 |
+
}
|
58 |
+
|
59 |
+
static function wpemfb_video_down() {
|
60 |
+
if ( current_user_can( 'manage_options' ) ) {
|
61 |
+
$options = self::get_option();
|
62 |
+
$options['close_warning2'] = 'true';
|
63 |
+
$options['video_download'] = 'true';
|
64 |
+
self::set_options( $options );
|
65 |
+
}
|
66 |
+
die;
|
67 |
+
}
|
68 |
+
|
69 |
/**
|
70 |
* Add WP Embed Facebook page to Settings
|
71 |
*/
|
83 |
*/
|
84 |
static function admin_enqueue_scripts( $hook_suffix ) {
|
85 |
if ( $hook_suffix == 'settings_page_embedfacebook' ) {
|
86 |
+
wp_enqueue_style( 'wpemfb-admin-css', self::get_url() . 'lib/admin/admin.css' );
|
87 |
}
|
88 |
+
wp_enqueue_style( 'wpemfb-default', self::get_url() . 'templates/default/default.css', array(), false );
|
89 |
+
wp_enqueue_style( 'wpemfb-classic', self::get_url() . 'templates/classic/classic.css', array(), false );
|
90 |
+
wp_enqueue_style( 'wpemfb-lightbox', self::get_url() . 'lib/lightbox2/css/lightbox.css', array(), false );
|
91 |
}
|
92 |
|
93 |
static function in_admin_footer() {
|
112 |
</script>
|
113 |
<?php
|
114 |
endif;
|
115 |
+
if ( self::get_option( 'close_warning2' ) == 'false' ) :
|
116 |
?>
|
117 |
<script type="text/javascript">
|
118 |
jQuery(document).on('click', '.wpemfb_warning .notice-dismiss', function () {
|
141 |
* Add template editor style to the embeds.
|
142 |
*/
|
143 |
static function admin_init() {
|
144 |
+
add_editor_style( self::get_url() . '/templates/default/default.css' );
|
145 |
+
add_editor_style( self::get_url() . '/templates/classic/classic.css' );
|
146 |
}
|
147 |
|
148 |
/**
|
149 |
* Render form sections
|
150 |
*
|
151 |
+
* @param string|bool $title
|
152 |
*/
|
153 |
static function section( $title = '' ) {
|
154 |
+
if ( $title ) :
|
155 |
+
if ( is_string( $title ) )
|
156 |
+
echo "<h3>$title</h3>"
|
157 |
?>
|
|
|
158 |
<table>
|
159 |
<tbody>
|
160 |
<?php
|
169 |
/**
|
170 |
* Render form fields
|
171 |
*
|
172 |
+
* @param string $type Type of input field
|
173 |
+
* @param string $name Input name
|
174 |
* @param string $label Input Label
|
175 |
+
* @param array $args
|
176 |
+
* @param array $atts Embed attributes
|
|
|
177 |
*/
|
178 |
static function field( $type, $name = '', $label = '', $args = array(), $atts = array() ) {
|
179 |
+
/** @since 2.1.1 */
|
180 |
+
$options = apply_filters('wpemfb_field_options',self::get_option());
|
181 |
$attsString = '';
|
182 |
if ( ! empty( $atts ) ) {
|
183 |
foreach ( $atts as $att => $val ) {
|
190 |
ob_start();
|
191 |
?>
|
192 |
<tr valign="middle">
|
193 |
+
<th<?php //echo ( $name == 'video_download' ) ? ' style="width: 60%;"' : ''
|
194 |
+
?>><label
|
195 |
for="<?php echo $name ?>"><?php echo $label ?></label></th>
|
196 |
<td>
|
197 |
<input type="checkbox" id="<?php echo $name ?>"
|
208 |
<tr valign="middle">
|
209 |
<th><label for="<?php echo $name ?>"><?php echo $label ?></label></th>
|
210 |
<td>
|
|
|
211 |
<select name="<?php echo $name ?>" <?php echo $attsString ?>>
|
212 |
+
<?php
|
213 |
+
foreach ( $args as $value => $name ) :
|
214 |
+
if ( is_numeric( $value ) ) {
|
215 |
+
$value = $name;
|
216 |
+
}
|
217 |
+
?>
|
218 |
<option
|
219 |
value="<?php echo $value ?>" <?php echo $option == $value ? 'selected' : '' ?>><?php echo $name ?></option>
|
220 |
<?php endforeach; ?>
|
245 |
<tr valign="middle">
|
246 |
<th><?php echo $label ?></th>
|
247 |
<td>
|
248 |
+
<?php echo $name ?>
|
249 |
</td>
|
250 |
</tr>
|
251 |
<?php
|
255 |
ob_start();
|
256 |
?>
|
257 |
<tr valign="middle">
|
258 |
+
<th><label for="<?php echo $name ?>"><?php echo $label ?></label></th>
|
259 |
<td>
|
|
|
260 |
<input id="<?php echo $name ?>"
|
261 |
type="<?php echo $type ?>"
|
262 |
name="<?php echo $name ?>" <?php echo isset( $args['required'] ) ? 'required' : '' ?>
|
263 |
+
value="<?php echo esc_attr($options[ $name ]) ?>" <?php echo $attsString ?>
|
264 |
+
class="regular-text"/>
|
265 |
</td>
|
266 |
</tr>
|
267 |
<?php
|
273 |
/**
|
274 |
* Gets $_POST variables and saves them to the database
|
275 |
*/
|
276 |
+
private static function save_data() {
|
277 |
+
$options = self::get_option();
|
278 |
+
foreach ( $options as $option => $value ) {
|
279 |
+
if ( $value == 'true' || $value == 'false' ) {
|
280 |
+
if ( isset( $_POST[ $option ] ) ) {
|
281 |
+
$options[ $option ] = 'true';
|
|
|
|
|
|
|
|
|
282 |
} else {
|
283 |
+
$options[ $option ] = 'false';
|
284 |
+
}
|
285 |
+
} else {
|
286 |
+
if ( isset( $_POST[ $option ] ) ) {
|
287 |
+
$sanitized = sanitize_text_field( $_POST[ $option ] );
|
288 |
+
$options[ $option ] = stripslashes($sanitized);
|
289 |
}
|
290 |
}
|
|
|
291 |
}
|
292 |
+
/** @since 2.1.1 */
|
293 |
+
do_action('wpemfb_save_data');
|
294 |
+
|
295 |
+
self::set_options( $options );
|
296 |
}
|
297 |
|
298 |
/**
|
300 |
*/
|
301 |
static function wpemfb_page() {
|
302 |
if ( isset( $_POST['save-data'] ) && wp_verify_nonce( $_POST['save-data'], 'W7ziLKoLoj' ) ) {
|
303 |
+
self::save_data();
|
304 |
}
|
305 |
if ( isset( $_POST['restore-data'] ) && wp_verify_nonce( $_POST['restore-data'], 'W7ziLKoLojka' ) ) {
|
306 |
+
self::set_options( self::get_defaults() );
|
307 |
}
|
308 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
<div class="wrap">
|
310 |
<h2>WP Embed Facebook</h2>
|
311 |
|
312 |
+
<div class="wef-content">
|
313 |
+
<form id="config-form" action="#" method="post">
|
314 |
+
<?php wp_nonce_field( 'W7ziLKoLoj', 'save-data' ); ?>
|
315 |
+
<?php
|
316 |
+
$has_app = self::has_fb_app();
|
317 |
+
$tabs = array(
|
318 |
+
__( 'Magic Embeds', 'wp-embed-facebook' ),
|
319 |
+
__( 'Social Plugins', 'wp-embed-facebook' ),
|
320 |
+
__( 'Custom Embeds', 'wp-embed-facebook' ),
|
321 |
+
__( 'Lightbox', 'wp-embed-facebook' ),
|
322 |
+
__( 'Advanced', 'wp-embed-facebook' ),
|
323 |
+
);
|
324 |
+
$tabs = apply_filters( 'wpemfb_tabs', $tabs );
|
325 |
+
?>
|
326 |
+
<h2 class="nav-tab-wrapper">
|
327 |
+
<?php
|
328 |
+
foreach ( $tabs as $tab ) {
|
329 |
+
$class = $tabs[0] == $tab ? "nav-tab-active" : "";
|
330 |
+
echo "<a class='nav-tab $class' href='#'>$tab</a>";
|
331 |
+
}
|
332 |
+
?>
|
333 |
+
</h2><br>
|
334 |
+
<section id="magic_embeds" class="sections">
|
335 |
+
<?php
|
336 |
+
self::section( true );
|
337 |
+
self::field( 'string',
|
338 |
+
sprintf( __( 'Auto embeds understand the url you are entering and return a social plugin or a custom embed. <br>They can be activated by <a href="https://codex.wordpress.org/Embeds" title="WordPress Embeds" target="_blank">pasting the url on the editor</a> or by the [facebook url ] <a href="%s" title="[facebook] Shortcode attributes and examples" target="_blank">shortcode</a>.', 'wp-embed-facebook' ), 'http://www.wpembedfb.com/shortcode-attributes-and-examples/' ),
|
339 |
+
'<h3>' . __( 'Auto Embeds', 'wp-embed-facebook' ) . '</h3>' );
|
340 |
+
self::field( 'checkbox', 'auto_embed_active', __( 'Auto embed url\'s on editor ', 'wp-embed-facebook' ) );
|
341 |
+
self::field( 'number', 'max_width', __( 'Maximum width in pixels', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
|
342 |
+
self::field( 'checkbox', 'video_as_post', __( 'Embed video as post', 'wp-embed-facebook' ) );
|
343 |
+
self::field( 'checkbox', 'video_download', sprintf( __( '%sDownload link under video', 'wp-embed-facebook' ), '<img style="display:block;float:left;padding-right:5px;" width="25px" height="auto" src="' . self::get_url() . 'lib/admin/ic_image_settings.png">' ) );
|
344 |
+
|
345 |
+
self::field( 'string', sprintf( __( 'The quote plugin lets people select text on your page and add it to their share.<br><a href="%s" target="_blank" title="WP Embed Facebook">Demo</a>', 'wp-embed-facebook' ), 'http://www.wpembedfb.com/demo-site/social-plugins/quote-plugin/' ), '<h3>' . __( 'Quote Plugin', 'wp-embed-facebook' ) . '</h3>' );
|
346 |
+
self::field( 'checkbox', 'quote_plugin_active', __( 'Active', 'wp-embed-facebook' ) );
|
347 |
+
self::field( 'text', 'quote_post_types', __( 'Post types', 'wp-embed-facebook' ) );
|
348 |
+
self::field( 'string', __( 'Coma separated post types i.e. post,page,attachment', 'wp-embed-facebook' ) );
|
349 |
+
|
350 |
+
self::field( 'string', 'Replace WP comments for FB comments on selected post types', '<h3>' . __( 'Comments', 'wp-embed-facebook' ) . '</h3>' );
|
351 |
+
self::field( 'checkbox', 'auto_comments_active', __( 'Active', 'wp-embed-facebook' ) );
|
352 |
+
self::field( 'text', 'auto_comments_post_types', __( 'Post types', 'wp-embed-facebook' ) );
|
353 |
+
self::field( 'string', __( 'Coma separated post types i.e. post,page,attachment', 'wp-embed-facebook' ) );
|
354 |
+
self::field( 'checkbox', 'comments_count_active', __( 'Sync comment count', 'wp-embed-facebook' ) );
|
355 |
+
self::field( 'string', '<small>Comments count get stored on _wef_comments_count post meta.<br>You can refresh the comment count by updating the post</small>' );
|
356 |
+
|
357 |
+
self::field( 'checkbox', 'comments_open_graph', __( 'Add open graph meta', 'wp-embed-facebook' ) );
|
358 |
+
self::field( 'string', __( 'Needed to moderate comments', 'wp-embed-facebook' ) . '<br><small>' . sprintf( __( 'Disable this if you already have another plugin adding <a title="Moderation Setup Instructions" target="_blank" href="%s">the fb:app_id meta</a>', 'wp-embed-facebook' ), 'https://developers.facebook.com/docs/plugins/comments/#moderation-setup-instructions' ) . '</small>' );
|
359 |
+
$comment_notes = __( 'To enable comments moderation setup your App ID', 'wp-embed-facebook' );
|
360 |
+
$comment_notes .= '<br>';
|
361 |
+
$comment_notes .= '<small>';
|
362 |
+
$comment_notes .= sprintf( __( 'If you cant see the "Moderate comment" link above each comment you will need to <a title="Sharing Debugger" target="_blank" href="%s">scrape the url</a>', 'wp-embed-facebook' ), 'https://developers.facebook.com/tools/debug/sharing/' );
|
363 |
+
$comment_notes .= '<br>';
|
364 |
+
$comment_notes .= 'An automatic solution for this will be available on future releases<br>';
|
365 |
+
$comment_notes .= '</small><br>';
|
366 |
+
self::field( 'string', $comment_notes, __( 'Notes:', 'wp-embed-facebook' ) );
|
367 |
+
|
368 |
+
self::field( 'string', '', '<h3>' . __( 'Facebook settings', 'wp-embed-facebook' ) . '</h3>' );
|
369 |
+
self::field( 'select', 'sdk_lang', __( 'Social Plugins Language', 'wp-embed-facebook' ), self::get_fb_locales() );
|
370 |
+
self::field( 'string',
|
371 |
+
sprintf(
|
372 |
+
__( 'Creating a Facebook app is easy view the <a href="%s" target="_blank" title="WP Embed FB documentation">step by step guide</a> or view <a href="%s" target="_blank" title="Facebook Apps">your apps</a>.'
|
373 |
+
, 'wp-embed-facebook'
|
374 |
+
),
|
375 |
+
'http://www.wpembedfb.com/blog/creating-a-facebook-app-the-step-by-step-guide/',
|
376 |
+
'https://developers.facebook.com/apps'
|
377 |
+
),
|
378 |
+
'' );
|
379 |
+
self::field( 'text', 'app_id', __( 'App ID', 'wp-embed-facebook' ) );
|
380 |
+
self::field( 'string', 'Needed for comments moderation and custom embeds' );
|
381 |
+
self::field( 'text', 'app_secret', __( 'App Secret', 'wp-embed-facebook' ) );
|
382 |
+
self::field( 'string', 'Needed for custom embeds' );
|
383 |
+
//TODO auto scrape fb share using fb api on updated posts, filtered by post_type
|
384 |
+
// self::field( 'checkbox', 'scrape_open_graph', __( 'Scrape FB share data', 'wp-embed-facebook' ) );
|
385 |
+
// self::field( 'string', __( '<small>This will update the contents of the share every time you update a plublished post<br>You need a FB App for this.</small>', 'wp-embed-facebook' ), '<h4>Notes:</h4>' );
|
386 |
+
|
387 |
+
self::section();
|
388 |
+
?>
|
389 |
+
</section>
|
390 |
+
|
391 |
+
<section id="social_plugins" class="sections">
|
392 |
+
<p>
|
393 |
+
<?php printf( __( '<a title="Facebook Social Plugins" href="%s" rel="nofollow" target="_blank">Social plugins</a> are pieces of code that Facebook developers created for us mortals.', 'wp-embed-facebook' ), 'https://developers.facebook.com/docs/plugins/' ) ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
<br>
|
395 |
+
<strong><?php _e( 'Example:', 'wp-embed-facebook' ) ?></strong>
|
396 |
+
<br>
|
397 |
+
<?php _e( 'Embed a like button for the curent page:', 'wp-embed-facebook' ) ?>
|
398 |
+
<br>
|
399 |
+
[fb_plugin like share=true layout=button_count]
|
400 |
+
<?php _e( 'add debug=1 to debug the result.', 'wp-embed-facebook' ) ?>
|
401 |
+
|
402 |
+
</p>
|
403 |
+
<?php
|
404 |
+
$vars = get_class_vars( 'WEF_Social_Plugins' );
|
405 |
+
self::section( true );
|
406 |
+
|
407 |
+
self::field( 'string', '[fb_plugin page href=]', '<h3>' . __( 'Page plugin', 'wp-embed-facebook' ). '<br>' . WEF_Social_Plugins::get_links( 'page' ) . '</h3>' );
|
408 |
+
self::field( 'number', 'page_width', 'width', array(), array(
|
409 |
+
'min' => '220',
|
410 |
+
'max' => '500'
|
411 |
+
) );
|
412 |
+
self::field( 'number', 'page_height', 'height', array(), array( 'min' => '70' ) );
|
413 |
+
self::field( 'text', 'page_tabs', 'tabs' );
|
414 |
+
self::field( 'string', __( 'Comma separated tabs i.e. timeline,events,messages' ) );
|
415 |
+
self::field( 'checkbox', 'page_hide-cover', 'hide-cover' );
|
416 |
+
self::field( 'checkbox', 'page_show-facepile', 'show-facepile' );
|
417 |
+
self::field( 'checkbox', 'page_hide-cta', 'hide-cta' );
|
418 |
+
self::field( 'checkbox', 'page_small-header', 'small-header' );
|
419 |
+
self::field( 'checkbox', 'page_adapt-container-width', 'adapt-container-width' );
|
420 |
+
|
421 |
+
self::field( 'string', '[fb_plugin post href=]', '<h3>' . __( 'Post plugin', 'wp-embed-facebook' ). '<br>' . WEF_Social_Plugins::get_links( 'post' ) . '</h3>' );
|
422 |
+
self::field( 'number', 'post_width', 'width', array(), array(
|
423 |
+
'min' => '350',
|
424 |
+
'max' => '750'
|
425 |
+
) );
|
426 |
+
self::field( 'checkbox', 'post_show-text', 'show-text' );
|
427 |
+
|
428 |
+
self::field( 'string', '[fb_plugin video href=]', '<h3>' . __( 'Video', 'wp-embed-facebook' ). '<br>' . WEF_Social_Plugins::get_links( 'video' ) . '</h3>' );
|
429 |
+
self::field( 'checkbox', 'video_allowfullscreen', 'allowfullscreen' );
|
430 |
+
self::field( 'checkbox', 'video_autoplay', 'autoplay' );
|
431 |
+
self::field( 'checkbox', 'video_show-text', 'show-text' );
|
432 |
+
self::field( 'checkbox', 'video_show-captions', 'show-captions' );
|
433 |
+
self::field( 'number', 'video_width', 'width', array(), array( 'min' => '220' ) );
|
434 |
+
|
435 |
+
self::field( 'string', '[fb_plugin comment href=]', '<h3>' . __( 'Single comment', 'wp-embed-facebook' ). '<br>' . WEF_Social_Plugins::get_links( 'comment' ) . '</h3>' );
|
436 |
+
self::field( 'number', 'comment_width', 'width', array(), array( 'min' => '220' ) );
|
437 |
+
self::field( 'checkbox', 'comment_include-parent', 'include-parent' );
|
438 |
+
|
439 |
+
self::field( 'string', '[fb_plugin comments]<br><small>' . __( 'Activate them on all your posts on the "Magic embeds" section', 'wp-embed-facebook' ) . '</small>', '<h3>' . __( 'Comments plugin', 'wp-embed-facebook' ). '<br>' . WEF_Social_Plugins::get_links( 'comments' ) . '</h3>' );
|
440 |
+
self::field( 'select', 'comments_colorscheme', 'colorscheme', $vars['comments']['colorscheme'] );
|
441 |
+
self::field( 'checkbox', 'comments_mobile', 'mobile' );
|
442 |
+
self::field( 'number', 'comments_num_posts', 'num_posts', array(), array( 'min' => '1' ) );
|
443 |
+
self::field( 'select', 'comments_order_by', 'order_by', $vars['comments']['order_by'] );
|
444 |
+
self::field( 'text', 'comments_width', 'width' );
|
445 |
+
|
446 |
+
self::field( 'string', '[fb_plugin quote]<br><small>' . __( 'Activate it on all your posts on the "Magic embeds" section', 'wp-embed-facebook' ) . '</small>', '<h3>' . __( 'Quote plugin', 'wp-embed-facebook' ). '<br>' . WEF_Social_Plugins::get_links( 'quote' ) . '</h3>' );
|
447 |
+
self::field( 'select', 'quote_layout', 'layout', $vars['quote']['layout'] );
|
448 |
+
|
449 |
+
self::field( 'string', '[fb_plugin save]', '<h3>' . __( 'Save button', 'wp-embed-facebook' ). '<br>' . WEF_Social_Plugins::get_links( 'save' ) . '</h3>' );
|
450 |
+
self::field( 'select', 'save_size', 'size', $vars['save']['size'] );
|
451 |
+
|
452 |
+
self::field( 'string', '[fb_plugin like]', '<h3>' . __( 'Like button', 'wp-embed-facebook' ). '<br>' . WEF_Social_Plugins::get_links( 'like' ) . '</h3>' );
|
453 |
+
self::field( 'select', 'like_action', 'action', $vars['like']['action'] );
|
454 |
+
self::field( 'select', 'like_colorscheme', 'colorscheme', $vars['like']['colorscheme'] );
|
455 |
+
self::field( 'checkbox', 'like_kid-directed-site', 'kid-directed-site' );
|
456 |
+
self::field( 'select', 'like_layout', 'layout', $vars['like']['layout'] );
|
457 |
+
self::field( 'checkbox', 'like_share', 'share' );
|
458 |
+
self::field( 'checkbox', 'like_show-faces', 'show-faces' );
|
459 |
+
self::field( 'number', 'like_width', 'width', array(), array( 'min' => '225' ) );
|
460 |
|
461 |
+
self::field( 'string', '[fb_plugin send]', '<h3>' . __( 'Send button', 'wp-embed-facebook' ). '<br>' . WEF_Social_Plugins::get_links( 'send' ) . '</h3>' );
|
462 |
+
self::field( 'select', 'send_colorscheme', 'colorscheme', $vars['send']['colorscheme'] );
|
463 |
+
self::field( 'checkbox', 'send_kid-directed-site', 'kid-directed-site' );
|
464 |
|
465 |
+
self::field( 'string', '[fb_plugin share]', '<h3>' . __( 'Share button', 'wp-embed-facebook' ). '<br>' . WEF_Social_Plugins::get_links( 'share' ) . '</h3>' );
|
466 |
+
self::field( 'select', 'share_layout', 'layout', $vars['share']['layout'] );
|
467 |
+
self::field( 'checkbox', 'share_mobile_iframe', 'mobile_iframe' );
|
468 |
|
469 |
+
self::field( 'string', '[fb_plugin follow href=]', '<h3>' . __( 'Follow button', 'wp-embed-facebook' ). '<br>' . WEF_Social_Plugins::get_links( 'follow' ) . '</h3>' );
|
470 |
+
self::field( 'select', 'follow_colorscheme', 'colorscheme', $vars['follow']['colorscheme'] );
|
471 |
+
self::field( 'checkbox', 'follow_kid-directed-site', 'kid-directed-site' );
|
472 |
+
self::field( 'select', 'follow_layout', 'layout', $vars['follow']['layout'] );
|
473 |
+
self::field( 'checkbox', 'follow_show-faces', 'show-faces' );
|
474 |
+
self::field( 'number', 'follow_width', 'width', array(), array(
|
475 |
+
'min' => '225',
|
476 |
+
'max' => '450'
|
477 |
+
) );
|
478 |
|
479 |
+
self::field( 'string', 'Make the embed smaller according to screen size', '<h3>' . __( 'Adaptive view', 'wp-embed-facebook' ) . '</h3>' );
|
480 |
+
self::field( 'checkbox', 'adaptive_fb_plugin', 'active' );
|
481 |
+
self::section();
|
482 |
|
483 |
+
?>
|
484 |
+
</section>
|
|
|
|
|
485 |
|
486 |
+
<section id="custom_embeds" class="sections">
|
487 |
+
<?php if ( ! $has_app ) : ?>
|
488 |
+
<div style="display: none">
|
489 |
+
<?php endif; ?>
|
490 |
+
<?php
|
491 |
+
self::section( __( "General", 'wp-embed-facebook' ) );
|
492 |
+
/**
|
493 |
+
* Filter available templates
|
494 |
+
*
|
495 |
+
* @since 2.0.2
|
496 |
+
*/
|
497 |
+
$templates = apply_filters( 'wpemfb_admin_theme', array(
|
498 |
+
'default' => 'Default',
|
499 |
+
'classic' => 'Classic'
|
500 |
+
) );
|
501 |
+
self::field( 'select', 'theme', 'Template', $templates );
|
502 |
|
503 |
+
self::field( 'string', '', '<h3>' . __( 'Albums', 'wp-embed-facebook' ) . '</h3>' );
|
504 |
+
self::field( 'number', 'max_photos', __( 'Number of Photos', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
|
505 |
+
|
506 |
+
self::field( 'string', '', '<h3>' . __( 'Events', 'wp-embed-facebook' ) . '</h3>' );
|
507 |
+
self::field( 'checkbox', 'ev_local_tz', __( 'Use WP time to calculate the date', 'wp-embed-facebook' ) );
|
508 |
+
|
509 |
+
self::field( 'string', '', '<h3>' . __( 'Pages', 'wp-embed-facebook' ) . '</h3>' );
|
510 |
+
self::field( 'checkbox', 'raw_page', __( 'Use by default on "Auto Embeds"', 'wp-embed-facebook' ) );
|
511 |
+
self::field( 'checkbox', 'show_like', __( 'Show like button', 'wp-embed-facebook' ) );
|
512 |
+
self::field( 'number', 'max_posts', __( 'Number of posts', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
|
513 |
+
|
514 |
+
self::field( 'string', '', '<h3>' . __( 'Photos', 'wp-embed-facebook' ) . '</h3>' );
|
515 |
+
self::field( 'checkbox', 'raw_photo', __( 'Use by default on "Auto Embeds"', 'wp-embed-facebook' ) );
|
516 |
+
|
517 |
+
self::field( 'string', '', '<h3>' . __( 'Posts', 'wp-embed-facebook' ) . '</h3>' );
|
518 |
+
self::field( 'checkbox', 'raw_post', __( 'Use by default on "Auto Embeds"', 'wp-embed-facebook' ) );
|
519 |
+
|
520 |
+
self::field( 'string', '', '<h3>' . __( 'Videos', 'wp-embed-facebook' ) . '</h3>' );
|
521 |
+
self::field( 'checkbox', 'raw_video', __( 'Use by default on "Auto Embeds"', 'wp-embed-facebook' ) );
|
522 |
+
self::field( 'checkbox', 'video_ratio', __( 'Force 16:9 ratio', 'wp-embed-facebook' ) );
|
523 |
+
|
524 |
+
self::field( 'string', '', '<h3>' . __( 'Profiles', 'wp-embed-facebook' ) . '</h3>' );
|
525 |
+
self::field( 'checkbox', 'show_follow', __( 'Show follow button', 'wp-embed-facebook' ) );
|
526 |
+
|
527 |
+
self::section();
|
528 |
+
?>
|
529 |
<p>
|
530 |
+
<?php _e( 'Custom embeds can be accessed using the [facebook url] or [embed] shortcodes also by activating "Auto Embeds" on Magic Embeds section.', 'wp-embed-facebook' ) ?>
|
531 |
+
<br>
|
532 |
+
<strong><?php _e( 'Example:', 'wp-embed-facebook' ) ?></strong>
|
533 |
+
<br>
|
534 |
+
Page custom embed<br>
|
535 |
+
[facebook https://www.facebook.com/sydneyoperahouse/ social_plugin=false posts=2]
|
536 |
+
<br>
|
537 |
+
<?php printf( __( '<a href="%s" title="WP Embed Facebook Shortcode" target="_blank">Read More</a>', 'wp-embed-facebook' ), 'http://www.wpembedfb.com/shortcode-attributes-and-examples/' ) ?>
|
538 |
</p>
|
539 |
+
<?php
|
540 |
+
if ( ! $has_app ) :
|
541 |
+
?>
|
542 |
+
</div>
|
543 |
+
<p>
|
544 |
+
<?php _e( 'By default you can only embed public pages, videos, photos and posts.', 'wp-embed-facebook' ) ?>
|
545 |
+
<br><?php _e( 'To embed albums, events, profiles and video as HTML5 you will need to setup a Facebook App on Magic Embeds section', 'wp-embed-facebook' ) ?>
|
546 |
+
</p>
|
547 |
+
<?php
|
548 |
+
endif;
|
549 |
+
?>
|
550 |
+
</section>
|
551 |
|
552 |
+
<section id="lightbox" class="sections">
|
553 |
+
<h4>Lightbox is only active on custom embeds.</h4>
|
554 |
+
<?php if ( ! $has_app ) : ?>
|
555 |
+
<div style="display: none">
|
556 |
+
<?php endif; ?>
|
557 |
+
<?php
|
558 |
+
self::section( __( "Lightbox Options", 'wp-embed-facebook' ) );
|
559 |
+
self::field( 'checkbox', 'LB_showImageNumberLabel', __( 'Show Image Number Label', 'wp-embed-facebook' ) );
|
560 |
+
self::field( 'text', 'LB_albumLabel', __( 'Album Label', 'wp-embed-facebook' ) );
|
561 |
+
self::field( 'number', 'LB_fadeDuration', __( 'Fade Duration', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
|
562 |
+
self::field( 'number', 'LB_resizeDuration', __( 'Resize Duration', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
|
563 |
+
self::field( 'number', 'LB_positionFromTop', __( 'Position From Top', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
|
564 |
+
self::field( 'number', 'LB_maxHeight', __( 'Max Height', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
|
565 |
+
self::field( 'number', 'LB_maxWidth', __( 'Max Width', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
|
566 |
+
self::field( 'checkbox', 'LB_alwaysShowNavOnTouchDevices', __( 'Always Show Nav On TouchDevices', 'wp-embed-facebook' ) );
|
567 |
+
self::field( 'checkbox', 'LB_fitImagesInViewport', __( 'Fit Images In Viewport', 'wp-embed-facebook' ) );
|
568 |
+
self::field( 'checkbox', 'LB_disableScrolling', __( 'Disable Scrolling', 'wp-embed-facebook' ) );
|
569 |
+
self::field( 'checkbox', 'LB_wrapAround', __( 'Loop Through Album', 'wp-embed-facebook' ) );
|
570 |
+
|
571 |
+
self::section();
|
572 |
+
if ( ! $has_app ) :
|
573 |
+
?>
|
574 |
</div>
|
575 |
+
<p>
|
576 |
+
<?php _e( 'By default you can only embed public pages, videos, photos and posts.', 'wp-embed-facebook' ) ?>
|
577 |
+
<br><?php _e( 'To embed albums, events, profiles and video as HTML5 you will need to setup a Facebook App on Magic Embeds section', 'wp-embed-facebook' ) ?>
|
578 |
+
</p>
|
579 |
+
<?php
|
580 |
+
endif;
|
581 |
+
?>
|
582 |
+
</section>
|
583 |
+
|
584 |
+
<?php do_action( 'wpemfb_options' ); ?>
|
585 |
+
|
586 |
+
<section id="advanced" class="sections">
|
587 |
+
<p>Beware altering this options without the proper knowledge could make the world disappear.</p>
|
588 |
+
<?php
|
589 |
+
self::section( true );
|
590 |
+
self::field( 'string', '', '<h3>' . __( 'Enqueue styles and scripts', 'wp-embed-facebook' ) . '</h3>' );
|
591 |
+
self::field( 'checkbox', 'enq_when_needed', __( 'Only when there is an embed present', 'wp-embed-facebook' ) );
|
592 |
+
self::field( 'checkbox', 'enq_fbjs', __( 'Facebook SDK', 'wp-embed-facebook' ) );
|
593 |
+
self::field( 'checkbox', 'enqueue_style', __( 'Template Styles', 'wp-embed-facebook' ) );
|
594 |
+
self::field( 'checkbox', 'enq_wpemfb', __( 'Adaptive social plugins script', 'wp-embed-facebook' ) );
|
595 |
+
|
596 |
+
self::field( 'string', __('',''), '<h3>' . __( 'Lightbox', 'wp-embed-facebook' ) . '</h3>' );
|
597 |
+
self::field( 'checkbox', 'enq_lightbox', __( 'Enqueue script', 'wp-embed-facebook' ) );
|
598 |
+
self::field( 'text', 'lightbox_att', __( 'Attribute', 'wp-embed-facebook' ) );
|
599 |
+
|
600 |
+
self::field( 'string', '', '<h3>' . __( 'Other Options', 'wp-embed-facebook' ) . '</h3>' );
|
601 |
+
self::field( 'checkbox', 'fb_root', __( 'Add fb-root on top of content', 'wp-embed-facebook' ) );
|
602 |
+
self::field( 'checkbox', 'enq_fbjs_global', __( 'Force Facebook SDK script on all site', 'wp-embed-facebook' ) );
|
603 |
+
self::field( 'checkbox', 'force_app_token', __( 'Force app token', 'wp-embed-facebook' ) );
|
604 |
+
$versions = array(
|
605 |
+
'v2.0' => '2.0',
|
606 |
+
'v2.1' => '2.1',
|
607 |
+
'v2.2' => '2.2',
|
608 |
+
'v2.3' => '2.3',
|
609 |
+
'v2.4' => '2.4',
|
610 |
+
'v2.5' => '2.5',
|
611 |
+
'v2.6' => '2.6',
|
612 |
+
);
|
613 |
+
self::field( 'select', 'sdk_version', 'Facebook SDK Version', $versions );
|
614 |
+
|
615 |
+
self::section();
|
616 |
+
?>
|
617 |
+
</section>
|
618 |
+
|
619 |
+
<input type="hidden" name="close_warning2" value="true">
|
620 |
+
<input type="submit" name="submit" class="button button-primary"
|
621 |
+
value="<?php _e( 'Save all settings', 'wp-embed-facebook' ) ?>"/>
|
622 |
+
</form>
|
623 |
+
<br>
|
624 |
+
|
625 |
+
<form method="post"
|
626 |
+
onsubmit="return confirm('<?php _e( 'Restore default values?', 'wp-embed-facebook' ) ?>');"
|
627 |
+
style="text-align: right">
|
628 |
+
<input type="submit" name="restore" class="button"
|
629 |
+
value="<?php _e( 'Restore defaults', 'wp-embed-facebook' ) ?>"/>
|
630 |
+
<br>
|
631 |
+
<?php wp_nonce_field( 'W7ziLKoLojka', 'restore-data' ); ?>
|
632 |
+
<br>
|
633 |
+
</form>
|
634 |
+
</div>
|
635 |
+
<div class="wef-sidebar">
|
636 |
+
<?php ob_start(); ?>
|
637 |
+
<h1><?php _e( 'Premium Extension Available', 'wp-embed-facebook' ) ?></h1>
|
638 |
+
<br>
|
639 |
+
|
640 |
+
<div class="features-list">
|
641 |
+
<p><?php _e( 'Shortcodes for embedding a full event or page.', 'wp-embed-facebook' ) ?></p>
|
642 |
+
|
643 |
+
<p><?php _e( 'Default event template shows admins and address.', 'wp-embed-facebook' ) ?></p>
|
644 |
+
|
645 |
+
<p><?php _e( 'Albums with more that 100 photos.', 'wp-embed-facebook' ) ?></p>
|
646 |
+
|
647 |
+
<p><?php _e( 'One Year Premium Support', 'wp-embed-facebook' ) ?></p>
|
648 |
+
|
649 |
+
<p>
|
650 |
+
<a class="button button-red" title="Premium extension" target="_blank"
|
651 |
+
href="http://www.wpembedfb.com/premium"><?php _e( 'Check it out', 'wp-embed-facebook' ) ?></a>
|
652 |
+
</p>
|
653 |
+
|
654 |
+
<p>
|
655 |
+
<?php _e( 'Plus new features cooking', 'wp-embed-facebook' ) ?>
|
656 |
+
<br>
|
657 |
+
<small>
|
658 |
+
<?php _e( 'Embed personal data, shortcode creator, widgets, special templates for albums and pages', 'wp-embed-facebook' ) ?>
|
659 |
+
</small>
|
660 |
+
</p>
|
661 |
</div>
|
662 |
+
<hr>
|
663 |
+
<h4><?php _e( "This free plugin has taken thousands of hours to maintain and develop", 'wp-embed-facebook' ) ?></h4>
|
664 |
+
|
665 |
+
<p>
|
666 |
+
<strong>
|
667 |
+
<a href="http://wordpress.org/plugins/wp-embed-facebook" title="wordpress.org"
|
668 |
+
target="_blank"><?php _e( "Rate it", 'wp-embed-facebook' ) ?>
|
669 |
+
<br>
|
670 |
+
<span style="color: gold;"> ★★★★★ </span>
|
671 |
+
</a>
|
672 |
+
</strong>
|
673 |
+
</p>
|
674 |
+
|
675 |
+
<p><strong><a target="_blank" title="paypal"
|
676 |
+
href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R8Q85GT3Q8Q26">👾<?php _e( 'Donate', 'wp-embed-facebook' ) ?>
|
677 |
+
👾</a></strong>
|
678 |
+
</p>
|
679 |
+
<hr>
|
680 |
+
<p><a href="http://www.wpembedfb.com" title="plugin website" target="_blank">
|
681 |
+
<small><?php _e( 'More information', 'wp-embed-facebook' ) ?></small>
|
682 |
+
</a></p>
|
683 |
+
<?php echo apply_filters( 'wpemfb_admin', ob_get_clean() ); ?>
|
684 |
+
|
685 |
</div>
|
686 |
</div>
|
687 |
<?php
|
688 |
}
|
689 |
+
}
|
lib/class-wp-embed-fb-plugin.php
CHANGED
@@ -1,21 +1,35 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
3 |
class WP_Embed_FB_Plugin {
|
4 |
-
|
5 |
-
* @var string Plugin directory
|
6 |
-
*/
|
7 |
private static $path = null;
|
8 |
-
/**
|
9 |
-
* @var string Plugin url
|
10 |
-
*/
|
11 |
private static $url = null;
|
12 |
private static $options = null;
|
13 |
private static $defaults = null;
|
14 |
-
const option_name = 'wpemfb_options';
|
15 |
private static $lb_defaults = null;
|
16 |
private static $has_photon = null;
|
17 |
private static $wp_timezone = null;
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
static function install() {
|
20 |
$type = ( get_option( 'wpemfb_theme' ) || get_option( self::option_name ) ) ? 'reactivated' : 'activated';
|
21 |
self::get_option();
|
@@ -28,14 +42,17 @@ class WP_Embed_FB_Plugin {
|
|
28 |
*/
|
29 |
static function uninstall() {
|
30 |
if ( is_multisite() ) {
|
|
|
31 |
$sites = wp_get_sites();
|
32 |
foreach ( $sites as $site ) {
|
33 |
switch_to_blog( $site['blog_id'] );
|
34 |
delete_option( self::option_name );
|
|
|
35 |
}
|
36 |
restore_current_blog();
|
37 |
} else {
|
38 |
delete_option( self::option_name );
|
|
|
39 |
}
|
40 |
|
41 |
return self::whois( 'uninstalled' );
|
@@ -49,7 +66,7 @@ class WP_Embed_FB_Plugin {
|
|
49 |
* @return array old options to be deleated since 2.1
|
50 |
*/
|
51 |
static function old_options() {
|
52 |
-
return
|
53 |
'show_posts',
|
54 |
'close_warning',
|
55 |
'height',
|
@@ -85,7 +102,7 @@ class WP_Embed_FB_Plugin {
|
|
85 |
'force_app_token',
|
86 |
'video_download',
|
87 |
'sdk_version'
|
88 |
-
)
|
89 |
}
|
90 |
|
91 |
static function get_defaults() {
|
@@ -94,52 +111,68 @@ class WP_Embed_FB_Plugin {
|
|
94 |
if ( strpos( $locale, 'es_' ) !== false ) {
|
95 |
$locale = 'es_LA';
|
96 |
}
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
self::$defaults = array(
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
144 |
|
145 |
return apply_filters( 'wpemfb_defaults', self::$defaults );
|
@@ -170,15 +203,6 @@ class WP_Embed_FB_Plugin {
|
|
170 |
return self::$lb_defaults;
|
171 |
}
|
172 |
|
173 |
-
//("uninstalled","deactivated","activated","reactivated")
|
174 |
-
protected static function whois( $install ) {
|
175 |
-
$home = home_url();
|
176 |
-
$home = esc_url( $home );
|
177 |
-
@file_get_contents( "http://www.wpembedfb.com/api/?whois=$install&site_url=$home" );
|
178 |
-
|
179 |
-
return true;
|
180 |
-
}
|
181 |
-
|
182 |
/**
|
183 |
* session start if necessary
|
184 |
*/
|
@@ -198,7 +222,9 @@ class WP_Embed_FB_Plugin {
|
|
198 |
* Load translation file
|
199 |
*/
|
200 |
static function plugins_loaded() {
|
|
|
201 |
load_plugin_textdomain( 'wp-embed-facebook', false, 'wp-embed-facebook/lang' );
|
|
|
202 |
}
|
203 |
|
204 |
/**
|
@@ -208,10 +234,7 @@ class WP_Embed_FB_Plugin {
|
|
208 |
wp_register_style( 'wpemfb-default', self::get_url() . 'templates/default/default.css', array(), false );
|
209 |
wp_register_style( 'wpemfb-classic', self::get_url() . 'templates/classic/classic.css', array(), false );
|
210 |
wp_register_style( 'wpemfb-lightbox', self::get_url() . 'lib/lightbox2/css/lightbox.css', array(), false );
|
211 |
-
wp_register_script(
|
212 |
-
'wpemfb-lightbox',
|
213 |
-
self::get_url() . 'lib/lightbox2/js/lightbox.min.js',
|
214 |
-
array( 'jquery' )
|
215 |
);
|
216 |
$lb_defaults = self::get_lb_defaults();
|
217 |
$options = self::get_option();
|
@@ -222,6 +245,7 @@ class WP_Embed_FB_Plugin {
|
|
222 |
}
|
223 |
}
|
224 |
if ( ! empty( $translation_array ) ) {
|
|
|
225 |
wp_localize_script( 'wpemfb-lightbox', 'WEF_LB', $translation_array );
|
226 |
}
|
227 |
wp_register_script(
|
@@ -235,26 +259,40 @@ class WP_Embed_FB_Plugin {
|
|
235 |
array( 'jquery' )
|
236 |
);
|
237 |
$translation_array = array(
|
238 |
-
'local' =>
|
239 |
-
'version' =>
|
240 |
-
'fb_id' =>
|
241 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
wp_localize_script( 'wpemfb-fbjs', 'WEF', $translation_array );
|
243 |
-
if (
|
244 |
-
if (
|
245 |
wp_enqueue_script( 'wpemfb-lightbox' );
|
246 |
wp_enqueue_style( 'wpemfb-lightbox' );
|
247 |
}
|
248 |
-
if (
|
249 |
wp_enqueue_script( 'wpemfb' );
|
250 |
}
|
251 |
-
if (
|
252 |
wp_enqueue_script( 'wpemfb-fbjs' );
|
253 |
}
|
254 |
}
|
255 |
-
if (
|
256 |
wp_enqueue_script( 'wpemfb-fbjs' );
|
257 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
}
|
259 |
|
260 |
static function get_path() {
|
@@ -291,6 +329,14 @@ class WP_Embed_FB_Plugin {
|
|
291 |
$compare[ $default_key ] = isset( $options[ $default_key ] ) ? $options[ $default_key ] : $default_value;
|
292 |
}
|
293 |
if ( $compare !== $options ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
self::set_options( $compare );
|
295 |
} else {
|
296 |
//set cache value
|
@@ -309,7 +355,7 @@ class WP_Embed_FB_Plugin {
|
|
309 |
self::set_options( $defaults );
|
310 |
} else {
|
311 |
//new instalation
|
312 |
-
//TODO get app id and secret from other plugins Jetpack
|
313 |
self::set_options( $defaults );
|
314 |
}
|
315 |
}
|
@@ -326,53 +372,6 @@ class WP_Embed_FB_Plugin {
|
|
326 |
self::$options = $options;
|
327 |
}
|
328 |
|
329 |
-
static function admin_notices() {
|
330 |
-
if ( ( WP_Embed_FB_Plugin::get_option( 'close_warning2' ) == 'false' ) ) :
|
331 |
-
?>
|
332 |
-
<div class="notice wpemfb_warning is-dismissible">
|
333 |
-
<h2>WP Embed Facebook</h2>
|
334 |
-
|
335 |
-
<p>Hey! The last step.</p>
|
336 |
-
|
337 |
-
<p><img style="position:relative; top: 5px;" height="20px" width="auto"
|
338 |
-
src="<?php echo WP_Embed_FB_Plugin::get_url() . 'lib/admin/ic_setting.png' ?>"> Turn on <a
|
339 |
-
id="wef-video-down" href="<?php echo admin_url( "options-general.php?page=embedfacebook" ) ?>">Video
|
340 |
-
Download Option</a> in settings.</p>
|
341 |
-
<small>
|
342 |
-
<?php
|
343 |
-
printf( __( 'To embed albums, events, profiles and video as HTML5 you will need a <a target="_blank" href="%s">Facebook App</a>', 'wp-embed-facebook' ), 'https://developers.facebook.com/apps' )
|
344 |
-
?>
|
345 |
-
</small>
|
346 |
-
<p>
|
347 |
-
<?php
|
348 |
-
printf( __( 'This free plugin has taken <strong>thousands of hours</strong> to develop and maintain consider making a <a target="_blank" href="%s">donation</a> or leaving a <a target="_blank" href="%s">review</a> <strong>do not let us loose faith</strong> in humanity.', 'wp-embed-facebook' ), 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R8Q85GT3Q8Q26', 'https://wordpress.org/support/view/plugin-reviews/wp-embed-facebook' )
|
349 |
-
?>
|
350 |
-
</p>
|
351 |
-
|
352 |
-
</div>
|
353 |
-
<?php
|
354 |
-
endif;
|
355 |
-
}
|
356 |
-
|
357 |
-
static function wpemfb_close_warning() {
|
358 |
-
if ( current_user_can( 'manage_options' ) ) {
|
359 |
-
$options = self::get_option();
|
360 |
-
$options['close_warning2'] = 'true';
|
361 |
-
self::set_options( $options );
|
362 |
-
}
|
363 |
-
die;
|
364 |
-
}
|
365 |
-
|
366 |
-
static function wpemfb_video_down() {
|
367 |
-
if ( current_user_can( 'manage_options' ) ) {
|
368 |
-
$options = self::get_option();
|
369 |
-
$options['close_warning2'] = 'true';
|
370 |
-
$options['video_download'] = 'true';
|
371 |
-
self::set_options( $options );
|
372 |
-
}
|
373 |
-
die;
|
374 |
-
}
|
375 |
-
|
376 |
static function has_fb_app() {
|
377 |
$app_id = WP_Embed_FB_Plugin::get_option( 'app_id' );
|
378 |
$app_secret = WP_Embed_FB_Plugin::get_option( 'app_secret' );
|
@@ -541,7 +540,7 @@ class WP_Embed_FB_Plugin {
|
|
541 |
static function get_timezone() {
|
542 |
if ( self::$wp_timezone === null ) {
|
543 |
$tzstring = get_option( 'timezone_string', '' );
|
544 |
-
if ( empty($tzstring) ) {
|
545 |
$current_offset = get_option( 'gmt_offset', 0 );
|
546 |
if ( 0 == $current_offset ) {
|
547 |
$tzstring = 'Etc/GMT';
|
@@ -554,4 +553,20 @@ class WP_Embed_FB_Plugin {
|
|
554 |
|
555 |
return self::$wp_timezone;
|
556 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
557 |
}
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* Main plugin file, stores defauls and utilities used along all the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
class WP_Embed_FB_Plugin {
|
8 |
+
const option_name = 'wpemfb_options';
|
|
|
|
|
9 |
private static $path = null;
|
|
|
|
|
|
|
10 |
private static $url = null;
|
11 |
private static $options = null;
|
12 |
private static $defaults = null;
|
|
|
13 |
private static $lb_defaults = null;
|
14 |
private static $has_photon = null;
|
15 |
private static $wp_timezone = null;
|
16 |
|
17 |
+
/**
|
18 |
+
* @var array $link_types Link fields needed for rendering a social plugin
|
19 |
+
*/
|
20 |
+
static $link_types = array( 'href', 'uri' );
|
21 |
+
|
22 |
+
static function hooks() {
|
23 |
+
//Session start when there is a facebook app
|
24 |
+
add_action( 'init', __CLASS__ . '::init', 999 );
|
25 |
+
|
26 |
+
//Translation string
|
27 |
+
add_action( 'plugins_loaded', __CLASS__ . '::plugins_loaded' );
|
28 |
+
|
29 |
+
//register all scripts and styles
|
30 |
+
add_action( 'wp_enqueue_scripts', __CLASS__ . '::wp_enqueue_scripts' );
|
31 |
+
}
|
32 |
+
|
33 |
static function install() {
|
34 |
$type = ( get_option( 'wpemfb_theme' ) || get_option( self::option_name ) ) ? 'reactivated' : 'activated';
|
35 |
self::get_option();
|
42 |
*/
|
43 |
static function uninstall() {
|
44 |
if ( is_multisite() ) {
|
45 |
+
//TODO deprecated for get_sites in WP v4.6
|
46 |
$sites = wp_get_sites();
|
47 |
foreach ( $sites as $site ) {
|
48 |
switch_to_blog( $site['blog_id'] );
|
49 |
delete_option( self::option_name );
|
50 |
+
delete_post_meta_by_key( '_wef_comment_count' );
|
51 |
}
|
52 |
restore_current_blog();
|
53 |
} else {
|
54 |
delete_option( self::option_name );
|
55 |
+
delete_post_meta_by_key( '_wef_comment_count' );
|
56 |
}
|
57 |
|
58 |
return self::whois( 'uninstalled' );
|
66 |
* @return array old options to be deleated since 2.1
|
67 |
*/
|
68 |
static function old_options() {
|
69 |
+
return array(
|
70 |
'show_posts',
|
71 |
'close_warning',
|
72 |
'height',
|
102 |
'force_app_token',
|
103 |
'video_download',
|
104 |
'sdk_version'
|
105 |
+
);
|
106 |
}
|
107 |
|
108 |
static function get_defaults() {
|
111 |
if ( strpos( $locale, 'es_' ) !== false ) {
|
112 |
$locale = 'es_LA';
|
113 |
}
|
114 |
+
$vars = WEF_Social_Plugins::get_defaults();
|
115 |
+
$social_options = array();
|
116 |
+
foreach ( $vars as $key => $value ) {
|
117 |
+
foreach ( $value as $d_key => $d_value ) {
|
118 |
+
if ( ! in_array( $d_key, self::$link_types ) ) {
|
119 |
+
$social_options["{$key}_$d_key"] = $d_value;
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
123 |
self::$defaults = array(
|
124 |
+
'sdk_lang' => array_key_exists( $locale, self::get_fb_locales() ) ? $locale : 'en_US',
|
125 |
+
'max_width' => '450',
|
126 |
+
'max_photos' => '24',
|
127 |
+
'max_posts' => '0',
|
128 |
+
'app_id' => '',
|
129 |
+
'app_secret' => '',
|
130 |
+
'theme' => 'default',
|
131 |
+
'sdk_version' => 'v2.6',
|
132 |
+
'show_like' => 'true',
|
133 |
+
'fb_root' => 'true',
|
134 |
+
'show_follow' => 'true',
|
135 |
+
'video_ratio' => 'false',
|
136 |
+
'video_as_post' => 'false',
|
137 |
+
'raw_video' => 'false',
|
138 |
+
'raw_photo' => 'false',
|
139 |
+
'raw_post' => 'false',
|
140 |
+
'raw_page' => 'false',
|
141 |
+
'enqueue_style' => 'true',
|
142 |
+
'enq_lightbox' => 'true',
|
143 |
+
'enq_wpemfb' => 'true',
|
144 |
+
'enq_fbjs' => 'true',
|
145 |
+
'ev_local_tz' => 'false',
|
146 |
+
'close_warning2' => 'false',
|
147 |
+
'force_app_token' => 'true',
|
148 |
+
'video_download' => 'false',
|
149 |
+
'enq_fbjs_global' => 'false',
|
150 |
+
'enq_when_needed' => 'false',
|
151 |
+
//Lightbox options
|
152 |
+
'LB_albumLabel' => 'Image %1 of %2',
|
153 |
+
'LB_alwaysShowNavOnTouchDevices' => 'false',
|
154 |
+
'LB_showImageNumberLabel' => 'true',
|
155 |
+
'LB_wrapAround' => 'false',
|
156 |
+
'LB_disableScrolling' => 'false',
|
157 |
+
'LB_fitImagesInViewport' => 'true',
|
158 |
+
'LB_maxWidth' => '0',
|
159 |
+
'LB_maxHeight' => '0',
|
160 |
+
'LB_positionFromTop' => '50',
|
161 |
+
'LB_resizeDuration' => '700',
|
162 |
+
'LB_fadeDuration' => '500',
|
163 |
+
'FB_plugins_as_iframe' => 'false',
|
164 |
+
'adaptive_fb_plugin' => 'false',
|
165 |
+
'quote_plugin_active' => 'false',
|
166 |
+
'quote_post_types' => 'post,page',
|
167 |
+
'auto_embed_active' => 'true',//
|
168 |
+
// 'auto_embed_post_types' => '',//TODO filter embed register handler per post_type
|
169 |
+
'auto_comments_active' => 'false',
|
170 |
+
'auto_comments_post_types' => 'post',
|
171 |
+
'comments_count_active' => 'true',
|
172 |
+
'comments_open_graph' => 'true',
|
173 |
+
// 'scrape_open_graph' => 'true',
|
174 |
+
'lightbox_att' => 'data-lightbox="roadtrip"',
|
175 |
+
) + $social_options;
|
176 |
}
|
177 |
|
178 |
return apply_filters( 'wpemfb_defaults', self::$defaults );
|
203 |
return self::$lb_defaults;
|
204 |
}
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
/**
|
207 |
* session start if necessary
|
208 |
*/
|
222 |
* Load translation file
|
223 |
*/
|
224 |
static function plugins_loaded() {
|
225 |
+
|
226 |
load_plugin_textdomain( 'wp-embed-facebook', false, 'wp-embed-facebook/lang' );
|
227 |
+
|
228 |
}
|
229 |
|
230 |
/**
|
234 |
wp_register_style( 'wpemfb-default', self::get_url() . 'templates/default/default.css', array(), false );
|
235 |
wp_register_style( 'wpemfb-classic', self::get_url() . 'templates/classic/classic.css', array(), false );
|
236 |
wp_register_style( 'wpemfb-lightbox', self::get_url() . 'lib/lightbox2/css/lightbox.css', array(), false );
|
237 |
+
wp_register_script( 'wpemfb-lightbox', self::get_url() . 'lib/lightbox2/js/lightbox.min.js', array( 'jquery' )
|
|
|
|
|
|
|
238 |
);
|
239 |
$lb_defaults = self::get_lb_defaults();
|
240 |
$options = self::get_option();
|
245 |
}
|
246 |
}
|
247 |
if ( ! empty( $translation_array ) ) {
|
248 |
+
//TODO use something like wp_add_inline_script('wpemfb-lightbox','new Lightbox(WEF_LB)') for LightBox options
|
249 |
wp_localize_script( 'wpemfb-lightbox', 'WEF_LB', $translation_array );
|
250 |
}
|
251 |
wp_register_script(
|
259 |
array( 'jquery' )
|
260 |
);
|
261 |
$translation_array = array(
|
262 |
+
'local' => $options['sdk_lang'],
|
263 |
+
'version' => $options['sdk_version'],
|
264 |
+
'fb_id' => $options['app_id'] == '0' ? '' : $options['app_id']
|
265 |
);
|
266 |
+
if ( $options['auto_comments_active'] == 'true' && $options['comments_count_active'] == 'true' ) {
|
267 |
+
$translation_array = $translation_array + array(
|
268 |
+
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
269 |
+
);
|
270 |
+
}
|
271 |
+
//TODO use something like wp_add_inline_script('wpemfb-fbjs','new Wpemfb(WEF)') for LightBox options
|
272 |
wp_localize_script( 'wpemfb-fbjs', 'WEF', $translation_array );
|
273 |
+
if ( $options['enq_when_needed'] == 'false' ) {
|
274 |
+
if ( $options['enq_lightbox'] == 'true' ) {
|
275 |
wp_enqueue_script( 'wpemfb-lightbox' );
|
276 |
wp_enqueue_style( 'wpemfb-lightbox' );
|
277 |
}
|
278 |
+
if ( $options['enq_wpemfb'] == 'true' ) {
|
279 |
wp_enqueue_script( 'wpemfb' );
|
280 |
}
|
281 |
+
if ( $options['enq_fbjs'] == 'true' ) {
|
282 |
wp_enqueue_script( 'wpemfb-fbjs' );
|
283 |
}
|
284 |
}
|
285 |
+
if ( $options['enq_fbjs_global'] == 'true' ) {
|
286 |
wp_enqueue_script( 'wpemfb-fbjs' );
|
287 |
}
|
288 |
+
|
289 |
+
if ( ( $options['auto_comments_active'] == 'true' ) && is_single() ) {
|
290 |
+
$array = WP_Embed_FB_Plugin::string_to_array( $options['auto_comments_post_types'] );
|
291 |
+
$queried_object = get_queried_object();
|
292 |
+
if ( in_array( $queried_object->post_type, $array ) ) {
|
293 |
+
wp_enqueue_script( 'wpemfb-fbjs' );
|
294 |
+
}
|
295 |
+
}
|
296 |
}
|
297 |
|
298 |
static function get_path() {
|
329 |
$compare[ $default_key ] = isset( $options[ $default_key ] ) ? $options[ $default_key ] : $default_value;
|
330 |
}
|
331 |
if ( $compare !== $options ) {
|
332 |
+
if ( isset( $option['page_show_faces'] ) ) {
|
333 |
+
$compare['page_show-facepile'] = $option['page_show_faces'];
|
334 |
+
$compare['page_small-header'] = $option['page_small_header'];
|
335 |
+
$compare['page_hide-cover'] = $option['page_hide_cover'];
|
336 |
+
if ( $option['page_show_posts'] == 'true' ) {
|
337 |
+
$compare['page_tabs'] = 'timeline';
|
338 |
+
}
|
339 |
+
}
|
340 |
self::set_options( $compare );
|
341 |
} else {
|
342 |
//set cache value
|
355 |
self::set_options( $defaults );
|
356 |
} else {
|
357 |
//new instalation
|
358 |
+
//TODO get app id and secret from other plugins Jetpack or WP Social Login or... one day...
|
359 |
self::set_options( $defaults );
|
360 |
}
|
361 |
}
|
372 |
self::$options = $options;
|
373 |
}
|
374 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
static function has_fb_app() {
|
376 |
$app_id = WP_Embed_FB_Plugin::get_option( 'app_id' );
|
377 |
$app_secret = WP_Embed_FB_Plugin::get_option( 'app_secret' );
|
540 |
static function get_timezone() {
|
541 |
if ( self::$wp_timezone === null ) {
|
542 |
$tzstring = get_option( 'timezone_string', '' );
|
543 |
+
if ( empty( $tzstring ) ) {
|
544 |
$current_offset = get_option( 'gmt_offset', 0 );
|
545 |
if ( 0 == $current_offset ) {
|
546 |
$tzstring = 'Etc/GMT';
|
553 |
|
554 |
return self::$wp_timezone;
|
555 |
}
|
556 |
+
|
557 |
+
static function string_to_array( $string ) {
|
558 |
+
$array = explode( ',', $string );
|
559 |
+
|
560 |
+
return array_map( 'trim', $array );
|
561 |
+
}
|
562 |
+
|
563 |
+
//("uninstalled","deactivated","activated","reactivated")
|
564 |
+
protected static function whois( $install ) {
|
565 |
+
$home = home_url();
|
566 |
+
$home = esc_url( $home );
|
567 |
+
@file_get_contents( "http://www.wpembedfb.com/api/?whois=$install&site_url=$home" );
|
568 |
+
|
569 |
+
return true;
|
570 |
+
}
|
571 |
+
|
572 |
}
|
lib/class-wp-embed-fb.php
CHANGED
@@ -26,67 +26,55 @@ class WP_Embed_FB {
|
|
26 |
*/
|
27 |
private static $fbsdk = null;
|
28 |
|
29 |
-
|
30 |
-
if ( self::$theme ) {
|
31 |
-
return self::$theme;
|
32 |
-
} else {
|
33 |
-
self::$theme = WP_Embed_FB_Plugin::get_option( 'theme' );
|
34 |
-
|
35 |
-
return self::$theme;
|
36 |
-
}
|
37 |
-
}
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
}
|
|
|
54 |
|
55 |
-
return
|
56 |
}
|
57 |
-
}
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
if ( WP_Embed_FB_Plugin::get_option( 'force_app_token' ) == 'true' ) {
|
62 |
-
self::$fbsdk->setAccessToken( WP_Embed_FB_Plugin::get_option( 'app_id' ) . '|' . WP_Embed_FB_Plugin::get_option( 'app_secret' ) );
|
63 |
-
}
|
64 |
-
|
65 |
-
return self::$fbsdk;
|
66 |
-
} else {
|
67 |
-
if ( ! class_exists( 'FacebookApiException' ) ) {
|
68 |
-
require_once "base_facebook.php";
|
69 |
-
}
|
70 |
-
require_once "class-sigami-facebook.php";
|
71 |
-
$config = array();
|
72 |
-
$config['appId'] = WP_Embed_FB_Plugin::get_option( 'app_id' );
|
73 |
-
$config['secret'] = WP_Embed_FB_Plugin::get_option( 'app_secret' );
|
74 |
-
//$config['fileUpload'] = false; // optional
|
75 |
-
self::$fbsdk = new Sigami_Facebook( $config );
|
76 |
-
if ( WP_Embed_FB_Plugin::get_option( 'force_app_token' ) == 'true' ) {
|
77 |
-
self::$fbsdk->setAccessToken( WP_Embed_FB_Plugin::get_option( 'app_id' ) . '|' . WP_Embed_FB_Plugin::get_option( 'app_secret' ) );
|
78 |
-
}
|
79 |
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
82 |
}
|
83 |
|
84 |
/**
|
85 |
-
* Run
|
86 |
*
|
87 |
-
* @param array
|
88 |
-
* @param string $url
|
89 |
-
* @param array
|
90 |
*
|
91 |
* @return string Embedded content
|
92 |
*
|
@@ -99,10 +87,10 @@ class WP_Embed_FB {
|
|
99 |
return $type_and_id;
|
100 |
}
|
101 |
if ( WP_Embed_FB_Plugin::get_option( 'enq_when_needed' ) == 'true' ) {
|
102 |
-
if($type_and_id['type'] == 'album'){
|
103 |
if ( WP_Embed_FB_Plugin::get_option( 'enq_lightbox' ) == 'true' ) {
|
104 |
-
wp_enqueue_script('wpemfb-lightbox');
|
105 |
-
wp_enqueue_style('wpemfb-lightbox');
|
106 |
}
|
107 |
}
|
108 |
if ( WP_Embed_FB_Plugin::get_option( 'enq_wpemfb' ) == 'true' ) {
|
@@ -112,16 +100,17 @@ class WP_Embed_FB {
|
|
112 |
wp_enqueue_script( 'wpemfb-fbjs' );
|
113 |
}
|
114 |
}
|
115 |
-
if(self::is_raw($type_and_id['type'])){
|
116 |
wp_enqueue_style( 'wpemfb-' . self::get_theme() );
|
117 |
}
|
118 |
$return = self::print_embed( $type_and_id['fb_id'], $type_and_id['type'], $juice );
|
119 |
self::clear_atts();
|
|
|
120 |
return $return;
|
121 |
}
|
122 |
|
123 |
/**
|
124 |
-
* @param string $juice
|
125 |
* @param string $original Original url to return.
|
126 |
*
|
127 |
* @return array|string
|
@@ -151,51 +140,65 @@ class WP_Embed_FB {
|
|
151 |
$fb_id = $setArray[1];
|
152 |
$type = 'album';
|
153 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
$juice = substr( $juice, 0, $pos );
|
155 |
}
|
156 |
$juiceArray = explode( '/', trim( $juice, '/' ) );
|
157 |
if ( ! $fb_id ) {
|
158 |
$fb_id = end( $juiceArray );
|
159 |
}
|
160 |
-
if (
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
|
|
|
|
|
|
176 |
}
|
177 |
-
$res .= '<br><span style="color: #4a0e13">' . __( 'Error' ) . ': ' . $error['error']['message'] . ' (only visible to admins)</span>';
|
178 |
}
|
179 |
-
|
180 |
-
$res .= '</p>';
|
181 |
|
182 |
-
|
|
|
183 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
}
|
185 |
-
} elseif ( in_array( 'photos', $juiceArray ) || in_array( 'photo.php', $juiceArray ) ) {
|
186 |
-
$type = 'photo';
|
187 |
-
} elseif ( in_array( 'events', $juiceArray ) ) {
|
188 |
-
$type = 'event';
|
189 |
-
} elseif ( in_array( 'videos', $juiceArray ) ) {
|
190 |
-
$type = 'video';
|
191 |
}
|
|
|
192 |
/**
|
193 |
* Filter the embed type.
|
194 |
*
|
195 |
* @since 1.8
|
196 |
*
|
197 |
-
* @param string $type
|
198 |
-
* @param array
|
199 |
*/
|
200 |
$type = apply_filters( 'wpemfb_embed_type', $type, $juiceArray );
|
201 |
if ( ! $type ) {
|
@@ -264,10 +267,10 @@ class WP_Embed_FB {
|
|
264 |
* }
|
265 |
*
|
266 |
* @updated 2.0
|
267 |
-
* @since
|
268 |
*
|
269 |
* @param string $default file full path
|
270 |
-
* @param array
|
271 |
*/
|
272 |
$template_name = apply_filters( 'wpemfb_category_template', $default, $fb_data['category'] );
|
273 |
}
|
@@ -301,7 +304,7 @@ class WP_Embed_FB {
|
|
301 |
/** @noinspection PhpUnusedLocalVariableInspection */
|
302 |
ob_start();
|
303 |
//show embed post on admin
|
304 |
-
if ( is_admin() || (isset($_GET['action']) && $_GET['action'] = 'cs_render_element')
|
305 |
<script>(function (d, s, id) {
|
306 |
var js, fjs = d.getElementsByTagName(s)[0];
|
307 |
if (d.getElementById(id)) return;
|
@@ -309,7 +312,8 @@ class WP_Embed_FB {
|
|
309 |
js.id = id;
|
310 |
js.src = "//connect.facebook.net/<?php echo WP_Embed_FB_Plugin::get_option('sdk_lang'); ?>/sdk.js#xfbml=1&version=<?php echo WP_Embed_FB_Plugin::get_option('sdk_version') ?>";
|
311 |
fjs.parentNode.insertBefore(js, fjs);
|
312 |
-
}(document, 'script', 'facebook-jssdk'));
|
|
|
313 |
<?php endif;
|
314 |
/**
|
315 |
* Change the file to include on a certain embed.
|
@@ -317,7 +321,7 @@ class WP_Embed_FB {
|
|
317 |
* @since 1.8
|
318 |
*
|
319 |
* @param string $template file full path
|
320 |
-
* @param array
|
321 |
*/
|
322 |
$template = apply_filters( 'wpemfb_template', $template, $fb_data, $type );
|
323 |
/** @noinspection PhpIncludeInspection */
|
@@ -326,19 +330,11 @@ class WP_Embed_FB {
|
|
326 |
return preg_replace( '/^\s+|\n|\r|\s+$/m', '', ob_get_clean() );
|
327 |
}
|
328 |
|
329 |
-
static function valid_fb_data( $fb_data ) {
|
330 |
-
if ( is_array( $fb_data ) && ( isset( $fb_data['id'] ) || isset( $fb_data['social_plugin'] ) ) ) {
|
331 |
-
return true;
|
332 |
-
}
|
333 |
-
|
334 |
-
return false;
|
335 |
-
}
|
336 |
-
|
337 |
/**
|
338 |
* get data from fb using WP_Embed_FB::$fbsdk->api('/'.$fb_id) :)
|
339 |
*
|
340 |
-
* @param int
|
341 |
-
* @param string $url
|
342 |
*
|
343 |
* @type string type of embed
|
344 |
* @return array|string
|
@@ -349,11 +345,11 @@ class WP_Embed_FB {
|
|
349 |
try {
|
350 |
switch ( $type ) {
|
351 |
case 'album' :
|
352 |
-
self::$num_photos =
|
353 |
$api_string = $fb_id . '?fields=name,id,from,description,count,photos.fields(name,picture,source,id).limit(' . self::$num_photos . ')';
|
354 |
break;
|
355 |
case 'page' :
|
356 |
-
$num_posts =
|
357 |
$api_string = $fb_id . '?fields=name,picture,is_community_page,link,id,cover,category,website,likes,genre';
|
358 |
if ( intval( $num_posts ) > 0 ) {
|
359 |
$api_string .= ',posts.limit(' . $num_posts . '){id,full_picture,type,via,source,parent_id,call_to_action,story,place,child_attachments,icon,created_time,message,description,caption,name,shares,link,picture,object_id,likes.limit(1).summary(true),comments.limit(1).summary(true)}';
|
@@ -382,8 +378,8 @@ class WP_Embed_FB {
|
|
382 |
* @since 1.9
|
383 |
*
|
384 |
* @param string $api_string The fb api request string according to type
|
385 |
-
* @param string $fb_id
|
386 |
-
* @param string $type
|
387 |
*
|
388 |
*/
|
389 |
$fb_data = $fbsdk->api( WP_Embed_FB_Plugin::get_option( 'sdk_version' ) . '/' . apply_filters( 'wpemfb_api_string', $api_string, $fb_id, $type ) );
|
@@ -395,8 +391,8 @@ class WP_Embed_FB {
|
|
395 |
* @since 1.9
|
396 |
*
|
397 |
* @param string $api_string2 The second request string empty if not necessary
|
398 |
-
* @param array
|
399 |
-
* @param string $type
|
400 |
*
|
401 |
*/
|
402 |
$api_string2 = apply_filters( 'wpemfb_2nd_api_string', $api_string2, $fb_data, $type );
|
@@ -410,8 +406,8 @@ class WP_Embed_FB {
|
|
410 |
*
|
411 |
* @since 1.9
|
412 |
*
|
413 |
-
* @param array
|
414 |
-
* @param string $type
|
415 |
*/
|
416 |
$fb_data = apply_filters( 'wpemfb_fb_data', $fb_data, $type );
|
417 |
|
@@ -434,6 +430,102 @@ class WP_Embed_FB {
|
|
434 |
return $fb_data;
|
435 |
}
|
436 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
/**
|
438 |
* Locate the template inside plugin or theme
|
439 |
*
|
@@ -452,59 +544,15 @@ class WP_Embed_FB {
|
|
452 |
return $located;
|
453 |
}
|
454 |
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
* @param string $urls separated by spaces
|
459 |
-
*
|
460 |
-
* @return string first url
|
461 |
-
*/
|
462 |
-
static function getwebsite( $urls ) {
|
463 |
-
$url = explode( ' ', trim( $urls ) );
|
464 |
-
|
465 |
-
return strpos( 'http://', $url[0] ) == false ? 'http://' . $url[0] : $url[0];
|
466 |
-
}
|
467 |
-
|
468 |
-
/**
|
469 |
-
* Shortcode function
|
470 |
-
* [facebook='url' width='600' raw='true' social_plugin='true' posts='2' ] width is optional
|
471 |
-
*
|
472 |
-
* @param array $atts [0]=>url ['width']=>embed width ['raw']=>for videos and photos
|
473 |
-
*
|
474 |
-
* @return string
|
475 |
-
*/
|
476 |
-
static function shortcode( $atts ) {
|
477 |
-
if ( ! empty( $atts ) && isset( $atts[0] ) ) {
|
478 |
-
$clean = trim( $atts[0], '=' );
|
479 |
-
if ( is_numeric( $clean ) ) {
|
480 |
-
$juice = $clean;
|
481 |
-
$clean = "https://www.facebook.com/$juice";
|
482 |
-
} else {
|
483 |
-
if ( strpos( $clean, 'facebook.com' ) === false ) {
|
484 |
-
return "<p>" . __( "This is not a valid facebook url", "wp-embed-facebook" ) . " $clean </p>";
|
485 |
-
}
|
486 |
-
$juice = str_replace( array(
|
487 |
-
'https:',
|
488 |
-
'http:',
|
489 |
-
'//facebook.com/',
|
490 |
-
'//m.facebook.com/',
|
491 |
-
'//www.facebook.com/'
|
492 |
-
), '', $clean );
|
493 |
-
}
|
494 |
-
$embed = self::fb_embed( array( 'https', '://www.facebook.com/', $juice ), $clean, $atts );
|
495 |
-
|
496 |
-
return $embed;
|
497 |
}
|
498 |
|
499 |
-
return
|
500 |
}
|
501 |
|
502 |
-
|
503 |
-
$match, /** @noinspection PhpUnusedParameterInspection */
|
504 |
-
$attr = null, $url = null, $atts = null
|
505 |
-
) {
|
506 |
-
return self::fb_embed( $match, $url, $atts );
|
507 |
-
}
|
508 |
|
509 |
static function make_clickable( $text ) {
|
510 |
return wpautop( self::rel_nofollow( make_clickable( $text ) ) );
|
@@ -523,44 +571,17 @@ class WP_Embed_FB {
|
|
523 |
return "<a $text rel=\"nofollow\">";
|
524 |
}
|
525 |
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
} else {
|
536 |
-
self::$raw = false;
|
537 |
-
}
|
538 |
-
}
|
539 |
-
if ( isset( $atts['social_plugin'] ) ) {
|
540 |
-
if ( $atts['social_plugin'] == 'true' ) {
|
541 |
-
self::$raw = false;
|
542 |
-
} else {
|
543 |
-
self::$raw = true;
|
544 |
-
}
|
545 |
-
}
|
546 |
-
if ( isset( $atts['theme'] ) ) {
|
547 |
-
self::$theme = $atts['theme'];
|
548 |
-
}
|
549 |
-
if ( isset( $atts['posts'] ) ) {
|
550 |
-
self::$num_posts = intval( $atts['posts'] );
|
551 |
-
}
|
552 |
-
if ( isset( $atts['photos'] ) ) {
|
553 |
-
self::$num_photos = intval( $atts['photos'] );
|
554 |
-
}
|
555 |
-
}
|
556 |
|
557 |
-
|
558 |
-
self::$width = self::$raw = self::$num_posts = self::$theme = self::$num_photos = null;
|
559 |
-
if(WP_Embed_FB_Plugin::has_photon())
|
560 |
-
add_filter('jetpack_photon_skip_image','__return_true');
|
561 |
}
|
562 |
|
563 |
-
static function fb_root( $content ) {
|
564 |
-
return '<div id="fb-root"></div>' . PHP_EOL . $content;
|
565 |
-
}
|
566 |
}
|
26 |
*/
|
27 |
private static $fbsdk = null;
|
28 |
|
29 |
+
/* MAGIC HERE */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
+
/**
|
32 |
+
* Shortcode function
|
33 |
+
* [facebook='url' width='600' raw='true' social_plugin='true' posts='2' ] width is optional
|
34 |
+
*
|
35 |
+
* @param array $atts [0]=>url ['width']=>embed width ['raw']=>for videos and photos
|
36 |
+
*
|
37 |
+
* @return string
|
38 |
+
*/
|
39 |
+
static function shortcode( $atts ) {
|
40 |
+
if ( ! empty( $atts ) && isset( $atts[0] ) ) {
|
41 |
+
$clean = trim( $atts[0], array( '=', 'href=', 'uri=', 'url=', 'src=', 'link=' ) );
|
42 |
+
if ( is_numeric( $clean ) ) {
|
43 |
+
$juice = $clean;
|
44 |
+
$clean = "https://www.facebook.com/$juice";
|
45 |
+
} else {
|
46 |
+
if ( strpos( $clean, 'facebook.com' ) === false ) {
|
47 |
+
return "<p>" . __( "This is not a valid facebook url", "wp-embed-facebook" ) . " $clean </p>";
|
48 |
+
}
|
49 |
+
$juice = str_replace( array(
|
50 |
+
'https:',
|
51 |
+
'http:',
|
52 |
+
'//facebook.com/',
|
53 |
+
'//m.facebook.com/',
|
54 |
+
'//www.facebook.com/'
|
55 |
+
), '', $clean );
|
56 |
}
|
57 |
+
$embed = self::fb_embed( array( 'https', '://www.facebook.com/', $juice ), $clean, $atts );
|
58 |
|
59 |
+
return $embed;
|
60 |
}
|
|
|
61 |
|
62 |
+
return '';
|
63 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
+
static function embed_register_handler(
|
66 |
+
$match, /** @noinspection PhpUnusedParameterInspection */
|
67 |
+
$attr, $url = null, $atts = null
|
68 |
+
) {
|
69 |
+
return self::fb_embed( $match, $url, $atts );
|
70 |
}
|
71 |
|
72 |
/**
|
73 |
+
* Run rabbit
|
74 |
*
|
75 |
+
* @param array $match [2]=url without ' https://www.facebook.com/ '
|
76 |
+
* @param string $url Original url
|
77 |
+
* @param array $atts Attributes for the embed
|
78 |
*
|
79 |
* @return string Embedded content
|
80 |
*
|
87 |
return $type_and_id;
|
88 |
}
|
89 |
if ( WP_Embed_FB_Plugin::get_option( 'enq_when_needed' ) == 'true' ) {
|
90 |
+
if ( $type_and_id['type'] == 'album' ) {
|
91 |
if ( WP_Embed_FB_Plugin::get_option( 'enq_lightbox' ) == 'true' ) {
|
92 |
+
wp_enqueue_script( 'wpemfb-lightbox' );
|
93 |
+
wp_enqueue_style( 'wpemfb-lightbox' );
|
94 |
}
|
95 |
}
|
96 |
if ( WP_Embed_FB_Plugin::get_option( 'enq_wpemfb' ) == 'true' ) {
|
100 |
wp_enqueue_script( 'wpemfb-fbjs' );
|
101 |
}
|
102 |
}
|
103 |
+
if ( self::is_raw( $type_and_id['type'] ) ) {
|
104 |
wp_enqueue_style( 'wpemfb-' . self::get_theme() );
|
105 |
}
|
106 |
$return = self::print_embed( $type_and_id['fb_id'], $type_and_id['type'], $juice );
|
107 |
self::clear_atts();
|
108 |
+
|
109 |
return $return;
|
110 |
}
|
111 |
|
112 |
/**
|
113 |
+
* @param string $juice facebook url without https://www.facebook.com
|
114 |
* @param string $original Original url to return.
|
115 |
*
|
116 |
* @return array|string
|
140 |
$fb_id = $setArray[1];
|
141 |
$type = 'album';
|
142 |
}
|
143 |
+
|
144 |
+
if ( isset( $vars['album_id'] ) ) {
|
145 |
+
$fb_id = $vars['album_id'];
|
146 |
+
$type = 'album';
|
147 |
+
}
|
148 |
+
|
149 |
+
if ( isset( $vars['story_fbid'] ) ) {
|
150 |
+
$fb_id = $vars['story_fbid'];
|
151 |
+
$type = 'post';
|
152 |
+
}
|
153 |
+
|
154 |
$juice = substr( $juice, 0, $pos );
|
155 |
}
|
156 |
$juiceArray = explode( '/', trim( $juice, '/' ) );
|
157 |
if ( ! $fb_id ) {
|
158 |
$fb_id = end( $juiceArray );
|
159 |
}
|
160 |
+
if ( ! $type ) {
|
161 |
+
if ( in_array( 'posts', $juiceArray ) ) {
|
162 |
+
$type = 'post';
|
163 |
+
if ( $has_fb_app && ( self::is_raw( 'post' ) ) ) {
|
164 |
+
try {
|
165 |
+
/** @noinspection PhpUndefinedVariableInspection */
|
166 |
+
$data = $fbsdk->api( '/' . $juiceArray[0] . '?fields=id' );
|
167 |
+
$fb_id = $data['id'] . '_' . $fb_id;
|
168 |
+
} catch ( FacebookApiException $e ) {
|
169 |
+
$res = '<p><a href="' . $original . '" target="_blank" rel="nofollow">' . $original . '</a>';
|
170 |
+
if ( is_super_admin() ) {
|
171 |
+
$error = $e->getResult();
|
172 |
+
if ( isset( $error['error']['code'] ) && ( $error['error']['code'] == '803' ) ) {
|
173 |
+
$res .= '<br><span style="color: #4a0e13">' . __( 'Error: Try embedding this post as a social plugin (only visible to admins)', 'wp-embed-facebook' ) . '</span>';
|
174 |
+
} else {
|
175 |
+
if ( isset( $error['error']['code'] ) ) {
|
176 |
+
$res .= '<br><span style="color: #4a0e13">' . __( 'Code' ) . ': ' . $error['error']['code'] . ' in type</span>';
|
177 |
+
}
|
178 |
+
$res .= '<br><span style="color: #4a0e13">' . __( 'Error' ) . ': ' . $error['error']['message'] . ' (only visible to admins)</span>';
|
179 |
}
|
|
|
180 |
}
|
181 |
+
$res .= '</p>';
|
|
|
182 |
|
183 |
+
return $res;
|
184 |
+
}
|
185 |
}
|
186 |
+
} elseif ( in_array( 'photos', $juiceArray ) || in_array( 'photo.php', $juiceArray ) ) {
|
187 |
+
$type = 'photo';
|
188 |
+
} elseif ( in_array( 'events', $juiceArray ) ) {
|
189 |
+
$type = 'event';
|
190 |
+
} elseif ( in_array( 'videos', $juiceArray ) || in_array( 'video.php', $juiceArray ) ) {
|
191 |
+
$type = 'video';
|
192 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
}
|
194 |
+
|
195 |
/**
|
196 |
* Filter the embed type.
|
197 |
*
|
198 |
* @since 1.8
|
199 |
*
|
200 |
+
* @param string $type the embed type.
|
201 |
+
* @param array $clean url parts of the request.
|
202 |
*/
|
203 |
$type = apply_filters( 'wpemfb_embed_type', $type, $juiceArray );
|
204 |
if ( ! $type ) {
|
267 |
* }
|
268 |
*
|
269 |
* @updated 2.0
|
270 |
+
* @since 1.0
|
271 |
*
|
272 |
* @param string $default file full path
|
273 |
+
* @param array $fb_data ['category'] data from facebook
|
274 |
*/
|
275 |
$template_name = apply_filters( 'wpemfb_category_template', $default, $fb_data['category'] );
|
276 |
}
|
304 |
/** @noinspection PhpUnusedLocalVariableInspection */
|
305 |
ob_start();
|
306 |
//show embed post on admin
|
307 |
+
if ( is_admin() || ( isset( $_GET['action'] ) && $_GET['action'] = 'cs_render_element' ) ) : ?>
|
308 |
<script>(function (d, s, id) {
|
309 |
var js, fjs = d.getElementsByTagName(s)[0];
|
310 |
if (d.getElementById(id)) return;
|
312 |
js.id = id;
|
313 |
js.src = "//connect.facebook.net/<?php echo WP_Embed_FB_Plugin::get_option('sdk_lang'); ?>/sdk.js#xfbml=1&version=<?php echo WP_Embed_FB_Plugin::get_option('sdk_version') ?>";
|
314 |
fjs.parentNode.insertBefore(js, fjs);
|
315 |
+
}(document, 'script', 'facebook-jssdk'));
|
316 |
+
FB.XFBML.parse();</script>
|
317 |
<?php endif;
|
318 |
/**
|
319 |
* Change the file to include on a certain embed.
|
321 |
* @since 1.8
|
322 |
*
|
323 |
* @param string $template file full path
|
324 |
+
* @param array $fb_data data from facebook
|
325 |
*/
|
326 |
$template = apply_filters( 'wpemfb_template', $template, $fb_data, $type );
|
327 |
/** @noinspection PhpIncludeInspection */
|
330 |
return preg_replace( '/^\s+|\n|\r|\s+$/m', '', ob_get_clean() );
|
331 |
}
|
332 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
/**
|
334 |
* get data from fb using WP_Embed_FB::$fbsdk->api('/'.$fb_id) :)
|
335 |
*
|
336 |
+
* @param int $fb_id Facebook id
|
337 |
+
* @param string $url Facebook url
|
338 |
*
|
339 |
* @type string type of embed
|
340 |
* @return array|string
|
345 |
try {
|
346 |
switch ( $type ) {
|
347 |
case 'album' :
|
348 |
+
self::$num_photos = is_numeric( self::$num_photos ) ? self::$num_photos : WP_Embed_FB_Plugin::get_option( 'max_photos' );
|
349 |
$api_string = $fb_id . '?fields=name,id,from,description,count,photos.fields(name,picture,source,id).limit(' . self::$num_photos . ')';
|
350 |
break;
|
351 |
case 'page' :
|
352 |
+
$num_posts = is_numeric( self::$num_posts ) ? self::$num_posts : WP_Embed_FB_Plugin::get_option( 'max_posts' );
|
353 |
$api_string = $fb_id . '?fields=name,picture,is_community_page,link,id,cover,category,website,likes,genre';
|
354 |
if ( intval( $num_posts ) > 0 ) {
|
355 |
$api_string .= ',posts.limit(' . $num_posts . '){id,full_picture,type,via,source,parent_id,call_to_action,story,place,child_attachments,icon,created_time,message,description,caption,name,shares,link,picture,object_id,likes.limit(1).summary(true),comments.limit(1).summary(true)}';
|
378 |
* @since 1.9
|
379 |
*
|
380 |
* @param string $api_string The fb api request string according to type
|
381 |
+
* @param string $fb_id The id of the object being requested.
|
382 |
+
* @param string $type The detected type of embed
|
383 |
*
|
384 |
*/
|
385 |
$fb_data = $fbsdk->api( WP_Embed_FB_Plugin::get_option( 'sdk_version' ) . '/' . apply_filters( 'wpemfb_api_string', $api_string, $fb_id, $type ) );
|
391 |
* @since 1.9
|
392 |
*
|
393 |
* @param string $api_string2 The second request string empty if not necessary
|
394 |
+
* @param array $fb_data The result from the first query
|
395 |
+
* @param string $type The detected type of embed
|
396 |
*
|
397 |
*/
|
398 |
$api_string2 = apply_filters( 'wpemfb_2nd_api_string', $api_string2, $fb_data, $type );
|
406 |
*
|
407 |
* @since 1.9
|
408 |
*
|
409 |
+
* @param array $fb_data the final result
|
410 |
+
* @param string $type The detected type of embed
|
411 |
*/
|
412 |
$fb_data = apply_filters( 'wpemfb_fb_data', $fb_data, $type );
|
413 |
|
430 |
return $fb_data;
|
431 |
}
|
432 |
|
433 |
+
static function set_atts( $atts ) {
|
434 |
+
if ( WP_Embed_FB_Plugin::has_photon() ) {
|
435 |
+
add_filter( 'jetpack_photon_skip_image', '__return_false' );
|
436 |
+
}
|
437 |
+
if ( isset( $atts['width'] ) ) {
|
438 |
+
self::$width = $atts['width'];
|
439 |
+
}
|
440 |
+
if ( isset( $atts['raw'] ) ) {
|
441 |
+
if ( $atts['raw'] == 'true' ) {
|
442 |
+
self::$raw = true;
|
443 |
+
} else {
|
444 |
+
self::$raw = false;
|
445 |
+
}
|
446 |
+
}
|
447 |
+
if ( isset( $atts['social_plugin'] ) ) {
|
448 |
+
if ( $atts['social_plugin'] == 'true' ) {
|
449 |
+
self::$raw = false;
|
450 |
+
} else {
|
451 |
+
self::$raw = true;
|
452 |
+
}
|
453 |
+
}
|
454 |
+
if ( isset( $atts['theme'] ) ) {
|
455 |
+
self::$theme = $atts['theme'];
|
456 |
+
}
|
457 |
+
if ( isset( $atts['posts'] ) ) {
|
458 |
+
self::$num_posts = intval( $atts['posts'] );
|
459 |
+
}
|
460 |
+
if ( isset( $atts['photos'] ) ) {
|
461 |
+
self::$num_photos = intval( $atts['photos'] );
|
462 |
+
}
|
463 |
+
}
|
464 |
+
|
465 |
+
static function clear_atts() {
|
466 |
+
self::$width = self::$raw = self::$num_posts = self::$theme = self::$num_photos = null;
|
467 |
+
if ( WP_Embed_FB_Plugin::has_photon() ) {
|
468 |
+
add_filter( 'jetpack_photon_skip_image', '__return_true' );
|
469 |
+
}
|
470 |
+
}
|
471 |
+
|
472 |
+
/* UTILITIES */
|
473 |
+
|
474 |
+
static function get_theme() {
|
475 |
+
if ( self::$theme ) {
|
476 |
+
return self::$theme;
|
477 |
+
} else {
|
478 |
+
self::$theme = WP_Embed_FB_Plugin::get_option( 'theme' );
|
479 |
+
|
480 |
+
return self::$theme;
|
481 |
+
}
|
482 |
+
}
|
483 |
+
|
484 |
+
static function is_raw( $type ) {
|
485 |
+
if ( self::$raw !== null ) {
|
486 |
+
return self::$raw;
|
487 |
+
} else {
|
488 |
+
switch ( $type ) {
|
489 |
+
case 'page':
|
490 |
+
case 'photo':
|
491 |
+
case 'post':
|
492 |
+
case 'video':
|
493 |
+
self::$raw = ( WP_Embed_FB_Plugin::get_option( 'raw_' . $type ) == 'false' ) ? false : true;
|
494 |
+
break;
|
495 |
+
default:
|
496 |
+
self::$raw = true;
|
497 |
+
break;
|
498 |
+
}
|
499 |
+
|
500 |
+
return self::$raw;
|
501 |
+
}
|
502 |
+
}
|
503 |
+
|
504 |
+
static function get_fbsdk() {
|
505 |
+
if ( self::$fbsdk && self::$fbsdk instanceof Sigami_Facebook ) {
|
506 |
+
if ( WP_Embed_FB_Plugin::get_option( 'force_app_token' ) == 'true' ) {
|
507 |
+
self::$fbsdk->setAccessToken( WP_Embed_FB_Plugin::get_option( 'app_id' ) . '|' . WP_Embed_FB_Plugin::get_option( 'app_secret' ) );
|
508 |
+
}
|
509 |
+
|
510 |
+
return self::$fbsdk;
|
511 |
+
} else {
|
512 |
+
if ( ! class_exists( 'FacebookApiException' ) ) {
|
513 |
+
require_once __DIR__ . "/base_facebook.php";
|
514 |
+
}
|
515 |
+
require_once __DIR__ . "/class-sigami-facebook.php";
|
516 |
+
$config = array();
|
517 |
+
$config['appId'] = WP_Embed_FB_Plugin::get_option( 'app_id' );
|
518 |
+
$config['secret'] = WP_Embed_FB_Plugin::get_option( 'app_secret' );
|
519 |
+
//$config['fileUpload'] = false; // optional
|
520 |
+
self::$fbsdk = new Sigami_Facebook( $config );
|
521 |
+
if ( WP_Embed_FB_Plugin::get_option( 'force_app_token' ) == 'true' ) {
|
522 |
+
self::$fbsdk->setAccessToken( WP_Embed_FB_Plugin::get_option( 'app_id' ) . '|' . WP_Embed_FB_Plugin::get_option( 'app_secret' ) );
|
523 |
+
}
|
524 |
+
|
525 |
+
return self::$fbsdk;
|
526 |
+
}
|
527 |
+
}
|
528 |
+
|
529 |
/**
|
530 |
* Locate the template inside plugin or theme
|
531 |
*
|
544 |
return $located;
|
545 |
}
|
546 |
|
547 |
+
static function valid_fb_data( $fb_data ) {
|
548 |
+
if ( is_array( $fb_data ) && ( isset( $fb_data['id'] ) || isset( $fb_data['social_plugin'] ) ) ) {
|
549 |
+
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
550 |
}
|
551 |
|
552 |
+
return false;
|
553 |
}
|
554 |
|
555 |
+
/* DISPLAY UTILITIES */
|
|
|
|
|
|
|
|
|
|
|
556 |
|
557 |
static function make_clickable( $text ) {
|
558 |
return wpautop( self::rel_nofollow( make_clickable( $text ) ) );
|
571 |
return "<a $text rel=\"nofollow\">";
|
572 |
}
|
573 |
|
574 |
+
/**
|
575 |
+
* If a user has a lot of websites registered on fb this function will only link to the first one
|
576 |
+
*
|
577 |
+
* @param string $urls separated by spaces
|
578 |
+
*
|
579 |
+
* @return string first url
|
580 |
+
*/
|
581 |
+
static function getwebsite( $urls ) {
|
582 |
+
$url = explode( ' ', trim( $urls ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
583 |
|
584 |
+
return strpos( 'http://', $url[0] ) == false ? 'http://' . $url[0] : $url[0];
|
|
|
|
|
|
|
585 |
}
|
586 |
|
|
|
|
|
|
|
587 |
}
|
lib/js/fb.js
CHANGED
@@ -7,5 +7,18 @@ jQuery(document).ready(function () {
|
|
7 |
version: WEF.version,
|
8 |
xfbml: true
|
9 |
});
|
|
|
|
|
|
|
|
|
|
|
10 |
});
|
11 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
version: WEF.version,
|
8 |
xfbml: true
|
9 |
});
|
10 |
+
if(!(typeof WEF.ajaxurl === "undefined")){
|
11 |
+
FB.Event.subscribe('comment.create', wef_comment_callback);
|
12 |
+
FB.Event.subscribe('comment.remove', wef_comment_callback);
|
13 |
+
}
|
14 |
+
|
15 |
});
|
16 |
});
|
17 |
+
var wef_comment_callback = function(response) {
|
18 |
+
|
19 |
+
var data = { action : 'wpemfb_comments', response : response };
|
20 |
+
jQuery.post(WEF.ajaxurl,data,function(res){
|
21 |
+
console.log(res);
|
22 |
+
});
|
23 |
+
|
24 |
+
};
|
lib/js/fb.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(){jQuery.ajaxSetup({cache:!0});var a="//connect.facebook.net/"+WEF.local+"/sdk.js";jQuery.getScript(a,function(){FB.init({appId:WEF.fb_id,version:WEF.version,xfbml:!0})})});
|
1 |
+
jQuery(document).ready(function(){jQuery.ajaxSetup({cache:!0});var a="//connect.facebook.net/"+WEF.local+"/sdk.js";jQuery.getScript(a,function(){FB.init({appId:WEF.fb_id,version:WEF.version,xfbml:!0}),"undefined"!=typeof WEF.ajaxurl&&(FB.Event.subscribe("comment.create",wef_comment_callback),FB.Event.subscribe("comment.remove",wef_comment_callback))})});var wef_comment_callback=function(a){var b={action:"wpemfb_comments",response:a};jQuery.post(WEF.ajaxurl,b,function(a){console.log(a)})};
|
lib/js/wpembedfb.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
jQuery(document).ready(function() {
|
2 |
-
|
3 |
-
|
|
|
4 |
});
|
1 |
+
jQuery(document).ready(function () {
|
2 |
+
jQuery(".wef-measure").each(function () {
|
3 |
+
jQuery(this).next().attr("data-width", jQuery(this).outerWidth() + "px")
|
4 |
+
})
|
5 |
});
|
lib/js/wpembedfb.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(){
|
1 |
+
jQuery(document).ready(function(){jQuery(".wef-measure").each(function(){jQuery(this).next().attr("data-width",jQuery(this).outerWidth()+"px")})});
|
lib/lightbox2/css/lightbox.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
body:after{content:url("../images/close.png") url("../images/loading.gif") url("../images/prev.png") url("../images/next.png");display:none}body .lb-disable-scrolling{overflow:hidden}.lightboxOverlay{position:absolute;top:0;left:0;z-index:999999;background-color:#000;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80);opacity:0.8;display:none}.lightbox{position:absolute;left:0;width:100%;z-index:1000000;text-align:center;line-height:0;font-weight:normal}.lightbox .lb-image{display:block;height:auto;max-width:inherit;border-radius:3px}.lightbox a img{border:none}.lb-outerContainer{position:relative;background-color:#fff;*zoom:1;width:250px;height:250px;margin:0 auto;border-radius:4px}.lb-outerContainer:after{content:"";display:table;clear:both}.lb-container{padding:4px}.lb-container>.nav{left:0}.lb-loader{position:absolute;top:43%;left:0;height:25%;width:100%;text-align:center;line-height:0}.lb-cancel{display:block;width:32px;height:32px;margin:0 auto;background:url("../images/loading.gif") no-repeat}.lb-prev,.lb-next{height:100%;cursor:pointer;display:block}.lb-nav{position:absolute;top:0;left:0;height:100%;width:100%;z-index:10}.lb-nav a{outline:none;background-image:url("data:image/gifbase64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")}.lb-nav a.lb-prev{width:34%;left:0;float:left;background:url("../images/prev.png") left 48% no-repeat;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);opacity:0;-webkit-transition:opacity 0.6s;-moz-transition:opacity 0.6s;-o-transition:opacity 0.6s;transition:opacity 0.6s}.lb-nav a.lb-prev:hover{filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}.lb-nav a.lb-next{width:64%;right:0;float:right;background:url(../images/next.png) right 48% no-repeat;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);opacity:0;-webkit-transition:opacity 0.6s;-moz-transition:opacity 0.6s;-o-transition:opacity 0.6s;transition:opacity 0.6s}.lb-nav a.lb-next:hover{filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}.lb-dataContainer{margin:0 auto;padding-top:5px;*zoom:1;width:100%;-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}.lb-dataContainer:after{content:"";display:table;clear:both}.lb-data{padding:0 4px;color:#ccc}.lb-data .lb-details{width:85%;float:left;text-align:left;line-height:1.1em}.lb-data .lb-caption{font-size:13px;font-weight:bold;line-height:1em}.lb-data .lb-number{display:block;clear:left;padding-bottom:1em;font-size:12px;color:#999}.lb-data .lb-close{display:block;float:right;width:30px;height:30px;background:url(../images/close.png) top right no-repeat;text-align:right;outline:none;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=70);opacity:0.7;-webkit-transition:opacity 0.2s;-moz-transition:opacity 0.2s;-o-transition:opacity 0.2s;transition:opacity 0.2s}.lb-data .lb-close:hover{cursor:pointer;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}
|
1 |
+
body:after{content:url("../images/close.png") url("../images/loading.gif") url("../images/prev.png") url("../images/next.png");display:none}body .lb-disable-scrolling{overflow:hidden}.lightboxOverlay{position:absolute;top:0;left:0;z-index:999999;background-color:#000;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80);opacity:0.8;display:none}.lightbox{position:absolute;left:0;width:100%;z-index:1000000;text-align:center;line-height:0;font-weight:normal}.lightbox .lb-image{display:block;height:auto;max-width:inherit;border-radius:3px}.lightbox .lb-image a img{border:none}.lightbox .lb-outerContainer{position:relative;background-color:#fff;*zoom:1;width:250px;height:250px;margin:0 auto;border-radius:4px}.lightbox .lb-outerContainer:after{content:"";display:table;clear:both}.lightbox .lb-container{padding:4px}.lightbox .lb-container>.nav{left:0}.lightbox .lb-loader{position:absolute;top:43%;left:0;height:25%;width:100%;text-align:center;line-height:0}.lightbox .lb-cancel{display:block;width:32px;height:32px;margin:0 auto;background:url("../images/loading.gif") no-repeat}.lightbox .lb-prev,.lightbox .lb-next{height:100%;cursor:pointer;display:block}.lightbox .lb-nav{position:absolute;top:0;left:0;height:100%;width:100%;z-index:10}.lightbox .lb-nav a{outline:none;background-image:url("data:image/gifbase64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")}.lightbox .lb-nav a.lb-prev{width:34%;left:0;float:left;background:url("../images/prev.png") left 48% no-repeat;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);opacity:0;-webkit-transition:opacity 0.6s;-moz-transition:opacity 0.6s;-o-transition:opacity 0.6s;transition:opacity 0.6s}.lightbox .lb-nav a.lb-prev:hover{filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}.lightbox .lb-nav a.lb-next{width:64%;right:0;float:right;background:url(../images/next.png) right 48% no-repeat;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);opacity:0;-webkit-transition:opacity 0.6s;-moz-transition:opacity 0.6s;-o-transition:opacity 0.6s;transition:opacity 0.6s}.lightbox .lb-nav a.lb-next:hover{filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}.lightbox .lb-dataContainer{margin:0 auto;padding-top:5px;*zoom:1;width:100%;-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}.lightbox .lb-dataContainer:after{content:"";display:table;clear:both}.lightbox .lb-data{padding:0 4px;color:#ccc}.lightbox .lb-data .lb-details{width:85%;float:left;text-align:left;line-height:1.1em}.lightbox .lb-data .lb-caption{font-size:13px;font-weight:bold;line-height:1em}.lightbox .lb-data .lb-number{display:block;clear:left;padding-bottom:1em;font-size:12px;color:#999}.lightbox .lb-data .lb-close{display:block;float:right;width:30px;height:30px;background:url(../images/close.png) top right no-repeat;text-align:right;outline:none;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=70);opacity:0.7;-webkit-transition:opacity 0.2s;-moz-transition:opacity 0.2s;-o-transition:opacity 0.2s;transition:opacity 0.2s}.lightbox .lb-data .lb-close:hover{cursor:pointer;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}
|
lib/lightbox2/css/lightbox.sass
CHANGED
@@ -15,7 +15,7 @@ body
|
|
15 |
opacity: 0.8
|
16 |
display: none
|
17 |
|
18 |
-
.lightbox
|
19 |
position: absolute
|
20 |
left: 0
|
21 |
width: 100%
|
@@ -28,141 +28,140 @@ body
|
|
28 |
height: auto
|
29 |
max-width: inherit
|
30 |
border-radius: 3px
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
-
.lb-outerContainer
|
35 |
-
position: relative
|
36 |
-
background-color: white
|
37 |
-
*zoom: 1
|
38 |
-
width: 250px
|
39 |
-
height: 250px
|
40 |
-
margin: 0 auto
|
41 |
-
border-radius: 4px
|
42 |
-
&:after
|
43 |
-
content: ""
|
44 |
-
display: table
|
45 |
-
clear: both
|
46 |
|
47 |
|
48 |
-
.lb-container
|
49 |
-
padding: 4px
|
50 |
-
> .nav
|
51 |
-
left: 0
|
52 |
|
53 |
-
.lb-loader
|
54 |
-
position: absolute
|
55 |
-
top: 43%
|
56 |
-
left: 0
|
57 |
-
height: 25%
|
58 |
-
width: 100%
|
59 |
-
text-align: center
|
60 |
-
line-height: 0
|
61 |
|
62 |
|
63 |
-
.lb-cancel
|
64 |
-
display: block
|
65 |
-
width: 32px
|
66 |
-
height: 32px
|
67 |
-
margin: 0 auto
|
68 |
-
background: url('../images/loading.gif') no-repeat
|
69 |
|
70 |
|
71 |
-
.lb-prev, .lb-next
|
72 |
-
height: 100%
|
73 |
-
cursor: pointer
|
74 |
-
display: block
|
75 |
|
76 |
-
.lb-nav
|
77 |
-
position: absolute
|
78 |
-
top: 0
|
79 |
-
left: 0
|
80 |
-
height: 100%
|
81 |
-
width: 100%
|
82 |
-
z-index: 10
|
83 |
-
a
|
84 |
-
outline: none
|
85 |
-
background-image: url('data:image/gifbase64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==')
|
86 |
-
a.lb-prev
|
87 |
-
width: 34%
|
88 |
-
left: 0
|
89 |
-
float: left
|
90 |
-
background: url('../images/prev.png') left 48% no-repeat
|
91 |
-
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0)
|
92 |
-
opacity: 0
|
93 |
-
-webkit-transition: opacity 0.6s
|
94 |
-
-moz-transition: opacity 0.6s
|
95 |
-
-o-transition: opacity 0.6s
|
96 |
-
transition: opacity 0.6s
|
97 |
-
&:hover
|
98 |
-
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100)
|
99 |
-
opacity: 1
|
100 |
-
a.lb-next
|
101 |
-
width: 64%
|
102 |
-
right: 0
|
103 |
-
float: right
|
104 |
-
background: url(../images/next.png) right 48% no-repeat
|
105 |
-
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0)
|
106 |
-
opacity: 0
|
107 |
-
-webkit-transition: opacity 0.6s
|
108 |
-
-moz-transition: opacity 0.6s
|
109 |
-
-o-transition: opacity 0.6s
|
110 |
-
transition: opacity 0.6s
|
111 |
-
&:hover
|
112 |
-
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100)
|
113 |
-
opacity: 1
|
114 |
|
115 |
|
116 |
-
.lb-dataContainer
|
117 |
-
margin: 0 auto
|
118 |
-
padding-top: 5px
|
119 |
-
*zoom: 1
|
120 |
-
width: 100%
|
121 |
-
-moz-border-radius-bottomleft: 4px
|
122 |
-
-webkit-border-bottom-left-radius: 4px
|
123 |
-
border-bottom-left-radius: 4px
|
124 |
-
-moz-border-radius-bottomright: 4px
|
125 |
-
-webkit-border-bottom-right-radius: 4px
|
126 |
-
border-bottom-right-radius: 4px
|
127 |
-
&:after
|
128 |
-
content: ""
|
129 |
-
display: table
|
130 |
-
clear: both
|
131 |
-
|
132 |
-
.lb-data
|
133 |
-
padding: 0 4px
|
134 |
-
color: #ccc
|
135 |
-
.lb-details
|
136 |
-
width: 85%
|
137 |
-
float: left
|
138 |
-
text-align: left
|
139 |
-
line-height: 1.1em
|
140 |
-
.lb-caption
|
141 |
-
font-size: 13px
|
142 |
-
font-weight: bold
|
143 |
-
line-height: 1em
|
144 |
-
.lb-number
|
145 |
-
display: block
|
146 |
-
clear: left
|
147 |
-
padding-bottom: 1em
|
148 |
-
font-size: 12px
|
149 |
-
color: #999999
|
150 |
-
.lb-close
|
151 |
-
display: block
|
152 |
-
float: right
|
153 |
-
width: 30px
|
154 |
-
height: 30px
|
155 |
-
background: url(../images/close.png) top right no-repeat
|
156 |
-
text-align: right
|
157 |
-
outline: none
|
158 |
-
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70)
|
159 |
-
opacity: 0.7
|
160 |
-
-webkit-transition: opacity 0.2s
|
161 |
-
-moz-transition: opacity 0.2s
|
162 |
-
-o-transition: opacity 0.2s
|
163 |
-
transition: opacity 0.2s
|
164 |
-
&:hover
|
165 |
-
cursor: pointer
|
166 |
-
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100)
|
167 |
-
opacity: 1
|
168 |
|
15 |
opacity: 0.8
|
16 |
display: none
|
17 |
|
18 |
+
.lightbox
|
19 |
position: absolute
|
20 |
left: 0
|
21 |
width: 100%
|
28 |
height: auto
|
29 |
max-width: inherit
|
30 |
border-radius: 3px
|
31 |
+
a img
|
32 |
+
border: none
|
33 |
+
.lb-outerContainer
|
34 |
+
position: relative
|
35 |
+
background-color: white
|
36 |
+
*zoom: 1
|
37 |
+
width: 250px
|
38 |
+
height: 250px
|
39 |
+
margin: 0 auto
|
40 |
+
border-radius: 4px
|
41 |
+
&:after
|
42 |
+
content: ""
|
43 |
+
display: table
|
44 |
+
clear: both
|
45 |
+
.lb-container
|
46 |
+
padding: 4px
|
47 |
+
> .nav
|
48 |
+
left: 0
|
49 |
+
.lb-loader
|
50 |
+
position: absolute
|
51 |
+
top: 43%
|
52 |
+
left: 0
|
53 |
+
height: 25%
|
54 |
+
width: 100%
|
55 |
+
text-align: center
|
56 |
+
line-height: 0
|
57 |
+
.lb-cancel
|
58 |
+
display: block
|
59 |
+
width: 32px
|
60 |
+
height: 32px
|
61 |
+
margin: 0 auto
|
62 |
+
background: url('../images/loading.gif') no-repeat
|
63 |
+
.lb-prev, .lb-next
|
64 |
+
height: 100%
|
65 |
+
cursor: pointer
|
66 |
+
display: block
|
67 |
+
.lb-nav
|
68 |
+
position: absolute
|
69 |
+
top: 0
|
70 |
+
left: 0
|
71 |
+
height: 100%
|
72 |
+
width: 100%
|
73 |
+
z-index: 10
|
74 |
+
a
|
75 |
+
outline: none
|
76 |
+
background-image: url('data:image/gifbase64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==')
|
77 |
+
a.lb-prev
|
78 |
+
width: 34%
|
79 |
+
left: 0
|
80 |
+
float: left
|
81 |
+
background: url('../images/prev.png') left 48% no-repeat
|
82 |
+
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0)
|
83 |
+
opacity: 0
|
84 |
+
-webkit-transition: opacity 0.6s
|
85 |
+
-moz-transition: opacity 0.6s
|
86 |
+
-o-transition: opacity 0.6s
|
87 |
+
transition: opacity 0.6s
|
88 |
+
&:hover
|
89 |
+
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100)
|
90 |
+
opacity: 1
|
91 |
+
a.lb-next
|
92 |
+
width: 64%
|
93 |
+
right: 0
|
94 |
+
float: right
|
95 |
+
background: url(../images/next.png) right 48% no-repeat
|
96 |
+
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0)
|
97 |
+
opacity: 0
|
98 |
+
-webkit-transition: opacity 0.6s
|
99 |
+
-moz-transition: opacity 0.6s
|
100 |
+
-o-transition: opacity 0.6s
|
101 |
+
transition: opacity 0.6s
|
102 |
+
&:hover
|
103 |
+
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100)
|
104 |
+
opacity: 1
|
105 |
+
.lb-dataContainer
|
106 |
+
margin: 0 auto
|
107 |
+
padding-top: 5px
|
108 |
+
*zoom: 1
|
109 |
+
width: 100%
|
110 |
+
-moz-border-radius-bottomleft: 4px
|
111 |
+
-webkit-border-bottom-left-radius: 4px
|
112 |
+
border-bottom-left-radius: 4px
|
113 |
+
-moz-border-radius-bottomright: 4px
|
114 |
+
-webkit-border-bottom-right-radius: 4px
|
115 |
+
border-bottom-right-radius: 4px
|
116 |
+
&:after
|
117 |
+
content: ""
|
118 |
+
display: table
|
119 |
+
clear: both
|
120 |
+
.lb-data
|
121 |
+
padding: 0 4px
|
122 |
+
color: #ccc
|
123 |
+
.lb-details
|
124 |
+
width: 85%
|
125 |
+
float: left
|
126 |
+
text-align: left
|
127 |
+
line-height: 1.1em
|
128 |
+
.lb-caption
|
129 |
+
font-size: 13px
|
130 |
+
font-weight: bold
|
131 |
+
line-height: 1em
|
132 |
+
.lb-number
|
133 |
+
display: block
|
134 |
+
clear: left
|
135 |
+
padding-bottom: 1em
|
136 |
+
font-size: 12px
|
137 |
+
color: #999999
|
138 |
+
.lb-close
|
139 |
+
display: block
|
140 |
+
float: right
|
141 |
+
width: 30px
|
142 |
+
height: 30px
|
143 |
+
background: url(../images/close.png) top right no-repeat
|
144 |
+
text-align: right
|
145 |
+
outline: none
|
146 |
+
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70)
|
147 |
+
opacity: 0.7
|
148 |
+
-webkit-transition: opacity 0.2s
|
149 |
+
-moz-transition: opacity 0.2s
|
150 |
+
-o-transition: opacity 0.2s
|
151 |
+
transition: opacity 0.2s
|
152 |
+
&:hover
|
153 |
+
cursor: pointer
|
154 |
+
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100)
|
155 |
+
opacity: 1
|
156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
|
|
|
|
|
|
|
|
|
159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
|
|
|
|
|
|
|
|
|
164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
|
166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
|
lib/lightbox2/js/lightbox.js
CHANGED
@@ -1 +1,482 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**!
|
2 |
+
* Lightbox v2.8.2
|
3 |
+
* by Lokesh Dhakar
|
4 |
+
* Adaptation for WordPress by Miguel Sirvent
|
5 |
+
*
|
6 |
+
* More info:
|
7 |
+
* @link http://lokeshdhakar.com/projects/lightbox2/
|
8 |
+
* @link http://wpembedfb.com
|
9 |
+
*
|
10 |
+
* Copyright 2007, 2015 Lokesh Dhakar
|
11 |
+
* Released under the MIT license
|
12 |
+
* https://github.com/lokesh/lightbox2/blob/master/LICENSE
|
13 |
+
*/
|
14 |
+
|
15 |
+
jQuery(function ($) {
|
16 |
+
// Descriptions of all options available on the demo site:
|
17 |
+
// http://lokeshdhakar.com/projects/lightbox2/index.html#options
|
18 |
+
|
19 |
+
function Lightbox(options) {
|
20 |
+
this.album = [];
|
21 |
+
this.currentImageIndex = void 0;
|
22 |
+
this.init();
|
23 |
+
|
24 |
+
// options
|
25 |
+
this.options = $.extend({}, this.constructor.defaults);
|
26 |
+
this.option(options);
|
27 |
+
}
|
28 |
+
|
29 |
+
Lightbox.defaults = {
|
30 |
+
albumLabel: 'Image %1 of %2',
|
31 |
+
alwaysShowNavOnTouchDevices: false,
|
32 |
+
fadeDuration: 500,
|
33 |
+
fitImagesInViewport: true,
|
34 |
+
// maxWidth: 800,
|
35 |
+
// maxHeight: 600,
|
36 |
+
positionFromTop: 50,
|
37 |
+
resizeDuration: 700,
|
38 |
+
showImageNumberLabel: true,
|
39 |
+
wrapAround: false,
|
40 |
+
disableScrolling: false
|
41 |
+
};
|
42 |
+
|
43 |
+
Lightbox.prototype.option = function (options) {
|
44 |
+
$.extend(this.options, options);
|
45 |
+
};
|
46 |
+
|
47 |
+
Lightbox.prototype.imageCountLabel = function (currentImageNum, totalImages) {
|
48 |
+
return this.options.albumLabel.replace(/%1/g, currentImageNum).replace(/%2/g, totalImages);
|
49 |
+
};
|
50 |
+
|
51 |
+
Lightbox.prototype.init = function () {
|
52 |
+
this.enable();
|
53 |
+
this.build();
|
54 |
+
};
|
55 |
+
|
56 |
+
// Loop through anchors and areamaps looking for either data-lightbox attributes or rel attributes
|
57 |
+
// that contain 'lightbox'. When these are clicked, start lightbox.
|
58 |
+
Lightbox.prototype.enable = function () {
|
59 |
+
var self = this;
|
60 |
+
$('body').on('click', 'a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]', function (event) {
|
61 |
+
self.start($(event.currentTarget));
|
62 |
+
return false;
|
63 |
+
});
|
64 |
+
};
|
65 |
+
|
66 |
+
// Build html for the lightbox and the overlay.
|
67 |
+
// Attach event handlers to the new DOM elements. click click click
|
68 |
+
Lightbox.prototype.build = function () {
|
69 |
+
var self = this;
|
70 |
+
$('' +
|
71 |
+
'<div id="lightboxOverlay" class="lightboxOverlay"></div>' +
|
72 |
+
'<div id="lightbox" class="lightbox">' +
|
73 |
+
'<div class="lb-outerContainer">' +
|
74 |
+
'<div class="lb-container">' +
|
75 |
+
'<img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" />' +
|
76 |
+
'<div class="lb-nav">' +
|
77 |
+
'<a class="lb-prev" href="" ></a>' +
|
78 |
+
'<a class="lb-next" href="" ></a>' +
|
79 |
+
'</div>' +
|
80 |
+
'<div class="lb-loader">' +
|
81 |
+
'<a class="lb-cancel"></a>' +
|
82 |
+
'</div>' +
|
83 |
+
'</div>' +
|
84 |
+
'</div>' +
|
85 |
+
'<div class="lb-dataContainer">' +
|
86 |
+
'<div class="lb-data">' +
|
87 |
+
'<div class="lb-details">' +
|
88 |
+
'<span class="lb-caption"></span>' +
|
89 |
+
'<span class="lb-number"></span>' +
|
90 |
+
'</div>' +
|
91 |
+
'<div class="lb-closeContainer">' +
|
92 |
+
'<a class="lb-close"></a>' +
|
93 |
+
'</div>' +
|
94 |
+
'</div>' +
|
95 |
+
'</div>' +
|
96 |
+
'</div>' +
|
97 |
+
'').appendTo($('body'));
|
98 |
+
|
99 |
+
// Cache jQuery objects
|
100 |
+
this.$lightbox = $('#lightbox');
|
101 |
+
this.$overlay = $('#lightboxOverlay');
|
102 |
+
this.$outerContainer = this.$lightbox.find('.lb-outerContainer');
|
103 |
+
this.$container = this.$lightbox.find('.lb-container');
|
104 |
+
|
105 |
+
// Store css values for future lookup
|
106 |
+
this.containerTopPadding = parseInt(this.$container.css('padding-top'), 10);
|
107 |
+
this.containerRightPadding = parseInt(this.$container.css('padding-right'), 10);
|
108 |
+
this.containerBottomPadding = parseInt(this.$container.css('padding-bottom'), 10);
|
109 |
+
this.containerLeftPadding = parseInt(this.$container.css('padding-left'), 10);
|
110 |
+
|
111 |
+
// Attach event handlers to the newly minted DOM elements
|
112 |
+
this.$overlay.hide().on('click', function () {
|
113 |
+
self.end();
|
114 |
+
return false;
|
115 |
+
});
|
116 |
+
|
117 |
+
this.$lightbox.hide().on('click', function (event) {
|
118 |
+
if ($(event.target).attr('id') === 'lightbox') {
|
119 |
+
self.end();
|
120 |
+
}
|
121 |
+
return false;
|
122 |
+
});
|
123 |
+
|
124 |
+
this.$outerContainer.on('click', function (event) {
|
125 |
+
if ($(event.target).attr('id') === 'lightbox') {
|
126 |
+
self.end();
|
127 |
+
}
|
128 |
+
return false;
|
129 |
+
});
|
130 |
+
|
131 |
+
this.$lightbox.find('.lb-prev').on('click', function () {
|
132 |
+
if (self.currentImageIndex === 0) {
|
133 |
+
self.changeImage(self.album.length - 1);
|
134 |
+
} else {
|
135 |
+
self.changeImage(self.currentImageIndex - 1);
|
136 |
+
}
|
137 |
+
return false;
|
138 |
+
});
|
139 |
+
|
140 |
+
this.$lightbox.find('.lb-next').on('click', function () {
|
141 |
+
if (self.currentImageIndex === self.album.length - 1) {
|
142 |
+
self.changeImage(0);
|
143 |
+
} else {
|
144 |
+
self.changeImage(self.currentImageIndex + 1);
|
145 |
+
}
|
146 |
+
return false;
|
147 |
+
});
|
148 |
+
|
149 |
+
this.$lightbox.find('.lb-loader, .lb-close').on('click', function () {
|
150 |
+
self.end();
|
151 |
+
return false;
|
152 |
+
});
|
153 |
+
};
|
154 |
+
|
155 |
+
// Show overlay and lightbox. If the image is part of a set, add siblings to album array.
|
156 |
+
Lightbox.prototype.start = function ($link) {
|
157 |
+
var self = this;
|
158 |
+
var $window = $(window);
|
159 |
+
|
160 |
+
$window.on('resize', $.proxy(this.sizeOverlay, this));
|
161 |
+
|
162 |
+
$('select, object, embed').css({
|
163 |
+
visibility: 'hidden'
|
164 |
+
});
|
165 |
+
|
166 |
+
this.sizeOverlay();
|
167 |
+
|
168 |
+
this.album = [];
|
169 |
+
var imageNumber = 0;
|
170 |
+
|
171 |
+
function addToAlbum($link) {
|
172 |
+
self.album.push({
|
173 |
+
link: $link.attr('href'),
|
174 |
+
title: $link.attr('data-title') || $link.attr('title')
|
175 |
+
});
|
176 |
+
}
|
177 |
+
|
178 |
+
// Support both data-lightbox attribute and rel attribute implementations
|
179 |
+
var dataLightboxValue = $link.attr('data-lightbox');
|
180 |
+
var $links;
|
181 |
+
|
182 |
+
if (dataLightboxValue) {
|
183 |
+
$links = $($link.prop('tagName') + '[data-lightbox="' + dataLightboxValue + '"]');
|
184 |
+
for (var i = 0; i < $links.length; i = ++i) {
|
185 |
+
addToAlbum($($links[i]));
|
186 |
+
if ($links[i] === $link[0]) {
|
187 |
+
imageNumber = i;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
} else {
|
191 |
+
if ($link.attr('rel') === 'lightbox') {
|
192 |
+
// If image is not part of a set
|
193 |
+
addToAlbum($link);
|
194 |
+
} else {
|
195 |
+
// If image is part of a set
|
196 |
+
$links = $($link.prop('tagName') + '[rel="' + $link.attr('rel') + '"]');
|
197 |
+
for (var j = 0; j < $links.length; j = ++j) {
|
198 |
+
addToAlbum($($links[j]));
|
199 |
+
if ($links[j] === $link[0]) {
|
200 |
+
imageNumber = j;
|
201 |
+
}
|
202 |
+
}
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
// Position Lightbox
|
207 |
+
var top = $window.scrollTop() + this.options.positionFromTop;
|
208 |
+
var left = $window.scrollLeft();
|
209 |
+
this.$lightbox.css({
|
210 |
+
top: top + 'px',
|
211 |
+
left: left + 'px'
|
212 |
+
}).fadeIn(this.options.fadeDuration);
|
213 |
+
|
214 |
+
// Disable scrolling of the page while open
|
215 |
+
if (this.options.disableScrolling) {
|
216 |
+
$('body').addClass('lb-disable-scrolling');
|
217 |
+
}
|
218 |
+
|
219 |
+
this.changeImage(imageNumber);
|
220 |
+
};
|
221 |
+
|
222 |
+
// Hide most UI elements in preparation for the animated resizing of the lightbox.
|
223 |
+
Lightbox.prototype.changeImage = function (imageNumber) {
|
224 |
+
var self = this;
|
225 |
+
|
226 |
+
this.disableKeyboardNav();
|
227 |
+
var $image = this.$lightbox.find('.lb-image');
|
228 |
+
|
229 |
+
this.$overlay.fadeIn(this.options.fadeDuration);
|
230 |
+
|
231 |
+
$('.lb-loader').fadeIn('slow');
|
232 |
+
this.$lightbox.find('.lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption').hide();
|
233 |
+
|
234 |
+
this.$outerContainer.addClass('animating');
|
235 |
+
|
236 |
+
// When image to show is preloaded, we send the width and height to sizeContainer()
|
237 |
+
var preloader = new Image();
|
238 |
+
preloader.onload = function () {
|
239 |
+
var $preloader;
|
240 |
+
var imageHeight;
|
241 |
+
var imageWidth;
|
242 |
+
var maxImageHeight;
|
243 |
+
var maxImageWidth;
|
244 |
+
var windowHeight;
|
245 |
+
var windowWidth;
|
246 |
+
|
247 |
+
$image.attr('src', self.album[imageNumber].link);
|
248 |
+
|
249 |
+
$preloader = $(preloader);
|
250 |
+
|
251 |
+
$image.width(preloader.width);
|
252 |
+
$image.height(preloader.height);
|
253 |
+
|
254 |
+
if (self.options.fitImagesInViewport) {
|
255 |
+
// Fit image inside the viewport.
|
256 |
+
// Take into account the border around the image and an additional 10px gutter on each side.
|
257 |
+
|
258 |
+
windowWidth = $(window).width();
|
259 |
+
windowHeight = $(window).height();
|
260 |
+
maxImageWidth = windowWidth - self.containerLeftPadding - self.containerRightPadding - 20;
|
261 |
+
maxImageHeight = windowHeight - self.containerTopPadding - self.containerBottomPadding - 120;
|
262 |
+
|
263 |
+
// Check if image size is larger then maxWidth|maxHeight in settings
|
264 |
+
if (self.options.maxWidth && self.options.maxWidth < maxImageWidth) {
|
265 |
+
maxImageWidth = self.options.maxWidth;
|
266 |
+
}
|
267 |
+
if (self.options.maxHeight && self.options.maxHeight < maxImageWidth) {
|
268 |
+
maxImageHeight = self.options.maxHeight;
|
269 |
+
}
|
270 |
+
|
271 |
+
// Is there a fitting issue?
|
272 |
+
if ((preloader.width > maxImageWidth) || (preloader.height > maxImageHeight)) {
|
273 |
+
if ((preloader.width / maxImageWidth) > (preloader.height / maxImageHeight)) {
|
274 |
+
imageWidth = maxImageWidth;
|
275 |
+
imageHeight = parseInt(preloader.height / (preloader.width / imageWidth), 10);
|
276 |
+
$image.width(imageWidth);
|
277 |
+
$image.height(imageHeight);
|
278 |
+
} else {
|
279 |
+
imageHeight = maxImageHeight;
|
280 |
+
imageWidth = parseInt(preloader.width / (preloader.height / imageHeight), 10);
|
281 |
+
$image.width(imageWidth);
|
282 |
+
$image.height(imageHeight);
|
283 |
+
}
|
284 |
+
}
|
285 |
+
}
|
286 |
+
self.sizeContainer($image.width(), $image.height());
|
287 |
+
};
|
288 |
+
|
289 |
+
preloader.src = this.album[imageNumber].link;
|
290 |
+
this.currentImageIndex = imageNumber;
|
291 |
+
};
|
292 |
+
|
293 |
+
// Stretch overlay to fit the viewport
|
294 |
+
Lightbox.prototype.sizeOverlay = function () {
|
295 |
+
this.$overlay
|
296 |
+
.width($(document).width())
|
297 |
+
.height($(document).height());
|
298 |
+
};
|
299 |
+
|
300 |
+
// Animate the size of the lightbox to fit the image we are showing
|
301 |
+
Lightbox.prototype.sizeContainer = function (imageWidth, imageHeight) {
|
302 |
+
var self = this;
|
303 |
+
|
304 |
+
var oldWidth = this.$outerContainer.outerWidth();
|
305 |
+
var oldHeight = this.$outerContainer.outerHeight();
|
306 |
+
var newWidth = imageWidth + this.containerLeftPadding + this.containerRightPadding;
|
307 |
+
var newHeight = imageHeight + this.containerTopPadding + this.containerBottomPadding;
|
308 |
+
|
309 |
+
function postResize() {
|
310 |
+
self.$lightbox.find('.lb-dataContainer').width(newWidth);
|
311 |
+
self.$lightbox.find('.lb-prevLink').height(newHeight);
|
312 |
+
self.$lightbox.find('.lb-nextLink').height(newHeight);
|
313 |
+
self.showImage();
|
314 |
+
}
|
315 |
+
|
316 |
+
if (oldWidth !== newWidth || oldHeight !== newHeight) {
|
317 |
+
this.$outerContainer.animate({
|
318 |
+
width: newWidth,
|
319 |
+
height: newHeight
|
320 |
+
}, this.options.resizeDuration, 'swing', function () {
|
321 |
+
postResize();
|
322 |
+
});
|
323 |
+
} else {
|
324 |
+
postResize();
|
325 |
+
}
|
326 |
+
};
|
327 |
+
|
328 |
+
// Display the image and its details and begin preload neighboring images.
|
329 |
+
Lightbox.prototype.showImage = function () {
|
330 |
+
this.$lightbox.find('.lb-loader').stop(true).hide();
|
331 |
+
this.$lightbox.find('.lb-image').fadeIn('slow');
|
332 |
+
|
333 |
+
this.updateNav();
|
334 |
+
this.updateDetails();
|
335 |
+
this.preloadNeighboringImages();
|
336 |
+
this.enableKeyboardNav();
|
337 |
+
};
|
338 |
+
|
339 |
+
// Display previous and next navigation if appropriate.
|
340 |
+
Lightbox.prototype.updateNav = function () {
|
341 |
+
// Check to see if the browser supports touch events. If so, we take the conservative approach
|
342 |
+
// and assume that mouse hover events are not supported and always show prev/next navigation
|
343 |
+
// arrows in image sets.
|
344 |
+
var alwaysShowNav = false;
|
345 |
+
try {
|
346 |
+
document.createEvent('TouchEvent');
|
347 |
+
alwaysShowNav = (this.options.alwaysShowNavOnTouchDevices) ? true : false;
|
348 |
+
} catch (e) {
|
349 |
+
}
|
350 |
+
|
351 |
+
this.$lightbox.find('.lb-nav').show();
|
352 |
+
|
353 |
+
if (this.album.length > 1) {
|
354 |
+
if (this.options.wrapAround) {
|
355 |
+
if (alwaysShowNav) {
|
356 |
+
this.$lightbox.find('.lb-prev, .lb-next').css('opacity', '1');
|
357 |
+
}
|
358 |
+
this.$lightbox.find('.lb-prev, .lb-next').show();
|
359 |
+
} else {
|
360 |
+
if (this.currentImageIndex > 0) {
|
361 |
+
this.$lightbox.find('.lb-prev').show();
|
362 |
+
if (alwaysShowNav) {
|
363 |
+
this.$lightbox.find('.lb-prev').css('opacity', '1');
|
364 |
+
}
|
365 |
+
}
|
366 |
+
if (this.currentImageIndex < this.album.length - 1) {
|
367 |
+
this.$lightbox.find('.lb-next').show();
|
368 |
+
if (alwaysShowNav) {
|
369 |
+
this.$lightbox.find('.lb-next').css('opacity', '1');
|
370 |
+
}
|
371 |
+
}
|
372 |
+
}
|
373 |
+
}
|
374 |
+
};
|
375 |
+
|
376 |
+
// Display caption, image number, and closing button.
|
377 |
+
Lightbox.prototype.updateDetails = function () {
|
378 |
+
var self = this;
|
379 |
+
|
380 |
+
// Enable anchor clicks in the injected caption html.
|
381 |
+
// Thanks Nate Wright for the fix. @https://github.com/NateWr
|
382 |
+
if (typeof this.album[this.currentImageIndex].title !== 'undefined' &&
|
383 |
+
this.album[this.currentImageIndex].title !== '') {
|
384 |
+
this.$lightbox.find('.lb-caption')
|
385 |
+
.html(this.album[this.currentImageIndex].title)
|
386 |
+
.fadeIn('fast')
|
387 |
+
.find('a').on('click', function (event) {
|
388 |
+
if ($(this).attr('target') !== undefined) {
|
389 |
+
window.open($(this).attr('href'), $(this).attr('target'));
|
390 |
+
} else {
|
391 |
+
location.href = $(this).attr('href');
|
392 |
+
}
|
393 |
+
});
|
394 |
+
}
|
395 |
+
|
396 |
+
if (this.album.length > 1 && this.options.showImageNumberLabel) {
|
397 |
+
var labelText = this.imageCountLabel(this.currentImageIndex + 1, this.album.length);
|
398 |
+
this.$lightbox.find('.lb-number').text(labelText).fadeIn('fast');
|
399 |
+
} else {
|
400 |
+
this.$lightbox.find('.lb-number').hide();
|
401 |
+
}
|
402 |
+
|
403 |
+
this.$outerContainer.removeClass('animating');
|
404 |
+
|
405 |
+
this.$lightbox.find('.lb-dataContainer').fadeIn(this.options.resizeDuration, function () {
|
406 |
+
return self.sizeOverlay();
|
407 |
+
});
|
408 |
+
};
|
409 |
+
|
410 |
+
// Preload previous and next images in set.
|
411 |
+
Lightbox.prototype.preloadNeighboringImages = function () {
|
412 |
+
if (this.album.length > this.currentImageIndex + 1) {
|
413 |
+
var preloadNext = new Image();
|
414 |
+
preloadNext.src = this.album[this.currentImageIndex + 1].link;
|
415 |
+
}
|
416 |
+
if (this.currentImageIndex > 0) {
|
417 |
+
var preloadPrev = new Image();
|
418 |
+
preloadPrev.src = this.album[this.currentImageIndex - 1].link;
|
419 |
+
}
|
420 |
+
};
|
421 |
+
|
422 |
+
Lightbox.prototype.enableKeyboardNav = function () {
|
423 |
+
$(document).on('keyup.keyboard', $.proxy(this.keyboardAction, this));
|
424 |
+
};
|
425 |
+
|
426 |
+
Lightbox.prototype.disableKeyboardNav = function () {
|
427 |
+
$(document).off('.keyboard');
|
428 |
+
};
|
429 |
+
|
430 |
+
Lightbox.prototype.keyboardAction = function (event) {
|
431 |
+
var KEYCODE_ESC = 27;
|
432 |
+
var KEYCODE_LEFTARROW = 37;
|
433 |
+
var KEYCODE_RIGHTARROW = 39;
|
434 |
+
|
435 |
+
var keycode = event.keyCode;
|
436 |
+
var key = String.fromCharCode(keycode).toLowerCase();
|
437 |
+
if (keycode === KEYCODE_ESC || key.match(/x|o|c/)) {
|
438 |
+
this.end();
|
439 |
+
} else if (key === 'p' || keycode === KEYCODE_LEFTARROW) {
|
440 |
+
if (this.currentImageIndex !== 0) {
|
441 |
+
this.changeImage(this.currentImageIndex - 1);
|
442 |
+
} else if (this.options.wrapAround && this.album.length > 1) {
|
443 |
+
this.changeImage(this.album.length - 1);
|
444 |
+
}
|
445 |
+
} else if (key === 'n' || keycode === KEYCODE_RIGHTARROW) {
|
446 |
+
if (this.currentImageIndex !== this.album.length - 1) {
|
447 |
+
this.changeImage(this.currentImageIndex + 1);
|
448 |
+
} else if (this.options.wrapAround && this.album.length > 1) {
|
449 |
+
this.changeImage(0);
|
450 |
+
}
|
451 |
+
}
|
452 |
+
};
|
453 |
+
// Closing time. :-(
|
454 |
+
Lightbox.prototype.end = function () {
|
455 |
+
this.disableKeyboardNav();
|
456 |
+
$(window).off('resize', this.sizeOverlay);
|
457 |
+
this.$lightbox.fadeOut(this.options.fadeDuration);
|
458 |
+
this.$overlay.fadeOut(this.options.fadeDuration);
|
459 |
+
$('select, object, embed').css({
|
460 |
+
visibility: 'visible'
|
461 |
+
});
|
462 |
+
if (this.options.disableScrolling) {
|
463 |
+
$('body').removeClass('lb-disable-scrolling');
|
464 |
+
}
|
465 |
+
};
|
466 |
+
if (typeof WEF_LB === "undefined") {
|
467 |
+
new Lightbox();
|
468 |
+
} else {
|
469 |
+
for (var key in WEF_LB) {
|
470 |
+
if (WEF_LB.hasOwnProperty(key)) {
|
471 |
+
if (WEF_LB[key] == 'false') {
|
472 |
+
WEF_LB[key] = false;
|
473 |
+
}
|
474 |
+
if (WEF_LB[key] == 'true') {
|
475 |
+
WEF_LB[key] = true;
|
476 |
+
}
|
477 |
+
}
|
478 |
+
}
|
479 |
+
new Lightbox(WEF_LB);
|
480 |
+
}
|
481 |
+
});
|
482 |
+
|
lib/lightbox2/js/lightbox.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function($){function Lightbox(options){this.album=[];this.currentImageIndex=void 0;this.init();this.options=$.extend({},this.constructor.defaults);this.option(options)}Lightbox.defaults={albumLabel:"Image %1 of %2",alwaysShowNavOnTouchDevices:false,fadeDuration:500,fitImagesInViewport:true,positionFromTop:50,resizeDuration:700,showImageNumberLabel:true,wrapAround:false,disableScrolling:false};Lightbox.prototype.option=function(options){$.extend(this.options,options)};Lightbox.prototype.imageCountLabel=function(currentImageNum,totalImages){return this.options.albumLabel.replace(/%1/g,currentImageNum).replace(/%2/g,totalImages)};Lightbox.prototype.init=function(){this.enable();this.build()};Lightbox.prototype.enable=function(){var self=this;$("body").on("click","a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]",function(event){self.start($(event.currentTarget));return false})};Lightbox.prototype.build=function(){var self=this;$('<div id="lightboxOverlay" class="lightboxOverlay"></div><div id="lightbox" class="lightbox"><div class="lb-outerContainer"><div class="lb-container"><img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" /><div class="lb-nav"><a class="lb-prev" href="" ></a><a class="lb-next" href="" ></a></div><div class="lb-loader"><a class="lb-cancel"></a></div></div></div><div class="lb-dataContainer"><div class="lb-data"><div class="lb-details"><span class="lb-caption"></span><span class="lb-number"></span></div><div class="lb-closeContainer"><a class="lb-close"></a></div></div></div></div>').appendTo($("body"));this.$lightbox=$("#lightbox");this.$overlay=$("#lightboxOverlay");this.$outerContainer=this.$lightbox.find(".lb-outerContainer");this.$container=this.$lightbox.find(".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(){self.end();return false});this.$lightbox.hide().on("click",function(event){if($(event.target).attr("id")==="lightbox"){self.end()}return false});this.$outerContainer.on("click",function(event){if($(event.target).attr("id")==="lightbox"){self.end()}return false});this.$lightbox.find(".lb-prev").on("click",function(){if(self.currentImageIndex===0){self.changeImage(self.album.length-1)}else{self.changeImage(self.currentImageIndex-1)}return false});this.$lightbox.find(".lb-next").on("click",function(){if(self.currentImageIndex===self.album.length-1){self.changeImage(0)}else{self.changeImage(self.currentImageIndex+1)}return false});this.$lightbox.find(".lb-loader, .lb-close").on("click",function(){self.end();return false})};Lightbox.prototype.start=function($link){var self=this;var $window=$(window);$window.on("resize",$.proxy(this.sizeOverlay,this));$("select, object, embed").css({visibility:"hidden"});this.sizeOverlay();this.album=[];var imageNumber=0;function addToAlbum($link){self.album.push({link:$link.attr("href"),title:$link.attr("data-title")||$link.attr("title")})}var dataLightboxValue=$link.attr("data-lightbox");var $links;if(dataLightboxValue){$links=$($link.prop("tagName")+'[data-lightbox="'+dataLightboxValue+'"]');for(var i=0;i<$links.length;i=++i){addToAlbum($($links[i]));if($links[i]===$link[0]){imageNumber=i}}}else{if($link.attr("rel")==="lightbox"){addToAlbum($link)}else{$links=$($link.prop("tagName")+'[rel="'+$link.attr("rel")+'"]');for(var j=0;j<$links.length;j=++j){addToAlbum($($links[j]));if($links[j]===$link[0]){imageNumber=j}}}}var top=$window.scrollTop()+this.options.positionFromTop;var left=$window.scrollLeft();this.$lightbox.css({top:top+"px",left:left+"px"}).fadeIn(this.options.fadeDuration);if(this.options.disableScrolling){$("body").addClass("lb-disable-scrolling")}this.changeImage(imageNumber)};Lightbox.prototype.changeImage=function(imageNumber){var self=this;this.disableKeyboardNav();var $image=this.$lightbox.find(".lb-image");this.$overlay.fadeIn(this.options.fadeDuration);$(".lb-loader").fadeIn("slow");this.$lightbox.find(".lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption").hide();this.$outerContainer.addClass("animating");var preloader=new Image;preloader.onload=function(){var $preloader;var imageHeight;var imageWidth;var maxImageHeight;var maxImageWidth;var windowHeight;var windowWidth;$image.attr("src",self.album[imageNumber].link);$preloader=$(preloader);$image.width(preloader.width);$image.height(preloader.height);if(self.options.fitImagesInViewport){windowWidth=$(window).width();windowHeight=$(window).height();maxImageWidth=windowWidth-self.containerLeftPadding-self.containerRightPadding-20;maxImageHeight=windowHeight-self.containerTopPadding-self.containerBottomPadding-120;if(self.options.maxWidth&&self.options.maxWidth<maxImageWidth){maxImageWidth=self.options.maxWidth}if(self.options.maxHeight&&self.options.maxHeight<maxImageWidth){maxImageHeight=self.options.maxHeight}if(preloader.width>maxImageWidth||preloader.height>maxImageHeight){if(preloader.width/maxImageWidth>preloader.height/maxImageHeight){imageWidth=maxImageWidth;imageHeight=parseInt(preloader.height/(preloader.width/imageWidth),10);$image.width(imageWidth);$image.height(imageHeight)}else{imageHeight=maxImageHeight;imageWidth=parseInt(preloader.width/(preloader.height/imageHeight),10);$image.width(imageWidth);$image.height(imageHeight)}}}self.sizeContainer($image.width(),$image.height())};preloader.src=this.album[imageNumber].link;this.currentImageIndex=imageNumber};Lightbox.prototype.sizeOverlay=function(){this.$overlay.width($(document).width()).height($(document).height())};Lightbox.prototype.sizeContainer=function(imageWidth,imageHeight){var self=this;var oldWidth=this.$outerContainer.outerWidth();var oldHeight=this.$outerContainer.outerHeight();var newWidth=imageWidth+this.containerLeftPadding+this.containerRightPadding;var newHeight=imageHeight+this.containerTopPadding+this.containerBottomPadding;function postResize(){self.$lightbox.find(".lb-dataContainer").width(newWidth);self.$lightbox.find(".lb-prevLink").height(newHeight);self.$lightbox.find(".lb-nextLink").height(newHeight);self.showImage()}if(oldWidth!==newWidth||oldHeight!==newHeight){this.$outerContainer.animate({width:newWidth,height:newHeight},this.options.resizeDuration,"swing",function(){postResize()})}else{postResize()}};Lightbox.prototype.showImage=function(){this.$lightbox.find(".lb-loader").stop(true).hide();this.$lightbox.find(".lb-image").fadeIn("slow");this.updateNav();this.updateDetails();this.preloadNeighboringImages();this.enableKeyboardNav()};Lightbox.prototype.updateNav=function(){var alwaysShowNav=false;try{document.createEvent("TouchEvent");alwaysShowNav=this.options.alwaysShowNavOnTouchDevices?true:false}catch(e){}this.$lightbox.find(".lb-nav").show();if(this.album.length>1){if(this.options.wrapAround){if(alwaysShowNav){this.$lightbox.find(".lb-prev, .lb-next").css("opacity","1")}this.$lightbox.find(".lb-prev, .lb-next").show()}else{if(this.currentImageIndex>0){this.$lightbox.find(".lb-prev").show();if(alwaysShowNav){this.$lightbox.find(".lb-prev").css("opacity","1")}}if(this.currentImageIndex<this.album.length-1){this.$lightbox.find(".lb-next").show();if(alwaysShowNav){this.$lightbox.find(".lb-next").css("opacity","1")}}}}};Lightbox.prototype.updateDetails=function(){var self=this;if(typeof this.album[this.currentImageIndex].title!=="undefined"&&this.album[this.currentImageIndex].title!==""){this.$lightbox.find(".lb-caption").html(this.album[this.currentImageIndex].title).fadeIn("fast").find("a").on("click",function(event){if($(this).attr("target")!==undefined){window.open($(this).attr("href"),$(this).attr("target"))}else{location.href=$(this).attr("href")}})}if(this.album.length>1&&this.options.showImageNumberLabel){var labelText=this.imageCountLabel(this.currentImageIndex+1,this.album.length);this.$lightbox.find(".lb-number").text(labelText).fadeIn("fast")}else{this.$lightbox.find(".lb-number").hide()}this.$outerContainer.removeClass("animating");this.$lightbox.find(".lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return self.sizeOverlay()})};Lightbox.prototype.preloadNeighboringImages=function(){if(this.album.length>this.currentImageIndex+1){var preloadNext=new Image;preloadNext.src=this.album[this.currentImageIndex+1].link}if(this.currentImageIndex>0){var preloadPrev=new Image;preloadPrev.src=this.album[this.currentImageIndex-1].link}};Lightbox.prototype.enableKeyboardNav=function(){$(document).on("keyup.keyboard",$.proxy(this.keyboardAction,this))};Lightbox.prototype.disableKeyboardNav=function(){$(document).off(".keyboard")};Lightbox.prototype.keyboardAction=function(event){var KEYCODE_ESC=27;var KEYCODE_LEFTARROW=37;var KEYCODE_RIGHTARROW=39;var keycode=event.keyCode;var key=String.fromCharCode(keycode).toLowerCase();if(keycode===KEYCODE_ESC||key.match(/x|o|c/)){this.end()}else if(key==="p"||keycode===KEYCODE_LEFTARROW){if(this.currentImageIndex!==0){this.changeImage(this.currentImageIndex-1)}else if(this.options.wrapAround&&this.album.length>1){this.changeImage(this.album.length-1)}}else if(key==="n"||keycode===KEYCODE_RIGHTARROW){if(this.currentImageIndex!==this.album.length-1){this.changeImage(this.currentImageIndex+1)}else if(this.options.wrapAround&&this.album.length>1){this.changeImage(0)}}};Lightbox.prototype.end=function(){this.disableKeyboardNav();$(window).off("resize",this.sizeOverlay);this.$lightbox.fadeOut(this.options.fadeDuration);this.$overlay.fadeOut(this.options.fadeDuration);$("select, object, embed").css({visibility:"visible"});if(this.options.disableScrolling){$("body").removeClass("lb-disable-scrolling")}};if(typeof WEF_LB==="undefined"){new Lightbox}else{for(var key in WEF_LB){if(WEF_LB.hasOwnProperty(key)){if(WEF_LB[key]=="false"){WEF_LB[key]=false}if(WEF_LB[key]=="true"){WEF_LB[key]=true}}}new Lightbox(WEF_LB)}});
|
1 |
+
jQuery(function(a){function b(b){this.album=[],this.currentImageIndex=void 0,this.init(),this.options=a.extend({},this.constructor.defaults),this.option(b)}if(b.defaults={albumLabel:"Image %1 of %2",alwaysShowNavOnTouchDevices:!1,fadeDuration:500,fitImagesInViewport:!0,positionFromTop:50,resizeDuration:700,showImageNumberLabel:!0,wrapAround:!1,disableScrolling:!1},b.prototype.option=function(b){a.extend(this.options,b)},b.prototype.imageCountLabel=function(a,b){return this.options.albumLabel.replace(/%1/g,a).replace(/%2/g,b)},b.prototype.init=function(){this.enable(),this.build()},b.prototype.enable=function(){var b=this;a("body").on("click","a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]",function(c){return b.start(a(c.currentTarget)),!1})},b.prototype.build=function(){var b=this;a('<div id="lightboxOverlay" class="lightboxOverlay"></div><div id="lightbox" class="lightbox"><div class="lb-outerContainer"><div class="lb-container"><img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" /><div class="lb-nav"><a class="lb-prev" href="" ></a><a class="lb-next" href="" ></a></div><div class="lb-loader"><a class="lb-cancel"></a></div></div></div><div class="lb-dataContainer"><div class="lb-data"><div class="lb-details"><span class="lb-caption"></span><span class="lb-number"></span></div><div class="lb-closeContainer"><a class="lb-close"></a></div></div></div></div>').appendTo(a("body")),this.$lightbox=a("#lightbox"),this.$overlay=a("#lightboxOverlay"),this.$outerContainer=this.$lightbox.find(".lb-outerContainer"),this.$container=this.$lightbox.find(".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 b.end(),!1}),this.$lightbox.hide().on("click",function(c){return"lightbox"===a(c.target).attr("id")&&b.end(),!1}),this.$outerContainer.on("click",function(c){return"lightbox"===a(c.target).attr("id")&&b.end(),!1}),this.$lightbox.find(".lb-prev").on("click",function(){return 0===b.currentImageIndex?b.changeImage(b.album.length-1):b.changeImage(b.currentImageIndex-1),!1}),this.$lightbox.find(".lb-next").on("click",function(){return b.currentImageIndex===b.album.length-1?b.changeImage(0):b.changeImage(b.currentImageIndex+1),!1}),this.$lightbox.find(".lb-loader, .lb-close").on("click",function(){return b.end(),!1})},b.prototype.start=function(b){function c(a){d.album.push({link:a.attr("href"),title:a.attr("data-title")||a.attr("title")})}var d=this,e=a(window);e.on("resize",a.proxy(this.sizeOverlay,this)),a("select, object, embed").css({visibility:"hidden"}),this.sizeOverlay(),this.album=[];var f,g=0,h=b.attr("data-lightbox");if(h){f=a(b.prop("tagName")+'[data-lightbox="'+h+'"]');for(var i=0;i<f.length;i=++i)c(a(f[i])),f[i]===b[0]&&(g=i)}else if("lightbox"===b.attr("rel"))c(b);else{f=a(b.prop("tagName")+'[rel="'+b.attr("rel")+'"]');for(var j=0;j<f.length;j=++j)c(a(f[j])),f[j]===b[0]&&(g=j)}var k=e.scrollTop()+this.options.positionFromTop,l=e.scrollLeft();this.$lightbox.css({top:k+"px",left:l+"px"}).fadeIn(this.options.fadeDuration),this.options.disableScrolling&&a("body").addClass("lb-disable-scrolling"),this.changeImage(g)},b.prototype.changeImage=function(b){var c=this;this.disableKeyboardNav();var d=this.$lightbox.find(".lb-image");this.$overlay.fadeIn(this.options.fadeDuration),a(".lb-loader").fadeIn("slow"),this.$lightbox.find(".lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption").hide(),this.$outerContainer.addClass("animating");var e=new Image;e.onload=function(){var f,g,h,i,j,k,l;d.attr("src",c.album[b].link),f=a(e),d.width(e.width),d.height(e.height),c.options.fitImagesInViewport&&(l=a(window).width(),k=a(window).height(),j=l-c.containerLeftPadding-c.containerRightPadding-20,i=k-c.containerTopPadding-c.containerBottomPadding-120,c.options.maxWidth&&c.options.maxWidth<j&&(j=c.options.maxWidth),c.options.maxHeight&&c.options.maxHeight<j&&(i=c.options.maxHeight),(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())},e.src=this.album[b].link,this.currentImageIndex=b},b.prototype.sizeOverlay=function(){this.$overlay.width(a(document).width()).height(a(document).height())},b.prototype.sizeContainer=function(a,b){function c(){d.$lightbox.find(".lb-dataContainer").width(g),d.$lightbox.find(".lb-prevLink").height(h),d.$lightbox.find(".lb-nextLink").height(h),d.showImage()}var d=this,e=this.$outerContainer.outerWidth(),f=this.$outerContainer.outerHeight(),g=a+this.containerLeftPadding+this.containerRightPadding,h=b+this.containerTopPadding+this.containerBottomPadding;e!==g||f!==h?this.$outerContainer.animate({width:g,height:h},this.options.resizeDuration,"swing",function(){c()}):c()},b.prototype.showImage=function(){this.$lightbox.find(".lb-loader").stop(!0).hide(),this.$lightbox.find(".lb-image").fadeIn("slow"),this.updateNav(),this.updateDetails(),this.preloadNeighboringImages(),this.enableKeyboardNav()},b.prototype.updateNav=function(){var a=!1;try{document.createEvent("TouchEvent"),a=!!this.options.alwaysShowNavOnTouchDevices}catch(b){}this.$lightbox.find(".lb-nav").show(),this.album.length>1&&(this.options.wrapAround?(a&&this.$lightbox.find(".lb-prev, .lb-next").css("opacity","1"),this.$lightbox.find(".lb-prev, .lb-next").show()):(this.currentImageIndex>0&&(this.$lightbox.find(".lb-prev").show(),a&&this.$lightbox.find(".lb-prev").css("opacity","1")),this.currentImageIndex<this.album.length-1&&(this.$lightbox.find(".lb-next").show(),a&&this.$lightbox.find(".lb-next").css("opacity","1"))))},b.prototype.updateDetails=function(){var b=this;if("undefined"!=typeof this.album[this.currentImageIndex].title&&""!==this.album[this.currentImageIndex].title&&this.$lightbox.find(".lb-caption").html(this.album[this.currentImageIndex].title).fadeIn("fast").find("a").on("click",function(b){void 0!==a(this).attr("target")?window.open(a(this).attr("href"),a(this).attr("target")):location.href=a(this).attr("href")}),this.album.length>1&&this.options.showImageNumberLabel){var c=this.imageCountLabel(this.currentImageIndex+1,this.album.length);this.$lightbox.find(".lb-number").text(c).fadeIn("fast")}else this.$lightbox.find(".lb-number").hide();this.$outerContainer.removeClass("animating"),this.$lightbox.find(".lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return b.sizeOverlay()})},b.prototype.preloadNeighboringImages=function(){if(this.album.length>this.currentImageIndex+1){var a=new Image;a.src=this.album[this.currentImageIndex+1].link}if(this.currentImageIndex>0){var b=new Image;b.src=this.album[this.currentImageIndex-1].link}},b.prototype.enableKeyboardNav=function(){a(document).on("keyup.keyboard",a.proxy(this.keyboardAction,this))},b.prototype.disableKeyboardNav=function(){a(document).off(".keyboard")},b.prototype.keyboardAction=function(a){var b=27,c=37,d=39,e=a.keyCode,f=String.fromCharCode(e).toLowerCase();e===b||f.match(/x|o|c/)?this.end():"p"===f||e===c?0!==this.currentImageIndex?this.changeImage(this.currentImageIndex-1):this.options.wrapAround&&this.album.length>1&&this.changeImage(this.album.length-1):"n"!==f&&e!==d||(this.currentImageIndex!==this.album.length-1?this.changeImage(this.currentImageIndex+1):this.options.wrapAround&&this.album.length>1&&this.changeImage(0))},b.prototype.end=function(){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({visibility:"visible"}),this.options.disableScrolling&&a("body").removeClass("lb-disable-scrolling")},"undefined"==typeof WEF_LB)new b;else{for(var c in WEF_LB)WEF_LB.hasOwnProperty(c)&&("false"==WEF_LB[c]&&(WEF_LB[c]=!1),"true"==WEF_LB[c]&&(WEF_LB[c]=!0));new b(WEF_LB)}});
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: poxtron
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R8Q85GT3Q8Q26
|
4 |
Tags: Facebook, facebook, Social Plugins, embed facebook, facebook video, facebook posts, facebook publication, facebook publications, facebook event, facebook events, facebook pages, facebook page, facebook profiles, facebook album, facebook albums, facebook photos, facebook photo, social,
|
5 |
Requires at least: 3.8.1
|
6 |
-
Tested up to: 4.5.
|
7 |
-
Stable tag: 2.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -40,10 +40,6 @@ Alternatively you can use the [facebook url] shortcode.
|
|
40 |
|
41 |
Read more about the shortcodes on [this](http://www.wpembedfb.com/shortcode-attributes-and-examples/) page.
|
42 |
|
43 |
-
= Contributing =
|
44 |
-
If you found a bug or want to add an extra feature create a pull request on https://github.com/sigami/wp-embed-facebook
|
45 |
-
|
46 |
-
|
47 |
= Premium extension =
|
48 |
* Embed full event shortcode
|
49 |
* Embed full fan page shortcode
|
@@ -55,6 +51,8 @@ If you found a bug or want to add an extra feature create a pull request on http
|
|
55 |
* Shortcode creator
|
56 |
* Special templates for albums and pages
|
57 |
|
|
|
|
|
58 |
|
59 |
== Installation ==
|
60 |
|
@@ -72,11 +70,11 @@ You can override the embed template with a custom one. More information on http:
|
|
72 |
|
73 |
= How can I make my page load faster ? =
|
74 |
|
75 |
-
Use any kind of page cache. W3 Total Cache or WP Super Cache
|
76 |
|
77 |
= I cannot embed my photo stream =
|
78 |
|
79 |
-
This plugin only works for embedding **albums**. The premium version will allow you embed all. (Feature available mid July 2016)
|
80 |
|
81 |
= Is there a way to embed an album with more than 100 photos ? =
|
82 |
|
@@ -104,11 +102,17 @@ This can only be achieved using the premium version
|
|
104 |
|
105 |
== Changelog ==
|
106 |
|
|
|
|
|
|
|
107 |
= 2.1.0 =
|
108 |
-
* Fixed: [facebook object_id]
|
109 |
-
* Fixed:
|
110 |
-
*
|
|
|
111 |
* Added: Extra FAQ
|
|
|
|
|
112 |
|
113 |
= 2.1 =
|
114 |
* Removed: all options and moved them to a single one 'wpemfb_options'
|
@@ -345,5 +349,5 @@ This can only be achieved using the premium version
|
|
345 |
|
346 |
== Upgrade Notice ==
|
347 |
|
348 |
-
= 2.1.
|
349 |
-
Fixes: error for uls something-3423223, [facebook object_id] shortcode
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R8Q85GT3Q8Q26
|
4 |
Tags: Facebook, facebook, Social Plugins, embed facebook, facebook video, facebook posts, facebook publication, facebook publications, facebook event, facebook events, facebook pages, facebook page, facebook profiles, facebook album, facebook albums, facebook photos, facebook photo, social,
|
5 |
Requires at least: 3.8.1
|
6 |
+
Tested up to: 4.5.3
|
7 |
+
Stable tag: 2.1.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
40 |
|
41 |
Read more about the shortcodes on [this](http://www.wpembedfb.com/shortcode-attributes-and-examples/) page.
|
42 |
|
|
|
|
|
|
|
|
|
43 |
= Premium extension =
|
44 |
* Embed full event shortcode
|
45 |
* Embed full fan page shortcode
|
51 |
* Shortcode creator
|
52 |
* Special templates for albums and pages
|
53 |
|
54 |
+
= Contributing =
|
55 |
+
If you found a bug or want to add an extra feature create a pull request [here](https://github.com/sigami/wp-embed-facebook)
|
56 |
|
57 |
== Installation ==
|
58 |
|
70 |
|
71 |
= How can I make my page load faster ? =
|
72 |
|
73 |
+
Use any kind of page cache. W3 Total Cache or WP Super Cache are known to be the best ones.
|
74 |
|
75 |
= I cannot embed my photo stream =
|
76 |
|
77 |
+
This plugin only works for embedding **albums**. The premium version will allow you to embed all. (Feature available mid July 2016)
|
78 |
|
79 |
= Is there a way to embed an album with more than 100 photos ? =
|
80 |
|
102 |
|
103 |
== Changelog ==
|
104 |
|
105 |
+
= 2.1.1 =
|
106 |
+
* Updated: social plugins embed
|
107 |
+
|
108 |
= 2.1.0 =
|
109 |
+
* Fixed: Shortcode [facebook object_id]
|
110 |
+
* Fixed: Error for uls https://www.facebook.com/something-3423223
|
111 |
+
* Fixed: Readme typo
|
112 |
+
* Added: Uglyfied scripts
|
113 |
* Added: Extra FAQ
|
114 |
+
* Added: Github for development https://github.com/sigami/wp-embed-facebook
|
115 |
+
|
116 |
|
117 |
= 2.1 =
|
118 |
* Removed: all options and moved them to a single one 'wpemfb_options'
|
349 |
|
350 |
== Upgrade Notice ==
|
351 |
|
352 |
+
= 2.1.1 =
|
353 |
+
Fixes: error for uls something-3423223, [facebook object_id] shortcode
|
templates/classic/com-page.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
<?php
|
16 |
$opt = WP_Embed_FB_Plugin::get_option('show_like');
|
17 |
if($opt === 'true') :
|
18 |
-
echo WEF_Social_Plugins::
|
19 |
else :
|
20 |
printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_data['likes'] );
|
21 |
endif;
|
15 |
<?php
|
16 |
$opt = WP_Embed_FB_Plugin::get_option('show_like');
|
17 |
if($opt === 'true') :
|
18 |
+
echo WEF_Social_Plugins::get('like',array('href'=>'https://www.facebook.com/'.$fb_data['id'],'share'=>'true','layout'=>'button_count'));
|
19 |
else :
|
20 |
printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_data['likes'] );
|
21 |
endif;
|
templates/classic/page.php
CHANGED
@@ -29,7 +29,7 @@
|
|
29 |
<?php
|
30 |
$opt = WP_Embed_FB_Plugin::get_option('show_like');
|
31 |
if($opt === 'true') :
|
32 |
-
echo WEF_Social_Plugins::
|
33 |
else :
|
34 |
printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_data['likes'] );
|
35 |
endif;
|
29 |
<?php
|
30 |
$opt = WP_Embed_FB_Plugin::get_option('show_like');
|
31 |
if($opt === 'true') :
|
32 |
+
echo WEF_Social_Plugins::get('like',array('href'=>'https://www.facebook.com/'.$fb_data['id'],'share'=>'true','layout'=>'button_count','show-faces'=> 'false'));
|
33 |
else :
|
34 |
printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_data['likes'] );
|
35 |
endif;
|
templates/classic/post.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
<?php
|
17 |
$opt = WP_Embed_FB_Plugin::get_option('show_like');
|
18 |
if($opt === 'true') :
|
19 |
-
echo WEF_Social_Plugins::
|
20 |
else :
|
21 |
printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_post['likes'] );
|
22 |
endif;
|
16 |
<?php
|
17 |
$opt = WP_Embed_FB_Plugin::get_option('show_like');
|
18 |
if($opt === 'true') :
|
19 |
+
echo WEF_Social_Plugins::get('like',array('href'=>'https://www.facebook.com/'.$fb_data['id'],'share'=>'true','layout'=>'button_count'));
|
20 |
else :
|
21 |
printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_post['likes'] );
|
22 |
endif;
|
templates/classic/profile.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
<?php
|
17 |
$opt = WP_Embed_FB_Plugin::get_option('show_follow');
|
18 |
if($opt === 'true') :
|
19 |
-
WEF_Social_Plugins::
|
20 |
endif;
|
21 |
?>
|
22 |
</div>
|
16 |
<?php
|
17 |
$opt = WP_Embed_FB_Plugin::get_option('show_follow');
|
18 |
if($opt === 'true') :
|
19 |
+
WEF_Social_Plugins::get('follow',array('href'=>'https://www.facebook.com/'.$fb_data['id']));
|
20 |
endif;
|
21 |
?>
|
22 |
</div>
|
templates/classic/social-plugin.php
CHANGED
@@ -3,20 +3,24 @@
|
|
3 |
switch($type){
|
4 |
case 'page' :
|
5 |
/** @noinspection PhpUndefinedVariableInspection */
|
6 |
-
echo WEF_Social_Plugins::
|
7 |
break;
|
8 |
case 'video' :
|
9 |
-
if(WP_Embed_FB_Plugin::get_option('video_as_post') == 'true')
|
|
|
|
|
10 |
/** @noinspection PhpUndefinedVariableInspection */
|
11 |
-
echo WEF_Social_Plugins::
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
15 |
break;
|
16 |
//case 'photo' :
|
17 |
//case 'post' :
|
18 |
default:
|
19 |
/** @noinspection PhpUndefinedVariableInspection */
|
20 |
-
echo WEF_Social_Plugins::
|
21 |
break;
|
22 |
}
|
3 |
switch($type){
|
4 |
case 'page' :
|
5 |
/** @noinspection PhpUndefinedVariableInspection */
|
6 |
+
echo WEF_Social_Plugins::get('page',array('href'=>'https://www.facebook.com/' . $fb_data['link'],'width'=>$width));
|
7 |
break;
|
8 |
case 'video' :
|
9 |
+
if ( WP_Embed_FB_Plugin::get_option( 'video_as_post' ) == 'true' ) /** @noinspection PhpUndefinedVariableInspection */ {
|
10 |
+
echo WEF_Social_Plugins::get('post',array('href'=>'https://www.facebook.com/' . $fb_data['link'],'width'=>$width));
|
11 |
+
} else {
|
12 |
/** @noinspection PhpUndefinedVariableInspection */
|
13 |
+
echo WEF_Social_Plugins::get('video',array('href'=>'https://www.facebook.com/' . $fb_data['link'],'width'=>$width));
|
14 |
+
if ( WP_Embed_FB_Plugin::get_option( 'video_download' ) == 'true' ) {
|
15 |
+
echo '<p class="wef-video-link"><a title="Download this video" href="http://www.freemake.com/free_video_downloader/">' . __( 'Download this video', 'wp-embed-facebook' ) . '</a></p>';
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
break;
|
20 |
//case 'photo' :
|
21 |
//case 'post' :
|
22 |
default:
|
23 |
/** @noinspection PhpUndefinedVariableInspection */
|
24 |
+
echo WEF_Social_Plugins::get('post',array('href'=>'https://www.facebook.com/' . $fb_data['link'],'width'=>$width));
|
25 |
break;
|
26 |
}
|
templates/comments.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( post_password_required() ) {
|
3 |
+
return;
|
4 |
+
}
|
5 |
+
echo WEF_Social_Plugins::get('comments',array('href'=>wp_get_shortlink(get_queried_object_id()),'width'=>'100%'));
|
templates/default/album.php
CHANGED
@@ -26,7 +26,7 @@
|
|
26 |
foreach ($fb_data['photos']['data'] as $pic) {
|
27 |
$data_title = isset($pic['name']) ? $pic['name'] : '';
|
28 |
?>
|
29 |
-
<a href="<?php echo $pic['source'] ?>"
|
30 |
<img class="thumbnail" src="<?php echo $pic['picture'] ?>" />
|
31 |
</a>
|
32 |
<?php
|
26 |
foreach ($fb_data['photos']['data'] as $pic) {
|
27 |
$data_title = isset($pic['name']) ? $pic['name'] : '';
|
28 |
?>
|
29 |
+
<a href="<?php echo $pic['source'] ?>" <?php echo WP_Embed_FB_Plugin::get_option('lightbox_att') ?> <?php echo !empty($data_title) ? 'data-title="'.esc_attr(wp_rel_nofollow(make_clickable(str_replace(array('"',"'"),array('"','''),$data_title)))).'"' : '' ?> >
|
30 |
<img class="thumbnail" src="<?php echo $pic['picture'] ?>" />
|
31 |
</a>
|
32 |
<?php
|
templates/default/com-page.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
<?php
|
16 |
$opt = WP_Embed_FB_Plugin::get_option('show_like');
|
17 |
if($opt === 'true') :
|
18 |
-
echo WEF_Social_Plugins::
|
19 |
else :
|
20 |
printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_data['likes'] );
|
21 |
endif;
|
15 |
<?php
|
16 |
$opt = WP_Embed_FB_Plugin::get_option('show_like');
|
17 |
if($opt === 'true') :
|
18 |
+
echo WEF_Social_Plugins::get('like',array('href'=>'https://www.facebook.com/'.$fb_data['id'],'share'=>'true','layout'=>'button_count','show-faces'=> 'false'));
|
19 |
else :
|
20 |
printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_data['likes'] );
|
21 |
endif;
|
templates/default/page.php
CHANGED
@@ -29,7 +29,7 @@
|
|
29 |
<?php
|
30 |
$opt = WP_Embed_FB_Plugin::get_option('show_like');
|
31 |
if($opt === 'true') :
|
32 |
-
echo WEF_Social_Plugins::
|
33 |
else :
|
34 |
printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_data['likes'] );
|
35 |
endif;
|
29 |
<?php
|
30 |
$opt = WP_Embed_FB_Plugin::get_option('show_like');
|
31 |
if($opt === 'true') :
|
32 |
+
echo WEF_Social_Plugins::get('like',array('href'=>'https://www.facebook.com/'.$fb_data['id'],'share'=>'true','layout'=>'button_count','show-faces'=> 'false'));
|
33 |
else :
|
34 |
printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_data['likes'] );
|
35 |
endif;
|
templates/default/post.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
<?php
|
17 |
$opt = WP_Embed_FB_Plugin::get_option('show_like');
|
18 |
if($opt === 'true') :
|
19 |
-
echo WEF_Social_Plugins::
|
20 |
else :
|
21 |
printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_post['likes'] );
|
22 |
endif;
|
16 |
<?php
|
17 |
$opt = WP_Embed_FB_Plugin::get_option('show_like');
|
18 |
if($opt === 'true') :
|
19 |
+
echo WEF_Social_Plugins::get('like',array('href'=>'https://www.facebook.com/'.$fb_data['id'],'share'=>'true','layout'=>'button_count'));
|
20 |
else :
|
21 |
printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_post['likes'] );
|
22 |
endif;
|
templates/default/profile.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
<?php
|
17 |
$opt = WP_Embed_FB_Plugin::get_option('show_follow');
|
18 |
if($opt === 'true') :
|
19 |
-
WEF_Social_Plugins::
|
20 |
endif;
|
21 |
?>
|
22 |
</div>
|
16 |
<?php
|
17 |
$opt = WP_Embed_FB_Plugin::get_option('show_follow');
|
18 |
if($opt === 'true') :
|
19 |
+
WEF_Social_Plugins::get('follow',array('href'=>'https://www.facebook.com/'.$fb_data['id']));
|
20 |
endif;
|
21 |
?>
|
22 |
</div>
|
templates/default/social-plugin.php
CHANGED
@@ -3,14 +3,14 @@
|
|
3 |
switch ( $type ) {
|
4 |
case 'page' :
|
5 |
/** @noinspection PhpUndefinedVariableInspection */
|
6 |
-
echo WEF_Social_Plugins::
|
7 |
break;
|
8 |
case 'video' :
|
9 |
if ( WP_Embed_FB_Plugin::get_option( 'video_as_post' ) == 'true' ) /** @noinspection PhpUndefinedVariableInspection */ {
|
10 |
-
echo WEF_Social_Plugins::
|
11 |
} else {
|
12 |
/** @noinspection PhpUndefinedVariableInspection */
|
13 |
-
echo WEF_Social_Plugins::
|
14 |
if ( WP_Embed_FB_Plugin::get_option( 'video_download' ) == 'true' ) {
|
15 |
echo '<p class="wef-video-link"><a title="Download this video" href="http://www.freemake.com/free_video_downloader/">' . __( 'Download this video', 'wp-embed-facebook' ) . '</a></p>';
|
16 |
}
|
@@ -21,6 +21,6 @@ switch ( $type ) {
|
|
21 |
//case 'post' :
|
22 |
default:
|
23 |
/** @noinspection PhpUndefinedVariableInspection */
|
24 |
-
echo WEF_Social_Plugins::
|
25 |
break;
|
26 |
}
|
3 |
switch ( $type ) {
|
4 |
case 'page' :
|
5 |
/** @noinspection PhpUndefinedVariableInspection */
|
6 |
+
echo WEF_Social_Plugins::get('page',array('href'=>'https://www.facebook.com/' . $fb_data['link'],'width'=>$width));
|
7 |
break;
|
8 |
case 'video' :
|
9 |
if ( WP_Embed_FB_Plugin::get_option( 'video_as_post' ) == 'true' ) /** @noinspection PhpUndefinedVariableInspection */ {
|
10 |
+
echo WEF_Social_Plugins::get('post',array('href'=>'https://www.facebook.com/' . $fb_data['link'],'width'=>$width));
|
11 |
} else {
|
12 |
/** @noinspection PhpUndefinedVariableInspection */
|
13 |
+
echo WEF_Social_Plugins::get('video',array('href'=>'https://www.facebook.com/' . $fb_data['link'],'width'=>$width));
|
14 |
if ( WP_Embed_FB_Plugin::get_option( 'video_download' ) == 'true' ) {
|
15 |
echo '<p class="wef-video-link"><a title="Download this video" href="http://www.freemake.com/free_video_downloader/">' . __( 'Download this video', 'wp-embed-facebook' ) . '</a></p>';
|
16 |
}
|
21 |
//case 'post' :
|
22 |
default:
|
23 |
/** @noinspection PhpUndefinedVariableInspection */
|
24 |
+
echo WEF_Social_Plugins::get('post',array('href'=>'https://www.facebook.com/' . $fb_data['link'],'width'=>$width));
|
25 |
break;
|
26 |
}
|
wp-embed-facebook.php
CHANGED
@@ -2,48 +2,46 @@
|
|
2 |
/*
|
3 |
Plugin Name: WP Embed Facebook
|
4 |
Plugin URI: http://www.wpembedfb.com
|
5 |
-
Description: Embed any public Facebook video, photo, album, event, page, profile, or post.
|
6 |
Author: Miguel Sirvent
|
7 |
-
Version: 2.1.
|
8 |
Author URI: http://www.wpembedfb.com
|
9 |
Text Domain: wp-embed-facebook
|
10 |
Domain Path: /lang
|
11 |
*/
|
12 |
|
|
|
13 |
|
14 |
-
require_once('lib/class-wp-embed-fb-plugin.php');
|
15 |
-
|
16 |
-
require_once('lib/class-wp-embed-fb.php');
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
////Translation string
|
21 |
-
add_action('plugins_loaded',array('WP_Embed_FB_Plugin','plugins_loaded'));
|
22 |
-
//Donate or review notice
|
23 |
-
add_action('admin_notices',array('WP_Embed_FB_Plugin','admin_notices'));
|
24 |
-
add_action('wp_ajax_wpemfb_close_warning',array('WP_Embed_FB_Plugin','wpemfb_close_warning'));
|
25 |
-
add_action('wp_ajax_wpemfb_video_down',array('WP_Embed_FB_Plugin','wpemfb_video_down'));
|
26 |
|
27 |
-
|
28 |
-
register_uninstall_hook(__FILE__,
|
29 |
-
register_deactivation_hook(__FILE__, array('WP_Embed_FB_Plugin', 'deactivate'));
|
30 |
|
31 |
-
|
|
|
32 |
|
33 |
-
if( WP_Embed_FB_Plugin::get_option('fb_root') === 'true' )
|
34 |
-
add_filter('the_content', array('WP_Embed_FB','fb_root'),10,1);
|
35 |
|
36 |
-
|
37 |
|
38 |
-
|
|
|
|
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
add_action('admin_init', array('WP_Embed_FB_Admin','admin_init'));
|
45 |
-
add_action('admin_enqueue_scripts', array('WP_Embed_FB_Admin','admin_enqueue_scripts'), 10,1);
|
46 |
-
add_action('in_admin_footer',array('WP_Embed_FB_Admin','in_admin_footer'));
|
47 |
}
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
2 |
/*
|
3 |
Plugin Name: WP Embed Facebook
|
4 |
Plugin URI: http://www.wpembedfb.com
|
5 |
+
Description: Embed any public Facebook video, photo, album, event, page, comment, profile, or post. Add Facebook comments to all your site, insert facebook social plugins (like, save, send, share, follow, quote, comments) anywhere on your site. View the <a href="http://www.wpembedfb.com/demo-site/" title="plugin website" target="_blank">demo site</a>.
|
6 |
Author: Miguel Sirvent
|
7 |
+
Version: 2.1.1
|
8 |
Author URI: http://www.wpembedfb.com
|
9 |
Text Domain: wp-embed-facebook
|
10 |
Domain Path: /lang
|
11 |
*/
|
12 |
|
13 |
+
require_once( __DIR__ . '/lib/class-wef-social-plugins.php' );
|
14 |
|
15 |
+
require_once( __DIR__ . '/lib/class-wp-embed-fb-plugin.php' );
|
16 |
+
WP_Embed_FB_Plugin::hooks();
|
|
|
17 |
|
18 |
+
/** @see WP_Embed_FB_Plugin::install */
|
19 |
+
register_activation_hook( __FILE__, 'WP_Embed_FB_Plugin::install' );
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
/** @see WP_Embed_FB_Plugin::uninstall */
|
22 |
+
register_uninstall_hook( __FILE__, 'WP_Embed_FB_Plugin::uninstall' );
|
|
|
23 |
|
24 |
+
/** @see WP_Embed_FB_Plugin::deactivate */
|
25 |
+
register_deactivation_hook( __FILE__, 'WP_Embed_FB_Plugin::deactivate' );
|
26 |
|
|
|
|
|
27 |
|
28 |
+
require_once( __DIR__ . '/lib/class-wp-embed-fb.php' );
|
29 |
|
30 |
+
/* Magic here */
|
31 |
+
require_once( __DIR__ . '/lib/class-wef-magic-embeds.php' );
|
32 |
+
WEF_Magic_Embeds::hooks();
|
33 |
|
34 |
+
|
35 |
+
if ( WP_Embed_FB_Plugin::get_option( 'auto_comments_active' ) === 'true' ) {
|
36 |
+
require_once( __DIR__ . '/lib/class-wef-comments.php' );
|
37 |
+
WEF_Comments::hooks();
|
|
|
|
|
|
|
38 |
}
|
39 |
|
40 |
+
if ( is_admin() ) {
|
41 |
+
require_once( __DIR__ . '/lib/class-wp-embed-fb-admin.php' );
|
42 |
+
WP_Embed_FB_Admin::hooks();
|
43 |
+
|
44 |
+
/** @see WP_Embed_FB_Admin::add_action_link */
|
45 |
+
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'WP_Embed_FB_Admin::add_action_link' );
|
46 |
+
}
|
47 |
|