WP Embed Facebook - Version 2.0

Version Description

  • Fixed language issue when embedding social plugins in admin
  • Fixed time on events
  • Update Facebook API to 2.4
  • Added a new parameters for shortcode 'social_plugin' and 'theme'
  • Fixed shortcode use [facebook=FB_Object_ID ]
  • Improved CSS and themes
  • New Embed Post Raw
Download this release

Release Info

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

Code changes from version 1.9.6.7 to 2.0

Files changed (44) hide show
  1. lang/wp-embed-facebook.pot +122 -69
  2. lib/admin.php +0 -282
  3. lib/{fb/base_facebook.php → base_facebook.php} +0 -0
  4. lib/{fb/facebook.php → class-sigami-facebook.php} +0 -27
  5. lib/class-wef-social-plugins.php +121 -0
  6. lib/class-wp-embed-fb-admin.php +328 -0
  7. lib/class-wp-embed-fb-plugin.php +162 -0
  8. lib/class-wp-embed-fb.php +431 -0
  9. lib/core.php +0 -504
  10. lib/img/hechoenmexico.png +0 -0
  11. lib/img/paypal.png +0 -0
  12. lib/img/taco.png +0 -0
  13. lib/js/admin.js +1 -1
  14. lib/js/wpembedfb.js +8 -5
  15. readme.txt +93 -28
  16. templates/classic/album.php +31 -32
  17. templates/classic/classic.css +1 -0
  18. templates/classic/classic.sass +177 -0
  19. templates/classic/com-page.php +25 -19
  20. templates/classic/event.php +31 -36
  21. templates/classic/page.php +44 -50
  22. templates/classic/photo.php +9 -11
  23. templates/classic/post.php +31 -0
  24. templates/classic/posts.php +0 -2
  25. templates/classic/profile.php +23 -22
  26. templates/classic/single-post.php +107 -0
  27. templates/classic/social-plugin.php +18 -0
  28. templates/classic/video.php +5 -8
  29. templates/classic/wpemfb.css +0 -113
  30. templates/default/album.php +18 -22
  31. templates/default/com-page.php +29 -27
  32. templates/default/default.css +1 -0
  33. templates/default/default.sass +180 -0
  34. templates/default/event.php +31 -36
  35. templates/default/page.php +23 -56
  36. templates/default/photo.php +9 -10
  37. templates/default/post.php +31 -0
  38. templates/default/posts.php +0 -3
  39. templates/default/profile.php +15 -17
  40. templates/default/single-post.php +107 -0
  41. templates/default/social-plugin.php +18 -0
  42. templates/default/video.php +4 -8
  43. templates/default/wpemfb.css +0 -168
  44. wp-embed-facebook.php +24 -28
lang/wp-embed-facebook.pot CHANGED
@@ -3,14 +3,14 @@ msgid ""
3
  msgstr ""
4
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
  "Project-Id-Version: WP Embed Facebook\n"
6
- "POT-Creation-Date: 2015-08-04 20:33-0500\n"
7
  "PO-Revision-Date: 2015-08-04 20:31-0500\n"
8
  "Last-Translator: Miguel Sirvent <miguel.sirvent@gmail.com>\n"
9
  "Language-Team: Miguel Sirvent <miguel.sirvent@gmail.com>\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
- "X-Generator: Poedit 1.8.4\n"
14
  "X-Poedit-Basepath: ..\n"
15
  "X-Poedit-WPHeader: wp-embed-facebook.php\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
@@ -20,167 +20,220 @@ msgstr ""
20
  "X-Poedit-SearchPath-0: .\n"
21
  "X-Poedit-SearchPathExcluded-0: *.js\n"
22
 
23
- #: lib/admin.php:187
24
  msgid "Facebook application data"
25
  msgstr ""
26
 
27
- #: lib/admin.php:188
28
  msgid "App ID"
29
  msgstr ""
30
 
31
- #: lib/admin.php:189
32
  msgid "App Secret"
33
  msgstr ""
34
 
35
- #: lib/admin.php:192
36
- msgid "General Options"
37
  msgstr ""
38
 
39
- #: lib/admin.php:194
40
  msgid "Template to use"
41
  msgstr ""
42
 
43
- #: lib/admin.php:210
44
  msgid "Embed Max-Width"
45
  msgstr ""
46
 
47
- #: lib/admin.php:211
 
 
 
 
48
  msgid "Number of Photos <br>on Embedded Albums"
49
  msgstr ""
50
 
51
- #: lib/admin.php:212
52
- msgid "Show follow button <br>on Embedded Profiles"
 
 
 
 
53
  msgstr ""
54
 
55
- #: lib/admin.php:214
56
- msgid "Embedded Fan Pages"
57
  msgstr ""
58
 
59
- #: lib/admin.php:215
 
 
 
 
60
  msgid "Show like button"
61
  msgstr ""
62
 
63
- #: lib/admin.php:216
64
  msgid "Show latest posts"
65
  msgstr ""
66
 
67
- #: lib/admin.php:217
68
  msgid "Number of posts"
69
  msgstr ""
70
 
71
- #: lib/admin.php:218
72
- msgid "Show events on local time"
73
  msgstr ""
74
 
75
- #: lib/admin.php:220
76
- msgid "Raw Embedded Options"
77
  msgstr ""
78
 
79
- #: lib/admin.php:221
80
- msgid "Embed Videos Raw"
81
  msgstr ""
82
 
83
- #: lib/admin.php:222
84
- msgid "Embed Photos Raw"
85
  msgstr ""
86
 
87
- #: lib/admin.php:223
88
- msgid "Use Facebook embed code on raw videos"
 
 
 
 
89
  msgstr ""
90
 
91
- #: lib/admin.php:230
92
- msgid "Advanced Options"
93
  msgstr ""
94
 
95
- #: lib/admin.php:231
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  msgid "Enqueue Styles"
97
  msgstr ""
98
 
99
- #: lib/admin.php:232
100
  msgid "Add fb-root on top of content"
101
  msgstr ""
102
 
103
- #: lib/admin.php:233
104
  msgid "Enqueue Lightbox script"
105
  msgstr ""
106
 
107
- #: lib/admin.php:234
108
  msgid "Enqueue WPEmbedFB script"
109
  msgstr ""
110
 
111
- #: lib/admin.php:235
112
  msgid "Enqueue Facebook SDK"
113
  msgstr ""
114
 
115
- #: lib/admin.php:240
116
- msgid "Save"
117
  msgstr ""
118
 
119
- #: lib/admin.php:245
120
- msgid "Premium Version Available"
121
  msgstr ""
122
 
123
- #: lib/admin.php:247
124
- msgid "Only $6.99 USD"
125
  msgstr ""
126
 
127
- #: lib/admin.php:250
128
- msgid "Check it out"
129
  msgstr ""
130
 
131
- #: lib/admin.php:254
132
- msgid "Events with cover"
133
  msgstr ""
134
 
135
- #: lib/admin.php:257
136
- msgid "Fan Page Full Embed"
137
  msgstr ""
138
 
139
- #: lib/admin.php:260
140
  msgid "One Year Premium Support"
141
  msgstr ""
142
 
143
- #: lib/admin.php:265
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  msgid "More information"
145
  msgstr ""
146
 
147
- #: lib/admin.php:268
148
- msgid "Plugin Web Site"
149
  msgstr ""
150
 
151
- #: lib/core.php:218
 
 
 
 
 
152
  msgid "Add Facebook App ID and Secret on admin to make this plugin work."
153
  msgstr ""
154
 
155
- #: lib/core.php:219
156
  msgid "WP Embed Facebook Settings"
157
  msgstr ""
158
 
159
- #: lib/core.php:220
160
  msgid "Your Facebook Apps"
161
  msgstr ""
162
 
163
- #: lib/core.php:292
164
- msgid "Error"
165
- msgstr ""
166
-
167
- #: lib/core.php:434
168
  #, php-format
169
  msgid "%d people like this."
170
  msgstr ""
171
 
172
- #: templates/classic/event.php:33 templates/default/event.php:30
173
- #: templates/default/event.php:33
174
- msgid "@ "
 
 
175
  msgstr ""
176
 
177
- #: templates/classic/event.php:37 templates/default/event.php:37
178
- msgid "Creator: "
 
179
  msgstr ""
180
 
181
- #: templates/default/com-page.php:23 templates/default/com-page.php:24
182
- #: templates/default/page.php:37 templates/default/page.php:38
183
- msgid "Web Site"
184
  msgstr ""
185
 
186
  #. Plugin Name of the plugin/theme
@@ -193,9 +246,9 @@ msgstr ""
193
 
194
  #. Description of the plugin/theme
195
  msgid ""
196
- "Embed a Facebook video, photo, album, event, page, profile, or post. Copy "
197
- "any facebook url to a single line on your post, or use shortcode "
198
- "[facebook='url' width='' ] more info at <a href=\"http://www.wpembedfb.com\" "
199
  "title=\"plugin website\">www.wpembedfb.com</a>"
200
  msgstr ""
201
 
3
  msgstr ""
4
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
  "Project-Id-Version: WP Embed Facebook\n"
6
+ "POT-Creation-Date: 2015-10-10 14:43-0500\n"
7
  "PO-Revision-Date: 2015-08-04 20:31-0500\n"
8
  "Last-Translator: Miguel Sirvent <miguel.sirvent@gmail.com>\n"
9
  "Language-Team: Miguel Sirvent <miguel.sirvent@gmail.com>\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Generator: Poedit 1.8.5\n"
14
  "X-Poedit-Basepath: ..\n"
15
  "X-Poedit-WPHeader: wp-embed-facebook.php\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
20
  "X-Poedit-SearchPath-0: .\n"
21
  "X-Poedit-SearchPathExcluded-0: *.js\n"
22
 
23
+ #: lib/class-wp-embed-fb-admin.php:217
24
  msgid "Facebook application data"
25
  msgstr ""
26
 
27
+ #: lib/class-wp-embed-fb-admin.php:218
28
  msgid "App ID"
29
  msgstr ""
30
 
31
+ #: lib/class-wp-embed-fb-admin.php:219
32
  msgid "App Secret"
33
  msgstr ""
34
 
35
+ #: lib/class-wp-embed-fb-admin.php:222
36
+ msgid "General "
37
  msgstr ""
38
 
39
+ #: lib/class-wp-embed-fb-admin.php:224
40
  msgid "Template to use"
41
  msgstr ""
42
 
43
+ #: lib/class-wp-embed-fb-admin.php:240
44
  msgid "Embed Max-Width"
45
  msgstr ""
46
 
47
+ #: lib/class-wp-embed-fb-admin.php:243
48
+ msgid "Album "
49
+ msgstr ""
50
+
51
+ #: lib/class-wp-embed-fb-admin.php:244
52
  msgid "Number of Photos <br>on Embedded Albums"
53
  msgstr ""
54
 
55
+ #: lib/class-wp-embed-fb-admin.php:247
56
+ msgid "Event "
57
+ msgstr ""
58
+
59
+ #: lib/class-wp-embed-fb-admin.php:248
60
+ msgid "Show events on local time"
61
  msgstr ""
62
 
63
+ #: lib/class-wp-embed-fb-admin.php:251
64
+ msgid "Pages "
65
  msgstr ""
66
 
67
+ #: lib/class-wp-embed-fb-admin.php:252
68
+ msgid "Embed Pages as Social Plugins"
69
+ msgstr ""
70
+
71
+ #: lib/class-wp-embed-fb-admin.php:253
72
  msgid "Show like button"
73
  msgstr ""
74
 
75
+ #: lib/class-wp-embed-fb-admin.php:254
76
  msgid "Show latest posts"
77
  msgstr ""
78
 
79
+ #: lib/class-wp-embed-fb-admin.php:255
80
  msgid "Number of posts"
81
  msgstr ""
82
 
83
+ #: lib/class-wp-embed-fb-admin.php:258
84
+ msgid "Photo "
85
  msgstr ""
86
 
87
+ #: lib/class-wp-embed-fb-admin.php:259
88
+ msgid "Embed Photos as Social Plugins"
89
  msgstr ""
90
 
91
+ #: lib/class-wp-embed-fb-admin.php:262
92
+ msgid "Post "
93
  msgstr ""
94
 
95
+ #: lib/class-wp-embed-fb-admin.php:263
96
+ msgid "Embed Posts as Social Plugins"
97
  msgstr ""
98
 
99
+ #: lib/class-wp-embed-fb-admin.php:266
100
+ msgid "Profile "
101
+ msgstr ""
102
+
103
+ #: lib/class-wp-embed-fb-admin.php:267
104
+ msgid "Show follow button <br>on Embedded Profiles"
105
  msgstr ""
106
 
107
+ #: lib/class-wp-embed-fb-admin.php:270
108
+ msgid "Video "
109
  msgstr ""
110
 
111
+ #: lib/class-wp-embed-fb-admin.php:271
112
+ msgid "Embed Videos as Social Plugins"
113
+ msgstr ""
114
+
115
+ #: lib/class-wp-embed-fb-admin.php:272
116
+ msgid "Use Posts social plugin"
117
+ msgstr ""
118
+
119
+ #: lib/class-wp-embed-fb-admin.php:273
120
+ msgid "Force 16:9 ratio"
121
+ msgstr ""
122
+
123
+ #: lib/class-wp-embed-fb-admin.php:282
124
+ msgid "Advanced "
125
+ msgstr ""
126
+
127
+ #: lib/class-wp-embed-fb-admin.php:283
128
  msgid "Enqueue Styles"
129
  msgstr ""
130
 
131
+ #: lib/class-wp-embed-fb-admin.php:284
132
  msgid "Add fb-root on top of content"
133
  msgstr ""
134
 
135
+ #: lib/class-wp-embed-fb-admin.php:285
136
  msgid "Enqueue Lightbox script"
137
  msgstr ""
138
 
139
+ #: lib/class-wp-embed-fb-admin.php:286
140
  msgid "Enqueue WPEmbedFB script"
141
  msgstr ""
142
 
143
+ #: lib/class-wp-embed-fb-admin.php:287
144
  msgid "Enqueue Facebook SDK"
145
  msgstr ""
146
 
147
+ #: lib/class-wp-embed-fb-admin.php:291
148
+ msgid "All options can be overwritten using the [facebook=url ]"
149
  msgstr ""
150
 
151
+ #: lib/class-wp-embed-fb-admin.php:293
152
+ msgid "Save"
153
  msgstr ""
154
 
155
+ #: lib/class-wp-embed-fb-admin.php:300
156
+ msgid "Keep this plugin's core free and accessible to all."
157
  msgstr ""
158
 
159
+ #: lib/class-wp-embed-fb-admin.php:305
160
+ msgid "Premium Extension Available"
161
  msgstr ""
162
 
163
+ #: lib/class-wp-embed-fb-admin.php:308
164
+ msgid "Embed a Facebook Page with all its details."
165
  msgstr ""
166
 
167
+ #: lib/class-wp-embed-fb-admin.php:309
168
+ msgid "Embed an Event with all its details."
169
  msgstr ""
170
 
171
+ #: lib/class-wp-embed-fb-admin.php:310
172
  msgid "One Year Premium Support"
173
  msgstr ""
174
 
175
+ #: lib/class-wp-embed-fb-admin.php:312
176
+ msgid "Plus new features cooking"
177
+ msgstr ""
178
+
179
+ #: lib/class-wp-embed-fb-admin.php:315
180
+ msgid "Upcoming events widget, events with maps..."
181
+ msgstr ""
182
+
183
+ #: lib/class-wp-embed-fb-admin.php:319
184
+ msgid "Only $6.99 USD"
185
+ msgstr ""
186
+
187
+ #: lib/class-wp-embed-fb-admin.php:322
188
+ msgid "Check it out"
189
+ msgstr ""
190
+
191
+ #: lib/class-wp-embed-fb-admin.php:326
192
  msgid "More information"
193
  msgstr ""
194
 
195
+ #: lib/class-wp-embed-fb.php:108 lib/class-wp-embed-fb.php:144
196
+ msgid "Code"
197
  msgstr ""
198
 
199
+ #: lib/class-wp-embed-fb.php:109 lib/class-wp-embed-fb.php:145
200
+ #: lib/class-wp-embed-fb.php:329
201
+ msgid "Error"
202
+ msgstr ""
203
+
204
+ #: lib/class-wp-embed-fb.php:155
205
  msgid "Add Facebook App ID and Secret on admin to make this plugin work."
206
  msgstr ""
207
 
208
+ #: lib/class-wp-embed-fb.php:156
209
  msgid "WP Embed Facebook Settings"
210
  msgstr ""
211
 
212
+ #: lib/class-wp-embed-fb.php:157
213
  msgid "Your Facebook Apps"
214
  msgstr ""
215
 
216
+ #: templates/classic/com-page.php:26 templates/classic/page.php:45
217
+ #: templates/classic/post.php:20 templates/default/com-page.php:26
218
+ #: templates/default/page.php:45 templates/default/post.php:20
 
 
219
  #, php-format
220
  msgid "%d people like this."
221
  msgstr ""
222
 
223
+ #: templates/classic/com-page.php:32 templates/classic/com-page.php:33
224
+ #: templates/classic/page.php:35 templates/classic/page.php:36
225
+ #: templates/default/com-page.php:32 templates/default/com-page.php:33
226
+ #: templates/default/page.php:35 templates/default/page.php:36
227
+ msgid "Web Site"
228
  msgstr ""
229
 
230
+ #: templates/classic/event.php:28 templates/classic/event.php:31
231
+ #: templates/default/event.php:28 templates/default/event.php:31
232
+ msgid "@ "
233
  msgstr ""
234
 
235
+ #: templates/classic/event.php:36 templates/default/event.php:36
236
+ msgid "Creator: "
 
237
  msgstr ""
238
 
239
  #. Plugin Name of the plugin/theme
246
 
247
  #. Description of the plugin/theme
248
  msgid ""
249
+ "Embed any public Facebook video, photo, album, event, page, profile, or "
250
+ "post. Copy the facebook url to a single line on your post, or use shortcode "
251
+ "[facebook=url ] more information at <a href=\"http://www.wpembedfb.com\" "
252
  "title=\"plugin website\">www.wpembedfb.com</a>"
253
  msgstr ""
254
 
