WP Embed Facebook - Version 3.0.0

Version Description

  • Improved: Translated API calls
  • Added: Url scraper
  • Added: Group social plugin
  • Removed: Deprecated social plugins
  • Removed: Events custom embeds because Facebook API changes, however, some functionality is still there on the premium version
  • Improved: Universal options page
  • Fixed: Comments count and order now on
  • Added: Facebook SDK v3.2
  • Added: Compatibility for visual themes
Download this release

Release Info

Developer poxtron
Plugin Icon 128x128 WP Embed Facebook
Version 3.0.0
Comparing to
See all releases

Code changes from version 3.0 to 3.0.0

Files changed (64) hide show
  1. LICENSE +674 -0
  2. inc/Admin.php +138 -0
  3. inc/Comments.php +229 -0
  4. inc/Embed_FB.php +616 -0
  5. inc/FB_API.php +213 -0
  6. inc/Framework.php +780 -0
  7. inc/Helpers.php +340 -0
  8. inc/Magic_Embeds.php +204 -0
  9. inc/Plugin.php +802 -0
  10. inc/Social_Plugins.php +685 -0
  11. inc/Widget.php +110 -0
  12. inc/css/admin.css +45 -0
  13. inc/deprecated/FacebookApiException.php +105 -0
  14. inc/deprecated/deprecated.php +115 -0
  15. inc/js/fb.js +65 -0
  16. inc/js/fb.min.js +1 -0
  17. library/Comments.php +0 -165
  18. library/Plugin_Framework.php +0 -544
  19. library/defaults.php +0 -9
  20. readme.txt +132 -81
  21. templates/classic/album.php +0 -38
  22. templates/classic/classic.css +0 -2
  23. templates/classic/classic.css.map +0 -7
  24. templates/classic/classic.sass +0 -220
  25. templates/classic/com-page.php +0 -32
  26. templates/classic/event.php +0 -37
  27. templates/classic/photo.php +0 -11
  28. templates/classic/post.php +0 -32
  29. templates/classic/profile.php +0 -26
  30. templates/classic/single-post.php +0 -142
  31. templates/classic/social-plugin.php +0 -23
  32. templates/classic/video.php +0 -30
  33. templates/comments.php +3 -1
  34. templates/{default → custom-embeds}/album.php +5 -2
  35. templates/{classic → custom-embeds}/page.php +9 -4
  36. templates/{default → custom-embeds}/photo.php +6 -3
  37. templates/{default → custom-embeds}/post.php +7 -5
  38. templates/{default → custom-embeds}/profile.php +7 -3
  39. templates/{default → custom-embeds}/single-post.php +21 -20
  40. templates/custom-embeds/social-plugin.php +27 -0
  41. templates/custom-embeds/styles.css +1 -0
  42. templates/custom-embeds/styles.css.map +1 -0
  43. templates/custom-embeds/styles.scss +393 -0
  44. templates/default/com-page.php +0 -32
  45. templates/default/default.css +0 -2
  46. templates/default/default.css.map +0 -7
  47. templates/default/default.sass +0 -218
  48. templates/default/event.php +0 -37
  49. templates/default/page.php +0 -47
  50. templates/default/social-plugin.php +0 -23
  51. templates/default/video.php +0 -30
  52. templates/images/comments.png +0 -0
  53. templates/images/like.png +0 -0
  54. templates/images/share.png +0 -0
  55. templates/lightbox/css/lightbox.css +1 -0
  56. templates/lightbox/css/lightbox.css.map +1 -0
  57. templates/lightbox/css/lightbox.sass +165 -0
  58. templates/lightbox/images/close.png +0 -0
  59. templates/lightbox/images/loading.gif +0 -0
  60. templates/lightbox/images/next.png +0 -0
  61. templates/lightbox/images/prev.png +0 -0
  62. templates/lightbox/js/lightbox.js +500 -0
  63. templates/lightbox/js/lightbox.min.js +1 -0
  64. wp-embed-facebook.php +36 -58
LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ {one line to give the program's name and a brief idea of what it does.}
635
+ Copyright (C) {year} {name of author}
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ {project} Copyright (C) {year} {fullname}
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <http://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
inc/Admin.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adds wp-admin related actions and filters.
4
+ *
5
+ * @package WP Embed Facebook
6
+ * @subpackage Admin
7
+ */
8
+
9
+ namespace SIGAMI\WP_Embed_FB;
10
+
11
+ // If this file is called directly, abort.
12
+ if ( ! defined( 'WPINC' ) ) {
13
+ die;
14
+ }
15
+
16
+ class Admin {
17
+
18
+ private static $instance = null;
19
+
20
+ static $url = null;
21
+
22
+ static function instance() {
23
+ if ( self::$instance === null ) {
24
+ self::$instance = new self();
25
+ }
26
+
27
+ return self::$instance;
28
+ }
29
+
30
+ private function __construct() {
31
+
32
+ self::$url = admin_url( 'options-general.php?page=' . Plugin::$menu_slug );
33
+
34
+ //notices
35
+ if ( ! Plugin::is_on( 'close_warning2' ) ) {
36
+ add_action( 'admin_notices', __CLASS__ . '::admin_notices' );
37
+ add_action( 'wp_ajax_wpemfb_close_warning', __CLASS__ . '::wpemfb_close_warning' );
38
+ add_action( 'in_admin_footer', __CLASS__ . '::in_admin_footer' );
39
+ }
40
+
41
+ //editor style
42
+ add_action( 'admin_init', __CLASS__ . '::admin_init' );
43
+
44
+ //register styles and scripts
45
+ add_action( 'admin_enqueue_scripts', __CLASS__ . '::admin_enqueue_scripts' );
46
+
47
+ add_filter( 'plugin_action_links_' . plugin_basename( Plugin::$FILE ),
48
+ __CLASS__ . '::add_action_link' );
49
+
50
+ }
51
+
52
+ static function admin_notices() {
53
+ ob_start();
54
+ ?>
55
+ <div class="notice wpemfb_warning is-dismissible">
56
+ <h2>WP Embed Facebook</h2>
57
+ <p>
58
+ <?php
59
+ printf( __( 'To enable comment moderation and embed albums, events, profiles and video as HTML5 setup a facebook app on <a id="wef_settings_link" href="%s">settings</a>',
60
+ 'wp-embed-facebook' ), Admin::$url )
61
+ ?>
62
+ </p>
63
+ </div>
64
+ <?php
65
+ echo ob_get_clean();
66
+ }
67
+
68
+ static function wpemfb_close_warning() {
69
+ if ( current_user_can( 'manage_options' ) ) {
70
+ $options = Plugin::get_option();
71
+ $options['close_warning2'] = 'true';
72
+ Plugin::set_options( $options );
73
+ }
74
+ die;
75
+ }
76
+
77
+ static function in_admin_footer() {
78
+ ob_start();
79
+ ?>
80
+ <script type="text/javascript">
81
+ jQuery(document).on('click', '.wpemfb_warning .notice-dismiss', function () {
82
+ jQuery.post(ajaxurl, {action: 'wpemfb_close_warning'});
83
+ });
84
+
85
+ jQuery(document).on('click', '#wef_settings_link', function (e) {
86
+ e.preventDefault();
87
+ jQuery.post(ajaxurl, {action: 'wpemfb_close_warning'}, function () {
88
+ window.location = "<?php echo Admin::$url; ?>"
89
+ });
90
+
91
+ });
92
+ </script>
93
+ <?php
94
+ echo ob_get_clean();
95
+ }
96
+
97
+ /**
98
+ * Enqueue WP Embed Facebook js and css to admin page
99
+ *
100
+ * @param string $hook_suffix current page
101
+ */
102
+ static function admin_enqueue_scripts( $hook_suffix ) {
103
+ if ( $hook_suffix == 'settings_page_' . Plugin::$menu_slug ) {
104
+ wp_enqueue_style( 'wpemfb-admin-css', Plugin::url() . 'inc/css/admin.css' );
105
+ }
106
+
107
+ wp_enqueue_style( 'wpemfb-custom', Plugin::url() . 'templates/custom-embeds/styles.css', [],
108
+ Plugin::VER );
109
+ }
110
+
111
+ static function add_action_link( $links ) {
112
+ array_unshift( $links,
113
+ '<a title="WP Embed Facebook Settings" href="' . Admin::$url . '">' . __( "Settings" )
114
+ . '</a>' );
115
+
116
+ return $links;
117
+ }
118
+
119
+ /**
120
+ * Add template editor style to the embeds.
121
+ */
122
+ static function admin_init() {
123
+ add_filter( 'mce_css', __CLASS__ . '::mce_css' );
124
+ }
125
+
126
+ static function mce_css( $css ) {
127
+
128
+ $styles = add_query_arg( 'version', Plugin::VER,
129
+ Plugin::url() . 'templates/custom-embeds/styles.css' );
130
+
131
+ if ( ! empty( $css ) ) {
132
+ $css .= ',';
133
+ }
134
+
135
+ return $css . $styles;
136
+ }
137
+
138
+ }
inc/Comments.php ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Comments helper.
4
+ *
5
+ * @package WP Embed Facebook
6
+ */
7
+
8
+ namespace SIGAMI\WP_Embed_FB;
9
+
10
+ // If this file is called directly, abort.
11
+ if ( ! defined( 'WPINC' ) ) {
12
+ die;
13
+ }
14
+
15
+ /**
16
+ * Handles comments auto embeds and comment count synchronization. It includes all actions and
17
+ * filters. Comments plugin can also be invoked using the [fb_plugin comments] shortocode.
18
+ *
19
+ * @see WEF_Social_Plugins
20
+ */
21
+ class Comments {
22
+
23
+ public static $current_post_type = '';
24
+
25
+ private static $instance = null;
26
+
27
+ static function instance() {
28
+ if ( self::$instance === null ) {
29
+ self::$instance = new self();
30
+ }
31
+
32
+ return self::$instance;
33
+ }
34
+
35
+ private function __construct() {
36
+ /** @see Comments::comments_template */
37
+ add_filter( 'comments_template', __CLASS__ . '::comments_template' );
38
+
39
+ if ( Plugin::get_option( 'comments_count_active' ) === 'true' ) {
40
+
41
+ /** @see Comments::get_comments_number */
42
+ add_filter( 'get_comments_number', __CLASS__ . '::get_comments_number', 10, 2 );
43
+
44
+ /** @see Comments::save_post */
45
+ add_action( 'save_post', __CLASS__ . '::save_post', 10, 3 );
46
+
47
+ /** @see Comments::pre_get_posts */
48
+ add_action( 'pre_get_posts', __CLASS__ . '::pre_get_posts' );
49
+
50
+ /** @see Comments::wpemfb_comments */
51
+ add_filter( 'wp_ajax_wpemfb_comments', __CLASS__ . '::wpemfb_comments' );
52
+ add_filter( 'wp_ajax_nopriv_wpemfb_comments', __CLASS__ . '::wpemfb_comments' );
53
+
54
+ /** @see Comments::uninstall */
55
+ add_action( Plugin::$option . '_uninstall', __CLASS__ . '::uninstall' );
56
+ }
57
+
58
+ if ( Plugin::get_option( 'comments_open_graph' ) === 'true' ) {
59
+ /** @see Comments::wp_head */
60
+ add_action( 'wp_head', __CLASS__ . '::wp_head' );
61
+ }
62
+ }
63
+
64
+ static function active_on_post_type() {
65
+ global $post_type, $post;
66
+
67
+ $allowed_post_types = Plugin::get_option( 'auto_comments_post_types' );
68
+
69
+ if ( in_array( self::$current_post_type, $allowed_post_types )
70
+ || in_array( $post_type, $allowed_post_types )
71
+ || ( ( $post instanceof \WP_Post )
72
+ && in_array( $post->post_type, $allowed_post_types ) ) ) {
73
+ return true;
74
+ }
75
+
76
+ return false;
77
+ }
78
+
79
+ static function uninstall() {
80
+ delete_post_meta_by_key( '_wef_comment_count' );
81
+ }
82
+
83
+ /**
84
+ * Adds FB open graph app_id meta tag to head
85
+ */
86
+ static function wp_head() {
87
+ $app_id = Plugin::get_option( 'app_id' );
88
+ if ( ! empty( $app_id ) ) {
89
+ echo '<meta property="fb:app_id" content="' . $app_id . '" />' . PHP_EOL;
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Replace theme template for FB comments.
95
+ *
96
+ * @param $template
97
+ *
98
+ * @return string
99
+ */
100
+ static function comments_template( $template ) {
101
+
102
+ if ( ! self::active_on_post_type() ) {
103
+ return $template;
104
+ }
105
+
106
+ $template = Plugin::path() . 'templates/comments.php';
107
+
108
+ return $template;
109
+ }
110
+
111
+ /**
112
+ * @see get_comments_number
113
+ *
114
+ * @param string $number Number of comments on WP
115
+ * @param int $post_id
116
+ *
117
+ * @return mixed|string
118
+ */
119
+ static function get_comments_number( $number, $post_id ) {
120
+
121
+ //Detect post type if this function is called on an ajax call
122
+ if ( wp_doing_ajax() ) {
123
+ if ( empty( self::$current_post_type ) ) {
124
+ self::$current_post_type = get_post_type( $post_id );
125
+ }
126
+ }
127
+
128
+ if ( ! self::active_on_post_type() ) {
129
+ return $number;
130
+ }
131
+
132
+ $count = get_post_meta( $post_id, '_wef_comment_count', true );
133
+ if ( $count ) {
134
+ return $count;
135
+ }
136
+
137
+ return '0';
138
+ }
139
+
140
+ /**
141
+ * Update the comment count on post update
142
+ *
143
+ * @param $post_id
144
+ * @param $post
145
+ * @param $update
146
+ */
147
+ static function save_post( $post_id, $post, $update ) {
148
+ self::$current_post_type = get_post_type( $post );
149
+ if ( wp_is_post_revision( $post_id )
150
+ || ! $update
151
+ || ! self::active_on_post_type() ) {
152
+ return;
153
+ }
154
+
155
+ $fbapi = FB_API::instance();
156
+
157
+ $old_token = $fbapi->getAccessToken();
158
+ $fbapi->setAccessToken(null);
159
+ $data = FB_API::instance()
160
+ ->run( "?fields=share{comment_count}&id=" . home_url( "/?p=$post_id" ) );
161
+ $fbapi->setAccessToken($old_token);
162
+
163
+ if ( ! is_wp_error( $data )
164
+ && isset( $data['share'] )
165
+ && isset( $data['share']['comment_count'] ) ) {
166
+ update_post_meta( $post->ID, '_wef_comment_count',
167
+ intval( $data['share']['comment_count'] ) );
168
+ }
169
+ }
170
+
171
+ /**
172
+ * Alter order by 'comment_count' to use _wef_comment_count meta instead
173
+ *
174
+ * @param \WP_Query $query
175
+ *
176
+ * @return \WP_Query
177
+ */
178
+ static function pre_get_posts( $query ) {
179
+
180
+ self::$current_post_type = $query->get( 'post_type' );
181
+
182
+ if ( self::active_on_post_type()
183
+ && isset( $query->query_vars['orderby'] )
184
+ && $query->query_vars['orderby'] == 'comment_count' ) {
185
+ $query->set( 'meta_query', [
186
+ 'relation' => 'OR',
187
+ [
188
+ 'key' => '_wef_comment_count',
189
+ 'compare' => 'NOT EXISTS'
190
+ ],
191
+ [
192
+ 'key' => '_wef_comment_count',
193
+ 'compare' => 'EXISTS'
194
+ ]
195
+ ] );
196
+ $query->set( 'orderby', 'meta_value_num' );
197
+ }
198
+
199
+ return $query;
200
+ }
201
+
202
+ /**
203
+ * Ajax function for updating comment count
204
+ */
205
+ static function wpemfb_comments() {
206
+ if ( isset( $_POST['response'] ) && isset( $_POST['response']['href'] ) ) {
207
+ $post_id = url_to_postid( $_POST['response']['href'] );
208
+ $count = self::get_comments_number( '', $post_id );
209
+ if ( isset( $_POST['response']['message'] ) ) {
210
+ $count ++;
211
+ } else {
212
+ $count --;
213
+ }
214
+ update_post_meta( $post_id, '_wef_comment_count', intval( $count ) );
215
+
216
+ /**
217
+ * Action triggered after posts comments counts get updated.
218
+ *
219
+ * @param integer $post_id Post id.
220
+ * @param object $response Facebook event response.
221
+ *
222
+ * @todo save info of the last 50 comments for recent comments widget on extended embeds.
223
+ * @since unknown
224
+ */
225
+ do_action( 'wef_updated_comment', $post_id, $_POST['response'] );
226
+ }
227
+ wp_die();
228
+ }
229
+ }
inc/Embed_FB.php ADDED
@@ -0,0 +1,616 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Shortcode helper.
4
+ *
5
+ * @package WP Embed Facebook
6
+ */
7
+
8
+ namespace SIGAMI\WP_Embed_FB;
9
+
10
+ // If this file is called directly, abort.
11
+ if ( ! defined( 'WPINC' ) ) {
12
+ die;
13
+ }
14
+
15
+ class Embed_FB {
16
+ /**
17
+ * @var string Width of the current embed
18
+ */
19
+ static $width = null;
20
+ /**
21
+ * @var bool|null if the current embed is in raw format
22
+ */
23
+ static $raw = null;
24
+ /**
25
+ * @var string Theme to use on the embed
26
+ */
27
+ static $theme = null;
28
+ /**
29
+ * @var int|null Number of posts on the page embed
30
+ */
31
+ static $num_posts = null;
32
+ /**
33
+ * @var int|null Number of photos on album
34
+ */
35
+ static $num_photos = null;
36
+
37
+ /* MAGIC HERE */
38
+
39
+ /**
40
+ * Shortcode function
41
+ * [facebook='url' width='600' raw='true' social_plugin='true' posts='2' ] width is optional
42
+ *
43
+ * @param array $atts [0]=>url ['width']=>embed width ['raw']=>for videos and photos
44
+ *
45
+ * @return string
46
+ */
47
+ static function shortcode( $atts ) {
48
+
49
+ $compat = [ 'href', 'uri', 'src', 'url', 'link' ];
50
+ foreach ( $compat as $com ) {
51
+ if ( isset( $atts[ $com ] ) ) {
52
+ $atts[0] = $atts[ $com ];
53
+ unset( $atts[ $com ] );
54
+ }
55
+ }
56
+ if ( ! empty( $atts ) && isset( $atts[0] ) ) {
57
+ $clean = trim( $atts[0], '=' );
58
+ $clean = html_entity_decode( $clean );
59
+
60
+ if ( is_numeric( $clean ) ) {
61
+ $juice = $clean;
62
+ $clean = "https://www.facebook.com/$juice";
63
+ } else {
64
+ if ( strpos( $clean, 'facebook.com' ) === false ) {
65
+ return "<p>" . __( "This is not a valid facebook url", "wp-embed-facebook" ) . " $clean </p>";
66
+ }
67
+ $juice = str_replace( [
68
+ 'https:',
69
+ 'http:',
70
+ '//facebook.com/',
71
+ '//m.facebook.com/',
72
+ '//www.facebook.com/'
73
+ ], '', $clean );
74
+ }
75
+ $embed = self::fb_embed( [ 'https', '://www.facebook.com/', $juice ], $clean, $atts );
76
+
77
+ return $embed;
78
+ }
79
+
80
+ return sprintf( __( /** @lang text */
81
+ 'You are using the [facebook] shortcode wrong. See examples <a title="Examples" target="_blank" href="%s" >here</a>.',
82
+ 'wp-embed-facebook' ), 'http://www.wpembedfb.com' );
83
+ }
84
+
85
+ /**
86
+ * Run rabbit
87
+ *
88
+ * @param $match
89
+ * @param null $url
90
+ * @param null $atts
91
+ *
92
+ * @return mixed|null|string|string[]
93
+ */
94
+ static function fb_embed( $match, $url = null, $atts = null ) {
95
+ $juice = $match[2];
96
+ self::set_atts( $atts );
97
+
98
+ /**
99
+ * Allows filtering facebook embed id and type.
100
+ *
101
+ * @param string|array $id_type Type and id.
102
+ * @param string $juice Juice.
103
+ * @param string $url Url.
104
+ *
105
+ * @since unknown
106
+ */
107
+ $type_and_id = apply_filters( 'wpemfb_type_id', self::get_type_and_id( $juice, $url ), $juice, $url );
108
+
109
+ if ( is_string( $type_and_id ) ) {
110
+ return $type_and_id;
111
+ }
112
+
113
+ if ( Plugin::get_option( 'enq_when_needed' ) == 'true' ) {
114
+ if ( $type_and_id['type'] == 'album' ) {
115
+ if ( Plugin::get_option( 'enq_lightbox' ) == 'true' ) {
116
+ wp_enqueue_script( 'wpemfb-lightbox' );
117
+ wp_enqueue_style( 'wpemfb-lightbox' );
118
+ }
119
+ }
120
+ if ( Plugin::get_option( 'enq_fbjs' ) == 'true' ) {
121
+ wp_enqueue_script( 'wpemfb-fbjs' );
122
+ }
123
+ }
124
+ if ( self::is_raw( $type_and_id['type'] ) ) {
125
+ wp_enqueue_style( 'wpemfb-custom' );
126
+ //Legacy support for custom embeds on
127
+ wp_enqueue_style( 'wpemfb-' . self::get_theme() );
128
+ }
129
+
130
+ /**
131
+ * Action is triggered while generating embed code.
132
+ *
133
+ * @since unknown
134
+ */
135
+ do_action( 'wp_embed_fb' );
136
+
137
+ $return = self::print_embed( $type_and_id['fb_id'], $type_and_id['type'], $juice );
138
+ if(is_wp_error($return)){
139
+ $return = $return->get_error_message();
140
+ }
141
+ self::clear_atts();
142
+
143
+ return $return;
144
+ }
145
+
146
+ /**
147
+ * @param $juice
148
+ * @param $original
149
+ *
150
+ * @return array|string
151
+ */
152
+ static function get_type_and_id( $juice, $original ) {
153
+ $has_fb_app = Helpers::has_fb_app();
154
+ $fbsdk = FB_API::instance();
155
+ $access_token = apply_filters( 'wef_access_token', $fbsdk->getAccessToken() );
156
+ $fbsdk->setAccessToken( $access_token );
157
+ $fb_id = null;
158
+ $type = null;
159
+ if ( ( $pos = strpos( $juice, "?" ) ) !== false ) {
160
+ $vars = [];
161
+ parse_str( parse_url( $juice, PHP_URL_QUERY ), $vars );
162
+ if ( isset( $vars['fbid'] ) ) {
163
+ $fb_id = $vars['fbid'];
164
+ }
165
+ if ( isset( $vars['id'] ) ) {
166
+ $fb_id = $vars['id'];
167
+ }
168
+ if ( isset( $vars['v'] ) ) {
169
+ $fb_id = $vars['v'];
170
+ $type = 'video';
171
+ }
172
+ if ( isset( $vars['set'] ) ) {
173
+ $setArray = explode( '.', $vars['set'] );
174
+ $fb_id = $setArray[1];
175
+ $type = 'album';
176
+ }
177
+
178
+ if ( isset( $vars['album_id'] ) ) {
179
+ $fb_id = $vars['album_id'];
180
+ $type = 'album';
181
+ }
182
+
183
+ if ( isset( $vars['story_fbid'] ) ) {
184
+ $fb_id = $vars['story_fbid'];
185
+ $type = 'post';
186
+ }
187
+
188
+ $juice = substr( $juice, 0, $pos );
189
+ }
190
+ $juiceArray = explode( '/', trim( $juice, '/' ) );
191
+ if ( ! $fb_id ) {
192
+ $fb_id = end( $juiceArray );
193
+ $fb_id_array = explode( '-', $fb_id );
194
+ if ( is_numeric( end( $fb_id_array ) ) ) {
195
+ $fb_id = end( $fb_id_array );
196
+ }
197
+ $fb_id = str_replace( ':0', '', $fb_id );
198
+ }
199
+ if ( ! $type ) {
200
+ if ( in_array( 'posts', $juiceArray ) ) {
201
+ $type = 'post';
202
+ if ( $has_fb_app && ( self::is_raw( 'post' ) ) ) {
203
+ try {
204
+ /** @noinspection PhpUndefinedVariableInspection */
205
+ $data = $fbsdk->api( '/' . $juiceArray[0] . '?fields=id' );
206
+ $fb_id = $data['id'] . '_' . $fb_id;
207
+ } catch ( \Exception $e ) {
208
+ $res = '<p><a href="' . $original . '" target="_blank" rel="nofollow">' . $original . '</a>';
209
+ if ( is_super_admin() ) {
210
+ if ( $e->getCode() == '803' ) {
211
+ $res .= '<br><span style="color: #4a0e13">'
212
+ . __( 'Error: Try embedding this post as a social plugin (only visible to admins)',
213
+ 'wp-embed-facebook' ) . '</span>';
214
+ } else {
215
+ $res .= '<br><span style="color: #4a0e13">' . __( 'Code' ) . ':&nbsp;' . $e->getCode()
216
+ . '&nbsp;in type</span>';
217
+ $res .= '<br><span style="color: #4a0e13">' . __( 'Error' ) . ':&nbsp;'
218
+ . $e->getMessage() . ' (only visible to admins)</span>';
219
+ }
220
+ }
221
+ $res .= '</p>';
222
+
223
+ return $res;
224
+ }
225
+ }
226
+ } elseif ( in_array( 'photos', $juiceArray ) || in_array( 'photo.php', $juiceArray ) ) {
227
+ $type = 'photo';
228
+ } elseif ( end( $juiceArray ) == 'events' ) {
229
+ $type = 'events';
230
+ } elseif ( in_array( 'events', $juiceArray ) ) {
231
+ $type = 'event';
232
+ } elseif ( in_array( 'videos', $juiceArray ) || in_array( 'video.php', $juiceArray ) ) {
233
+ $type = 'video';
234
+ }
235
+ }
236
+
237
+ /**
238
+ * Filter the embed type.
239
+ *
240
+ * @since 1.8
241
+ *
242
+ * @param string $type the embed type.
243
+ * @param array $clean url parts of the request.
244
+ */
245
+ $type = apply_filters( 'wpemfb_embed_type', $type, $juiceArray );
246
+
247
+ if ( ! $type ) {
248
+ if ( $has_fb_app ) {
249
+ try {
250
+ /** @noinspection PhpUndefinedVariableInspection */
251
+ $metadata = $fbsdk->api( '/' . $fb_id . '?metadata=1' );
252
+ $type = $metadata['metadata']['type'];
253
+ } catch ( \Exception $e ) {
254
+ $res = '<p><a href="https://www.facebook.com/' . $juice
255
+ . '" target="_blank" rel="nofollow">https://www.facebook.com/' . $juice . '</a>';
256
+ if ( is_super_admin() ) {
257
+ $res .= '<br><span style="color: #4a0e13">' . __( 'Code' ) . ':&nbsp;' . $e->getCode()
258
+ . '&nbsp;' . $type . '</span>';
259
+ $res .= '<br><span style="color: #4a0e13">' . __( 'Error' ) . ':&nbsp;' . $e->getMessage()
260
+ . ' (only visible to admins)</span>';
261
+ }
262
+ $res .= '</p>';
263
+
264
+ return $res;
265
+ }
266
+ } else {
267
+ $type = 'page';
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Filter the FB id.
273
+ *
274
+ * @param integer $fb_id Facebook id.
275
+ * @param array $juiceArray Juice array.
276
+ *
277
+ * @since unknown
278
+ */
279
+ $fb_id = apply_filters( 'wpemfb_embed_fb_id', $fb_id, $juiceArray, $type );
280
+
281
+ return [ 'type' => $type, 'fb_id' => $fb_id ];
282
+ }
283
+
284
+ static function print_embed( $fb_id, $type, $juice ) {
285
+
286
+ /**
287
+ * Short circuit `print_embed`. If `true` is returned.
288
+ *
289
+ * @param boolean $ret Return.
290
+ * @param integer $fb_id Facebook id.
291
+ * @param string $type Type.
292
+ * @param string $juice Juice.
293
+ *
294
+ * @since unknwon
295
+ */
296
+ $interrupt = apply_filters( 'wef_interrupt', '', $fb_id, $type, $juice );
297
+
298
+ if ( $interrupt ) {
299
+ return $interrupt;
300
+ }
301
+
302
+ if ( ! self::is_raw( $type ) || $type == 'video' || $type == 'group' ) {
303
+ $fb_data = [ 'social_plugin' => true, 'link' => $juice, 'type' => $type ];
304
+ $template_name = 'social-plugin';
305
+ } else {
306
+ switch ( $type ) {
307
+ case 'page' :
308
+ case 'photo' :
309
+ case 'post':
310
+ case 'album' :
311
+ $fb_data = self::fb_api_get( $fb_id, $juice, $type );
312
+ $template_name = $type;
313
+ break;
314
+ case 'user' :
315
+ $fb_data = self::fb_api_get( $fb_id, $juice, 'profile' );
316
+ $template_name = 'profile';
317
+ break;
318
+ default :
319
+ $fb_data = self::fb_api_get( $fb_id, $juice, $type );
320
+ $template_name = $type;
321
+ break;
322
+ }
323
+ }
324
+
325
+ if ( ! self::valid_fb_data( $fb_data ) ) {
326
+ if ( is_string( $fb_data ) ) {
327
+ return new \WP_Error('api_error',$fb_data);
328
+ }
329
+
330
+ return print_r( $fb_data, true );
331
+ }
332
+
333
+ //get default variables to use on templates
334
+ /** @noinspection PhpUnusedLocalVariableInspection */
335
+ $width = ! empty( self::$width ) ? self::$width : Plugin::get_option( 'max_width' );
336
+ $theme = ! empty( self::$theme ) ? self::$theme : Plugin::get_option( 'theme' );
337
+ /** @noinspection PhpUnusedLocalVariableInspection */
338
+ ob_start();
339
+ //show embed post on admin
340
+ if ( is_admin()
341
+ || wp_doing_ajax()
342
+ || ( isset( $_GET['action'] ) && $_GET['action'] == 'cs_render_element' )//X Theme compat
343
+ || isset( $_GET['et_fb'] ) //Divi builder compatibility. The most awesome builder BTW
344
+ ) : ?>
345
+ <script>(function (d, s, id) {
346
+ let js, fjs = d.getElementsByTagName(s)[0];
347
+ if (d.getElementById(id)) return;
348
+ js = d.createElement(s);
349
+ js.id = id;
350
+ js.src = "//connect.facebook.net/<?php echo Plugin::get_option( 'sdk_lang' ); ?>/sdk.js#xfbml=1&version=<?php echo Plugin::get_option( 'sdk_version' ) ?>";
351
+ fjs.parentNode.insertBefore(js, fjs);
352
+ }(document, 'script', 'facebook-jssdk'));
353
+ FB.XFBML.parse();</script>
354
+ <?php endif;
355
+
356
+ /**
357
+ * Use this filter to remove `WP Embed Facebook` copyright comment from HTML.
358
+ *
359
+ * I could have hardcoded this but... I know you will leave it there :)
360
+ *
361
+ * @param string $text Copyright text.
362
+ *
363
+ * @since unknown
364
+ */
365
+ echo apply_filters( 'wef_embedded_with', '<!-- Embedded with WP Embed Facebook - http://wpembedfb.com -->' );
366
+
367
+ $template = self::locate_template( $template_name );
368
+
369
+ /**
370
+ * Change the file to include on a certain embed.
371
+ *
372
+ * @since 1.8
373
+ *
374
+ * @param string $template file full path
375
+ * @param array $fb_data data from facebook
376
+ */
377
+ $template = apply_filters( 'wpemfb_template', $template, $fb_data, $type );
378
+ /** @noinspection PhpIncludeInspection */
379
+ include( $template );
380
+
381
+ return preg_replace( '/^\s+|\n|\r|\s+$/m', '', ob_get_clean() );
382
+ }
383
+
384
+ /**
385
+ * get data from fb using WP_Embed_FB::$fbsdk->api('/'.$fb_id) :)
386
+ *
387
+ * @param int $fb_id Facebook id
388
+ * @param string $url Facebook url
389
+ *
390
+ * @type string type of embed
391
+ * @return array|string
392
+ */
393
+ static function fb_api_get( $fb_id, $url, $type = "" ) {
394
+ if ( Helpers::has_fb_app() ) {
395
+
396
+ /**
397
+ * Allow passing custom data before getting data from `WP_Embed_FB::$fbsdk->api('/'.$fb_id)`.
398
+ *
399
+ * @param array $fb_data FB data.
400
+ * @param string $type Type.
401
+ * @param integer $fb_id FB id.
402
+ * @param string $url url.
403
+ */
404
+ $fb_data = apply_filters( 'wpemfb_custom_fb_data', [], $type, $fb_id, $url );
405
+
406
+ if ( empty( $fb_data ) ) {
407
+ $fbsdk = FB_API::instance();
408
+ try {
409
+ switch ( $type ) {
410
+ case 'album' :
411
+ self::$num_photos = is_numeric( self::$num_photos ) ? self::$num_photos
412
+ : Plugin::get_option( 'max_photos' );
413
+ $api_string = $fb_id
414
+ . '?fields=name,id,from,description,count,photos.fields(name,picture,source,id).limit('
415
+ . self::$num_photos . ')';
416
+ break;
417
+ case 'page' :
418
+ $num_posts = is_numeric( self::$num_posts ) ? self::$num_posts
419
+ : Plugin::get_option( 'max_posts' );
420
+ $api_string = $fb_id . '?locale=' . Plugin::get_option( 'sdk_lang' )
421
+ . '&fields=name,picture,is_community_page,link,id,cover,category,website,genre,fan_count';
422
+ if ( intval( $num_posts ) > 0 ) {
423
+ $api_string .= ',posts.limit(' . $num_posts
424
+ . '){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)}';
425
+ }
426
+ break;
427
+ case 'photo' :
428
+ $api_string = $fb_id
429
+ . '?fields=id,source,link,likes.limit(1).summary(true),comments.limit(1).summary(true)';
430
+ break;
431
+ case 'post' :
432
+ $api_string = $fb_id . '?locale=' . Plugin::get_option( 'sdk_lang' )
433
+ . '&fields=from{id,name,likes,link},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)';
434
+ break;
435
+ default :
436
+ $api_string = $fb_id;
437
+ break;
438
+ }
439
+ /**
440
+ * Filter the fist fbsdk query
441
+ *
442
+ * @since 1.9
443
+ *
444
+ * @param string $api_string The fb api request string according to type
445
+ * @param string $fb_id The id of the object being requested.
446
+ * @param string $type The detected type of embed
447
+ *
448
+ */
449
+ $api_string = apply_filters( 'wpemfb_api_string', $api_string, $fb_id, $type );
450
+
451
+ $fb_data = $fbsdk->api( Plugin::get_option( 'sdk_version' ) . '/' . $api_string );
452
+
453
+ $api_string2 = '';
454
+
455
+ /**
456
+ * Filter the second fbsdk query if necessary
457
+ *
458
+ * @since 1.9
459
+ *
460
+ * @param string $api_string2 The second request string empty if not necessary
461
+ * @param array $fb_data The result from the first query
462
+ * @param string $type The detected type of embed
463
+ *
464
+ */
465
+ $api_string2 = apply_filters( 'wpemfb_2nd_api_string', $api_string2, $fb_data, $type );
466
+
467
+ if ( ! empty( $api_string2 ) ) {
468
+ $extra_data = $fbsdk->api( Plugin::get_option( 'sdk_version' ) . '/' . $api_string2 );
469
+ $fb_data = array_merge( $fb_data, $extra_data );
470
+ }
471
+ } catch ( \Exception $e ) {
472
+
473
+ $fb_data = '<p><a href="https://www.facebook.com/' . $url
474
+ . '" target="_blank" rel="nofollow">https://www.facebook.com/' . $url . '</a>';
475
+ if ( is_super_admin() ) {
476
+ $fb_data .= '<br><small style="color: #4a0e13">' . __( 'Error' ) . ':&nbsp;' . $e->getMessage()
477
+ . ' (only visible to admins)</small>';
478
+ if ( $type == 'event' || $type == 'events' ) {
479
+ $fb_data .= '<br><small style="color: #114ac2">'
480
+ . sprintf( __( 'You can embed this resource with Extended Embeds Add-on visit %s to know more',
481
+ 'wp-embed-facebook' ), 'https://wpembedfb.com' ) . '</small>';
482
+ $fb_data .= '</p>';
483
+ }
484
+ }
485
+ $fb_data .= '</p>';
486
+
487
+ }
488
+ }
489
+ } else {
490
+ $fb_data = '<p><a href="https://www.facebook.com/' . $url
491
+ . '" target="_blank" rel="nofollow">https://www.facebook.com/' . $url . '</a>';
492
+ if ( is_super_admin() ) {
493
+ $fb_data .= '<br><span style="color: #4a0e13">' . sprintf( __( /** @lang text */
494
+ '<small>To embed this type of content you need to setup a facebook app on <a href="%s" title="WP Embed Facebook Settings">settings</a></small>',
495
+ 'wp-embed-facebook' ), Admin::$url ) . '</span>';
496
+ }
497
+ $fb_data .= '</p>';
498
+ }
499
+
500
+ /**
501
+ * Filter fb_data
502
+ *
503
+ * @since 1.9
504
+ *
505
+ * @param array $fb_data the final result
506
+ * @param string $type The detected type of embed
507
+ */
508
+ $fb_data = apply_filters( 'wpemfb_fb_data', $fb_data, $type );
509
+
510
+ return $fb_data;
511
+ }
512
+
513
+ static function set_atts( $atts ) {
514
+ if ( Helpers::has_photon() ) {
515
+ add_filter( 'jetpack_photon_skip_image', '__return_false' );
516
+ }
517
+ if ( isset( $atts['width'] ) ) {
518
+ self::$width = $atts['width'];
519
+ }
520
+ if ( isset( $atts['raw'] ) ) {
521
+ if ( $atts['raw'] == 'true' ) {
522
+ self::$raw = true;
523
+ } else {
524
+ self::$raw = false;
525
+ }
526
+ }
527
+
528
+ if ( isset( $atts['custom_embed'] ) ) {
529
+ self::$raw = true;
530
+ } elseif ( isset( $atts['social_plugin'] ) ) {
531
+ if ( $atts['social_plugin'] == 'true' ) {
532
+ self::$raw = false;
533
+ } else {
534
+ self::$raw = true;
535
+ }
536
+ }
537
+
538
+ if ( isset( $atts['theme'] ) ) {
539
+ self::$theme = $atts['theme'];
540
+ }
541
+ if ( isset( $atts['posts'] ) ) {
542
+ self::$num_posts = intval( $atts['posts'] );
543
+ }
544
+ if ( isset( $atts['photos'] ) ) {
545
+ self::$num_photos = intval( $atts['photos'] );
546
+ }
547
+ }
548
+
549
+ static function clear_atts() {
550
+ self::$width = self::$raw = self::$num_posts = self::$theme = self::$num_photos = null;
551
+ if ( Helpers::has_photon() ) {
552
+ add_filter( 'jetpack_photon_skip_image', '__return_true' );
553
+ }
554
+ }
555
+
556
+ /* UTILITIES */
557
+
558
+ static function get_theme() {
559
+ if ( self::$theme ) {
560
+ return self::$theme;
561
+ } else {
562
+ self::$theme = Plugin::get_option( 'theme' );
563
+
564
+ return self::$theme;
565
+ }
566
+ }
567
+
568
+ static function is_raw( $type ) {
569
+ if ( self::$raw !== null ) {
570
+ return self::$raw;
571
+ } else {
572
+ switch ( $type ) {
573
+ case 'page':
574
+ case 'photo':
575
+ case 'post':
576
+ self::$raw = ( Plugin::get_option( 'raw_' . $type ) === 'false' ) ? false : true;
577
+ break;
578
+ default:
579
+ self::$raw = true;
580
+ break;
581
+ }
582
+
583
+ return self::$raw;
584
+ }
585
+ }
586
+
587
+ /**
588
+ * Locate the template inside plugin or theme
589
+ *
590
+ * @param string $template_name Template file name
591
+ *
592
+ * @return string Template location
593
+ */
594
+ static function locate_template( $template_name ) {
595
+ $theme = self::get_theme();
596
+ $located = locate_template( [
597
+ 'plugins/wp-embed-facebook/custom-embeds/' . $template_name . '.php',
598
+ 'plugins/wp-embed-facebook/' . $theme . '/' . $template_name . '.php',
599
+ ] );
600
+ if ( empty( $located ) ) {
601
+ $located = Plugin::path() . 'templates/custom-embeds/' . $template_name . '.php';;
602
+ }
603
+
604
+ return $located;
605
+ }
606
+
607
+ static function valid_fb_data( $fb_data ) {
608
+ if ( is_array( $fb_data )
609
+ && ( isset( $fb_data['id'] ) || isset( $fb_data['social_plugin'] )
610
+ || isset( $fb_data['data'] ) ) ) {
611
+ return true;
612
+ }
613
+
614
+ return false;
615
+ }
616
+ }
inc/FB_API.php ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * API helper.
4
+ *
5
+ * @package WP Embed Facebook
6
+ */
7
+
8
+ namespace SIGAMI\WP_Embed_FB;
9
+
10
+ // If this file is called directly, abort.
11
+ if ( ! defined( 'WPINC' ) ) {
12
+ die;
13
+ }
14
+
15
+ /**
16
+ * Class FB_API
17
+ * Why use a SDK when WordPress has everything you need.
18
+ *
19
+ * Example:
20
+ * use SIGAMI\WP_Embed_FB\FB_API;
21
+ * FB_API::instance()->api(); //on error throws \Exception
22
+ * FB_API::instance()->run(); //on error returns WP_Error
23
+ *
24
+ * @package SIGAMI\WP_Embed_FB
25
+ */
26
+ class FB_API {
27
+
28
+ const GRAPH_URL = 'https://graph.facebook.com/';
29
+
30
+ protected $access_token, $app_id, $app_secret;
31
+
32
+ public $app_access_token;
33
+
34
+ /**
35
+ * @var FB_API
36
+ */
37
+ protected static $instance = null;
38
+
39
+ /**
40
+ * @return FB_API
41
+ */
42
+ static function instance($app_id = null, $app_secret = null) {
43
+ if ( static::$instance === null ) {
44
+ static::$instance = new static($app_id,$app_secret);
45
+ }
46
+
47
+ return static::$instance;
48
+ }
49
+
50
+ protected function __construct($app_id = null,$app_secret = null) {
51
+ $this->app_id = $app_id === null ? Plugin::get_option( 'app_id' ) : $app_id;
52
+ $this->app_secret = $app_secret === null ? Plugin::get_option( 'app_secret' ) : $app_secret;
53
+ $this->app_access_token = "{$this->app_id}|{$this->app_secret}";
54
+ $this->access_token = strlen( $this->app_access_token ) > 5 ? $this->app_access_token : null;
55
+ }
56
+
57
+ /**
58
+ * @param string $token
59
+ */
60
+ public function setAccessToken( $token ) {
61
+ $this->access_token = $token;
62
+ }
63
+
64
+ /**
65
+ * @return string
66
+ */
67
+ public function getAccessToken() {
68
+ return $this->access_token;
69
+ }
70
+
71
+ /**
72
+ * Get token information
73
+ *
74
+ * @param string $token
75
+ *
76
+ * @return array|\WP_Error
77
+ */
78
+ public function debugToken( $token ) {
79
+ return $this->run( 'debug_token?input_token=' . $token );
80
+ }
81
+
82
+ /**
83
+ * API call to extend an access token
84
+ *
85
+ * @param string $user_token
86
+ *
87
+ * @return array|\WP_Error
88
+ */
89
+ public function extendAccessToken( $user_token ) {
90
+
91
+ $args['client_id'] = $this->app_id;
92
+ $args['client_secret'] = $this->app_secret;
93
+ $args['grant_type'] = 'fb_exchange_token';
94
+ $args['fb_exchange_token'] = $user_token;
95
+
96
+ $string = add_query_arg( $args, 'oauth/access_token' );
97
+
98
+ return $this->run( $string );
99
+ }
100
+
101
+ /**
102
+ * So simple...
103
+ * //TODO add a successful call example here
104
+ *
105
+ * @param string $link
106
+ *
107
+ * @return array|\WP_Error
108
+ */
109
+ public function scrape_url( $link ) {
110
+ return $this->run( '', 'POST', [
111
+ 'scrape' => 'true',
112
+ 'id' => esc_url_raw( $link )
113
+ ] );
114
+ }
115
+
116
+ /**
117
+ * API Wrapper to handle error the WordPress way
118
+ *
119
+ * @param string $string
120
+ * @param string $method
121
+ * @param array $message
122
+ *
123
+ * @return array|\WP_Error
124
+ */
125
+ public function run( $string = '', $method = 'GET', $message = [] ) {
126
+ try {
127
+ return $this->api( $string, $method, $message );
128
+ } catch ( \Exception $e ) {
129
+ return new \WP_Error( $e->getCode(), $e->getMessage() );
130
+ }
131
+ }
132
+
133
+ /**
134
+ * Same name as in FB PHP SDK
135
+ *
136
+ * @param string $string
137
+ * @param string $method
138
+ * @param array $message
139
+ *
140
+ * @return array
141
+ * @throws \Exception
142
+ */
143
+ public function api( $string = '', $method = 'GET', $message = [] ) {
144
+
145
+ $vars = [];
146
+ $base_url = self::GRAPH_URL;
147
+ $pos = strpos( $string, "?" );
148
+ if ( $pos !== false ) {
149
+ parse_str( parse_url( $string, PHP_URL_QUERY ), $vars );
150
+ $base_url .= substr( trim( $string, '/' ), 0, $pos );
151
+ } else {
152
+ $base_url .= trim( $string, '/' );
153
+ }
154
+
155
+ if ( $this->access_token !== null ) {
156
+ $vars['access_token'] = $this->access_token;
157
+ }
158
+
159
+ $url = add_query_arg( $vars, $base_url );
160
+
161
+ if ( $method == 'GET' ) {
162
+ if ( ! empty( $message ) ) {
163
+ $url = add_query_arg( $message, $url );
164
+ }
165
+ $response = wp_remote_get( $url );
166
+ } elseif ( $method == 'POST' ) {
167
+ $response = wp_remote_post( $url, ! empty( $message ) ? [ 'body' => $message ] : [] );
168
+ } else {
169
+ throw new \Exception( __( 'Invalid API method', 'wp-embed-facebook' ), 69 );
170
+ }
171
+
172
+ if ( is_wp_error( $response ) ) {
173
+ throw new \Exception( $response->get_error_code() . '=>'
174
+ . $response->get_error_message(), 500 );
175
+ }
176
+
177
+ $response_code = wp_remote_retrieve_response_code( $response );
178
+ $response_message = wp_remote_retrieve_response_message( $response );
179
+ $response_body = wp_remote_retrieve_body( $response );
180
+
181
+ $data = empty( $response_body ) ? false : json_decode( $response_body, true );
182
+
183
+ if ( is_array( $data ) ) {
184
+
185
+ $api_error = false;
186
+ $code = isset( $data['error_code'] ) ? $data['error_code'] : 0;
187
+
188
+ if ( isset( $data['error'] ) && is_array( $data['error'] ) ) {
189
+ $api_error = $data['error']['message'];
190
+ $code = isset( $data['error']['code'] ) ? $data['error']['code'] : $code;
191
+ } elseif ( isset( $data['error_description'] ) ) {
192
+ $api_error = $data['error_description'];
193
+ } elseif ( isset( $data['error_msg'] ) ) {
194
+ $api_error = $data['error_msg'];
195
+ }
196
+
197
+ if ( $api_error !== false ) {
198
+ throw new \Exception( $api_error, (int) $code );
199
+ }
200
+ }
201
+
202
+ if ( 200 != $response_code && ! empty( $response_message ) ) {
203
+ throw new \Exception( $response_message, (int) $response_code );
204
+ }
205
+
206
+ if ( 200 != $response_code || ! is_array( $data ) || empty( $data ) ) {
207
+ throw new \Exception( __( 'Unknown error occurred', 'wp-embed-facebook' ),
208
+ (int) $response_code );
209
+ }
210
+
211
+ return $data;
212
+ }
213
+ }
inc/Framework.php ADDED
@@ -0,0 +1,780 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace SIGAMI\WP_Embed_FB;
4
+
5
+ // If this file is called directly, abort.
6
+ if ( ! defined( 'WPINC' ) ) {
7
+ die;
8
+ }
9
+
10
+ /**
11
+ * Class Framework
12
+ *
13
+ * @version 2.6.3
14
+ */
15
+ abstract class Framework {
16
+
17
+ #################################################################
18
+ # Replace this variables on Plugin Class constructor as needed #
19
+ #################################################################
20
+
21
+ /**
22
+ * REQUIRED
23
+ *
24
+ * @var string option_name from get_option. Where all plugin options are stored
25
+ */
26
+ protected static $option = '';
27
+
28
+ /**
29
+ * @var bool Refresh options on each page load, helpful to add new defaults on the fly
30
+ * set to WP_DEBUG on Framework constructor.
31
+ */
32
+ protected static $defaults_change = null;
33
+
34
+ /**
35
+ * String values for toggle options like checkboxes or any other internal process
36
+ *
37
+ * @var string
38
+ */
39
+ protected static $on = 'true';
40
+ protected static $off = 'false';
41
+
42
+ /**
43
+ * Admin page type to edit the plugin options. Set to false disable this feature.
44
+ *
45
+ * @var string
46
+ * menu|submenu|management|options|theme|plugins|users|dashboard|posts|media|links|pages|comments
47
+ */
48
+ protected static $page_type = 'options';
49
+ protected static $capability = 'manage_options';
50
+ protected static $menu_slug = 'new_page';
51
+ # Only for menu pages (Top Level)
52
+ protected static $icon = '';
53
+ protected static $position = null;
54
+ # Only for submenu pages
55
+ protected static $parent_slug = 'options-general.php';
56
+ # Labels for options page. Set i18n on constructor
57
+ protected static $page_title = 'New Page';
58
+ protected static $menu_title = 'New Page';
59
+ /**
60
+ * @var bool Enable reset button on options page
61
+ */
62
+ protected static $reset_button = true;
63
+ # Labels for reset options. Set i18n on constructor
64
+ protected static $reset_string = 'Reset to defaults';
65
+ protected static $confirmation = 'Are you sure?';
66
+ /**
67
+ * @var string internal control to redirect to current tab on save
68
+ */
69
+ protected static $current_tab = '';
70
+
71
+ ###########################################
72
+ # Cache of commonly used vars do not edit #
73
+ ###########################################
74
+
75
+ /**
76
+ * @var string __FILE__ constant from plugin FILE
77
+ */
78
+ public static $FILE = '';
79
+
80
+ protected static $defaults = null;
81
+ private static $options = null;
82
+ private static $path = null;
83
+ private static $url = null;
84
+ private static $instance = null;
85
+
86
+ static function instance( $file ) {
87
+ if ( self::$instance === null ) {
88
+ self::$instance = new static( $file );
89
+ }
90
+
91
+ return self::$instance;
92
+ }
93
+
94
+ protected function __construct( $file ) {
95
+
96
+ if ( empty( static::$option ) ) {
97
+ wp_die( "You must set an option name on the Plugin class constructor" );
98
+ }
99
+
100
+ static::$FILE = $file;
101
+
102
+ if ( ( static::$defaults_change === null ) && defined( WP_DEBUG ) ) {
103
+ static::$defaults_change = (bool) WP_DEBUG;
104
+ }
105
+
106
+ add_action( 'plugins_loaded', get_called_class() . '::load_translation' );
107
+ register_setting( "Settings_" . static::$option, static::$option, [
108
+ 'sanitize_callback' => get_called_class() . '::sanitize_option',
109
+ 'default' => static::defaults(),
110
+ ] );
111
+
112
+ register_activation_hook( $file, get_called_class() . '::activation' );
113
+ register_uninstall_hook( $file, get_called_class() . '::uninstall' );
114
+ register_deactivation_hook( $file, get_called_class() . '::deactivation' );
115
+ add_action( 'upgrader_process_complete', get_called_class() . '::update', 10, 2 );
116
+
117
+ if ( is_admin() && is_string( static::$page_type ) ) {
118
+ /** @see Framework::add_page() */
119
+ add_action( 'admin_menu', get_called_class() . '::add_page' );
120
+ /** @see Framework::add_pager_script() */
121
+ add_action( 'current_screen', get_called_class() . '::add_pager_script' );
122
+ /** @see Framework::redirect_to_tab() */
123
+ add_action('load-options.php', get_called_class() . '::redirect_to_tab' );
124
+ }
125
+ }
126
+
127
+ static function activation() {
128
+ static::$defaults_change = true;
129
+ static::get_option();
130
+ do_action( static::$option . '_' . __FUNCTION__, __FUNCTION__ );
131
+ }
132
+
133
+ static function uninstall() {
134
+ do_action( static::$option . '_' . __FUNCTION__, __FUNCTION__ );
135
+ if ( is_multisite() ) {
136
+ $sites = get_sites();
137
+ foreach ( $sites as $site ) {
138
+ switch_to_blog( $site['blog_id'] );
139
+ delete_option( static::$option );
140
+ }
141
+ restore_current_blog();
142
+ } else {
143
+ delete_option( static::$option );
144
+ }
145
+ }
146
+
147
+ static function deactivation() {
148
+ do_action( static::$option . '_' . __FUNCTION__, __FUNCTION__ );
149
+ }
150
+
151
+ static function update( $object, $options ) {
152
+ if ( $options['action'] == 'update'
153
+ && $options['page_type'] == 'plugin'
154
+ && isset( $options['plugins'] )
155
+ && in_array( plugin_basename( static::$FILE ), $options['plugins'] ) ) {
156
+
157
+ static::$defaults_change = true;
158
+ static::get_option();
159
+ do_action( static::$option . '_' . __FUNCTION__, __FUNCTION__ );
160
+ }
161
+ }
162
+
163
+ static function path() {
164
+ if ( null === self::$path ) {
165
+ self::$path = plugin_dir_path( static::$FILE );
166
+ }
167
+
168
+ return self::$path;
169
+ }
170
+
171
+ static function url() {
172
+ if ( null === self::$url ) {
173
+ self::$url = plugin_dir_url( static::$FILE );
174
+ }
175
+
176
+ return self::$url;
177
+ }
178
+
179
+ /**
180
+ * To save options pass an array with all values as set on defaults. See example below:
181
+ *
182
+ * <code>
183
+ * # Set single option
184
+ * Plugin::set_options( ['option'=>'new value'] + Plugin::get_option() );
185
+ * or
186
+ * Plugin::set_options( array_merge(Plugin::get_option(),['option'=>'new value']) );
187
+ *
188
+ * # Reset all options to defaults
189
+ * Plugin::set_options(Plugin::defaults());
190
+ *
191
+ * </code>
192
+ * @param array|string $options
193
+ */
194
+ static function set_options( $options ) {
195
+ update_option( static::$option, $options, true );
196
+ self::$options = get_option( static::$option );
197
+ }
198
+
199
+ /**
200
+ * Get a single option or all of them. Can
201
+ *
202
+ * @param null|string $option
203
+ *
204
+ * @return array|mixed The queried option. False if the option does not exists. Array with all
205
+ * options if $option is null;
206
+ */
207
+ static function get_option( $option = null ) {
208
+ if ( ! is_array( self::$options ) ) {
209
+ $options = get_option( static::$option );
210
+ if ( is_array( $options ) ) {
211
+ #Sanitize options on install, update and on development also useful when you want to
212
+ # add a new default and want it to show on the next page load.
213
+ # Equals to WP_DEBUG on construct
214
+ if ( static::$defaults_change ) {
215
+ if ( $options === static::defaults() ) {
216
+ self::$options = $options;
217
+ } else {
218
+ $compare = [];
219
+ foreach ( static::defaults() as $default_key => $default_value ) {
220
+ $compare[ $default_key ] = isset( $options[ $default_key ] ) ? $options[ $default_key ]
221
+ : $default_value;
222
+ }
223
+ if ( $compare === $options ) {
224
+ self::$options = $options;
225
+ } else {
226
+ static::set_options( $compare );
227
+ }
228
+ }
229
+ } else {
230
+ self::$options = $options;
231
+ }
232
+ } else {
233
+ static::set_options( static::defaults() );
234
+ }
235
+ }
236
+ if ( $option ) {
237
+ return isset( self::$options[ $option ] ) ? self::$options[ $option ] : false;
238
+ } else {
239
+ return self::$options;
240
+ }
241
+ }
242
+
243
+ /**
244
+ * Sanitizes the option values before saving it to database.
245
+ *
246
+ * @param array $options Options previous to be saved on data base
247
+ *
248
+ * @return array The validated option.
249
+ */
250
+ static function sanitize_option( $options ) {
251
+
252
+ $defaults = static::defaults();
253
+
254
+ if ( is_string( $options ) && ( $options == 'reset_defaults' ) ) {
255
+ do_action( self::$option . '_reset_defaults' );
256
+
257
+ return $defaults;
258
+ }
259
+
260
+ if ( $options === $defaults ) {
261
+ return $options;
262
+ }
263
+
264
+ $clean = [];
265
+ foreach ( $defaults as $name => $default_value ) {
266
+ $clean[ $name ] = $default_value;
267
+ if ( ( ( $default_value === static::$on ) || ( $default_value === static::$off ) ) ) {
268
+ if ( isset( $options[ $name ] ) && ( $options[ $name ] === static::$on ) ) {
269
+ $clean[ $name ] = static::$on;
270
+ } else {
271
+ $clean[ $name ] = static::$off;
272
+ }
273
+ } elseif ( isset( $options[ $name ] ) ) {
274
+ if ( is_int( $default_value ) ) {
275
+ $options[ $name ] = (int) $options[ $name ];
276
+ }
277
+ if ( ( is_string( $default_value ) && is_string( $options[ $name ] ) )
278
+ || ( is_object( $default_value ) && is_object( $options[ $name ] ) )
279
+ || ( is_array( $default_value ) && is_array( $options[ $name ] ) ) ) {
280
+ $clean[ $name ] = $options[ $name ];
281
+ }
282
+ }
283
+ }
284
+
285
+ return $clean;
286
+ }
287
+
288
+ /**
289
+ * @param string $option
290
+ *
291
+ * @return bool
292
+ */
293
+ static function is_on( $option ) {
294
+ return static::get_option( $option ) === static::$on;
295
+ }
296
+
297
+ static function get_option_name(){
298
+ return static::$option;
299
+ }
300
+
301
+ /**
302
+ * Add page to Settings
303
+ */
304
+ static function add_page() {
305
+ $function = 'add_' . static::$page_type . '_page';
306
+ if ( function_exists( $function ) ) {
307
+
308
+ if ( static::$page_type == 'menu' ) {
309
+ $options_page = call_user_func( $function, static::$page_title, static::$menu_title,
310
+ static::$capability, static::$menu_slug, get_called_class() . '::display_page', static::$icon,
311
+ static::$position );
312
+ } elseif ( static::$page_type == 'submenu' ) {
313
+ $options_page = call_user_func( $function, static::$parent_slug, static::$page_title,
314
+ static::$menu_title, static::$capability, static::$menu_slug,
315
+ get_called_class() . '::display_page' );
316
+ } else {
317
+ $options_page = call_user_func( $function, static::$page_title, static::$menu_title,
318
+ static::$capability, static::$menu_slug, get_called_class() . '::display_page' );
319
+ }
320
+
321
+ if ( false === $options_page ) {
322
+ wp_die( 'Invalid page: ' . static::$page_type . ' ' . $function );
323
+ }
324
+ } else {
325
+ wp_die( 'Invalid page page_type: ' . static::$page_type );
326
+ }
327
+ }
328
+
329
+ static function add_pager_script() {
330
+ global $current_screen;
331
+
332
+ if ( ( strpos( $current_screen->id, static::$menu_slug ) !== false )
333
+ && ( count( static::tabs() ) > 1 ) ) {
334
+ add_action( 'in_admin_footer', get_called_class() . '::pager_script' );
335
+ }
336
+ }
337
+
338
+ static function pager_script() {
339
+ ob_start();
340
+ ?>
341
+ <script type="text/javascript">
342
+ const handleTabs = function (hash) {
343
+ const $sections = jQuery('.section');
344
+ const $tabs = jQuery(".nav-tab-wrapper a");
345
+ const $hash_input = jQuery('[name="<?php echo esc_attr(static::$option).'_hash' ?>"]');
346
+ $sections.hide();
347
+ if (hash.length) {
348
+ hash.show();
349
+ jQuery.each($tabs, function (key, value) {
350
+ jQuery(value).removeClass("nav-tab-active");
351
+ });
352
+ $tabs.eq(hash.index()).addClass('nav-tab-active');
353
+ $hash_input.attr('value',window.location.hash);
354
+ } else {
355
+ $sections.first().show();
356
+ }
357
+ };
358
+ handleTabs(jQuery(window.location.hash));
359
+ jQuery(window).bind('hashchange', function () {
360
+ handleTabs(jQuery(window.location.hash));
361
+ // jQuery("html, body").animate({scrollTop: 0}, "slow");
362
+ });
363
+ </script>
364
+ <?php
365
+ echo ob_get_clean();
366
+ }
367
+
368
+ static function redirect_to_tab(){
369
+ if(isset($_REQUEST['option_page'])
370
+ &&($_REQUEST['option_page'] === 'Settings_'.static::$option)){
371
+ if(isset($_POST[static::$option.'_hash'])){
372
+ static::$current_tab = $_POST[static::$option.'_hash'];
373
+ add_filter('wp_redirect',get_called_class().'::redirect_to_tab_filter');
374
+ unset($_POST[static::$option.'_hash']);
375
+ unset($_REQUEST[static::$option.'_hash']);
376
+ }
377
+ }
378
+ }
379
+
380
+ static function redirect_to_tab_filter($red){
381
+ return $red . static::$current_tab;
382
+ }
383
+
384
+ /**
385
+ * Render form sections
386
+ *
387
+ * @param string|bool $title
388
+ * @param string $description
389
+ */
390
+ static function field_group( $title = '', $description = '' ) {
391
+ if ( $title ) :
392
+ if ( is_string( $title ) ) {
393
+ echo "<h3>$title</h3>";
394
+ }
395
+ if ( ! empty( $description ) ) {
396
+ echo "<p>$description</p>";
397
+
398
+ }
399
+ ?>
400
+ <table class="form-table">
401
+ <tbody>
402
+ <?php
403
+ else :
404
+ ?>
405
+ </tbody>
406
+ </table>
407
+ <?php
408
+ endif;
409
+ }
410
+
411
+ /**
412
+ * Render form fields
413
+ *
414
+ * @param string $type Type of input field
415
+ * @param string $name Input name
416
+ * @param string $label Input Label
417
+ * @param string $description Field description
418
+ * @param array|null $atts HTML attributes like example
419
+ * ['required','max'=>20,'onclick'=>'do_something()']
420
+ * @param array $values Option values for select and checklist fields
421
+ * @param string $option Option to store the values
422
+ */
423
+ static function field( $type, $name = '', $label = '', $description = '', $atts = null, $values = [], $option = ''
424
+ ) {
425
+ if ( empty( $option ) || $option == static::$option ) {
426
+ $option = static::$option;
427
+ $options = apply_filters( $option . '_field_options', static::get_option() );
428
+ } else {
429
+ $options = (array) get_option( $option );
430
+ }
431
+
432
+ //TODO add aria-described-by on input that points to the id of description but first find out how to test them
433
+
434
+ $help_text = ! empty( $description ) ? "<p class=\"description\">$description</p>" : "";
435
+ $attsString = '';
436
+ ob_start();
437
+ switch ( $type ) {
438
+ case 'checklist':
439
+ ?>
440
+ <tr>
441
+ <th><?php echo $label ?></th>
442
+ <td>
443
+ <fieldset>
444
+ <?php
445
+ foreach ( $values as $value => $title ) :
446
+ $checked = ( in_array( $value, $options[ $name ] ) ) ? 'checked' : '';
447
+ ?>
448
+ <label for="<?php echo esc_attr("{$option}_$name") ?>">
449
+ <input type="checkbox" id="<?php echo esc_attr("{$option}_$name") ?>"
450
+ name="<?php echo $option . "[$name][]" ?>"
451
+ value="<?php echo $value ?>" <?php echo $checked . ' ' . $attsString ?>/>
452
+ <span><?php echo $title ?></span>
453
+ </label>
454
+ <br>
455
+ <?php endforeach; ?>
456
+ </fieldset>
457
+ <?php echo $help_text ?>
458
+ </td>
459
+ </tr>
460
+ <?php
461
+ break;
462
+ case 'checkbox':
463
+ $checked = ( $options[ $name ] === static::$on ) ? 'checked' : '';
464
+ //if(empty($description))
465
+ // wp_die('checkbox field needs description');
466
+ ?>
467
+ <tr valign="middle">
468
+ <th scope="row">
469
+ <?php echo $label ?>
470
+ </th>
471
+ <td>
472
+ <label for="<?php echo esc_attr("{$option}_$name") ?>">
473
+ <input type="checkbox" id="<?php echo esc_attr("{$option}_$name") ?>"
474
+ name="<?php echo $option . "[$name]" ?>" <?php echo $checked ?>
475
+ value="<?php echo static::$on ?>" <?php echo self::atts2string( $atts ) ?>/>
476
+ <?php echo $description ?></label>
477
+ </td>
478
+ </tr>
479
+ <?php
480
+ break;
481
+ case 'select' :
482
+ ?>
483
+ <tr valign="middle">
484
+ <th scope="row"><label
485
+ for="<?php echo esc_attr("{$option}_$name") ?>"><?php echo $label ?></label>
486
+ </th>
487
+ <td>
488
+ <select id="<?php echo esc_attr("{$option}_$name") ?>" name="<?php echo $option . "[$name]" ?>" <?php echo $attsString ?>>
489
+ <?php
490
+ foreach ( $values as $value => $option_label ) :
491
+ if ( is_numeric( $value ) && strpos($option_label,' ') === false ) {
492
+ $value = $option_label;
493
+ }
494
+ ?>
495
+ <option value="<?php echo $value ?>" <?php echo $options[ $name ] == $value ? 'selected'
496
+ : '' ?>><?php echo $option_label ?></option>
497
+ <?php endforeach; ?>
498
+ </select>
499
+ <?php echo $help_text ?>
500
+ </td>
501
+ </tr>
502
+ <?php
503
+ break;
504
+ case 'string' :
505
+ ?>
506
+ <tr valign="middle">
507
+ <th><?php echo $label ?></th>
508
+ <td <?php echo $attsString ?>>
509
+ <?php echo $name ?>
510
+ <?php echo $help_text ?>
511
+ </td>
512
+ </tr>
513
+ <?php
514
+ break;
515
+ case 'hidden':
516
+ $value_hidden = esc_attr(isset( $atts['value'] ) ? $atts['value'] : $options[ $name ]);
517
+ ?>
518
+ <input id="<?php echo esc_attr("{$option}_$name") ?>"
519
+ type="hidden"
520
+ name="<?php echo $option . "[$name]" ?>"
521
+ value="<?php echo esc_attr($value_hidden) ?>" <?php echo self::atts2string( $atts ) ?>>
522
+ <?php
523
+ break;
524
+ default:
525
+ if ( ! isset( $atts['class'] ) ) {
526
+ $atts['class'] = 'regular-text';
527
+ }
528
+ ?>
529
+ <tr>
530
+ <th scope="row"><label
531
+ for="<?php echo esc_attr("{$option}_$name") ?>"><?php echo $label ?></label>
532
+ </th>
533
+ <td>
534
+ <input id="<?php echo esc_attr("{$option}_$name") ?>"
535
+ type="<?php echo $type ?>"
536
+ name="<?php echo $option . "[$name]" ?>"
537
+ value="<?php echo esc_attr( $options[ $name ] ) ?>" <?php echo self::atts2string( $atts ) ?>>
538
+ <?php echo $help_text ?>
539
+ </td>
540
+ </tr>
541
+ <?php
542
+ break;
543
+ }
544
+ ob_end_flush();
545
+ }
546
+
547
+ /**
548
+ * @param array associative array of html attributes i.e.
549
+ * ['class'=>'control error'] turns into <... class="control error" >
550
+ * ['required'=>true] turns into <... required >
551
+ *
552
+ * @return string attributes on html format
553
+ */
554
+ static function atts2string( $array ) {
555
+
556
+ if ( ! is_array( $array ) || empty( $array ) ) {
557
+ return '';
558
+ }
559
+
560
+ $return = '';
561
+ foreach ( $array as $att => $val ) {
562
+ if ( is_numeric( $att ) ) {//this is not ok but there for some reason...
563
+ $return .= " " . esc_attr( $val ) . " ";
564
+ } elseif ( $val === true ) {
565
+ $return .= " " . esc_attr( $att ) . " ";
566
+ } else {
567
+ $return .= $att . '="' . esc_attr( $val ) . '" ';
568
+ }
569
+ }
570
+
571
+ return $return;
572
+ }
573
+
574
+ static function parse_tabs( $tabs ) {
575
+ foreach ( $tabs as $tab ) {
576
+ $data = wp_parse_args( $tab, [
577
+ 'label' => '',
578
+ 'id' => '',
579
+ 'sections' => [],
580
+ 'attributes' => [],
581
+ 'description' => '',
582
+ ] );
583
+ if ( ! isset( $data['attributes']['class'] ) ) {
584
+ $data['attributes']['class'] = 'section';
585
+ }
586
+ if ( isset( $data['attributes']['id'] ) ) {
587
+ $data['id'] = $data['attributes']['id'];
588
+ }
589
+ if ( empty( $data['id'] ) || empty( $data['label'] ) ) {
590
+ wp_die( 'You must set id and label at least. ' . print_r( $tabs, true ) );
591
+ }
592
+ $attributes = static::atts2string( $data['attributes'] );
593
+ echo "<section id='{$data['id']}' $attributes>";
594
+ echo $data['description'];
595
+ foreach ( $data['sections'] as $section ) {
596
+ $data = wp_parse_args( $section, [
597
+ 'title' => '',
598
+ 'fields' => [],
599
+ 'description' => '',
600
+ ] );
601
+ static::field_group( $data['title'], $data['description'] );
602
+ foreach ( $data['fields'] as $field ) {
603
+ $field_data = wp_parse_args( $field, [
604
+ 'type' => '',//text, checkbox, select, checklist, string or number
605
+ 'name' => '',//option name must match plugin defaults
606
+ 'label' => '',
607
+ 'description' => '',//help text
608
+ 'values' => [],//values for checklist
609
+ 'attributes' => [],//html attributes
610
+ 'option' => static::$option,
611
+ ] );
612
+ static::field( $field_data['type'], $field_data['name'], $field_data['label'],
613
+ $field_data['description'], $field_data['attributes'], $field_data['values'],
614
+ $field_data['option'] );
615
+ }
616
+ static::field_group();
617
+ }
618
+ echo "</section>";
619
+ }
620
+ }
621
+
622
+ /**
623
+ * Renders the wp-admin settings page with tabs rendered by js or no tab for single static:tabs
624
+ */
625
+ static function display_page() {
626
+ ?>
627
+ <div class="wrap">
628
+ <h2><?php echo static::$page_title ?></h2>
629
+ <?php static::before_form() ?>
630
+ <form action="options.php" method="post">
631
+ <?php
632
+ settings_fields( "Settings_" . static::$option );
633
+ do_action( static::$option . '_inside_form' );
634
+ ?>
635
+ <?php if ( count( static::tabs() ) > 1 ) : ?>
636
+ <h2 class="nav-tab-wrapper">
637
+ <?php
638
+ foreach ( static::tabs() as $key => $tab ) {
639
+ $class = 0 == $key ? "nav-tab-active" : "";
640
+ echo "<a class='nav-tab $class' href='#{$tab['id']}'>{$tab['label']}</a>";
641
+ }
642
+ ?>
643
+ </h2><br>
644
+ <?php endif; ?>
645
+ <input type="hidden" name="<?php echo esc_attr(static::$option).'_hash' ?>" value="">
646
+ <div class="sections">
647
+ <?php static::parse_tabs( static::tabs() ) ?>
648
+ <?php submit_button(); ?>
649
+ </div>
650
+ </form>
651
+ <?php if ( static::$reset_button ): ?>
652
+ <br>
653
+ <form action="options.php" method="post"
654
+ onsubmit="return confirm('<?php echo static::$confirmation ?>');">
655
+ <?php settings_fields( "Settings_" . static::$option ); ?>
656
+ <input type="hidden" name="<?php echo static::$option ?>"
657
+ value="reset_defaults"/>
658
+ <input type="submit" name="restore" class="button"
659
+ value="<?php echo static::$reset_string ?>"/>
660
+ </form>
661
+ <?php endif ?>
662
+ <?php static::after_form() ?>
663
+ </div>
664
+ <?php
665
+ }
666
+
667
+ ##############################################
668
+ # Replace this functions on the Plugin class #
669
+ ##############################################
670
+
671
+ /**
672
+ * Set the correct text domain
673
+ */
674
+ static function load_translation() {
675
+ load_plugin_textdomain( 'text_domain', false, basename( dirname( static::$FILE ) ) . '/languages' );
676
+ }
677
+
678
+ /**
679
+ * This function is an example of how to set default values of the option
680
+ *
681
+ * @return array Default variables used on this plugin
682
+ */
683
+ static function defaults() {
684
+ if ( self::$defaults === null ) {
685
+ self::$defaults = [
686
+ 'off_option' => 'false',
687
+ 'on_option' => 'true',
688
+ 'text_option' => 'Something crazy',
689
+ 'checklist_option' => [ 'one' ],//only checkbox one is selected two is not
690
+ 'number_option' => 34,
691
+ ];
692
+ }
693
+
694
+ return self::$defaults;
695
+ }
696
+
697
+ static function before_form() {
698
+ echo '';
699
+ }
700
+
701
+ static function after_form() {
702
+ echo '';
703
+ }
704
+
705
+ /**
706
+ * This function is an example of how to produce the form to hold all settings.
707
+ *
708
+ * @return array options page sections
709
+ *
710
+ */
711
+ static function tabs() {
712
+ $sections = [
713
+ [
714
+ 'label' => __( 'General', 'text_domain' ),
715
+ 'id' => 'general',
716
+ 'sections' => [
717
+ [
718
+ //Set title to true for no title
719
+ 'title' => __( 'Some Stuff', 'text_domain' ),
720
+ 'description' => __( 'This stuff is interesting', 'text_domain' ),
721
+ 'fields' => [
722
+ [
723
+ 'type' => 'text',
724
+ 'name' => 'text_option',
725
+ 'label' => __( 'Text Option', 'text_domain' ),
726
+ 'description' => 'Help text'
727
+ ],
728
+ [
729
+ 'type' => 'checkbox',
730
+ 'name' => 'off_option',
731
+ 'label' => __( 'Off Option', 'text_domain' ),
732
+ 'description' => 'Help text'
733
+ ],
734
+ [
735
+ 'type' => 'checkbox',
736
+ 'name' => 'on_option',
737
+ 'label' => __( 'On Option', 'text_domain' ),
738
+ ],
739
+ ]
740
+ ]
741
+ ]
742
+
743
+ ],
744
+ [
745
+ 'label' => __( 'Advanced', 'text_domain' ),
746
+ 'id' => 'advanced',
747
+ 'sections' => [
748
+ [
749
+ 'title' => __( 'More Important Stuff', 'text_domain' ),
750
+ 'fields' => [
751
+ [
752
+ 'type' => 'number',
753
+ 'name' => 'number_option',
754
+ 'label' => __( 'Number Option', 'text_domain' ),
755
+ 'description' => 'Help text',
756
+ //'attributes' => [ 'max' => '30', 'required' => true ]
757
+ ],
758
+ [
759
+ 'type' => 'checklist',
760
+ 'name' => 'checklist_option',
761
+ 'label' => __( 'Checklist Option', 'text_domain' ),
762
+ 'description' => 'more info',
763
+ 'values' => [
764
+ 'one' => __( 'One title', 'text_domain' ),
765
+ 'two' => __( 'Two title', 'text_domain' )
766
+ ]
767
+ ],
768
+ ]
769
+ ]
770
+ ]
771
+
772
+ ],
773
+ ];
774
+
775
+ /**
776
+ * Allow 3rd party add-on's or extensions to add other sections
777
+ */
778
+ return apply_filters( self::$option . '_admin_sections', $sections );
779
+ }
780
+ }
inc/Helpers.php ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Helpers.
4
+ *
5
+ * @package WP Embed Facebook
6
+ */
7
+
8
+ namespace SIGAMI\WP_Embed_FB;
9
+
10
+ // If this file is called directly, abort.
11
+ if ( ! defined( 'WPINC' ) ) {
12
+ die;
13
+ }
14
+
15
+ class Helpers {
16
+
17
+ static $has_photon = null;
18
+ static $wp_timezone = null;
19
+ static $lb_defaults = null;
20
+
21
+ static function string_to_array( $string ) {
22
+ return explode( ',', trim( $string, ' ,' ) );
23
+ }
24
+
25
+ static function has_photon() {
26
+ if ( self::$has_photon === null ) {
27
+ if ( class_exists( 'Jetpack' )
28
+ && method_exists( 'Jetpack', 'get_active_modules' )
29
+ && in_array( 'photon', Jetpack::get_active_modules() ) ) {
30
+ self::$has_photon = true;
31
+ } else {
32
+ self::$has_photon = false;
33
+ }
34
+ }
35
+
36
+ return self::$has_photon;
37
+ }
38
+
39
+ static function has_fb_app() {
40
+ $options = Plugin::get_option();
41
+ $has_app = true;
42
+ if ( empty( $options['app_secret'] ) || empty( $options['app_id'] ) ) {
43
+ $has_app = false;
44
+ }
45
+
46
+ return apply_filters('wef_has_fb_app',$has_app);
47
+ }
48
+
49
+ static function get_timezone() {
50
+ if ( self::$wp_timezone === null ) {
51
+ $tzstring = get_option( 'timezone_string', '' );
52
+ if ( empty( $tzstring ) ) {
53
+ $current_offset = get_option( 'gmt_offset', 0 );
54
+ if ( 0 == $current_offset ) {
55
+ $tzstring = 'Etc/GMT';
56
+ } else {
57
+ $tzstring = ( $current_offset < 0 ) ? 'Etc/GMT' . $current_offset
58
+ : 'Etc/GMT+' . $current_offset;
59
+ }
60
+ }
61
+ self::$wp_timezone = $tzstring;
62
+ }
63
+
64
+ return self::$wp_timezone;
65
+ }
66
+
67
+ static function get_true_url() {
68
+ global $wp;
69
+ if ( is_home() ) {
70
+ return home_url();
71
+ }
72
+
73
+ if ( in_the_loop() ) {
74
+ global $post;
75
+ if ( Plugin::get_option( 'permalink_on_social_plugins' ) === 'true' ) {
76
+ return get_permalink( $post->ID );
77
+ } else {
78
+ $query = '/?p=' . $post->ID;
79
+ }
80
+ } else {
81
+ if ( Plugin::get_option( 'permalink_on_social_plugins' ) === 'true' ) {
82
+ $query = $wp->request;
83
+ } else {
84
+ $query = '/?' . $wp->query_string;
85
+ }
86
+ }
87
+
88
+ return home_url( $query );
89
+ }
90
+
91
+ static function lightbox_title( $title ) {
92
+ $clean_title = esc_attr( wp_rel_nofollow( make_clickable( str_replace( [ '"', "'" ], [
93
+ '&#34;',
94
+ '&#39;'
95
+ ], $title ) ) ) );
96
+
97
+ /**
98
+ * Filter lightbox title.
99
+ *
100
+ * @param string $clean_title Sanitized title with `data-title` attribute.
101
+ * @param string $title Raw title.
102
+ *
103
+ * @since unknown
104
+ */
105
+ return apply_filters( 'wef_lightbox_title', 'data-title="' . $clean_title . '"', $title );
106
+ }
107
+
108
+ static function get_lb_defaults() {
109
+ if ( self::$lb_defaults === null ) {
110
+ $keys = [
111
+ 'albumLabel',
112
+ 'alwaysShowNavOnTouchDevices',
113
+ 'showImageNumberLabel',
114
+ 'wrapAround',
115
+ 'disableScrolling',
116
+ 'fitImagesInViewport',
117
+ 'maxWidth',
118
+ 'maxHeight',
119
+ 'positionFromTop',
120
+ 'resizeDuration',
121
+ 'fadeDuration',
122
+ 'wpGallery'
123
+ ];
124
+ self::$lb_defaults = [];
125
+ $defaults = Plugin::defaults();
126
+ foreach ( $keys as $key ) {
127
+ self::$lb_defaults[ $key ] = $defaults[ 'LB_' . $key ];
128
+ }
129
+ }
130
+
131
+ return self::$lb_defaults;
132
+ }
133
+
134
+ static function make_clickable( $text ) {
135
+ if ( empty( $text ) ) {
136
+ return $text;
137
+ }
138
+
139
+ return wpautop( self::rel_nofollow( make_clickable( $text ) ) );
140
+ }
141
+
142
+ static function rel_nofollow( $text ) {
143
+ $text = stripslashes( $text );
144
+
145
+ return preg_replace_callback( /** @lang text */
146
+ '|<a (.+?)>|i', [ __CLASS__, 'nofollow_callback' ], $text );
147
+ }
148
+
149
+ static function nofollow_callback( $matches ) {
150
+ $text = $matches[1];
151
+ $text = str_replace( [ ' rel="nofollow"', " rel='nofollow'" ], '', $text );
152
+
153
+ return "<a $text rel=\"nofollow\">";
154
+ }
155
+
156
+ static function get_api_versions() {
157
+ return [
158
+ //'v2.6' => '2.6',
159
+ //'v2.7' => '2.7',
160
+ //'v2.8' => '2.8',
161
+ 'v2.9' => '2.9',
162
+ 'v2.10' => '2.10',
163
+ 'v2.11' => '2.11',
164
+ 'v2.12' => '2.12',
165
+ 'v3.0' => '3.0',
166
+ 'v3.1' => '3.1',
167
+ 'v3.2' => '3.2',
168
+ ];
169
+ }
170
+
171
+ static function get_fb_locales() {
172
+ return [
173
+
174
+ 'af_ZA' => 'Afrikaans',
175
+ 'ar_AR' => 'Arabic',
176
+ 'ar_IN' => 'Assamese',
177
+ 'az_AZ' => 'Azerbaijani',
178
+ 'be_BY' => 'Belarusian',
179
+ 'bg_BG' => 'Bulgarian',
180
+ 'bn_IN' => 'Bengali',
181
+ 'br_FR' => 'Breton',
182
+ 'bs_BA' => 'Bosnian',
183
+ 'ca_ES' => 'Catalan',
184
+ 'cb_IQ' => 'Sorani Kurdish',
185
+ 'co_FR' => 'Corsican',
186
+ 'cs_CZ' => 'Czech',
187
+ 'cx_PH' => 'Cebuano',
188
+ 'cy_GB' => 'Welsh',
189
+ 'da_DK' => 'Danish',
190
+ 'de_DE' => 'German',
191
+ 'el_GR' => 'Greek',
192
+ 'en_GB' => 'English (UK)',
193
+ 'en_UD' => 'English (Upside Down)',
194
+ 'en_US' => 'English (US)',
195
+ 'es_ES' => 'Spanish (Spain)',
196
+ 'es_LA' => 'Spanish',
197
+ 'et_EE' => 'Estonian',
198
+ 'eu_ES' => 'Basque',
199
+ 'fa_IR' => 'Persian',
200
+ 'ff_NG' => 'Fulah',
201
+ 'fi_FI' => 'Finnish',
202
+ 'fo_FO' => 'Faroese',
203
+ 'fr_CA' => 'French (Canada)',
204
+ 'fr_FR' => 'French (France)',
205
+ 'fy_NL' => 'Frisian',
206
+ 'ga_IE' => 'Irish',
207
+ 'gl_ES' => 'Galician',
208
+ 'gn_PY' => 'Guarani',
209
+ 'gu_IN' => 'Gujarati',
210
+ 'ha_NG' => 'Hausa',
211
+ 'he_IL' => 'Hebrew',
212
+ 'hi_IN' => 'Hindi',
213
+ 'hr_HR' => 'Croatian',
214
+ 'hu_HU' => 'Hungarian',
215
+ 'hy_AM' => 'Armenian',
216
+ 'id_ID' => 'Indonesian',
217
+ 'is_IS' => 'Icelandic',
218
+ 'it_IT' => 'Italian',
219
+ 'ja_JP' => 'Japanese',
220
+ 'ja_KS' => 'Japanese (Kansai)',
221
+ 'jv_ID' => 'Javanese',
222
+ 'ka_GE' => 'Georgian',
223
+ 'kk_KZ' => 'Kazakh',
224
+ 'km_KH' => 'Khmer',
225
+ 'kn_IN' => 'Kannada',
226
+ 'ko_KR' => 'Korean',
227
+ 'ku_TR' => 'Kurdish (Kurmanji)',
228
+ 'lt_LT' => 'Lithuanian',
229
+ 'lv_LV' => 'Latvian',
230
+ 'mg_MG' => 'Malagasy',
231
+ 'mk_MK' => 'Macedonian',
232
+ 'ml_IN' => 'Malayalam',
233
+ 'mn_MN' => 'Mongolian',
234
+ 'mr_IN' => 'Marathi',
235
+ 'ms_MY' => 'Malay',
236
+ 'mt_MT' => 'Maltese',
237
+ 'my_MM' => 'Burmese',
238
+ 'nb_NO' => 'Norwegian (bokmal)',
239
+ 'ne_NP' => 'Nepali',
240
+ 'nl_BE' => 'Dutch (België)',
241
+ 'nl_NL' => 'Dutch',
242
+ 'nn_NO' => 'Norwegian (nynorsk)',
243
+ 'or_IN' => 'Oriya',
244
+ 'pa_IN' => 'Punjabi',
245
+ 'pl_PL' => 'Polish',
246
+ 'ps_AF' => 'Pashto',
247
+ 'pt_BR' => 'Portuguese (Brazil)',
248
+ 'pt_PT' => 'Portuguese (Portugal)',
249
+ 'qz_MM' => 'Burmese',
250
+ 'ro_RO' => 'Romanian',
251
+ 'ru_RU' => 'Russian',
252
+ 'rw_RW' => 'Kinyarwanda',
253
+ 'sc_IT' => 'Sardinian',
254
+ 'si_LK' => 'Sinhala',
255
+ 'sk_SK' => 'Slovak',
256
+ 'sl_SI' => 'Slovenian',
257
+ 'so_SO' => 'Somali',
258
+ 'sq_AL' => 'Albanian',
259
+ 'sr_RS' => 'Serbian',
260
+ 'sv_SE' => 'Swedish',
261
+ 'sw_KE' => 'Swahili',
262
+ 'sz_PL' => 'Silesian',
263
+ 'ta_IN' => 'Tamil',
264
+ 'te_IN' => 'Telugu',
265
+ 'tg_TJ' => 'Tajik',
266
+ 'th_TH' => 'Thai',
267
+ 'tl_PH' => 'Filipino',
268
+ 'tr_TR' => 'Turkish',
269
+ 'tz_MA' => 'Tamazight',
270
+ 'uk_UA' => 'Ukrainian',
271
+ 'ur_PK' => 'Urdu',
272
+ 'uz_UZ' => 'Uzbek',
273
+ 'vi_VN' => 'Vietnamese',
274
+ 'zh_CN' => 'Simplified Chinese (China)',
275
+ 'zh_HK' => 'Traditional Chinese (Hong Kong)',
276
+ 'zh_TW' => 'Traditional Chinese (Taiwan)',
277
+
278
+ ];
279
+ }
280
+
281
+ /**
282
+ * Soon to be deprecated
283
+ *
284
+ * @return array
285
+ */
286
+ static function old_options() {
287
+ return [
288
+ 'show_posts',
289
+ 'close_warning',
290
+ 'height',
291
+ 'close_warning1',
292
+ 'max_width',
293
+ 'max_photos',
294
+ 'max_posts',
295
+ 'app_id',
296
+ 'app_secret',
297
+ 'proportions',
298
+ 'show_like',
299
+ 'fb_root',
300
+ 'theme',
301
+ 'show_follow',
302
+ 'video_ratio',
303
+ 'video_as_post',
304
+ 'raw_video',
305
+ 'raw_photo',
306
+ 'raw_post',
307
+ 'raw_page',
308
+ 'enqueue_style',
309
+ 'enq_lightbox',
310
+ 'enq_wpemfb',
311
+ 'enq_fbjs',
312
+ 'ev_local_tz',
313
+ 'page_height',
314
+ 'page_show_faces',
315
+ 'page_small_header',
316
+ 'page_hide_cover',
317
+ 'page_show_posts',
318
+ 'sdk_lang',
319
+ 'close_warning2',
320
+ 'force_app_token',
321
+ 'video_download',
322
+ 'sdk_version'
323
+ ];
324
+ }
325
+
326
+ /**
327
+ * Get $_POST or $_GET request.
328
+ *
329
+ * @param string $name Name of request.
330
+ * @param mixed $default Default value if request not found.
331
+ * @return mixed
332
+ *
333
+ * @author Rahul Aryan <rah12@live.com>
334
+ *
335
+ * @since 3.0.0
336
+ */
337
+ public static function get_request( $name, $default = null ) {
338
+ return isset( $_REQUEST[ $name ] ) ? $_REQUEST[ $name ] : $default; // WPCS: input var ok. sanitization ok. CSRF ok.
339
+ }
340
+ }
inc/Magic_Embeds.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Embed Helpers.
4
+ *
5
+ * @package WP Embed Facebook
6
+ */
7
+
8
+ namespace SIGAMI\WP_Embed_FB;
9
+
10
+ // If this file is called directly, abort.
11
+ if ( ! defined( 'WPINC' ) ) {
12
+ die;
13
+ }
14
+
15
+ /**
16
+ * Where all the embedding happens.
17
+ *
18
+ * @uses WP_Embed_FB
19
+ * @uses Social_Plugins
20
+ * @uses WP_Embed_FB_Plugin
21
+ */
22
+ class Magic_Embeds {
23
+ private static $instance = null;
24
+
25
+ static function instance() {
26
+ if ( self::$instance === null ) {
27
+ self::$instance = new self();
28
+ }
29
+
30
+ return self::$instance;
31
+ }
32
+
33
+ private function __construct() {
34
+
35
+ /** @see Magic_Embeds::plugins_loaded */
36
+ if ( Plugin::get_option( 'auto_embed_active' ) == 'true' ) {
37
+ add_filter( 'plugins_loaded', __CLASS__ . '::plugins_loaded' );
38
+ }
39
+
40
+ /** @see Magic_Embeds::wp_enqueue_scripts */
41
+ add_action( 'wp_enqueue_scripts', __CLASS__ . '::wp_enqueue_scripts' );
42
+
43
+ /** @see Magic_Embeds::the_content */
44
+ add_filter( 'the_content', __CLASS__ . '::the_content' );
45
+
46
+ //Deprecate old api versions
47
+ add_action( 'init', __CLASS__ . '::init', 999 );
48
+
49
+ /** @see Embed_FB::shortcode */
50
+ add_shortcode( 'facebook', __NAMESPACE__ . '\Embed_FB::shortcode' );
51
+ add_shortcode( 'embedfb', __NAMESPACE__ . '\Embed_FB::shortcode' );
52
+
53
+ /** @see Social_Plugins::shortcode */
54
+ add_shortcode( 'fb_plugin', __NAMESPACE__ . '\Social_Plugins::shortcode' );
55
+
56
+ add_action( 'widgets_init', __CLASS__ . '::widgets_init' );
57
+
58
+ }
59
+
60
+ static function widgets_init() {
61
+ register_widget( '\SIGAMI\WP_Embed_FB\Widget' );
62
+ }
63
+
64
+ static function init() {
65
+ if ( Helpers::has_fb_app() ) {
66
+ if ( (float) substr( Plugin::get_option( 'sdk_version' ), 1 ) <= 2.8 ) {
67
+ $options = Plugin::get_option();
68
+ $options['sdk_version'] = 'v3.1';
69
+ Plugin::set_options( $options );
70
+ }
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Adds fb_foot to top and quote plugin
76
+ *
77
+ * @param string $the_content Post content
78
+ *
79
+ * @return string
80
+ */
81
+ static function the_content( $the_content ) {
82
+ if ( Plugin::get_option( 'fb_root' ) === 'true' ) {
83
+ $the_content = '<div id="fb-root"></div>' . PHP_EOL . $the_content;
84
+ }
85
+ if ( is_single() && ( Plugin::get_option( 'quote_plugin_active' ) === 'true' ) ) {
86
+ $array = Helpers::string_to_array( Plugin::get_option( 'quote_post_types' ) );
87
+ if ( in_array( $GLOBALS['post']->post_type, $array ) ) {
88
+ $the_content .= Social_Plugins::get( 'quote' );
89
+ }
90
+ }
91
+
92
+ return $the_content;
93
+ }
94
+
95
+ /**
96
+ * Adds Embed register handler
97
+ */
98
+ static function plugins_loaded() {
99
+ wp_embed_register_handler( "wpembedfb", "/(http|https):\/\/www\.facebook\.com\/([^<\s]*)/",
100
+ __CLASS__ . '::embed_register_handler' );
101
+ //TODO finish this
102
+ //add_action('pre_get_posts',__CLASS__.'::pre_get_posts');
103
+ //add_action('current_screen',__CLASS__.'::pre_get_posts');
104
+ }
105
+
106
+ static function pre_get_posts(){
107
+ if(!self::active_on_post_type()){
108
+ wp_embed_unregister_handler('wpembedfb');
109
+ }
110
+ }
111
+
112
+ static function active_on_post_type() {
113
+ global $post_type, $post;
114
+
115
+ $allowed_post_types = Plugin::get_option( 'auto_embed_post_types' );
116
+
117
+ if ( in_array( $post_type, $allowed_post_types )
118
+ || ( ( $post instanceof \WP_Post )
119
+ && in_array( $post->post_type, $allowed_post_types ) ) ) {
120
+ return true;
121
+ }
122
+
123
+ return false;
124
+ }
125
+
126
+ static function embed_register_handler(
127
+ $match, /** @noinspection PhpUnusedParameterInspection */
128
+ $attr, $url = null, $atts = null
129
+ ) {
130
+ return Embed_FB::fb_embed( $match, $url, $atts );
131
+ }
132
+
133
+ static function wp_enqueue_scripts() {
134
+ //Legacy for custom templates previous to version 3.0
135
+ // now add /plugins/wp-embed-facebook/custom-embeds/ to your theme
136
+ foreach ( [ 'default', 'classic', 'elegant' ] as $theme ) {
137
+ $on_theme = locate_template( "/plugins/wp-embed-facebook/$theme/$theme.css" );
138
+ if ( ! empty( $on_theme ) ) {
139
+ wp_register_style( 'wpemfb-' . $theme, $on_theme, [], Plugin::VER );
140
+ }
141
+ }
142
+ wp_register_style( 'wpemfb-custom', Plugin::url() . 'templates/custom-embeds/styles.css',
143
+ [], Plugin::VER );
144
+ wp_register_style( 'wpemfb-lightbox', Plugin::url() . 'templates/lightbox/css/lightbox.css',
145
+ [], Plugin::VER );
146
+ wp_register_script( 'wpemfb-lightbox',
147
+ Plugin::url() . 'templates/lightbox/js/lightbox.min.js', [ 'jquery' ],
148
+ Plugin::VER );
149
+ $lb_defaults = Helpers::get_lb_defaults();
150
+ $options = Plugin::get_option();
151
+ $translation_array = [];
152
+ foreach ( $lb_defaults as $default_name => $value ) {
153
+ if ( $options[ 'LB_' . $default_name ] !== $value ) {
154
+ $translation_array[ $default_name ] = $options[ 'LB_' . $default_name ];
155
+ }
156
+ }
157
+ if ( ! empty( $translation_array ) ) {
158
+ wp_localize_script( 'wpemfb-lightbox', 'WEF_LB', $translation_array );
159
+ }
160
+
161
+ $deps = ( $options['adaptive_fb_plugin'] == 'true' ) ? [ 'jquery' ] : [];
162
+
163
+ wp_register_script( 'wpemfb-fbjs', Plugin::url() . 'inc/js/fb.min.js', $deps,
164
+ Plugin::VER );
165
+ $translation_array = [
166
+ 'local' => $options['sdk_lang'],
167
+ 'version' => $options['sdk_version'],
168
+ 'fb_id' => $options['app_id'] == '0' ? '' : $options['app_id']
169
+ ];
170
+ if ( $options['auto_comments_active'] == 'true' && $options['comments_count_active'] == 'true' ) {
171
+ $translation_array = $translation_array + [
172
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
173
+ ];
174
+ }
175
+ if ( $options['adaptive_fb_plugin'] == 'true' ) {
176
+ $translation_array = $translation_array + [
177
+ 'adaptive' => 1,
178
+ ];
179
+ }
180
+ wp_localize_script( 'wpemfb-fbjs', 'WEF', $translation_array );
181
+
182
+ if ( $options['enq_when_needed'] == 'false' ) {
183
+ if ( $options['enq_lightbox'] == 'true' ) {
184
+ wp_enqueue_script( 'wpemfb-lightbox' );
185
+ wp_enqueue_style( 'wpemfb-lightbox' );
186
+ }
187
+ if ( $options['enq_fbjs'] == 'true' ) {
188
+ wp_enqueue_script( 'wpemfb-fbjs' );
189
+ }
190
+ }
191
+ if ( $options['enq_fbjs_global'] == 'true' ) {
192
+ wp_enqueue_script( 'wpemfb-fbjs' );
193
+ }
194
+
195
+ if ( ( $options['auto_comments_active'] == 'true' ) && is_single() ) {
196
+ $array = $options['auto_comments_post_types'];
197
+ $queried_object = get_queried_object();
198
+ if ( in_array( $queried_object->post_type, $array ) ) {
199
+ wp_enqueue_script( 'wpemfb-fbjs' );
200
+ }
201
+ }
202
+ }
203
+
204
+ }
inc/Plugin.php ADDED
@@ -0,0 +1,802 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Main plugin class.
4
+ *
5
+ * @package WP Embed Facebook
6
+ */
7
+
8
+ namespace SIGAMI\WP_Embed_FB;
9
+
10
+ // If this file is called directly, abort.
11
+ if ( ! defined( 'WPINC' ) ) {
12
+ die;
13
+ }
14
+
15
+ /**
16
+ * Class Plugin Holds common varialbes, defaults, and options page
17
+ *
18
+ * @package SIGAMI\WP_Embed_FB
19
+ */
20
+ final class Plugin extends Framework {
21
+
22
+ const VER = '2.9.9';
23
+
24
+ static $option = 'wpemfb_options';
25
+ static $menu_slug = 'embedfacebook';
26
+ static $page_type = 'options';
27
+
28
+ static $debug = true;
29
+
30
+ /**
31
+ * Class constructor.
32
+ */
33
+ protected function __construct( $file ) {
34
+ self::$page_title = __( 'Embed Facebook', 'wp-embed-facebook' );
35
+ self::$menu_title = __( 'Embed Facebook', 'wp-embed-facebook' );
36
+
37
+ self::$reset_string = esc_attr__( 'Reset to defaults', 'wp-embed-facebook' );
38
+ self::$confirmation = esc_attr__( 'Are you sure?', 'wp-embed-facebook' );
39
+
40
+ parent::__construct( $file );
41
+
42
+ static::$defaults_change = static::$debug;
43
+
44
+ add_action( self::$option . '_activation', __CLASS__ . '::whois' );
45
+ add_action( self::$option . '_uninstall', __CLASS__ . '::whois' );
46
+ add_action( self::$option . '_deactivation', __CLASS__ . '::whois' );
47
+ add_action( self::$option . '_update', __CLASS__ . '::whois' );
48
+ }
49
+
50
+ /**
51
+ * Load textdomain.
52
+ */
53
+ static function load_translation() {
54
+ load_plugin_textdomain( 'wp-embed-facebook', false, basename( dirname( self::$FILE ) ) . '/lang/' );
55
+ }
56
+
57
+ /**
58
+ * Plugin defaults.
59
+ *
60
+ * @since unknown
61
+ * @since 3.0.0 Added default for `auto_scrape_post_types`.
62
+ *
63
+ * @return array
64
+ */
65
+ static function defaults() {
66
+ if ( self::$defaults === null ) {
67
+ $locale = get_locale();
68
+ $locale = str_replace( [
69
+ 'es_MX',
70
+ 'es_AR',
71
+ 'es_CL',
72
+ 'es_GT',
73
+ 'es_PE',
74
+ 'es_VE'
75
+ ], 'es_LA', $locale );
76
+
77
+ $fb_locales = Helpers::get_fb_locales();
78
+
79
+ if ( isset( $fb_locales[ $locale ] ) ) {
80
+ $sdk_lang = $locale;
81
+ } else {
82
+ $sdk_lang = 'en_US';
83
+ }
84
+
85
+ $vars = Social_Plugins::get_defaults();
86
+ $social_options = [];
87
+ foreach ( $vars as $key => $value ) {
88
+ foreach ( $value as $d_key => $d_value ) {
89
+ if ( ! in_array( $d_key, Social_Plugins::$link_types ) ) {
90
+ $social_options["{$key}_$d_key"] = $d_value;
91
+ }
92
+ }
93
+ }
94
+ self::$defaults = [
95
+ 'sdk_lang' => $sdk_lang,
96
+ 'max_width' => '450',
97
+ 'max_photos' => '24',
98
+ 'max_posts' => '0',
99
+ 'app_id' => '',
100
+ 'app_secret' => '',
101
+ 'theme' => 'default',
102
+ 'sdk_version' => 'v3.2',
103
+ 'show_like' => 'true',
104
+ 'fb_root' => 'true',
105
+ 'show_follow' => 'true',
106
+ 'video_ratio' => 'false',
107
+ 'video_as_post' => 'false',
108
+ 'raw_photo' => 'false',
109
+ 'raw_post' => 'false',
110
+ 'raw_page' => 'false',
111
+ 'enqueue_style' => 'true',
112
+ 'enq_lightbox' => 'true',
113
+ 'enq_fbjs' => 'true',
114
+ 'close_warning2' => 'false',
115
+ 'enq_fbjs_global' => 'false',
116
+ 'enq_when_needed' => 'false',
117
+ //Lightbox options
118
+ 'LB_albumLabel' => 'Image %1 of %2',
119
+ 'LB_alwaysShowNavOnTouchDevices' => 'false',
120
+ 'LB_showImageNumberLabel' => 'true',
121
+ 'LB_wrapAround' => 'false',
122
+ 'LB_disableScrolling' => 'false',
123
+ 'LB_fitImagesInViewport' => 'true',
124
+ 'LB_maxWidth' => '0',
125
+ 'LB_maxHeight' => '0',
126
+ 'LB_positionFromTop' => '50',
127
+ 'LB_resizeDuration' => '700',
128
+ 'LB_fadeDuration' => '500',
129
+ 'LB_wpGallery' => 'false',
130
+ 'FB_plugins_as_iframe' => 'false',
131
+ 'adaptive_fb_plugin' => 'false',
132
+ 'quote_plugin_active' => 'false',
133
+ 'quote_post_types' => [ 'post', 'page' ],
134
+ 'auto_embed_active' => 'true',
135
+ //
136
+ 'auto_embed_post_types' => [ 'post' ],//TODO test
137
+ 'auto_comments_active' => 'false',
138
+ 'auto_comments_post_types' => [ 'post' ],
139
+ 'comments_count_active' => 'true',
140
+ 'comments_open_graph' => 'true',
141
+ // 'scrape_open_graph' => 'true',//TODO get real options from file
142
+ 'lightbox_att' => 'data-lightbox="roadtrip"',
143
+ 'event_start_time_format' => 'l, j F Y g:i a',
144
+ 'single_post_time_format' => 'l, j F Y g:s a',
145
+ 'single_post_from_like' => 'false',
146
+ 'permalink_on_social_plugins' => 'false',
147
+ //'auto_scrape_posts' => 'true',
148
+ //'auto_scrape_post_types' => [ 'post', 'page' ],
149
+ ] + $social_options;
150
+ }
151
+
152
+ /**
153
+ * Filter default options of the plugin.
154
+ *
155
+ * @param array $default Default options.
156
+ *
157
+ * @since unknown
158
+ */
159
+ return apply_filters( 'wpemfb_defaults', self::$defaults );
160
+ }
161
+
162
+ static function tabs() {
163
+ $comment_notes
164
+ = sprintf( __( 'To enable comments moderation setup your App ID <a href="#fb_api">here</a>', 'wp-embed-facebook' ),
165
+ Admin::$url );
166
+ $comment_notes .= '<br>';
167
+ $comment_notes .= '<small>';
168
+ $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>',
169
+ 'wp-embed-facebook' ), 'https://developers.facebook.com/tools/debug/sharing/' );
170
+ $comment_notes .= '<br>';
171
+ //$comment_notes .= 'An automatic solution for this will be available on future releases<br>';
172
+ $comment_notes .= '</small><br>';
173
+
174
+ ob_start();
175
+ 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.',
176
+ 'wp-embed-facebook' ), 'https://developers.facebook.com/docs/plugins/' )
177
+ ?>
178
+ <br>
179
+ <strong><?php _e( 'Example:', 'wp-embed-facebook' ) ?></strong>
180
+ <br>
181
+ <?php _e( 'Embed a like button for the current page:', 'wp-embed-facebook' ) ?>
182
+ <br>
183
+ <code class="shortcode_example">[fb_plugin like share=true layout=button_count]</code><br>
184
+ <?php _e( '<strong>add help=1</strong> to view all available options and defaults.', 'wp-embed-facebook' ); ?>
185
+ <br>
186
+ <?php _e( 'Like, Share, Save and Send buttons take the current page as default. To set a custom url use the href= attribute or uri= in case of the save button.',
187
+ 'wp-embed-facebook' ) ?>
188
+ <?php
189
+ $social_plugins_desc = ob_get_clean();
190
+ ob_start();
191
+ ?>
192
+ <p>
193
+ <?php _e( 'Custom embeds can be triggered using the [embedfb url] or [embed] shortcodes also by activating "Auto Embeds" on Magic Embeds section.',
194
+ 'wp-embed-facebook' ) ?>
195
+ <br>
196
+ <strong><?php _e( 'Example:', 'wp-embed-facebook' ) ?></strong>
197
+ <br>
198
+ Page custom embed<br>
199
+ <code class="shortcode_example">[embedfb https://www.facebook.com/sydneyoperahouse/
200
+ social_plugin=false posts=2]</code>
201
+ <br>
202
+ <?php printf( __( '<a href="%s" title="WP Embed Facebook Shortcode" target="_blank">Read More</a>', 'wp-embed-facebook' ),
203
+ 'http://www.wpembedfb.com/shortcode-attributes-and-examples/' ) ?>
204
+ </p>
205
+ <?php
206
+ $custom_embeds_desc = ob_get_clean();
207
+ $post_types = get_post_types( [ 'public' => true ] );
208
+ $public_post_types = array_combine( $post_types, $post_types );
209
+ $sections = [
210
+ # Magic Embeds
211
+ [
212
+ 'label' => __( 'Magic Embeds', 'wp-embed-facebook' ),
213
+ 'id' => 'magic_embeds',
214
+ 'sections' => [
215
+ [
216
+ 'title' => __( 'Auto Embeds', 'wp-embed-facebook' ),
217
+ 'description' => 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="%s" title="WordPress Embeds" target="_blank">pasting the url on the editor</a> or by the [embedfb url ] <a href="%s" title="[facebook] Shortcode attributes and examples" target="_blank">shortcode</a>.',
218
+ 'wp-embed-facebook' ), 'https://codex.wordpress.org/Embeds',
219
+ 'http://www.wpembedfb.com/shortcode-attributes-and-examples/' ),
220
+ 'fields' => [
221
+ [
222
+ 'type' => 'checkbox',
223
+ 'name' => 'auto_embed_active',
224
+ 'label' => __( "Auto embed URL's on editor", 'wp-embed-facebook' ),
225
+ ],
226
+ [
227
+ 'type' => 'number',
228
+ 'name' => 'max_width',
229
+ 'label' => __( 'Maximum width in pixels', 'wp-embed-facebook' ),
230
+ 'attributes' => [ 'min' => '0' ]
231
+ ],
232
+ [
233
+ 'type' => 'checkbox',
234
+ 'name' => 'video_as_post',
235
+ 'label' => __( 'Embed video as post', 'wp-embed-facebook' ),
236
+ ],
237
+ ]
238
+ ],
239
+ [
240
+ 'title' => __( 'Comments', 'wp-embed-facebook' ),
241
+ 'description' => __( 'Replace WP comments for FB comments on selected post types', 'wp-embed-facebook' ),
242
+ 'fields' => [
243
+ [
244
+ 'type' => 'checkbox',
245
+ 'name' => 'auto_comments_active',
246
+ 'label' => __( 'Active', 'wp-embed-facebook' ),
247
+ ],
248
+ [
249
+ 'type' => 'checklist',
250
+ 'name' => 'auto_comments_post_types',
251
+ 'label' => __( 'Post types', 'wp-embed-facebook' ),
252
+ 'values' => $public_post_types
253
+ ],
254
+ [
255
+ 'type' => 'checkbox',
256
+ 'name' => 'comments_count_active',
257
+ 'label' => __( 'Sync comment count', 'wp-embed-facebook' ),
258
+ 'description' => sprintf( '<p class="description">%s<br>%s</p>',
259
+ __( 'Comments count get stored on _wef_comments_count post meta.', 'wp-embed-facebook' ),
260
+ __( 'You can refresh the comment count by updating the post', 'wp-embed-facebook' ) ),
261
+ ],
262
+ [
263
+ 'type' => 'checkbox',
264
+ 'name' => 'comments_open_graph',
265
+ 'label' => __( 'Add open graph meta', 'wp-embed-facebook' ),
266
+ 'description' => sprintf( '%s<p class="description">%s<br>' . $comment_notes . '</p>',
267
+ __( 'Needed to moderate comments', 'wp-embed-facebook' ),
268
+ 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>',
269
+ 'wp-embed-facebook' ),
270
+ 'https://developers.facebook.com/docs/plugins/comments/#moderation-setup-instructions' ) ),
271
+ ],
272
+ ]
273
+ ],
274
+ [
275
+ 'title' => __( 'Quote Plugin', 'wp-embed-facebook' ),
276
+ 'description' => __( 'The quote plugin lets people select text on your page and add it to their Facebook share.',
277
+ 'wp-embed-facebook' ),
278
+ 'fields' => [
279
+ [
280
+ 'type' => 'checkbox',
281
+ 'name' => 'quote_plugin_active',
282
+ 'label' => __( 'Active', 'wp-embed-facebook' ),
283
+ ],
284
+ [
285
+ 'type' => 'checklist',
286
+ 'name' => 'quote_post_types',
287
+ 'label' => __( 'Post types', 'wp-embed-facebook' ),
288
+ 'values' => $public_post_types
289
+ ],
290
+ ]
291
+ ],
292
+ ]
293
+ ],
294
+ # Social Plugins
295
+ //TODO add group
296
+ [
297
+ 'label' => __( 'Social Plugins', 'wp-embed-facebook' ),
298
+ 'id' => 'social_plugins',
299
+ 'sections' => [
300
+ [
301
+ 'title' => 'Social Plugins',
302
+ 'description' => $social_plugins_desc,
303
+ ],
304
+ [
305
+ 'title' => __( 'Adaptive view', 'wp-embed-facebook' ),
306
+ 'fields' => [
307
+ [
308
+ 'type' => 'checkbox',
309
+ 'name' => 'adaptive_fb_plugin',
310
+ 'label' => __( 'Active', 'wp-embed-facebook' ),
311
+ 'description' => __( 'Make social plugins adapt their width to parent container on page load',
312
+ 'wp-embed-facebook' ),
313
+ ],
314
+ ]
315
+ ],
316
+ [
317
+ 'title' => __( 'Page plugin', 'wp-embed-facebook' ),
318
+ 'description' => Social_Plugins::get_links( 'page' )
319
+ . ' <code class="shortcode_example">[fb_plugin page href=]</code>',
320
+ 'fields' => [
321
+ self::social_field( 'page', 'width' ),
322
+ self::social_field( 'page', 'height' ),
323
+ self::social_field( 'page', 'tabs',
324
+ __( 'Tabs separated by commas i.e. timeline,events,messages', 'wp-embed-facebook' ) ),
325
+ self::social_field( 'page', 'hide-cover' ),
326
+ self::social_field( 'page', 'hide-cta' ),
327
+ self::social_field( 'page', 'small-header' ),
328
+ self::social_field( 'page', 'adapt-container-width' ),
329
+ ]
330
+ ],
331
+ [
332
+ 'title' => __( 'Post plugin', 'wp-embed-facebook' ),
333
+ 'description' => Social_Plugins::get_links( 'post' )
334
+ . ' <code class="shortcode_example">[fb_plugin post href=]</code>',
335
+ 'fields' => [
336
+ self::social_field( 'post', 'width' ),
337
+ self::social_field( 'post', 'show-text' ),
338
+ ]
339
+ ],
340
+ [
341
+ 'title' => __( 'Video & Live Stream', 'wp-embed-facebook' ),
342
+ 'description' => Social_Plugins::get_links( 'video' )
343
+ . ' <code class="shortcode_example">[fb_plugin video href=]</code>',
344
+ 'fields' => [
345
+ self::social_field( 'video', 'allowfullscreen' ),
346
+ self::social_field( 'video', 'autoplay' ),
347
+ self::social_field( 'video', 'width' ),
348
+ self::social_field( 'video', 'show-text' ),
349
+ self::social_field( 'video', 'show-captions' )
350
+ ]
351
+ ],
352
+ [
353
+ 'title' => __( 'Group', 'wp-embed-facebook' ),
354
+ 'description' => Social_Plugins::get_links( 'group' )
355
+ . ' <code class="shortcode_example">[fb_plugin group href=]</code>',
356
+ 'fields' => [
357
+ self::social_field( 'group', 'show-social-context' ),
358
+ self::social_field( 'group', 'show-metadata' ),
359
+ self::social_field( 'group', 'skin' ),
360
+ ]
361
+ ],
362
+ [
363
+ 'title' => __( 'Single Comment', 'wp-embed-facebook' ),
364
+ 'description' => Social_Plugins::get_links( 'comment' )
365
+ . ' <code class="shortcode_example">[fb_plugin comment href=]</code>',
366
+ 'fields' => [
367
+ self::social_field( 'comment', 'width' ),
368
+ self::social_field( 'comment', 'include-parent' ),
369
+ ]
370
+ ],
371
+ [
372
+ 'title' => __( 'Comments plugin', 'wp-embed-facebook' ),
373
+ 'description' => Social_Plugins::get_links( 'comments' )
374
+ . ' <code class="shortcode_example">[fb_plugin comments]</code>' . '<br>'
375
+ . __( 'Activate them on all your posts or custom post types on the "Magic embeds" section',
376
+ 'wp-embed-facebook' ) . '<a href="' . admin_url( "options-general.php?page=embedfacebook#magic_embeds" )
377
+ . '">here</a>',
378
+ 'fields' => [
379
+ self::social_field( 'comments', 'colorscheme' ),
380
+ self::social_field( 'comments', 'mobile' ),
381
+ self::social_field( 'comments', 'num_posts' ),
382
+ self::social_field( 'comments', 'order_by' ),
383
+ self::social_field( 'comments', 'width' ),
384
+ ]
385
+ ],
386
+ [
387
+ 'title' => __( 'Quote plugin', 'wp-embed-facebook' ),
388
+ 'description' => Social_Plugins::get_links( 'quote' )
389
+ . ' <code class="shortcode_example">[fb_plugin quote]</code>' . '<br>'
390
+ . __( 'Activate them on all your posts or custom post types on the "Magic embeds" section',
391
+ 'wp-embed-facebook' ) . '<a href="' . admin_url( "options-general.php?page=embedfacebook#magic_embeds" )
392
+ . '">here</a>',
393
+ 'fields' => [
394
+ self::social_field( 'quote', 'layout' ),
395
+ ]
396
+ ],
397
+ [
398
+ 'title' => __( 'Save Button', 'wp-embed-facebook' ),
399
+ 'description' => Social_Plugins::get_links( 'save' )
400
+ . ' <code class="shortcode_example">[fb_plugin save]</code>',
401
+ 'fields' => [
402
+ self::social_field( 'save', 'size' ),
403
+ ]
404
+ ],
405
+ [
406
+ 'title' => __( 'Like Button', 'wp-embed-facebook' ),
407
+ 'description' => Social_Plugins::get_links( 'like' )
408
+ . ' <code class="shortcode_example">[fb_plugin like]</code>',
409
+ 'fields' => [
410
+ self::social_field( 'like', 'action' ),
411
+ self::social_field( 'like', 'colorscheme' ),
412
+ self::social_field( 'like', 'kid-directed-site' ),
413
+ self::social_field( 'like', 'layout' ),
414
+ self::social_field( 'like', 'ref',
415
+ __( 'A label for tracking referrals which must be less than 50 characters and can contain alphanumeric characters and some punctuation',
416
+ 'wp-embed-facebook' ) ),
417
+ self::social_field( 'like', 'share' ),
418
+ self::social_field( 'like', 'show-faces' ),
419
+ self::social_field( 'like', 'size' ),
420
+ self::social_field( 'like', 'width' ),
421
+ ]
422
+ ],
423
+ [
424
+ 'title' => __( 'Share Button', 'wp-embed-facebook' ),
425
+ 'description' => Social_Plugins::get_links( 'share' )
426
+ . ' <code class="shortcode_example">[fb_plugin share]</code>',
427
+ 'fields' => [
428
+ self::social_field( 'share', 'layout' ),
429
+ self::social_field( 'share', 'mobile_iframe' ),
430
+ ]
431
+ ]
432
+ ]
433
+ ],
434
+ # API
435
+ [
436
+ 'label' => __( 'API', 'wp-embed-facebook' ),
437
+ 'id' => 'fb_api',
438
+ 'sections' => [
439
+ [
440
+ 'title' => __( 'Facebook API settings', 'wp-embed-facebook' ),
441
+ 'description' => sprintf( __( '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>.',
442
+ 'wp-embed-facebook' ), 'http://www.wpembedfb.com/blog/creating-a-facebook-app-the-step-by-step-guide/',
443
+ 'https://developers.facebook.com/apps' ),
444
+ 'fields' => [
445
+ [
446
+ 'type' => 'select',
447
+ 'name' => 'sdk_lang',
448
+ 'label' => __( 'Social Plugins Language', 'wp-embed-facebook' ),
449
+ 'values' => Helpers::get_fb_locales()
450
+ ],
451
+ [
452
+ 'type' => 'select',
453
+ 'name' => 'sdk_version',
454
+ 'label' => __( 'API Version', 'wp-embed-facebook' ),
455
+ 'values' => Helpers::get_api_versions()
456
+ ],
457
+ [
458
+ 'type' => 'text',
459
+ 'name' => 'app_id',
460
+ 'label' => __( 'App ID', 'wp-embed-facebook' ),
461
+ 'description' => __( 'Needed for comments moderation and custom embeds', 'wp-embed-facebook' )
462
+ ],
463
+ [
464
+ 'type' => 'text',
465
+ 'name' => 'app_secret',
466
+ 'label' => __( 'App Secret', 'wp-embed-facebook' ),
467
+ 'description' => __( 'Needed for custom embeds', 'wp-embed-facebook' )
468
+ ],
469
+ ]
470
+ ],
471
+ ]
472
+ ],
473
+ # Custom Embeds
474
+ [
475
+ 'label' => __( 'Custom Embeds', 'wp-embed-facebook' ),
476
+ 'id' => 'custom_embeds',
477
+ 'sections' => [
478
+ [
479
+ 'title' => __( 'Custom Embeds', 'wp-embed-facebook' ),
480
+ 'description' => $custom_embeds_desc,
481
+ ],
482
+ [
483
+ 'title' => __( 'For all embeds', 'wp-embed-facebook' ),
484
+ 'description' => __( 'Change this for individual embeds using the shortcode attributes', 'wp-embed-facebook' )
485
+ . '<br><code class="shortcode_example">[embedfb https://ww... theme=classic]</code>',
486
+ 'fields' => [
487
+ [
488
+ 'type' => 'select',
489
+ 'name' => 'theme',
490
+ 'label' => __( 'Template', 'wp-embed-facebook' ),
491
+ 'values' => [
492
+ 'default' => 'Default',
493
+ 'classic' => 'Classic',
494
+ 'elegant' => 'Elegant'
495
+ ]
496
+ ],
497
+ ]
498
+ ],
499
+
500
+ [
501
+ 'title' => __( 'Albums', 'wp-embed-facebook' ),
502
+ 'description' => __( 'Change this for individual embeds using the shortcode attributes', 'wp-embed-facebook' )
503
+ . '<br><code class="shortcode_example">[embedfb https://ww... photos=20]</code>',
504
+ 'fields' => [
505
+ [
506
+ 'type' => 'number',
507
+ 'name' => 'max_photos',
508
+ 'label' => __( 'Maximum number of photos', 'wp-embed-facebook' ),
509
+ ],
510
+
511
+ ]
512
+ ],
513
+ [
514
+ 'title' => __( 'Pages', 'wp-embed-facebook' ),
515
+ 'description' => __( 'Change this for individual embeds using the shortcode attributes', 'wp-embed-facebook' )
516
+ . '<br><code class="shortcode_example">[embedfb https://ww... posts=2 social_plugin=false ]</code>',
517
+ 'fields' => [
518
+ [
519
+ 'type' => 'checkbox',
520
+ 'name' => 'raw_page',
521
+ 'label' => __( 'Use custom embed by default on "Auto Embeds"', 'wp-embed-facebook' ),
522
+ ],
523
+ [
524
+ 'type' => 'checkbox',
525
+ 'name' => 'show_like',
526
+ 'label' => __( 'Show like button', 'wp-embed-facebook' ),
527
+ ],
528
+ [
529
+ 'type' => 'number',
530
+ 'name' => 'max_posts',
531
+ 'label' => __( 'Number of posts', 'wp-embed-facebook' ),
532
+ ],
533
+
534
+ ]
535
+ ],
536
+ [
537
+ 'title' => __( 'Photo', 'wp-embed-facebook' ),
538
+ 'description' => __( 'Change this for individual embeds using the shortcode attributes', 'wp-embed-facebook' )
539
+ . '<br><code class="shortcode_example">[embedfb https://ww... social_plugin=false ]</code>',
540
+ 'fields' => [
541
+ [
542
+ 'type' => 'checkbox',
543
+ 'name' => 'raw_photo',
544
+ 'label' => __( 'Use custom embed by default on "Auto Embeds"', 'wp-embed-facebook' ),
545
+ ]
546
+
547
+ ]
548
+ ],
549
+ [
550
+ 'title' => __( 'Post', 'wp-embed-facebook' ),
551
+ 'description' => __( 'Change this for individual embeds using the shortcode attributes', 'wp-embed-facebook' )
552
+ . '<br><code class="shortcode_example">[embedfb https://ww... social_plugin=false ]</code>',
553
+ 'fields' => [
554
+ [
555
+ 'type' => 'checkbox',
556
+ 'name' => 'raw_post',
557
+ 'label' => __( 'Use custom embed by default on "Auto Embeds"', 'wp-embed-facebook' ),
558
+ ],
559
+ [
560
+ 'type' => 'text',
561
+ 'name' => 'single_post_time_format',
562
+ 'label' => __( 'Time format', 'wp-embed-facebook' ),
563
+ 'description' => '<a href="https://codex.wordpress.org/Formatting_Date_and_Time" target="_blank">'
564
+ . __( 'examples', 'wp-embed-facebook' ) . '<a/>'
565
+ ]
566
+
567
+ ]
568
+ ]
569
+ ]
570
+ ],
571
+ # Lightbox
572
+ [
573
+ 'label' => __( 'Lightbox', 'wp-embed-facebook' ),
574
+ 'id' => 'ligthbox',
575
+ 'sections' => [
576
+ [
577
+ 'title' => __( 'Lightbox' ),
578
+ 'fields' => [
579
+ [
580
+ 'type' => 'checkbox',
581
+ 'name' => 'LB_showImageNumberLabel',
582
+ 'label' => __( 'Show Image Number Label', 'wp-embed-facebook' ),
583
+ ],
584
+ [
585
+ 'type' => 'text',
586
+ 'name' => 'LB_albumLabel',
587
+ 'label' => __( 'Album Label', 'wp-embed-facebook' ),
588
+ ],
589
+ [
590
+ 'type' => 'number',
591
+ 'name' => 'LB_fadeDuration',
592
+ 'label' => __( 'Fade Duration', 'wp-embed-facebook' ),
593
+ 'attributes' => [ 'min' => '0' ]
594
+ ],
595
+ [
596
+ 'type' => 'number',
597
+ 'name' => 'LB_resizeDuration',
598
+ 'label' => __( 'Resize Duration', 'wp-embed-facebook' ),
599
+ 'attributes' => [ 'min' => '0' ]
600
+ ],
601
+ [
602
+ 'type' => 'number',
603
+ 'name' => 'LB_positionFromTop',
604
+ 'label' => __( 'Position From Top', 'wp-embed-facebook' ),
605
+ 'attributes' => [ 'min' => '0' ]
606
+ ],
607
+ [
608
+ 'type' => 'number',
609
+ 'name' => 'LB_maxHeight',
610
+ 'label' => __( 'Max Height', 'wp-embed-facebook' ),
611
+ 'attributes' => [ 'min' => '0' ]
612
+ ],
613
+ [
614
+ 'type' => 'number',
615
+ 'name' => 'LB_maxWidth',
616
+ 'label' => __( 'Max Width', 'wp-embed-facebook' ),
617
+ 'attributes' => [ 'min' => '0' ]
618
+ ],
619
+ [
620
+ 'type' => 'checkbox',
621
+ 'name' => 'LB_alwaysShowNavOnTouchDevices',
622
+ 'label' => __( 'Always Show Nav On TouchDevices', 'wp-embed-facebook' ),
623
+ 'attributes' => ''
624
+ ],
625
+ [
626
+ 'type' => 'checkbox',
627
+ 'name' => 'LB_fitImagesInViewport',
628
+ 'label' => __( 'Fit Images In Viewport', 'wp-embed-facebook' ),
629
+ ],
630
+ [
631
+ 'type' => 'checkbox',
632
+ 'name' => 'LB_disableScrolling',
633
+ 'label' => __( 'Disable Scrolling', 'wp-embed-facebook' ),
634
+ ],
635
+ [
636
+ 'type' => 'checkbox',
637
+ 'name' => 'LB_wrapAround',
638
+ 'label' => __( 'Loop Through Album', 'wp-embed-facebook' ),
639
+ ],
640
+ [
641
+ 'type' => 'checkbox',
642
+ 'name' => 'LB_wpGallery',
643
+ 'label' => __( 'Use this lightbox on the [gallery] shortcode', 'wp-embed-facebook' ),
644
+ ],
645
+ ]
646
+
647
+ ]
648
+ ]
649
+ ],
650
+ # Advanced
651
+ [
652
+ 'label' => __( 'Advanced', 'wp-embed-facebook' ),
653
+ 'id' => 'advanced',
654
+ 'sections' => [
655
+ [
656
+ 'title' => __( 'Enqueue styles and scripts', 'wp-embed-facebook' ),
657
+ 'fields' => [
658
+ [
659
+ 'type' => 'checkbox',
660
+ 'name' => 'enq_when_needed',
661
+ 'label' => __( 'Only when there is an embed present', 'wp-embed-facebook' )
662
+ ],
663
+ [
664
+ 'type' => 'checkbox',
665
+ 'name' => 'permalink_on_social_plugins',
666
+ 'label' => __( 'Use permalinks on social plugins urls', 'wp-embed-facebook' )
667
+ ],
668
+ [
669
+ 'type' => 'checkbox',
670
+ 'name' => 'enq_fbjs',
671
+ 'label' => __( 'Facebook SDK', 'wp-embed-facebook' )
672
+ ],
673
+ [
674
+ 'type' => 'checkbox',
675
+ 'name' => 'enqueue_style',
676
+ 'label' => __( 'Template Styles', 'wp-embed-facebook' )
677
+ ]
678
+ ]
679
+ ],
680
+ [
681
+ 'title' => __( 'Lightbox', 'wp-embed-facebook' ),
682
+ 'fields' => [
683
+ [
684
+ 'type' => 'checkbox',
685
+ 'name' => 'enq_lightbox',
686
+ 'label' => __( 'Enqueue script', 'wp-embed-facebook' )
687
+ ],
688
+ [
689
+ 'type' => 'text',
690
+ 'name' => 'lightbox_att',
691
+ 'label' => __( 'Attribute', 'wp-embed-facebook' )
692
+ ],
693
+ ]
694
+ ],
695
+ [
696
+ 'title' => __( 'Other options', 'wp-embed-facebook' ),
697
+ 'fields' => [
698
+ [
699
+ 'type' => 'checkbox',
700
+ 'name' => 'fb_root',
701
+ 'label' => __( 'Add fb-root on top of content', 'wp-embed-facebook' )
702
+ ],
703
+ [
704
+ 'type' => 'checkbox',
705
+ 'name' => 'enq_fbjs_global',
706
+ 'label' => __( 'Force Facebook SDK script on all site', 'wp-embed-facebook' )
707
+ ],
708
+ [
709
+ 'type' => 'hidden',
710
+ 'name' => 'close_warning2',
711
+ 'attributes' => [ 'value' => 'true' ]
712
+ ],
713
+ ]
714
+ ]
715
+ ]
716
+ ],
717
+
718
+ ];
719
+
720
+ /**
721
+ * Filter plugin options.
722
+ *
723
+ * @param array $sections Plugin options.
724
+ */
725
+ return apply_filters( 'wpemfb_admin_sections', $sections );
726
+ }
727
+
728
+ /**
729
+ * @param string $plugin
730
+ * @param string $option
731
+ * @param null $description
732
+ *
733
+ * @return array
734
+ */
735
+ static function social_field( $plugin, $option, $description = null ) {
736
+ $all_vars = Social_Plugins::get_defaults( true );
737
+ $defaults = $all_vars[ $plugin ];
738
+ $values = $defaults[ $option ];
739
+ $field['name'] = $plugin . '_' . $option;
740
+ $field['label'] = $option;
741
+ if ( is_array( $values ) ) {
742
+ if ( ( $values[0] === self::$on || $values[0] === self::$off )
743
+ && ( $values[1] === self::$on || $values[1] === self::$off ) ) {
744
+ $field['type'] = 'checkbox';
745
+ } else {
746
+ $field['type'] = 'select';
747
+ $field['values'] = $values;
748
+ }
749
+ } elseif ( is_numeric( $values ) ) {
750
+ $field['type'] = 'number';
751
+ } else {
752
+ $field['type'] = 'text';
753
+ }
754
+ if ( $description !== null ) {
755
+ $field['description'] = $description;
756
+ }
757
+
758
+ return $field;
759
+
760
+ }
761
+
762
+ static function before_form() {
763
+ echo '<div class="wef-content">';
764
+ }
765
+
766
+ static function after_form() {
767
+ echo '</div>';
768
+ ?>
769
+ <div class="wef-sidebar">
770
+ <?php ob_start(); ?>
771
+ <h2><?php _e( "This free plugin has taken thousands of hours to maintain and develop", 'wp-embed-facebook' ) ?></h2>
772
+ <h3>
773
+ <a href="https://wordpress.org/support/plugin/wp-embed-facebook/reviews/?rate=5#new-post"
774
+ title="wordpress.org"
775
+ target="_blank"><?php _e( "Rate it", 'wp-embed-facebook' ) ?>
776
+ <br>
777
+ <span style="color: gold;"> &#9733;&#9733;&#9733;&#9733;&#9733; </span>
778
+ </a>
779
+ </h3>
780
+ <!-- <h3><a target="_blank" title="paypal"-->
781
+ <!-- href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R8Q85GT3Q8Q26">👾--><?php //_e( 'Donate',
782
+ // 'wp-embed-facebook' ) ?>
783
+ <!-- 👾</a>-->
784
+ <!-- </h3>-->
785
+ <hr>
786
+ <p><a href="http://www.wpembedfb.com" title="plugin website" target="_blank">
787
+ <small><?php _e( 'Plugin Website', 'wp-embed-facebook' ) ?></small>
788
+ </a></p>
789
+ <?php echo ob_get_clean(); ?>
790
+
791
+ </div>
792
+ <?php
793
+ }
794
+
795
+ static function whois( $install ) {
796
+ $home = esc_url( get_home_url() );
797
+ @file_get_contents( "http://www.wpembedfb.com/api/?whois=$install&site_url=$home" );
798
+
799
+ return true;
800
+ }
801
+
802
+ }
inc/Social_Plugins.php ADDED
@@ -0,0 +1,685 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Group of static functions to render facebook social
4
+ * plugins on WordPress it has no dependencies.
5
+ *
6
+ * @author Miguel Sirvent & Rahul Aryan
7
+ * @package WP Embed Facebook
8
+ * @subpackage Classes
9
+ */
10
+
11
+ namespace SIGAMI\WP_Embed_FB;
12
+
13
+ // If this file is called directly, abort.
14
+ if ( ! defined( 'WPINC' ) ) {
15
+ die;
16
+ }
17
+
18
+ /**
19
+ * Social plugin class.
20
+ *
21
+ * @since unknown
22
+ */
23
+ class Social_Plugins {
24
+
25
+ /**
26
+ * @var array $link_types Link fields needed for rendering a social plugin
27
+ */
28
+ static $link_types = [ 'href', 'uri' ];
29
+
30
+ /**
31
+ * Quote Plugin
32
+ *
33
+ * The quote plugin lets people select text on your page and add it to their share, so they can
34
+ * tell a more expressive story.
35
+ *
36
+ * <code>
37
+ *
38
+ * href: The absolute URL of the page that will be quoted.
39
+ * layout:
40
+ * quote: On text selection, a button with a blue Facebook icon and "Share Quote" text is
41
+ * shown as an overlay. When a person clicks it, it will open a share dialog with the
42
+ * highlighted text as a quote. button: Behaves the same as the "quote" option but has just
43
+ * a blue Facebook icon in the button.
44
+ *
45
+ * </code>
46
+ *
47
+ * @link https://developers.facebook.com/docs/plugins/quote
48
+ */
49
+ static $quote
50
+ = [
51
+ 'href' => '',
52
+ 'layout' => [ 'quote', 'button' ]
53
+ ];
54
+ /**
55
+ * Save Button
56
+ *
57
+ * The save button lets people save items or services to a private list on Facebook, share it
58
+ * with friends, and receive relevant notifications. For example, a person can save an item of
59
+ * clothing, trip, or link that they're thinking about and go back to that list for future
60
+ * consumption, or get notified when that item or trip has a promotional deal.
61
+ *
62
+ * <code>
63
+ *
64
+ * uri: The absolute link of the page that will be saved.
65
+ * size: large or small
66
+ *
67
+ * </code>
68
+ *
69
+ * @link https://developers.facebook.com/docs/plugins/save
70
+ */
71
+ static $save
72
+ = [
73
+ 'uri' => '',
74
+ 'size' => [ 'large', 'small' ]
75
+ ];
76
+ /**
77
+ * Like Button
78
+ *
79
+ * A single click on the Like button will 'like' pieces of content on the web and share them on
80
+ * Facebook. You can also display a Share button next to the Like button to let people add a
81
+ * personal message and customize who they share with.
82
+ *
83
+ * <code>
84
+ *
85
+ * action: The verb to display on the button.
86
+ * like
87
+ * recommend
88
+ * colorscheme: The color scheme used by the plugin for any text outside of the button itself.
89
+ * light
90
+ * dark
91
+ * href: The absolute URL of the page that will be quoted.
92
+ * kid-directed-site: TIf your web site or online service, or a portion of your service, is
93
+ * directed to children under 13 you must enable this layout: Selects one of the different
94
+ * layouts that are available for the plugin. standard button_count button box_count ref: A
95
+ * label for tracking referrals which must be less than 50 characters and can contain
96
+ * alphanumeric characters and some punctuation (currently +/=-.:_). share: Specifies whether
97
+ * to include a share button beside the Like button. This only works with the XFBML version.
98
+ * show_faces: Specifies whether to display profile photos below the button (standard layout
99
+ * only). You must not enable this on child-directed sites. width: The width of the plugin
100
+ * (standard layout only), which is subject to the minimum and default width. default 450
101
+ * minimum 225
102
+ *
103
+ * </code>
104
+ *
105
+ * @link https://developers.facebook.com/docs/plugins/like-button
106
+ */
107
+ static $like
108
+ = [
109
+ 'href' => '',
110
+ 'action' => [ 'like', 'recommend' ],
111
+ 'colorscheme' => [ 'light', 'dark' ],
112
+ 'kid-directed-site' => [ 'false', 'true' ],
113
+ 'layout' => [ 'standard', 'button_count', 'button', 'box_count' ],
114
+ 'ref' => '',
115
+ 'share' => [ 'false', 'true' ],
116
+ 'show-faces' => [ 'true', 'false' ],
117
+ 'size' => [ 'small', 'large' ],
118
+ 'width' => '450'
119
+ ];
120
+ /**
121
+ * Share Button
122
+ *
123
+ * The Share button lets people add a personalized message to links before sharing on their
124
+ * timeline, in groups, or to their friends via a Facebook Message.
125
+ *
126
+ * <code>
127
+ *
128
+ * href: The absolute URL of the page that will be quoted.
129
+ * layout: Selects one of the different layouts that are available for the plugin.
130
+ * link
131
+ * icon_link
132
+ * icon
133
+ * button_count
134
+ * button
135
+ * box_count
136
+ * mobile_iframe: If set to true, the share button will open the share dialog in an iframe
137
+ * (instead of a popup) on top of your website on mobile. This option is only available for
138
+ * mobile, not desktop. characters and some punctuation (currently +/=-.:_).
139
+ *
140
+ * </code>
141
+ *
142
+ * @link https://developers.facebook.com/docs/plugins/share-button/
143
+ */
144
+ static $share
145
+ = [
146
+ 'href' => '',
147
+ 'layout' => [
148
+ 'icon_link',
149
+ 'link',
150
+ 'icon',
151
+ 'button_count',
152
+ 'button',
153
+ 'box_count'
154
+ ],
155
+ 'mobile_iframe' => [ 'false', 'true' ],
156
+ ];
157
+ /**
158
+ * Send Button
159
+ *
160
+ * The Send button lets people privately send content on your site to one or more friends in a
161
+ * Facebook message.
162
+ *
163
+ * <code>
164
+ *
165
+ * href: The absolute URL of the page that will be quoted.
166
+ * colorscheme: The color scheme used by the plugin.
167
+ * light
168
+ * dark
169
+ * kid-directed-site: TIf your web site or online service, or a portion of your service, is
170
+ * directed to children under 13 you must enable this ref: A label for tracking referrals which
171
+ * must be less than 50 characters and can contain alphanumeric characters and some punctuation
172
+ * (currently +/=-.:_).
173
+ *
174
+ * </code>
175
+ *
176
+ * @link https://developers.facebook.com/docs/plugins/send-button
177
+ */
178
+ //static $send
179
+ // = [
180
+ // 'href' => '',
181
+ // 'colorscheme' => [ 'light', 'dark' ],
182
+ // 'kid-directed-site' => [ 'false', 'true' ],
183
+ // 'ref' => '',
184
+ // ];
185
+ /**
186
+ * Group
187
+ *
188
+ * The Group Plugins lets people join your Facebook group from a link in an email message or a
189
+ * web page.
190
+ *
191
+ * @link https://developers.facebook.com/docs/plugins/group-plugin
192
+ */
193
+ static $group
194
+ = [
195
+ 'href' => '',
196
+ 'show-social-context' => [ 'false', 'true' ],
197
+ 'show-metadata' => [ 'false', 'true' ],
198
+ 'skin' => [ 'light', 'dark' ],
199
+ ];
200
+ /**
201
+ * Embedded Comments
202
+ *
203
+ * Embedded comments are a simple way to put public post comments - by a Page or a person on
204
+ * Facebook - into the content of your web site or web page. Only public comments from Facebook
205
+ * Pages and profiles can be embedded.
206
+ *
207
+ * <code>
208
+ *
209
+ * href: The absolute URL of the comment.
210
+ * width: The width of the embedded comment container. Min. 220px.
211
+ * include-parent: Set to true to include parent comment (if URL is a reply).
212
+ *
213
+ * </code>
214
+ *
215
+ * @link https://developers.facebook.com/docs/plugins/embedded-comments/
216
+ *
217
+ * fb-comment-comment ?
218
+ */
219
+ static $comment
220
+ = [
221
+ 'href' => '',
222
+ 'width' => '560',
223
+ 'include-parent' => [ 'false', 'true' ]
224
+ ];
225
+ /**
226
+ * Embedded Video & Live Video Player
227
+ *
228
+ * With the embedded video player you can easily add Facebook videos and Facebook live videos
229
+ * to your website. You can use any public video post by a Page or a person as video or live
230
+ * video source.
231
+ *
232
+ * <code>
233
+ *
234
+ * href: The absolute URL of the page that will be quoted.
235
+ * allowfullscreen: Allow the video to be played in fullscreen mode.
236
+ * autoplay: Automatically start playing the video when the page loads. The video will be
237
+ * played without sound
238
+ * (muted). People can turn on sound via the video player controls. This setting does
239
+ * not apply to mobile devices. width: The width of the video container. Min. 220px.
240
+ * show-text: Set to true to include the text from the Facebook post associated with
241
+ * the video, if any. show-captions: Set to true to show captions (if available) by
242
+ * default. Captions are only available on desktop.
243
+ *
244
+ * </code>
245
+ *
246
+ * @link https://developers.facebook.com/docs/plugins/embedded-video-player/
247
+ *
248
+ * @link https://developers.facebook.com/docs/plugins/embedded-video-player/#how-to-get-a-video-posts-url
249
+ */
250
+ static $video
251
+ = [
252
+ 'href' => '',
253
+ 'allowfullscreen' => [ 'false', 'true' ],
254
+ 'autoplay' => [ 'false', 'true' ],
255
+ 'width' => '',
256
+ 'show-text' => [ 'false', 'true' ],
257
+ 'show-captions' => [ 'true', 'false' ],
258
+ ];
259
+ /**
260
+ * Page Plugin
261
+ *
262
+ * The Page plugin lets you easily embed and promote any Facebook Page on your website. Just
263
+ * like on Facebook, your visitors can like and share the Page without leaving your site.
264
+ *
265
+ * <code>
266
+ *
267
+ * href: The absolute URL of the page that will be quoted.
268
+ * width: The pixel width of the plugin. Min. is 180 & Max. is 500
269
+ * height: The pixel height of the plugin. Min. is 70
270
+ * tabs: Tabs to render i.e. timeline, events, messages. Use a comma-separated list to add
271
+ * multiple tabs, i.e. timeline, events. hide_cover: Tabs to render i.e. timeline, events,
272
+ * messages. Use a comma-separated list to add multiple tabs, i.e. timeline, events.
273
+ * hide-cover: Hide cover photo in the header show-facepile: Show profile photos when friends
274
+ * like this hide-cta: Hide the custom call to action button (if available) small-header: Use
275
+ * the small header instead adapt-container-width: Try to fit inside the container width
276
+ *
277
+ * </code>
278
+ *
279
+ * @link https://developers.facebook.com/docs/plugins/page-plugin/
280
+ */
281
+ static $page
282
+ = [
283
+ 'href' => '',
284
+ 'width' => '340',
285
+ 'height' => '500',
286
+ 'tabs' => '',
287
+ 'hide-cover' => [ 'false', 'true' ],
288
+ 'show-facepile' => [ 'true', 'false' ],
289
+ 'hide-cta' => [ 'false', 'true' ],
290
+ 'small-header' => [ 'false', 'true' ],
291
+ 'adapt-container-width' => [ 'true', 'false' ],
292
+ ];
293
+ /**
294
+ * Comments Plugin
295
+ *
296
+ * The comments plugin lets people comment on content on your site using their Facebook
297
+ * account. People can choose to share their comment activity with their friends (and friends
298
+ * of their friends) on Facebook as well. The comments plugin also includes built-in moderation
299
+ * tools and social relevance ranking.
300
+ *
301
+ * <code>
302
+ *
303
+ * colorscheme: The color scheme used by the comments plugin.
304
+ * dark
305
+ * light
306
+ * href: The absolute URL of the page that will be quoted.
307
+ * mobile: A boolean value that specifies whether to show the mobile-optimized version or not.
308
+ * num_posts: The number of comments to show by default. The minimum value is 1
309
+ * order_by: The order to use when displaying comments.
310
+ * social
311
+ * reverse_time
312
+ * time
313
+ * width: The width of the comments plugin on the webpage. This can be either a pixel value or
314
+ * a percentage (such as 100%) for fluid width. The mobile version of the comments plugin
315
+ * ignores the width parameter and instead has a fluid width of 100%. The minimum width
316
+ * supported by the comments plugin is 320px.
317
+ *
318
+ * </code>
319
+ *
320
+ * @link https://developers.facebook.com/docs/plugins/comments/
321
+ */
322
+ static $comments
323
+ = [
324
+ 'href' => '',
325
+ 'colorscheme' => [ 'light', 'dark' ],
326
+ 'mobile' => [ 'false', 'true' ],
327
+ 'num_posts' => '10',
328
+ 'order_by' => [ 'social', 'reverse_time', 'time' ],
329
+ 'width' => '550px',
330
+ ];
331
+ /**
332
+ * Embedded Posts
333
+ *
334
+ * Embedded Posts are a simple way to put public posts - by a Page or a person on Facebook -
335
+ * into the content of your web site or web page. Only public posts from Facebook Pages and
336
+ * profiles can be embedded.
337
+ *
338
+ * <code>
339
+ *
340
+ * href: The absolute URL of the post to be embedded.
341
+ * width: The width of the plugin. (between 350 and 750)
342
+ * show-text: show te post content (it was not documented Õ..õ )
343
+ *
344
+ * </code>
345
+ *
346
+ * @link https://developers.facebook.com/docs/plugins/embedded-posts/
347
+ */
348
+ static $post
349
+ = [
350
+ 'href' => '',
351
+ 'width' => '500',
352
+ 'show-text' => [ 'true', 'false' ],
353
+ ];
354
+ /**
355
+ * Associative array with the default variables interpreted by fb
356
+ */
357
+ private static $defaults = null;
358
+
359
+ /**
360
+ * Associative array containing links for demos and documentation.
361
+ *
362
+ * @param false|string $feature Feature slug.
363
+ * @return array|false
364
+ */
365
+ private static function doc_links( $feature = false ) {
366
+ $links = [
367
+ 'quote' => [
368
+ 'docs' => 'plugins/quote',
369
+ 'demo' => 'social-plugins/quote',
370
+ ],
371
+ 'save' => [
372
+ 'docs' => 'plugins/save',
373
+ 'demo' => 'social-plugins/save-button',
374
+ ],
375
+ 'like' => [
376
+ 'docs' => 'plugins/like-button',
377
+ 'demo' => 'social-plugins/like-button',
378
+ ],
379
+ 'share' => [
380
+ 'docs' => 'plugins/share-button',
381
+ 'demo' => 'social-plugins/share-button',
382
+ ],
383
+ 'send' => [
384
+ 'docs' => 'plugins/send-button',
385
+ 'demo' => 'social-plugins/send-button',
386
+ ],
387
+ 'comment' => [
388
+ 'docs' => 'plugins/embedded-comments',
389
+ 'demo' => 'social-plugins/single-comment',
390
+ ],
391
+ 'video' => [
392
+ 'docs' => 'plugins/embedded-video-player',
393
+ 'demo' => 'embedded-video-live-video-player',
394
+ ],
395
+ 'page' => [
396
+ 'docs' => 'plugins/page-plugin',
397
+ 'demo' => 'social-plugins/page-embed',
398
+ ],
399
+ 'comments' => [
400
+ 'docs' => 'plugins/comments',
401
+ 'demo' => 'social-plugins/comments-plugin',
402
+ ],
403
+ 'post' => [
404
+ 'docs' => 'plugins/embedded-posts',
405
+ 'demo' => 'social-plugins/post-embed',
406
+ ],
407
+ 'group' => [
408
+ 'docs' => 'plugins/group-plugin',
409
+ 'demo' => 'social-plugins/group',
410
+ ],
411
+ ];
412
+
413
+ if ( false === $feature ) {
414
+ return $links;
415
+ }
416
+
417
+ if ( ! isset( $links[ $feature ] ) ) {
418
+ return false;
419
+ }
420
+
421
+ return $links[ $feature ];
422
+ }
423
+
424
+ static function get_links( $type, $link = true ) {
425
+ $ret = '';
426
+
427
+ $doc_link = self::doc_links( $type );
428
+
429
+ if ( false !== $doc_link ) {
430
+ if ( $link ) {
431
+ $ret = '<small>';
432
+ $ret .= '<a href="http://www.wpembedfb.com/' . user_trailingslashit( $doc_link['demo'] ) . '" target="_blank" title="WP Embed Facebook Demo">Demo</a> ';
433
+ $ret .= '<a href="https://developers.facebook.com/docs/' . user_trailingslashit( $doc_link['docs'] ) . '" target="_blank" title="Official FB documentation">Info</a>';
434
+ $ret .= '</small>';
435
+ } else {
436
+ $ret = $doc_link[ $type ];
437
+ }
438
+ }
439
+
440
+ return $ret;
441
+ }
442
+
443
+ static function get_defaults( $all_options = false ) {
444
+
445
+ if ( self::$defaults === null || $all_options ) {
446
+ $vars = get_class_vars( __CLASS__ );
447
+ unset( $vars['defaults'] );
448
+ unset( $vars['links'] );
449
+ unset( $vars['link_types'] );
450
+
451
+ foreach ( $vars as $type => $options ) {
452
+
453
+ foreach ( $options as $option => $default ) {
454
+ if ( is_array( $default ) ) {
455
+ $vars[ $type ][ $option ] = $all_options ? $default : $default[0];
456
+ }
457
+ }
458
+ }
459
+ if ( $all_options ) {
460
+ return $vars;
461
+ }
462
+
463
+ self::$defaults = $vars;
464
+ }
465
+
466
+ return self::$defaults;
467
+ }
468
+
469
+ /**
470
+ * Gets the HTML code of any social plugin if any
471
+ *
472
+ * @see Social_Plugins::$quote
473
+ * @see Social_Plugins::$save
474
+ * @see Social_Plugins::$like
475
+ * @see Social_Plugins::$share
476
+ * @see Social_Plugins::$send
477
+ * @see Social_Plugins::$comment
478
+ * @see Social_Plugins::$video
479
+ * @see Social_Plugins::$page
480
+ * @see Social_Plugins::$comments
481
+ * @see Social_Plugins::$post
482
+ *
483
+ * @param string $type = quote|save|like|share|send|comment|video|page|comments|post
484
+ * @param array $options Defaults are Social_Plugins::$type
485
+ *
486
+ * @return string
487
+ */
488
+ static function get( $type = 'like', $options = [] ) {
489
+ if ( $type == 'comment' ) {
490
+ $type_clean = 'comment-embed';
491
+ } elseif ( $type == 'comments_count' ) {
492
+ $type_clean = 'comments-count';
493
+ } elseif ( $type == 'share' ) {
494
+ $type_clean = 'share-button';
495
+ } else {
496
+ $type_clean = $type;
497
+ }
498
+
499
+ /**
500
+ * Before getting the HTML code of any social plugin.
501
+ *
502
+ * @since unknown
503
+ */
504
+ do_action( 'wef_sp_get_action' );
505
+
506
+ $defaults = self::get_defaults();
507
+ $settings = Plugin::get_option();
508
+ $real_options = $defaults[ $type ];
509
+ foreach ( $defaults[ $type ] as $key => $def_value ) {
510
+ if ( in_array( $key, Social_Plugins::$link_types ) ) {
511
+ if ( empty( $options[ $key ] ) ) {
512
+ $real_options[ $key ] = Helpers::get_true_url();
513
+ } else {
514
+ $real_options[ $key ] = $options[ $key ];
515
+ }
516
+ } else {
517
+ if ( $settings["{$type}_$key"] != $def_value ) {
518
+ $def_value = $settings["{$type}_$key"];
519
+ }
520
+ $real_options[ $key ] = isset( $options[ $key ] ) ? $options[ $key ] : $def_value;
521
+ }
522
+ }
523
+
524
+ /**
525
+ * Filter defaults options of social plugin.
526
+ *
527
+ * @param string $default Defaults.
528
+ * @param string $type Type of plugin.
529
+ * @since unknown
530
+ */
531
+ $filtered_options = apply_filters( 'wef_sp_defaults', $real_options, $type );
532
+ $extra = '';
533
+ foreach ( $filtered_options as $option => $value ) {
534
+ $extra .= "data-$option=\"$value\" ";
535
+ }
536
+ $extra = trim( $extra );
537
+
538
+ /**
539
+ * Filter social plugin HTML output.
540
+ *
541
+ * @param string $html HTML of social plugin.
542
+ * @param string $type Type.
543
+ * @param mixed $options Options.
544
+ * @param string $defaults Default options.
545
+ *
546
+ * @since unknown
547
+ */
548
+ return apply_filters( 'wef_sp_get_filter', "<div class=\"fb-$type_clean\" $extra></div>",
549
+ $type, $options, $defaults );
550
+ }
551
+
552
+ static function shortcode( $atts = [] ) {
553
+ $type = array_shift( $atts );
554
+ if ( $type == 'comments-count' ) {
555
+ $type = 'comments_count';
556
+ }
557
+
558
+ $defaults = self::get_defaults();
559
+
560
+ if ( isset( $defaults[ $type ] ) ) {
561
+
562
+ if ( isset( $atts['help'] )
563
+ || isset( $atts['usage'] )
564
+ || ( isset( $atts[0] ) && ( ( $atts[0] == 'help' ) || ( $atts[0] == 'usage' ) ) )
565
+ ) {
566
+ return self::usage( $type );
567
+ }
568
+
569
+ $ret = self::get( $type, $atts );
570
+
571
+ if ( ( Plugin::get_option( 'enq_when_needed' ) == 'true' ) && ( Plugin::get_option( 'enq_fbjs' ) == 'true' ) ) {
572
+ wp_enqueue_script( 'wpemfb-fbjs' );
573
+ }
574
+
575
+ /**
576
+ * Action triggered while generating shortcode content.
577
+ *
578
+ * @since unknown
579
+ */
580
+ do_action( 'wef_sp_shortcode_action' );
581
+
582
+ if ( isset( $defaults[ $type ]['width'] ) && $type != 'comments' && $type != 'page' ) {
583
+ $default_width = $defaults[ $type ]['width'];
584
+ if ( isset( $atts['adaptive'] ) ) {
585
+ if ( $atts['adaptive'] == 'true' ) {
586
+ $ret = self::add_adaptive( $default_width, $atts ) . $ret;
587
+ }
588
+ } elseif ( Plugin::get_option( 'adaptive_fb_plugin' ) == 'true' ) {
589
+ $ret = self::add_adaptive( $default_width, $atts ) . $ret;
590
+ }
591
+ }
592
+
593
+ if ( isset( $atts['debug'] ) ) {
594
+ $ret .= self::debug( $ret, $atts, $type );
595
+ //$ret .= print_r($ret,true);
596
+ //$ret .= print_r($atts,true);
597
+ //$ret .= print_r($data,true);
598
+ }
599
+
600
+ //return print_r($atts,true);
601
+ /**
602
+ * Filter social plugin shortcode output.
603
+ *
604
+ * @param string $ret HTML output.
605
+ * @param string $type Type.
606
+ * @param array $atts Attributes.
607
+ * @param string $defaults Defaults option.
608
+ *
609
+ * @since unknown
610
+ */
611
+ return apply_filters( 'wef_sp_shortcode_filter', $ret, $type, $atts, $defaults );
612
+ }
613
+
614
+ ob_start();
615
+ $types = array_keys( $defaults );
616
+ echo '<p>' . __( 'Invalid Facebook plugin type use it like this:',
617
+ 'wp-embed-facebook' ) . '</p>';
618
+ echo '<p>[fb_plugin ' . implode( '|', $types ) . ' help ]</p>';
619
+
620
+ return ob_get_clean();
621
+ }
622
+
623
+ static function debug( $ret, $atts, $type ) {
624
+ $atts_raw = $atts;
625
+ $debug = '';
626
+ $atts_raw_string = '';
627
+ unset( $atts_raw['debug'] );
628
+ foreach ( $atts_raw as $key => $value ) {
629
+ $atts_raw_string .= "$key=\"$value\" ";
630
+ }
631
+ $debug .= '<br><pre>';
632
+ $debug .= '<strong>';
633
+ $debug .= __( 'Shortcode used:', 'wp-embed-facebook' ) . "<br>";
634
+ $debug .= '</strong>';
635
+ $debug .= esc_html( htmlentities( "[fb_plugin $type $atts_raw_string]" ) );
636
+ $debug .= '<br>';
637
+ $debug .= '<strong>';
638
+ $debug .= __( 'Final code:', 'wp-embed-facebook' ) . "<br>";
639
+ $debug .= '</strong>';
640
+ $debug .= esc_html( htmlentities( $ret, ENT_QUOTES ) );
641
+ $debug .= '<br>';
642
+ $debug .= '<strong>';
643
+ $debug .= __( 'More information:', 'wp-embed-facebook' );
644
+ $debug .= '</strong>';
645
+ $debug .= self::get_links( $type );
646
+ $debug .= '</pre>';
647
+
648
+ return $debug;
649
+ }
650
+
651
+ static function usage( $type ) {
652
+
653
+ $all_defaults = self::get_defaults( true );
654
+
655
+ $string = ' ';
656
+
657
+ foreach ( $all_defaults[ $type ] as $att => $default ) {
658
+ if ( is_array( $default ) ) {
659
+ $default = implode( '|', $default );
660
+ }
661
+ $string .= "$att=\"$default\" ";
662
+ }
663
+ ob_start();
664
+ echo '<p>' . __( 'Shortcode usage example:', 'wp-embed-facebook' ) . '</p>';
665
+ echo '<p>[fb_plugin ' . $type . $string . ' adaptive="false|true" ]</p>';
666
+ echo '<p>' . __( 'More information:',
667
+ 'wp-embed-facebook' ) . ' ' . self::get_links( $type ) . '</p>';
668
+
669
+ return ob_get_clean();
670
+ }
671
+
672
+ private static function add_adaptive( $default_width, $atts ) {
673
+ $width = isset( $atts['width'] ) ? $atts['width'] : $default_width;
674
+ wp_enqueue_script( 'wpemfb' );
675
+ $ret = '';
676
+ $ret .= '<div class="wef-measure"';
677
+ if ( ! empty( $width ) ) {
678
+ $ret .= ' style="max-width: ' . $width . 'px;"';
679
+ }
680
+ $ret .= '></div>';
681
+
682
+ return $ret;
683
+ }
684
+
685
+ }
inc/Widget.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Register widget.
4
+ *
5
+ * @author Miguel Sirvent
6
+ * @package WP Embed Facebook
7
+ */
8
+
9
+ namespace SIGAMI\WP_Embed_FB;
10
+
11
+ // If this file is called directly, abort.
12
+ if ( ! defined( 'WPINC' ) ) {
13
+ die;
14
+ }
15
+
16
+ /**
17
+ * Adds WEF_Widget widget.
18
+ */
19
+ class Widget extends \WP_Widget {
20
+
21
+ /**
22
+ * Register widget with WordPress.
23
+ */
24
+ function __construct() {
25
+ parent::__construct(
26
+ 'wef_widget', // Base ID
27
+ esc_html__( 'WP Embed Facebook', 'wp-embed-facebook' ), // Name
28
+ [ 'description' => esc_html__( 'Shortcode widget', 'wp-embed-facebook' ), ] // Args
29
+ );
30
+ }
31
+
32
+ /**
33
+ * Front-end display of widget.
34
+ *
35
+ * @see WP_Widget::widget()
36
+ *
37
+ * @param array $args Widget arguments.
38
+ * @param array $instance Saved values from database.
39
+ */
40
+ public function widget( $args, $instance ) {
41
+ echo $args['before_widget'];
42
+ if ( ! empty( $instance['title'] ) ) {
43
+ /**
44
+ * Allow filtering widget title.
45
+ *
46
+ * @param string $title Title of widget.
47
+ * @since unknown
48
+ */
49
+ $title = apply_filters( 'widget_title', $instance['title'] );
50
+
51
+ echo $args['before_title'] . $title . $args['after_title'];
52
+ }
53
+ echo do_shortcode( $instance['shortcode'] );
54
+ echo $args['after_widget'];
55
+ }
56
+
57
+ /**
58
+ * Back-end widget form.
59
+ *
60
+ * @see WP_Widget::form()
61
+ *
62
+ * @param array $instance Previously saved values from database.
63
+ *
64
+ * @return string
65
+ */
66
+ public function form( $instance ) {
67
+ $title = ! empty( $instance['title'] ) ? $instance['title'] : '';
68
+ $shortcode = ! empty( $instance['shortcode'] ) ? $instance['shortcode'] : '';
69
+ ?>
70
+ <p>
71
+ <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_attr_e( 'Title:',
72
+ 'wp-embed-facebook' ); ?></label>
73
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
74
+ name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text"
75
+ value="<?php echo esc_attr( $title ); ?>">
76
+ </p>
77
+ <p>
78
+ <label for="<?php echo esc_attr( $this->get_field_id( 'shortcode' ) ); ?>"><?php esc_attr_e( 'Shortcode:',
79
+ 'wp-embed-facebook' ); ?><br>
80
+ <small>Example: [embedfb https://www.facebook... ] or [fb_plugin like]</small>
81
+ </label>
82
+ <input class="widefat"
83
+ id="<?php echo esc_attr( $this->get_field_id( 'shortcode' ) ); ?>"
84
+ name="<?php echo esc_attr( $this->get_field_name( 'shortcode' ) ); ?>"
85
+ type="text" value="<?php echo esc_attr( $shortcode ); ?>">
86
+ </p>
87
+ <?php
88
+ return true;
89
+ }
90
+
91
+ /**
92
+ * Sanitize widget form values as they are saved.
93
+ *
94
+ * @see WP_Widget::update()
95
+ *
96
+ * @param array $new_instance Values just sent to be saved.
97
+ * @param array $old_instance Previously saved values from database.
98
+ *
99
+ * @return array Updated safe values to be saved.
100
+ */
101
+ public function update( $new_instance, $old_instance ) {
102
+ $instance = [];
103
+ $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
104
+
105
+ $instance['shortcode'] = ( ! empty( $new_instance['shortcode'] ) ) ? strip_tags( $new_instance['shortcode'] ) : '';
106
+
107
+ return $instance;
108
+ }
109
+
110
+ }
inc/css/admin.css ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wef-content{
2
+ width: 72%;
3
+ float: left;
4
+ /*border-right: 1px solid gray;*/
5
+ }
6
+ .wef-sidebar{
7
+ width: 28%;
8
+ float: left;
9
+ text-align: center;
10
+ /*border-left: 1px solid gray;*/
11
+ /*padding: 0 10px;*/
12
+ }
13
+
14
+ @media (max-width: 870px) {
15
+ .wef-sidebar, .wef-content {
16
+ width: 100% !important;
17
+ }
18
+ }
19
+ .wef-sidebar .button-red {
20
+ background: #D2002C none repeat scroll 0 0;
21
+ border-color: #AA0012;
22
+ box-shadow: 0 1px 0 rgba(230, 14, 23, 0.5) inset, 0 1px 0 rgba(173, 173, 173, 0.15);
23
+ color: #FFF;
24
+ text-decoration: none;
25
+ }
26
+ .wef-sidebar .button-red:focus, .wef-sidebar .button-red:hover {
27
+ background: #AB1F42 none repeat scroll 0 0;
28
+ border-color: #AA0012;
29
+ box-shadow: 0 1px 0 rgba(230, 14, 23, 0.5) inset;
30
+ }
31
+
32
+ input.button[name=restore] {
33
+ float: right;
34
+ }
35
+
36
+ #social_plugins .form-table th {
37
+ padding: 5px 0 0 0;
38
+ }
39
+ #social_plugins .form-table td {
40
+ padding: 4px 0;
41
+ }
42
+
43
+ .shortcode_example{
44
+ margin-left: 20px;
45
+ }
inc/deprecated/FacebookApiException.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2011 Facebook, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
6
+ * not use this file except in compliance with the License. You may obtain
7
+ * a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
+ * License for the specific language governing permissions and limitations
15
+ * under the License.
16
+ */
17
+
18
+ /**
19
+ * Thrown when an API call returns an exception.
20
+ *
21
+ * @author Naitik Shah <naitik@facebook.com>
22
+ */
23
+ class FacebookApiException extends Exception
24
+ {
25
+ /**
26
+ * The result from the API server that represents the exception information.
27
+ */
28
+ protected $result;
29
+
30
+ /**
31
+ * Make a new API Exception with the given result.
32
+ *
33
+ * @param array $result The result from the API server
34
+ */
35
+ public function __construct($result)
36
+ {
37
+ $this->result = $result;
38
+
39
+ $code = isset($result['error_code']) ? $result['error_code'] : 0;
40
+
41
+ if (isset($result['error_description'])) {
42
+ // OAuth 2.0 Draft 10 style
43
+ $msg = $result['error_description'];
44
+ } else if (isset($result['error']) && is_array($result['error'])) {
45
+ // OAuth 2.0 Draft 00 style
46
+ $msg = $result['error']['message'];
47
+ } else if (isset($result['error_msg'])) {
48
+ // Rest server style
49
+ $msg = $result['error_msg'];
50
+ } else {
51
+ $msg = 'Unknown Error. Check getResult()';
52
+ }
53
+
54
+ parent::__construct($msg, $code);
55
+ }
56
+
57
+ /**
58
+ * Return the associated result object returned by the API server.
59
+ *
60
+ * @return array The result from the API server
61
+ */
62
+ public function getResult()
63
+ {
64
+ return $this->result;
65
+ }
66
+
67
+ /**
68
+ * Returns the associated type for the error. This will default to
69
+ * 'Exception' when a type is not available.
70
+ *
71
+ * @return string
72
+ */
73
+ public function getType()
74
+ {
75
+ if (isset($this->result['error'])) {
76
+ $error = $this->result['error'];
77
+ if (is_string($error)) {
78
+ // OAuth 2.0 Draft 10 style
79
+ return $error;
80
+ } else if (is_array($error)) {
81
+ // OAuth 2.0 Draft 00 style
82
+ if (isset($error['type'])) {
83
+ return $error['type'];
84
+ }
85
+ }
86
+ }
87
+
88
+ return 'Exception';
89
+ }
90
+
91
+ /**
92
+ * To make debugging easier.
93
+ *
94
+ * @return string The string representation of the error
95
+ */
96
+ public function __toString()
97
+ {
98
+ $str = $this->getType() . ': ';
99
+ if ($this->code != 0) {
100
+ $str .= $this->code . ': ';
101
+ }
102
+ return $str . $this->message;
103
+ }
104
+ }
105
+
inc/deprecated/deprecated.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use SIGAMI\WP_Embed_FB\Embed_FB;
4
+ use SIGAMI\WP_Embed_FB\FB_API;
5
+ use SIGAMI\WP_Embed_FB\Plugin;
6
+ use SIGAMI\WP_Embed_FB\Helpers;
7
+
8
+ final class WP_Embed_FB_Options {
9
+ protected static $instance = null;
10
+ static function instance(){
11
+ if(self::$instance === null){
12
+ self::$instance = new self;
13
+ }
14
+ return self::$instance;
15
+ }
16
+ //This runs after plugin activation and update
17
+ protected function __construct() {
18
+ $this->remove_old_options();
19
+ $this->string_options_to_array();
20
+ }
21
+
22
+ function string_options_to_array(){
23
+ $options = Plugin::get_option();
24
+ foreach ($options as $key => $value){
25
+ if(in_array($key,['quote_post_types','auto_comments_post_types']) && is_string($value)){
26
+ $options[$value] = Helpers::string_to_array($value);
27
+ }
28
+ }
29
+ Plugin::set_options($options);
30
+ }
31
+
32
+ function remove_old_options(){
33
+ if ( get_option( 'wpemfb_theme' ) ) {
34
+ //upgrade options
35
+ $defaults = Plugin::get_option();
36
+ foreach ( Helpers::old_options() as $old_option ) {
37
+ if ( isset( $defaults[ $old_option ] ) ) {
38
+ $defaults[ $old_option ] = get_option( 'wpemfb_' . $old_option, $defaults[ $old_option ] );
39
+ }
40
+ delete_option( 'wpemfb_' . $old_option );
41
+ }
42
+ Plugin::set_options( $defaults );
43
+ }
44
+ }
45
+ }
46
+
47
+ add_action(Plugin::$option.'_activation','WP_Embed_FB_Options::instance');
48
+ add_action(Plugin::$option.'_update','WP_Embed_FB_Options::instance');
49
+
50
+ WP_Embed_FB_Options::instance();
51
+ /**
52
+ * Class WP_Embed_FB
53
+ *
54
+ * @deprecated use FB_API::instance()->api('')
55
+ */
56
+ final class WP_Embed_FB extends Embed_FB {
57
+ /**
58
+ * @deprecated use SIGAMI\WP_Embed_FB\Embed_Facebook; Embed_Facebook::get_fbsdk();
59
+ *
60
+ */
61
+ static function get_fbsdk() {
62
+ _deprecated_function( 'WP_Embed_FB::get_fbsdk()', '3.0',
63
+ "Example: \n use SIGAMI\WP_Embed_FB\FB_API; \n FB_API::instance()->api('') " );
64
+
65
+ return new WP_Embed_FB_Deprecated_API;
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Class WP_Embed_FB_API
71
+ *
72
+ * @deprecated Never used only created for backwards compatibility
73
+ */
74
+ final class WP_Embed_FB_Deprecated_API {
75
+
76
+ /**
77
+ * @param string $string
78
+ * @param string $method
79
+ * @param array $message
80
+ *
81
+ * @throws FacebookApiException
82
+ */
83
+ public function api( $string = '', $method = 'GET', $message = [] ) {
84
+ if ( ! class_exists( 'FacebookApiException' ) ) {
85
+ /** @noinspection PhpIncludeInspection */
86
+ require_once( Plugin::path() . 'deprecated/FacebookApiException.php' );
87
+ }
88
+ try {
89
+ FB_API::instance()->api( $string, $method, $message );
90
+ } catch ( Exception $e ) {
91
+ throw new FacebookApiException( [
92
+ 'error_code' => $e->getCode(),
93
+ 'error_description' => $e->getMessage()
94
+ ] );
95
+ }
96
+ }
97
+
98
+ public function setAccessToken($token){
99
+ FB_API::instance()->setAccessToken($token);
100
+ }
101
+
102
+ public function getAccessToken(){
103
+ return FB_API::instance()->getAccessToken();
104
+ }
105
+
106
+ public function setExtendedAccessToken() {
107
+ $extended = FB_API::instance()->extendAccessToken( FB_API::instance()->getAccessToken() );
108
+ if ( ! is_wp_error( $extended ) ) {
109
+ FB_API::instance()->setAccessToken( $extended['token'] );//TODO test this
110
+ }
111
+ return $extended;
112
+ }
113
+ }
114
+
115
+
inc/js/fb.js ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ window.fbAsyncInit = function () {
2
+ FB.init({
3
+ appId: WEF.fb_id,
4
+ version: WEF.version,
5
+ xfbml: true
6
+ });
7
+ if (!(typeof WEF.ajaxurl === "undefined")) {
8
+ FB.Event.subscribe('comment.create', wef_comment_callback);
9
+ FB.Event.subscribe('comment.remove', wef_comment_callback);
10
+ }
11
+
12
+ };
13
+
14
+ (function (d, s, id) {
15
+ var js, fjs = d.getElementsByTagName(s)[0];
16
+ if (d.getElementById(id)) return;
17
+ js = d.createElement(s);
18
+ js.id = id;
19
+ // js.async = true;
20
+ js.src = "//connect.facebook.net/" + WEF.local + "/sdk.js";
21
+ fjs.parentNode.insertBefore(js, fjs);
22
+ }(document, 'script', 'facebook-jssdk'));
23
+
24
+ var wef_serialize = function (obj, prefix) {
25
+ var str = [], p;
26
+ for (p in obj) {
27
+ if (obj.hasOwnProperty(p)) {
28
+ var k = prefix ? prefix + "[" + p + "]" : p, v = obj[p];
29
+ str.push((v !== null && typeof v === "object") ?
30
+ wef_serialize(v, k) :
31
+ encodeURIComponent(k) + "=" + encodeURIComponent(v));
32
+ }
33
+ }
34
+ return str.join("&");
35
+ };
36
+
37
+ var wef_comment_callback = function (response) {
38
+
39
+ // console.log(response);
40
+
41
+ var wef_ajax = new XMLHttpRequest();
42
+
43
+ // wef_ajax.onreadystatechange = function()
44
+ // {
45
+ // if(wef_ajax.readyState === 4 && wef_ajax.status === 200)
46
+ // {
47
+ // alert(wef_ajax.responseText);
48
+ // }
49
+ // };
50
+
51
+ var data = wef_serialize({action: 'wpemfb_comments', response: response});
52
+
53
+ wef_ajax.open("POST", WEF.ajaxurl, true);
54
+ wef_ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
55
+ wef_ajax.send(data);
56
+ };
57
+
58
+ if (WEF.hasOwnProperty('adaptive')) {
59
+ (function ($) {
60
+ $(".wef-measure").each(function () {
61
+ $(this).next().attr("data-width", $(this).outerWidth() + "px")
62
+ })
63
+ })(jQuery);
64
+ }
65
+
inc/js/fb.min.js ADDED
@@ -0,0 +1 @@
 
1
+ window.fbAsyncInit=function(){FB.init({appId:WEF.fb_id,version:WEF.version,xfbml:!0}),void 0!==WEF.ajaxurl&&(FB.Event.subscribe("comment.create",wef_comment_callback),FB.Event.subscribe("comment.remove",wef_comment_callback))},function(e,n,t){var o,a=e.getElementsByTagName(n)[0];e.getElementById(t)||((o=e.createElement(n)).id=t,o.src="//connect.facebook.net/"+WEF.local+"/sdk.js",a.parentNode.insertBefore(o,a))}(document,"script","facebook-jssdk");var wef_serialize=function(e,n){var t,o=[];for(t in e)if(e.hasOwnProperty(t)){var a=n?n+"["+t+"]":t,c=e[t];o.push(null!==c&&"object"==typeof c?wef_serialize(c,a):encodeURIComponent(a)+"="+encodeURIComponent(c))}return o.join("&")},wef_comment_callback=function(e){var n=new XMLHttpRequest,t=wef_serialize({action:"wpemfb_comments",response:e});n.open("POST",WEF.ajaxurl,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.send(t)};WEF.hasOwnProperty("adaptive")&&function(e){e(".wef-measure").each(function(){e(this).next().attr("data-width",e(this).outerWidth()+"px")})}(jQuery);
library/Comments.php DELETED
@@ -1,165 +0,0 @@
1
- <?php
2
-
3
- namespace SIGAMI\WP_Embed_FB;
4
-
5
- /**
6
- * Handles comments auto embeds and comment count synchronization. It includes all actions and filters. Comments plugin
7
- * can also be invoked using the [fb_plugin comments] shortocode.
8
- *
9
- * @see WEF_Social_Plugins
10
- */
11
- class WEF_Comments {
12
- static function hooks() {
13
-
14
- /** @see WEF_Comments::comments_template */
15
- add_filter( 'comments_template', __CLASS__ . '::comments_template' );
16
-
17
- if ( Plugin::get_option( 'comments_count_active' ) === 'true' ) {
18
-
19
- /** @see WEF_Comments::get_comments_number */
20
- add_filter( 'get_comments_number', __CLASS__ . '::get_comments_number', 10, 2 );
21
-
22
- /** @see WEF_Comments::save_post */
23
- add_filter( 'save_post', __CLASS__ . '::save_post', 10, 3 );
24
-
25
- /** @see WEF_Comments::pre_get_posts */
26
- add_action( 'pre_get_posts', __CLASS__ . '::pre_get_posts' );
27
-
28
- /** @see WEF_Comments::wpemfb_comments */
29
- add_filter( 'wp_ajax_wpemfb_comments', __CLASS__ . '::wpemfb_comments' );
30
- add_filter( 'wp_ajax_nopriv_wpemfb_comments', __CLASS__ . '::wpemfb_comments' );
31
-
32
- }
33
-
34
- if ( Plugin::get_option( 'comments_open_graph' ) === 'true' ) {
35
- /** @see WEF_Comments::wp_head */
36
- add_action( 'wp_head', __CLASS__ . '::wp_head' );
37
- }
38
- }
39
-
40
- /**
41
- * Adds FB open graph app_id meta tag to head
42
- */
43
- static function wp_head() {
44
- $app_id = Plugin::get_option( 'app_id' );
45
- if ( ! empty( $app_id ) ) {
46
- echo '<meta property="fb:app_id" content="' . $app_id . '" />' . PHP_EOL;
47
- }
48
- }
49
-
50
- /**
51
- * Replace theme template for FB comments.
52
- *
53
- * @param $template
54
- *
55
- * @return string
56
- */
57
- static function comments_template( $template ) {
58
- $array = self::string_to_array( self::get_option( 'auto_comments_post_types' ) );
59
- if ( in_array( $GLOBALS['post']->post_type, $array ) ) {
60
- $template = self::path() . 'templates/comments.php';
61
- }
62
-
63
- return $template;
64
-
65
- }
66
-
67
- /**
68
- * @see get_comments_number
69
- *
70
- * @param string $number Number of comments on WP
71
- * @param int $post_id
72
- *
73
- * @return mixed|string
74
- */
75
- static function get_comments_number(
76
- /** @noinspection PhpUnusedParameterInspection */
77
- $number, $post_id
78
- ) {
79
- $count = get_post_meta( $post_id, '_wef_comment_count', true );
80
- if ( $count ) {
81
- return $count;
82
- }
83
-
84
- return '0';
85
- }
86
-
87
- /**
88
- * Update the comment count on post update
89
- *
90
- * @param $post_id
91
- * @param $post
92
- * @param $update
93
- */
94
- static function save_post( $post_id, $post, $update ) {
95
- if ( wp_is_post_revision( $post_id ) || ! $update ) {
96
- return;
97
- }
98
- $options = self::get_option();
99
- $array = self::string_to_array( $options['auto_comments_post_types'] );
100
- //https://graph.facebook.com/?id=http://t-underboot.sigami.net/?p=4
101
- if ( in_array( $post->post_type, $array ) ) {
102
- $args = array(
103
- 'fields' => 'share{comment_count}',
104
- 'id' => home_url( "/?p=$post_id" )
105
- );
106
- $url = "https://graph.facebook.com/{$options[ 'sdk_version' ]}/?" . http_build_query( $args );
107
- $request = wp_remote_get( $url );
108
- $response = wp_remote_retrieve_body( $request );
109
- if ( ! is_wp_error( $request ) && ! empty( $response ) ) {
110
- $data = json_decode( $response, true );
111
- // print_r($data);die();
112
- if ( is_array( $data ) && isset( $data['share'] ) && isset( $data['share']['comment_count'] ) ) {
113
- update_post_meta( $post->ID, '_wef_comment_count', intval( $data['share']['comment_count'] ) );
114
- }
115
-
116
- }
117
- }
118
- }
119
-
120
- /**
121
- * Alter order by 'comment_count' to use _wef_comment_count meta instead
122
- *
123
- * @param WP_Query $query
124
- *
125
- * @return WP_Query
126
- */
127
- static function pre_get_posts( $query ) {
128
- if ( isset( $query->query_vars['orderby'] ) && $query->query_vars['orderby'] == 'comment_count' ) {
129
- $query->set(
130
- 'meta_query',
131
- array(
132
- 'relation' => 'OR',
133
- array(
134
- 'key' => '_wef_comment_count',
135
- 'compare' => 'NOT EXISTS'
136
- ),
137
- array(
138
- 'key' => '_wef_comment_count',
139
- 'compare' => 'EXISTS'
140
- )
141
- )
142
- );
143
- $query->set( 'orderby', 'meta_value_num' );
144
- }
145
-
146
- return $query;
147
- }
148
-
149
- /**
150
- * Ajax function for updating comment count
151
- */
152
- static function wpemfb_comments() {
153
- if ( isset( $_POST['response'] ) && isset( $_POST['response']['href'] ) ) {
154
- $post_id = url_to_postid( $_POST['response']['href'] );
155
- $count = self::get_comments_number( '', $post_id );
156
- if ( isset( $_POST['response']['message'] ) ) {
157
- $count ++;
158
- } else {
159
- $count --;
160
- }
161
- update_post_meta( $post_id, '_wef_comment_count', intval( $count ) );
162
- }
163
- wp_die();
164
- }
165
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
library/Plugin_Framework.php DELETED
@@ -1,544 +0,0 @@
1
- <?php
2
- /**
3
- * Created for: wp-embed-facebook
4
- * By: Miguel Sirvent
5
- * Date: 23/05/18
6
- * Time: 10:41 PM
7
- */
8
-
9
- namespace SIGAMI\WP_Embed_FB;
10
-
11
- abstract class Plugin_Framework {
12
-
13
- const VER = '1.1.2';
14
-
15
- const FILE = null;
16
-
17
- const OPTION = null;
18
-
19
- # Admin page options
20
- /**
21
- * @var string menu|submenu|management|options|theme|plugins|users|dashboard|posts|media|links|pages|comments
22
- */
23
- protected static $type = 'options';
24
- protected static $page_title = 'New Page';
25
- protected static $menu_title = 'New Page';
26
- protected static $capability = 'manage_options';
27
- protected static $menu_slug = 'new_page';
28
- # Only for menu pages (Top Level)
29
- protected static $icon = '';
30
- protected static $position = null;
31
- # Only for submenu pages
32
- protected static $parent_slug = 'options-general.php';
33
- # Sections of the admin page
34
- protected static $tabs = array( 'General', 'Advanced' );
35
-
36
- # Cache of commonly used vars.
37
- protected static $defaults = null;
38
- private static $options = null;
39
- private static $path = null;
40
- private static $url = null;
41
- private static $instance = null;
42
-
43
- static function instance() {
44
- if ( self::$instance === null ) {
45
- self::$instance = new static();
46
- }
47
-
48
- return self::$instance;
49
- }
50
-
51
- protected function __construct() {
52
- # plugin translation
53
- add_action( 'plugins_loaded', get_called_class() . '::load_translation' );
54
-
55
- if ( ! empty( static::OPTION ) ) {
56
-
57
- register_setting( "Settings_" . static::OPTION, static::OPTION, [
58
- 'sanitize_callback' => get_called_class() . '::sanitize_option',
59
- 'default' => static::defaults(),
60
- ] );
61
-
62
- register_activation_hook( static::FILE, get_called_class() . '::activation' );
63
- register_uninstall_hook( static::FILE, get_called_class() . '::uninstall' );
64
- register_deactivation_hook( static::FILE, get_called_class() . '::deactivation' );
65
-
66
- if ( is_admin() ) {
67
- /** @see Plugin_Framework::add_page() */
68
- add_action( 'admin_menu', get_called_class() . '::add_page' );
69
- /** @see Plugin_Framework::add_pager_script() */
70
- add_action( 'current_screen', get_called_class() . '::add_pager_script' );
71
- }
72
-
73
- }
74
- }
75
-
76
- static function activation() {
77
- static::get_option();
78
- do_action( static::OPTION . '_' . __FUNCTION__ );
79
- }
80
-
81
- static function uninstall() {
82
- do_action( static::OPTION . '_' . __FUNCTION__ );
83
- delete_option( static::OPTION );
84
- }
85
-
86
- static function deactivation() {
87
- do_action( static::OPTION . '_' . __FUNCTION__ );
88
- }
89
-
90
- static function path() {
91
- if ( null === self::$path ) {
92
- self::$path = plugin_dir_path( static::FILE );
93
- }
94
-
95
- return self::$path;
96
- }
97
-
98
- static function url() {
99
- if ( null === self::$url ) {
100
- self::$url = plugin_dir_url( static::FILE );
101
- }
102
-
103
- return self::$url;
104
- }
105
-
106
- static function load_translation() {
107
- load_plugin_textdomain( 'text_domain', false, 'lang/' );
108
- }
109
-
110
- /**
111
- * @return array Default variables used on this plugin
112
- */
113
- static function defaults() {
114
- if ( self::$defaults === null ) {
115
- self::$defaults = array(
116
- 'off_option' => 0,
117
- 'on_option' => 'on',
118
- 'text_option' => 'Somethin crazy',
119
- 'checklist_option' => array( 'one' => 'One name', 'two' => 'Two title' ),
120
- 'number_option' => 34,
121
- );
122
- }
123
-
124
- return self::$defaults;
125
- }
126
-
127
- /**
128
- * To save options pass an array with all values as set on defaults. See example below:
129
- *
130
- * <code>
131
- * # Set single option
132
- * Plugin::set_options( ['option'=>'new value'] + Plugin::get_option() );
133
- * or
134
- * Plugin::set_options( array_merge(Plugin::get_option(),['option'=>'new value']) );
135
- *
136
- * # reset option to default
137
- * Plugin::set_option(array_merge(Plugin::defaults(),['other_option'=>Plugin::defaults()['other_option']]));
138
- *
139
- * # Reset all options to defaults
140
- * Plugin::set_options(Plugin::defaults());
141
- *
142
- * </code>
143
- * @param array $options
144
- */
145
- static function set_options( $options ) {
146
- update_option( static::OPTION, $options, true );
147
- self::$options = get_option( static::OPTION );
148
- }
149
-
150
- /**
151
- * Get a single option or all of them.
152
- *
153
- * @param null|string $option
154
- *
155
- * @return array|mixed The queried option. False if the option does not exists. Array with all options if $option is null;
156
- */
157
- static function get_option( $option = null ) {
158
- if ( ! is_array( self::$options ) ) {
159
- $options = get_option( static::OPTION );
160
- if ( is_array( $options ) ) {
161
- if ( $options === static::defaults() ) {
162
- self::$options = $options;
163
- } else {
164
- $compare = array();
165
- foreach ( static::defaults() as $default_key => $default_value ) {
166
- $compare[ $default_key ] = isset( $options[ $default_key ] )
167
- ? $options[ $default_key ] : $default_value;
168
- }
169
- if ( $compare === $options ) {
170
- self::$options = $options;
171
- } else {
172
- static::set_options( $compare );
173
- }
174
- }
175
- } else {
176
- static::set_options( static::defaults() );
177
- }
178
- }
179
- if ( $option ) {
180
- return isset( self::$options[ $option ] ) ? self::$options[ $option ] : false;
181
- } else {
182
- return self::$options;
183
- }
184
- }
185
-
186
- /**
187
- * Sanitizes the option values before saving it to database.
188
- *
189
- * @param array $options Options previous to be saved on data base
190
- *
191
- * @return array The validated option.
192
- */
193
- static function sanitize_option( $options ) {
194
-
195
- $defaults = static::defaults();
196
-
197
- if ( is_string( $options ) && $options == 'restore' ) {
198
- return $defaults;
199
- }
200
-
201
- if ( $options === $defaults ) {
202
- return $options;
203
- }
204
-
205
- $clean = array();
206
- foreach ( $defaults as $name => $default_value ) {
207
- $clean[ $name ] = $default_value;
208
- if ( ( ( $default_value === 'on' ) || ( $default_value === 0 ) ) ) {
209
- if ( isset( $options[ $name ] ) && ( $options[ $name ] !== 0 ) ) {
210
- $clean[ $name ] = 'on';
211
- } else {
212
- $clean[ $name ] = 0;
213
- }
214
- } elseif ( isset( $options[ $name ] ) ) {
215
- if ( ( is_int( $default_value ) && is_int( $options[ $name ] ) )
216
- || ( is_string( $default_value ) && is_string( $options[ $name ] ) )
217
- || ( is_object( $default_value ) && is_object( $options[ $name ] ) )
218
- || ( is_array( $default_value ) && is_array( $options[ $name ] ) ) ) {
219
- $clean[ $name ] = $options[ $name ];
220
- }
221
- }
222
- }
223
-
224
- return $clean;
225
- }
226
-
227
- /**
228
- * Add page to Settings
229
- */
230
- static function add_page() {
231
- $function = 'add_' . static::$type . '_page';
232
- if ( function_exists( $function ) ) {
233
-
234
- if ( static::$type == 'menu' ) {
235
- $options_page = call_user_func( $function, static::$page_title, static::$menu_title,
236
- static::$capability, static::$menu_slug, get_called_class() . '::display_page',
237
- static::$icon, static::$position );
238
- } elseif ( static::$type == 'submenu' ) {
239
- $options_page = call_user_func( $function, static::$parent_slug,
240
- static::$page_title, static::$menu_title, static::$capability,
241
- static::$menu_slug, get_called_class() . '::display_page' );
242
- } else {
243
- $options_page = call_user_func( $function, static::$page_title, static::$menu_title,
244
- static::$capability, static::$menu_slug,
245
- get_called_class() . '::display_page' );
246
- }
247
-
248
- if ( false === $options_page ) {
249
- wp_die( 'Invalid page: ' . static::$type . ' ' . $function );
250
- }
251
-
252
- } else {
253
- wp_die( 'Invalid page type: ' . static::$type );
254
- }
255
- }
256
-
257
- static function add_pager_script() {
258
- global $current_screen;
259
-
260
- if ( strpos( $current_screen->id, static::$menu_slug ) !== false ) {
261
-
262
- if ( count( static::$tabs ) > 1 ) {
263
- add_action( 'in_admin_footer', get_called_class() . '::pager_script' );
264
- }
265
-
266
- }
267
- }
268
-
269
- static function pager_script() {
270
- ob_start();
271
- ?>
272
- <script type="text/javascript">
273
- jQuery(document).ready(function () {
274
- var sections = jQuery('section');
275
- var tabs = jQuery(".nav-tab-wrapper a");
276
- var hash = jQuery(window.location.hash);
277
- sections.hide();
278
- if (hash.length) {
279
- var index = hash.index() - 6; //why 6 ? dunno
280
- //console.log(index);
281
- sections.eq(index).show();
282
- jQuery.each(tabs, function (key, value) {
283
- jQuery(value).removeClass("nav-tab-active");
284
- });
285
- tabs.eq(index).addClass('nav-tab-active');
286
- } else {
287
- sections.first().show();
288
- }
289
- tabs.on('click', function (event) {
290
- var index = jQuery(this).index();
291
- var url = window.location.pathname + window.location.search + '#' + sections.eq(index)[0].id;
292
- event.preventDefault();
293
- sections.hide();
294
- jQuery.each(tabs, function (key, value) {
295
- jQuery(value).removeClass("nav-tab-active");
296
- });
297
- sections.eq(index).show();
298
- jQuery(this).addClass('nav-tab-active');
299
- window.history.pushState(sections.eq(index)[0].id, tabs.eq(index)[0].innerText, url);
300
- });
301
- });
302
- </script>
303
- <?php
304
- echo ob_get_clean();
305
- }
306
-
307
- /**
308
- * Render form sections
309
- *
310
- * @param string|bool $title
311
- */
312
- static function section( $title = '' ) {
313
- if ( $title ) :
314
- if ( is_string( $title ) )
315
- echo "<h3>$title</h3>"
316
- ?>
317
- <table class="form-table">
318
- <tbody>
319
- <?php
320
- else :
321
- ?>
322
- </tbody>
323
- </table>
324
- <?php
325
- endif;
326
- }
327
-
328
- /**
329
- * Render form fields
330
- *
331
- * @param string $type Type of input field
332
- * @param string $name Input name
333
- * @param string $label Input Label
334
- * @param string $description Field description
335
- * @param array|null $atts HTML attributes like example ['required','max'=>20,'onclick'=>'do_something()']
336
- * @param array $values Option values for select and checklist fields
337
- */
338
- static function field(
339
- $type, $name = '', $label = '', $description = '', $atts = null, $values = array()
340
- ) {
341
- //TODO add aria-describedby on input that points to the id of description
342
- $options = apply_filters( static::OPTION . '_field_options', static::get_option() );
343
- $attsString = '';
344
- if ( ! empty( $atts ) ) {
345
- foreach ( $atts as $att => $val ) {
346
- if ( is_numeric( $att ) ) {
347
- $attsString .= " $val ";
348
- } else {
349
- $attsString .= $att . '="' . $val . '" ';
350
- }
351
-
352
- }
353
- }
354
- switch ( $type ) {
355
- case 'checklist':
356
-
357
- ob_start();
358
- ?>
359
- <tr>
360
- <th><?php echo $label ?></th>
361
- <td>
362
- <fieldset>
363
- <?php
364
- foreach ( $values as $value => $title ) :
365
- $checked = ( in_array( $value, $options[ $name ] ) ) ? 'checked'
366
- : '';
367
- ?>
368
- <label for="<?php echo "{$name}_$value" ?>">
369
- <input type="checkbox" id="<?php echo "{$name}_$value" ?>"
370
- name="<?php echo static::OPTION . "[$name][]" ?>"
371
- value="<?php echo $value ?>" <?php echo $checked ?> <?php echo $attsString ?>/>
372
- <span><?php echo $title ?></span>
373
- </label>
374
- <br>
375
-
376
- <?php endforeach; ?>
377
- </fieldset>
378
- <?php if ( ! empty( $description ) ) : ?>
379
- <p class="description"><?php echo $description ?></p>
380
- <?php endif; ?>
381
- </td>
382
- </tr>
383
- <?php
384
- ob_end_flush();
385
- break;
386
- case 'checkbox':
387
- $checked = ( $options[ $name ] === 'on' ) ? 'checked' : '';
388
- ob_start();
389
- ?>
390
- <tr valign="middle">
391
- <th scope="row"><label
392
- for="<?php echo $name ?>"><?php echo $label ?></label></th>
393
- <td>
394
- <input type="checkbox" id="<?php echo $name ?>"
395
- name="<?php echo static::OPTION
396
- . "[$name]" ?>" <?php echo $checked ?> <?php echo $attsString ?>/>
397
- <?php if ( ! empty( $description ) ) : ?>
398
- <span><?php echo $description ?></span>
399
- <?php endif; ?>
400
- </td>
401
- </tr>
402
- <?php
403
- ob_end_flush();
404
- break;
405
- case 'select' :
406
- $option = $options[ $name ];
407
- ob_start();
408
- ?>
409
- <tr valign="middle">
410
- <th scope="row"><label for="<?php echo static::OPTION
411
- . "[$name]" ?>"><?php echo $label ?></label>
412
- </th>
413
- <td>
414
- <select name="<?php echo static::OPTION
415
- . "[$name]" ?>" <?php echo $attsString ?>>
416
- <?php
417
- foreach ( $values as $value => $name ) :
418
- if ( is_numeric( $value ) ) {
419
- $value = $name;
420
- }
421
- ?>
422
- <option value="<?php echo $name ?>" <?php echo $option == $value
423
- ? 'selected' : '' ?>><?php echo $name ?></option>
424
- <?php endforeach; ?>
425
- </select>
426
- <?php if ( ! empty( $description ) ) : ?>
427
- <p class="description"><?php echo $description ?></p>
428
- <?php endif; ?>
429
- </td>
430
- </tr>
431
- <?php
432
- ob_end_flush();
433
- break;
434
-
435
- case 'string' :
436
- ob_start();
437
- ?>
438
- <tr valign="middle">
439
- <th><?php echo $label ?></th>
440
- <td>
441
- <?php echo $name ?>
442
- </td>
443
- </tr>
444
- <?php
445
- ob_end_flush();
446
- break;
447
- default:
448
- ob_start();
449
- ?>
450
- <tr>
451
- <th scope="row"><label for="<?php echo static::OPTION
452
- . "[$name]" ?>"><?php echo $label ?></label>
453
- </th>
454
- <td>
455
- <input id="<?php echo $name ?>"
456
- type="<?php echo $type ?>"
457
- name="<?php echo static::OPTION . "[$name]" ?>"
458
- value="<?php echo esc_attr( $options[ $name ] ) ?>" <?php echo $attsString ?>
459
- <?php echo ! isset( $atts['class'] ) ? ' class="regular-text" '
460
- : ''; ?>/>
461
- <?php if ( ! empty( $description ) ) : ?>
462
- <p class="description"><?php echo $description ?></p>
463
- <?php endif; ?>
464
- </td>
465
- </tr>
466
- <?php
467
- ob_end_flush();
468
- break;
469
- }
470
- }
471
-
472
- /**
473
- * Renders the wp-admin settings page
474
- */
475
- static function display_page() {
476
- if ( isset( $_POST['restore-data'] )
477
- && wp_verify_nonce( $_POST['restore-data'], 'W7ziLKoLojka' ) ) {
478
- update_option( static::OPTION, static::defaults(), true );
479
- }
480
- ?>
481
- <div class="wrap">
482
- <h2><?php echo static::$page_title ?></h2>
483
- <?php //settings_errors(); ?>
484
- <!--suppress HtmlUnknownTarget -->
485
- <form action="options.php" method="post">
486
- <?php settings_fields( "Settings_" . static::OPTION ); ?>
487
- <?php
488
- $tabs = apply_filters( static::OPTION . '_tabs', static::$tabs );
489
- ?>
490
- <?php if ( count( static::$tabs ) > 1 ) : ?>
491
- <h2 class="nav-tab-wrapper">
492
- <?php
493
- foreach ( $tabs as $tab ) {
494
- $class = $tabs[0] == $tab ? "nav-tab-active" : "";
495
- echo "<a class='nav-tab $class' href='#'>$tab</a>";
496
- }
497
- ?>
498
- </h2><br>
499
- <?php endif; ?>
500
- <?php echo static::form_content() ?>
501
- <?php submit_button(); ?>
502
- </form>
503
- <br>
504
- <!--suppress HtmlUnknownTarget -->
505
- <form action="options.php" method="post"
506
- onsubmit="return confirm('<?php _e( 'Restore default values?',
507
- 'text_domain' ) ?>');">
508
- <?php settings_fields( "Settings_" . static::OPTION ); ?>
509
- <input type="hidden" name="<?php echo static::OPTION ?>" value="restore"/>
510
- <input type="submit" name="restore" class="button"
511
- value="<?php _e( 'Restore defaults', 'text_domain' ) ?>"/>
512
- </form>
513
- </div>
514
- <?php
515
- }
516
-
517
- static function form_content() {
518
- ob_start();
519
- ?>
520
- <section id="general" class="section">
521
- <?php
522
- self::section( __( 'General options', 'text_domain' ) );
523
- self::field( 'text', 'text_option', __( 'Text Option', 'text_domain' ), 'Help text' );
524
- self::field( 'checkbox', 'off_option', __( 'Off Option', 'text_domain' ) );
525
- self::field( 'checkbox', 'on_option', __( 'On Option', 'text_domain' ), 'extra info' );
526
- self::section();
527
- ?>
528
- </section>
529
- <section id="advanced" class="section">
530
- <?php
531
- self::section( __( 'Advanced options', 'text_domain' ) );
532
- self::field( 'number', 'number_option', __( 'Number Option', 'text_domain' ),
533
- 'Help text', array( 'max' => '30' ) );
534
- #using the default values on checklist is optional they can also be created by other means
535
- self::field( 'checklist', 'checklist_option', __( 'Checklist Option', 'text_domain' ),
536
- 'more info', '', self::get_option( 'checklist_option' ) );
537
- self::section();
538
- ?>
539
- </section>
540
- <?php
541
- return ob_get_clean();
542
- }
543
-
544
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
library/defaults.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
- /**
3
- * Created for: wp-embed-facebook
4
- * By: Miguel Sirvent
5
- * Date: 23/05/18
6
- * Time: 10:17 PM
7
- */
8
-
9
- //TODO place all default settings for
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,91 +1,125 @@
1
  === WP Embed Facebook ===
2
- 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: 4.9.5
6
- Tested up to: 4.9.5
7
- Stable tag: 3.0
 
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
 
 
 
10
 
 
11
 
 
12
 
 
13
 
14
- TODO Borrar la sección del album y usar solo el gallery de wp
15
 
 
 
 
 
 
 
 
 
 
16
 
17
- Embed any public Facebook video, page, comment, event, album, photo, profile. Add Facebook comments to all your site or embed any Social Plugin.
18
 
19
- == Description ==
20
 
21
- Automatically embed any type of content from Facebook directly into your site by simply copying the url into the editor.
22
 
23
- There are two types of embeds: Custom Embeds that which entirely native to this plugin and social plugins which are pieces of code created by Facebook developers
24
 
25
- [All custom embeds examples](http://www.wpembedfb.com/demo-site/category/custom-embeds/)
26
 
27
- [All social plugins examples](http://www.wpembedfb.com/demo-site/category/social-plugins/)
28
 
29
- As an alternative to automatically embed your content you can use the `[facebook url]` shortcode instead and pass on some parameters to change each embed [examples](http://www.wpembedfb.com/demo-site/category/custom-embeds/).
30
 
31
- You can also use the built in WordPress `[embed]` [shortcode](https://codex.wordpress.org/Embeds).
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
- = Supported Embeds =
34
- * Facebook Live Video
35
- * Facebook Videos
36
- * Facebook Albums
37
- * Facebook Page Events List
38
- * Facebook Photos
39
- * Facebook Fan pages
40
- * Facebook Profiles
41
- * Facebook Posts
42
- * Facebook Comment
43
 
44
- = Facebook Social Plugins =
45
- Pieces of code crafted by Facebook developers for us mortals ( [official documentation](https://developers.facebook.com/docs/plugins/) ). Create a default instance with the shortcode: `[fb_plugin type]`
 
 
 
 
 
46
 
47
- Examples:
48
 
49
- A like and share button for the current page (works on a sidebar)
50
 
51
- `[fb_plugin like share=true]`
52
 
53
- Embed a complete Facebook fan page with latest post, events and the posibility to send a direct message
54
 
55
- `[fb_plugin page href=https://www.facebook.com/sydneyoperahouse/ tabs=timeline,events,messages ] `
56
 
57
- Embed all upcoming events of a fan page
58
 
59
- `[fb_plugin page href=https://www.facebook.com/wpemf/ small-header=true height=350 tabs=messages ]`
60
 
61
- See a lot more examples [here](http://www.wpembedfb.com/demo-site/category/social-plugins/).
 
 
 
 
 
 
 
 
62
 
63
  = Facebook Comments =
64
- Automatically replace the WordPress comments system with Facebook comments or manually using the shortcode `[fb_plugin comments]`.
65
 
66
- To enable moderation you have to set up a Facebook App ID and Secret also scrape the urls on Facebook more details inside the settings page.
 
 
67
 
68
  = The Quote Social Plugin =
69
- The last social plugin to come to life allows your visitors to share any part of your site just by selecting text. Activate it automatically on selected post types or by using the shortcode `[fb_plugin quote]`. [Demo](http://www.wpembedfb.com/demo-site/social-plugins/quote-plugin/).
 
70
 
71
  = Requirements =
72
- * Nothing to embed posts, pages, videos and comments.
 
73
  * For custom embeds and comments moderation a Facebook App Id and Secret are required more details inside settings.
74
 
75
- **[One page live demo](http://www.wpembedfb.com/demo/)**
76
 
77
- **[Demo Site](http://www.wpembedfb.com/demo-site/)**
 
 
 
 
 
 
78
 
79
  = Contributing =
80
- If you found a bug or want to add an extra feature create a pull request on [github](https://github.com/sigami/wp-embed-facebook).
81
 
82
- = Premium extension =
83
- * "Elegant" custom embeds theme
84
- * Embed full fan page shortcode
85
- * Embed albums with more that 100 photos
86
- * Features cooking
87
- * Shortcode creator
88
- * Special templates for albums and pages
89
 
90
  == Installation ==
91
 
@@ -94,7 +128,7 @@ If you found a bug or want to add an extra feature create a pull request on [git
94
  1. Create a Facebook App follow the [step by step guide](http://www.wpembedfb.com/creating-a-facebook-app-the-step-by-step-guide/).
95
  1. Copy the App Id and App Secret to the “Embed Facebook” page under the Settings section.
96
  1. Change settings to your liking.
97
- 1. Enjoy and tell someone !
98
 
99
  == Frequently Asked Questions ==
100
 
@@ -102,32 +136,38 @@ If you found a bug or want to add an extra feature create a pull request on [git
102
 
103
  You can overwrite the embed template with a custom one.
104
 
105
- 1. Create a folder on **your theme** named "plugins".
106
- 1. Inside that folder create a new one named "wp-embed-facebook".
107
- 1. Inside that folder create a new one named "default".
108
- 1. Copy the contents of “wp-embed-facebook/templates/default/” to “your-theme/plugins/wp-embed-facebook/default”
109
- 1. Change the template files to what you want. Inside each file you can access the `$fb_data` array that contains the information retrieved from facebook.
110
 
111
  = I moved from another Facebook comments/like plugin and my comments don't show =
112
 
113
- Go to advanced section on settings and tick the option "Use permalinks on social plugins urls" if it does not work please create a support ticket mentioning the old comments plugin.
114
 
115
- = How can I make my page load faster ? =
116
 
117
- Social plugins will load at its own time via JavaScript so you just have to wait on them, for custom embeds a cache plugin will greatly increase performance.
118
 
119
- = Why can't I embed a certain fan page getting error code 100 ? =
120
 
121
- The Facebook page your are trying to embed is not available to users logged out from Facebook.
122
 
123
- = I cannot embed my photo stream =
124
 
125
- This plugin only works for embedding **albums**. Alternatives are being tested and they will be available very soon.
126
 
127
- = Is there a way to embed an album with more than 100 photos ? =
128
 
129
  Change the number of embedded photos on settings or use the shortcode like this [facebook album_url photos=200 ] This can only be achieved using the premium version.
130
 
 
 
 
 
 
 
131
  = How I can guarantee that this software is kept up to date? =
132
 
133
  Buying the premium extensions helps to keep this project alive.
@@ -139,7 +179,7 @@ Buying the premium extensions helps to keep this project alive.
139
  3. Video Social Plugin
140
  4. Video Custom Embed
141
  5. Album
142
- 6. Album with more than 100 photos (Premium only)
143
  7. Event
144
  8. Full Event Shortcode (Premium only)
145
  9. Full Page Shortcode (Premium only)
@@ -153,6 +193,17 @@ Buying the premium extensions helps to keep this project alive.
153
 
154
  == Changelog ==
155
 
 
 
 
 
 
 
 
 
 
 
 
156
  = 2.2.4 =
157
  * Fixed: Missing icons on custom embeds
158
  * Added: Facebook SDK v2.12
@@ -195,7 +246,7 @@ Buying the premium extensions helps to keep this project alive.
195
  * Improved: updated wp_get_sites for get_sites
196
 
197
  = 2.1.10 =
198
- * Improved: Deprecated Facebook sdk 2.1 and 2.2 automatically updates to 2.3
199
  * Improved: admin navigation
200
 
201
  = 2.1.9 =
@@ -207,10 +258,10 @@ Buying the premium extensions helps to keep this project alive.
207
  * Fixed: Prevent wrong file load on theme templates @pierreg_
208
 
209
  = 2.1.7 =
210
- * Fixed: url understanding on page embeds when they have the format page-name-8798798
211
  * Fixed: website on custom embed fail on edge cases
212
  * Fixed: download video link
213
- * Added: spanish translations ES, MX, AR, CL, GT, PE, VE
214
 
215
  = 2.1.6 =
216
  * Fixed: missing posts from page embeds
@@ -238,13 +289,13 @@ Buying the premium extensions helps to keep this project alive.
238
  * Fixed: includes giving problems in some sites.
239
 
240
  = 2.1.2 =
241
- * Added: [fb_plugin] shortcode to embed any type of social plugin
242
  * Added: Auto embed comments plugin to certain post types
243
  * Added: Auto embed quote plugin to certain post types
244
  * Added: Default options for all social plugins
245
  * Added: Advanced option to integrate other lightbox scripts to the album embeds
246
  * Improved: Admin area is more comprehensive with tons of examples
247
- * Improved: url recognition
248
  * Deprecated: Old functions on Wef_Social_Plugins class
249
 
250
  = 2.1.1 =
@@ -259,8 +310,8 @@ Buying the premium extensions helps to keep this project alive.
259
  * Added: Github for development https://github.com/sigami/wp-embed-facebook
260
 
261
  = 2.1 =
262
- * Removed: all options and moved them to a single one 'wpemfb_options'
263
- * Removed: resize cover javascript it is now done with css
264
  * Fixed: timezone bug custom post and events
265
  * Added option to only load scripts when an embed is present
266
  * Added option to reset all options
@@ -279,7 +330,7 @@ Buying the premium extensions helps to keep this project alive.
279
  * Added Lightbox Option Position From Top
280
  * Added Lightbox Option Resize Duration
281
  * Added Lightbox Option Fade Duration
282
- * Changed css on classic theme
283
 
284
  = 2.0.9.1 =
285
  * Fixed: Admin notice bug
@@ -288,14 +339,14 @@ Buying the premium extensions helps to keep this project alive.
288
 
289
 
290
  = 2.0.9 =
291
- * Fixed: css on footer when using different themes
292
  * Changed: d all.js to sdk.js (bryant1410)
293
  * Optimization for sites with no Facebook App
294
  * Added error messages for special cases
295
  * Added advanced option for selecting Facebook SDK version
296
- * Fixed: locale error inside editor
297
  * Fixed: link underline in some themes
298
- * Fixed: several css and html structure nothing critical
299
 
300
  = 2.0.8 =
301
  * Fix Event title css
@@ -317,7 +368,7 @@ Buying the premium extensions helps to keep this project alive.
317
  * Added 'type' parameter to wpemfb_template filter
318
  * Fixed: https on all templates
319
  * Fixed: like and comment links on single post raw
320
- * Fixed: forced app token only if it has app
321
  * Fixed: admin shortcode references
322
  * Fixed: removed unused options on uninstall
323
  * Fixed: translations strings
@@ -335,7 +386,7 @@ Buying the premium extensions helps to keep this project alive.
335
  * Added options for page social plugins
336
  * Changed admin layout
337
  * Does not need facebook app for simple embeds
338
- * More human friendly
339
 
340
  = 2.0.1 =
341
  * Fixed: message on photo single post
@@ -344,7 +395,7 @@ Buying the premium extensions helps to keep this project alive.
344
  * Fixed: language issue when embedding social plugins in admin
345
  * Fixed: time on events
346
  * Changed: Facebook API to 2.4
347
- * Added a new parameters for shortcode 'social_plugin' and 'theme'
348
  * Fixed: shortcode use [facebook FB_Object_ID ]
349
  * Improved CSS and themes
350
  * New Embed Post Raw
@@ -420,15 +471,15 @@ Buying the premium extensions helps to keep this project alive.
420
 
421
  = 1.8 =
422
  * Compatibility with twenty 15 theme
423
- * New css for embeds
424
- * Compatibility with premium plugin
425
 
426
  = 1.7.1 =
427
- * Documentation Changed:
428
  * New advanced option
429
 
430
  = 1.7 =
431
- * Better detection of video urls
432
  * FB js now loaded via jquery
433
  * More comprehensive admin section
434
  * Fix album pictures not showing on chrome
1
  === WP Embed Facebook ===
2
+ Contributors: poxtron, nerdaryan
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R8Q85GT3Q8Q26
4
+ Tags: 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: 4.5
6
+ Tested up to: 5.0
7
+ Requires PHP: 5.4
8
+ Stable tag: 3.0.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
+ Embed any public Facebook video, page, comment, event, album, photo, profile. Add Facebook comments to all your site or embed any Social Plugin.
12
+
13
+ == Description ==
14
 
15
+ Automatically embed any content from Facebook directly into your site just by copying the URL into the editor, using shortcodes or the new embed block.
16
 
17
+ Replace the WordPress comments system with Facebook comments on selected post types or manually using a shortcode.
18
 
19
+ Use simple shortcodes to invoke like, send, share, save buttons or any other Facebook Social Plugin.
20
 
21
+ = Supported Embeds =
22
 
23
+ * Videos & Live Video
24
+ * Albums
25
+ * Photos
26
+ * Fan pages
27
+ * Groups
28
+ * Page Events List
29
+ * Posts
30
+ * Profiles
31
+ * Single Comment
32
 
33
+ There are two types of embeds: Custom Embeds that are entirely native to this plugin and Social Plugins which are pieces of code created by Facebook developers.
34
 
35
+ [All custom embeds examples](https://wpembedfb.com/social-plugin/)
36
 
37
+ [All social plugins examples](https://wpembedfb.com/custom-embed/)
38
 
39
+ As an alternative to automatically embed your content, you can use the `[embedfb url]` shortcode instead and pass on some parameters to change each embed [examples](http://www.wpembedfb.com/demo-site/category/custom-embeds/).
40
 
41
+ You can also use the built-in WordPress `[embed]` [shortcode](https://codex.wordpress.org/Embeds).
42
 
43
+ = Facebook Social Plugins =
44
 
45
+ **Shortcode variations**
46
 
47
+ `
48
+ [fb_plugin like]
49
+ [fb_plugin send]
50
+ [fb_plugin share]
51
+ [fb_plugin save]
52
+ [fb_plugin comments]
53
+ [fb_plugin quote]
54
+ [fb_plugin page href=]
55
+ [fb_plugin post href=]
56
+ [fb_plugin video href=]
57
+ [fb_plugin group href=]
58
+ [fb_plugin comment href=]
59
+ `
60
 
61
+ Change the default attributes for each plugin on settings or individually on using shortcode attributes, see the list of all available attributes using the "help" attribute like this: `[fb_plugin like help=1]`
 
 
 
 
 
 
 
 
 
62
 
63
+ For example: To embed a complete Facebook fan page with the latest post, events, and chat; use the shortcode like this:
64
+
65
+ `[fb_plugin page href=https://www.facebook.com/wpemf tabs=timeline,events,messages ] `
66
+
67
+ To only show events use `tabs=events`. For posts use "timeline" and for chat use "messages".
68
+
69
+ Embed a share button for your main fan page
70
 
71
+ `[fb_plugin share href=https://www.facebook.com/wpemf layout=button_count ]`
72
 
73
+ Remove the "href" attribute to share the current page even if its invoked from a widget.
74
 
75
+ Find all possible attributes on the plugin settings "Social Plugins" section. See live examples [here](http://www.wpembedfb.com/demo-site/category/social-plugins/).
76
 
77
+ = Custom Embeds =
78
 
79
+ Set up the use of custom embeds when possible automatically on settings, or change the type of embed individually using the main shortcode.
80
 
81
+ For example: To embed an album, individual photo, post or fan page from Facebook use the shortcode like this:
82
 
83
+ `[embedfb href=https://www.facebook.com/... social_plugin=false ] `
84
 
85
+ Set the number of photos on embedded albums using the "photos" attribute
86
+
87
+ `[embedfb href=https://www.facebook.com/... photos=200 ]`
88
+
89
+ Select between different styles of embeds using the theme attribute
90
+
91
+ `[embedfb href=https://www.facebook.com/... social_plugin=false theme=classic ] `
92
+
93
+ Available themes are "default", "classic" and "elegant". Look on the FAQ on how to fully personalize your embeds.
94
 
95
  = Facebook Comments =
 
96
 
97
+ Automatically replace the WordPress comments system with Facebook comments on selected post types or manually using the shortcode `[fb_plugin comments]`.
98
+
99
+ To enable moderation, scrape URLs and custom embeds you have to set up a Facebook App ID and Secret on the settings page.
100
 
101
  = The Quote Social Plugin =
102
+
103
+ Allow your visitors to share text from your site just by selecting it. Activate it automatically on selected post types or using the shortcode `[fb_plugin quote]` [Demo](http://www.wpembedfb.com/demo-site/social-plugins/quote-plugin/).
104
 
105
  = Requirements =
106
+
107
+ * Nothing to embed posts, pages, videos, and comments.
108
  * For custom embeds and comments moderation a Facebook App Id and Secret are required more details inside settings.
109
 
110
+ = Extended Embeds Add-On =
111
 
112
+ * Scrape your shared URL's on Facebook on update or manually on selected post types
113
+ * Simple Widget for generating custom embeds and social plugin shortcodes
114
+ * Embed single events you have been invited to
115
+ * Embed all upcomming events of your fan page
116
+ * Embed the full content of a single event using the shortcode `[fbfullevent url]`
117
+ * Custom embed for fan pages with posts, events and albums tabs using the shortcode `[bfullpage url]`
118
+ * One accessible yearly payment for a license that you can use on all the sites you want :)
119
 
120
  = Contributing =
 
121
 
122
+ Feel like adding something? Create a pull request to the master branch on [github](https://github.com/sigami/wp-embed-facebook). All are welcome.
 
 
 
 
 
 
123
 
124
  == Installation ==
125
 
128
  1. Create a Facebook App follow the [step by step guide](http://www.wpembedfb.com/creating-a-facebook-app-the-step-by-step-guide/).
129
  1. Copy the App Id and App Secret to the “Embed Facebook” page under the Settings section.
130
  1. Change settings to your liking.
131
+ 1. Enjoy and tell someone!
132
 
133
  == Frequently Asked Questions ==
134
 
136
 
137
  You can overwrite the embed template with a custom one.
138
 
139
+ 1. Create a folder on **your theme** named "plugins"
140
+ 1. Inside that folder create a new one named "wp-embed-facebook"
141
+ 1. Inside that folder create a new one named "default"
142
+ 1. Copy the contents of “wp-embed-facebook/custom-embeds/” to “your-theme/plugins/wp-embed-facebook/custom-embeds/”
143
+ 1. Change the template files to what you want. Inside each file, you can access the `$fb_data` array that contains the information retrieved from Facebook
144
 
145
  = I moved from another Facebook comments/like plugin and my comments don't show =
146
 
147
+ Go to "Advanced" section on settings and tick the option "Use permalinks on social plugins URLs" if it does not work, please create a support ticket mentioning the old comments plugin.
148
 
149
+ = How can I make my page load faster? =
150
 
151
+ Social plugins will load at its own time via JavaScript, so you have to wait on them, for custom embeds a cache plugin will significantly increase performance.
152
 
153
+ = Why can't I embed a specific fan page getting error code 100? =
154
 
155
+ The Facebook page you are trying to embed is not available to users logged out from Facebook.
156
 
157
+ = I cannot embed my photostream =
158
 
159
+ This plugin only works for embedding **albums**.
160
 
161
+ = Is there a way to embed an album with more than 100 photos? =
162
 
163
  Change the number of embedded photos on settings or use the shortcode like this [facebook album_url photos=200 ] This can only be achieved using the premium version.
164
 
165
+ = How to get the correct URL from Facebook? =
166
+
167
+ Time is the master. Right click on the video, post, album, etc. time of creation and copy the URL.
168
+
169
+ Buying the premium extensions helps to keep this project alive.
170
+
171
  = How I can guarantee that this software is kept up to date? =
172
 
173
  Buying the premium extensions helps to keep this project alive.
179
  3. Video Social Plugin
180
  4. Video Custom Embed
181
  5. Album
182
+ 6. An album with more than 100 photos (Premium only)
183
  7. Event
184
  8. Full Event Shortcode (Premium only)
185
  9. Full Page Shortcode (Premium only)
193
 
194
  == Changelog ==
195
 
196
+ = 3.0.0 =
197
+ * Improved: Translated API calls
198
+ * Added: Url scraper
199
+ * Added: Group social plugin
200
+ * Removed: Deprecated social plugins
201
+ * Removed: Events custom embeds because Facebook API changes, however, some functionality is still there on the premium version
202
+ * Improved: Universal options page
203
+ * Fixed: Comments count and order now on
204
+ * Added: Facebook SDK v3.2
205
+ * Added: Compatibility for visual themes
206
+
207
  = 2.2.4 =
208
  * Fixed: Missing icons on custom embeds
209
  * Added: Facebook SDK v2.12
246
  * Improved: updated wp_get_sites for get_sites
247
 
248
  = 2.1.10 =
249
+ * Improved: Deprecated Facebook SDK 2.1 and 2.2 automatically updates to 2.3
250
  * Improved: admin navigation
251
 
252
  = 2.1.9 =
258
  * Fixed: Prevent wrong file load on theme templates @pierreg_
259
 
260
  = 2.1.7 =
261
+ * Fixed: URL understanding on page embeds when they have the format page-name-8798798
262
  * Fixed: website on custom embed fail on edge cases
263
  * Fixed: download video link
264
+ * Added: Spanish translations ES, MX, AR, CL, GT, PE, VE
265
 
266
  = 2.1.6 =
267
  * Fixed: missing posts from page embeds
289
  * Fixed: includes giving problems in some sites.
290
 
291
  = 2.1.2 =
292
+ * Added: [fb_plugin] shortcode to embed any social plugin
293
  * Added: Auto embed comments plugin to certain post types
294
  * Added: Auto embed quote plugin to certain post types
295
  * Added: Default options for all social plugins
296
  * Added: Advanced option to integrate other lightbox scripts to the album embeds
297
  * Improved: Admin area is more comprehensive with tons of examples
298
+ * Improved: URL recognition
299
  * Deprecated: Old functions on Wef_Social_Plugins class
300
 
301
  = 2.1.1 =
310
  * Added: Github for development https://github.com/sigami/wp-embed-facebook
311
 
312
  = 2.1 =
313
+ * Removed: all options and moved them to a single one "wpemfb_options"
314
+ * Removed: resize cover javascript it is now done with CSS
315
  * Fixed: timezone bug custom post and events
316
  * Added option to only load scripts when an embed is present
317
  * Added option to reset all options
330
  * Added Lightbox Option Position From Top
331
  * Added Lightbox Option Resize Duration
332
  * Added Lightbox Option Fade Duration
333
+ * Changed CSS on the classic theme
334
 
335
  = 2.0.9.1 =
336
  * Fixed: Admin notice bug
339
 
340
 
341
  = 2.0.9 =
342
+ * Fixed: CSS on footer when using different themes
343
  * Changed: d all.js to sdk.js (bryant1410)
344
  * Optimization for sites with no Facebook App
345
  * Added error messages for special cases
346
  * Added advanced option for selecting Facebook SDK version
347
+ * Fixed: locale error inside the editor
348
  * Fixed: link underline in some themes
349
+ * Fixed: several CSS and HTML structure nothing critical
350
 
351
  = 2.0.8 =
352
  * Fix Event title css
368
  * Added 'type' parameter to wpemfb_template filter
369
  * Fixed: https on all templates
370
  * Fixed: like and comment links on single post raw
371
+ * Fixed: forced app token only if it has an app
372
  * Fixed: admin shortcode references
373
  * Fixed: removed unused options on uninstall
374
  * Fixed: translations strings
386
  * Added options for page social plugins
387
  * Changed admin layout
388
  * Does not need facebook app for simple embeds
389
+ * More human-friendly
390
 
391
  = 2.0.1 =
392
  * Fixed: message on photo single post
395
  * Fixed: language issue when embedding social plugins in admin
396
  * Fixed: time on events
397
  * Changed: Facebook API to 2.4
398
+ * Added new parameters for shortcode "social_plugin" and "theme"
399
  * Fixed: shortcode use [facebook FB_Object_ID ]
400
  * Improved CSS and themes
401
  * New Embed Post Raw
471
 
472
  = 1.8 =
473
  * Compatibility with twenty 15 theme
474
+ * New CSS for embeds
475
+ * Compatibility with the premium plugin
476
 
477
  = 1.7.1 =
478
+ * Documentation Changed:
479
  * New advanced option
480
 
481
  = 1.7 =
482
+ * Better detection of video URLs
483
  * FB js now loaded via jquery
484
  * More comprehensive admin section
485
  * Fix album pictures not showing on chrome
templates/classic/album.php DELETED
@@ -1,38 +0,0 @@
1
- <div class="wef-classic aligncenter" style="max-width: <?php echo $width ?>px">
2
- <div class="wef-row">
3
- <div class="wef-col-3 wef-text-center">
4
- <a href="https://facebook.com/<?php /** @noinspection PhpUndefinedVariableInspection */
5
- echo $fb_data['from']['id'] ?>" target="_blank" rel="nofollow">
6
- <img src="https://graph.facebook.com/<?php echo $fb_data['from']['id'] ?>/picture" />
7
- </a>
8
- </div>
9
- <div class="wef-col-9 wef-pl-none">
10
- <a href="https://facebook.com/<?php echo $fb_data['from']['id'] ?>" target="_blank" rel="nofollow">
11
- <span class="wef-title"><?php echo $fb_data['from']['name'] ?></span>
12
- </a>
13
- <br>
14
- <?php if(isset($fb_data['from']['category'])) : ?>
15
- <?php echo $fb_data['from']['category'].'<br>' ?>
16
- <?php endif; ?>
17
- <a href="https://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow"><?php echo $fb_data['name'] ?></a>
18
- </div>
19
- </div>
20
- <hr class="wef-hr">
21
- <div class="wef-row">
22
- <div class="wef-col-12 wef-text-center">
23
- <div class="wef-text-center wef-album-thumbs">
24
- <?php
25
- if(isset($fb_data['photos']))
26
- foreach ($fb_data['photos']['data'] as $pic) {
27
- $data_title = isset($pic['name']) ? $pic['name'] : '';
28
- ?>
29
- <a class="wef-album-thumbs" href="<?php echo $pic['source'] ?>" <?php echo WP_Embed_FB_Plugin::get_option('lightbox_att') ?> <?php echo !empty($data_title) ? WP_Embed_FB_Plugin::lightbox_title($data_title) : '' ?> >
30
- <span class="wef-album-thumb" style="background-image: url('<?php echo $pic['picture'] ?>')"></span>
31
- </a>
32
- <?php
33
- }
34
- ?>
35
- </div>
36
- </div>
37
- </div>
38
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/classic/classic.css DELETED
@@ -1,2 +0,0 @@
1
- .wef-classic{font:300 14px/20px Helvetica;padding:10px;display:table;margin:10px auto;border-width:1px;border-style:solid;border-color:#23487F;box-shadow:1px 1px 2px #23487F;width:100%;background-color:#fff;color:#0f0f0f}@media (min-width: 30em){.wef-classic .row{width:100%;display:table-row;table-layout:fixed;float:left}.wef-classic .wef-col-1,.wef-classic .wef-col-2,.wef-classic .wef-col-3,.wef-classic .wef-col-4,.wef-classic .wef-col-5,.wef-classic .wef-col-6,.wef-classic .wef-col-7,.wef-classic .wef-col-8,.wef-classic .wef-col-9,.wef-classic .wef-col-10,.wef-classic .wef-col-11,.wef-classic .wef-col-12{display:table-cell;float:left}.wef-classic .wef-col-12{width:100%}.wef-classic .wef-col-11{width:91.66667%}.wef-classic .wef-col-10{width:83.33333%}.wef-classic .wef-col-9{width:75%}.wef-classic .wef-col-8{width:66.66667%}.wef-classic .wef-col-7{width:58.33333%}.wef-classic .wef-col-6{width:50%}.wef-classic .wef-col-5{width:41.66667%}.wef-classic .wef-col-4{width:33.33333%}.wef-classic .wef-col-3{width:25%}.wef-classic .wef-col-2{width:16.66667%}.wef-classic .wef-col-1{width:8.33333%}}.wef-classic hr.wef-hr{margin-top:10px !important;margin-bottom:10px !important;margin-left:0 !important;margin-right:0 !important;float:left !important;border-top:1px;border-style:solid;border-color:#23487F;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;height:0 !important;width:100% !important}.wef-classic img.wef-icon{float:right;box-shadow:none;margin:0;padding:0;display:block}.wef-classic img.wef-thumbnail{border:1px solid gray;border-radius:2px;height:60px !important;margin:2px 4px;padding:0;width:60px !important}.wef-classic .wef-album-thumbs{display:inline-block}.wef-classic a.wef-button{padding:5px 9px !important;text-align:center;text-decoration:none !important;display:inline-block;font-size:15px;-webkit-transition-duration:.1s;transition-duration:.1s;cursor:pointer;background-color:#fff;color:#000 !important;border:2px solid #23487F !important;border-radius:4px}.wef-classic a.wef-button:hover,.wef-classic a.wef-button:focus{background-color:#23487F !important;color:#fff !important;text-decoration:none !important}.wef-classic a{font:300 14px/20px Helvetica;color:#23487F !important;text-decoration:none !important;border:0 !important;margin:0 !important;padding:0 !important;box-shadow:none !important}.wef-classic a:focus,.wef-classic a:hover{color:#23487F;text-decoration:underline !important}.wef-classic a.wef-post-likes{color:#6d84b4 !important;font-size:12px !important}.wef-classic a.road-trip{width:0 !important;height:0 !important}.wef-classic a img{display:inline-block !important;margin:0 !important;padding:0 !important;box-shadow:none !important}.wef-classic p{font:300 14px/20px Helvetica;padding:0 !important;margin:0 !important}.wef-classic p.wef-post-time{font-style:italic;color:#8e8c8d;font-size:12px}.wef-classic p.caption-link{text-align:right;word-break:break-all}.wef-classic p.caption-link a{font-size:12px;color:#8e8c8d !important;text-transform:uppercase}.wef-classic p.caption-title{text-align:left}.wef-classic p.caption-title a{font-size:12px;font-weight:bold}.wef-classic iframe,.wef-classic embed,.wef-classic object,.wef-classic video,.wef-classic audio{width:100% !important;border:0 !important;margin:0 !important;padding:0 !important}.wef-classic .wef-post-link{border-width:1px;border-style:solid;border-color:#d0d0d0;box-shadow:1px 1px 2px #b3b3b3}.wef-classic .wef-post-link p{padding-left:10px !important;padding-right:10px !important}.wef-classic .wef-text-center{text-align:center}.wef-classic .wef-pl-none{padding-left:0 !important;word-break:break-all}.wef-classic .wef-title{font-size:20px !important;font-weight:bold !important;word-break:break-all;display:inherit !important;height:100% !important;background-color:transparent !important;padding-top:5px !important}.wef-classic .wef-pad-top{padding-top:5px}.wef-classic .caption-description p{color:#8e8c8d !important;font-style:italic !important;font-size:12px !important}.wef-classic .wef-measure{width:100%}.wef-classic .wef-event_address{color:#565656;font-size:12px}.wef-classic .wef-relative-container{position:relative;display:block;height:0;overflow:hidden}.wef-classic .wef-relative-container .wef-relative,.wef-classic .wef-relative-container .wef-video iframe,.wef-classic .wef-video .wef-relative-container iframe,.wef-classic .wef-relative-container .wef-video embed,.wef-classic .wef-video .wef-relative-container embed,.wef-classic .wef-relative-container .wef-video object,.wef-classic .wef-video .wef-relative-container object,.wef-classic .wef-relative-container .wef-video video,.wef-classic .wef-video .wef-relative-container video{position:absolute;top:0;left:0;bottom:0;height:100%;width:100%;border:0;margin:0;padding:0}.wef-classic .wef-video{padding:0 0 56.25%}.wef-classic .wef-fbpost-image{padding:0 0 75%}.wef-classic .wef-fbpost-image div{cursor:pointer;background-size:cover;background-position:50% 50%}.wef-classic .wef-cover{padding:0 0 36.86%}.wef-classic .wef-cover div{background-size:100% !important;background-position-x:0;cursor:pointer}.wef-classic span.wef-album-thumb{height:65px !important;margin:1px;padding:2px;width:65px !important;float:left;background-size:cover}.wef-classic .wef-text-right{text-align:right}.wef-classic .event_address{color:#404040;font-style:italic}
2
- /*# sourceMappingURL=classic.css.map */
 
 
templates/classic/classic.css.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "mappings": "AAAA,YAAY,CACV,IAAI,CAAE,uBAAuB,CAC7B,OAAO,CAAE,IAAI,CACb,OAAO,CAAE,KAAK,CACd,MAAM,CAAE,SAAS,CAEf,YAAK,CAAE,GAAG,CACV,YAAK,CAAE,KAAK,CACZ,YAAK,CAAE,OAAO,CAChB,UAAU,CAAE,mBAAmB,CAC/B,KAAK,CAAE,IAAI,CACX,gBAAgB,CAAE,IAAO,CACzB,KAAK,CAAE,OAAO,CACd,wBAAwB,CACtB,iBAAI,CACF,KAAK,CAAE,IAAI,CACX,OAAO,CAAE,SAAS,CAClB,YAAY,CAAE,KAAK,CACnB,KAAK,CAAE,IAAI,CACb,kSAAiJ,CAC/I,OAAO,CAAE,UAAU,CACnB,KAAK,CAAE,IAAI,CACb,wBAAW,CACT,KAAK,CAAE,IAAI,CACb,wBAAW,CACT,KAAK,CAAE,SAAY,CACrB,wBAAW,CACT,KAAK,CAAE,SAAY,CACrB,uBAAU,CACR,KAAK,CAAE,GAAG,CACZ,uBAAU,CACR,KAAK,CAAE,SAAY,CACrB,uBAAU,CACR,KAAK,CAAE,SAAY,CACrB,uBAAU,CACR,KAAK,CAAE,GAAG,CACZ,uBAAU,CACR,KAAK,CAAE,SAAY,CACrB,uBAAU,CACR,KAAK,CAAE,SAAY,CACrB,uBAAU,CACR,KAAK,CAAE,GAAG,CACZ,uBAAU,CACR,KAAK,CAAE,SAAY,CACrB,uBAAU,CACR,KAAK,CAAE,QAAW,EACtB,sBAAS,CAEL,UAAG,CAAE,eAAe,CACpB,aAAM,CAAE,eAAe,CACvB,WAAI,CAAE,YAAY,CAClB,YAAK,CAAE,YAAY,CACrB,KAAK,CAAE,eAAe,CAEpB,UAAG,CAAE,GAAG,CACR,YAAK,CAAE,KAAK,CACZ,YAAK,CAAE,OAAO,CAChB,eAAe,CAAE,WAAW,CAC5B,kBAAkB,CAAE,WAAW,CAC/B,UAAU,CAAE,WAAW,CACvB,MAAM,CAAE,YAAY,CACpB,KAAK,CAAE,eAAe,CACxB,yBAAY,CACV,KAAK,CAAE,KAAK,CACZ,UAAU,CAAE,IAAI,CAChB,MAAM,CAAE,CAAC,CACT,OAAO,CAAE,CAAC,CACV,OAAO,CAAE,KAAK,CAChB,8BAAiB,CACf,MAAM,CAAE,cAAiB,CACzB,aAAa,CAAE,GAAG,CAClB,MAAM,CAAE,eAAe,CACvB,MAAM,CAAE,OAAO,CACf,OAAO,CAAE,CAAC,CACV,KAAK,CAAE,eAAe,CACxB,8BAAiB,CACf,OAAO,CAAE,YAAY,CACvB,yBAAY,CACV,OAAO,CAAE,kBAAkB,CAC3B,UAAU,CAAE,MAAM,CAClB,eAAe,CAAE,eAAe,CAChC,OAAO,CAAE,YAAY,CACrB,SAAS,CAAE,IAAI,CACf,2BAA2B,CAAE,GAAG,CAChC,mBAAmB,CAAE,GAAG,CACxB,MAAM,CAAE,OAAO,CACf,gBAAgB,CAAE,IAAI,CACtB,KAAK,CAAE,eAAe,CACtB,MAAM,CAAE,4BAA4B,CACpC,aAAa,CAAE,GAAG,CAClB,+DAAgB,CACd,gBAAgB,CAAE,kBAAkB,CACpC,KAAK,CAAE,eAAgB,CACvB,eAAe,CAAE,eAAe,CACpC,cAAC,CACC,IAAI,CAAE,uBAAuB,CAC7B,KAAK,CAAE,kBAAkB,CACzB,eAAe,CAAE,eAAe,CAChC,MAAM,CAAE,YAAY,CACpB,MAAM,CAAE,YAAY,CACpB,OAAO,CAAE,YAAY,CACrB,UAAU,CAAE,eAAe,CAC3B,yCAAgB,CACd,KAAK,CAAE,OAAO,CACd,eAAe,CAAE,oBAAoB,CACvC,6BAAgB,CACd,KAAK,CAAE,kBAAkB,CACzB,SAAS,CAAE,eAAe,CAC5B,wBAAW,CACT,KAAK,CAAE,YAAY,CACnB,MAAM,CAAE,YAAY,CACtB,kBAAG,CACD,OAAO,CAAE,uBAAuB,CAChC,MAAM,CAAE,YAAY,CACpB,OAAO,CAAE,YAAY,CACrB,UAAU,CAAE,eAAe,CAC/B,cAAC,CACC,IAAI,CAAE,uBAAuB,CAC7B,OAAO,CAAE,YAAY,CACrB,MAAM,CAAE,YAAY,CACpB,4BAAe,CACb,UAAU,CAAE,MAAM,CAClB,KAAK,CAAE,OAAO,CACd,SAAS,CAAE,IAAI,CACjB,2BAAc,CACZ,UAAU,CAAE,KAAK,CACjB,UAAU,CAAE,SAAS,CACrB,6BAAC,CACC,SAAS,CAAE,IAAI,CACf,KAAK,CAAE,kBAAkB,CACzB,cAAc,CAAE,SAAS,CAC7B,4BAAe,CACb,UAAU,CAAE,IAAI,CAChB,8BAAC,CACC,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CACvB,gGAAmC,CACjC,KAAK,CAAE,eAAe,CACtB,MAAM,CAAE,YAAY,CACpB,MAAM,CAAE,YAAY,CACpB,OAAO,CAAE,YAAY,CACvB,2BAAc,CAEV,YAAK,CAAE,GAAG,CACV,YAAK,CAAE,KAAK,CACZ,YAAK,CAAE,OAAO,CAChB,UAAU,CAAE,mBAAmB,CAC/B,6BAAC,CAEG,YAAI,CAAE,eAAe,CACrB,aAAK,CAAE,eAAe,CAC5B,6BAAgB,CACd,UAAU,CAAE,MAAM,CACpB,yBAAY,CACV,YAAY,CAAE,YAAY,CAC1B,UAAU,CAAE,SAAS,CACvB,uBAAU,CACR,SAAS,CAAE,eAAe,CAC1B,WAAW,CAAE,eAAe,CAC5B,UAAU,CAAE,SAAS,CACrB,OAAO,CAAE,kBAAkB,CAC3B,MAAM,CAAE,eAAe,CACvB,gBAAgB,CAAE,sBAAsB,CACxC,WAAW,CAAE,cAAc,CAC7B,yBAAY,CAER,WAAG,CAAE,GAAG,CACZ,mCAAsB,CACpB,KAAK,CAAE,kBAAkB,CACzB,UAAU,CAAE,iBAAiB,CAC7B,SAAS,CAAE,eAAe,CAC5B,yBAAY,CACV,KAAK,CAAE,IAAI,CACb,+BAAkB,CAChB,KAAK,CAAE,OAAO,CACd,SAAS,CAAE,IAAI,CACjB,oCAAuB,CACrB,QAAQ,CAAE,QAAQ,CAClB,OAAO,CAAE,KAAK,CACd,MAAM,CAAE,CAAC,CACT,QAAQ,CAAE,MAAM,CAChB,seAAa,CACX,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,MAAM,CAAE,CAAC,CACT,MAAM,CAAE,IAAI,CACZ,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,CAAC,CACT,MAAM,CAAE,CAAC,CACT,OAAO,CAAE,CAAC,CACd,uBAAU,CACR,OAAO,CAAE,UAAU,CAGrB,8BAAiB,CACf,OAAO,CAAE,OAAO,CAChB,kCAAG,CACD,MAAM,CAAE,OAAO,CAEb,eAAI,CAAE,KAAK,CACX,mBAAQ,CAAE,OAAO,CACvB,uBAAU,CACR,OAAO,CAAE,UAAU,CACnB,2BAAG,CACD,eAAe,CAAE,eAAe,CAChC,qBAAqB,CAAE,CAAC,CACxB,MAAM,CAAE,OAAO,CACnB,iCAAoB,CAClB,MAAM,CAAE,eAAe,CACvB,MAAM,CAAE,GAAG,CACX,OAAO,CAAE,GAAG,CACZ,KAAK,CAAE,eAAe,CACtB,KAAK,CAAE,IAAI,CACX,eAAe,CAAE,KAAK,CACxB,4BAAe,CACb,UAAU,CAAE,KAAK,CACnB,2BAAc,CACZ,KAAK,CAAE,OAAO,CACd,UAAU,CAAE,MAAM",
4
- "sources": ["classic.sass"],
5
- "names": [],
6
- "file": "classic.css"
7
- }
 
 
 
 
 
 
 
templates/classic/classic.sass DELETED
@@ -1,220 +0,0 @@
1
- .wef-classic
2
- font: 300 14px/20px Helvetica
3
- padding: 10px
4
- display: table
5
- margin: 10px auto
6
- border:
7
- width: 1px
8
- style: solid
9
- color: #23487F
10
- box-shadow: 1px 1px 2px #23487F
11
- width: 100%
12
- background-color: #FFFFFF
13
- color: #0f0f0f
14
- @media (min-width: 30em)
15
- .row
16
- width: 100%
17
- display: table-row
18
- table-layout: fixed
19
- float: left
20
- .wef-col-1, .wef-col-2, .wef-col-3, .wef-col-4, .wef-col-5, .wef-col-6, .wef-col-7, .wef-col-8, .wef-col-9, .wef-col-10, .wef-col-11, .wef-col-12
21
- display: table-cell
22
- float: left
23
- .wef-col-12
24
- width: 100%
25
- .wef-col-11
26
- width: 91.66666667%
27
- .wef-col-10
28
- width: 83.33333333%
29
- .wef-col-9
30
- width: 75%
31
- .wef-col-8
32
- width: 66.66666667%
33
- .wef-col-7
34
- width: 58.33333333%
35
- .wef-col-6
36
- width: 50%
37
- .wef-col-5
38
- width: 41.66666667%
39
- .wef-col-4
40
- width: 33.33333333%
41
- .wef-col-3
42
- width: 25%
43
- .wef-col-2
44
- width: 16.66666667%
45
- .wef-col-1
46
- width: 8.33333333%
47
- hr.wef-hr
48
- margin:
49
- top: 10px !important
50
- bottom: 10px !important
51
- left: 0 !important
52
- right: 0 !important
53
- float: left !important
54
- border:
55
- top: 1px
56
- style: solid
57
- color: #23487F
58
- -moz-box-sizing: content-box
59
- -webkit-box-sizing: content-box
60
- box-sizing: content-box
61
- height: 0 !important
62
- width: 100% !important
63
- img.wef-icon
64
- float: right
65
- box-shadow: none
66
- margin: 0
67
- padding: 0
68
- display: block
69
- img.wef-thumbnail
70
- border: 1px solid #808080
71
- border-radius: 2px
72
- height: 60px !important
73
- margin: 2px 4px
74
- padding: 0
75
- width: 60px !important
76
- .wef-album-thumbs
77
- display: inline-block
78
- a.wef-button
79
- padding: 5px 9px !important
80
- text-align: center
81
- text-decoration: none !important
82
- display: inline-block
83
- font-size: 15px
84
- -webkit-transition-duration: .1s
85
- transition-duration: .1s
86
- cursor: pointer
87
- background-color: #fff
88
- color: #000 !important
89
- border: 2px solid #23487F !important
90
- border-radius: 4px
91
- &:hover, &:focus
92
- background-color: #23487F !important
93
- color: white !important
94
- text-decoration: none !important
95
- a
96
- font: 300 14px/20px Helvetica
97
- color: #23487F !important
98
- text-decoration: none !important
99
- border: 0 !important
100
- margin: 0 !important
101
- padding: 0 !important
102
- box-shadow: none !important
103
- &:focus, &:hover
104
- color: #23487F
105
- text-decoration: underline !important
106
- &.wef-post-likes
107
- color: #6d84b4 !important
108
- font-size: 12px !important
109
- &.road-trip
110
- width: 0 !important
111
- height: 0 !important
112
- img
113
- display: inline-block !important
114
- margin: 0 !important
115
- padding: 0 !important
116
- box-shadow: none !important
117
- p
118
- font: 300 14px/20px Helvetica
119
- padding: 0 !important
120
- margin: 0 !important
121
- &.wef-post-time
122
- font-style: italic
123
- color: #8e8c8d
124
- font-size: 12px
125
- &.caption-link
126
- text-align: right
127
- word-break: break-all
128
- a
129
- font-size: 12px
130
- color: #8e8c8d !important
131
- text-transform: uppercase
132
- &.caption-title
133
- text-align: left
134
- a
135
- font-size: 12px
136
- font-weight: bold
137
- iframe, embed, object, video, audio
138
- width: 100% !important
139
- border: 0 !important
140
- margin: 0 !important
141
- padding: 0 !important
142
- .wef-post-link
143
- border:
144
- width: 1px
145
- style: solid
146
- color: #d0d0d0
147
- box-shadow: 1px 1px 2px #b3b3b3
148
- p
149
- padding:
150
- left: 10px !important
151
- right: 10px !important
152
- .wef-text-center
153
- text-align: center
154
- .wef-pl-none
155
- padding-left: 0 !important
156
- word-break: break-all
157
- .wef-title
158
- font-size: 20px !important
159
- font-weight: bold !important
160
- word-break: break-all
161
- display: inherit !important
162
- height: 100% !important
163
- background-color: transparent !important
164
- padding-top: 5px !important
165
- .wef-pad-top
166
- padding:
167
- top: 5px
168
- .caption-description p
169
- color: #8e8c8d !important
170
- font-style: italic !important
171
- font-size: 12px !important
172
- .wef-measure
173
- width: 100%
174
- .wef-event_address
175
- color: #565656
176
- font-size: 12px
177
- .wef-relative-container
178
- position: relative
179
- display: block
180
- height: 0
181
- overflow: hidden
182
- .wef-relative
183
- position: absolute
184
- top: 0
185
- left: 0
186
- bottom: 0
187
- height: 100%
188
- width: 100%
189
- border: 0
190
- margin: 0
191
- padding: 0
192
- .wef-video
193
- padding: 0 0 56.25%
194
- iframe, embed, object, video
195
- @extend .wef-relative
196
- .wef-fbpost-image
197
- padding: 0 0 75%
198
- div
199
- cursor: pointer
200
- background:
201
- size: cover
202
- position: 50% 50%
203
- .wef-cover
204
- padding: 0 0 36.86%
205
- div
206
- background-size: 100% !important
207
- background-position-x: 0
208
- cursor: pointer
209
- span.wef-album-thumb
210
- height: 65px !important
211
- margin: 1px
212
- padding: 2px
213
- width: 65px !important
214
- float: left
215
- background-size: cover
216
- .wef-text-right
217
- text-align: right
218
- .event_address
219
- color: #404040
220
- font-style: italic
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/classic/com-page.php DELETED
@@ -1,32 +0,0 @@
1
- <div class="wef-classic aligncenter" style="max-width: <?php echo $width ?>px">
2
- <div class="wef-row">
3
- <div class="wef-col-3 wef-text-center">
4
- <a href="https://www.facebook.com/<?php /** @noinspection PhpUndefinedVariableInspection */
5
- echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
6
- <img src="https://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
7
- </a>
8
- </div>
9
- <div class="wef-col-9 wef-pl-none">
10
- <a href="https://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
11
- <span class="wef-title"><?php echo $fb_data['name'] ?></span>
12
- </a>
13
- <br>
14
- <div>
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;
22
- ?>
23
- </div>
24
- <?php if(isset($fb_data["website"])) : ?>
25
- <br>
26
- <a href="<?php echo WP_Embed_FB::getwebsite($fb_data["website"]) ?>" title="<?php _e('Web Site', 'wp-embed-facebook') ?>" target="_blank">
27
- <?php _e('Web Site','wp-embed-facebook') ?>
28
- </a>
29
- <?php endif; ?>
30
- </div>
31
- </div>
32
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/classic/event.php DELETED
@@ -1,37 +0,0 @@
1
- <?php
2
- $start_time_format = WP_Embed_FB_Plugin::get_option('event_start_time_format');
3
- $old_time_zone = date_default_timezone_get();
4
- if(WP_Embed_FB_Plugin::get_option('ev_local_tz') == 'true'){
5
- $timezone = WP_Embed_FB_Plugin::get_timezone();
6
- } else {
7
- $timezone = isset( $fb_data['timezone'] ) ? $fb_data['timezone'] : WP_Embed_FB_Plugin::get_timezone();
8
- }
9
- date_default_timezone_set( $timezone );
10
- /** @noinspection PhpUndefinedVariableInspection */
11
- $start_time = date_i18n( $start_time_format, strtotime( $fb_data['start_time'] ) );
12
- date_default_timezone_set( $old_time_zone );
13
- ?>
14
- <div class="wef-classic aligncenter" style="max-width: <?php echo $width ?>px">
15
- <?php if(isset($fb_data['cover'])) : ?>
16
- <div class="wef-relative-container wef-cover"><div class="wef-relative" style="background-image: url('<?php echo $fb_data['cover']['source'] ?>'); background-position-y: <?php echo $fb_data['cover']['offset_y'] ?>%" onclick="window.open('https://www.facebook.com/<?php echo $fb_data['id'] ?>', '_blank')"></div></div>
17
- <?php endif; ?>
18
- <div class="wef-row wef-pad-top">
19
- <div class="wef-col-12">
20
- <a href="https://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
21
- <span class="wef-title"><?php echo $fb_data['name'] ?></span>
22
- </a>
23
- <p><?php echo $start_time ?></p>
24
- <p>
25
- <?php
26
- if ( isset( $fb_data['place']['id'] ) ) {
27
- _e( '@ ', 'wp-embed-facebook' );
28
- echo '<a href="https://www.facebook.com/' . $fb_data['place']['id'] . '" target="_blank">' . $fb_data['place']['name'] . '</a>';
29
- } else {
30
- echo isset( $fb_data['place']['name'] ) ? __( '@ ', 'wp-embed-facebook' ) . $fb_data['place']['name'] : '';
31
- }
32
- ?>
33
- </p>
34
- <p><?php echo __( 'Creator: ', 'wp-embed-facebook' ) . '<a href="https://www.facebook.com/' . $fb_data['owner']['id'] . '" target="_blank">' . $fb_data['owner']['name'] . '</a>' ?></p>
35
- </div>
36
- </div>
37
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/classic/photo.php DELETED
@@ -1,11 +0,0 @@
1
- <div class="wef-classic aligncenter" style="max-width: <?php echo $width ?>px" >
2
- <a href="<?php //TODO sdk v2.10 does not use source it uses images
3
- /** @noinspection PhpUndefinedVariableInspection */
4
- echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
5
- <img src="<?php echo $fb_data['source'] ?>" width="100%" height="auto" >
6
- </a>
7
- <a class="wef-post-link" href="<?php echo $fb_data['link'] ?> " target="_blank" rel="nofollow">
8
- <?php echo isset($fb_data['likes']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y6/r/l9Fe9Ugss0S.gif" />'.$fb_data['likes']['summary']['total_count'].' ' : "" ?>
9
- <?php echo isset($fb_data['comments']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yg/r/V8Yrm0eKZpi.gif" />'.$fb_data['comments']['summary']['total_count'].' ' : "" ?>
10
- </a>
11
- </div>
 
 
 
 
 
 
 
 
 
 
 
templates/classic/post.php DELETED
@@ -1,32 +0,0 @@
1
- <?php $fb_post = /** @noinspection PhpUndefinedVariableInspection */
2
- $fb_data ?>
3
- <div class="wef-classic aligncenter" style="max-width: <?php echo $width ?>px" >
4
- <div class="wef-col-3 wef-text-center">
5
- <a href="https://www.facebook.com/<?php echo $fb_post['from']['id'] ?>" target="_blank" rel="nofollow">
6
- <img src="https://graph.facebook.com/<?php echo $fb_post['from']['id'] ?>/picture" width="50px" height="50px" />
7
- </a>
8
- </div>
9
- <div class="wef-col-9 wef-pl-none">
10
- <p>
11
- <a href="https://www.facebook.com/<?php echo $fb_post['from']['id'] ?>" target="_blank" rel="nofollow">
12
- <span class="wef-title"><?php echo $fb_post['from']['name'] ?></span>
13
- </a>
14
- </p>
15
- <div>
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;
23
- ?>
24
- </div>
25
- </div>
26
- <?php if(isset($fb_post['picture']) || isset($fb_post['message'])) : ?>
27
- <?php
28
- global $wp_embed;
29
- include('single-post.php');
30
- ?>
31
- <?php endif; ?>
32
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/classic/profile.php DELETED
@@ -1,26 +0,0 @@
1
- <div class="wef-classic aligncenter" style="max-width: <?php echo $width ?>px">
2
- <div class="wef-row">
3
- <div class="wef-col-3 wef-text-center">
4
- <a href="https://www.facebook.com/<?php /** @noinspection PhpUndefinedVariableInspection */
5
- echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
6
- <img src="https://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
7
- </a>
8
- </div>
9
- <div class="wef-col-9 wef-pl-none">
10
- <p>
11
- <a href="https://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
12
- <span class="wef-title"><?php echo $fb_data['name'] ?></span>
13
- </a>
14
- </p>
15
- <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>
23
- </div>
24
- </div>
25
- </div>
26
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/classic/single-post.php DELETED
@@ -1,142 +0,0 @@
1
- <?php
2
-
3
-
4
- $story = isset($fb_post['story']) ? '<p>' . $fb_post['story'] . '</p>' : '';
5
-
6
- $icon = isset($fb_post["icon"]) ? '<img class="wef-icon" title="Facebook ' . $fb_post["type"] . '" src="' . $fb_post["icon"] . '">' : '';
7
-
8
- $old_time_zone = date_default_timezone_get();
9
- date_default_timezone_set(WP_Embed_FB_Plugin::get_timezone());
10
- $time = $icon . date_i18n(WP_Embed_FB_Plugin::get_option('single_post_time_format'), strtotime($fb_post['created_time']));
11
- date_default_timezone_set($old_time_zone);
12
-
13
- $description = isset($fb_post['description']) && !empty($fb_post['description']) ? WP_Embed_FB::make_clickable($fb_post['description']) : '';
14
-
15
- $linkArray = explode("_", $fb_post['id']);
16
- $link = (isset($fb_post['link']) && !empty($fb_post['link'])) ? $fb_post['link'] : "https://www.facebook.com/" . $linkArray[0] . "/posts/" . $linkArray[1];
17
-
18
- $message = (isset($fb_post['message']) && !empty($fb_post['message'])) ? $fb_post['message'] : '';
19
-
20
- $caption = isset($fb_post['caption']) && !empty($fb_post['caption']) ? $fb_post['caption'] : '';
21
-
22
- $name = isset($fb_post['name']) && !empty($fb_post['name']) ? $fb_post['name'] : '';
23
-
24
-
25
- if ($caption == $message) {
26
- $caption = '';
27
- }
28
-
29
- $message = WP_Embed_FB::make_clickable($message);
30
-
31
-
32
- $name = empty($name) ? '' : "<p class=\"caption-title\"><a href=\"$link\" title=\"$name\" target=\"_blank\" rel=\"nofollow\">$name</a></p>";
33
-
34
- $description = empty($description) ? '' : "<div class=\"caption-description\">$description</div>";
35
-
36
- $caption = empty($caption) ? '' : "<p class=\"caption-link\"><a href=\"$link\" target=\"_blank\" rel=\"nofollow\"></a>$caption</p>";
37
-
38
- $link_info = $name . $description . $caption;
39
- ?>
40
- <hr class="wef-hr">
41
- <div class="wef-row">
42
- <div class="wef-col-12">
43
- <?php //echo '<pre>'.wpautop(print_r($fb_post,true)).'</pre>'; ?>
44
- <?php echo $story ?>
45
- <p class="wef-post-time"><?php echo $time ?></p>
46
- <?php
47
- echo $message ? '<p>' . $message . '</p>' : '';
48
- switch ($fb_post["type"]) :
49
- case 'video':
50
- if (strpos($link, 'facebook.com') !== false) {
51
- $raw = WP_Embed_FB::$raw;
52
- $width_r = WP_Embed_FB::$width;
53
- WP_Embed_FB::$raw = true;
54
- WP_Embed_FB::$width = $width - 40;
55
- echo $wp_embed->shortcode(array('src' => $link));
56
- WP_Embed_FB::$raw = $raw;
57
- WP_Embed_FB::$width = $width_r;
58
- echo $link_info;
59
- } else {
60
- $use_ratio = (WP_Embed_FB_Plugin::get_option('video_ratio') == 'true');
61
- echo '<div class="wef-post-link">';
62
- echo $use_ratio ? '<div class="wef-video">' : '';
63
- echo $wp_embed->shortcode(array('src' => $link, 'width' => $width - 20));
64
- echo $use_ratio ? '</div>' : '';
65
- echo $link_info;
66
- echo '</div>';
67
- }
68
- break;
69
- case 'event':
70
- WP_Embed_FB::$width = $width - 40;
71
- echo $wp_embed->shortcode(array('src' => $link));
72
- WP_Embed_FB::$width = $width;
73
- break;
74
- case 'photo':
75
- ?>
76
-
77
- <a href="<?php echo $fb_post['full_picture'] ?>" <?php echo WP_Embed_FB_Plugin::get_option('lightbox_att') ?> <?php echo $message ? WP_Embed_FB_Plugin::lightbox_title($message) : '' ?> >
78
- <div class="wef-relative-container wef-fbpost-image">
79
- <div class="wef-relative"
80
- style="background-image: url('<?php echo $fb_post['full_picture'] ?>');"></div>
81
- </div>
82
- </a>
83
- <?php echo $link_info; ?>
84
- <?php
85
- break;
86
- case 'music':
87
- case 'link':
88
- ?>
89
- <div class="wef-post-link" style="max-width: <?php echo $width ?>px;">
90
- <?php if (isset($fb_post['full_picture']) && !empty($fb_post['full_picture'])) : ?>
91
- <div class="wef-relative-container wef-fbpost-image">
92
- <div class="wef-relative"
93
- style="background-image: url('<?php echo $fb_post['full_picture'] ?>');"
94
- onclick="window.open('<?php echo $link ?>', '_blank')"></div>
95
- </div>
96
- <?php endif ?>
97
- <?php if ($fb_post["type"] == 'music') : ?>
98
- <p>
99
- <audio controls>
100
- <source src="<?php echo $fb_post['source'] ?>" type="audio/mpeg">
101
- </audio>
102
- </p>
103
- <?php endif ?>
104
- <?php echo $link_info; ?>
105
- </div>
106
- <?php
107
- break;
108
- case 'status':
109
- default:
110
- ?>
111
- <?php if (isset($fb_post['full_picture'], $link) && !empty($fb_post['full_picture']) && !empty($link)) : ?>
112
- <a href="<?php echo $fb_post['full_picture'] ?>" <?php echo WP_Embed_FB_Plugin::get_option('lightbox_att') ?> <?php echo $message ? WP_Embed_FB_Plugin::lightbox_title($message) : '' ?> >
113
- <div class="wef-relative-container wef-fbpost-image">
114
- <div class="wef-relative"
115
- style="background-image: url('<?php echo $fb_post['full_picture'] ?>');"></div>
116
- </div>
117
- </a>
118
- <?php endif; ?>
119
- <?php echo $link_info; ?>
120
- <?php
121
- break;
122
- endswitch;
123
- $title_count = '';
124
- if (isset($fb_post['likes'])) {
125
- $title_count .= $fb_post['likes']['summary']['total_count'] . ' ' . __('likes', 'wp-embed-facebook') . ' ';
126
- }
127
- if (isset($fb_post['comments'])) {
128
- $title_count .= $fb_post['comments']['summary']['total_count'] . ' ' . __('comments', 'wp-embed-facebook') . ' ';
129
- }
130
- if (isset($fb_post['shares'])) {
131
- $title_count .= $fb_post['shares']['count'] . ' ' . __('shares', 'wp-embed-facebook') . ' ';
132
- }
133
- ?><br>
134
- <a class="wef-post-likes"
135
- href="<?php echo "https://www.facebook.com/" . $linkArray[0] . "/posts/" . $linkArray[1] ?> "
136
- target="_blank" rel="nofollow" title="<?php echo esc_attr($title_count) ?>">
137
- <?php echo isset($fb_post['likes']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y6/r/l9Fe9Ugss0S.gif" />' . $fb_post['likes']['summary']['total_count'] . ' ' : "" ?>
138
- <?php echo isset($fb_post['comments']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yg/r/V8Yrm0eKZpi.gif" />' . $fb_post['comments']['summary']['total_count'] . ' ' : "" ?>
139
- <?php echo isset($fb_post['shares']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y2/r/o19N6EzzbUm.png" />' . $fb_post['shares']['count'] . ' ' : "" ?>
140
- </a>
141
- </div>
142
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/classic/social-plugin.php DELETED
@@ -1,23 +0,0 @@
1
- <div class="wef-measure" style="max-width: <?php echo $width ?>px;"></div>
2
- <?php
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
- }
15
-
16
- break;
17
- //case 'photo' :
18
- //case 'post' :
19
- default:
20
- /** @noinspection PhpUndefinedVariableInspection */
21
- echo WEF_Social_Plugins::get('post',array('href'=>'https://www.facebook.com/' . $fb_data['link'],'width'=>$width));
22
- break;
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/classic/video.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- $use_ratio = (WP_Embed_FB_Plugin::get_option('video_ratio') == 'true');
3
- ?>
4
- <div class="wef-classic aligncenter" style="max-width: <?php echo $width ?>px">
5
- <?php echo $use_ratio ? '<div class="wef-relative-container wef-video">' : '' ?>
6
- <?php
7
- /** @noinspection PhpUndefinedVariableInspection */
8
- $url = $fb_data['source'];
9
- $file_array = explode('/',parse_url($url, PHP_URL_PATH));
10
- $file = end($file_array);
11
- $type_array = explode('.',$file);
12
- $type = end($type_array);
13
- $clean_type = strtolower($type);
14
-
15
- if( WP_Embed_FB::is_raw('video') && $clean_type == 'mp4' ) : ?>
16
- <?php $end = isset($fb_data['format']) ? end($fb_data['format']) : $fb_data; ?>
17
-
18
- <video controls poster="<?php echo $end['picture'] ?>" >
19
- <source src="<?php echo $fb_data['source'] ?>" type="video/<?php echo $clean_type ?>">
20
- </video>
21
-
22
- <?php else : ?>
23
-
24
- <div class="fb-video" data-allowfullscreen="true"
25
- data-href="/<?php echo $fb_data['from']['id'] ?>/videos/<?php echo $fb_data['id'] ?>">
26
- </div>
27
-
28
- <?php endif; ?>
29
- <?php echo $use_ratio ? '</div>' : '' ?>
30
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/comments.php CHANGED
@@ -1,5 +1,7 @@
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%'));
 
1
  <?php
2
+ use SIGAMI\WP_Embed_FB\Social_Plugins;
3
  if ( post_password_required() ) {
4
  return;
5
  }
6
+ echo "<style>.fb_iframe_widget iframe{width: 100% !important;}</style>";
7
+ echo Social_Plugins::get('comments',array('href'=>wp_get_shortlink(get_queried_object_id()),'width'=>'100%'));
templates/{default → custom-embeds}/album.php RENAMED
@@ -1,4 +1,7 @@
1
- <div class="wef-default" style="max-width: <?php echo $width ?>px">
 
 
 
2
  <div class="wef-row">
3
  <div class="wef-col-3 wef-text-center">
4
  <a href="https://facebook.com/<?php /** @noinspection PhpUndefinedVariableInspection */
@@ -26,7 +29,7 @@
26
  foreach ($fb_data['photos']['data'] as $pic) {
27
  $data_title = isset($pic['name']) ? $pic['name'] : '';
28
  ?>
29
- <a class="wef-album-thumbs" href="<?php echo $pic['source'] ?>" <?php echo WP_Embed_FB_Plugin::get_option('lightbox_att') ?> <?php echo !empty($data_title) ? WP_Embed_FB_Plugin::lightbox_title($data_title) : '' ?> >
30
  <span class="wef-album-thumb" style="background-image: url('<?php echo $pic['picture'] ?>')"></span>
31
  </a>
32
  <?php
1
+ <?php
2
+ use SIGAMI\WP_Embed_FB\Plugin;
3
+ ?>
4
+ <div class="wef-container wef-<?php echo $theme ?>" style="max-width: <?php echo $width ?>px">
5
  <div class="wef-row">
6
  <div class="wef-col-3 wef-text-center">
7
  <a href="https://facebook.com/<?php /** @noinspection PhpUndefinedVariableInspection */
29
  foreach ($fb_data['photos']['data'] as $pic) {
30
  $data_title = isset($pic['name']) ? $pic['name'] : '';
31
  ?>
32
+ <a class="wef-album-thumbs" href="<?php echo $pic['source'] ?>" <?php echo Plugin::get_option('lightbox_att') ?> <?php echo !empty($data_title) ? \SIGAMI\WP_Embed_FB\Helpers::lightbox_title($data_title) : '' ?> >
33
  <span class="wef-album-thumb" style="background-image: url('<?php echo $pic['picture'] ?>')"></span>
34
  </a>
35
  <?php
templates/{classic → custom-embeds}/page.php RENAMED
@@ -1,4 +1,9 @@
1
- <div class="wef-classic aligncenter" style="max-width: <?php echo $width ?>px" >
 
 
 
 
 
2
  <?php if(isset($fb_data['cover'])) : ?>
3
  <div class="wef-relative-container wef-cover"><div class="wef-relative" style="background-image: url('<?php echo $fb_data['cover']['source'] ?>'); background-position-y: <?php echo $fb_data['cover']['offset_y'] ?>%" onclick="window.open('https://www.facebook.com/<?php echo $fb_data['id'] ?>', '_blank')"></div></div>
4
  <?php endif; ?>
@@ -21,15 +26,15 @@
21
  }
22
  ?><br>
23
  <?php if(isset($fb_data["website"]) && (strip_tags($fb_data["website"]) != '')) : ?>
24
- <a href="<?php echo WP_Embed_FB::getwebsite($fb_data["website"]) ?>" title="<?php _e('Web Site', 'wp-embed-facebook') ?>" target="_blank">
25
  <?php _e('Web Site','wp-embed-facebook') ?>
26
  </a>
27
  <?php endif; ?>
28
  <div style="float: right;">
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['fan_count'] );
35
  endif;
1
+ <?php
2
+ use SIGAMI\WP_Embed_FB\Plugin;
3
+ use SIGAMI\WP_Embed_FB\Social_Plugins;
4
+ use SIGAMI\WP_Embed_FB\Embed_FB;
5
+ ?>
6
+ <div class="wef-container wef-<?php echo $theme ?>" style="max-width: <?php echo $width ?>px" >
7
  <?php if(isset($fb_data['cover'])) : ?>
8
  <div class="wef-relative-container wef-cover"><div class="wef-relative" style="background-image: url('<?php echo $fb_data['cover']['source'] ?>'); background-position-y: <?php echo $fb_data['cover']['offset_y'] ?>%" onclick="window.open('https://www.facebook.com/<?php echo $fb_data['id'] ?>', '_blank')"></div></div>
9
  <?php endif; ?>
26
  }
27
  ?><br>
28
  <?php if(isset($fb_data["website"]) && (strip_tags($fb_data["website"]) != '')) : ?>
29
+ <a href="<?php echo esc_url_raw($fb_data["website"]) ?>" title="<?php _e('Web Site', 'wp-embed-facebook') ?>" target="_blank">
30
  <?php _e('Web Site','wp-embed-facebook') ?>
31
  </a>
32
  <?php endif; ?>
33
  <div style="float: right;">
34
  <?php
35
+ $opt = Plugin::get_option('show_like');
36
  if($opt === 'true') :
37
+ echo Social_Plugins::get('like',array('href'=>'https://www.facebook.com/'.$fb_data['id'],'share'=>'true','layout'=>'button_count','show-faces'=> 'false'));
38
  else :
39
  printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_data['fan_count'] );
40
  endif;
templates/{default → custom-embeds}/photo.php RENAMED
@@ -1,11 +1,14 @@
1
- <div class="wef-default" style="max-width: <?php echo $width ?>px" >
 
 
 
2
  <a href="<?php /** @noinspection PhpUndefinedVariableInspection */
3
  echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
4
  <img src="<?php echo $fb_data['source'] ?>" width="100%" height="auto" >
5
  </a>
6
 
7
  <a class="wef-post-link" href="<?php echo $fb_data['link'] ?> " target="_blank" rel="nofollow">
8
- <?php echo isset($fb_data['likes']) ? '<img width="16px" height="16px" src="'.WP_Embed_FB_Plugin::url().'lib/images/like.png" /> '.$fb_data['likes']['summary']['total_count'].' ' : "" ?>
9
- <?php echo isset($fb_data['comments']) ? ' <img width="16px" height="16px" src="'.WP_Embed_FB_Plugin::url().'lib/images/comments.png"/> '.$fb_data['comments']['summary']['total_count'].' ' : "" ?>
10
  </a>
11
  </div>
1
+ <?php
2
+ use SIGAMI\WP_Embed_FB\Plugin;
3
+ ?>
4
+ <div class="wef-container wef-<?php echo $theme ?>" style="max-width: <?php echo $width ?>px" >
5
  <a href="<?php /** @noinspection PhpUndefinedVariableInspection */
6
  echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
7
  <img src="<?php echo $fb_data['source'] ?>" width="100%" height="auto" >
8
  </a>
9
 
10
  <a class="wef-post-link" href="<?php echo $fb_data['link'] ?> " target="_blank" rel="nofollow">
11
+ <?php echo isset($fb_data['likes']) ? '<img width="16px" height="16px" src="'.Plugin::url().'templates/images/like.png" /> '.$fb_data['likes']['summary']['total_count'].' ' : "" ?>
12
+ <?php echo isset($fb_data['comments']) ? ' <img width="16px" height="16px" src="'.Plugin::url().'templates/images/comments.png"/> '.$fb_data['comments']['summary']['total_count'].' ' : "" ?>
13
  </a>
14
  </div>
templates/{default → custom-embeds}/post.php RENAMED
@@ -1,6 +1,8 @@
1
- <?php $fb_post = /** @noinspection PhpUndefinedVariableInspection */
2
- $fb_data ?>
3
- <div class="wef-default" style="max-width: <?php echo $width ?>px" >
 
 
4
  <div class="wef-col-3 wef-text-center">
5
  <a href="https://www.facebook.com/<?php echo $fb_post['from']['id'] ?>" target="_blank" rel="nofollow">
6
  <img src="https://graph.facebook.com/<?php echo $fb_post['from']['id'] ?>/picture" width="50px" height="50px" />
@@ -14,9 +16,9 @@
14
  </p>
15
  <div>
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;
1
+ <?php
2
+ use SIGAMI\WP_Embed_FB\Plugin;
3
+ use SIGAMI\WP_Embed_FB\Social_Plugins;
4
+ $fb_post = $fb_data ?>
5
+ <div class="wef-container wef-<?php echo $theme ?>" style="max-width: <?php echo $width ?>px" >
6
  <div class="wef-col-3 wef-text-center">
7
  <a href="https://www.facebook.com/<?php echo $fb_post['from']['id'] ?>" target="_blank" rel="nofollow">
8
  <img src="https://graph.facebook.com/<?php echo $fb_post['from']['id'] ?>/picture" width="50px" height="50px" />
16
  </p>
17
  <div>
18
  <?php
19
+ $opt = Plugin::get_option('show_like');
20
  if($opt === 'true') :
21
+ echo Social_Plugins::get('like',array('href'=>'https://www.facebook.com/'.$fb_data['id'],'share'=>'true','layout'=>'button_count'));
22
  else :
23
  printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_post['likes'] );
24
  endif;
templates/{default → custom-embeds}/profile.php RENAMED
@@ -1,4 +1,8 @@
1
- <div class="wef-default" style="max-width: <?php echo $width ?>px">
 
 
 
 
2
  <div class="wef-row">
3
  <div class="wef-col-3 wef-text-center">
4
  <a href="https://www.facebook.com/<?php /** @noinspection PhpUndefinedVariableInspection */
@@ -14,9 +18,9 @@
14
  </p>
15
  <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>
1
+ <?php
2
+ use SIGAMI\WP_Embed_FB\Plugin;
3
+ use SIGAMI\WP_Embed_FB\Social_Plugins;
4
+ ?>
5
+ <div class="wef-container wef-<?php echo $theme ?>" style="max-width: <?php echo $width ?>px">
6
  <div class="wef-row">
7
  <div class="wef-col-3 wef-text-center">
8
  <a href="https://www.facebook.com/<?php /** @noinspection PhpUndefinedVariableInspection */
18
  </p>
19
  <div>
20
  <?php
21
+ $opt = Plugin::get_option('show_follow');
22
  if($opt === 'true') :
23
+ Social_Plugins::get('follow',array('href'=>'https://www.facebook.com/'.$fb_data['id']));
24
  endif;
25
  ?>
26
  </div>
templates/{default → custom-embeds}/single-post.php RENAMED
@@ -1,16 +1,18 @@
1
  <?php
2
-
 
 
3
 
4
  $story = isset($fb_post['story']) ? '<p>' . $fb_post['story'] . '</p>' : '';
5
 
6
  $icon = isset($fb_post["icon"]) ? '<img class="wef-icon" title="Facebook ' . $fb_post["type"] . '" src="' . $fb_post["icon"] . '">' : '';
7
 
8
  $old_time_zone = date_default_timezone_get();
9
- date_default_timezone_set(WP_Embed_FB_Plugin::get_timezone());
10
- $time = $icon . date_i18n(WP_Embed_FB_Plugin::get_option('single_post_time_format'), strtotime($fb_post['created_time']));
11
  date_default_timezone_set($old_time_zone);
12
 
13
- $description = isset($fb_post['description']) && !empty($fb_post['description']) ? WP_Embed_FB::make_clickable($fb_post['description']) : '';
14
 
15
  $linkArray = explode("_", $fb_post['id']);
16
  $link = (isset($fb_post['link']) && !empty($fb_post['link'])) ? $fb_post['link'] : "https://www.facebook.com/" . $linkArray[0] . "/posts/" . $linkArray[1];
@@ -26,7 +28,7 @@ if ($caption == $message) {
26
  $caption = '';
27
  }
28
 
29
- $message = WP_Embed_FB::make_clickable($message);
30
 
31
 
32
  $name = empty($name) ? '' : "<p class=\"caption-title\"><a href=\"$link\" title=\"$name\" target=\"_blank\" rel=\"nofollow\">$name</a></p>";
@@ -40,7 +42,6 @@ $link_info = $name . $description . $caption;
40
  <hr class="wef-hr">
41
  <div class="wef-row">
42
  <div class="wef-col-12">
43
- <?php //echo '<pre>'.wpautop(print_r($fb_post,true)).'</pre>'; ?>
44
  <?php echo $story ?>
45
  <p class="wef-post-time"><?php echo $time ?></p>
46
  <?php
@@ -48,16 +49,16 @@ $link_info = $name . $description . $caption;
48
  switch ($fb_post["type"]) :
49
  case 'video':
50
  if (strpos($link, 'facebook.com') !== false) {
51
- $raw = WP_Embed_FB::$raw;
52
- $width_r = WP_Embed_FB::$width;
53
- WP_Embed_FB::$raw = true;
54
- WP_Embed_FB::$width = $width - 40;
55
  echo $wp_embed->shortcode(array('src' => $link));
56
- WP_Embed_FB::$raw = $raw;
57
- WP_Embed_FB::$width = $width_r;
58
  echo $link_info;
59
  } else {
60
- $use_ratio = (WP_Embed_FB_Plugin::get_option('video_ratio') == 'true');
61
  echo '<div class="wef-post-link">';
62
  echo $use_ratio ? '<div class="wef-video">' : '';
63
  echo $wp_embed->shortcode(array('src' => $link, 'width' => $width - 20));
@@ -67,14 +68,14 @@ $link_info = $name . $description . $caption;
67
  }
68
  break;
69
  case 'event':
70
- WP_Embed_FB::$width = $width - 40;
71
  echo $wp_embed->shortcode(array('src' => $link));
72
- WP_Embed_FB::$width = $width;
73
  break;
74
  case 'photo':
75
  ?>
76
 
77
- <a href="<?php echo $fb_post['full_picture'] ?>" <?php echo WP_Embed_FB_Plugin::get_option('lightbox_att') ?> <?php echo $message ? WP_Embed_FB_Plugin::lightbox_title($message) : '' ?> >
78
  <div class="wef-relative-container wef-fbpost-image">
79
  <div class="wef-relative"
80
  style="background-image: url('<?php echo $fb_post['full_picture'] ?>');"></div>
@@ -109,7 +110,7 @@ $link_info = $name . $description . $caption;
109
  default:
110
  ?>
111
  <?php if (isset($fb_post['full_picture'], $link) && !empty($fb_post['full_picture']) && !empty($link)) : ?>
112
- <a href="<?php echo $fb_post['full_picture'] ?>" <?php echo WP_Embed_FB_Plugin::get_option('lightbox_att') ?> <?php echo $message ? WP_Embed_FB_Plugin::lightbox_title($message) : '' ?> >
113
  <div class="wef-relative-container wef-fbpost-image">
114
  <div class="wef-relative"
115
  style="background-image: url('<?php echo $fb_post['full_picture'] ?>');"></div>
@@ -134,9 +135,9 @@ $link_info = $name . $description . $caption;
134
  <a class="wef-post-likes"
135
  href="<?php echo "https://www.facebook.com/" . $linkArray[0] . "/posts/" . $linkArray[1] ?> "
136
  target="_blank" rel="nofollow" title="<?php echo esc_attr($title_count) ?>">
137
- <?php echo isset($fb_post['likes']) ? ' <img width="16px" height="16px" src="'.WP_Embed_FB_Plugin::url().'lib/images/like.png" /> ' . $fb_post['likes']['summary']['total_count'] . ' ' : "" ?>
138
- <?php echo isset($fb_post['comments']) ? ' <img width="16px" height="16px" src="'.WP_Embed_FB_Plugin::url().'lib/images/comments.png" /> ' . $fb_post['comments']['summary']['total_count'] . ' ' : "" ?>
139
- <?php echo isset($fb_post['shares']) ? ' <img width="16px" height="16px" src="'.WP_Embed_FB_Plugin::url().'lib/images/share.png" /> ' . $fb_post['shares']['count'] . ' ' : "" ?>
140
  </a>
141
  </div>
142
  </div>
1
  <?php
2
+ use SIGAMI\WP_Embed_FB\Embed_FB;
3
+ use SIGAMI\WP_Embed_FB\Plugin;
4
+ use SIGAMI\WP_Embed_FB\Helpers;
5
 
6
  $story = isset($fb_post['story']) ? '<p>' . $fb_post['story'] . '</p>' : '';
7
 
8
  $icon = isset($fb_post["icon"]) ? '<img class="wef-icon" title="Facebook ' . $fb_post["type"] . '" src="' . $fb_post["icon"] . '">' : '';
9
 
10
  $old_time_zone = date_default_timezone_get();
11
+ date_default_timezone_set(Helpers::get_timezone());
12
+ $time = $icon . date_i18n(Plugin::get_option('single_post_time_format'), strtotime($fb_post['created_time']));
13
  date_default_timezone_set($old_time_zone);
14
 
15
+ $description = isset($fb_post['description']) && !empty($fb_post['description']) ? Helpers::make_clickable($fb_post['description']) : '';
16
 
17
  $linkArray = explode("_", $fb_post['id']);
18
  $link = (isset($fb_post['link']) && !empty($fb_post['link'])) ? $fb_post['link'] : "https://www.facebook.com/" . $linkArray[0] . "/posts/" . $linkArray[1];
28
  $caption = '';
29
  }
30
 
31
+ $message = Helpers::make_clickable($message);
32
 
33
 
34
  $name = empty($name) ? '' : "<p class=\"caption-title\"><a href=\"$link\" title=\"$name\" target=\"_blank\" rel=\"nofollow\">$name</a></p>";
42
  <hr class="wef-hr">
43
  <div class="wef-row">
44
  <div class="wef-col-12">
 
45
  <?php echo $story ?>
46
  <p class="wef-post-time"><?php echo $time ?></p>
47
  <?php
49
  switch ($fb_post["type"]) :
50
  case 'video':
51
  if (strpos($link, 'facebook.com') !== false) {
52
+ $raw = Embed_FB::$raw;
53
+ $width_r = Embed_FB::$width;
54
+ Embed_FB::$raw = true;
55
+ Embed_FB::$width = (int) str_replace(['px','%'],[],$width) - 40;
56
  echo $wp_embed->shortcode(array('src' => $link));
57
+ Embed_FB::$raw = $raw;
58
+ Embed_FB::$width = $width_r;
59
  echo $link_info;
60
  } else {
61
+ $use_ratio = (Plugin::get_option('video_ratio') == 'true');
62
  echo '<div class="wef-post-link">';
63
  echo $use_ratio ? '<div class="wef-video">' : '';
64
  echo $wp_embed->shortcode(array('src' => $link, 'width' => $width - 20));
68
  }
69
  break;
70
  case 'event':
71
+ Embed_FB::$width = $width - 40;
72
  echo $wp_embed->shortcode(array('src' => $link));
73
+ Embed_FB::$width = $width;
74
  break;
75
  case 'photo':
76
  ?>
77
 
78
+ <a href="<?php echo $fb_post['full_picture'] ?>" <?php echo Plugin::get_option('lightbox_att') ?> <?php echo $message ? Helpers::lightbox_title($message) : '' ?> >
79
  <div class="wef-relative-container wef-fbpost-image">
80
  <div class="wef-relative"
81
  style="background-image: url('<?php echo $fb_post['full_picture'] ?>');"></div>
110
  default:
111
  ?>
112
  <?php if (isset($fb_post['full_picture'], $link) && !empty($fb_post['full_picture']) && !empty($link)) : ?>
113
+ <a href="<?php echo $fb_post['full_picture'] ?>" <?php echo Plugin::get_option('lightbox_att') ?> <?php echo $message ? \SIGAMI\WP_Embed_FB\Helpers::lightbox_title($message) : '' ?> >
114
  <div class="wef-relative-container wef-fbpost-image">
115
  <div class="wef-relative"
116
  style="background-image: url('<?php echo $fb_post['full_picture'] ?>');"></div>
135
  <a class="wef-post-likes"
136
  href="<?php echo "https://www.facebook.com/" . $linkArray[0] . "/posts/" . $linkArray[1] ?> "
137
  target="_blank" rel="nofollow" title="<?php echo esc_attr($title_count) ?>">
138
+ <?php echo isset($fb_post['likes']) ? ' <img width="16px" height="16px" src="'.Plugin::url().'templates/images/like.png" /> ' . $fb_post['likes']['summary']['total_count'] . ' ' : "" ?>
139
+ <?php echo isset($fb_post['comments']) ? ' <img width="16px" height="16px" src="'.Plugin::url().'templates/images/comments.png" /> ' . $fb_post['comments']['summary']['total_count'] . ' ' : "" ?>
140
+ <?php echo isset($fb_post['shares']) ? ' <img width="16px" height="16px" src="'.Plugin::url().'templates/images/share.png" /> ' . $fb_post['shares']['count'] . ' ' : "" ?>
141
  </a>
142
  </div>
143
  </div>
templates/custom-embeds/social-plugin.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ use SIGAMI\WP_Embed_FB\Plugin;
3
+ use SIGAMI\WP_Embed_FB\Social_Plugins;
4
+ ?>
5
+ <div class="wef-measure" style="max-width: <?php echo $width ?>px;"></div>
6
+ <?php
7
+ switch ( $type ) {
8
+ case 'page' :
9
+ /** @noinspection PhpUndefinedVariableInspection */
10
+ echo Social_Plugins::get('page',array('href'=>'https://www.facebook.com/' . $fb_data['link'],'width'=>$width));
11
+ break;
12
+ case 'video' :
13
+ if ( Plugin::get_option( 'video_as_post' ) == 'true' ) /** @noinspection PhpUndefinedVariableInspection */ {
14
+ echo Social_Plugins::get('post',array('href'=>'https://www.facebook.com/' . $fb_data['link'],'width'=>$width));
15
+ } else {
16
+ /** @noinspection PhpUndefinedVariableInspection */
17
+ echo Social_Plugins::get('video',array('href'=>'https://www.facebook.com/' . $fb_data['link'],'width'=>$width));
18
+ }
19
+
20
+ break;
21
+ //case 'photo' :
22
+ //case 'post' :
23
+ default:
24
+ /** @noinspection PhpUndefinedVariableInspection */
25
+ echo Social_Plugins::get('post',array('href'=>'https://www.facebook.com/' . $fb_data['link'],'width'=>$width));
26
+ break;
27
+ }
templates/custom-embeds/styles.css ADDED
@@ -0,0 +1 @@
 
1
+ .wef-container{padding:10px;line-height:20px;font-size:14px;font-weight:300;font-family:Helvetica,serif;display:table;width:100%}@media(min-width: 30em){.wef-container .wef-row{width:100%;display:table-row;table-layout:fixed;float:left}.wef-container .wef-col-1{width:8.3333333333%;display:table-cell;float:left}.wef-container .wef-col-2{width:16.6666666667%;display:table-cell;float:left}.wef-container .wef-col-3{width:25%;display:table-cell;float:left}.wef-container .wef-col-4{width:33.3333333333%;display:table-cell;float:left}.wef-container .wef-col-5{width:41.6666666667%;display:table-cell;float:left}.wef-container .wef-col-6{width:50%;display:table-cell;float:left}.wef-container .wef-col-7{width:58.3333333333%;display:table-cell;float:left}.wef-container .wef-col-8{width:66.6666666667%;display:table-cell;float:left}.wef-container .wef-col-9{width:75%;display:table-cell;float:left}.wef-container .wef-col-10{width:83.3333333333%;display:table-cell;float:left}.wef-container .wef-col-11{width:91.6666666667%;display:table-cell;float:left}.wef-container .wef-col-12{width:100%;display:table-cell;float:left}}.wef-container hr.wef-hr{margin-top:10px !important;margin-bottom:10px !important;margin-left:0 !important;margin-right:0 !important;float:left !important;border-top:1px;border-style:solid;border-color:#dedede;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;height:0 !important;width:100% !important}.wef-container img.wef-icon{float:right;box-shadow:none;margin:0;padding:0;display:block}.wef-container img.wef-thumbnail{border:1px solid gray;border-radius:2px;height:60px !important;margin:2px 4px;padding:0;width:60px !important}.wef-container .wef-album-thumbs{display:inline-block}.wef-container a.wef-button{padding:5px 9px !important;text-align:center;text-decoration:none !important;display:inline-block;font-size:15px;-webkit-transition-duration:.1s;transition-duration:.1s;cursor:pointer;background-color:#fff;color:#000 !important;border:2px solid #23487f !important;border-radius:4px}.wef-container a.wef-button:hover,.wef-container a.wef-button:focus{background-color:#23487f !important;color:#fff !important;text-decoration:none !important}.wef-container a{font:300 14px/20px Helvetica;color:#23487f !important;text-decoration:none !important;border:0 !important;margin:0 !important;padding:0 !important;box-shadow:none !important}.wef-container a:focus,.wef-container a:hover{color:#23487f;text-decoration:underline !important}.wef-container a.wef-post-likes{color:#6d84b4 !important;font-size:12px !important}.wef-container a.road-trip{width:0 !important;height:0 !important}.wef-container a img{display:inline-block !important;margin:0 !important;padding:0 !important;box-shadow:none !important}.wef-container p{font:300 14px/20px Helvetica;padding:0 !important;margin:0 !important}.wef-container p.wef-post-time{font-style:italic;color:#8e8c8d;font-size:12px}.wef-container p.caption-link{text-align:right;word-break:break-all}.wef-container p.caption-link a{font-size:12px;color:#8e8c8d !important;text-transform:uppercase}.wef-container p.caption-title{text-align:left}.wef-container p.caption-title a{font-size:12px;font-weight:bold}.wef-container .caption-description p{color:#8e8c8d !important;font-style:italic !important;font-size:12px !important}.wef-container iframe,.wef-container embed,.wef-container object,.wef-container video,.wef-container audio{width:100% !important;border:0 !important;margin:0 !important;padding:0 !important}.wef-container .wef-post-link{border-width:1px;border-style:solid;border-color:#d0d0d0;box-shadow:1px 1px 2px #b3b3b3}.wef-container .wef-post-link p{padding-left:10px !important;padding-right:10px !important}.wef-container .wef-text-center{text-align:center}.wef-container .wef-text-right{text-align:right}.wef-container .wef-pl-none{padding-left:0 !important;word-break:break-all}.wef-container .wef-title{font-size:20px !important;font-weight:bold !important;word-break:break-all;display:inherit !important;height:100% !important;background-color:transparent !important;padding-top:5px !important}.wef-container .wef-pad-top{padding-top:5px}.wef-container .wef-measure{width:100%}.wef-container .wef-event_address{color:#404040;font-style:italic}.wef-container .wef-relative-container{position:relative;display:block;height:0;overflow:hidden}.wef-container .wef-relative-container .wef-relative,.wef-container .wef-relative-container .wef-video iframe,.wef-container .wef-video .wef-relative-container iframe,.wef-container .wef-relative-container .wef-video embed,.wef-container .wef-video .wef-relative-container embed,.wef-container .wef-relative-container .wef-video object,.wef-container .wef-video .wef-relative-container object,.wef-container .wef-relative-container .wef-video video,.wef-container .wef-video .wef-relative-container video{position:absolute;top:0;left:0;bottom:0;height:100%;width:100%;border:0;margin:0;padding:0}.wef-container .wef-video{padding:0 0 56.25%}.wef-container .wef-fbpost-image{padding:0 0 51%}.wef-container .wef-fbpost-image div{cursor:pointer;background-size:cover;background-position:50% 50%}.wef-container .wef-cover{padding:0 0 36.86%}.wef-container .wef-cover div{background-size:100% !important;background-position-x:0;cursor:pointer}.wef-container .wef-album-thumb{height:65px !important;margin:1px;padding:2px;width:65px !important;float:left;background-size:cover}.wef-container .wef-hovereffect{width:100%;height:100%;float:left;overflow:hidden;position:relative;text-align:center;cursor:default}.wef-container .wef-hovereffect .overlay{width:100%;height:100%;position:absolute;overflow:hidden;top:0;left:0;-webkit-transition:all .4s ease-in-out;transition:all .4s ease-in-out}.wef-container .wef-hovereffect a.info{display:inline-block;text-decoration:none;text-transform:uppercase !important;color:#fff !important;border:1px solid #fff !important;margin:50px 0 0 0;background-color:transparent;opacity:0;filter:alpha(opacity=0);-webkit-transform:scale(1.5);-ms-transform:scale(1.5);transform:scale(1.5);-webkit-transition:all .4s ease-in-out;transition:all .4s ease-in-out;font-weight:normal;height:85%;width:85%;position:absolute;left:8%;padding:70px}.wef-container .wef-hovereffect:hover .overlay{background-color:rgba(170,170,170,.4) !important}.wef-container .wef-hovereffect:hover a.info{opacity:1;filter:alpha(opacity=100);-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);background-color:rgba(0,0,0,.4);top:5%;padding-top:5% !important}.wef-default{background-color:#fff;border-width:1px;border-style:solid;border-color:#dedede;border-radius:2px}.wef-classic{background-color:#fff;margin:10px auto;border-width:1px;border-style:solid;border-color:#23487f;border-radius:0;box-shadow:1px 1px 2px #23487f;color:#0f0f0f}.wef-elegant{margin:10px auto;border-width:1px;border-style:solid;border-color:#f0f0f0;border-radius:0;width:100%;background-color:#efefef}/*# sourceMappingURL=styles.css.map */
templates/custom-embeds/styles.css.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sourceRoot":"","sources":["styles.scss"],"names":[],"mappings":"AAQA,eACE,aACA,iBAEE,eACA,gBACA,4BAIF,cACA,WACA,wBACE,wBACE,WACA,kBACA,mBACA,WAIA,0BACE,oBACA,mBACA,WAHF,0BACE,qBACA,mBACA,WAHF,0BACE,UACA,mBACA,WAHF,0BACE,qBACA,mBACA,WAHF,0BACE,qBACA,mBACA,WAHF,0BACE,UACA,mBACA,WAHF,0BACE,qBACA,mBACA,WAHF,0BACE,qBACA,mBACA,WAHF,0BACE,UACA,mBACA,WAHF,2BACE,qBACA,mBACA,WAHF,2BACE,qBACA,mBACA,WAHF,2BACE,WACA,mBACA,YAON,yBAEI,2BACA,8BACA,yBACA,0BAEF,sBAEE,eACA,mBACA,qBAEF,4BACA,+BACA,uBACA,oBACA,sBAGF,4BACE,YACA,gBACA,SACA,UACA,cAGF,iCACE,sBACA,kBACA,uBACA,eACA,UACA,sBAGF,iCACE,qBAGF,4BACE,2BACA,kBACA,gCACA,qBACA,eACA,gCACA,wBACA,eACA,sBACA,sBACA,oCACA,kBAEA,oEACE,oCACA,sBACA,gCAIJ,iBACE,6BACA,yBACA,gCACA,oBACA,oBACA,qBACA,2BAEA,8CACE,cACA,qCAGF,gCACE,yBACA,0BAGF,2BACE,mBACA,oBAGF,qBACE,gCACA,oBACA,qBACA,2BAIJ,iBACE,6BACA,qBACA,oBAEA,+BACE,kBACA,cACA,eAKF,8BACE,iBACA,qBAEA,gCACE,eACA,yBACA,yBAIJ,+BACE,gBAEA,iCACE,eACA,iBAKN,sCACE,yBACA,6BACA,0BAGF,2GACE,sBACA,oBACA,oBACA,qBAGF,8BAEI,iBACA,mBACA,qBAEF,+BACA,gCAEI,6BACA,8BAKN,gCACE,kBAGF,+BACE,iBAGF,4BACE,0BACA,qBAGF,0BACE,0BACA,4BACA,qBACA,2BACA,uBACA,wCACA,2BAGF,4BAEI,gBAIJ,4BACE,WAGF,kCACE,cACA,kBAGF,uCACE,kBACA,cACA,SACA,gBAEA,yfACE,kBACA,MACA,OACA,SACA,YACA,WACA,SACA,SACA,UAIJ,0BACE,mBAOF,iCACE,gBAEA,qCACE,eAEE,sBACA,4BAKN,0BACE,mBAEA,8BACE,gCACA,wBACA,eAKJ,gCACE,uBACA,WACA,YACA,sBACA,WACA,sBAGF,gCACE,WACA,YACA,WACA,gBACA,kBACA,kBACA,eAEA,yCACE,WACA,YACA,kBACA,gBACA,MACA,OACA,uCACA,+BAGF,uCACE,qBACA,qBAGA,oCACA,sBACA,iCACA,kBACA,6BACA,UACA,wBACA,6BACA,yBACA,qBACA,uCACA,+BACA,mBACA,WACA,UACA,kBAGA,QACA,aAIA,+CACE,iDAGF,6CACE,UACA,0BACA,2BACA,uBACA,mBACA,gCACA,OACA,0BAOR,aACE,sBAEE,iBACA,mBACA,qBACA,kBAIJ,aACE,sBACA,iBAEE,iBACA,mBACA,qBACA,gBAEF,+BACA,cAGF,aACE,iBAEE,iBACA,mBACA,qBACA,gBAEF,WACA","file":"styles.css"}
templates/custom-embeds/styles.scss ADDED
@@ -0,0 +1,393 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ //You may ask why this prefix ? It will help you to white label you custom embeds using custom templates :)
3
+ $pf: wef-;
4
+
5
+ //Set the number of columns for the custom embeds grid
6
+ $max-cols: 12;
7
+
8
+ //Main Styles
9
+ .#{$pf}container {
10
+ padding: 10px;
11
+ line-height: 20px;
12
+ font: {
13
+ size: 14px;
14
+ weight: 300;
15
+ family: Helvetica, serif;
16
+ }
17
+
18
+ //ROW SYSTEM
19
+ display: table;
20
+ width: 100%;
21
+ @media (min-width: 30em) {
22
+ .#{$pf}row {
23
+ width: 100%;
24
+ display: table-row;
25
+ table-layout: fixed;
26
+ float: left;
27
+ }
28
+
29
+ @for $i from 1 through $max-cols {
30
+ .#{$pf}col-#{$i} {
31
+ width: $i/$max-cols * 100%;
32
+ display: table-cell;
33
+ float: left;
34
+ }
35
+ }
36
+ }
37
+
38
+ //Template Styles
39
+
40
+ hr.#{$pf}hr {
41
+ margin: {
42
+ top: 10px !important;
43
+ bottom: 10px !important;
44
+ left: 0 !important;
45
+ right: 0 !important;
46
+ }
47
+ float: left !important;
48
+ border: {
49
+ top: 1px;
50
+ style: solid;
51
+ color: #DEDEDE;
52
+ }
53
+ -moz-box-sizing: content-box;
54
+ -webkit-box-sizing: content-box;
55
+ box-sizing: content-box;
56
+ height: 0 !important;
57
+ width: 100% !important;
58
+ }
59
+
60
+ img.#{$pf}icon {
61
+ float: right;
62
+ box-shadow: none;
63
+ margin: 0;
64
+ padding: 0;
65
+ display: block;
66
+ }
67
+
68
+ img.#{$pf}thumbnail {
69
+ border: 1px solid #808080;
70
+ border-radius: 2px;
71
+ height: 60px !important;
72
+ margin: 2px 4px;
73
+ padding: 0;
74
+ width: 60px !important;
75
+ }
76
+
77
+ .#{$pf}album-thumbs {
78
+ display: inline-block;
79
+ }
80
+
81
+ a.#{$pf}button {
82
+ padding: 5px 9px !important;
83
+ text-align: center;
84
+ text-decoration: none !important;
85
+ display: inline-block;
86
+ font-size: 15px;
87
+ -webkit-transition-duration: 0.1s;
88
+ transition-duration: 0.1s;
89
+ cursor: pointer;
90
+ background-color: #fff;
91
+ color: #000 !important;
92
+ border: 2px solid #23487F !important;
93
+ border-radius: 4px;
94
+
95
+ &:hover, &:focus {
96
+ background-color: #23487F !important;
97
+ color: white !important;
98
+ text-decoration: none !important;
99
+ }
100
+ }
101
+
102
+ a {
103
+ font: 300 14px / 20px Helvetica;
104
+ color: #23487F !important;
105
+ text-decoration: none !important;
106
+ border: 0 !important;
107
+ margin: 0 !important;
108
+ padding: 0 !important;
109
+ box-shadow: none !important;
110
+
111
+ &:focus, &:hover {
112
+ color: #23487F;
113
+ text-decoration: underline !important;
114
+ }
115
+
116
+ &.#{$pf}post-likes {
117
+ color: #6d84b4 !important;
118
+ font-size: 12px !important;
119
+ }
120
+
121
+ &.road-trip {
122
+ width: 0 !important;
123
+ height: 0 !important;
124
+ }
125
+
126
+ img {
127
+ display: inline-block !important;
128
+ margin: 0 !important;
129
+ padding: 0 !important;
130
+ box-shadow: none !important;
131
+ }
132
+ }
133
+
134
+ p {
135
+ font: 300 14px / 20px Helvetica;
136
+ padding: 0 !important;
137
+ margin: 0 !important;
138
+
139
+ &.#{$pf}post-time {
140
+ font-style: italic;
141
+ color: #8e8c8d;
142
+ font-size: 12px;
143
+ }
144
+
145
+ //TODO add prefix to caption
146
+
147
+ &.caption-link {
148
+ text-align: right;
149
+ word-break: break-all;
150
+
151
+ a {
152
+ font-size: 12px;
153
+ color: #8e8c8d !important;
154
+ text-transform: uppercase;
155
+ }
156
+ }
157
+
158
+ &.caption-title {
159
+ text-align: left;
160
+
161
+ a {
162
+ font-size: 12px;
163
+ font-weight: bold;
164
+ }
165
+ }
166
+ }
167
+
168
+ .caption-description p {
169
+ color: #8e8c8d !important;
170
+ font-style: italic !important;
171
+ font-size: 12px !important;
172
+ }
173
+
174
+ iframe, embed, object, video, audio {
175
+ width: 100% !important;
176
+ border: 0 !important;
177
+ margin: 0 !important;
178
+ padding: 0 !important;
179
+ }
180
+
181
+ .#{$pf}post-link {
182
+ border: {
183
+ width: 1px;
184
+ style: solid;
185
+ color: #d0d0d0;
186
+ }
187
+ box-shadow: 1px 1px 2px #b3b3b3;
188
+ p {
189
+ padding: {
190
+ left: 10px !important;
191
+ right: 10px !important;
192
+ }
193
+ }
194
+ }
195
+
196
+ .#{$pf}text-center {
197
+ text-align: center;
198
+ }
199
+
200
+ .#{$pf}text-right {
201
+ text-align: right;
202
+ }
203
+
204
+ .#{$pf}pl-none {
205
+ padding-left: 0 !important;
206
+ word-break: break-all;
207
+ }
208
+
209
+ .#{$pf}title {
210
+ font-size: 20px !important;
211
+ font-weight: bold !important;
212
+ word-break: break-all;
213
+ display: inherit !important;
214
+ height: 100% !important;
215
+ background-color: transparent !important;
216
+ padding-top: 5px !important;
217
+ }
218
+
219
+ .#{$pf}pad-top {
220
+ padding: {
221
+ top: 5px;
222
+ }
223
+ }
224
+
225
+ .#{$pf}measure {
226
+ width: 100%;
227
+ }
228
+
229
+ .#{$pf}event_address {
230
+ color: #404040;
231
+ font-style: italic;
232
+ }
233
+
234
+ .#{$pf}relative-container {
235
+ position: relative;
236
+ display: block;
237
+ height: 0;
238
+ overflow: hidden;
239
+
240
+ .#{$pf}relative {
241
+ position: absolute;
242
+ top: 0;
243
+ left: 0;
244
+ bottom: 0;
245
+ height: 100%;
246
+ width: 100%;
247
+ border: 0;
248
+ margin: 0;
249
+ padding: 0;
250
+ }
251
+ }
252
+
253
+ .#{$pf}video {
254
+ padding: 0 0 56.25%;
255
+
256
+ iframe, embed, object, video {
257
+ @extend .#{$pf}relative;
258
+ }
259
+ }
260
+
261
+ .#{$pf}fbpost-image {
262
+ padding: 0 0 51%;
263
+
264
+ div {
265
+ cursor: pointer;
266
+ background: {
267
+ size: cover;
268
+ position: 50% 50%;
269
+ }
270
+ }
271
+ }
272
+
273
+ .#{$pf}cover {
274
+ padding: 0 0 36.86%;
275
+
276
+ div {
277
+ background-size: 100% !important;
278
+ background-position-x: 0;
279
+ cursor: pointer;
280
+ }
281
+ }
282
+
283
+ //TODO can be span or div
284
+ .#{$pf}album-thumb {
285
+ height: 65px !important;
286
+ margin: 1px;
287
+ padding: 2px;
288
+ width: 65px !important;
289
+ float: left;
290
+ background-size: cover;
291
+ }
292
+
293
+ .#{$pf}hovereffect {
294
+ width: 100%;
295
+ height: 100%;
296
+ float: left;
297
+ overflow: hidden;
298
+ position: relative;
299
+ text-align: center;
300
+ cursor: default;
301
+
302
+ .overlay {
303
+ width: 100%;
304
+ height: 100%;
305
+ position: absolute;
306
+ overflow: hidden;
307
+ top: 0;
308
+ left: 0;
309
+ -webkit-transition: all 0.4s ease-in-out;
310
+ transition: all 0.4s ease-in-out;
311
+ }
312
+
313
+ a.info {
314
+ display: inline-block;
315
+ text-decoration: none;
316
+
317
+ //padding: 7px 14px
318
+ text-transform: uppercase !important;
319
+ color: #fff !important;
320
+ border: 1px solid #fff !important;
321
+ margin: 50px 0 0 0;
322
+ background-color: transparent;
323
+ opacity: 0;
324
+ filter: alpha(opacity=0);
325
+ -webkit-transform: scale(1.5);
326
+ -ms-transform: scale(1.5);
327
+ transform: scale(1.5);
328
+ -webkit-transition: all 0.4s ease-in-out;
329
+ transition: all 0.4s ease-in-out;
330
+ font-weight: normal;
331
+ height: 85%;
332
+ width: 85%;
333
+ position: absolute;
334
+
335
+ //top: -20%
336
+ left: 8%;
337
+ padding: 70px;
338
+ }
339
+
340
+ &:hover {
341
+ .overlay {
342
+ background-color: rgba(170, 170, 170, 0.4) !important;
343
+ }
344
+
345
+ a.info {
346
+ opacity: 1;
347
+ filter: alpha(opacity=100);
348
+ -webkit-transform: scale(1);
349
+ -ms-transform: scale(1);
350
+ transform: scale(1);
351
+ background-color: rgba(0, 0, 0, 0.4);
352
+ top: 5%;
353
+ padding-top: 5% !important;
354
+ }
355
+ }
356
+ }
357
+ }
358
+
359
+ //Theme Styles
360
+ .#{$pf}default {
361
+ background-color: #FFFFFF;
362
+ border: {
363
+ width: 1px;
364
+ style: solid;
365
+ color: #DEDEDE;
366
+ radius: 2px;
367
+ }
368
+ }
369
+
370
+ .#{$pf}classic {
371
+ background-color: #FFFFFF;
372
+ margin: 10px auto;
373
+ border: {
374
+ width: 1px;
375
+ style: solid;
376
+ color: #23487F;
377
+ radius: 0;
378
+ }
379
+ box-shadow: 1px 1px 2px #23487F;
380
+ color: #0f0f0f;
381
+ }
382
+
383
+ .#{$pf}elegant {
384
+ margin: 10px auto;
385
+ border: {
386
+ width: 1px;
387
+ style: solid;
388
+ color: #f0f0f0;
389
+ radius: 0;
390
+ }
391
+ width: 100%;
392
+ background-color: #efefef;
393
+ }
templates/default/com-page.php DELETED
@@ -1,32 +0,0 @@
1
- <div class="wef-default" style="max-width: <?php echo $width ?>px">
2
- <div class="wef-row">
3
- <div class="wef-col-3 wef-text-center">
4
- <a href="https://www.facebook.com/<?php /** @noinspection PhpUndefinedVariableInspection */
5
- echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
6
- <img src="https://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
7
- </a>
8
- </div>
9
- <div class="wef-col-9 wef-pl-none">
10
- <a href="https://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
11
- <span class="wef-title"><?php echo $fb_data['name'] ?></span>
12
- </a>
13
- <br>
14
- <div>
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;
22
- ?>
23
- </div>
24
- <?php if(isset($fb_data["website"])) : ?>
25
- <br>
26
- <a href="<?php echo WP_Embed_FB::getwebsite($fb_data["website"]) ?>" title="<?php _e('Web Site', 'wp-embed-facebook') ?>" target="_blank">
27
- <?php _e('Web Site','wp-embed-facebook') ?>
28
- </a>
29
- <?php endif; ?>
30
- </div>
31
- </div>
32
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/default/default.css DELETED
@@ -1,2 +0,0 @@
1
- .wef-default{font:300 14px/20px Helvetica;padding:10px;display:table;border-width:1px;border-style:solid;border-color:#DEDEDE;border-radius:2px;width:100%;background-color:#fff}@media (min-width: 30em){.wef-default .row{width:100%;display:table-row;table-layout:fixed;float:left}.wef-default .wef-col-1,.wef-default .wef-col-2,.wef-default .wef-col-3,.wef-default .wef-col-4,.wef-default .wef-col-5,.wef-default .wef-col-6,.wef-default .wef-col-7,.wef-default .wef-col-8,.wef-default .wef-col-9,.wef-default .wef-col-10,.wef-default .wef-col-11,.wef-default .wef-col-12{display:table-cell;float:left}.wef-default .wef-col-12{width:100%}.wef-default .wef-col-11{width:91.66667%}.wef-default .wef-col-10{width:83.33333%}.wef-default .wef-col-9{width:75%}.wef-default .wef-col-8{width:66.66667%}.wef-default .wef-col-7{width:58.33333%}.wef-default .wef-col-6{width:50%}.wef-default .wef-col-5{width:41.66667%}.wef-default .wef-col-4{width:33.33333%}.wef-default .wef-col-3{width:25%}.wef-default .wef-col-2{width:16.66667%}.wef-default .wef-col-1{width:8.33333%}}.wef-default hr.wef-hr{margin-top:10px !important;margin-bottom:10px !important;margin-left:0 !important;margin-right:0 !important;float:left !important;border-top:1px;border-style:solid;border-color:#DEDEDE;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;height:0 !important;width:100% !important}.wef-default img.wef-icon{float:right;box-shadow:none;margin:0;padding:0;display:block}.wef-default img.wef-thumbnail{border:1px solid gray;border-radius:2px;height:60px !important;margin:2px 4px;padding:0;width:60px !important}.wef-default .wef-album-thumbs{display:inline-block}.wef-default a.wef-button{padding:5px 9px !important;text-align:center;text-decoration:none !important;display:inline-block;font-size:15px;-webkit-transition-duration:.1s;transition-duration:.1s;cursor:pointer;background-color:#fff;color:#000 !important;border:2px solid #23487F !important;border-radius:4px}.wef-default a.wef-button:hover,.wef-default a.wef-button:focus{background-color:#23487F !important;color:#fff !important;text-decoration:none !important}.wef-default a{font:300 14px/20px Helvetica;color:#23487F !important;text-decoration:none !important;border:0 !important;margin:0 !important;padding:0 !important;box-shadow:none !important}.wef-default a:focus,.wef-default a:hover{color:#23487F;text-decoration:underline !important}.wef-default a.wef-post-likes{color:#6d84b4 !important;font-size:12px !important}.wef-default a.road-trip{width:0 !important;height:0 !important}.wef-default a img{display:inline-block !important;margin:0 !important;padding:0 !important;box-shadow:none !important}.wef-default p{font:300 14px/20px Helvetica;padding:0 !important;margin:0 !important}.wef-default p.wef-post-time{font-style:italic;color:#8e8c8d;font-size:12px}.wef-default p.caption-link{text-align:right;word-break:break-all}.wef-default p.caption-link a{font-size:12px;color:#8e8c8d !important;text-transform:uppercase}.wef-default p.caption-title{text-align:left}.wef-default p.caption-title a{font-size:12px;font-weight:bold}.wef-default iframe,.wef-default embed,.wef-default object,.wef-default video,.wef-default audio{width:100% !important;border:0 !important;margin:0 !important;padding:0 !important}.wef-default .wef-post-link{border-width:1px;border-style:solid;border-color:#d0d0d0;box-shadow:1px 1px 2px #b3b3b3}.wef-default .wef-post-link p{padding-left:10px !important;padding-right:10px !important}.wef-default .wef-text-center{text-align:center}.wef-default .wef-pl-none{padding-left:0 !important;word-break:break-all}.wef-default .wef-title{font-size:20px !important;font-weight:bold !important;word-break:break-all;display:inherit !important;height:100% !important;background-color:transparent !important;padding-top:5px !important}.wef-default .wef-pad-top{padding-top:5px}.wef-default .caption-description p{color:#8e8c8d !important;font-style:italic !important;font-size:12px !important}.wef-default .wef-measure{width:100%}.wef-default .wef-event_address{color:#565656;font-size:12px}.wef-default .wef-relative-container{position:relative;display:block;height:0;overflow:hidden}.wef-default .wef-relative-container .wef-relative,.wef-default .wef-relative-container .wef-video iframe,.wef-default .wef-video .wef-relative-container iframe,.wef-default .wef-relative-container .wef-video embed,.wef-default .wef-video .wef-relative-container embed,.wef-default .wef-relative-container .wef-video object,.wef-default .wef-video .wef-relative-container object,.wef-default .wef-relative-container .wef-video video,.wef-default .wef-video .wef-relative-container video{position:absolute;top:0;left:0;bottom:0;height:100%;width:100%;border:0;margin:0;padding:0}.wef-default .wef-video{padding:0 0 56.25%}.wef-default .wef-fbpost-image{padding:0 0 75%}.wef-default .wef-fbpost-image div{cursor:pointer;background-size:cover;background-position:50% 50%}.wef-default .wef-cover{padding:0 0 36.86%}.wef-default .wef-cover div{background-size:100% !important;background-position-x:0;cursor:pointer}.wef-default span.wef-album-thumb{height:65px !important;margin:1px;padding:2px;width:65px !important;float:left;background-size:cover}.wef-default .wef-text-right{text-align:right}.wef-default .event_address{color:#404040;font-style:italic}
2
- /*# sourceMappingURL=default.css.map */
 
 
templates/default/default.css.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "mappings": "AAAA,YAAY,CACV,IAAI,CAAE,uBAAuB,CAC7B,OAAO,CAAE,IAAI,CACb,OAAO,CAAE,KAAK,CAEZ,YAAK,CAAE,GAAG,CACV,YAAK,CAAE,KAAK,CACZ,YAAK,CAAE,OAAO,CACd,aAAM,CAAE,GAAG,CACb,KAAK,CAAE,IAAI,CACX,gBAAgB,CAAE,IAAO,CACzB,wBAAwB,CACtB,iBAAI,CACF,KAAK,CAAE,IAAI,CACX,OAAO,CAAE,SAAS,CAClB,YAAY,CAAE,KAAK,CACnB,KAAK,CAAE,IAAI,CACb,kSAAiJ,CAC/I,OAAO,CAAE,UAAU,CACnB,KAAK,CAAE,IAAI,CACb,wBAAW,CACT,KAAK,CAAE,IAAI,CACb,wBAAW,CACT,KAAK,CAAE,SAAY,CACrB,wBAAW,CACT,KAAK,CAAE,SAAY,CACrB,uBAAU,CACR,KAAK,CAAE,GAAG,CACZ,uBAAU,CACR,KAAK,CAAE,SAAY,CACrB,uBAAU,CACR,KAAK,CAAE,SAAY,CACrB,uBAAU,CACR,KAAK,CAAE,GAAG,CACZ,uBAAU,CACR,KAAK,CAAE,SAAY,CACrB,uBAAU,CACR,KAAK,CAAE,SAAY,CACrB,uBAAU,CACR,KAAK,CAAE,GAAG,CACZ,uBAAU,CACR,KAAK,CAAE,SAAY,CACrB,uBAAU,CACR,KAAK,CAAE,QAAW,EACtB,sBAAS,CAEL,UAAG,CAAE,eAAe,CACpB,aAAM,CAAE,eAAe,CACvB,WAAI,CAAE,YAAY,CAClB,YAAK,CAAE,YAAY,CACrB,KAAK,CAAE,eAAe,CAEpB,UAAG,CAAE,GAAG,CACR,YAAK,CAAE,KAAK,CACZ,YAAK,CAAE,OAAO,CAChB,eAAe,CAAE,WAAW,CAC5B,kBAAkB,CAAE,WAAW,CAC/B,UAAU,CAAE,WAAW,CACvB,MAAM,CAAE,YAAY,CACpB,KAAK,CAAE,eAAe,CACxB,yBAAY,CACV,KAAK,CAAE,KAAK,CACZ,UAAU,CAAE,IAAI,CAChB,MAAM,CAAE,CAAC,CACT,OAAO,CAAE,CAAC,CACV,OAAO,CAAE,KAAK,CAChB,8BAAiB,CACf,MAAM,CAAE,cAAiB,CACzB,aAAa,CAAE,GAAG,CAClB,MAAM,CAAE,eAAe,CACvB,MAAM,CAAE,OAAO,CACf,OAAO,CAAE,CAAC,CACV,KAAK,CAAE,eAAe,CACxB,8BAAiB,CACf,OAAO,CAAE,YAAY,CACvB,yBAAY,CACV,OAAO,CAAE,kBAAkB,CAC3B,UAAU,CAAE,MAAM,CAClB,eAAe,CAAE,eAAe,CAChC,OAAO,CAAE,YAAY,CACrB,SAAS,CAAE,IAAI,CACf,2BAA2B,CAAE,GAAG,CAChC,mBAAmB,CAAE,GAAG,CACxB,MAAM,CAAE,OAAO,CACf,gBAAgB,CAAE,IAAI,CACtB,KAAK,CAAE,eAAe,CACtB,MAAM,CAAE,4BAA4B,CACpC,aAAa,CAAE,GAAG,CAClB,+DAAgB,CACd,gBAAgB,CAAE,kBAAkB,CACpC,KAAK,CAAE,eAAgB,CACvB,eAAe,CAAE,eAAe,CACpC,cAAC,CACC,IAAI,CAAE,uBAAuB,CAC7B,KAAK,CAAE,kBAAkB,CACzB,eAAe,CAAE,eAAe,CAChC,MAAM,CAAE,YAAY,CACpB,MAAM,CAAE,YAAY,CACpB,OAAO,CAAE,YAAY,CACrB,UAAU,CAAE,eAAe,CAC3B,yCAAgB,CACd,KAAK,CAAE,OAAO,CACd,eAAe,CAAE,oBAAoB,CACvC,6BAAgB,CACd,KAAK,CAAE,kBAAkB,CACzB,SAAS,CAAE,eAAe,CAC5B,wBAAW,CACT,KAAK,CAAE,YAAY,CACnB,MAAM,CAAE,YAAY,CACtB,kBAAG,CACD,OAAO,CAAE,uBAAuB,CAChC,MAAM,CAAE,YAAY,CACpB,OAAO,CAAE,YAAY,CACrB,UAAU,CAAE,eAAe,CAC/B,cAAC,CACC,IAAI,CAAE,uBAAuB,CAC7B,OAAO,CAAE,YAAY,CACrB,MAAM,CAAE,YAAY,CACpB,4BAAe,CACb,UAAU,CAAE,MAAM,CAClB,KAAK,CAAE,OAAO,CACd,SAAS,CAAE,IAAI,CACjB,2BAAc,CACZ,UAAU,CAAE,KAAK,CACjB,UAAU,CAAE,SAAS,CACrB,6BAAC,CACC,SAAS,CAAE,IAAI,CACf,KAAK,CAAE,kBAAkB,CACzB,cAAc,CAAE,SAAS,CAC7B,4BAAe,CACb,UAAU,CAAE,IAAI,CAChB,8BAAC,CACC,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CACvB,gGAAmC,CACjC,KAAK,CAAE,eAAe,CACtB,MAAM,CAAE,YAAY,CACpB,MAAM,CAAE,YAAY,CACpB,OAAO,CAAE,YAAY,CACvB,2BAAc,CAEV,YAAK,CAAE,GAAG,CACV,YAAK,CAAE,KAAK,CACZ,YAAK,CAAE,OAAO,CAChB,UAAU,CAAE,mBAAmB,CAC/B,6BAAC,CAEG,YAAI,CAAE,eAAe,CACrB,aAAK,CAAE,eAAe,CAC5B,6BAAgB,CACd,UAAU,CAAE,MAAM,CACpB,yBAAY,CACV,YAAY,CAAE,YAAY,CAC1B,UAAU,CAAE,SAAS,CACvB,uBAAU,CACR,SAAS,CAAE,eAAe,CAC1B,WAAW,CAAE,eAAe,CAC5B,UAAU,CAAE,SAAS,CACrB,OAAO,CAAE,kBAAkB,CAC3B,MAAM,CAAE,eAAe,CACvB,gBAAgB,CAAE,sBAAsB,CACxC,WAAW,CAAE,cAAc,CAC7B,yBAAY,CAER,WAAG,CAAE,GAAG,CACZ,mCAAsB,CACpB,KAAK,CAAE,kBAAkB,CACzB,UAAU,CAAE,iBAAiB,CAC7B,SAAS,CAAE,eAAe,CAC5B,yBAAY,CACV,KAAK,CAAE,IAAI,CACb,+BAAkB,CAChB,KAAK,CAAE,OAAO,CACd,SAAS,CAAE,IAAI,CACjB,oCAAuB,CACrB,QAAQ,CAAE,QAAQ,CAClB,OAAO,CAAE,KAAK,CACd,MAAM,CAAE,CAAC,CACT,QAAQ,CAAE,MAAM,CAChB,seAAa,CACX,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,MAAM,CAAE,CAAC,CACT,MAAM,CAAE,IAAI,CACZ,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,CAAC,CACT,MAAM,CAAE,CAAC,CACT,OAAO,CAAE,CAAC,CACd,uBAAU,CACR,OAAO,CAAE,UAAU,CAGrB,8BAAiB,CACf,OAAO,CAAE,OAAO,CAChB,kCAAG,CACD,MAAM,CAAE,OAAO,CAEb,eAAI,CAAE,KAAK,CACX,mBAAQ,CAAE,OAAO,CACvB,uBAAU,CACR,OAAO,CAAE,UAAU,CACnB,2BAAG,CACD,eAAe,CAAE,eAAe,CAChC,qBAAqB,CAAE,CAAC,CACxB,MAAM,CAAE,OAAO,CACnB,iCAAoB,CAClB,MAAM,CAAE,eAAe,CACvB,MAAM,CAAE,GAAG,CACX,OAAO,CAAE,GAAG,CACZ,KAAK,CAAE,eAAe,CACtB,KAAK,CAAE,IAAI,CACX,eAAe,CAAE,KAAK,CACxB,4BAAe,CACb,UAAU,CAAE,KAAK,CACnB,2BAAc,CACZ,KAAK,CAAE,OAAO,CACd,UAAU,CAAE,MAAM",
4
- "sources": ["default.sass"],
5
- "names": [],
6
- "file": "default.css"
7
- }
 
 
 
 
 
 
 
templates/default/default.sass DELETED
@@ -1,218 +0,0 @@
1
- .wef-default
2
- font: 300 14px/20px Helvetica
3
- padding: 10px
4
- display: table
5
- border:
6
- width: 1px
7
- style: solid
8
- color: #DEDEDE
9
- radius: 2px
10
- width: 100%
11
- background-color: #FFFFFF
12
- @media (min-width: 30em)
13
- .row
14
- width: 100%
15
- display: table-row
16
- table-layout: fixed
17
- float: left
18
- .wef-col-1, .wef-col-2, .wef-col-3, .wef-col-4, .wef-col-5, .wef-col-6, .wef-col-7, .wef-col-8, .wef-col-9, .wef-col-10, .wef-col-11, .wef-col-12
19
- display: table-cell
20
- float: left
21
- .wef-col-12
22
- width: 100%
23
- .wef-col-11
24
- width: 91.66666667%
25
- .wef-col-10
26
- width: 83.33333333%
27
- .wef-col-9
28
- width: 75%
29
- .wef-col-8
30
- width: 66.66666667%
31
- .wef-col-7
32
- width: 58.33333333%
33
- .wef-col-6
34
- width: 50%
35
- .wef-col-5
36
- width: 41.66666667%
37
- .wef-col-4
38
- width: 33.33333333%
39
- .wef-col-3
40
- width: 25%
41
- .wef-col-2
42
- width: 16.66666667%
43
- .wef-col-1
44
- width: 8.33333333%
45
- hr.wef-hr
46
- margin:
47
- top: 10px !important
48
- bottom: 10px !important
49
- left: 0 !important
50
- right: 0 !important
51
- float: left !important
52
- border:
53
- top: 1px
54
- style: solid
55
- color: #DEDEDE
56
- -moz-box-sizing: content-box
57
- -webkit-box-sizing: content-box
58
- box-sizing: content-box
59
- height: 0 !important
60
- width: 100% !important
61
- img.wef-icon
62
- float: right
63
- box-shadow: none
64
- margin: 0
65
- padding: 0
66
- display: block
67
- img.wef-thumbnail
68
- border: 1px solid #808080
69
- border-radius: 2px
70
- height: 60px !important
71
- margin: 2px 4px
72
- padding: 0
73
- width: 60px !important
74
- .wef-album-thumbs
75
- display: inline-block
76
- a.wef-button
77
- padding: 5px 9px !important
78
- text-align: center
79
- text-decoration: none !important
80
- display: inline-block
81
- font-size: 15px
82
- -webkit-transition-duration: .1s
83
- transition-duration: .1s
84
- cursor: pointer
85
- background-color: #fff
86
- color: #000 !important
87
- border: 2px solid #23487F !important
88
- border-radius: 4px
89
- &:hover, &:focus
90
- background-color: #23487F !important
91
- color: white !important
92
- text-decoration: none !important
93
- a
94
- font: 300 14px/20px Helvetica
95
- color: #23487F !important
96
- text-decoration: none !important
97
- border: 0 !important
98
- margin: 0 !important
99
- padding: 0 !important
100
- box-shadow: none !important
101
- &:focus, &:hover
102
- color: #23487F
103
- text-decoration: underline !important
104
- &.wef-post-likes
105
- color: #6d84b4 !important
106
- font-size: 12px !important
107
- &.road-trip
108
- width: 0 !important
109
- height: 0 !important
110
- img
111
- display: inline-block !important
112
- margin: 0 !important
113
- padding: 0 !important
114
- box-shadow: none !important
115
- p
116
- font: 300 14px/20px Helvetica
117
- padding: 0 !important
118
- margin: 0 !important
119
- &.wef-post-time
120
- font-style: italic
121
- color: #8e8c8d
122
- font-size: 12px
123
- &.caption-link
124
- text-align: right
125
- word-break: break-all
126
- a
127
- font-size: 12px
128
- color: #8e8c8d !important
129
- text-transform: uppercase
130
- &.caption-title
131
- text-align: left
132
- a
133
- font-size: 12px
134
- font-weight: bold
135
- iframe, embed, object, video, audio
136
- width: 100% !important
137
- border: 0 !important
138
- margin: 0 !important
139
- padding: 0 !important
140
- .wef-post-link
141
- border:
142
- width: 1px
143
- style: solid
144
- color: #d0d0d0
145
- box-shadow: 1px 1px 2px #b3b3b3
146
- p
147
- padding:
148
- left: 10px !important
149
- right: 10px !important
150
- .wef-text-center
151
- text-align: center
152
- .wef-pl-none
153
- padding-left: 0 !important
154
- word-break: break-all
155
- .wef-title
156
- font-size: 20px !important
157
- font-weight: bold !important
158
- word-break: break-all
159
- display: inherit !important
160
- height: 100% !important
161
- background-color: transparent !important
162
- padding-top: 5px !important
163
- .wef-pad-top
164
- padding:
165
- top: 5px
166
- .caption-description p
167
- color: #8e8c8d !important
168
- font-style: italic !important
169
- font-size: 12px !important
170
- .wef-measure
171
- width: 100%
172
- .wef-event_address
173
- color: #565656
174
- font-size: 12px
175
- .wef-relative-container
176
- position: relative
177
- display: block
178
- height: 0
179
- overflow: hidden
180
- .wef-relative
181
- position: absolute
182
- top: 0
183
- left: 0
184
- bottom: 0
185
- height: 100%
186
- width: 100%
187
- border: 0
188
- margin: 0
189
- padding: 0
190
- .wef-video
191
- padding: 0 0 56.25%
192
- iframe, embed, object, video
193
- @extend .wef-relative
194
- .wef-fbpost-image
195
- padding: 0 0 75%
196
- div
197
- cursor: pointer
198
- background:
199
- size: cover
200
- position: 50% 50%
201
- .wef-cover
202
- padding: 0 0 36.86%
203
- div
204
- background-size: 100% !important
205
- background-position-x: 0
206
- cursor: pointer
207
- span.wef-album-thumb
208
- height: 65px !important
209
- margin: 1px
210
- padding: 2px
211
- width: 65px !important
212
- float: left
213
- background-size: cover
214
- .wef-text-right
215
- text-align: right
216
- .event_address
217
- color: #404040
218
- font-style: italic
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/default/event.php DELETED
@@ -1,37 +0,0 @@
1
- <?php
2
- $start_time_format = WP_Embed_FB_Plugin::get_option('event_start_time_format');
3
- $old_time_zone = date_default_timezone_get();
4
- if(WP_Embed_FB_Plugin::get_option('ev_local_tz') == 'true'){
5
- $timezone = WP_Embed_FB_Plugin::get_timezone();
6
- } else {
7
- $timezone = isset( $fb_data['timezone'] ) ? $fb_data['timezone'] : WP_Embed_FB_Plugin::get_timezone();
8
- }
9
- date_default_timezone_set( $timezone );
10
- /** @noinspection PhpUndefinedVariableInspection */
11
- $start_time = date_i18n( $start_time_format, strtotime( $fb_data['start_time'] ) );
12
- date_default_timezone_set( $old_time_zone );
13
- ?>
14
- <div class="wef-default" style="max-width: <?php echo $width ?>px">
15
- <?php if(isset($fb_data['cover'])) : ?>
16
- <div class="wef-relative-container wef-cover"><div class="wef-relative" style="background-image: url('<?php echo $fb_data['cover']['source'] ?>'); background-position-y: <?php echo $fb_data['cover']['offset_y'] ?>%" onclick="window.open('https://www.facebook.com/<?php echo $fb_data['id'] ?>', '_blank')"></div></div>
17
- <?php endif; ?>
18
- <div class="wef-row wef-pad-top">
19
- <div class="wef-col-12">
20
- <a href="https://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
21
- <span class="wef-title"><?php echo $fb_data['name'] ?></span>
22
- </a>
23
- <p><?php echo $start_time ?></p>
24
- <p>
25
- <?php
26
- if ( isset( $fb_data['place']['id'] ) ) {
27
- _e( '@ ', 'wp-embed-facebook' );
28
- echo '<a href="https://www.facebook.com/' . $fb_data['place']['id'] . '" target="_blank">' . $fb_data['place']['name'] . '</a>';
29
- } else {
30
- echo isset( $fb_data['place']['name'] ) ? __( '@ ', 'wp-embed-facebook' ) . $fb_data['place']['name'] : '';
31
- }
32
- ?>
33
- </p>
34
- <p><?php echo __( 'Creator: ', 'wp-embed-facebook' ) . '<a href="https://www.facebook.com/' . $fb_data['owner']['id'] . '" target="_blank">' . $fb_data['owner']['name'] . '</a>' ?></p>
35
- </div>
36
- </div>
37
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/default/page.php DELETED
@@ -1,47 +0,0 @@
1
- <div class="wef-default" style="max-width: <?php echo $width ?>px" >
2
- <?php if(isset($fb_data['cover'])) : ?>
3
- <div class="wef-relative-container wef-cover"><div class="wef-relative" style="background-image: url('<?php echo $fb_data['cover']['source'] ?>'); background-position-y: <?php echo $fb_data['cover']['offset_y'] ?>%" onclick="window.open('https://www.facebook.com/<?php echo $fb_data['id'] ?>', '_blank')"></div></div>
4
- <?php endif; ?>
5
- <div class="wef-row wef-pad-top">
6
- <div class="wef-col-2 wef-text-center">
7
- <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
8
- <img src="<?php echo $fb_data['picture']['data']['url'] ?>" width="50px" height="50px" />
9
- </a>
10
- </div>
11
- <div class="wef-col-10 wef-pl-none">
12
- <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
13
- <span class="wef-title"><?php echo $fb_data['name'] ?></span>
14
- </a>
15
- <br>
16
- <?php
17
- if($fb_data['category'] == 'Musician/band'){
18
- echo isset($fb_data['genre']) ? $fb_data['genre'] : '';
19
- } else {
20
- _e($fb_data['category'],'wp-embed-facebook');
21
- }
22
- ?><br>
23
- <?php if(isset($fb_data["website"]) && (strip_tags($fb_data["website"]) != '')) : ?>
24
- <a href="<?php echo WP_Embed_FB::getwebsite($fb_data["website"]) ?>" title="<?php _e('Web Site', 'wp-embed-facebook') ?>" target="_blank">
25
- <?php _e('Web Site','wp-embed-facebook') ?>
26
- </a>
27
- <?php endif; ?>
28
- <div style="float: right;">
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['fan_count'] );
35
- endif;
36
- ?>
37
- </div>
38
- </div>
39
- </div>
40
- <?php if(isset($fb_data['posts'])) : global $wp_embed; ?>
41
- <?php foreach($fb_data['posts']['data'] as $fb_post) : ?>
42
- <?php if(isset($fb_post['picture']) || isset($fb_post['message'])) : ?>
43
- <?php include('single-post.php') ?>
44
- <?php endif; ?>
45
- <?php endforeach; ?>
46
- <?php endif; ?>
47
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/default/social-plugin.php DELETED
@@ -1,23 +0,0 @@
1
- <div class="wef-measure" style="max-width: <?php echo $width ?>px;"></div>
2
- <?php
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
- }
15
-
16
- break;
17
- //case 'photo' :
18
- //case 'post' :
19
- default:
20
- /** @noinspection PhpUndefinedVariableInspection */
21
- echo WEF_Social_Plugins::get('post',array('href'=>'https://www.facebook.com/' . $fb_data['link'],'width'=>$width));
22
- break;
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/default/video.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- $use_ratio = (WP_Embed_FB_Plugin::get_option('video_ratio') == 'true');
3
- ?>
4
- <div class="wef-default" style="max-width: <?php echo $width ?>px">
5
- <?php echo $use_ratio ? '<div class="wef-relative-container wef-video">' : '' ?>
6
- <?php
7
- /** @noinspection PhpUndefinedVariableInspection */
8
- $url = $fb_data['source'];
9
- $file_array = explode('/',parse_url($url, PHP_URL_PATH));
10
- $file = end($file_array);
11
- $type_array = explode('.',$file);
12
- $type = end($type_array);
13
- $clean_type = strtolower($type);
14
-
15
- if( WP_Embed_FB::is_raw('video') && $clean_type == 'mp4' ) : ?>
16
- <?php $end = isset($fb_data['format']) ? end($fb_data['format']) : $fb_data; ?>
17
-
18
- <video controls poster="<?php echo $end['picture'] ?>" >
19
- <source src="<?php echo $fb_data['source'] ?>" type="video/<?php echo $clean_type ?>">
20
- </video>
21
-
22
- <?php else : ?>
23
-
24
- <div class="fb-video" data-allowfullscreen="true"
25
- data-href="/<?php echo $fb_data['from']['id'] ?>/videos/<?php echo $fb_data['id'] ?>">
26
- </div>
27
-
28
- <?php endif; ?>
29
- <?php echo $use_ratio ? '</div>' : '' ?>
30
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/images/comments.png ADDED
Binary file
templates/images/like.png ADDED
Binary file
templates/images/share.png ADDED
Binary file
templates/lightbox/css/lightbox.css ADDED
@@ -0,0 +1 @@
 
1
+ body:after{content:url("../images/close.png") url("../images/loading.gif") url("../images/prev.png") url("../images/next.png");display:none}.lb-disable-scrolling{overflow:hidden !important}.lightboxOverlay{position:absolute;top:0;left:0;z-index:999999;background-color:#000;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80);opacity:.8;display:none}.lightbox{position:absolute;left:0;width:100%;z-index:1000000;text-align:center;line-height:0;font-weight:normal;padding:0;height:0}.lightbox .lb-image{display:block;height:auto;max-width:inherit;border-radius:0}.lightbox .lb-image a img{border:none}.lightbox .lb-outerContainer{position:relative;background-color:rgba(0,0,0,.5);*zoom:1;width:250px;height:250px;margin:0 auto;border-radius:0}.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 .6s;-moz-transition:opacity .6s;-o-transition:opacity .6s;transition:opacity .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 .6s;-moz-transition:opacity .6s;-o-transition:opacity .6s;transition:opacity .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%;border-radius:0}.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:.7;-webkit-transition:opacity .2s;-moz-transition:opacity .2s;-o-transition:opacity .2s;transition:opacity .2s}.lightbox .lb-data .lb-close:hover{cursor:pointer;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}/*# sourceMappingURL=lightbox.css.map */
templates/lightbox/css/lightbox.css.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sourceRoot":"","sources":["lightbox.sass"],"names":[],"mappings":"AACE,WACE,oHACA,aAEJ,sBACE,2BAEF,iBACE,kBACA,MACA,OACA,eACA,sBACA,2DACA,WACA,aAEF,UACE,kBACA,OACA,WACA,gBACA,kBACA,cACA,mBACA,UACA,SACA,oBACE,cACA,YACA,kBACA,gBACA,0BACE,YACJ,6BACE,kBACA,gCACA,QACA,YACA,aACA,cACA,gBACA,mCACE,WACA,cACA,WACJ,wBACE,YACA,+BACE,OACJ,qBACE,kBACA,QACA,OACA,WACA,WACA,kBACA,cACF,qBACE,cACA,WACA,YACA,cACA,kDACF,sCACE,YACA,eACA,cACF,kBACE,kBACA,MACA,OACA,YACA,WACA,WACA,oBACE,aACA,0GACF,4BACE,UACA,OACA,WACA,wDACA,0DACA,UACA,+BACA,4BACA,0BACA,uBACA,kCACE,4DACA,UACJ,4BACE,UACA,QACA,YACA,uDACA,0DACA,UACA,+BACA,4BACA,0BACA,uBACA,kCACE,4DACA,UACN,4BACE,cACA,gBACA,QACA,WACA,gBACA,kCACE,WACA,cACA,WACJ,mBACE,cACA,WACA,+BACE,UACA,WACA,gBACA,kBACF,+BACE,eACA,iBACA,gBACF,8BACE,cACA,WACA,mBACA,eACA,WACF,6BACE,cACA,YACA,WACA,YACA,wDACA,iBACA,aACA,2DACA,WACA,+BACA,4BACA,0BACA,uBACA,mCACE,eACA,4DACA","file":"lightbox.css"}
templates/lightbox/css/lightbox.sass ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body
2
+ &:after
3
+ content: url('../images/close.png') url('../images/loading.gif') url('../images/prev.png') url('../images/next.png')
4
+ display: none
5
+
6
+ .lb-disable-scrolling
7
+ overflow: hidden !important
8
+
9
+ .lightboxOverlay
10
+ position: absolute
11
+ top: 0
12
+ left: 0
13
+ z-index: 999999
14
+ background-color: #000000
15
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80)
16
+ opacity: 0.8
17
+ display: none
18
+
19
+ .lightbox
20
+ position: absolute
21
+ left: 0
22
+ width: 100%
23
+ z-index: 1000000
24
+ text-align: center
25
+ line-height: 0
26
+ font-weight: normal
27
+ padding: 0
28
+ height: 0
29
+ .lb-image
30
+ display: block
31
+ height: auto
32
+ max-width: inherit
33
+ border-radius: 0
34
+ a img
35
+ border: none
36
+ .lb-outerContainer
37
+ position: relative
38
+ background-color: rgba(0, 0, 0, 0.50)
39
+ *zoom: 1
40
+ width: 250px
41
+ height: 250px
42
+ margin: 0 auto
43
+ border-radius: 0
44
+ &:after
45
+ content: ""
46
+ display: table
47
+ clear: both
48
+ .lb-container
49
+ padding: 4px
50
+ > .nav
51
+ left: 0
52
+ .lb-loader
53
+ position: absolute
54
+ top: 43%
55
+ left: 0
56
+ height: 25%
57
+ width: 100%
58
+ text-align: center
59
+ line-height: 0
60
+ .lb-cancel
61
+ display: block
62
+ width: 32px
63
+ height: 32px
64
+ margin: 0 auto
65
+ background: url('../images/loading.gif') no-repeat
66
+ .lb-prev, .lb-next
67
+ height: 100%
68
+ cursor: pointer
69
+ display: block
70
+ .lb-nav
71
+ position: absolute
72
+ top: 0
73
+ left: 0
74
+ height: 100%
75
+ width: 100%
76
+ z-index: 10
77
+ a
78
+ outline: none
79
+ background-image: url('data:image/gifbase64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==')
80
+ a.lb-prev
81
+ width: 34%
82
+ left: 0
83
+ float: left
84
+ background: url('../images/prev.png') left 48% no-repeat
85
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0)
86
+ opacity: 0
87
+ -webkit-transition: opacity 0.6s
88
+ -moz-transition: opacity 0.6s
89
+ -o-transition: opacity 0.6s
90
+ transition: opacity 0.6s
91
+ &:hover
92
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100)
93
+ opacity: 1
94
+ a.lb-next
95
+ width: 64%
96
+ right: 0
97
+ float: right
98
+ background: url(../images/next.png) right 48% no-repeat
99
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0)
100
+ opacity: 0
101
+ -webkit-transition: opacity 0.6s
102
+ -moz-transition: opacity 0.6s
103
+ -o-transition: opacity 0.6s
104
+ transition: opacity 0.6s
105
+ &:hover
106
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100)
107
+ opacity: 1
108
+ .lb-dataContainer
109
+ margin: 0 auto
110
+ padding-top: 5px
111
+ *zoom: 1
112
+ width: 100%
113
+ border-radius: 0
114
+ &:after
115
+ content: ""
116
+ display: table
117
+ clear: both
118
+ .lb-data
119
+ padding: 0 4px
120
+ color: #ccc
121
+ .lb-details
122
+ width: 85%
123
+ float: left
124
+ text-align: left
125
+ line-height: 1.1em
126
+ .lb-caption
127
+ font-size: 13px
128
+ font-weight: bold
129
+ line-height: 1em
130
+ .lb-number
131
+ display: block
132
+ clear: left
133
+ padding-bottom: 1em
134
+ font-size: 12px
135
+ color: #999999
136
+ .lb-close
137
+ display: block
138
+ float: right
139
+ width: 30px
140
+ height: 30px
141
+ background: url(../images/close.png) top right no-repeat
142
+ text-align: right
143
+ outline: none
144
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70)
145
+ opacity: 0.7
146
+ -webkit-transition: opacity 0.2s
147
+ -moz-transition: opacity 0.2s
148
+ -o-transition: opacity 0.2s
149
+ transition: opacity 0.2s
150
+ &:hover
151
+ cursor: pointer
152
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100)
153
+ opacity: 1
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
templates/lightbox/images/close.png ADDED
Binary file
templates/lightbox/images/loading.gif ADDED
Binary file
templates/lightbox/images/next.png ADDED
Binary file
templates/lightbox/images/prev.png ADDED
Binary file
templates/lightbox/js/lightbox.js ADDED
@@ -0,0 +1,500 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ //console.log($window.scrollTop());
206
+
207
+ // Position Lightbox
208
+ var top = $window.scrollTop() + this.options.positionFromTop;
209
+ var left = $window.scrollLeft();
210
+ this.$lightbox.css({
211
+ top: top + 'px',
212
+ left: left + 'px'
213
+ }).fadeIn(this.options.fadeDuration);
214
+
215
+ // Disable scrolling of the page while open
216
+ if (this.options.disableScrolling) {
217
+ $('body').addClass('lb-disable-scrolling');
218
+ $('html').addClass('lb-disable-scrolling');
219
+ }
220
+
221
+ this.changeImage(imageNumber);
222
+ };
223
+
224
+ // Hide most UI elements in preparation for the animated resizing of the lightbox.
225
+ Lightbox.prototype.changeImage = function (imageNumber) {
226
+ var self = this;
227
+
228
+ this.disableKeyboardNav();
229
+ var $image = this.$lightbox.find('.lb-image');
230
+
231
+ this.$overlay.fadeIn(this.options.fadeDuration);
232
+
233
+ $('.lb-loader').fadeIn('slow');
234
+ this.$lightbox.find('.lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption').hide();
235
+
236
+ this.$outerContainer.addClass('animating');
237
+
238
+ // When image to show is preloaded, we send the width and height to sizeContainer()
239
+ var preloader = new Image();
240
+ preloader.onload = function () {
241
+ var $preloader;
242
+ var imageHeight;
243
+ var imageWidth;
244
+ var maxImageHeight;
245
+ var maxImageWidth;
246
+ var windowHeight;
247
+ var windowWidth;
248
+
249
+ $image.attr('src', self.album[imageNumber].link);
250
+
251
+ $preloader = $(preloader);
252
+
253
+ $image.width(preloader.width);
254
+ $image.height(preloader.height);
255
+
256
+ if (self.options.fitImagesInViewport) {
257
+ // Fit image inside the viewport.
258
+ // Take into account the border around the image and an additional 10px gutter on each side.
259
+
260
+ windowWidth = $(window).width();
261
+ windowHeight = $(window).height();
262
+ maxImageWidth = windowWidth - self.containerLeftPadding - self.containerRightPadding - 20;
263
+ maxImageHeight = windowHeight - self.containerTopPadding - self.containerBottomPadding - 120;
264
+
265
+ // Check if image size is larger then maxWidth|maxHeight in settings
266
+ if (self.options.maxWidth && self.options.maxWidth < maxImageWidth) {
267
+ maxImageWidth = self.options.maxWidth;
268
+ }
269
+ if (self.options.maxHeight && self.options.maxHeight < maxImageWidth) {
270
+ maxImageHeight = self.options.maxHeight;
271
+ }
272
+
273
+ // Is there a fitting issue?
274
+ if ((preloader.width > maxImageWidth) || (preloader.height > maxImageHeight)) {
275
+ if ((preloader.width / maxImageWidth) > (preloader.height / maxImageHeight)) {
276
+ imageWidth = maxImageWidth;
277
+ imageHeight = parseInt(preloader.height / (preloader.width / imageWidth), 10);
278
+ $image.width(imageWidth);
279
+ $image.height(imageHeight);
280
+ } else {
281
+ imageHeight = maxImageHeight;
282
+ imageWidth = parseInt(preloader.width / (preloader.height / imageHeight), 10);
283
+ $image.width(imageWidth);
284
+ $image.height(imageHeight);
285
+ }
286
+ }
287
+ }
288
+ self.sizeContainer($image.width(), $image.height());
289
+ };
290
+
291
+ preloader.src = this.album[imageNumber].link;
292
+ this.currentImageIndex = imageNumber;
293
+ };
294
+
295
+ // Stretch overlay to fit the viewport
296
+ Lightbox.prototype.sizeOverlay = function () {
297
+ this.$overlay
298
+ .width($(document).width())
299
+ .height($(document).height());
300
+ };
301
+
302
+ // Animate the size of the lightbox to fit the image we are showing
303
+ Lightbox.prototype.sizeContainer = function (imageWidth, imageHeight) {
304
+ var self = this;
305
+
306
+ var oldWidth = this.$outerContainer.outerWidth();
307
+ var oldHeight = this.$outerContainer.outerHeight();
308
+ var newWidth = imageWidth + this.containerLeftPadding + this.containerRightPadding;
309
+ var newHeight = imageHeight + this.containerTopPadding + this.containerBottomPadding;
310
+
311
+ function postResize() {
312
+ self.$lightbox.find('.lb-dataContainer').width(newWidth);
313
+ self.$lightbox.find('.lb-prevLink').height(newHeight);
314
+ self.$lightbox.find('.lb-nextLink').height(newHeight);
315
+ self.showImage();
316
+ }
317
+
318
+ if (oldWidth !== newWidth || oldHeight !== newHeight) {
319
+ this.$outerContainer.animate({
320
+ width: newWidth,
321
+ height: newHeight
322
+ }, this.options.resizeDuration, 'swing', function () {
323
+ postResize();
324
+ });
325
+ } else {
326
+ postResize();
327
+ }
328
+ };
329
+
330
+ // Display the image and its details and begin preload neighboring images.
331
+ Lightbox.prototype.showImage = function () {
332
+ this.$lightbox.find('.lb-loader').stop(true).hide();
333
+ this.$lightbox.find('.lb-image').fadeIn('slow');
334
+
335
+ this.updateNav();
336
+ this.updateDetails();
337
+ this.preloadNeighboringImages();
338
+ this.enableKeyboardNav();
339
+ };
340
+
341
+ // Display previous and next navigation if appropriate.
342
+ Lightbox.prototype.updateNav = function () {
343
+ // Check to see if the browser supports touch events. If so, we take the conservative approach
344
+ // and assume that mouse hover events are not supported and always show prev/next navigation
345
+ // arrows in image sets.
346
+ var alwaysShowNav = false;
347
+ try {
348
+ document.createEvent('TouchEvent');
349
+ alwaysShowNav = (this.options.alwaysShowNavOnTouchDevices) ? true : false;
350
+ } catch (e) {
351
+ }
352
+
353
+ this.$lightbox.find('.lb-nav').show();
354
+
355
+ if (this.album.length > 1) {
356
+ if (this.options.wrapAround) {
357
+ if (alwaysShowNav) {
358
+ this.$lightbox.find('.lb-prev, .lb-next').css('opacity', '1');
359
+ }
360
+ this.$lightbox.find('.lb-prev, .lb-next').show();
361
+ } else {
362
+ if (this.currentImageIndex > 0) {
363
+ this.$lightbox.find('.lb-prev').show();
364
+ if (alwaysShowNav) {
365
+ this.$lightbox.find('.lb-prev').css('opacity', '1');
366
+ }
367
+ }
368
+ if (this.currentImageIndex < this.album.length - 1) {
369
+ this.$lightbox.find('.lb-next').show();
370
+ if (alwaysShowNav) {
371
+ this.$lightbox.find('.lb-next').css('opacity', '1');
372
+ }
373
+ }
374
+ }
375
+ }
376
+ };
377
+
378
+ // Display caption, image number, and closing button.
379
+ Lightbox.prototype.updateDetails = function () {
380
+ var self = this;
381
+
382
+ // Enable anchor clicks in the injected caption html.
383
+ // Thanks Nate Wright for the fix. @https://github.com/NateWr
384
+ if (typeof this.album[this.currentImageIndex].title !== 'undefined' &&
385
+ this.album[this.currentImageIndex].title !== '') {
386
+ this.$lightbox.find('.lb-caption')
387
+ .html(this.album[this.currentImageIndex].title)
388
+ .fadeIn('fast')
389
+ .find('a').on('click', function (event) {
390
+ if ($(this).attr('target') !== undefined) {
391
+ window.open($(this).attr('href'), $(this).attr('target'));
392
+ } else {
393
+ location.href = $(this).attr('href');
394
+ }
395
+ });
396
+ }
397
+
398
+ if (this.album.length > 1 && this.options.showImageNumberLabel) {
399
+ var labelText = this.imageCountLabel(this.currentImageIndex + 1, this.album.length);
400
+ this.$lightbox.find('.lb-number').text(labelText).fadeIn('fast');
401
+ } else {
402
+ this.$lightbox.find('.lb-number').hide();
403
+ }
404
+
405
+ this.$outerContainer.removeClass('animating');
406
+
407
+ this.$lightbox.find('.lb-dataContainer').fadeIn(this.options.resizeDuration, function () {
408
+ return self.sizeOverlay();
409
+ });
410
+ };
411
+
412
+ // Preload previous and next images in set.
413
+ Lightbox.prototype.preloadNeighboringImages = function () {
414
+ if (this.album.length > this.currentImageIndex + 1) {
415
+ var preloadNext = new Image();
416
+ preloadNext.src = this.album[this.currentImageIndex + 1].link;
417
+ }
418
+ if (this.currentImageIndex > 0) {
419
+ var preloadPrev = new Image();
420
+ preloadPrev.src = this.album[this.currentImageIndex - 1].link;
421
+ }
422
+ };
423
+
424
+ Lightbox.prototype.enableKeyboardNav = function () {
425
+ $(document).on('keyup.keyboard', $.proxy(this.keyboardAction, this));
426
+ };
427
+
428
+ Lightbox.prototype.disableKeyboardNav = function () {
429
+ $(document).off('.keyboard');
430
+ };
431
+
432
+ Lightbox.prototype.keyboardAction = function (event) {
433
+ var KEYCODE_ESC = 27;
434
+ var KEYCODE_LEFTARROW = 37;
435
+ var KEYCODE_RIGHTARROW = 39;
436
+
437
+ var keycode = event.keyCode;
438
+ var key = String.fromCharCode(keycode).toLowerCase();
439
+ if (keycode === KEYCODE_ESC || key.match(/x|o|c/)) {
440
+ this.end();
441
+ } else if (key === 'p' || keycode === KEYCODE_LEFTARROW) {
442
+ if (this.currentImageIndex !== 0) {
443
+ this.changeImage(this.currentImageIndex - 1);
444
+ } else if (this.options.wrapAround && this.album.length > 1) {
445
+ this.changeImage(this.album.length - 1);
446
+ }
447
+ } else if (key === 'n' || keycode === KEYCODE_RIGHTARROW) {
448
+ if (this.currentImageIndex !== this.album.length - 1) {
449
+ this.changeImage(this.currentImageIndex + 1);
450
+ } else if (this.options.wrapAround && this.album.length > 1) {
451
+ this.changeImage(0);
452
+ }
453
+ }
454
+ };
455
+ // Closing time. :-(
456
+ Lightbox.prototype.end = function () {
457
+ this.disableKeyboardNav();
458
+ $(window).off('resize', this.sizeOverlay);
459
+ this.$lightbox.fadeOut(this.options.fadeDuration);
460
+ this.$overlay.fadeOut(this.options.fadeDuration);
461
+ $('select, object, embed').css({
462
+ visibility: 'visible'
463
+ });
464
+ if (this.options.disableScrolling) {
465
+ $('body').removeClass('lb-disable-scrolling');
466
+ $('html').removeClass('lb-disable-scrolling');
467
+ }
468
+ };
469
+ if (typeof WEF_LB === "undefined") {
470
+ new Lightbox();
471
+ }
472
+ else {
473
+ for (var key in WEF_LB) {
474
+ if (WEF_LB.hasOwnProperty(key)) {
475
+ if (WEF_LB[key] === 'false') {
476
+ WEF_LB[key] = false;
477
+ }
478
+ else if (WEF_LB[key] === 'true') {
479
+ WEF_LB[key] = true;
480
+ }
481
+ else if (key !== 'albumLabel') {
482
+ WEF_LB[key] = parseInt(WEF_LB[key]);
483
+ }
484
+ }
485
+ }
486
+ if (WEF_LB.hasOwnProperty('wpGallery') && WEF_LB['wpGallery']) {
487
+ $('.gallery-icon a').each(function () {
488
+ var href = $(this).attr('href');
489
+ var p = new RegExp('.*?(\\.jpg|\\.png|\\.gif|\\.svg)', 'i');
490
+ var m = p.exec(href);
491
+ if (m !== null) {
492
+ $(this).attr('data-lightbox', 'roadtrip');
493
+ }
494
+
495
+ });
496
+ }
497
+
498
+ new Lightbox(WEF_LB);
499
+ }
500
+ });
templates/lightbox/js/lightbox.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(function(g){function t(t){this.album=[],this.currentImageIndex=void 0,this.init(),this.options=g.extend({},this.constructor.defaults),this.option(t)}if(t.defaults={albumLabel:"Image %1 of %2",alwaysShowNavOnTouchDevices:!1,fadeDuration:500,fitImagesInViewport:!0,positionFromTop:50,resizeDuration:700,showImageNumberLabel:!0,wrapAround:!1,disableScrolling:!1},t.prototype.option=function(t){g.extend(this.options,t)},t.prototype.imageCountLabel=function(t,i){return this.options.albumLabel.replace(/%1/g,t).replace(/%2/g,i)},t.prototype.init=function(){this.enable(),this.build()},t.prototype.enable=function(){var i=this;g("body").on("click","a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]",function(t){return i.start(g(t.currentTarget)),!1})},t.prototype.build=function(){var i=this;g('<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(g("body")),this.$lightbox=g("#lightbox"),this.$overlay=g("#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 i.end(),!1}),this.$lightbox.hide().on("click",function(t){return"lightbox"===g(t.target).attr("id")&&i.end(),!1}),this.$outerContainer.on("click",function(t){return"lightbox"===g(t.target).attr("id")&&i.end(),!1}),this.$lightbox.find(".lb-prev").on("click",function(){return 0===i.currentImageIndex?i.changeImage(i.album.length-1):i.changeImage(i.currentImageIndex-1),!1}),this.$lightbox.find(".lb-next").on("click",function(){return i.currentImageIndex===i.album.length-1?i.changeImage(0):i.changeImage(i.currentImageIndex+1),!1}),this.$lightbox.find(".lb-loader, .lb-close").on("click",function(){return i.end(),!1})},t.prototype.start=function(t){var i=this,e=g(window);e.on("resize",g.proxy(this.sizeOverlay,this)),g("select, object, embed").css({visibility:"hidden"}),this.sizeOverlay(),this.album=[];var n=0;function a(t){i.album.push({link:t.attr("href"),title:t.attr("data-title")||t.attr("title")})}var o,s=t.attr("data-lightbox");if(s){o=g(t.prop("tagName")+'[data-lightbox="'+s+'"]');for(var r=0;r<o.length;r=++r)a(g(o[r])),o[r]===t[0]&&(n=r)}else if("lightbox"===t.attr("rel"))a(t);else{o=g(t.prop("tagName")+'[rel="'+t.attr("rel")+'"]');for(var h=0;h<o.length;h=++h)a(g(o[h])),o[h]===t[0]&&(n=h)}var l=e.scrollTop()+this.options.positionFromTop,d=e.scrollLeft();this.$lightbox.css({top:l+"px",left:d+"px"}).fadeIn(this.options.fadeDuration),this.options.disableScrolling&&(g("body").addClass("lb-disable-scrolling"),g("html").addClass("lb-disable-scrolling")),this.changeImage(n)},t.prototype.changeImage=function(s){var r=this;this.disableKeyboardNav();var h=this.$lightbox.find(".lb-image");this.$overlay.fadeIn(this.options.fadeDuration),g(".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 l=new Image;l.onload=function(){var t,i,e,n,a,o;h.attr("src",r.album[s].link),g(l),h.width(l.width),h.height(l.height),r.options.fitImagesInViewport&&(o=g(window).width(),a=g(window).height(),n=o-r.containerLeftPadding-r.containerRightPadding-20,e=a-r.containerTopPadding-r.containerBottomPadding-120,r.options.maxWidth&&r.options.maxWidth<n&&(n=r.options.maxWidth),r.options.maxHeight&&r.options.maxHeight<n&&(e=r.options.maxHeight),(l.width>n||l.height>e)&&(l.width/n>l.height/e?(i=n,t=parseInt(l.height/(l.width/i),10)):(t=e,i=parseInt(l.width/(l.height/t),10)),h.width(i),h.height(t))),r.sizeContainer(h.width(),h.height())},l.src=this.album[s].link,this.currentImageIndex=s},t.prototype.sizeOverlay=function(){this.$overlay.width(g(document).width()).height(g(document).height())},t.prototype.sizeContainer=function(t,i){var e=this,n=this.$outerContainer.outerWidth(),a=this.$outerContainer.outerHeight(),o=t+this.containerLeftPadding+this.containerRightPadding,s=i+this.containerTopPadding+this.containerBottomPadding;function r(){e.$lightbox.find(".lb-dataContainer").width(o),e.$lightbox.find(".lb-prevLink").height(s),e.$lightbox.find(".lb-nextLink").height(s),e.showImage()}n!==o||a!==s?this.$outerContainer.animate({width:o,height:s},this.options.resizeDuration,"swing",function(){r()}):r()},t.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()},t.prototype.updateNav=function(){var t=!1;try{document.createEvent("TouchEvent"),t=!!this.options.alwaysShowNavOnTouchDevices}catch(t){}this.$lightbox.find(".lb-nav").show(),1<this.album.length&&(this.options.wrapAround?(t&&this.$lightbox.find(".lb-prev, .lb-next").css("opacity","1"),this.$lightbox.find(".lb-prev, .lb-next").show()):(0<this.currentImageIndex&&(this.$lightbox.find(".lb-prev").show(),t&&this.$lightbox.find(".lb-prev").css("opacity","1")),this.currentImageIndex<this.album.length-1&&(this.$lightbox.find(".lb-next").show(),t&&this.$lightbox.find(".lb-next").css("opacity","1"))))},t.prototype.updateDetails=function(){var t=this;if(void 0!==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(t){void 0!==g(this).attr("target")?window.open(g(this).attr("href"),g(this).attr("target")):location.href=g(this).attr("href")}),1<this.album.length&&this.options.showImageNumberLabel){var i=this.imageCountLabel(this.currentImageIndex+1,this.album.length);this.$lightbox.find(".lb-number").text(i).fadeIn("fast")}else this.$lightbox.find(".lb-number").hide();this.$outerContainer.removeClass("animating"),this.$lightbox.find(".lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return t.sizeOverlay()})},t.prototype.preloadNeighboringImages=function(){this.album.length>this.currentImageIndex+1&&((new Image).src=this.album[this.currentImageIndex+1].link);0<this.currentImageIndex&&((new Image).src=this.album[this.currentImageIndex-1].link)},t.prototype.enableKeyboardNav=function(){g(document).on("keyup.keyboard",g.proxy(this.keyboardAction,this))},t.prototype.disableKeyboardNav=function(){g(document).off(".keyboard")},t.prototype.keyboardAction=function(t){var i=t.keyCode,e=String.fromCharCode(i).toLowerCase();27===i||e.match(/x|o|c/)?this.end():"p"===e||37===i?0!==this.currentImageIndex?this.changeImage(this.currentImageIndex-1):this.options.wrapAround&&1<this.album.length&&this.changeImage(this.album.length-1):"n"!==e&&39!==i||(this.currentImageIndex!==this.album.length-1?this.changeImage(this.currentImageIndex+1):this.options.wrapAround&&1<this.album.length&&this.changeImage(0))},t.prototype.end=function(){this.disableKeyboardNav(),g(window).off("resize",this.sizeOverlay),this.$lightbox.fadeOut(this.options.fadeDuration),this.$overlay.fadeOut(this.options.fadeDuration),g("select, object, embed").css({visibility:"visible"}),this.options.disableScrolling&&(g("body").removeClass("lb-disable-scrolling"),g("html").removeClass("lb-disable-scrolling"))},"undefined"==typeof WEF_LB)new t;else{for(var i in WEF_LB)WEF_LB.hasOwnProperty(i)&&("false"===WEF_LB[i]?WEF_LB[i]=!1:"true"===WEF_LB[i]?WEF_LB[i]=!0:"albumLabel"!==i&&(WEF_LB[i]=parseInt(WEF_LB[i])));WEF_LB.hasOwnProperty("wpGallery")&&WEF_LB.wpGallery&&g(".gallery-icon a").each(function(){var t=g(this).attr("href");null!==new RegExp(".*?(\\.jpg|\\.png|\\.gif|\\.svg)","i").exec(t)&&g(this).attr("data-lightbox","roadtrip")}),new t(WEF_LB)}});
wp-embed-facebook.php CHANGED
@@ -1,81 +1,59 @@
1
  <?php
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: 3.0.0
8
  Author URI: http://www.wpembedfb.com
9
  Text Domain: wp-embed-facebook
10
- Domain Path: /lang
11
  */
12
 
13
  namespace SIGAMI\WP_Embed_FB;
14
 
 
 
 
 
 
15
  spl_autoload_register( __NAMESPACE__ . '\auto_loader' );
16
 
 
 
 
 
 
 
17
  function auto_loader( $class_name ) {
18
  if ( false !== strpos( $class_name, __NAMESPACE__ ) ) {
19
- $classes_dir = realpath( plugin_dir_path( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'inc'
20
- . DIRECTORY_SEPARATOR;
21
- /** @noinspection PhpIncludeInspection */
22
- require_once $classes_dir . str_replace( [ __NAMESPACE__, '\\' ], '', $class_name )
23
- . '.php';
24
  }
25
  }
26
 
27
- final class Plugin extends Plugin_Framework {
28
-
29
- const FILE = __FILE__;
30
-
31
- const OPTION = 'wp-embed-fb';
32
 
33
- # Sections of the admin page
34
- protected static $tabs = [ 'General' ];
35
-
36
- static function load_translation() {
37
- load_plugin_textdomain( 'wp-embed-fb', false,
38
- dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
39
- }
40
-
41
- static function defaults() {
42
- if ( self::$defaults === null ) {
43
- self::$defaults = [
44
- 'option' => 'on',
45
- ];
46
- }
47
-
48
- return self::$defaults;
49
- }
50
 
51
- static function form_content() {
52
- ob_start();
53
- ?>
54
- <section id="general" class="section">
55
- <?php
56
- self::section( __( 'Options', 'wp-embed-fb' ) );
57
- self::field( 'checkbox', 'option', __( 'Option', 'wp-embed-fb' ),
58
- __( 'Description', 'wp-embed-fb' ) );
59
- self::section();
60
- ?>
61
- </section>
62
- <?php
63
-
64
- return ob_get_clean();
65
- }
66
-
67
- protected function __construct() {
68
-
69
- self::$page_title = __( 'Page Title', 'wp-embed-fb' );
70
- self::$menu_title = __( 'Menu Title', 'wp-embed-fb' );
71
- self::$menu_slug = 'wp-embed-fb';
72
-
73
- parent::__construct();
74
-
75
- $options = self::get_option();
76
-
77
- }
78
 
 
 
79
  }
80
 
81
- Plugin::instance();
 
 
 
1
  <?php
2
+ /**
3
+ @author Miguel Sirvent and Rahul Aryan
4
+ @license GPL-3.0+ https://www.gnu.org/licenses/gpl-3.0.txt
5
+ @link https://www.wpembedfb.com
6
+ @package WP Embed FB
7
+
8
+ @wordpress-plugin
9
  Plugin Name: WP Embed Facebook
10
  Plugin URI: http://www.wpembedfb.com
11
+ Description: Embed any public Facebook video, photo, album, event, page,
12
+ comment, profile, or post. Add Facebook comments to all your site, insert
13
+ Facebook social plugins (like, save, send, share, follow, quote, comments)
14
+ anywhere on your site. View the <a href="https://wpembedfb.com/features" title="plugin website" target="_blank">features</a>.
15
  Author: Miguel Sirvent
16
  Version: 3.0.0
17
  Author URI: http://www.wpembedfb.com
18
  Text Domain: wp-embed-facebook
19
+ GitHub Plugin URI: sigami/wp-embed-facebook
20
  */
21
 
22
  namespace SIGAMI\WP_Embed_FB;
23
 
24
+ // If this file is called directly, abort.
25
+ if ( ! defined( 'WPINC' ) ) {
26
+ die;
27
+ }
28
+
29
  spl_autoload_register( __NAMESPACE__ . '\auto_loader' );
30
 
31
+ /**
32
+ * Plugin class autoloader.
33
+ *
34
+ * @param string $class_name Class name to load.
35
+ * @return void
36
+ */
37
  function auto_loader( $class_name ) {
38
  if ( false !== strpos( $class_name, __NAMESPACE__ ) ) {
39
+ $dir = realpath( plugin_dir_path( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR;
40
+ require_once $dir . str_replace( [ __NAMESPACE__, '\\' ], '', $class_name ) . '.php';
 
 
 
41
  }
42
  }
43
 
44
+ Plugin::instance( __FILE__ );
 
 
 
 
45
 
46
+ Magic_Embeds::instance();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
+ if ( Plugin::is_on( 'auto_comments_active' ) ) {
49
+ Comments::instance();
50
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
+ if ( is_admin() ) {
53
+ Admin::instance();
54
  }
55
 
56
+ //COMPATIBILITY
57
+ include Plugin::path().'inc/deprecated/deprecated.php';
58
+
59
+ //TODO change lightbox css to make it more hermetic