lib/admin.php DELETED
@@ -1,282 +0,0 @@
1
- <?php
2
-
3
- //TODO add option
4
- class EmbFbAdmin
5
- {
6
- static function admin_enqueue_scripts($hook_suffix)
7
- {
8
- if ($hook_suffix == 'settings_page_embedfacebook') {
9
- global $wp_scripts;
10
- wp_enqueue_script('wpemfb-admin', WPEMFBURL . 'lib/js/admin.js', array('jquery-ui-accordion'));
11
- $queryui = $wp_scripts->query('jquery-ui-core');
12
- $url = "https://ajax.googleapis.com/ajax/libs/jqueryui/" . $queryui->ver . "/themes/smoothness/jquery-ui.css";
13
- wp_enqueue_style('jquery-ui-start', $url, false, null);
14
- }
15
- $translation_array = array('local' => get_locale(), 'fb_id' => get_option('wpemfb_app_id'), 'fb_root' => get_option('wpemfb_fb_root'));
16
- wp_localize_script('wpemfb', 'WEF', $translation_array);
17
- wp_enqueue_script('wpemfb');
18
- }
19
-
20
- static function admin_init()
21
- {
22
- $theme = get_option('wpemfb_theme');
23
- add_editor_style(WPEMFBURL . 'templates/' . $theme . '/wpemfb.css');
24
- }
25
-
26
- static function add_page()
27
- {
28
- add_options_page('EmbedFacebook', 'Embed Facebook', 'manage_options', 'embedfacebook', array('EmbFbAdmin', 'embedfb_page'));
29
- }
30
-
31
- /**
32
- * @param $option string option name
33
- * @param $type string direct or true/false
34
- */
35
- static function save_option($option, $type)
36
- {
37
- if ($type == 'direct') {
38
- if (isset($_POST[$option])) {
39
- update_option($option, $_POST[$option]);
40
- }
41
- } else {
42
- if (isset($_POST[$option])) {
43
- update_option($option, 'true');
44
- } else {
45
- update_option($option, 'false');
46
- }
47
- }
48
- }
49
-
50
- static function savedata()
51
- {
52
- if (isset($_POST['wpemfb_app_secret'], $_POST['wpemfb_app_id'])) {
53
-
54
- $options = array(
55
- 'wpemfb_app_id' => 'direct',
56
- 'wpemfb_app_secret' => 'direct',
57
- 'wpemfb_max_width' => 'direct',
58
- 'wpemfb_max_photos' => 'direct',
59
- 'wpemfb_max_posts' => 'direct',
60
- 'wpemfb_theme' => 'direct',
61
- 'wpemfb_show_like' => 'true/false',
62
- 'wpemfb_enqueue_style' => 'true/false',
63
- 'wpemfb_fb_root' => 'true/false',
64
- 'wpemfb_show_follow' => 'true/false',
65
- 'wpemfb_raw_video' => 'true/false',
66
- 'wpemfb_raw_photo' => 'true/false',
67
- 'wpemfb_show_posts' => 'true/false',
68
- 'wpemfb_raw_post' => 'true/false',
69
- 'wpemfb_enq_lightbox' => 'true/false',
70
- 'wpemfb_enq_wpemfb' => 'true/false',
71
- 'wpemfb_enq_fbjs' => 'true/false',
72
- 'wpemfb_ev_local_tz' => 'true/false',
73
- 'wpemfb_raw_video_fb' => 'true/false',
74
- );
75
- foreach ($options as $option => $type) {
76
- self::save_option($option, $type);
77
- }
78
- if (isset($_POST['wpemfb_max_width']) && is_int($_POST['wpemfb_max_width'])) {
79
- $prop = get_option('wpemfb_proportions') * $_POST['wpemfb_max_width'];
80
- update_option('wpemfb_height', $prop);
81
- }
82
- }
83
- /**
84
- * Save extra options, requires coordination with 'wpemfb_options' action
85
- *
86
- * @since 1.8
87
- *
88
- */
89
- do_action('wpemfb_admin_save_data');
90
- }
91
-
92
- static function field($type, $name, $label, $args = array())
93
- {
94
- switch ($type) {
95
- case 'checkbox':
96
- ob_start();
97
- ?>
98
- <tr valign="middle">
99
- <th><?php echo $label ?></th>
100
- <td>
101
- <input type="checkbox"
102
- name="<?php echo $name ?>" <?php echo (get_option($name) === 'true') ? 'checked' : '' ?> />
103
- </td>
104
- </tr>
105
- <?php
106
- ob_end_flush();
107
- break;
108
- default:
109
- ob_start();
110
- ?>
111
- <tr valign="middle">
112
- <th><?php echo $label ?></th>
113
- <td>
114
- <input type="<?php echo $type ?>"
115
- name="<?php echo $name ?>" <?php echo isset($args['required']) ? 'required' : '' ?>
116
- value="<?php echo get_option($name) ?>" size="38"/>
117
- </td>
118
- </tr>
119
- <?php
120
- ob_end_flush();
121
- break;
122
- }
123
- }
124
- static function section($title=''){
125
- if(!empty($title)) :
126
- ?>
127
- <h5><?php echo $title ?></h5>
128
- <div>
129
- <table>
130
- <tbody>
131
- <?php
132
- else :
133
- ?>
134
- </tbody>
135
- </table>
136
- </div>
137
- <?php
138
- endif;
139
- }
140
- static function embedfb_page()
141
- {
142
- if (isset($_POST['save-data']) && wp_verify_nonce($_POST['save-data'], 'wp-embed-facebook')) {
143
- self::savedata();
144
-
145
- }
146
- $sel1 = (get_option('wpemfb_theme') === 'default') ? 'selected' : '';
147
- $sel2 = (get_option('wpemfb_theme') === 'classic') ? 'selected' : '';
148
-
149
- ?>
150
- <style>
151
- .ui-widget-content th {
152
- font-weight: normal;
153
- padding-right: 10px;
154
- }
155
-
156
- .settings-col {
157
- width: 50% !important;
158
- padding-right: 2% !important;
159
- text-align: left !important;
160
- }
161
-
162
- .welcome-panel-last {
163
- width: 47% !important;
164
- text-align: center;
165
- }
166
-
167
- @media (max-width: 870px) {
168
- .settings-col {
169
- width: 100% !important;
170
- }
171
-
172
- .welcome-panel-last {
173
- width: 100% !important;
174
- }
175
- }
176
- </style>
177
- <div class="wrap">
178
- <h2>WP Embed Facebook</h2>
179
- <div class="welcome-panel">
180
- <div class="welcome-panel-content">
181
- <div class="welcome-panel-column-container">
182
- <div class="welcome-panel-column settings-col">
183
- <form id="config-form" action="#" method="post">
184
- <?php wp_nonce_field('wp-embed-facebook', 'save-data'); ?>
185
- <div id="accordion">
186
- <?php
187
- self::section(__('Facebook application data', 'wp-embed-facebook'));
188
- self::field('text', 'wpemfb_app_id', __('App ID', 'wp-embed-facebook'), array('required' => 'true'));
189
- self::field('text', 'wpemfb_app_secret', __('App Secret', 'wp-embed-facebook'), array('required' => 'true'));
190
- self::section();
191
- ?>
192
- <?php self::section(__("General Options", 'wp-embed-facebook')); ?>
193
- <tr valign="middle">
194
- <th><?php _e("Template to use", 'wp-embed-facebook') ?></th>
195
- <td>
196
- <select name="wpemfb_theme">
197
- <option value="default" <?php echo $sel1 ?> >Default</option>
198
- <option value="classic" <?php echo $sel2 ?> >Classic</option>
199
- <?php
200
- /**
201
- * Add a new theme option
202
- * @since 1.8
203
- */
204
- do_action('wpemfb_admin_theme');
205
- ?>
206
- </select>
207
- </td>
208
- </tr>
209
- <?php
210
- self::field('number', 'wpemfb_max_width', __('Embed Max-Width', 'wp-embed-facebook'));
211
- self::field('number', 'wpemfb_max_photos', __('Number of Photos <br>on Embedded Albums', 'wp-embed-facebook'));
212
- self::field('checkbox', 'wpemfb_show_follow', __('Show follow button <br>on Embedded Profiles', 'wp-embed-facebook'));
213
- self::section();
214
- self::section(__('Embedded Fan Pages', 'wp-embed-facebook'));
215
- self::field('checkbox', 'wpemfb_show_like', __('Show like button', 'wp-embed-facebook'));
216
- self::field('checkbox', 'wpemfb_show_posts', __('Show latest posts', 'wp-embed-facebook'));
217
- self::field('number', 'wpemfb_max_posts', __('Number of posts', 'wp-embed-facebook'));
218
- self::field('checkbox', 'wpemfb_ev_local_tz', __('Show events on local time', 'wp-embed-facebook'));
219
- self::section();
220
- self::section(__('Raw Embedded Options', 'wp-embed-facebook'));
221
- self::field('checkbox', 'wpemfb_raw_video', __('Embed Videos Raw', 'wp-embed-facebook'));
222
- self::field('checkbox', 'wpemfb_raw_photo', __('Embed Photos Raw', 'wp-embed-facebook'));
223
- self::field('checkbox', 'wpemfb_raw_video_fb', __('Use Facebook embed code on raw videos', 'wp-embed-facebook'));
224
- self::section();
225
- /**
226
- * Add more options to the plugin page save them with 'wpemfb_admin_save_data' action
227
- * @since 1.8
228
- */
229
- do_action('wpemfb_options');
230
- self::section(__('Advanced Options', 'wp-embed-facebook'));
231
- self::field('checkbox', 'wpemfb_enqueue_style', __('Enqueue Styles', 'wp-embed-facebook'));
232
- self::field('checkbox', 'wpemfb_fb_root', __('Add fb-root on top of content', 'wp-embed-facebook'));
233
- self::field('checkbox', 'wpemfb_enq_lightbox', __('Enqueue Lightbox script', 'wp-embed-facebook'));
234
- self::field('checkbox', 'wpemfb_enq_wpemfb', __('Enqueue WPEmbedFB script', 'wp-embed-facebook'));
235
- self::field('checkbox', 'wpemfb_enq_fbjs', __('Enqueue Facebook SDK', 'wp-embed-facebook'));
236
- self::section();
237
- ?>
238
- </div>
239
- <input type="submit" name="submit" class="button button-primary button-hero"
240
- value="<?php _e('Save', 'wp-embed-facebook') ?>"/>
241
- </form>
242
- </div>
243
- <div class="welcome-panel-column welcome-panel-last">
244
- <?php ob_start(); ?>
245
- <h3><?php _e('Premium Version Available', 'wp-embed-facebook') ?></h3>
246
-
247
- <h2><?php _e('Only $6.99 USD', 'wp-embed-facebook') ?></h2>
248
- <br>
249
- <a class="button button-primary"
250
- href="http://www.wpembedfb.com/premium"><?php _e('Check it out', 'wp-embed-facebook') ?></a>
251
- <br>
252
- <ul>
253
- <li>
254
- <?php _e('Events with cover', 'wp-embed-facebook') ?>
255
- </li>
256
- <li>
257
- <?php _e('Fan Page Full Embed', 'wp-embed-facebook') ?>
258
- </li>
259
- <li>
260
- <?php _e('One Year Premium Support', 'wp-embed-facebook') ?>
261
- </li>
262
- </ul>
263
- <hr>
264
- <p>
265
- <small><?php _e('More information', 'wp-embed-facebook') ?></small>
266
- <br>
267
- <a href="http://www.wpembedfb.com"
268
- style="color:#23487F;"><?php _e('Plugin Web Site', 'wp-embed-facebook') ?></a>
269
- </p>
270
- <hr>
271
- <p>
272
- <img src="<?php echo plugins_url('/img/hechoenmexico.png', __FILE__) ?>" width="60px"/>
273
- </p>
274
- <?php echo apply_filters('wpemfb_admin', ob_get_clean()); ?>
275
- </div>
276
- </div>
277
- </div>
278
- </div>
279
- </div>
280
- <?php
281
- }
282
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/{fb/base_facebook.php → base_facebook.php} RENAMED
File without changes
lib/{fb/facebook.php → class-sigami-facebook.php} RENAMED
@@ -1,22 +1,4 @@
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
- if(!class_exists('FacebookApiException'))
18
- require_once "base_facebook.php";
19
-
20
  /**
21
  * Extends the BaseFacebook class with the intent of using
22
  * PHP sessions to store user ids and access tokens.
@@ -45,15 +27,6 @@ class Sigami_Facebook extends BaseFacebook
45
  * @see BaseFacebook::__construct in facebook.php
46
  */
47
  public function __construct($config) {
48
- if (version_compare(phpversion(), '5.4.0', '<')) {
49
- if(session_id() == '') {
50
- session_start();
51
- }
52
- } else {
53
- if (session_status() == PHP_SESSION_NONE) {
54
- session_start();
55
- }
56
- }
57
  parent::__construct($config);
58
  if (!empty($config['sharedSession'])) {
59
  $this->initSharedSession();
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /**
3
  * Extends the BaseFacebook class with the intent of using
4
  * PHP sessions to store user ids and access tokens.
27
  * @see BaseFacebook::__construct in facebook.php
28
  */
29
  public function __construct($config) {
 
 
 
 
 
 
 
 
 
30
  parent::__construct($config);
31
  if (!empty($config['sharedSession'])) {
32
  $this->initSharedSession();
lib/class-wef-social-plugins.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class WEF_Social_Plugins
4
+ *
5
+ * Group of static functions to render facebook social plugins.
6
+ *
7
+ */
8
+ class WEF_Social_Plugins {
9
+ /**
10
+ * @param string $href
11
+ *
12
+ * @return string
13
+ */
14
+ static function send_btn( $href ) {
15
+ return '<div class="fb-send" data-href="' . $href . '"></div>';
16
+ }
17
+
18
+ /**
19
+ * @param string $href
20
+ * @param $options array colorscheme | share | layout | show_faces
21
+ *
22
+ * @return string
23
+ */
24
+ static function like_btn( $href, $options = array() ) {
25
+ $defaults = array(
26
+ 'colorscheme' => 'light',//dark
27
+ 'share' => 'false',
28
+ 'layout' => 'standard',//"standard", "button_count", "button" or "box_count".
29
+ 'show_faces' => 'false',
30
+ );
31
+ $options = wp_parse_args( $options, $defaults );
32
+
33
+ return '<div class="fb-like" data-href="' . $href . '" data-colorscheme="' . $options['colorscheme'] . '" data-layout="' . $options['layout'] . '" data-action="like" data-show-faces="' . $options['show_faces'] . '" data-share="' . $options['share'] . '" ></div>';
34
+ }
35
+
36
+ /**
37
+ * @param $href
38
+ * @param array $options
39
+ *
40
+ * @return string
41
+ */
42
+ static function follow_btn( $href, $options = array() ) {
43
+ $defaults = array(
44
+ 'colorscheme' => 'light',//dark
45
+ 'layout' => 'standard',//"standard", "button_count" or "box_count"
46
+ 'show_faces' => 'false',
47
+ );
48
+ $options = wp_parse_args( $options, $defaults );
49
+
50
+ return '<div class="fb-follow" data-href="' . $href . '" data-colorscheme="' . $options['colorscheme'] . '" data-layout="' . $options['layout'] . '" data-show-faces="' . $options['show_faces'] . '" ></div>';
51
+ }
52
+
53
+ /**
54
+ * @param string $href
55
+ * @param string $layout Can be one of "box_count", "button_count", "button", "link", "icon_link", or "icon".
56
+ *
57
+ * @return string
58
+ */
59
+ static function share_btn( $href, $layout = 'icon_link' ) {
60
+ return '<div class="fb-share-button" data-href="' . $href . '" data-layout="' . $layout . '"></div>';
61
+ }
62
+
63
+ /**
64
+ * @param string $href
65
+ * @param int $width
66
+ * @param array $options hide_cover,show_facepile,show_posts,small_header,height
67
+ *
68
+ * @return string
69
+ */
70
+ static function page_plugin( $href, $width, $options = array() ) {
71
+ $defaults = array(
72
+ 'hide_cover' => 'false',
73
+ 'show_facepile' => 'true',
74
+ 'show_posts' => 'false',
75
+ 'small_header' => 'false',
76
+ 'height' => '500'
77
+ );
78
+ $options = wp_parse_args( $options, $defaults );
79
+
80
+ return '<div class="fb-page" data-href="' . $href . '" data-width="' . $width . '" data-hide-cover="' . $options["hide_cover"] . '" data-show-facepile="' . $options["show_facepile"] . '" data-show-posts="' . $options["show_posts"] . '" date-small-header="' . $options["small_header"] . '" data-height="' . $options["height"] . '"></div>';
81
+ }
82
+
83
+ /**
84
+ * @param string $href
85
+ * @param int $width
86
+ *
87
+ * @return string
88
+ */
89
+ static function embedded_post( $href, $width ) {
90
+ return '<div class="fb-post" data-href="' . $href . '" data-width="' . $width . '"></div>';
91
+ }
92
+
93
+ /**
94
+ * @param string $href
95
+ * @param int $width
96
+ *
97
+ * @return string
98
+ */
99
+ static function embedded_video( $href, $width ) {
100
+ return '<div class="fb-video" data-href="' . $href . '" data-width="' . $width . '"></div>';
101
+ }
102
+
103
+ /**
104
+ * @param string $href
105
+ * @param int $width
106
+ * @param array $options colorscheme,num_posts,order_by
107
+ *
108
+ * @return string
109
+ */
110
+ static function comments( $href, $width, $options = array() ) {
111
+ $defaults = array(
112
+ 'colorscheme' => 'light',//dark
113
+ 'num_posts' => '10',
114
+ 'order_by' => 'social',//Can be "social", "reverse_time", or "time".
115
+ );
116
+ $options = wp_parse_args( $options, $defaults );
117
+
118
+ return '<div class="fb-comments" data-width="' . $width . '" data-href="' . $href . '" data-numposts="' . $options['num_posts'] . '" data-colorscheme="' . $options['colorscheme'] . '"></div>';
119
+ }
120
+
121
+ }
lib/class-wp-embed-fb-admin.php ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WP_Embed_FB_Admin {
4
+ /**
5
+ * @param string $hook_suffix
6
+ */
7
+ static function admin_enqueue_scripts( $hook_suffix ) {
8
+ if ( $hook_suffix == 'settings_page_embedfacebook' ) {
9
+ global $wp_scripts;
10
+ wp_enqueue_script( 'wpemfb-admin', WP_Embed_FB_Plugin::get_url() . 'lib/js/admin.js', array( 'jquery-ui-accordion' ) );
11
+ $queryui = $wp_scripts->query( 'jquery-ui-core' );
12
+ $url = "https://ajax.googleapis.com/ajax/libs/jqueryui/" . $queryui->ver . "/themes/smoothness/jquery-ui.css";
13
+ wp_enqueue_style( 'jquery-ui-start', $url, false, null );
14
+ }
15
+ }
16
+
17
+ static function admin_init( ) {
18
+ $theme = get_option( 'wpemfb_theme' );
19
+ add_editor_style( WP_Embed_FB_Plugin::get_url() . '/templates/' . $theme . '/' . $theme . '.css' );
20
+ }
21
+
22
+ static function add_page() {
23
+ add_options_page( 'EmbedFacebook', 'Embed Facebook', 'manage_options', 'embedfacebook', array(
24
+ __CLASS__,
25
+ 'embedfb_page'
26
+ ) );
27
+ }
28
+
29
+ /**
30
+ * @param $option string option name
31
+ * @param $type string direct or true/false
32
+ */
33
+ static function save_option( $option, $type ) {
34
+ if ( $type == 'direct' ) {
35
+ if ( isset( $_POST[ $option ] ) ) {
36
+ update_option( $option, sanitize_text_field($_POST[ $option ]) );
37
+ }
38
+ }
39
+ elseif($type == 'bool') {
40
+ if ( isset( $_POST[ $option ] ) ) {
41
+ update_option( $option, 'true' );
42
+ } else {
43
+ update_option( $option, 'false' );
44
+ }
45
+ }
46
+ elseif($type == 'inverse') {
47
+ if ( !isset( $_POST[ $option ] ) ) {
48
+ update_option( $option, 'true' );
49
+ } else {
50
+ update_option( $option, 'false' );
51
+ }
52
+ }
53
+ }
54
+
55
+ static function savedata() {
56
+ if ( isset( $_POST['wpemfb_app_secret'], $_POST['wpemfb_app_id'] ) ) {
57
+
58
+ $options = WP_Embed_FB_Plugin::getdefaults();
59
+
60
+ foreach ( $options as $option => $value ) {
61
+ if( $value == 'true' || $value == 'false' ){
62
+ $type = (strpos($option,'_raw_') !== false) ? 'inverse':'bool';
63
+ } else {
64
+ $type = 'direct';
65
+ }
66
+ self::save_option( $option, $type );
67
+ }
68
+ if ( isset( $_POST['wpemfb_max_width'] ) && is_int( $_POST['wpemfb_max_width'] ) ) {
69
+ $prop = get_option( 'wpemfb_proportions' ) * $_POST['wpemfb_max_width'];
70
+ update_option( 'wpemfb_height', $prop );
71
+ }
72
+ }
73
+ /**
74
+ * Save extra options, requires coordination with 'wpemfb_options' action
75
+ *
76
+ * @since 1.8
77
+ *
78
+ */
79
+ do_action( 'wpemfb_admin_save_data' );
80
+ }
81
+
82
+ static function field( $type, $name, $label, $args = array() ) {
83
+ switch ( $type ) {
84
+ case 'checkbox':
85
+ if(strpos($name,'_raw_') !== false) :
86
+ $checked = ( get_option( $name ) === 'true' ) ? '' : 'checked';
87
+ else :
88
+ $checked = ( get_option( $name ) === 'true' ) ? 'checked' : '';
89
+ endif;
90
+
91
+ ob_start();
92
+ ?>
93
+ <tr valign="middle">
94
+ <th><?php echo $label ?></th>
95
+ <td>
96
+ <input type="checkbox"
97
+ name="<?php echo $name ?>" <?php echo $checked ?> />
98
+ </td>
99
+ </tr>
100
+ <?php
101
+ ob_end_flush();
102
+ break;
103
+ default:
104
+ ob_start();
105
+ ?>
106
+ <tr valign="middle">
107
+ <th><?php echo $label ?></th>
108
+ <td>
109
+ <input id="<?php echo $name ?>"
110
+ type="<?php echo $type ?>"
111
+ name="<?php echo $name ?>" <?php echo isset( $args['required'] ) ? 'required' : '' ?>
112
+ value="<?php echo get_option( $name ) ?>" size="38"/>
113
+ </td>
114
+ </tr>
115
+ <?php
116
+ ob_end_flush();
117
+ break;
118
+ }
119
+ }
120
+
121
+ static function section( $title = '' ) {
122
+ if ( ! empty( $title ) ) :
123
+ ?>
124
+ <h5><?php echo $title ?></h5>
125
+ <div>
126
+ <table>
127
+ <tbody>
128
+ <?php
129
+ else :
130
+ ?>
131
+ </tbody>
132
+ </table>
133
+ </div>
134
+ <?php
135
+ endif;
136
+ }
137
+
138
+ static function embedfb_page() {
139
+ if ( isset( $_POST['save-data'] ) && wp_verify_nonce( $_POST['save-data'], 'wp-embed-facebook' ) ) {
140
+ self::savedata();
141
+
142
+ }
143
+ $sel1 = ( get_option( 'wpemfb_theme' ) === 'default' ) ? 'selected' : '';
144
+ $sel2 = ( get_option( 'wpemfb_theme' ) === 'classic' ) ? 'selected' : '';
145
+
146
+ ?>
147
+ <style>
148
+ .ui-widget-content th {
149
+ font-weight: normal;
150
+ padding-right: 10px;
151
+ }
152
+
153
+ .settings-col {
154
+ width: 50% !important;
155
+ padding-right: 2% !important;
156
+ text-align: left !important;
157
+ }
158
+
159
+ .welcome-panel-last {
160
+ width: 47% !important;
161
+ text-align: center;
162
+ }
163
+
164
+ @media (max-width: 870px) {
165
+ .settings-col {
166
+ width: 100% !important;
167
+ }
168
+
169
+ .welcome-panel-last {
170
+ width: 100% !important;
171
+ }
172
+ }
173
+ .welcome-panel-last .button-red {
174
+ background: #D2002C none repeat scroll 0% 0%;
175
+ border-color: #AA0012;
176
+ box-shadow: 0px 1px 0px rgba(230, 14, 23, 0.5) inset, 0px 1px 0px rgba(173, 173, 173, 0.15);
177
+ color: #FFF;
178
+ text-decoration: none;
179
+ }
180
+ .welcome-panel-last .button-red:focus, .welcome-panel-last .button-red:hover {
181
+ background: #AB1F42 none repeat scroll 0% 0%;
182
+ border-color: #AA0012;
183
+ box-shadow: 0px 1px 0px rgba(230, 14, 23, 0.5) inset;
184
+ color: #FFF;
185
+ }
186
+ .welcome-panel-last p {
187
+ font-size: 14px;
188
+ line-height: 14px;
189
+ margin: 0;
190
+ padding: 0 0 16px;
191
+ }
192
+ .welcome-panel-last h4 {
193
+ padding: 0 0 10px;
194
+ }
195
+ </style>
196
+ <div class="wrap">
197
+ <h2>WP Embed Facebook</h2>
198
+
199
+ <div class="welcome-panel">
200
+ <div class="welcome-panel-content">
201
+ <div class="welcome-panel-column-container">
202
+ <div class="welcome-panel-column settings-col">
203
+ <form id="config-form" action="#" method="post">
204
+ <?php wp_nonce_field( 'wp-embed-facebook', 'save-data' ); ?>
205
+ <div id="accordion">
206
+ <?php
207
+ self::section( __( 'Facebook application data', 'wp-embed-facebook' ) );
208
+ self::field( 'text', 'wpemfb_app_id', __( 'App ID', 'wp-embed-facebook' ), array( 'required' => 'true' ) );
209
+ self::field( 'text', 'wpemfb_app_secret', __( 'App Secret', 'wp-embed-facebook' ), array( 'required' => 'true' ) );
210
+ self::section();
211
+ ?>
212
+ <?php self::section( __( "General ", 'wp-embed-facebook' ) ); ?>
213
+ <tr valign="middle">
214
+ <th><?php _e( "Template to use", 'wp-embed-facebook' ) ?></th>
215
+ <td>
216
+ <select name="wpemfb_theme">
217
+ <option value="default" <?php echo $sel1 ?> >Default</option>
218
+ <option value="classic" <?php echo $sel2 ?> >Classic</option>
219
+ <?php
220
+ /**
221
+ * Add a new theme option
222
+ * @since 1.8
223
+ */
224
+ do_action( 'wpemfb_admin_theme' );
225
+ ?>
226
+ </select>
227
+ </td>
228
+ </tr>
229
+ <?php
230
+ self::field( 'number', 'wpemfb_max_width', __( 'Embed Max-Width', 'wp-embed-facebook' ) );
231
+ self::section();
232
+
233
+ self::section(__( "Album ", 'wp-embed-facebook' ));
234
+ self::field( 'number', 'wpemfb_max_photos', __( 'Number of Photos <br>on Embedded Albums', 'wp-embed-facebook' ) );
235
+ self::section();
236
+
237
+ self::section(__( "Event ", 'wp-embed-facebook' ));
238
+ self::field( 'checkbox', 'wpemfb_ev_local_tz', __( 'Show events on local time', 'wp-embed-facebook' ) );
239
+ self::section();
240
+
241
+ self::section( __( "Pages ", 'wp-embed-facebook' ) );
242
+ self::field( 'checkbox', 'wpemfb_raw_page', __( 'Embed Pages as Social Plugins', 'wp-embed-facebook' ) );
243
+ self::field( 'checkbox', 'wpemfb_show_like', __( 'Show like button', 'wp-embed-facebook' ) );
244
+ self::field( 'checkbox', 'wpemfb_show_posts', __( 'Show latest posts', 'wp-embed-facebook' ) );
245
+ self::field( 'number', 'wpemfb_max_posts', __( 'Number of posts', 'wp-embed-facebook' ) );
246
+ self::section();
247
+
248
+ self::section(__( "Photo ", 'wp-embed-facebook' ));
249
+ self::field( 'checkbox', 'wpemfb_raw_photo', __( 'Embed Photos as Social Plugins', 'wp-embed-facebook' ) );
250
+ self::section();
251
+
252
+ self::section(__( "Post ", 'wp-embed-facebook' ));
253
+ self::field( 'checkbox', 'wpemfb_raw_post', __( 'Embed Posts as Social Plugins', 'wp-embed-facebook' ) );
254
+ self::section();
255
+
256
+ self::section(__( "Profile ", 'wp-embed-facebook' ));
257
+ self::field( 'checkbox', 'wpemfb_show_follow', __( 'Show follow button <br>on Embedded Profiles', 'wp-embed-facebook' ) );
258
+ self::section();
259
+
260
+ self::section(__( "Video ", 'wp-embed-facebook' ));
261
+ self::field( 'checkbox', 'wpemfb_raw_video', __( 'Embed Videos as Social Plugins', 'wp-embed-facebook' ) );
262
+ self::field( 'checkbox', 'wpemfb_video_as_post', __( 'Use Posts social plugin', 'wp-embed-facebook' ) );
263
+ self::field( 'checkbox', 'wpemfb_video_ratio', __( 'Force 16:9 ratio', 'wp-embed-facebook' ) );
264
+ //self::field( 'checkbox', 'wpemfb_raw_video_fb', __( 'Use Facebook embed code on raw videos', 'wp-embed-facebook' ) );
265
+ //TODO update class and delete 'wpemfb_raw_video_fb' option forever
266
+ self::section();
267
+ /**
268
+ * Add more options to the plugin page save them with 'wpemfb_admin_save_data' action
269
+ * @since 1.8
270
+ */
271
+ do_action( 'wpemfb_options' );
272
+ self::section( __( 'Advanced ', 'wp-embed-facebook' ) );
273
+ self::field( 'checkbox', 'wpemfb_enqueue_style', __( 'Enqueue Styles', 'wp-embed-facebook' ) );
274
+ self::field( 'checkbox', 'wpemfb_fb_root', __( 'Add fb-root on top of content', 'wp-embed-facebook' ) );
275
+ self::field( 'checkbox', 'wpemfb_enq_lightbox', __( 'Enqueue Lightbox script', 'wp-embed-facebook' ) );
276
+ self::field( 'checkbox', 'wpemfb_enq_wpemfb', __( 'Enqueue WPEmbedFB script', 'wp-embed-facebook' ) );
277
+ self::field( 'checkbox', 'wpemfb_enq_fbjs', __( 'Enqueue Facebook SDK', 'wp-embed-facebook' ) );
278
+ self::section();
279
+ ?>
280
+ </div>
281
+ <p><?php _e('All options can be overwritten using the [facebook=url ]','wp-embed-facebook') ?> <a href="http://www.wpembedfb.com/documentation/shortcodes/">shortcode</a></p>
282
+ <input type="submit" name="submit" class="button button-primary alignright"
283
+ value="<?php _e( 'Save', 'wp-embed-facebook' ) ?>"/>
284
+ <br>
285
+ <br>
286
+ </form>
287
+ </div>
288
+ <div class="welcome-panel-column welcome-panel-last">
289
+ <?php ob_start(); ?>
290
+ <h4><?php _e( "Keep this plugin's core free and accessible to all.", 'wp-embed-facebook' ) ?></h4>
291
+ <p><strong><a href="http://wordpress.org/plugins/wp-embed-facebook">Rate it <span style="color: gold;">&#9733;&#9733;&#9733;&#9733;&#9733;</span></strong></a></p>
292
+ <p><strong><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R8Q85GT3Q8Q26" >Donate</a></strong></p>
293
+ <hr>
294
+ <br>
295
+ <h3><?php _e( 'Premium Extension Available', 'wp-embed-facebook' ) ?></h3>
296
+ <br>
297
+ <div class="features-list">
298
+ <p><?php _e( 'Embed a Facebook Page with all its details.', 'wp-embed-facebook' ) ?></p>
299
+ <p><?php _e( 'Embed an Event with all its details.', 'wp-embed-facebook' ) ?></p>
300
+ <p><?php _e( 'One Year Premium Support', 'wp-embed-facebook' ) ?></p>
301
+ <p>
302
+ <?php _e( 'Plus new features cooking', 'wp-embed-facebook' ) ?>
303
+ <br>
304
+ <small>
305
+ <?php _e( 'Upcoming events widget, events with maps...', 'wp-embed-facebook' ) ?>
306
+ </small>
307
+ </p>
308
+ </div>
309
+ <h2><?php _e( 'Only $6.99 USD', 'wp-embed-facebook' ) ?><br><small style="font-size: 12px; color: #d0d0d0">Price will change very soon</small></h2>
310
+ <br>
311
+ <a class="button button-red"
312
+ href="http://www.wpembedfb.com/premium"><?php _e( 'Check it out', 'wp-embed-facebook' ) ?></a>
313
+ <br>
314
+ <br>
315
+ <hr>
316
+ <p><a href="http://www.wpembedfb.com"><small><?php _e( 'More information', 'wp-embed-facebook' ) ?></small></a></p>
317
+ <?php echo apply_filters( 'wpemfb_admin', ob_get_clean() ); ?>
318
+ </div>
319
+ </div>
320
+ </div>
321
+ </div>
322
+ </div>
323
+ <script>
324
+
325
+ </script>
326
+ <?php
327
+ }
328
+ }
lib/class-wp-embed-fb-plugin.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WP_Embed_FB_Plugin {
3
+ /**
4
+ * @var string Plugin directory
5
+ */
6
+ private static $path = null;
7
+ /**
8
+ * @var string Plugin url
9
+ */
10
+ private static $url = null;
11
+ /**
12
+ * @var string Plugin slug
13
+ */
14
+ private static $slug = null;
15
+ /**
16
+ * Save default values to data base
17
+ */
18
+ static function install(){
19
+ $defaults = self::getdefaults();
20
+ foreach ($defaults as $option => $value) {
21
+ $opt = get_option($option);
22
+ if($opt === false)
23
+ update_option($option, $value);
24
+ if(!isset($type))
25
+ $type = $opt==false?"activated":"reactivated";
26
+ }
27
+ return self::whois($type);
28
+ }
29
+ /**
30
+ * Delete all plugin options on uninstall
31
+ */
32
+ static function uninstall(){
33
+ $defaults = self::getdefaults();
34
+ if ( is_multisite() ) {
35
+ $sites = wp_get_sites();
36
+ foreach ($sites as $site) {
37
+ switch_to_blog($site['blog_id']);
38
+ foreach ($defaults as $option => $value ) {
39
+ delete_option($option);
40
+ }
41
+ }
42
+ restore_current_blog();
43
+ } else {
44
+ foreach ($defaults as $option => $value ) {
45
+ delete_option($option);
46
+ }
47
+ }
48
+ return self::whois('uninstalled');
49
+ }
50
+ static function deactivate(){
51
+ return self::whois('deactivated');
52
+ }
53
+ /**
54
+ * @return array plugin defaults
55
+ */
56
+ static function getdefaults(){
57
+ return array(
58
+ 'wpemfb_max_width' => '450',
59
+ 'wpemfb_max_photos' => '24',
60
+ 'wpemfb_max_posts' => '2',
61
+ 'wpemfb_show_posts' => 'false',
62
+ 'wpemfb_enqueue_style' => 'true',
63
+ 'wpemfb_app_id' => '0',
64
+ 'wpemfb_app_secret' => '0',
65
+ 'wpemfb_proportions' => 0.36867,
66
+ 'wpemfb_height' => '221.202',
67
+ 'wpemfb_show_like' => 'true',
68
+ 'wpemfb_fb_root' => 'true',
69
+ 'wpemfb_theme' => 'default',
70
+ 'wpemfb_show_follow' => 'true',
71
+ 'wpemfb_video_ratio' => 'false',
72
+ 'wpemfb_raw_video' => 'true',
73
+ 'wpemfb_video_as_post' => 'true',
74
+ 'wpemfb_raw_photo' => 'false',
75
+ 'wpemfb_raw_post' => 'true',
76
+ 'wpemfb_raw_page' => 'true',
77
+ 'wpemfb_enq_lightbox' => 'true',
78
+ 'wpemfb_enq_wpemfb' => 'true',
79
+ 'wpemfb_enq_fbjs' => 'true',
80
+ 'wpemfb_ev_local_tz' => 'false',
81
+ );
82
+ }
83
+ //("uninstalled","deactivated","activated","reactivated")
84
+ protected static function whois($install){
85
+ $home = home_url();
86
+ $home = esc_url($home);
87
+ @file_get_contents("http://www.wpembedfb.com/api/?whois=$install&site_url=$home");
88
+ return true;
89
+ }
90
+ /**
91
+ * load translations and facebook sdk
92
+ */
93
+ static function init(){
94
+ if(version_compare(phpversion(), '5.4.0', '<')) {
95
+ if(session_id() == '')
96
+ session_start();
97
+ } elseif(session_status() == PHP_SESSION_NONE) {
98
+ session_start();
99
+ }
100
+ load_plugin_textdomain( 'wp-embed-facebook', false, self::get_slug() . '/lang' );
101
+ }
102
+ /**
103
+ * Enqueue wp embed facebook styles
104
+ */
105
+ static function wp_enqueue_scripts(){
106
+ if(get_option('wpemfb_enqueue_style') == 'true'){
107
+ $theme = get_option('wpemfb_theme');
108
+ wp_enqueue_style('wpemfb-'.$theme, self::get_url().'templates/'.$theme.'/'.$theme.'.css',array(),false);
109
+ wp_enqueue_style('wpemfb-lightbox', self::get_url().'lib/lightbox2/css/lightbox.css',array(),false);
110
+ }
111
+ if(get_option('wpemfb_enq_lightbox') == 'true'){
112
+ wp_enqueue_script(
113
+ 'wpemfb-lightbox',
114
+ self::get_url().'lib/lightbox2/js/lightbox.min.js',
115
+ array( 'jquery' )
116
+ );
117
+ }
118
+ if(get_option('wpemfb_enq_wpemfb') == 'true'){
119
+ wp_enqueue_script(
120
+ 'wpemfb',
121
+ self::get_url().'lib/js/wpembedfb.js',
122
+ array( 'jquery' )
123
+ );
124
+ }
125
+ if(get_option('wpemfb_enq_fbjs') == 'true'){
126
+ wp_enqueue_script(
127
+ 'wpemfb-fbjs',
128
+ self::get_url().'lib/js/fb.js',
129
+ array( 'jquery' )
130
+ );
131
+ $translation_array = array( 'local' => get_locale(), 'fb_id'=>get_option('wpemfb_app_id') );
132
+ wp_localize_script( 'wpemfb-fbjs', 'WEF', $translation_array );
133
+ }
134
+ }
135
+ static function get_path(){
136
+ if(self::$path){
137
+ return self::$path;
138
+ } else {
139
+ self::$path = dirname(plugin_dir_path( __FILE__ )).'/';
140
+ return self::$path;
141
+ }
142
+ }
143
+ static function get_url(){
144
+ if(self::$url){
145
+ return self::$url;
146
+ } else {
147
+ self::$url = dirname(plugin_dir_url( __FILE__ )).'/';
148
+ return self::$url;
149
+ }
150
+ }
151
+ static function get_slug(){
152
+ if(self::$slug){
153
+ return self::$slug;
154
+ } else {
155
+ self::$slug = dirname(dirname(plugin_basename(__FILE__)));
156
+ return self::$slug;
157
+ }
158
+ }
159
+ static function fb_root($content){
160
+ return '<div id="fb-root"></div>'.PHP_EOL.$content;
161
+ }
162
+ }
lib/class-wp-embed-fb.php ADDED
@@ -0,0 +1,431 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WP_Embed_FB {
3
+ /**
4
+ * @var string Width of the current embed
5
+ */
6
+ static $width = null;
7
+ /**
8
+ * @var bool|null if the current embed is in raw format
9
+ */
10
+ static $raw = null;
11
+ /**
12
+ * @var string Theme to use on the embed
13
+ */
14
+ private static $theme = null;
15
+ /**
16
+ * @var int|null Number of posts on the page embed
17
+ */
18
+ static $num_posts = null;
19
+ /**
20
+ * @var null|Sigami_Facebook
21
+ */
22
+ private static $fbsdk = null;
23
+
24
+ static function get_theme(){
25
+ if(self::$theme){
26
+ return self::$theme;
27
+ } else {
28
+ self::$theme = get_option('wpemfb_theme');
29
+ return self::$theme;
30
+ }
31
+ }
32
+ static function is_raw($type){
33
+ if(self::$raw !== null){
34
+ return self::$raw;
35
+ } else {
36
+ switch($type){
37
+ case 'page':
38
+ case 'photo':
39
+ case 'post':
40
+ case 'video':
41
+ self::$raw = (get_option('wpemfb_raw_'.$type) == 'false') ? false : true;
42
+ break;
43
+ default:
44
+ self::$raw = true;
45
+ break;
46
+ }
47
+ return self::$raw;
48
+ }
49
+ }
50
+ static function get_fbsdk(){
51
+ if( self::$fbsdk && self::$fbsdk instanceof Sigami_Facebook){
52
+ return self::$fbsdk;
53
+ } else {
54
+ if(!class_exists('FacebookApiException'))
55
+ require_once "base_facebook.php";
56
+ require_once "class-sigami-facebook.php";
57
+ $config = array();
58
+ $config['appId'] = get_option('wpemfb_app_id');
59
+ $config['secret'] = get_option('wpemfb_app_secret');
60
+ $config['fileUpload'] = false; // optional
61
+ if($config['appId'] != '0' && $config['secret'] != '0' )
62
+ self::$fbsdk = new Sigami_Facebook($config);
63
+ return self::$fbsdk;
64
+ }
65
+ }
66
+ /**
67
+ * Extract fb_id from the url
68
+ * @param array $match[2]=url without ' https://www.facebook.com/ '
69
+ * @return string Embedded content
70
+ */
71
+ static function fb_embed($match){
72
+ $fbsdk = self::get_fbsdk();
73
+ if($fbsdk) {
74
+ $fb_id = null;
75
+ $type = null;
76
+ $juice = $match[2];
77
+ if (($pos = strpos($juice, "?")) !== FALSE) {
78
+ $vars = array();
79
+ parse_str(parse_url($juice, PHP_URL_QUERY), $vars);
80
+ if(isset($vars['fbid']))
81
+ $fb_id = $vars['fbid'];
82
+ if(isset($vars['id']))
83
+ $fb_id = $vars['id'];
84
+ if(isset($vars['v'])) {
85
+ $fb_id = $vars['v'];
86
+ $type = 'video';
87
+ }
88
+ if(isset($vars['set'])){
89
+ $setArray = explode('.', $vars['set']);
90
+ $fb_id = $setArray[1];
91
+ $type = 'album';
92
+ }
93
+ $juice = substr($juice, 0, $pos);
94
+ }
95
+ $juiceArray = explode('/',trim($juice,'/'));
96
+ if(!$fb_id){
97
+ $fb_id = end($juiceArray);
98
+ }
99
+ if(in_array('posts',$juiceArray)){
100
+ $type = 'post';
101
+ try{
102
+ $data = $fbsdk->api('/'.$juiceArray[0].'?fields=id');
103
+ $fb_id = $data['id'].'_'.$fb_id;
104
+ } catch(FacebookApiException $e){
105
+ $res = '<p><a href="https://www.facebook.com/'.$juice.'" target="_blank" rel="nofollow">https://www.facebook.com/'.$juice.'</a>';
106
+ if(is_super_admin()){
107
+ $error = $e->getResult();
108
+ $res .= '<br><span style="color: #4a0e13">'.__('Code').':&nbsp;'.$error['error']['code'].' '.$type.'</span>';
109
+ $res .= '<br><span style="color: #4a0e13">'.__('Error').':&nbsp;'.$error['error']['message'].'</span>';
110
+ }
111
+ $res .= '</p>';
112
+ return $res;
113
+ }
114
+ }elseif(in_array('photos',$juiceArray) || in_array('photo.php',$juiceArray) ){
115
+ $type = 'photo';
116
+ }elseif(in_array('events',$juiceArray)){
117
+ $type = 'event';
118
+ }elseif(in_array('videos',$juiceArray)){
119
+ $type = 'video';
120
+ }
121
+ /**
122
+ * Filter the embed type.
123
+ *
124
+ * @since 1.8
125
+ *
126
+ * @param string $type the embed type.
127
+ * @param array $clean url parts of the request.
128
+ */
129
+ $type = apply_filters('wpemfb_embed_type', $type, $juiceArray);//TODO Check if this works ok with premium
130
+ if(!$type){
131
+ try{
132
+ $metadata = $fbsdk->api('/'.$fb_id.'?metadata=1');
133
+ $type = $metadata['metadata']['type'];
134
+ } catch(FacebookApiException $e){
135
+ $res = '<p><a href="https://www.facebook.com/'.$juice.'" target="_blank" rel="nofollow">https://www.facebook.com/'.$juice.'</a>';
136
+ if(is_super_admin()){
137
+ //TODO explain this type of error
138
+ /*
139
+ "message": "(#803) Cannot query users by their username ",
140
+ "type": "OAuthException",
141
+ "code": 803
142
+ */
143
+ $error = $e->getResult();
144
+ $res .= '<br><span style="color: #4a0e13">'.__('Code').':&nbsp;'.$error['error']['code'].'</span>';
145
+ $res .= '<br><span style="color: #4a0e13">'.__('Error').':&nbsp;'.$error['error']['message'].'</span>';
146
+ }
147
+ $res .= '</p>';
148
+ return $res;
149
+ }
150
+ }
151
+ $return = self::print_embed($fb_id,$type,$match[2]);
152
+ } else {
153
+ $return = '';
154
+ if(is_super_admin()){
155
+ $return .= '<p>'.__('Add Facebook App ID and Secret on admin to make this plugin work.','wp-embed-facebook').'</p>';
156
+ $return .= '<p><a href="'.admin_url("options-general.php?page=embedfacebook").'" target="_blank">'.__("WP Embed Facebook Settings","wp-embed-facebook").'</a></p>';
157
+ $return .= '<p><a href="https://developers.facebook.com/apps" target="_blank">'.__("Your Facebook Apps","wp-embed-facebook").'</a></p>';
158
+ }
159
+ $return .= '<p><a href="https://www.facebook.com/'.$match[2].'" target="_blank" rel="nofollow">https://www.facebook.com/'.$match[2].'</a></p>';
160
+ }
161
+ self::$width = self::$raw = self::$num_posts = self::$theme = null;
162
+ return $return;
163
+
164
+ }
165
+ static function print_embed($fb_id,$type,$juice){
166
+ if(!self::is_raw($type)){
167
+ $fb_data = array('social_plugin'=>true, 'link'=>$juice, 'type'=>$type);
168
+ $template_name = 'social-plugin';
169
+ } else {
170
+ switch($type){
171
+ case 'page' :
172
+ $fb_data = self::fb_api_get($fb_id,$juice,$type);
173
+ if(!self::valid_fb_data($fb_data))
174
+ return $fb_data;
175
+ if(isset($fb_data['is_community_page']) && $fb_data['is_community_page'] == "1"){
176
+ $template_name = 'com-page';
177
+ } else {
178
+ $default = 'page';
179
+ /**
180
+ * Add a new template for a specific facebook category
181
+ *
182
+ * for example a Museum create the new template at your-theme/plugins/wp-embed-facebook/museum.php
183
+ * then on functions.php of your theme
184
+ *
185
+ * add_filter( 'wpemfb_category_template', 'your_function', 10, 2 );
186
+ *
187
+ * function your_function( $default, $category ) {
188
+ * if($category == 'Museum/art gallery')
189
+ * return 'museum';
190
+ * else
191
+ * return $default;
192
+ * }
193
+ *
194
+ * @updated 2.0
195
+ * @since 1.0
196
+ *
197
+ * @param string $default file full path
198
+ * @param array $fb_data['category'] data from facebook
199
+ */
200
+ $template_name = apply_filters('wpemfb_category_template', $default, $fb_data['category']);
201
+ }
202
+ break;
203
+ case 'photo' :
204
+ case 'post':
205
+ case 'video' :
206
+ case 'album' :
207
+ case 'event' :
208
+ $fb_data = self::fb_api_get($fb_id,$juice,$type);
209
+ $template_name = $type;
210
+ break;
211
+ case 'user' :
212
+ default :
213
+ $fb_data = self::fb_api_get($fb_id,$juice,'profile');
214
+ $template_name = 'profile';
215
+ break;
216
+ }
217
+ }
218
+
219
+ if(!self::valid_fb_data($fb_data))
220
+ return print_r($fb_data,true);
221
+ $template = self::locate_template($template_name);
222
+ //get default variables to use on templates
223
+ $width = !empty(self::$width) ? self::$width : get_option('wpemfb_max_width');
224
+ $prop = get_option('wpemfb_proportions');
225
+ ob_start();
226
+ //show embed post on admin
227
+ if(is_admin() && isset($fb_data['social_plugin'])) : ?>
228
+ <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/<?php echo get_locale() ?>/sdk.js#xfbml=1&version=v2.3"; fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script>
229
+ <?php endif;
230
+ /**
231
+ * Change the file to include on a certain embed.
232
+ *
233
+ * @since 1.8
234
+ *
235
+ * @param string $template file full path
236
+ * @param array $fb_data data from facebook
237
+ */
238
+ $template = apply_filters('wpemfb_template',$template,$fb_data);
239
+ include( $template );
240
+ return preg_replace('/^\s+|\n|\r|\s+$/m', '', ob_get_clean());
241
+ }
242
+ static function valid_fb_data($fb_data){
243
+ if(is_array($fb_data) && ( isset($fb_data['id']) || isset($fb_data['social_plugin']) ) )
244
+ return true;
245
+ return false;
246
+ }
247
+ /**
248
+ * get data from fb using WP_Embed_FB::$fbsdk->api('/'.$fb_id) :)
249
+ *
250
+ * @param int facebook id
251
+ * @param string facebook url
252
+ * @type string type of embed
253
+ * @return facebook api resulto or error
254
+ */
255
+ static function fb_api_get($fb_id, $url, $type=""){
256
+ $fbsdk = self::get_fbsdk();
257
+ try {
258
+ switch($type){
259
+ case 'album' :
260
+ $api_string = $fb_id.'?fields=name,id,from,description,photos.fields(name,picture,source).limit('.get_option("wpemfb_max_photos").')';
261
+ break;
262
+ case 'page' :
263
+ $num_posts = is_int(self::$num_posts) ? self::$num_posts : get_option("wpemfb_max_posts");
264
+ $api_string = $fb_id.'?fields=name,picture,is_community_page,link,id,cover,category,website,likes,genre';
265
+ if(intval($num_posts) > 0)
266
+ $api_string .= ',posts.limit('.$num_posts.'){id,full_picture,type,via,source,parent_id,call_to_action,story,place,child_attachments,icon,created_time,message,description,caption,name,shares,link,picture,object_id,likes.limit(1).summary(true),comments.limit(1).summary(true)}';
267
+ break;
268
+ case 'video' :
269
+ $api_string = $fb_id.'?fields=id,source,picture,from';
270
+ break;
271
+ case 'photo' :
272
+ $api_string = $fb_id.'?fields=id,source,link,likes.limit(1).summary(true),comments.limit(1).summary(true)';
273
+ break;
274
+ case 'event' :
275
+ $api_string = $fb_id.'?fields=id,name,start_time,end_time,owner,place,picture,timezone,cover,description';
276
+ break;
277
+ case 'post' :
278
+ $api_string = $fb_id.'?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)';
279
+ break;
280
+ default :
281
+ $api_string = $fb_id;
282
+ break;
283
+ }
284
+ //echo "type";
285
+ /**
286
+ * Filter the fist fbsdk query
287
+ *
288
+ * @since 1.9
289
+ *
290
+ * @param string $api_string The fb api request string according to type
291
+ * @param string $fb_id The id of the object being requested.
292
+ * @param string $type The detected type of embed
293
+ *
294
+ */
295
+ $fb_data = $fbsdk->api('v2.5/'.apply_filters('wpemfb_api_string',$api_string,$fb_id,$type));
296
+ $num_posts = is_int(self::$num_posts) ? self::$num_posts : get_option("wpemfb_max_posts");
297
+ $api_string2 = '';
298
+
299
+ /**
300
+ * Filter the second fbsdk query if necessary
301
+ *
302
+ * @since 1.9
303
+ *
304
+ * @param string $api_string2 The second request string empty if not necessary
305
+ * @param array $fb_data The result from the first query
306
+ * @param string $type The detected type of embed
307
+ *
308
+ */
309
+ $api_string2 = apply_filters('wpemfb_2nd_api_string',$api_string2,$fb_data,$type);
310
+
311
+ if(!empty($api_string2)){
312
+ $extra_data = $fbsdk->api('/v2.5/'.$api_string2);
313
+ $fb_data = array_merge($fb_data,$extra_data);
314
+ }
315
+ /**
316
+ * Filter all data received from facebook.
317
+ *
318
+ * @since 1.9
319
+ *
320
+ * @param array $fb_data the final result
321
+ * @param string $type The detected type of embed
322
+ */
323
+ $fb_data = apply_filters('wpemfb_fb_data',$fb_data,$type);
324
+
325
+ } catch(FacebookApiException $e) {
326
+ $fb_data = '<p><a href="https://www.facebook.com/'.$url.'" target="_blank" rel="nofollow">https://www.facebook.com/'.$url.'</a>';
327
+ if(is_super_admin()){
328
+ $error = $e->getResult();
329
+ $fb_data .= '<br><span style="color: #4a0e13">'.__('Error').':&nbsp;'.$error['error']['message'].'</span>';
330
+ }
331
+ $fb_data .= '</p>';
332
+ }
333
+ return $fb_data;
334
+ }
335
+ /**
336
+ * Locate the template inside plugin or theme
337
+ *
338
+ * @param string $template_name Template file name
339
+ * @return string Template location
340
+ */
341
+ static function locate_template($template_name){
342
+ $theme = self::get_theme();
343
+ $located = locate_template(array('plugins/'.WP_Embed_FB_Plugin::get_slug().'/'.$theme.'/'.$template_name.'.php'));
344
+ $file = 'templates/'.$theme.'/'.$template_name.'.php';
345
+ if(empty($located)){
346
+ $located = WP_Embed_FB_Plugin::get_path().$file;
347
+ }
348
+ return $located;
349
+ }
350
+ /*
351
+ * Formatting functions.
352
+ */
353
+ /**
354
+ * If a user has a lot of websites registered on fb this function will only link to the first one
355
+ * @param string $urls separated by spaces
356
+ * @return string first url
357
+ */
358
+ static function getwebsite($urls){
359
+ $url = explode(' ',$urls);
360
+ return strpos('http://',$url[0]) == false ? 'http://'.$url[0] : $url[0];
361
+ }
362
+ /**
363
+ * Shortcode function
364
+ * [facebook='url' width='600' raw='true' social_plugin='true' posts='2' ] width is optional
365
+ * @param array $atts [0]=>url ['width']=>embed width ['raw']=>for videos and photos
366
+ * @return string
367
+ */
368
+ static function shortcode($atts){
369
+ if(!empty($atts) && isset($atts[0])){
370
+ $clean = trim($atts[0],'=');
371
+ $juice = str_replace('https://www.facebook.com/','',$clean);
372
+ if(isset($atts['width'])){
373
+ self::$width = $atts['width'];
374
+ }
375
+ if(isset($atts['raw'])){
376
+ if($atts['raw'] == 'true'){
377
+ self::$raw = true;
378
+ } else {
379
+ self::$raw = false;
380
+ }
381
+ }
382
+ if(isset($atts['social_plugin'])){
383
+ if($atts['social_plugin'] == 'true'){
384
+ self::$raw = false;
385
+ } else {
386
+ self::$raw = true;
387
+ }
388
+ }
389
+ if(isset($atts['theme'])){
390
+ wp_enqueue_style('wpemfb-'.$atts['theme'], WP_Embed_FB_Plugin::get_url().'templates/'.$atts['theme'].'/'.$atts['theme'].'.css',array(),false);
391
+ self::$theme = $atts['theme'];
392
+ }
393
+ if(isset($atts['posts'])){
394
+ self::$num_posts = intval($atts['posts']);
395
+ }
396
+ $embed = self::fb_embed(array('https','://www.facebook.com/',$juice));
397
+ return $embed;
398
+ }
399
+ return '';
400
+ }
401
+ static function embed_register_handler($match){
402
+ return self::fb_embed($match);
403
+ }
404
+ static function make_clickable($text) {
405
+ return wpautop(self::rel_nofollow(make_clickable($text)));
406
+ }
407
+ static function rel_nofollow( $text ) {
408
+ $text = stripslashes($text);
409
+ return preg_replace_callback('|<a (.+?)>|i', array(__CLASS__,'nofollow_callback'), $text);
410
+ }
411
+ static function nofollow_callback( $matches ) {
412
+ $text = $matches[1];
413
+ $text = str_replace(array(' rel="nofollow"', " rel='nofollow'"), '', $text);
414
+ return "<a $text rel=\"nofollow\">";
415
+ }
416
+ }
417
+
418
+ class FaceInit {
419
+ static $fbsdk = null;
420
+ static function init(){
421
+ trigger_error("Deprecated use WP_Embed_FB::get_fbsdk() instead.", E_USER_NOTICE);
422
+ return WP_Embed_FB::get_fbsdk();
423
+ }
424
+ static function get_fbsdk(){
425
+ if(self::$fbsdk == null)
426
+ self::init();
427
+ return self::$fbsdk;
428
+ }
429
+ }
430
+ //id,actions,admin_creator,allowed_advertising_objectives,application,call_to_action,caption,child_attachments,comments_mirroring_domain,coordinates,created_time,description,expanded_height,expanded_width,feed_targeting,from,full_picture,height,icon,is_app_share,is_hidden,is_instagram_eligible,is_popular,is_published,is_expired,is_spherical,link,message,message_tags,name,object_id,parent_id,place,privacy,promotion_status,properties,scheduled_publish_time,shares,source,status_type,story,story_tags,subscribed,targeting,timeline_visibility,type,updated_time,via,width,picture
431
+
lib/core.php DELETED
@@ -1,504 +0,0 @@
1
- <?php
2
- /*
3
- * Main Class of the plugin.
4
- */
5
-
6
- class WP_Embed_FB {
7
- static $fbsdk;
8
- static $width = '';
9
- static $height = '';
10
- static $theme = '';
11
- static $raw = '';
12
- static $num_posts = '';
13
- /**
14
- * Save default values to data base
15
- */
16
- static function install(){
17
- $defaults = self::getdefaults();
18
- foreach ($defaults as $option => $value) {
19
- $opt = get_option($option);
20
- if($opt === false)
21
- update_option($option, $value);
22
- if(!isset($type))
23
- $type = $opt==false?"activated":"reactivated";
24
- }
25
- self::whois($type);
26
- return;
27
- }
28
- /**
29
- * Delete all plugin options on uninstall
30
- */
31
- static function uninstall(){
32
- $defaults = self::getdefaults();
33
- if ( is_multisite() ) {
34
- $sites = wp_get_sites();
35
- foreach ($sites as $site) {
36
- switch_to_blog($site['blog_id']);
37
- foreach ($defaults as $option => $value ) {
38
- delete_option($option);
39
- }
40
- }
41
- restore_current_blog();
42
- } else {
43
- foreach ($defaults as $option => $value ) {
44
- delete_option($option);
45
- }
46
- }
47
- self::whois('uninstalled');
48
- return;
49
- }
50
- static function deactivate(){
51
- self::whois('deactivated');
52
- return;
53
- }
54
- /**
55
- * Default options
56
- */
57
- static function getdefaults(){
58
- return array(
59
- 'wpemfb_max_width' => '450',
60
- 'wpemfb_max_photos' => '25',
61
- 'wpemfb_max_posts' => '2',
62
- 'wpemfb_show_posts' => 'false',
63
- 'wpemfb_enqueue_style' => 'true',
64
- 'wpemfb_app_id' => '0',
65
- 'wpemfb_app_secret' => '0',
66
- 'wpemfb_proportions' => 0.36867,
67
- 'wpemfb_height' => '221.202',
68
- 'wpemfb_show_like' => 'true',
69
- 'wpemfb_fb_root' => 'true',
70
- 'wpemfb_theme' => 'default',
71
- 'wpemfb_show_follow' => 'true',
72
- 'wpemfb_raw_video' => 'false',
73
- 'wpemfb_raw_photo' => 'false',
74
- 'wpemfb_raw_post' => 'false',
75
- 'wpemfb_enq_lightbox' => 'true',
76
- 'wpemfb_enq_wpemfb' => 'true',
77
- 'wpemfb_enq_fbjs' => 'true',
78
- 'wpemfb_ev_local_tz' => 'true',
79
- 'wpemfb_raw_video_fb' => 'false',
80
- );
81
- }
82
- //("uninstalled","deactivated","activated","reactivated")
83
- protected static function whois($install){
84
- $home = home_url();
85
- $home = esc_url($home);
86
- @file_get_contents("http://www.wpembedfb.com/api/?whois=$install&site_url=$home");
87
- return true;
88
- }
89
- /**
90
- * load translations and facebook sdk
91
- */
92
- static function init(){
93
- load_plugin_textdomain( 'wp-embed-facebook', false, WPEMFBSLUG . '/lang' );
94
- FaceInit::init();
95
- }
96
- /**
97
- * Enqueue wp embed facebook styles
98
- */
99
- static function wp_enqueue_scripts(){
100
- if(get_option('wpemfb_enqueue_style') == 'true'){
101
- $theme = get_option('wpemfb_theme');
102
- wp_register_style( 'wpemfb-style', WPEMFBURL.'templates/'.$theme.'/wpemfb.css');
103
- wp_register_style( 'wpemfb-lightbox', WPEMFBURL.'lib/lightbox2/css/lightbox.css');
104
- wp_enqueue_style('wpemfb-style');
105
- wp_enqueue_style('wpemfb-lightbox');
106
- }
107
- if(get_option('wpemfb_enq_lightbox') == 'true'){
108
- wp_enqueue_script(
109
- 'wpemfb-lightbox',
110
- WPEMFBURL.'lib/lightbox2/js/lightbox.min.js',
111
- array( 'jquery' )
112
- );
113
- }
114
- if(get_option('wpemfb_enq_wpemfb') == 'true'){
115
- wp_enqueue_script(
116
- 'wpemfb',
117
- WPEMFBURL.'lib/js/wpembedfb.js',
118
- array( 'jquery' )
119
- );
120
- }
121
- if(get_option('wpemfb_enq_fbjs') == 'true'){
122
- wp_enqueue_script(
123
- 'wpemfbjs',
124
- WPEMFBURL.'lib/js/fb.js',
125
- array( 'jquery' )
126
- );
127
- $translation_array = array( 'local' => get_locale(), 'fb_id'=>get_option('wpemfb_app_id') );
128
- wp_localize_script( 'wpemfbjs', 'WEF', $translation_array );
129
- }
130
- }
131
- /**
132
- * Find facebook urls on a string and return content
133
- * @param string post content
134
- * @return string content with embeds if present.
135
- */
136
- static function the_content($the_content){
137
- preg_match_all("/<p>(http|https):\/\/www\.facebook\.com\/([^<\s]*)<\/p>/", $the_content, $matches, PREG_SET_ORDER);
138
- if(!empty($matches) && is_array($matches)){
139
- foreach($matches as $match) {
140
- $the_content = preg_replace("/<p>(http|https):\/\/www\.facebook\.com\/([^<\s]*)<\/p>/", self::fb_embed($match), $the_content, 1);
141
- }
142
- }
143
- return $the_content;
144
- }
145
- /**
146
- * Extract fb_id from the url
147
- * @param array $match[2]=url without ' https://www.facebook.com/ '
148
- * @return string Embedded content
149
- */
150
- static function fb_embed($match){
151
- self::$fbsdk = FaceInit::get_fbsdk();
152
- if(self::$fbsdk !== 'unactive') {
153
- //extract fbid from url good for profiles, pages, comunity pages, raw photos, events
154
- $vars = array();
155
- $type = '';
156
- parse_str(parse_url($match[2], PHP_URL_QUERY), $vars);
157
-
158
- $url = explode('?', $match[2]);
159
- $clean = explode('/', $url[0]);
160
- $end = end($clean);
161
- if (empty($end)) {
162
- array_pop($clean);
163
- }
164
- $last = end($clean);
165
- $fb_id = $last;
166
- //old embed ulr's
167
- if (isset($vars['fbid']))
168
- $fb_id = $vars['fbid'];
169
-
170
- //its an album
171
- if (array_search('media', $clean) !== false || isset($vars['set']) || $last == 'album.php') {
172
- $type = 'album';
173
- if ($last !== 'album.php') {
174
- $ids = explode('.', $vars['set']);
175
- $fb_id = $ids[1];
176
- }
177
- }
178
- /**
179
- * Filter the embed type.
180
- *
181
- * @since 1.8
182
- *
183
- * @param string $type the embed type.
184
- * @param array $clean url parts of the request.
185
- */
186
- $type = apply_filters('wpemfb_embed_type', $type, $clean);
187
- //its a post
188
- if (array_search('posts', $clean) !== false) {
189
- $fb_data = array('link' => $match[2], 'is_post' => '');
190
- return self::print_fb_data($fb_data);
191
- }
192
- if (isset($vars['v'])) { //is video
193
- $fb_id = $vars['v'];
194
- return self::fb_api_get($fb_id, $match[2], 'video');
195
- }
196
- if (!empty(self::$raw)) {
197
- $raw_photo = self::$raw;
198
- } else {
199
- $raw_photo = get_option('wpemfb_raw_photo') == 'true' ? 'true' : 'false';
200
- }
201
- //photos
202
- if ('photo.php' == $last || (array_search('photos', $clean) !== false)) {
203
- if ($raw_photo == 'true') {
204
- return self::fb_api_get($fb_id, $match[2]);
205
- } else {
206
- $fb_data = array('link' => $match[2], 'is_post' => '');
207
- return self::print_fb_data($fb_data);
208
- }
209
- }
210
- return self::fb_api_get($fb_id, $match[2], $type);
211
- } else {
212
- $return = '';
213
- if(is_super_admin()){
214
- $return .= '<p>'.__('Add Facebook App ID and Secret on admin to make this plugin work.','wp-embed-facebook').'</p>';
215
- $return .= '<p><a href="'.admin_url("options-general.php?page=embedfacebook").'" target="_blank">'.__("WP Embed Facebook Settings","wp-embed-facebook").'</a></p>';
216
- $return .= '<p><a href="https://developers.facebook.com/apps" target="_blank">'.__("Your Facebook Apps","wp-embed-facebook").'</a></p>';
217
- }
218
- $return .= '<p><a href="https://www.facebook.com/'.$match[2].'" target="_blank" rel="nofollow">https://www.facebook.com/'.$match[2].'</a></p>';
219
- return $return;
220
- }
221
-
222
- }
223
- /**
224
- * get data from fb using WP_Embed_FB::$fbsdk->api('/'.$fb_id) :)
225
- *
226
- * @param int facebook id
227
- * @param string facebook url
228
- * @type string type of embed
229
- * @return facebook api resulto or error
230
- */
231
- static function fb_api_get($fb_id, $url, $type=""){
232
- $wp_emb_fbsdk = self::$fbsdk;
233
- try {
234
- if($type == 'album')
235
- $api_string = $fb_id.'?fields=name,id,from,description,photos.fields(name,picture,source).limit('.get_option("wpemfb_max_photos").')';
236
- else
237
- $api_string = $fb_id;
238
-
239
- /**
240
- * Filter the fist fbsdk query
241
- *
242
- * @since 1.9
243
- *
244
- * @param string $api_string The fb api request string according to type
245
- * @param string $fb_id The id of the object being requested.
246
- * @param string $type The detected type of embed
247
- *
248
- */
249
- $fb_data = $wp_emb_fbsdk->api('/v2.3/'.apply_filters('wpemfb_api_string',$api_string,$fb_id,$type));
250
- $num_posts = self::$num_posts !== '' && is_numeric(self::$num_posts) ? self::$num_posts : get_option("wpemfb_max_posts");
251
- $api_string2 = '';
252
- if(isset($fb_data['embed_html']))
253
- $fb_data = array_merge($fb_data,array('is_video' => '1','link'=>$url));
254
- elseif( isset($fb_data['category']) && get_option("wpemfb_show_posts") == "true")
255
- $api_string2 = '/'.$fb_data['id'].'?fields=posts.limit('.$num_posts.'){message,shares,link,picture,object_id,likes.limit(1).summary(true),comments.limit(1).summary(true)}';
256
-
257
- /**
258
- * Filter the second fbsdk query if necessary
259
- *
260
- * @since 1.9
261
- *
262
- * @param string $api_string2 The second request string empty if not necessary
263
- * @param array $fb_data The result from the first query
264
- * @param string $type The detected type of embed
265
- *
266
- */
267
- $api_string2 = apply_filters('wpemfb_2nd_api_string',$api_string2,$fb_data,$type);
268
-
269
- if(!empty($api_string2)){
270
- $extra_data = $wp_emb_fbsdk->api('/v2.3/'.$api_string2);
271
- $fb_data = array_merge($fb_data,$extra_data);
272
- }
273
- /**
274
- * Filter all data received from facebook.
275
- *
276
- * @since 1.9
277
- *
278
- * @param array $fb_data the final result
279
- * @param string $type The detected type of embed
280
- */
281
- $fb_data = apply_filters('wpemfb_fb_data',$fb_data,$type);
282
-
283
- $res = self::print_fb_data($fb_data);
284
- } catch(FacebookApiException $e) {
285
- $res = '<p><a href="https://www.facebook.com/'.$url.'" target="_blank" rel="nofollow">https://www.facebook.com/'.$url.'</a>';
286
- if(is_super_admin()){
287
- $error = $e->getResult();
288
- $res .= '<br><span style="color: #4a0e13">'.__('Error').':&nbsp;'.$error['error']['message'].'</span>';
289
- }
290
- $res .= '</p>';
291
- }
292
- return $res;
293
- }
294
- /**
295
- * find out what kind of data we got from facebook
296
- *
297
- * @param array $fb_data result from facebook
298
- * @return string embedded content
299
- */
300
- static function print_fb_data($fb_data){
301
- if(isset($fb_data['is_video'])) { //is raw video
302
- if (!empty(self::$raw)) {
303
- $raw_video = self::$raw;
304
- } else {
305
- $raw_video = get_option('wpemfb_raw_video') == 'true' ? 'true' : 'false';
306
- }
307
- if ($raw_video == 'true') {
308
- $template = self::locate_template('video');
309
- } else {
310
- $template = self::locate_template('posts');
311
- }
312
- } elseif(isset($fb_data['is_post'])) { //is post
313
- $template = self::locate_template('posts');
314
- } elseif(isset($fb_data['start_time'])) { //is event
315
- $template = self::locate_template('event');
316
- } elseif(isset($fb_data['photos'])) { //is album
317
- $template = self::locate_template('album');
318
- } elseif(isset($fb_data['width'])) { //is raw photo
319
- $template = self::locate_template('photo');
320
- } elseif(isset($fb_data['category'])) { //is page
321
- if(isset($fb_data['is_community_page']) && $fb_data['is_community_page'] == "1" ){
322
- $template = self::locate_template('com-page'); //is community page
323
- }else {
324
- $default = self::locate_template('page');
325
- /**
326
- * Add a new template for a specific facebook category
327
- *
328
- * for example a Museum create the new template at your-theme/plugins/wp-embed-facebook/museum.php
329
- * then on functions.php of your theme
330
- *
331
- * add_filter( 'wpemfb_category_template', 'your_function', 10, 2 );
332
- *
333
- * function your_function( $default, $category ) {
334
- * if($category == 'Museum/art gallery')
335
- * return WP_Embed_FB::locate_template('museum');
336
- * else
337
- * return $default;
338
- * }
339
- *
340
- * @since 1.0
341
- *
342
- * @param string $default file full path
343
- * @param array $fb_data['category'] data from facebook
344
- */
345
- $template = apply_filters('wpemfb_category_template', $default, $fb_data['category']);
346
- }
347
- } else { //is profile
348
- $template = self::locate_template('profile');
349
- }
350
- //get default variables to use on templates
351
- if(empty(self::$width)){
352
- $width = get_option('wpemfb_max_width');
353
- $height = get_option('wpemfb_height');
354
- } else {
355
- $width = self::$width;
356
- $height = self::$height;
357
- }
358
- $prop = get_option('wpemfb_proportions');
359
- ob_start();
360
- //show embed post on admin
361
- if(is_admin() && isset($fb_data['is_post'])) : ?>
362
- <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/es_LA/sdk.js#xfbml=1&version=v2.3"; fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script>
363
- <?php endif;
364
- /**
365
- * Change the file to include on a certain embed.
366
- *
367
- * @since 1.8
368
- *
369
- * @param string $template file full path
370
- * @param array $fb_data data from facebook
371
- */
372
- $template = apply_filters('wpemfb_template',$template,$fb_data);
373
- include( $template );
374
- return preg_replace('/^\s+|\n|\r|\s+$/m', '', ob_get_clean());
375
- }
376
- /**
377
- * Locate the template inside plugin or theme
378
- *
379
- * @param string $template_name Template file name
380
- * @return string Template location
381
- */
382
- static function locate_template($template_name){
383
- $theme = get_option('wpemfb_theme');
384
- $located = locate_template(array('plugins/'.WPEMFBSLUG.'/'.$template_name.'.php'));
385
- $file = 'templates/'.$theme.'/'.$template_name.'.php';
386
- if(empty($located)){
387
- $located = WPEMFBDIR.$file;
388
- }
389
- return $located;
390
- }
391
- /*
392
- * Formatting functions.
393
- */
394
- /**
395
- * If a user has a lot of websites registered on fb this function will only link to the first one
396
- * @param string $urls separated by spaces
397
- * @return string first url
398
- */
399
- static function getwebsite($urls){
400
- $url = explode(' ',$urls);
401
- return $url[0];
402
- }
403
- /**
404
- * Shows a like button or a facebook like count of a page depending on settings
405
- * @param int $fb_id facebook id
406
- * @param int $likes show likes count
407
- * @param bool $share show share button
408
- * @param bool $faces show faces
409
- */
410
- static function like_btn($fb_id,$likes=null,$share=false,$faces=false){
411
- $opt = get_option('wpemfb_show_like');
412
- if($opt === 'true') :
413
- ob_start();
414
- ?>
415
- <div class="fb-like" data-href="https://facebook.com/<?php echo $fb_id ?>" data-layout="button_count" data-action="like" data-show-faces="<?php echo $faces ? 'true' : 'false' ?>" data-share="<?php echo $share ? 'true' : 'false' ?>" >
416
- </div>
417
- <?php
418
- echo ob_get_clean();
419
- return;
420
- else :
421
- printf( __( '%d people like this.', 'wp-embed-facebook' ), $likes );
422
- return;
423
- endif;
424
- }
425
- /**
426
- * Shows a follow button depending on settings
427
- * @param int $fb_id facebook id or username
428
- */
429
- static function follow_btn($fb_id){
430
- $opt = get_option('wpemfb_show_follow');
431
- if($opt === 'true') :
432
- ob_start();
433
- ?>
434
- <div class="fb-follow" data-href="https://www.facebook.com/<?php echo $fb_id ?>" data-colorscheme="light" data-layout="button_count" data-show-faces="false">
435
- </div>
436
- <?php
437
- ob_end_flush();
438
- return;
439
- endif;
440
- }
441
- /**
442
- * Shortcode function
443
- * [facebook='url' width='600'] width is optional
444
- * @param array $atts [0]=>url ['width']=>embed width ['raw']=>for videos and photos
445
- * @return string
446
- */
447
- static function shortcode($atts){
448
- if(!empty($atts) && isset($atts[0])){
449
- $clean = trim($atts[0],'=');
450
- if( is_numeric($clean) )
451
- $url = '<p>https://www.facebook.com/'.$clean.'/</p>';
452
- else
453
- $url = '<p>'.$clean.'</p>';
454
-
455
- if(isset($atts['width'])){
456
- $prop = get_option('wpemfb_proportions');
457
- self::$width = $atts['width'];
458
- self::$height = $prop * $atts['width'];
459
- }
460
- if(isset($atts['raw'])){
461
- self::$raw = $atts['raw'];
462
- }
463
- if(isset($atts['posts'])){
464
- self::$num_posts = $atts['posts'];
465
- }
466
- $embed = self::the_content($url);
467
- self::$height = self::$width = self::$raw = self::$num_posts = '';
468
- return $embed;
469
- }
470
- return '';
471
- }
472
- static function embed_register_handler($match){
473
- return self::fb_embed($match);
474
- }
475
- static function fb_root($ct){
476
- $root = '<div id="fb-root"></div>';
477
- $root .= "\n";
478
- return $root.$ct;
479
- }
480
- }
481
-
482
- /**
483
- * Triggering the FaceInit::init(); will give you access to the fb php sdk on FaceInit::$fbsdk which you can use to make any call shown here
484
- * https://developers.facebook.com/docs/reference/php/
485
- */
486
- class FaceInit {
487
- static $fbsdk = null;
488
- static function init(){
489
- require('fb/facebook.php');
490
- $config = array();
491
- $config['appId'] = get_option('wpemfb_app_id');
492
- $config['secret'] = get_option('wpemfb_app_secret');
493
- $config['fileUpload'] = false; // optional
494
- if($config['appId'] != '0' && $config['secret'] != '0' )
495
- self::$fbsdk = new Sigami_Facebook($config);
496
- else
497
- self::$fbsdk = 'unactive';
498
- }
499
- static function get_fbsdk(){
500
- if(self::$fbsdk == null)
501
- self::init();
502
- return self::$fbsdk;
503
- }
504
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/img/hechoenmexico.png DELETED
Binary file
lib/img/paypal.png DELETED
Binary file
lib/img/taco.png DELETED
Binary file
lib/js/admin.js CHANGED
@@ -1,3 +1,3 @@
1
  jQuery(function() {
2
  jQuery( "#accordion" ).accordion();
3
- });
1
  jQuery(function() {
2
  jQuery( "#accordion" ).accordion();
3
+ });
lib/js/wpembedfb.js CHANGED
@@ -1,16 +1,19 @@
1
  jQuery(document).ready(function() {
2
  resize_cover();
3
- var v_width = jQuery(".wpemfb-container").outerWidth();
4
  jQuery(".fb-post").attr("data-width",v_width+"px");
5
  });
6
  jQuery(window).resize(function(){
7
  resize_cover();
8
  });
9
  function resize_cover(){
10
- var cover = jQuery(".wpemfb-cover");
11
- var v_width = cover.width();
12
- var v_height = 0.368 * v_width;
13
- cover.css("height",v_height );
 
 
 
14
  //console.log(v_height);
15
  //console.log(jQuery(".wpemfb-cover").height());
16
  }
1
  jQuery(document).ready(function() {
2
  resize_cover();
3
+ var v_width = jQuery(".wef-measure").outerWidth();
4
  jQuery(".fb-post").attr("data-width",v_width+"px");
5
  });
6
  jQuery(window).resize(function(){
7
  resize_cover();
8
  });
9
  function resize_cover(){
10
+ jQuery(".wef-measure > .cover").each(function(){
11
+ //console.log(jQuery(one_cover));
12
+ jQuery(this).css("height",0.368 * jQuery(this).width());
13
+ });
14
+ //var v_width = cover.width();
15
+ //var v_height = 0.368 * v_width;
16
+ //cover.css("height",v_height );
17
  //console.log(v_height);
18
  //console.log(jQuery(".wpemfb-cover").height());
19
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: poxtron
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R8Q85GT3Q8Q26
4
  Tags: Facebook, facebook, Social Plugins, embed facebook, facebook video, facebook posts, facebook publication, facebook publications, facebook event, facebook events, facebook pages, facebook page, facebook profiles, facebook album, facebook albums, facebook photos, facebook photo, social,
5
  Requires at least: 3.8.1
6
- Tested up to: 4.3
7
- Stable tag: 1.9.6.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -14,8 +14,6 @@ Embed a Facebook video, page, event, album, photo, profile or post to any WordPr
14
 
15
  Embed any public facebook video, page, post, profile, photo or event directly into a WordPress post, without having to write a single line of code. Simply put the facebook url on a separate line on the content of any post, and this plugin will fetch data associated with that url and display it. If the data is not public, like “invite only” events or private profiles it will return a link.
16
 
17
- **[Demo](http://www.wpembedfb.com/demo/)**
18
-
19
  = Supported Embeds =
20
  * Facebook Videos
21
  * Facebook Albums
@@ -26,29 +24,92 @@ Embed any public facebook video, page, post, profile, photo or event directly in
26
  * Facebook Profiles
27
  * Facebook Publications
28
 
29
- **[Demo](http://www.wpembedfb.com/demo/)**
30
 
31
  = Requirements =
32
- * Facebook App id and Secret
33
 
34
  = How to use it =
35
  Copy the facebook url on a single line.
36
- Or you can use a shortcode `[facebook=url width=200 raw=true]`
37
- width and raw are optional, raw only works for videos and photos.
38
 
39
- = Options =
40
- * Settings -> Embed Facebook.
41
- * Show latest Posts of Fan Page
42
- * Number of photos shown on album embed
43
- * Embed width customization
44
- * Show like buttons on Fan Pages
45
- * Show Follow Button on profile embed
46
- * Remove plugin styles
47
- * Change Theme
48
- * Add fb-root
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
 
50
 
51
- * The information that is shown on your post, is from facebook directly, no images or data are stored on your server.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  == Installation ==
54
 
@@ -56,23 +117,18 @@ width and raw are optional, raw only works for videos and photos.
56
  1. Extract to /wp-content/plugins/ folder, and activate the plugin in /wp-admin/.
57
  1. Create a [facebook app](https://developers.facebook.com/apps).
58
  1. Copy the app id and app secret to the “Embed Facebook” page under the Settings section.
59
- 1. Copy on a single line any facebook url.
60
  1. Enjoy and tell someone !
61
 
62
  == Frequently Asked Questions ==
63
 
64
- = Wny I can only see "Embedded post will show on publish" ? =
65
 
66
- It is possible that another plugin or your theme already has the Facebook SDK for javascript. Disable the enqueue of the script on the advanced options and test, if this does not work create a new thread on the support forum, with a link.
67
 
68
  = Is there a way to embed an album with more than 100 photos ? =
69
 
70
  This is a facebook limitation, will try to work around it.
71
 
72
- = How to change embedded post background =
73
-
74
- The embedded post code comes directly from facebook so there is no easy way to change it (maybe some esoteric javascript). For a moment there posts could be queried on the api but is not working anymore. When it does an update will follow.
75
-
76
  == Screenshots ==
77
 
78
  1. Fan Page Embed
@@ -82,6 +138,15 @@ The embedded post code comes directly from facebook so there is no easy way to c
82
 
83
  == Changelog ==
84
 
 
 
 
 
 
 
 
 
 
85
  = 1.9.6.7 =
86
  * Fixed delete of options on uninstall
87
 
@@ -226,5 +291,5 @@ The embedded post code comes directly from facebook so there is no easy way to c
226
 
227
  == Upgrade Notice ==
228
 
229
- = 1.9.6.7 =
230
- * Fixed delete of options on uninstall
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R8Q85GT3Q8Q26
4
  Tags: Facebook, facebook, Social Plugins, embed facebook, facebook video, facebook posts, facebook publication, facebook publications, facebook event, facebook events, facebook pages, facebook page, facebook profiles, facebook album, facebook albums, facebook photos, facebook photo, social,
5
  Requires at least: 3.8.1
6
+ Tested up to: 4.3.2
7
+ Stable tag: 2.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
14
 
15
  Embed any public facebook video, page, post, profile, photo or event directly into a WordPress post, without having to write a single line of code. Simply put the facebook url on a separate line on the content of any post, and this plugin will fetch data associated with that url and display it. If the data is not public, like “invite only” events or private profiles it will return a link.
16
 
 
 
17
  = Supported Embeds =
18
  * Facebook Videos
19
  * Facebook Albums
24
  * Facebook Profiles
25
  * Facebook Publications
26
 
27
+ **[Live Demo](http://www.wpembedfb.com/demo/)**
28
 
29
  = Requirements =
30
+ * Facebook App Id and Secret you can get them [here](https://developers.facebook.com/apps/)
31
 
32
  = How to use it =
33
  Copy the facebook url on a single line.
 
 
34
 
35
+ You can *override* the general setting for each embed using a shortcode.
36
+
37
+ = Shortcode Examples =
38
+
39
+ Assuming all settings are in their default state.
40
+
41
+ **Videos**
42
+
43
+ * From source using html5 video tag
44
+
45
+ `[facebook=https://www.facebook.com/ArchanNair/videos/10152579879850694 ]`
46
+
47
+ * Use facebook [embedded video](https://developers.facebook.com/docs/plugins/embedded-video-player) plugin
48
+
49
+ `[facebook=https://www.facebook.com/ArchanNair/videos/10152579879850694 social_plugin=true ]`
50
+
51
+ **Pages**
52
+
53
+ * Using default settings
54
+
55
+ `[facebook=https://www.facebook.com/sydneyoperahouse ]`
56
+
57
+ * Changing the number of posts shown
58
+
59
+ `[facebook=https://www.facebook.com/sydneyoperahouse posts=2 ]`
60
+
61
+ * Use facebook [page plugin](https://developers.facebook.com/docs/plugins/page-plugin)
62
+
63
+ `[facebook=https://www.facebook.com/sydneyoperahouse social_plugin=page attributes=adapt_container,show_friends,small_cover,hide_cover,show_posts ]`
64
+
65
+ All attributes are optional and if 'attributes' is not present it will use the default values
66
+
67
+ **Albums**
68
+
69
+ `[facebook=https://www.facebook.com/media/set/?set=a.10151932001713698.1073741831.10883823697 ]`
70
+
71
+ **Events**
72
+
73
+ `[facebook=https://www.facebook.com/events/507909879383103/ ]`
74
+
75
+ **Photos**
76
 
77
+ * Embed the photo as a plain image on your site
78
 
79
+ `[facebook=https://www.facebook.com/ArchanNair/photos/a.10151932001713698.1073741831.10883823697/10153545048758698/]`
80
+
81
+ * Use facebook [embedded post](https://developers.facebook.com/docs/plugins/embedded-posts) plugin
82
+
83
+ `[facebook=https://www.facebook.com/ArchanNair/photos/a.10151932001713698.1073741831.10883823697/10153545048758698/ social_plugin=true ]`
84
+
85
+ **Posts**
86
+
87
+ `[facebook=https://www.facebook.com/radiohead/posts/10152688346467245 ]`
88
+
89
+ * Use facebook [embedded post](https://developers.facebook.com/docs/plugins/embedded-posts) plugin
90
+
91
+ `[facebook=https://www.facebook.com/radiohead/posts/10152688346467245 social_plugin=true ]`
92
+
93
+
94
+ **Profiles**
95
+
96
+ `[facebook=https://www.facebook.com/4 ]`
97
+
98
+ You will need the facebook id of the user to embed the profile.
99
+
100
+ **Changing the width**
101
+
102
+ `[facebook=https://www.facebook.com/sydneyoperahouse width=970 ]`
103
+
104
+ All shortcodes can be affected by the width attribute and it represents the *maximum width* in pixels the embed can be rendered, never the less all embeds are responsive.
105
+
106
+ **Changing the theme**
107
+
108
+ `[facebook=https://www.facebook.com/sydneyoperahouse theme=classic ]`
109
+
110
+ **Embedding a Facebook object_id**
111
+
112
+ `[facebook=507909879383103 ]`
113
 
114
  == Installation ==
115
 
117
  1. Extract to /wp-content/plugins/ folder, and activate the plugin in /wp-admin/.
118
  1. Create a [facebook app](https://developers.facebook.com/apps).
119
  1. Copy the app id and app secret to the “Embed Facebook” page under the Settings section.
 
120
  1. Enjoy and tell someone !
121
 
122
  == Frequently Asked Questions ==
123
 
124
+ = Why is a facebook app needed?
125
 
126
+ All facebook queries to the api need to come from someone so an app is required to tell facebook who did the query
127
 
128
  = Is there a way to embed an album with more than 100 photos ? =
129
 
130
  This is a facebook limitation, will try to work around it.
131
 
 
 
 
 
132
  == Screenshots ==
133
 
134
  1. Fan Page Embed
138
 
139
  == Changelog ==
140
 
141
+ = 2.0 =
142
+ * Fixed language issue when embedding social plugins in admin
143
+ * Fixed time on events
144
+ * Update Facebook API to 2.4
145
+ * Added a new parameters for shortcode 'social_plugin' and 'theme'
146
+ * Fixed shortcode use [facebook=FB_Object_ID ]
147
+ * Improved CSS and themes
148
+ * New Embed Post Raw
149
+
150
  = 1.9.6.7 =
151
  * Fixed delete of options on uninstall
152
 
291
 
292
  == Upgrade Notice ==
293
 
294
+ = 2.0 =
295
+ * Overall Working a LOT Better.
templates/classic/album.php CHANGED
@@ -1,37 +1,36 @@
1
- <?php
2
- /*
3
- * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
- * to access all fb data print_r($fb_data)
5
- */
6
- ?>
7
- <div class="wpemfb-container" >
8
- <div style="max-width: <?php echo $width ?>px;">
9
- <div class="wpemfb-info">
10
- <div class="wpemfb-pic">
11
  <img src="http://graph.facebook.com/<?php echo $fb_data['from']['id'] ?>/picture" />
12
- </div>
13
- <div class="wpemfb-desc">
14
- <h4 class="wpemfb-title" >
15
- <a href="https://facebook.com/<?php echo $fb_data['from']['id'] ?>" target="_blank" rel="nofollow">
16
- <?php echo $fb_data['from']['name'] ?>
17
- </a>
18
- </h4>
19
- <?php if(isset($fb_data['from']['category'])) : ?>
20
- <?php echo $fb_data['from']['category'].'<br>' ?>
21
- <?php endif; ?>
22
- <a href="https://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow"><?php echo $fb_data['name'] ?></a>
23
- </div>
24
  </div>
25
- <p style="text-align: center">
26
- <?php
27
- foreach ($fb_data['photos']['data'] as $pic) {
28
- ?>
29
- <a class="wpemfb-link" href="<?php echo $pic['source'] ?>" data-lightbox="roadtrip" data-title="<?php echo $pic['name'] ?>" >
30
- <img class="wpemfb-thmb" src="<?php echo $pic['picture'] ?>" />
31
- </a>
 
 
 
 
 
 
 
 
32
  <?php
33
- }
34
- ?>
35
- </p>
 
 
 
 
 
 
 
 
36
  </div>
37
  </div>
1
+ <div class="wef-classic" style="max-width: <?php echo $width ?>px">
2
+ <div class="row">
3
+ <div class="col-3 text-center">
4
+ <a href="https://facebook.com/<?php echo $fb_data['from']['id'] ?>" target="_blank" rel="nofollow">
 
 
 
 
 
 
5
  <img src="http://graph.facebook.com/<?php echo $fb_data['from']['id'] ?>/picture" />
6
+ </a>
 
 
 
 
 
 
 
 
 
 
 
7
  </div>
8
+ <div class="col-9 pl-none">
9
+ <a href="https://facebook.com/<?php echo $fb_data['from']['id'] ?>" target="_blank" rel="nofollow">
10
+ <span class="title"><?php echo $fb_data['from']['name'] ?></span>
11
+ </a>
12
+ <br>
13
+ <?php if(isset($fb_data['from']['category'])) : ?>
14
+ <?php echo $fb_data['from']['category'].'<br>' ?>
15
+ <?php endif; ?>
16
+ <a href="https://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow"><?php echo $fb_data['name'] ?></a>
17
+ </div>
18
+ </div>
19
+ <hr>
20
+ <div class="row">
21
+ <div class="col-12 text-center">
22
+ <div class="text-center album-thumbs">
23
  <?php
24
+ foreach ($fb_data['photos']['data'] as $pic) {
25
+ $data_title = isset($pic['name']) ? $pic['name'] : $fb_data['from']['name'];
26
+ ?>
27
+ <a class="road-trip" href="<?php echo $pic['source'] ?>" data-lightbox="roadtrip" data-title="<?php echo esc_attr(wp_rel_nofollow(make_clickable($data_title))) ?>" >
28
+ <img class="thumbnail" src="<?php echo $pic['picture'] ?>" />
29
+ </a>
30
+ <?php
31
+ }
32
+ ?>
33
+ </div>
34
+ </div>
35
  </div>
36
  </div>
templates/classic/classic.css ADDED
@@ -0,0 +1 @@
 
1
+ .wef-classic{font:300 14px/20px Helvetica;padding:10px;display:inline-block;border-width:1px;border-style:solid;border-color:#23487f;width:100%;background-color:#fff}.wef-classic .row{margin-left:-10px;margin-right:-10px;display:table;width:100%}.wef-classic .col-1,.wef-classic .col-2,.wef-classic .col-3,.wef-classic .col-4,.wef-classic .col-5,.wef-classic .col-6,.wef-classic .col-7,.wef-classic .col-8,.wef-classic .col-9,.wef-classic .col-10,.wef-classic .col-11,.wef-classic .col-12{position:relative;min-height:1px;padding-left:10px;padding-right:10px;display:table-cell;vertical-align:middle;text-align:left}.wef-classic .col-12{width:100%}.wef-classic .col-11{width:91.66667%}.wef-classic .col-10{width:83.33333%}.wef-classic .col-9{width:75%}.wef-classic .col-8{width:66.66667%}.wef-classic .col-7{width:58.33333%}.wef-classic .col-6{width:50%}.wef-classic .col-5{width:41.66667%}.wef-classic .col-4{width:33.33333%}.wef-classic .col-3{width:25%}.wef-classic .col-2{width:16.66667%}.wef-classic .col-1{width:8.33333%}.wef-classic hr{margin-top:10px !important;margin-bottom:10px !important;margin-left:0 !important;margin-right:0 !important;float:none !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.icon{float:right;box-shadow:none;margin:0;padding:0;display:block}.wef-classic img.thumbnail{border:1px solid gray;border-radius:2px;height:60px !important;margin:1px;padding:2px;width:60px !important}.wef-classic .album-thumbs{line-height:1px !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}.wef-classic a:focus,.wef-classic a:hover{color:#23487f;text-decoration:underline !important}.wef-classic a.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}.wef-classic p{font:300 14px/20px Helvetica;padding:0 !important;margin:0 !important}.wef-classic p.post-time{font-style:italic;color:#8e8c8d;font-size:12px}.wef-classic p.caption-title{font-size:12px;font-weight:bold}.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 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 .post-link{border-width:1px;border-style:solid;border-color:#d0d0d0}.wef-classic .post-link p{padding-left:10px !important;padding-right:10px !important}.wef-classic .text-center{text-align:center}.wef-classic .pl-none{padding-left:0 !important;word-break:break-all}.wef-classic .color{color:#23487f}.wef-classic .bold{font-weight:bold !important}.wef-classic .title{font-size:20px !important;font-weight:bold !important;word-break:break-all}.wef-classic .cover{width:100%;background-size:100%}.wef-classic .pad-top{padding-top:5px}.wef-classic .page-post{left:2.6% !important}.wef-classic .caption-description p{color:#8e8c8d !important;font-style:italic !important;font-size:12px !important}.wef-classic .video{position:relative;display:block;height:0;padding:0 0 56.25%;overflow:hidden}.wef-classic .video iframe,.wef-classic .video embed,.wef-classic .video object,.wef-classic .video video{position:absolute;top:0;left:0;bottom:0;height:100%;width:100%;border:0;margin:0;padding:0}.wef-classic .wef-measure{width:100%}.wef-classic .break-all{word-break:break-all}
templates/classic/classic.sass ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wef-classic
2
+ font: 300 14px/20px Helvetica
3
+ padding: 10px
4
+ display: inline-block
5
+ border:
6
+ width: 1px
7
+ style: solid
8
+ color: #23487F
9
+ width: 100%
10
+ background-color: #FFFFFF
11
+ .row
12
+ margin:
13
+ left: -10px
14
+ right: -10px
15
+ display: table
16
+ width: 100%
17
+ .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12
18
+ /* float: left */
19
+ position: relative
20
+ min-height: 1px
21
+ padding:
22
+ left: 10px
23
+ right: 10px
24
+ display: table-cell
25
+ vertical-align: middle
26
+ text-align: left
27
+ .col-12
28
+ width: 100%
29
+ .col-11
30
+ width: 91.66666667%
31
+ .col-10
32
+ width: 83.33333333%
33
+ .col-9
34
+ width: 75%
35
+ .col-8
36
+ width: 66.66666667%
37
+ .col-7
38
+ width: 58.33333333%
39
+ .col-6
40
+ width: 50%
41
+ .col-5
42
+ width: 41.66666667%
43
+ .col-4
44
+ width: 33.33333333%
45
+ .col-3
46
+ width: 25%
47
+ .col-2
48
+ width: 16.66666667%
49
+ .col-1
50
+ width: 8.33333333%
51
+ hr
52
+ margin:
53
+ top: 10px !important
54
+ bottom: 10px !important
55
+ left: 0 !important
56
+ right: 0 !important
57
+ float: none !important
58
+ border:
59
+ top: 1px
60
+ style: solid
61
+ color: #23487F
62
+ -moz-box-sizing: content-box
63
+ -webkit-box-sizing: content-box
64
+ box-sizing: content-box
65
+ height: 0 !important
66
+ width: 100% !important
67
+ img.icon
68
+ float: right
69
+ box-shadow: none
70
+ margin: 0
71
+ padding: 0
72
+ display: block
73
+ img.thumbnail
74
+ border: 1px solid #808080
75
+ border-radius: 2px
76
+ height: 60px !important
77
+ margin: 1px
78
+ padding: 2px
79
+ width: 60px !important
80
+ .album-thumbs
81
+ line-height: 1px !important
82
+ //padding-left: 5.3% !important
83
+ a
84
+ font: 300 14px/20px Helvetica
85
+ color: #23487F !important
86
+ text-decoration: none !important
87
+ border: 0 !important
88
+ margin: 0 !important
89
+ padding: 0 !important
90
+ &:focus, &:hover
91
+ color: #23487F
92
+ text-decoration: underline !important
93
+ &.post-likes
94
+ color: #6d84b4 !important
95
+ font-size: 12px !important
96
+ &.road-trip
97
+ width: 0 !important
98
+ height: 0 !important
99
+ img
100
+ display: inline-block !important
101
+ p
102
+ font: 300 14px/20px Helvetica
103
+ padding: 0 !important
104
+ margin: 0 !important
105
+ &.post-time
106
+ font-style: italic
107
+ color: #8e8c8d
108
+ font-size: 12px
109
+ &.caption-title
110
+ font-size: 12px
111
+ font-weight: bold
112
+ &.caption-link
113
+ text-align: right
114
+ word-break: break-all
115
+ a
116
+ font-size: 12px
117
+ color: #8e8c8d !important
118
+ text-transform: uppercase
119
+ iframe, embed, object, video, audio
120
+ width: 100% !important
121
+ border: 0 !important
122
+ margin: 0 !important
123
+ padding: 0 !important
124
+ .post-link
125
+ border:
126
+ width: 1px
127
+ style: solid
128
+ color: #d0d0d0
129
+ p
130
+ padding:
131
+ left: 10px !important
132
+ right: 10px !important
133
+ .text-center
134
+ text-align: center
135
+ .pl-none
136
+ padding-left: 0 !important
137
+ word-break: break-all
138
+ .color
139
+ color: #23487F
140
+ .bold
141
+ font-weight: bold !important
142
+ .title
143
+ font-size: 20px !important
144
+ font-weight: bold !important
145
+ word-break: break-all
146
+ .cover
147
+ width: 100%
148
+ background-size: 100%
149
+ .pad-top
150
+ padding:
151
+ top: 5px
152
+ .page-post
153
+ left: 2.6% !important
154
+ .caption-description p
155
+ color: #8e8c8d !important
156
+ font-style: italic !important
157
+ font-size: 12px !important
158
+ .video
159
+ position: relative
160
+ display: block
161
+ height: 0
162
+ padding: 0 0 56.25%
163
+ overflow: hidden
164
+ iframe, embed, object, video
165
+ position: absolute
166
+ top: 0
167
+ left: 0
168
+ bottom: 0
169
+ height: 100%
170
+ width: 100%
171
+ border: 0
172
+ margin: 0
173
+ padding: 0
174
+ .wef-measure
175
+ width: 100%
176
+ .break-all
177
+ word-break: break-all
templates/classic/com-page.php CHANGED
@@ -1,25 +1,31 @@
1
- <?php
2
- /*
3
- * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
- * to access all fb data print_r($fb_data)
5
- */
6
- ?>
7
- <div class="wpemfb-container" style="min-width:<?php echo $width ?>px">
8
- <div class="wpemfb-info" style="width: <?php echo $width ?>">
9
- <div class="wpemfb-pic">
10
- <a href="http://facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
11
  <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
12
- </a>
13
  </div>
14
- <div class="wpemfb-desc">
15
- <h4 class="wpemfb-title" >
16
- <a href="http://facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
17
- <?php echo $fb_data['name'] ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  </a>
19
- </h4>
20
- <?php WP_Embed_FB::like_btn($fb_data['id'],$fb_data['likes']) ?><br>
21
- <?php echo isset($fb_data["website"]) ? WP_Embed_FB::getwebsite($fb_data["website"]) : ""; ?>
22
  </div>
23
  </div>
24
  </div>
25
-
1
+ <div class="wef-classic" style="max-width: <?php echo $width ?>px">
2
+ <div class="row">
3
+ <div class="col-3 text-center">
4
+ <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
 
 
 
 
 
 
5
  <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
6
+ </a>
7
  </div>
8
+ <div class="col-9 pl-none">
9
+ <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
10
+ <span class="title"><?php echo $fb_data['name'] ?></span>
11
+ </a>
12
+ <br>
13
+ <div>
14
+ <?php
15
+ $opt = get_option('wpemfb_show_like');
16
+ if($opt === 'true') :
17
+ echo WEF_Social_Plugins::like_btn('https://www.facebook.com/'.$fb_data['id'],array('share'=>'true','layout'=>'button_count'));
18
+ else :
19
+ printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_data['likes'] );
20
+ endif;
21
+ ?>
22
+ </div>
23
+ <?php if(isset($fb_data["website"])) : ?>
24
+ <br>
25
+ <a href="<?php echo WP_Embed_FB::getwebsite($fb_data["website"]) ?>" title="<?php _e('Web Site', 'wp-embed-facebook') ?>" target="_blank">
26
+ <?php _e('Web Site','wp-embed-facebook') ?>
27
  </a>
28
+ <?php endif; ?>
 
 
29
  </div>
30
  </div>
31
  </div>
 
templates/classic/event.php CHANGED
@@ -1,40 +1,35 @@
1
  <?php
2
- /*
3
- * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
- * to access all fb data print_r($fb_data)
5
- */
6
- ?>
7
- <?php
8
- $start_time_format = 'l, j F Y g:s a';
9
- $start_time = strtotime($fb_data['start_time']);
10
- if (get_option('wpemfb_ev_local_tz', 'true') == 'true') {
11
- $start_time = $start_time + get_option('gmt_offset') * 3600; //shows event date on local time
12
  }
 
 
 
13
  ?>
14
- <div class="wpemfb-container" style="min-width:<?php echo $width ?>px">
15
-
16
- <div class="wpemfb-info">
17
- <div class="wpemfb-pic">
18
- <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
19
- <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
20
- </a>
21
- </div>
22
- <div class="wpemfb-desc">
23
- <h4 class="wpemfb-title" >
24
- <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
25
- <?php echo $fb_data['name'] ?>
26
- </a>
27
- </h4>
28
- <?php echo date_i18n($start_time_format, $start_time) ?><br>
29
- <?php
30
- if(isset($fb_data['place']['id'])){
31
- echo '<a href="http://www.facebook.com/'.$fb_data['place']['id'].'" target="_blank">'.$fb_data['location'].'</a>';
32
- } else {
33
- echo isset($fb_data['place']['name']) ? __('@ ', 'wp-embed-facebook') . $fb_data['place']['name'] : '';
34
- }
35
- ?>
36
- <br>
37
- <?php echo __('Creator: ', 'wp-embed-facebook').'<a href="http://www.facebook.com/'.$fb_data['owner']['id'].'" target="_blank">'.$fb_data['owner']['name'].'</a>' ?>
38
- </div>
39
- </div>
40
  </div>
1
  <?php
2
+ $height = $width * $prop;
3
+ $start_time_format = 'l, j F Y g:i a';
4
+ $old_time_zone = date_default_timezone_get();
5
+ if(get_option('wpemfb_ev_local_tz') == 'true'){
6
+ $timezone = get_option( 'timezone_string' );
7
+ } else {
8
+ $timezone = isset( $fb_data['timezone'] ) ? $fb_data['timezone'] : get_option( 'timezone_string' );
 
 
 
9
  }
10
+ date_default_timezone_set( $timezone );
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 wef-measure" style="max-width: <?php echo $width ?>px">
15
+ <div class="cover" style="height:<?php echo $height ?>px; background-image: url('<?php echo $fb_data['cover']['source'] ?>'); background-position: 0% <?php echo $fb_data['cover']['offset_y'] ?>%;" onclick="window.open('http://www.facebook.com/<?php echo $fb_data['id'] ?>', '_blank')" ></div>
16
+ <div class="row pad-top">
17
+ <div class="col-12">
18
+ <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
19
+ <span class="title"><?php echo $fb_data['name'] ?></span>
20
+ </a>
21
+ <p><?php echo $start_time ?></p>
22
+ <p>
23
+ <?php
24
+ if ( isset( $fb_data['place']['id'] ) ) {
25
+ _e( '@ ', 'wp-embed-facebook' );
26
+ echo '<a href="http://www.facebook.com/' . $fb_data['place']['id'] . '" target="_blank">' . $fb_data['place']['name'] . '</a>';
27
+ } else {
28
+ echo isset( $fb_data['place']['name'] ) ? __( '@ ', 'wp-embed-facebook' ) . $fb_data['place']['name'] : '';
29
+ }
30
+ ?>
31
+ </p>
32
+ <p><?php echo __( 'Creator: ', 'wp-embed-facebook' ) . '<a href="http://www.facebook.com/' . $fb_data['owner']['id'] . '" target="_blank">' . $fb_data['owner']['name'] . '</a>' ?></p>
33
+ </div>
34
+ </div>
 
 
 
 
 
35
  </div>
templates/classic/page.php CHANGED
@@ -1,55 +1,49 @@
1
  <?php
2
- /*
3
- * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
- * to access all fb data print_r($fb_data)
5
- */
6
  $show_posts = get_option("wpemfb_show_posts") == "true" ? true : false;
7
  ?>
8
- <div class="wpemfb-container" style="width:<?php echo $width ?>px; margin-left: auto; margin-right: auto; ">
9
- <div class="wpemfb-cover" style="height:<?php echo $height ?>px; width:<?php echo $width?>px; background-image: url(<?php echo $fb_data['cover']['source'] ?>); background-position: 0 <?php echo $fb_data['cover']['offset_y'] ?>%; "></div>
10
- <div class="wpemfb-info">
11
- <div class="wpemfb-pic">
12
- <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
13
- <img class="wpemfb-thmb-profile" src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
14
- </a>
15
- </div>
16
- <div class="wpemfb-desc">
17
- <h4 class="wpemfb-title" >
18
  <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
19
- <?php echo $fb_data['name'] ?>
 
 
 
 
 
20
  </a>
21
- </h4>
22
- <?php
23
- if($fb_data['category'] == 'Musician/band'){
24
- echo isset($fb_data['genre']) ? $fb_data['genre'].'<br>' : '';
25
- } else {
26
- _e($fb_data['category'],'wp-embed-facebook');
27
- }
28
- ?><br>
29
- <?php WP_Embed_FB::like_btn($fb_data['id'],$fb_data['likes']) ?><br>
30
- <?php echo isset($fb_data["website"]) ? WP_Embed_FB::getwebsite($fb_data["website"]) : ""; ?>
31
- </div>
32
- </div>
33
- <?php if($show_posts) : ?>
34
- <br>
35
- <?php foreach($fb_data['posts']['data'] as $fbpost) : ?>
36
- <?php $link = explode("_", $fbpost['id']) ?>
37
- <div class="wpemfb-posts-container" onclick="window.open('<?php echo "https://www.facebook.com/".$link[0]."/posts/".$link[1] ?>', '_blank')">
38
- <?php if(isset($fbpost['picture'])) : ?>
39
- <div class="wpemfb-post-image">
40
- <img src="<?php echo $fbpost['picture'] ?>" />
41
- </div>
42
- <?php endif; ?>
43
- <div class="wpemfb-post-message" style=" width:<?php echo isset($fbpost['picture']) ? "69%" : "100%" ?>;">
44
- <p><?php echo $fbpost['message'] ?></p>
45
- <p class="wpemfb-likes">
46
- <?php echo isset($fbpost['likes']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y6/r/l9Fe9Ugss0S.gif" />'.$fbpost['likes']['summary']['total_count'].' ' : "" ?>
47
- <?php echo isset($fbpost['comments']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yg/r/V8Yrm0eKZpi.gif" />'.$fbpost['comments']['summary']['total_count'].' ' : "" ?>
48
- <?php echo isset($fbpost['shares']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y2/r/o19N6EzzbUm.png" />'.$fbpost['shares']['count'].' ' : "" ?>
49
- </p>
50
- </div>
51
- </div>
52
- <?php //print_r($fbpost) ?>
53
- <?php endforeach; ?>
54
- <?php endif; ?>
55
- </div>
1
  <?php
2
+ $height = round((($width - 21 ) * $prop),2);
 
 
 
3
  $show_posts = get_option("wpemfb_show_posts") == "true" ? true : false;
4
  ?>
5
+ <div class="wef-classic wef-measure" style="max-width: <?php echo $width ?>px" >
6
+ <div class="cover" style="height:<?php echo $height ?>px; background-image: url('<?php echo $fb_data['cover']['source'] ?>'); background-position: 0 <?php echo $fb_data['cover']['offset_y'] ?>%; cursor: pointer" onclick="window.open('<?php echo $fb_data['link'] ?>', '_blank')" ></div>
7
+ <div class="row pad-top">
8
+ <div class="col-2 text-center">
 
 
 
 
 
 
9
  <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
10
+ <img src="<?php echo $fb_data['picture']['data']['url'] ?>" width="50px" height="50px" />
11
+ </a>
12
+ </div>
13
+ <div class="col-10 pl-none">
14
+ <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
15
+ <span class="title"><?php echo $fb_data['name'] ?></span>
16
  </a>
17
+ <br>
18
+ <?php
19
+ if($fb_data['category'] == 'Musician/band'){
20
+ echo isset($fb_data['genre']) ? $fb_data['genre'] : '';
21
+ } else {
22
+ _e($fb_data['category'],'wp-embed-facebook');
23
+ }
24
+ ?><br>
25
+ <?php if(isset($fb_data["website"])) : ?>
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 style="float: right;">
31
+ <?php
32
+ $opt = get_option('wpemfb_show_like');
33
+ if($opt === 'true') :
34
+ echo WEF_Social_Plugins::like_btn('https://www.facebook.com/'.$fb_data['id'],array('share'=>'true','layout'=>'button_count'));
35
+ else :
36
+ printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_data['likes'] );
37
+ endif;
38
+ ?>
39
+ </div>
40
+ </div>
41
+ </div>
42
+ <?php if($show_posts && isset($fb_data['posts'])) : global $wp_embed; ?>
43
+ <?php foreach($fb_data['posts']['data'] as $fb_post) : ?>
44
+ <?php if(isset($fb_post['picture']) || isset($fb_post['message'])) : ?>
45
+ <?php include('single-post.php') ?>
46
+ <?php endif; ?>
47
+ <?php endforeach; ?>
48
+ <?php endif; ?>
49
+ </div>
 
 
templates/classic/photo.php CHANGED
@@ -1,11 +1,9 @@
1
- <?php
2
- /*
3
- * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
- * to access all fb data print_r($fb_data)
5
- */
6
- $width = $width - 20;
7
- $height = $width * $prop;
8
- ?>
9
- <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
10
- <img src="<?php echo $fb_data['source'] ?>" width="<?php echo $width ?>px" height="auto" style="max-width: <?php echo $width ?>px" />
11
- </a>
1
+ <div class="wef-classic" style="max-width: <?php echo $width ?>px" >
2
+ <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
3
+ <img src="<?php echo $fb_data['source'] ?>" width="100%" height="auto" >
4
+ </a>
5
+ <a class="post-link" href="<?php echo $fb_data['link'] ?> " target="_blank" rel="nofollow">
6
+ <?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'].' ' : "" ?>
7
+ <?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'].' ' : "" ?>
8
+ </a>
9
+ </div>
 
 
templates/classic/post.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $fb_post = $fb_data ?>
2
+ <div class="wef-classic" style="max-width: <?php echo $width ?>px" >
3
+ <div class="col-3 text-center">
4
+ <a href="http://www.facebook.com/<?php echo $fb_post['from']['id'] ?>" target="_blank" rel="nofollow">
5
+ <img src="http://graph.facebook.com/<?php echo $fb_post['from']['id'] ?>/picture" width="50px" height="50px" />
6
+ </a>
7
+ </div>
8
+ <div class="col-9 pl-none">
9
+ <p>
10
+ <a href="http://www.facebook.com/<?php echo $fb_post['from']['id'] ?>" target="_blank" rel="nofollow">
11
+ <span class="title"><?php echo $fb_post['from']['name'] ?></span>
12
+ </a>
13
+ </p>
14
+ <div>
15
+ <?php
16
+ $opt = get_option('wpemfb_show_like');
17
+ if($opt === 'true') :
18
+ echo WEF_Social_Plugins::like_btn($fb_post['link'],array('share'=>'true','layout'=>'button_count'));
19
+ else :
20
+ printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_post['likes'] );
21
+ endif;
22
+ ?>
23
+ </div>
24
+ </div>
25
+ <?php if(isset($fb_post['picture']) || isset($fb_post['message'])) : ?>
26
+ <?php
27
+ global $wp_embed;
28
+ include('single-post.php');
29
+ ?>
30
+ <?php endif; ?>
31
+ </div>
templates/classic/posts.php DELETED
@@ -1,2 +0,0 @@
1
- <div class="fb-post" data-href="https://www.facebook.com/<?php echo $fb_data['link'] ?>" data-width="<?php echo $width ?>">
2
- </div>
 
 
templates/classic/profile.php CHANGED
@@ -1,24 +1,25 @@
1
- <?php
2
- /*
3
- * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
- * to access all fb data print_r($fb_data)
5
- */
6
- ?>
7
- <div class="wpemfb-container" style="min-width:<?php echo $width ?>px">
8
- <div class="wpemfb-info">
9
- <div class="wpemfb-pic">
10
- <a href="http://facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
11
- <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
12
- </a>
13
- </div>
14
- <div class="wpemfb-desc">
15
- <h4 class="wpemfb-title" >
16
- <a href="http://facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
17
- <?php echo $fb_data['name'] ?>
18
- </a><br>
19
- <?php WP_Embed_FB::follow_btn($fb_data['id']) ?>
20
- </h4>
21
- </div>
22
- </div>
 
23
  </div>
24
 
1
+ <div class="wef-classic" style="max-width: <?php echo $width ?>px">
2
+ <div class="row">
3
+ <div class="col-3 text-center">
4
+ <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
5
+ <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
6
+ </a>
7
+ </div>
8
+ <div class="col-9 pl-none">
9
+ <p>
10
+ <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
11
+ <span class="title"><?php echo $fb_data['name'] ?></span>
12
+ </a>
13
+ </p>
14
+ <div>
15
+ <?php
16
+ $opt = get_option('wpemfb_show_follow');
17
+ if($opt === 'true') :
18
+ WEF_Social_Plugins::follow_btn('https://www.facebook.com/'.$fb_data['id']);
19
+ endif;
20
+ ?>
21
+ </div>
22
+ </div>
23
+ </div>
24
  </div>
25
 
templates/classic/single-post.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $fb_post['link'] = isset($fb_post['link']) ? $fb_post['link'] : '';
3
+ $link = explode("_", $fb_post['id']);
4
+ $picture_link = isset($fb_post['link']) ? $fb_post['link'] : "https://www.facebook.com/".$link[0]."/posts/".$link[1];
5
+ $message = null;
6
+ $description = isset($fb_post['description']) && !empty($fb_post['description']) ? WP_Embed_FB::make_clickable($fb_post['description']) : null ;
7
+ $caption = isset($fb_post['caption']) && !empty($fb_post['caption']) ? $fb_post['caption'] : null ;
8
+ $name = isset($fb_post['name']) && !empty($fb_post['name']) ? $fb_post['name'] : null ;
9
+ $is_fb_link = strpos($fb_post['link'],'facebook.com') !== false;
10
+ $video_ratio = (get_option('wpemfb_video_ratio') == 'true') ? true : false;
11
+ if(isset($fb_post['message']) && !empty($fb_post['message'])) :
12
+ $message = str_replace($fb_post['link'],'',$fb_post['message']);
13
+ $message = WP_Embed_FB::make_clickable($message);
14
+ endif;
15
+ $name = $name ? '<p class="caption-title">'.$name.'</p>':'';
16
+ $description = $description ? '<div class="caption-description">'.$description.'</div>':'';
17
+ $caption = $caption ? '<p class="caption-link"><a href="'.$fb_post["link"].'" rel="nofollow">'.$caption.'</a></p>':'';
18
+ $link_info = $name.$description.$caption;
19
+ $icon = isset($fb_post["icon"]) ? '<img class="icon" src="'.$fb_post["icon"].'">' : '';
20
+ $old_time_zone = date_default_timezone_get();
21
+ date_default_timezone_set(get_option('timezone_string'));
22
+ $post_time = $icon.date_i18n('l, j F Y g:s a', strtotime($fb_post['created_time'])) ;
23
+ date_default_timezone_set($old_time_zone);
24
+ ?>
25
+ <hr>
26
+ <div class="row">
27
+ <div class="col-12 page-post">
28
+ <?php //echo '<pre>'.wpautop(print_r($fb_post,true)).'</pre>'; ?>
29
+ <?php echo isset($fb_post['story']) ? '<p>'.$fb_post['story'].'</p>' : '';?>
30
+ <p class="post-time" ><?php echo $post_time ?></p>
31
+ <?php
32
+ switch($fb_post["type"]) :
33
+ case 'video':
34
+ echo $message ? '<p>'.$message.'</p>':'';
35
+ if($is_fb_link){
36
+ $raw = WP_Embed_FB::$raw;
37
+ $width_r = WP_Embed_FB::$width;
38
+ WP_Embed_FB::$raw = true;
39
+ WP_Embed_FB::$width = $width-40;
40
+ echo $wp_embed->shortcode(array('src'=>$fb_post['link']));
41
+ WP_Embed_FB::$raw = $raw;
42
+ WP_Embed_FB::$width = $width_r;
43
+ echo $link_info;
44
+ } else {
45
+ $use_ratio = (get_option('wpemfb_video_ratio') == 'true');
46
+ echo '<div class="post-link">';
47
+ echo $use_ratio ? '<div class="video">' : '';
48
+ echo $wp_embed->shortcode(array('src'=>$fb_post['link'], 'width'=>$width - 20));
49
+ echo $use_ratio ? '</div>' : '';
50
+ echo $link_info;
51
+ echo '</div>';
52
+ }
53
+ break;
54
+ case 'event':
55
+ echo $message ? '<p>'.$message.'</p>':'';
56
+ WP_Embed_FB::$width = $width-40;
57
+ echo $wp_embed->shortcode(array('src'=>$fb_post['link']));
58
+ WP_Embed_FB::$width = $width;
59
+ break;
60
+ case 'photo':
61
+ ?>
62
+ <a href="<?php echo "https://www.facebook.com/".$link[0]."/posts/".$link[1] ?>" rel="nofollow" target="_blank">
63
+ <img src="<?php echo $fb_post['full_picture'] ?>" width="100%" height="auto" /><br>
64
+ </a>
65
+ <?php echo $description; ?>
66
+ <?php
67
+ break;
68
+ case 'status':
69
+ echo $message ? '<p>'.$message.'</p>':'';
70
+ break;
71
+ case 'music':
72
+ case 'link':
73
+ echo $message ? '<p>'.$message.'</p>':'';
74
+ ?>
75
+ <div class="post-link" style="max-width: <?php echo $width?>px;">
76
+ <a href="<?php echo $fb_post['link'] ?>" rel="nofollow" target="_blank">
77
+ <img src="<?php echo $fb_post['full_picture'] ?>" width="100%" height="auto" /><br>
78
+ </a>
79
+ <?php if($type == 'music') : ?>
80
+ <p>
81
+ <audio controls>
82
+ <source src="<?php echo $fb_post['source'] ?>" type="audio/mpeg">
83
+ </audio>
84
+ </p>
85
+ <?php endif ?>
86
+ <?php echo $link_info; ?>
87
+ </div>
88
+ <?php
89
+ break;
90
+ default:
91
+ echo $message ? '<p>'.$message.'</p>':'';
92
+ ?>
93
+ <a href="<?php echo $fb_post['link'] ?>" rel="nofollow" target="_blank">
94
+ <img src="<?php echo $fb_post['full_picture'] ?>" width="100%" height="auto" /><br>
95
+ </a>
96
+ <?php echo $link_info; ?>
97
+ <?php
98
+ break;
99
+ endswitch;
100
+ ?>
101
+ <a class="post-likes" href="<?php echo "https://www.facebook.com/".$link[0]."/posts/".$link[1] ?> " target="_blank" rel="nofollow">
102
+ <?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'].' ' : "" ?>
103
+ <?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'].' ' : "" ?>
104
+ <?php echo isset($fb_post['shares']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y2/r/o19N6EzzbUm.png" />'.$fb_post['shares']['count'].' ' : "" ?>
105
+ </a>
106
+ </div>
107
+ </div>
templates/classic/social-plugin.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wef-measure" style="max-width: <?php echo $width ?>px;"></div>
2
+ <?php
3
+ switch($type){
4
+ case 'page' :
5
+ echo WEF_Social_Plugins::page_plugin('https://www.facebook.com/'.$fb_data['link'],$width);
6
+ break;
7
+ case 'video' :
8
+ if(get_option('wpemfb_video_as_post','false') == 'true')
9
+ echo WEF_Social_Plugins::embedded_post('https://www.facebook.com/'.$fb_data['link'],$width);
10
+ else
11
+ echo WEF_Social_Plugins::embedded_video('https://www.facebook.com/'.$fb_data['link'],$width);
12
+ break;
13
+ //case 'photo' :
14
+ //case 'post' :
15
+ default:
16
+ echo WEF_Social_Plugins::embedded_post('https://www.facebook.com/'.$fb_data['link'],$width);
17
+ break;
18
+ }
templates/classic/video.php CHANGED
@@ -1,12 +1,8 @@
1
  <?php
2
- /*
3
- * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
- * to access all fb data print_r($fb_data)
5
- *
6
- */
7
  ?>
8
- <div style="width: <?php echo $width ?>px">
9
- <div class="wpemfb-video">
10
  <?php
11
  $url = $fb_data['source'];
12
  $file_array = explode('/',parse_url($url, PHP_URL_PATH));
@@ -14,6 +10,7 @@
14
  $type_array = explode('.',$file);
15
  $type = end($type_array);
16
  $clean_type = strtolower($type);
 
17
  if( get_option('wpemfb_raw_video_fb') == 'false' && $clean_type == 'mp4' ) : ?>
18
  <?php $end = isset($fb_data['format']) ? end($fb_data['format']) : $fb_data; ?>
19
 
@@ -28,5 +25,5 @@
28
  </div>
29
 
30
  <?php endif; ?>
31
- </div>
32
  </div>
1
  <?php
2
+ $use_ratio = (get_option('wpemfb_video_ratio') == 'true');
 
 
 
 
3
  ?>
4
+ <div class="wef-classic" style="max-width: <?php echo $width ?>px">
5
+ <?php echo $use_ratio ? '<div class="video">' : '' ?>
6
  <?php
7
  $url = $fb_data['source'];
8
  $file_array = explode('/',parse_url($url, PHP_URL_PATH));
10
  $type_array = explode('.',$file);
11
  $type = end($type_array);
12
  $clean_type = strtolower($type);
13
+
14
  if( get_option('wpemfb_raw_video_fb') == 'false' && $clean_type == 'mp4' ) : ?>
15
  <?php $end = isset($fb_data['format']) ? end($fb_data['format']) : $fb_data; ?>
16
 
25
  </div>
26
 
27
  <?php endif; ?>
28
+ <?php echo $use_ratio ? '</div>' : '' ?>
29
  </div>
templates/classic/wpemfb.css DELETED
@@ -1,113 +0,0 @@
1
- .wpemfb-container{
2
- margin-top:5px;
3
- border: 1px solid #23487E;
4
- border-radius: 2px;
5
- box-shadow: 2px 2px 3px #1A3151;
6
- display: inline-table;
7
- height: auto;
8
- margin-left: auto ;
9
- margin-right: auto ;
10
- }
11
- .wpemfb-page-container{
12
- margin-top:5px;
13
- border: 1px solid #23487E;
14
- border-radius: 2px;
15
- box-shadow: 2px 2px 3px #1A3151;
16
- display: inline-table;
17
- height: auto;
18
- margin-left: auto ;
19
- margin-right: auto ;
20
- width: 100%;
21
- }
22
- .wpemfb-cover{
23
- width: 100%;
24
- background-size: 100%;
25
- }
26
- .wpemfb-info a {
27
- color: #23487E;
28
- text-decoration: none !important;
29
- }
30
- .wpemfb-info a:hover {
31
- color: #23487E;
32
- text-decoration: underline !important;
33
- }
34
- .wpemfb-title{
35
- padding: 0 !important;
36
- margin: 0 !important;
37
- }
38
- .wpemfb-pic{
39
- display: table-cell;
40
- vertical-align: middle;
41
- margin: 0;
42
- padding: 5px;
43
- width: 10%;
44
- }
45
- .wpemfb-desc{
46
- display: table-cell;
47
- vertical-align: middle;
48
- }
49
- img.wpemfb-thmb {
50
- border: 1px solid #808080;
51
- height: 60px !important;
52
- margin: 1px;
53
- padding: 2px;
54
- width: 60px !important;
55
- }
56
- .wpemfb-link{
57
- text-decoration: none !important;
58
- }
59
-
60
- .wpemfb-posts-container{
61
- margin:0 auto;
62
- width:100% !important;
63
- border-top: 1px solid whitesmoke;
64
- padding: 3px 0;
65
- display: table;
66
- cursor: pointer;
67
- }
68
- .wpemfb-post-message{
69
- float:left;
70
- padding-left: 3px;
71
- text-align: justify;
72
- margin:0;
73
- }
74
- .wpemfb-post-image{
75
- float:left;
76
- margin:0;
77
- width:30%;
78
- text-align: center;
79
- }
80
- .wpemfb-likes{
81
- font-size: 12px;
82
- color: #6d84b4;
83
- font-family: Helvetica
84
- }
85
- .wpemfb-clean-link{
86
- border: none !important;
87
- font-weight: normal !important;
88
- text-decoration: none !important;
89
- }
90
-
91
- /**
92
- * Video Embed
93
- */
94
- .wpemfb-video {
95
- position: relative;
96
- display: block;
97
- height: 0;
98
- padding: 0 0 56.25%;
99
- overflow: hidden;
100
- }
101
- .wpemfb-video .wpemfb-video-item,
102
- .wpemfb-video iframe,
103
- .wpemfb-video embed,
104
- .wpemfb-video object,
105
- .wpemfb-video video {
106
- position: absolute;
107
- top: 0;
108
- left: 0;
109
- bottom: 0;
110
- height: 100%;
111
- width: 100%;
112
- border: 0;
113
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/default/album.php CHANGED
@@ -1,40 +1,36 @@
1
- <?php
2
- /*
3
- * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
- * to access all fb data print_r($fb_data)
5
- */
6
- ?>
7
- <div class="wpemfb-container" style="max-width: <?php echo $width ?>px">
8
- <div class="wpemfb-row">
9
- <div class="wpemfb-col-3 wpemfb-text-center">
10
  <a href="https://facebook.com/<?php echo $fb_data['from']['id'] ?>" target="_blank" rel="nofollow">
11
  <img src="http://graph.facebook.com/<?php echo $fb_data['from']['id'] ?>/picture" />
12
- </a>
13
-
14
  </div>
15
- <div class="wpemfb-col-9 wpemfb-pl-none">
16
- <a class="wpemfb-title" href="https://facebook.com/<?php echo $fb_data['from']['id'] ?>" target="_blank" rel="nofollow">
17
- <?php echo $fb_data['from']['name'] ?>
18
- </a>
19
  <br>
20
  <?php if(isset($fb_data['from']['category'])) : ?>
21
  <?php echo $fb_data['from']['category'].'<br>' ?>
22
  <?php endif; ?>
23
  <a href="https://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow"><?php echo $fb_data['name'] ?></a>
24
  </div>
25
- </div>
26
  <hr>
27
- <div class="wpemfb-row">
28
- <div class="wpemfb-col-12 wpemfb-text-center">
 
29
  <?php
30
  foreach ($fb_data['photos']['data'] as $pic) {
 
31
  ?>
32
- <a href="<?php echo $pic['source'] ?>" data-lightbox="roadtrip" data-title="<?php echo $pic['name'] ?>" >
33
- <img class="wpemfb-thmb" src="<?php echo $pic['picture'] ?>" />
34
- </a>
35
  <?php
36
  }
37
  ?>
 
38
  </div>
39
  </div>
40
- </div>
1
+ <div class="wef-default" style="max-width: <?php echo $width ?>px">
2
+ <div class="row">
3
+ <div class="col-3 text-center">
 
 
 
 
 
 
4
  <a href="https://facebook.com/<?php echo $fb_data['from']['id'] ?>" target="_blank" rel="nofollow">
5
  <img src="http://graph.facebook.com/<?php echo $fb_data['from']['id'] ?>/picture" />
6
+ </a>
 
7
  </div>
8
+ <div class="col-9 pl-none">
9
+ <a href="https://facebook.com/<?php echo $fb_data['from']['id'] ?>" target="_blank" rel="nofollow">
10
+ <span class="title"><?php echo $fb_data['from']['name'] ?></span>
11
+ </a>
12
  <br>
13
  <?php if(isset($fb_data['from']['category'])) : ?>
14
  <?php echo $fb_data['from']['category'].'<br>' ?>
15
  <?php endif; ?>
16
  <a href="https://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow"><?php echo $fb_data['name'] ?></a>
17
  </div>
18
+ </div>
19
  <hr>
20
+ <div class="row">
21
+ <div class="col-12">
22
+ <div class="text-center album-thumbs">
23
  <?php
24
  foreach ($fb_data['photos']['data'] as $pic) {
25
+ $data_title = isset($pic['name']) ? $pic['name'] : $fb_data['from']['name'];
26
  ?>
27
+ <a class="road-trip" href="<?php echo $pic['source'] ?>" data-lightbox="roadtrip" data-title="<?php echo esc_attr(wp_rel_nofollow(make_clickable($data_title))) ?>" >
28
+ <img class="thumbnail" src="<?php echo $pic['picture'] ?>" />
29
+ </a>
30
  <?php
31
  }
32
  ?>
33
+ </div>
34
  </div>
35
  </div>
36
+ </div>
templates/default/com-page.php CHANGED
@@ -1,29 +1,31 @@
1
- <?php
2
- /*
3
- * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
- * to access all fb data print_r($fb_data)
5
- */
6
- $height = $width * $prop;
7
- ?>
8
- <div class="wpemfb-container" style="max-width: <?php echo $width ?>px">
9
- <div class="wpemfb-row">
10
- <div class="wpemfb-col-3 wpemfb-text-center">
11
- <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
12
- <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
13
- </a>
 
 
 
 
 
 
 
 
14
  </div>
15
- <div class="wpemfb-col-9 wpemfb-pl-none">
16
- <a class="wpemfb-title" href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
17
- <?php echo $fb_data['name'] ?>
18
- </a>
19
  <br>
20
- <div><?php WP_Embed_FB::like_btn($fb_data['id'],$fb_data['likes']) ?></div>
21
- <?php if(isset($fb_data["website"])) : ?>
22
- <br>
23
- <a href="http://<?php echo WP_Embed_FB::getwebsite($fb_data["website"]) ?>" title="<?php _e('Web Site', 'wp-embed-facebook') ?>" target="_blank">
24
- <?php _e('Web Site','wp-embed-facebook') ?>
25
- </a>
26
- <?php endif; ?>
27
- </div>
28
- </div>
29
- </div>
1
+ <div class="wef-default" style="max-width: <?php echo $width ?>px">
2
+ <div class="row">
3
+ <div class="col-3 text-center">
4
+ <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
5
+ <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
6
+ </a>
7
+ </div>
8
+ <div class="col-9 pl-none">
9
+ <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
10
+ <span class="title"><?php echo $fb_data['name'] ?></span>
11
+ </a>
12
+ <br>
13
+ <div>
14
+ <?php
15
+ $opt = get_option('wpemfb_show_like');
16
+ if($opt === 'true') :
17
+ echo WEF_Social_Plugins::like_btn('https://www.facebook.com/'.$fb_data['id'],array('share'=>'true','layout'=>'button_count'));
18
+ else :
19
+ printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_data['likes'] );
20
+ endif;
21
+ ?>
22
  </div>
23
+ <?php if(isset($fb_data["website"])) : ?>
 
 
 
24
  <br>
25
+ <a href="<?php echo WP_Embed_FB::getwebsite($fb_data["website"]) ?>" title="<?php _e('Web Site', 'wp-embed-facebook') ?>" target="_blank">
26
+ <?php _e('Web Site','wp-embed-facebook') ?>
27
+ </a>
28
+ <?php endif; ?>
29
+ </div>
30
+ </div>
31
+ </div>
 
 
 
templates/default/default.css ADDED
@@ -0,0 +1 @@
 
1
+ .wef-default{font:300 14px/20px Helvetica;padding:10px;display:inline-block;border-width:1px;border-style:solid;border-color:#dedede;border-radius:2px;width:100%;background-color:#fff}.wef-default .row{margin-left:-10px;margin-right:-10px;display:table;width:100%}.wef-default .col-1,.wef-default .col-2,.wef-default .col-3,.wef-default .col-4,.wef-default .col-5,.wef-default .col-6,.wef-default .col-7,.wef-default .col-8,.wef-default .col-9,.wef-default .col-10,.wef-default .col-11,.wef-default .col-12{position:relative;min-height:1px;padding-left:10px;padding-right:10px;display:table-cell;vertical-align:middle;text-align:left}.wef-default .col-12{width:100%}.wef-default .col-11{width:91.66667%}.wef-default .col-10{width:83.33333%}.wef-default .col-9{width:75%}.wef-default .col-8{width:66.66667%}.wef-default .col-7{width:58.33333%}.wef-default .col-6{width:50%}.wef-default .col-5{width:41.66667%}.wef-default .col-4{width:33.33333%}.wef-default .col-3{width:25%}.wef-default .col-2{width:16.66667%}.wef-default .col-1{width:8.33333%}.wef-default hr{margin-top:10px !important;margin-bottom:10px !important;margin-left:0 !important;margin-right:0 !important;float:none !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.icon{float:right;box-shadow:none;margin:0;padding:0;display:block}.wef-default img.thumbnail{border:1px solid gray;border-radius:2px;height:60px !important;margin:1px;padding:2px;width:60px !important}.wef-default .album-thumbs{line-height:1px !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}.wef-default a:focus,.wef-default a:hover{color:#23487f;text-decoration:underline !important}.wef-default a.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;padding:0}.wef-default p{font:300 14px/20px Helvetica;padding:0 !important;margin:0 !important}.wef-default p.post-time{font-style:italic;color:#8e8c8d;font-size:12px}.wef-default p.caption-title{font-size:12px;font-weight:bold}.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 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 .post-link{border-width:1px;border-style:solid;border-color:#d0d0d0}.wef-default .post-link p{padding-left:10px !important;padding-right:10px !important}.wef-default .text-center{text-align:center}.wef-default .pl-none{padding-left:0 !important;word-break:break-all}.wef-default .color{color:#23487f}.wef-default .bold{font-weight:bold !important}.wef-default .title{font-size:20px !important;font-weight:bold !important;word-break:break-all}.wef-default .cover{width:100%;background-size:100%}.wef-default .pad-top{padding-top:5px}.wef-default .page-post{left:2.6% !important}.wef-default .caption-description p{color:#8e8c8d !important;font-style:italic !important;font-size:12px !important}.wef-default .video{position:relative;display:block;height:0;padding:0 0 56.25%;overflow:hidden}.wef-default .video iframe,.wef-default .video embed,.wef-default .video object,.wef-default .video video{position:absolute;top:0;left:0;bottom:0;height:100%;width:100%;border:0;margin:0;padding:0}.wef-default .wef-measure{width:100%}.wef-default .break-all{word-break:break-all}
templates/default/default.sass ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wef-default
2
+ font: 300 14px/20px Helvetica
3
+ padding: 10px
4
+ display: inline-block
5
+ border:
6
+ width: 1px
7
+ style: solid
8
+ color: #DEDEDE
9
+ radius: 2px
10
+ width: 100%
11
+ background-color: #FFFFFF
12
+ .row
13
+ margin:
14
+ left: -10px
15
+ right: -10px
16
+ display: table
17
+ width: 100%
18
+ .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12
19
+ /* float: left */
20
+ position: relative
21
+ min-height: 1px
22
+ padding:
23
+ left: 10px
24
+ right: 10px
25
+ display: table-cell
26
+ vertical-align: middle
27
+ text-align: left
28
+ .col-12
29
+ width: 100%
30
+ .col-11
31
+ width: 91.66666667%
32
+ .col-10
33
+ width: 83.33333333%
34
+ .col-9
35
+ width: 75%
36
+ .col-8
37
+ width: 66.66666667%
38
+ .col-7
39
+ width: 58.33333333%
40
+ .col-6
41
+ width: 50%
42
+ .col-5
43
+ width: 41.66666667%
44
+ .col-4
45
+ width: 33.33333333%
46
+ .col-3
47
+ width: 25%
48
+ .col-2
49
+ width: 16.66666667%
50
+ .col-1
51
+ width: 8.33333333%
52
+ hr
53
+ margin:
54
+ top: 10px !important
55
+ bottom: 10px !important
56
+ left: 0 !important
57
+ right: 0 !important
58
+ float: none !important
59
+ border:
60
+ top: 1px
61
+ style: solid
62
+ color: #DEDEDE
63
+ -moz-box-sizing: content-box
64
+ -webkit-box-sizing: content-box
65
+ box-sizing: content-box
66
+ height: 0 !important
67
+ width: 100% !important
68
+ img.icon
69
+ float: right
70
+ box-shadow: none
71
+ margin: 0
72
+ padding: 0
73
+ display: block
74
+ img.thumbnail
75
+ border: 1px solid #808080
76
+ border-radius: 2px
77
+ height: 60px !important
78
+ margin: 1px
79
+ padding: 2px
80
+ width: 60px !important
81
+ .album-thumbs
82
+ line-height: 1px !important
83
+ //padding-left: 5.3% !important
84
+ a
85
+ font: 300 14px/20px Helvetica
86
+ color: #23487F !important
87
+ text-decoration: none !important
88
+ border: 0 !important
89
+ margin: 0 !important
90
+ padding: 0 !important
91
+ &:focus, &:hover
92
+ color: #23487F
93
+ text-decoration: underline !important
94
+ &.post-likes
95
+ color: #6d84b4 !important
96
+ font-size: 12px !important
97
+ &.road-trip
98
+ width: 0 !important
99
+ height: 0 !important
100
+ img
101
+ display: inline-block !important
102
+ margin: 0
103
+ padding: 0
104
+ p
105
+ font: 300 14px/20px Helvetica
106
+ padding: 0 !important
107
+ margin: 0 !important
108
+ &.post-time
109
+ font-style: italic
110
+ color: #8e8c8d
111
+ font-size: 12px
112
+ &.caption-title
113
+ font-size: 12px
114
+ font-weight: bold
115
+ &.caption-link
116
+ text-align: right
117
+ word-break: break-all
118
+ a
119
+ font-size: 12px
120
+ color: #8e8c8d !important
121
+ text-transform: uppercase
122
+ iframe, embed, object, video, audio
123
+ width: 100% !important
124
+ border: 0 !important
125
+ margin: 0 !important
126
+ padding: 0 !important
127
+ .post-link
128
+ border:
129
+ width: 1px
130
+ style: solid
131
+ color: #d0d0d0
132
+ p
133
+ padding:
134
+ left: 10px !important
135
+ right: 10px !important
136
+ .text-center
137
+ text-align: center
138
+ .pl-none
139
+ padding-left: 0 !important
140
+ word-break: break-all
141
+ .color
142
+ color: #23487F
143
+ .bold
144
+ font-weight: bold !important
145
+ .title
146
+ font-size: 20px !important
147
+ font-weight: bold !important
148
+ word-break: break-all
149
+ .cover
150
+ width: 100%
151
+ background-size: 100%
152
+ .pad-top
153
+ padding:
154
+ top: 5px
155
+ .page-post
156
+ left: 2.6% !important
157
+ .caption-description p
158
+ color: #8e8c8d !important
159
+ font-style: italic !important
160
+ font-size: 12px !important
161
+ .video
162
+ position: relative
163
+ display: block
164
+ height: 0
165
+ padding: 0 0 56.25%
166
+ overflow: hidden
167
+ iframe, embed, object, video
168
+ position: absolute
169
+ top: 0
170
+ left: 0
171
+ bottom: 0
172
+ height: 100%
173
+ width: 100%
174
+ border: 0
175
+ margin: 0
176
+ padding: 0
177
+ .wef-measure
178
+ width: 100%
179
+ .break-all
180
+ word-break: break-all
templates/default/event.php CHANGED
@@ -1,40 +1,35 @@
1
  <?php
2
- /*
3
- * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
- * to access all fb data print_r($fb_data)
5
- */
6
- $height = $width * $prop;
7
- $start_time_format = 'l, j F Y g:s a';
8
- $start_time = strtotime($fb_data['start_time']);
9
- if (get_option('wpemfb_ev_local_tz', 'true') == 'true') {
10
- $start_time = $start_time + get_option('gmt_offset') * 3600; //shows event date on local time
11
  }
 
 
 
12
  ?>
13
- <div class="wpemfb-container" style="max-width: <?php echo $width ?>px">
14
- <div class="wpemfb-row wpemfb-pad-top">
15
- <div class="wpemfb-col-3 wpemfb-text-center">
16
- <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
17
- <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture/large"/>
18
- </a>
19
- </div>
20
- <div class="wpemfb-col-9 wpemfb-pl-none">
21
- <a class="wpemfb-title" href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank"
22
- rel="nofollow">
23
- <?php echo $fb_data['name'] ?>
24
- </a>
25
- <br>
26
- <?php echo date_i18n($start_time_format, $start_time) ?>
27
- <br>
28
- <?php
29
- if(isset($fb_data['place']['id'])){
30
- _e('@ ', 'wp-embed-facebook');
31
- echo '<a href="http://www.facebook.com/'.$fb_data['place']['id'].'" target="_blank">'.$fb_data['place']['name'].'</a>';
32
- } else {
33
- echo isset($fb_data['place']['name']) ? __('@ ', 'wp-embed-facebook') . $fb_data['place']['name'] : '';
34
- }
35
- ?>
36
- <br>
37
- <?php echo __('Creator: ', 'wp-embed-facebook') . '<a href="http://www.facebook.com/' . $fb_data['owner']['id'] . '" target="_blank">' . $fb_data['owner']['name'] . '</a>' ?>
38
- </div>
39
- </div>
40
  </div>
1
  <?php
2
+ $height = $width * $prop;
3
+ $start_time_format = 'l, j F Y g:i a';
4
+ $old_time_zone = date_default_timezone_get();
5
+ if(get_option('wpemfb_ev_local_tz') == 'true'){
6
+ $timezone = get_option( 'timezone_string' );
7
+ } else {
8
+ $timezone = isset( $fb_data['timezone'] ) ? $fb_data['timezone'] : get_option( 'timezone_string' );
 
 
9
  }
10
+ date_default_timezone_set( $timezone );
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 wef-measure" style="max-width: <?php echo $width ?>px">
15
+ <div class="cover" style="height:<?php echo $height ?>px; background-image: url('<?php echo $fb_data['cover']['source'] ?>'); background-position: 0% <?php echo $fb_data['cover']['offset_y'] ?>%;" onclick="window.open('http://www.facebook.com/<?php echo $fb_data['id'] ?>', '_blank')" ></div>
16
+ <div class="row pad-top">
17
+ <div class="col-12">
18
+ <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
19
+ <span class="title"><?php echo $fb_data['name'] ?></span>
20
+ </a>
21
+ <p><?php echo $start_time ?></p>
22
+ <p>
23
+ <?php
24
+ if ( isset( $fb_data['place']['id'] ) ) {
25
+ _e( '@ ', 'wp-embed-facebook' );
26
+ echo '<a href="http://www.facebook.com/' . $fb_data['place']['id'] . '" target="_blank">' . $fb_data['place']['name'] . '</a>';
27
+ } else {
28
+ echo isset( $fb_data['place']['name'] ) ? __( '@ ', 'wp-embed-facebook' ) . $fb_data['place']['name'] : '';
29
+ }
30
+ ?>
31
+ </p>
32
+ <p><?php echo __( 'Creator: ', 'wp-embed-facebook' ) . '<a href="http://www.facebook.com/' . $fb_data['owner']['id'] . '" target="_blank">' . $fb_data['owner']['name'] . '</a>' ?></p>
33
+ </div>
34
+ </div>
 
 
 
 
 
 
35
  </div>
templates/default/page.php CHANGED
@@ -1,25 +1,18 @@
1
  <?php
2
- /*
3
- * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
- * to access all fb data print_r($fb_data)
5
- */
6
- $height = $width * $prop;
7
  $show_posts = get_option("wpemfb_show_posts") == "true" ? true : false;
8
- //$wp_emb_fbsdk = WP_Embed_FB::$fbsdk;
9
  ?>
10
- <div class="wpemfb-container" style="max-width: <?php echo $width ?>px" >
11
- <div class="wpemfb-cover"
12
- style= "height:<?php echo $height ?>px; background-image: url(<?php echo $fb_data['cover']['source'] ?>); background-position: 0 <?php echo $fb_data['cover']['offset_y'] ?>%;" onclick="window.open('<?php echo $fb_data['link'] ?>', '_blank')" >
13
- </div>
14
- <div class="wpemfb-row wpemfb-pad-top">
15
- <div class="wpemfb-col-2 wpemfb-text-center">
16
  <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
17
- <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" width="50px" height="50px" />
18
  </a>
19
  </div>
20
- <div class="wpemfb-col-10">
21
- <a class="wpemfb-title" href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
22
- <?php echo $fb_data['name'] ?>
23
  </a>
24
  <br>
25
  <?php
@@ -34,49 +27,23 @@
34
  <?php _e('Web Site','wp-embed-facebook') ?>
35
  </a>
36
  <?php endif; ?>
37
- <div style="float: right;"><?php WP_Embed_FB::like_btn($fb_data['id'],$fb_data['likes']) ?></div>
 
 
 
 
 
 
 
 
 
38
  </div>
39
  </div>
40
- <?php if($show_posts && isset($fb_data['posts'])) : ?>
41
- <?php foreach($fb_data['posts']['data'] as $fbpost) : ?>
42
-
43
- <?php if(isset($fbpost['picture']) || isset($fbpost['message'])) : ?>
44
- <?php $link = explode("_", $fbpost['id']); ?>
45
- <hr>
46
- <div class="wpemfb-row">
47
- <?php if(isset($fbpost['picture']) && isset($fbpost['message'])) : ?>
48
- <div class="wpemfb-col-3 wpemfb-text-center">
49
- <a class="wpemfb-clean-link" href="<?php echo "https://www.facebook.com/".$link[0]."/posts/".$link[1] ?>" target="_blank" rel="nofollow">
50
- <img src="<?php echo $fbpost['picture'] ?>" width="70px" height"70px" />
51
- </a>
52
- </div>
53
- <div class="wpemfb-col-9 wpemfb-pl-none">
54
- <span class="wpemfb-page-post"><?php echo make_clickable($fbpost['message']) ?></span><br>
55
- <a class="wpemfb-post-link" href="<?php echo "https://www.facebook.com/".$link[0]."/posts/".$link[1] ?> " target="_blank" rel="nofollow">
56
- <?php echo isset($fbpost['likes']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y6/r/l9Fe9Ugss0S.gif" />'.$fbpost['likes']['summary']['total_count'].' ' : "" ?>
57
- <?php echo isset($fbpost['comments']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yg/r/V8Yrm0eKZpi.gif" />'.$fbpost['comments']['summary']['total_count'].' ' : "" ?>
58
- <?php echo isset($fbpost['shares']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y2/r/o19N6EzzbUm.png" />'.$fbpost['shares']['count'].' ' : "" ?>
59
- </a>
60
- </div>
61
- <?php elseif(isset($fbpost['picture'])): ?>
62
- <div class="wpemfb-col-12 wpemfb-text-center">
63
- <a class="wpemfb-clean-link" href="<?php echo "https://www.facebook.com/".$link[0]."/posts/".$link[1] ?>" target="_blank" rel="nofollow">
64
- <img src="<?php echo $fbpost['picture'] ?>" />
65
- </a>
66
- </div>
67
- <?php elseif(isset($fbpost['message'])): ?>
68
- <div class="wpemfb-col-12">
69
- <span class="wpemfb-page-post"><?php echo make_clickable($fbpost['message']) ?></span><br>
70
- <a class="wpemfb-post-link" href="<?php echo "https://www.facebook.com/".$link[0]."/posts/".$link[1] ?> " target="_blank" rel="nofollow">
71
- <?php echo isset($fbpost['likes']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y6/r/l9Fe9Ugss0S.gif" />'.$fbpost['likes']['summary']['total_count'].' ' : "" ?>
72
- <?php echo isset($fbpost['comments']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yg/r/V8Yrm0eKZpi.gif" />'.$fbpost['comments']['summary']['total_count'].' ' : "" ?>
73
- <?php echo isset($fbpost['shares']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y2/r/o19N6EzzbUm.png" />'.$fbpost['shares']['count'].' ' : "" ?>
74
- </a>
75
- </div>
76
- <?php endif; ?>
77
- </div>
78
  <?php endif; ?>
79
-
80
  <?php endforeach; ?>
81
  <?php endif; ?>
82
  </div>
1
  <?php
2
+ $height = round((($width - 21 ) * $prop),2);
 
 
 
 
3
  $show_posts = get_option("wpemfb_show_posts") == "true" ? true : false;
 
4
  ?>
5
+ <div class="wef-default wef-measure" style="max-width: <?php echo $width ?>px" >
6
+ <div class="cover" style="height:<?php echo $height ?>px; background-image: url('<?php echo $fb_data['cover']['source'] ?>'); background-position: 0 <?php echo $fb_data['cover']['offset_y'] ?>%; cursor: pointer" onclick="window.open('<?php echo $fb_data['link'] ?>', '_blank')" ></div>
7
+ <div class="row pad-top">
8
+ <div class="col-2 text-center">
 
 
9
  <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
10
+ <img src="<?php echo $fb_data['picture']['data']['url'] ?>" width="50px" height="50px" />
11
  </a>
12
  </div>
13
+ <div class="col-10 pl-none">
14
+ <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
15
+ <span class="title"><?php echo $fb_data['name'] ?></span>
16
  </a>
17
  <br>
18
  <?php
27
  <?php _e('Web Site','wp-embed-facebook') ?>
28
  </a>
29
  <?php endif; ?>
30
+ <div style="float: right;">
31
+ <?php
32
+ $opt = get_option('wpemfb_show_like');
33
+ if($opt === 'true') :
34
+ echo WEF_Social_Plugins::like_btn('https://www.facebook.com/'.$fb_data['id'],array('share'=>'true','layout'=>'button_count'));
35
+ else :
36
+ printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_data['likes'] );
37
+ endif;
38
+ ?>
39
+ </div>
40
  </div>
41
  </div>
42
+ <?php if($show_posts && isset($fb_data['posts'])) : global $wp_embed; ?>
43
+ <?php foreach($fb_data['posts']['data'] as $fb_post) : ?>
44
+ <?php if(isset($fb_post['picture']) || isset($fb_post['message'])) : ?>
45
+ <?php include('single-post.php') ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  <?php endif; ?>
 
47
  <?php endforeach; ?>
48
  <?php endif; ?>
49
  </div>
templates/default/photo.php CHANGED
@@ -1,10 +1,9 @@
1
- <?php
2
- /*
3
- * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
- * to access all fb data print_r($fb_data)
5
- */
6
- $height = $width * $prop;
7
- ?>
8
- <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
9
- <img src="<?php echo $fb_data['source'] ?>" width="<?php echo $width ?>px" height="auto" style="max-width: <?php echo $width ?>px" />
10
- </a>
1
+ <div class="wef-default" style="max-width: <?php echo $width ?>px" >
2
+ <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
3
+ <img src="<?php echo $fb_data['source'] ?>" width="100%" height="auto" >
4
+ </a>
5
+ <a class="post-link" href="<?php echo $fb_data['link'] ?> " target="_blank" rel="nofollow">
6
+ <?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'].' ' : "" ?>
7
+ <?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'].' ' : "" ?>
8
+ </a>
9
+ </div>
 
templates/default/post.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $fb_post = $fb_data ?>
2
+ <div class="wef-default" style="max-width: <?php echo $width ?>px" >
3
+ <div class="col-3 text-center">
4
+ <a href="http://www.facebook.com/<?php echo $fb_post['from']['id'] ?>" target="_blank" rel="nofollow">
5
+ <img src="http://graph.facebook.com/<?php echo $fb_post['from']['id'] ?>/picture" width="50px" height="50px" />
6
+ </a>
7
+ </div>
8
+ <div class="col-9 pl-none">
9
+ <p>
10
+ <a href="http://www.facebook.com/<?php echo $fb_post['from']['id'] ?>" target="_blank" rel="nofollow">
11
+ <span class="title"><?php echo $fb_post['from']['name'] ?></span>
12
+ </a>
13
+ </p>
14
+ <div>
15
+ <?php
16
+ $opt = get_option('wpemfb_show_like');
17
+ if($opt === 'true') :
18
+ echo WEF_Social_Plugins::like_btn($fb_post['link'],array('share'=>'true','layout'=>'button_count'));
19
+ else :
20
+ printf( __( '%d people like this.', 'wp-embed-facebook' ), $fb_post['likes'] );
21
+ endif;
22
+ ?>
23
+ </div>
24
+ </div>
25
+ <?php if(isset($fb_post['picture']) || isset($fb_post['message'])) : ?>
26
+ <?php
27
+ global $wp_embed;
28
+ include('single-post.php');
29
+ ?>
30
+ <?php endif; ?>
31
+ </div>
templates/default/posts.php DELETED
@@ -1,3 +0,0 @@
1
- <div class="wpemfb-container wpemfb-mesure" style="position:absolute; max-width: <?php echo $width ?>px;"></div>
2
- <div class="fb-post" data-href="https://www.facebook.com/<?php echo $fb_data['link'] ?>" data-width="<?php echo $width ?>">
3
- </div>
 
 
 
templates/default/profile.php CHANGED
@@ -1,25 +1,23 @@
1
- <?php
2
- /*
3
- * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
- * to access all fb data print_r($fb_data)
5
- */
6
- $height = $width * $prop;
7
- ?>
8
- <div class="wpemfb-container" style="max-width: <?php echo $width ?>px">
9
- <div class="wpemfb-row">
10
- <div class="wpemfb-col-3 wpemfb-text-center">
11
  <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
12
  <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
13
  </a>
14
  </div>
15
- <div class="wpemfb-col-9 wpemfb-pl-none">
 
 
 
 
 
16
  <div>
17
- <a class="wpemfb-title" href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
18
- <?php echo $fb_data['name'] ?>
19
- </a>
20
- </div>
21
- <div>
22
- <?php WP_Embed_FB::follow_btn($fb_data['id']) ?>
23
  </div>
24
  </div>
25
  </div>
1
+ <div class="wef-default" style="max-width: <?php echo $width ?>px">
2
+ <div class="row">
3
+ <div class="col-3 text-center">
 
 
 
 
 
 
 
4
  <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
5
  <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
6
  </a>
7
  </div>
8
+ <div class="col-9 pl-none">
9
+ <p>
10
+ <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
11
+ <span class="title"><?php echo $fb_data['name'] ?></span>
12
+ </a>
13
+ </p>
14
  <div>
15
+ <?php
16
+ $opt = get_option('wpemfb_show_follow');
17
+ if($opt === 'true') :
18
+ WEF_Social_Plugins::follow_btn('https://www.facebook.com/'.$fb_data['id']);
19
+ endif;
20
+ ?>
21
  </div>
22
  </div>
23
  </div>
templates/default/single-post.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $fb_post['link'] = isset($fb_post['link']) ? $fb_post['link'] : '';
3
+ $link = explode("_", $fb_post['id']);
4
+ $picture_link = isset($fb_post['link']) ? $fb_post['link'] : "https://www.facebook.com/".$link[0]."/posts/".$link[1];
5
+ $message = null;
6
+ $description = isset($fb_post['description']) && !empty($fb_post['description']) ? WP_Embed_FB::make_clickable($fb_post['description']) : null ;
7
+ $caption = isset($fb_post['caption']) && !empty($fb_post['caption']) ? $fb_post['caption'] : null ;
8
+ $name = isset($fb_post['name']) && !empty($fb_post['name']) ? $fb_post['name'] : null ;
9
+ $is_fb_link = strpos($fb_post['link'],'facebook.com') !== false;
10
+ $video_ratio = (get_option('wpemfb_video_ratio') == 'true') ? true : false;
11
+ if(isset($fb_post['message']) && !empty($fb_post['message'])) :
12
+ $message = str_replace($fb_post['link'],'',$fb_post['message']);
13
+ $message = WP_Embed_FB::make_clickable($message);
14
+ endif;
15
+ $name = $name ? '<p class="caption-title">'.$name.'</p>':'';
16
+ $description = $description ? '<div class="caption-description">'.$description.'</div>':'';
17
+ $caption = $caption ? '<p class="caption-link"><a href="'.$fb_post["link"].'" rel="nofollow">'.$caption.'</a></p>':'';
18
+ $link_info = $name.$description.$caption;
19
+ $icon = isset($fb_post["icon"]) ? '<img class="icon" src="'.$fb_post["icon"].'">' : '';
20
+ $old_time_zone = date_default_timezone_get();
21
+ date_default_timezone_set(get_option('timezone_string'));
22
+ $post_time = $icon.date_i18n('l, j F Y g:s a', strtotime($fb_post['created_time'])) ;
23
+ date_default_timezone_set($old_time_zone);
24
+ ?>
25
+ <hr>
26
+ <div class="row">
27
+ <div class="col-12 page-post">
28
+ <?php //echo '<pre>'.wpautop(print_r($fb_post,true)).'</pre>'; ?>
29
+ <?php echo isset($fb_post['story']) ? '<p>'.$fb_post['story'].'</p>' : '';?>
30
+ <p class="post-time" ><?php echo $post_time ?></p>
31
+ <?php
32
+ switch($fb_post["type"]) :
33
+ case 'video':
34
+ echo $message ? '<p>'.$message.'</p>':'';
35
+ if($is_fb_link){
36
+ $raw = WP_Embed_FB::$raw;
37
+ $width_r = WP_Embed_FB::$width;
38
+ WP_Embed_FB::$raw = true;
39
+ WP_Embed_FB::$width = $width-40;
40
+ echo $wp_embed->shortcode(array('src'=>$fb_post['link']));
41
+ WP_Embed_FB::$raw = $raw;
42
+ WP_Embed_FB::$width = $width_r;
43
+ echo $link_info;
44
+ } else {
45
+ $use_ratio = (get_option('wpemfb_video_ratio') == 'true');
46
+ echo '<div class="post-link">';
47
+ echo $use_ratio ? '<div class="video">' : '';
48
+ echo $wp_embed->shortcode(array('src'=>$fb_post['link'], 'width'=>$width - 20));
49
+ echo $use_ratio ? '</div>' : '';
50
+ echo $link_info;
51
+ echo '</div>';
52
+ }
53
+ break;
54
+ case 'event':
55
+ echo $message ? '<p>'.$message.'</p>':'';
56
+ WP_Embed_FB::$width = $width-40;
57
+ echo $wp_embed->shortcode(array('src'=>$fb_post['link']));
58
+ WP_Embed_FB::$width = $width;
59
+ break;
60
+ case 'photo':
61
+ ?>
62
+ <a href="<?php echo "https://www.facebook.com/".$link[0]."/posts/".$link[1] ?>" rel="nofollow" target="_blank">
63
+ <img src="<?php echo $fb_post['full_picture'] ?>" width="100%" height="auto" /><br>
64
+ </a>
65
+ <?php echo $description; ?>
66
+ <?php
67
+ break;
68
+ case 'status':
69
+ echo $message ? '<p>'.$message.'</p>':'';
70
+ break;
71
+ case 'music':
72
+ case 'link':
73
+ echo $message ? '<p>'.$message.'</p>':'';
74
+ ?>
75
+ <div class="post-link" style="max-width: <?php echo $width?>px;">
76
+ <a href="<?php echo $fb_post['link'] ?>" rel="nofollow" target="_blank">
77
+ <img src="<?php echo $fb_post['full_picture'] ?>" width="100%" height="auto" /><br>
78
+ </a>
79
+ <?php if($type == 'music') : ?>
80
+ <p>
81
+ <audio controls>
82
+ <source src="<?php echo $fb_post['source'] ?>" type="audio/mpeg">
83
+ </audio>
84
+ </p>
85
+ <?php endif ?>
86
+ <?php echo $link_info; ?>
87
+ </div>
88
+ <?php
89
+ break;
90
+ default:
91
+ echo $message ? '<p>'.$message.'</p>':'';
92
+ ?>
93
+ <a href="<?php echo $fb_post['link'] ?>" rel="nofollow" target="_blank">
94
+ <img src="<?php echo $fb_post['full_picture'] ?>" width="100%" height="auto" /><br>
95
+ </a>
96
+ <?php echo $link_info; ?>
97
+ <?php
98
+ break;
99
+ endswitch;
100
+ ?>
101
+ <a class="post-likes" href="<?php echo "https://www.facebook.com/".$link[0]."/posts/".$link[1] ?> " target="_blank" rel="nofollow">
102
+ <?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'].' ' : "" ?>
103
+ <?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'].' ' : "" ?>
104
+ <?php echo isset($fb_post['shares']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y2/r/o19N6EzzbUm.png" />'.$fb_post['shares']['count'].' ' : "" ?>
105
+ </a>
106
+ </div>
107
+ </div>
templates/default/social-plugin.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wef-measure" style="max-width: <?php echo $width ?>px;"></div>
2
+ <?php
3
+ switch($type){
4
+ case 'page' :
5
+ echo WEF_Social_Plugins::page_plugin('https://www.facebook.com/'.$fb_data['link'],$width);
6
+ break;
7
+ case 'video' :
8
+ if(get_option('wpemfb_video_as_post','false') == 'true')
9
+ echo WEF_Social_Plugins::embedded_post('https://www.facebook.com/'.$fb_data['link'],$width);
10
+ else
11
+ echo WEF_Social_Plugins::embedded_video('https://www.facebook.com/'.$fb_data['link'],$width);
12
+ break;
13
+ //case 'photo' :
14
+ //case 'post' :
15
+ default:
16
+ echo WEF_Social_Plugins::embedded_post('https://www.facebook.com/'.$fb_data['link'],$width);
17
+ break;
18
+ }
templates/default/video.php CHANGED
@@ -1,12 +1,8 @@
1
  <?php
2
- /*
3
- * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
- * to access all fb data print_r($fb_data)
5
- *
6
- */
7
  ?>
8
- <div style="width: <?php echo $width ?>px">
9
- <div class="wpemfb-video">
10
  <?php
11
  $url = $fb_data['source'];
12
  $file_array = explode('/',parse_url($url, PHP_URL_PATH));
@@ -29,5 +25,5 @@
29
  </div>
30
 
31
  <?php endif; ?>
32
- </div>
33
  </div>
1
  <?php
2
+ $use_ratio = (get_option('wpemfb_video_ratio') == 'true');
 
 
 
 
3
  ?>
4
+ <div class="wef-default" style="max-width: <?php echo $width ?>px">
5
+ <?php echo $use_ratio ? '<div class="video">' : '' ?>
6
  <?php
7
  $url = $fb_data['source'];
8
  $file_array = explode('/',parse_url($url, PHP_URL_PATH));
25
  </div>
26
 
27
  <?php endif; ?>
28
+ <?php echo $use_ratio ? '</div>' : '' ?>
29
  </div>
templates/default/wpemfb.css DELETED
@@ -1,168 +0,0 @@
1
- /*
2
- * Table structure modification of bootstrap
3
- */
4
- .wpemfb-container {
5
- padding: 10px;
6
- display: inline-block;
7
- font-family: Helvetica;
8
- border: 1px solid #DEDEDE;
9
- border-radius: 2px;
10
- width: 100%;
11
- font-size: 14px;
12
- }
13
- .wpemfb-row {
14
- margin-left: -10px;
15
- margin-right: -10px;
16
- display: table;
17
- width: 100%;
18
- }
19
- .wpemfb-col-1, .wpemfb-col-2, .wpemfb-col-3, .wpemfb-col-4, .wpemfb-col-5, .wpemfb-col-6, .wpemfb-col-7, .wpemfb-col-8, .wpemfb-col-9, .wpemfb-col-10, .wpemfb-col-11, .wpemfb-col-12 {
20
- /*float: left;*/
21
- position: relative;
22
- min-height: 1px;
23
- padding-left: 10px;
24
- padding-right: 10px;
25
- display: table-cell;
26
- vertical-align: middle;
27
- text-align: left;
28
- }
29
- .wpemfb-col-12 {
30
- width: 100%;
31
- }
32
- .wpemfb-col-11 {
33
- width: 91.66666667%;
34
- }
35
- .wpemfb-col-10 {
36
- width: 83.33333333%;
37
- }
38
- .wpemfb-col-9 {
39
- width: 75%;
40
- }
41
- .wpemfb-col-8 {
42
- width: 66.66666667%;
43
- }
44
- .wpemfb-col-7 {
45
- width: 58.33333333%;
46
- }
47
- .wpemfb-col-6 {
48
- width: 50%;
49
- }
50
- .wpemfb-col-5 {
51
- width: 41.66666667%;
52
- }
53
- .wpemfb-col-4 {
54
- width: 33.33333333%;
55
- }
56
- .wpemfb-col-3 {
57
- width: 25%;
58
- }
59
- .wpemfb-col-2 {
60
- width: 16.66666667%;
61
- }
62
- .wpemfb-col-1 {
63
- width: 8.33333333%;
64
- }
65
-
66
- /**
67
- * Helpers
68
- */
69
-
70
- .wpemfb-container > hr {
71
- margin-top: 10px;
72
- margin-bottom: 10px;
73
- border: 0;
74
- border-top: 1px solid #DEDEDE;
75
- -moz-box-sizing: content-box;
76
- -webkit-box-sizing: content-box;
77
- box-sizing: content-box;
78
- height: 0;
79
- float: left;
80
- width: 100%
81
- }
82
- .wpemfb-text-center{
83
- text-align: center;
84
- }
85
- .wpemfb-pl-none{
86
- padding-left: 0;
87
- }
88
- .wpemfb-color{
89
- color: #23487F;
90
- }
91
- .wpemfb-title{
92
- font-size: 20px;
93
- font-weight: bold;
94
- }
95
- .wpemfb-container img {
96
- display: inline-block !important;
97
- }
98
- .wpemfb-pad-top{
99
- padding-top:5px;
100
- }
101
- /*
102
- * Links
103
- */
104
- .wpemfb-container a {
105
- font-family: Helvetica !important;
106
- color: #23487F !important;
107
- text-decoration: none !important;
108
- border:0 !important;
109
- }
110
- .wpemfb-container a:hover,
111
- a:focus {
112
- color: #23487F;
113
- text-decoration: underline;
114
- }
115
- .wpemfb-container a:focus {
116
- color: #23487F;
117
- text-decoration: underline;
118
- }
119
- /*
120
- * Page Embed
121
- */
122
- .wpemfb-page-post{
123
- text-align: justify;
124
- overflow: hidden;
125
- }
126
- a.wpemfb-post-link{
127
- color: #6d84b4 !important;
128
- font-size: 12px;
129
- }
130
- .wpemfb-cover{
131
- width: 100%;
132
- background-size: 100%;
133
- }
134
- /**
135
- * Album Embed
136
- */
137
- img.wpemfb-thmb {
138
- border: 1px solid #808080;
139
- border-radius: 2px;
140
- height: 60px !important;
141
- margin: 1px;
142
- padding: 2px;
143
- width: 60px !important;
144
- }
145
-
146
- /**
147
- * Video Embed
148
- */
149
- .wpemfb-video {
150
- position: relative;
151
- display: block;
152
- height: 0;
153
- padding: 0 0 56.25%;
154
- overflow: hidden;
155
- }
156
- .wpemfb-video .wpemfb-video-item,
157
- .wpemfb-video iframe,
158
- .wpemfb-video embed,
159
- .wpemfb-video object,
160
- .wpemfb-video video {
161
- position: absolute;
162
- top: 0;
163
- left: 0;
164
- bottom: 0;
165
- height: 100%;
166
- width: 100%;
167
- border: 0;
168
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wp-embed-facebook.php CHANGED
@@ -2,39 +2,35 @@
2
  /*
3
  Plugin Name: WP Embed Facebook
4
  Plugin URI: http://www.wpembedfb.com
5
- Description: Embed a Facebook video, photo, album, event, page, profile, or post. Copy any facebook url to a single line on your post, or use shortcode [facebook='url' width='' ] more info at <a href="http://www.wpembedfb.com" title="plugin website">www.wpembedfb.com</a>
6
  Author: Miguel Sirvent
7
- Version: 1.9.6.7
8
  Author URI: http://profiles.wordpress.org/poxtron/
9
  */
 
 
 
10
 
11
- /*
12
- * Constant definitions
13
- */
14
- define("WPEMFBDIR",plugin_dir_path( __FILE__ ));
15
- define("WPEMFBURL",plugin_dir_url( __FILE__ ));
16
- define("WPEMFBSLUG",dirname(plugin_basename(__FILE__)));
17
- // core include
18
- require_once WPEMFBDIR.'lib/core.php';
 
 
19
 
20
- /*
21
- * ALL actions, filters and hooks.
22
- */
23
- register_activation_hook(__FILE__, array('WP_Embed_FB', 'install') );
24
- register_uninstall_hook(__FILE__, array('WP_Embed_FB', 'uninstall') );
25
- register_deactivation_hook(__FILE__, array('WP_Embed_FB', 'deactivate'));
26
- add_action('init',array('WP_Embed_FB','init'),1);
27
- add_action('wp_enqueue_scripts', array('WP_Embed_FB', 'wp_enqueue_scripts') );
28
- wp_embed_register_handler("wpembedfb","/(http|https):\/\/www\.facebook\.com\/([^<\s]*)/",array("WP_Embed_FB","embed_register_handler"));
29
  add_shortcode('facebook', array('WP_Embed_FB','shortcode') );
30
- //optional filter to content anonymous function
31
- if( get_option('wpemfb_fb_root') === 'true' ){
32
- add_filter('the_content', array('WP_Embed_FB','fb_root'),10,1);
33
- }
34
 
35
  if(is_admin()){
36
- require_once WPEMFBDIR.'lib/admin.php';
37
- add_action('admin_menu', array('EmbFbAdmin','add_page'));
38
- add_action( 'admin_enqueue_scripts', array('EmbFbAdmin','admin_enqueue_scripts'), 10,1);
39
- add_action( 'admin_init', array('EmbFbAdmin','admin_init'));
40
- }
 
 
2
  /*
3
  Plugin Name: WP Embed Facebook
4
  Plugin URI: http://www.wpembedfb.com
5
+ Description: Embed any public Facebook video, photo, album, event, page, profile, or post. Copy the facebook url to a single line on your post, or use shortcode [facebook=url ] more information at <a href="http://www.wpembedfb.com" title="plugin website">www.wpembedfb.com</a>
6
  Author: Miguel Sirvent
7
+ Version: 2.0
8
  Author URI: http://profiles.wordpress.org/poxtron/
9
  */
10
+ require_once('lib/class-wp-embed-fb-plugin.php');
11
+ require_once('lib/class-wef-social-plugins.php');
12
+ require_once('lib/class-wp-embed-fb.php');
13
 
14
+ add_action('init',array('WP_Embed_FB_Plugin','init'),1);//DONE
15
+
16
+ register_activation_hook(__FILE__, array('WP_Embed_FB_Plugin', 'install') );
17
+ register_uninstall_hook(__FILE__, array('WP_Embed_FB_Plugin', 'uninstall') );
18
+ register_deactivation_hook(__FILE__, array('WP_Embed_FB_Plugin', 'deactivate'));
19
+
20
+ add_action('wp_enqueue_scripts', array('WP_Embed_FB_Plugin', 'wp_enqueue_scripts') );
21
+
22
+ if( get_option('wpemfb_fb_root') === 'true' )
23
+ add_filter('the_content', array('WP_Embed_FB_Plugin','fb_root'),10,1);
24
 
 
 
 
 
 
 
 
 
 
25
  add_shortcode('facebook', array('WP_Embed_FB','shortcode') );
26
+
27
+ wp_embed_register_handler("wpembedfb","/(http|https):\/\/www\.facebook\.com\/([^<\s]*)/",array("WP_Embed_FB","embed_register_handler"));
 
 
28
 
29
  if(is_admin()){
30
+ require_once('lib/class-wp-embed-fb-admin.php');
31
+ add_action('admin_menu', array('WP_Embed_FB_Admin','add_page'));
32
+ add_action('admin_init', array('WP_Embed_FB_Admin','admin_init'));
33
+ add_action('admin_enqueue_scripts', array('WP_Embed_FB_Admin','admin_enqueue_scripts'), 10,1);
34
+ }
35
+
36
+