WP Embed Facebook - Version 1.7

Version Description

  • Better detection of video urls
  • FB js now loaded via jquery
  • More comprehensive admin section
  • Fix -- pictures not showing on chrome
Download this release

Release Info

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

Code changes from version 1.6.2 to 1.7

lang/.pot.pot DELETED
@@ -1,15 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: wp-embed-fb\n"
4
- "POT-Creation-Date: 2014-02-26 10:48-0600\n"
5
- "PO-Revision-Date: 2014-02-26 10:51-0600\n"
6
- "Last-Translator: \n"
7
- "Language-Team: \n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "X-Generator: Poedit 1.6.4\n"
12
- "X-Poedit-Basepath: .\n"
13
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
14
- "Language: en_US\n"
15
- "X-Poedit-SourceCharset: UTF-8\n"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lang/wp-embed-facebook-en_US.mo ADDED
Binary file
lang/wp-embed-facebook-en_US.po ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WP Embed Facebook\n"
4
+ "POT-Creation-Date: 2014-10-26 12:02-0600\n"
5
+ "PO-Revision-Date: 2014-10-26 12:03-0600\n"
6
+ "Last-Translator: Miguel Sirvent <miguel.sirvent@gmail.com>\n"
7
+ "Language-Team: \n"
8
+ "Language: en_US\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.6.10\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "X-Poedit-KeywordsList: _e;_x;__\n"
16
+ "X-Poedit-SearchPath-0: ..\n"
17
+
18
+ #: ../lib/admin.php:132
19
+ msgid "Facebook application data"
20
+ msgstr ""
21
+
22
+ #: ../lib/admin.php:150
23
+ msgid "General Options"
24
+ msgstr ""
25
+
26
+ #: ../lib/admin.php:155
27
+ msgid "Template to use"
28
+ msgstr ""
29
+
30
+ #: ../lib/admin.php:164
31
+ msgid "Embed Max-Width"
32
+ msgstr ""
33
+
34
+ #: ../lib/admin.php:170
35
+ msgid "Number of Photos <br> on Embedded Albums"
36
+ msgstr ""
37
+
38
+ #: ../lib/admin.php:176
39
+ msgid "Show follow button <br>on Embedded Profiles"
40
+ msgstr ""
41
+
42
+ #: ../lib/admin.php:184
43
+ msgid "Embedded Fan Pages"
44
+ msgstr ""
45
+
46
+ #: ../lib/admin.php:189
47
+ msgid "Show like button"
48
+ msgstr ""
49
+
50
+ #: ../lib/admin.php:195
51
+ msgid "Show latest posts"
52
+ msgstr ""
53
+
54
+ #: ../lib/admin.php:201
55
+ msgid "Number of posts"
56
+ msgstr ""
57
+
58
+ #: ../lib/admin.php:209
59
+ msgid "Raw Embedded Options"
60
+ msgstr ""
61
+
62
+ #: ../lib/admin.php:214
63
+ msgid "Embed Videos Raw"
64
+ msgstr ""
65
+
66
+ #: ../lib/admin.php:215
67
+ msgid "not mobile friendly"
68
+ msgstr ""
69
+
70
+ #: ../lib/admin.php:223
71
+ msgid "Embed Photos Raw"
72
+ msgstr ""
73
+
74
+ #: ../lib/admin.php:241
75
+ msgid "Advanced Options"
76
+ msgstr ""
77
+
78
+ #: ../lib/admin.php:246
79
+ msgid "Enqueue Styles"
80
+ msgstr ""
81
+
82
+ #: ../lib/admin.php:252
83
+ msgid "Add fb-root on top of content"
84
+ msgstr ""
85
+
86
+ #: ../lib/admin.php:252
87
+ msgid "Some themes may not need this"
88
+ msgstr ""
89
+
90
+ #: ../lib/admin.php:258
91
+ msgid "Enqueue Lightbox script"
92
+ msgstr ""
93
+
94
+ #: ../lib/admin.php:264
95
+ msgid "Enqueue WPEmbedFB script"
96
+ msgstr ""
97
+
98
+ #: ../lib/admin.php:273
99
+ msgid "Save"
100
+ msgstr ""
101
+
102
+ #: ../lib/admin.php:277
103
+ msgid "Donate!"
104
+ msgstr ""
105
+
106
+ #: ../lib/admin.php:278
107
+ msgid "Help me keep this plugin up to date"
108
+ msgstr ""
109
+
110
+ #: ../lib/admin.php:279
111
+ msgid "Click the taco !"
112
+ msgstr ""
113
+
114
+ #: ../lib/admin.php:288
115
+ msgid "Searching for the Premium version ?"
116
+ msgstr ""
117
+
118
+ #: ../lib/admin.php:291
119
+ msgid "Embed Full Pages"
120
+ msgstr ""
121
+
122
+ #: ../lib/admin.php:294
123
+ msgid "Embed Events with cover"
124
+ msgstr ""
125
+
126
+ #: ../lib/admin.php:297
127
+ msgid "More Resposive Teplates"
128
+ msgstr ""
129
+
130
+ #: ../lib/admin.php:300
131
+ msgid "Comming Soon"
132
+ msgstr ""
133
+
134
+ #: ../lib/admin.php:305
135
+ msgid "Plugin Web Site"
136
+ msgstr ""
137
+
138
+ #: ../lib/core.php:321
139
+ #, php-format
140
+ msgid "%d people like this."
141
+ msgstr ""
142
+
143
+ #: ../templates/classic/event.php:33 ../templates/default/event.php:37
144
+ msgid "Creator: "
145
+ msgstr ""
146
+
147
+ #: ../templates/default/com-page.php:25 ../templates/default/com-page.php:26
148
+ #: ../templates/default/page.php:44 ../templates/default/page.php:45
149
+ msgid "Web Site"
150
+ msgstr ""
151
+
152
+ #: ../templates/default/event.php:29
153
+ msgid "@ "
154
+ msgstr ""
lang/wp-embed-facebook-es_ES.mo CHANGED
Binary file
lang/wp-embed-facebook-es_ES.po CHANGED
@@ -1,9 +1,9 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: WP Embed Facebook v1.4\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: \n"
6
- "PO-Revision-Date: 2014-04-02 08:53:31+0000\n"
7
  "Last-Translator: Miguel Sirvent <miguel.sirvent@gmail.com>\n"
8
  "Language-Team: Miguel Sirvent <miguel.sirvent@gmail.com>\n"
9
  "MIME-Version: 1.0\n"
@@ -20,159 +20,184 @@ msgstr ""
20
  "X-Poedit-SearchPath-0: .\n"
21
  "X-Textdomain-Support: yes"
22
 
23
- #: lib/admin.php:77
24
  #@ wp-embed-facebook
25
  msgid "Facebook application data"
26
  msgstr "Datos de la App de Facebook"
27
 
28
- #: lib/admin.php:92
29
  #@ wp-embed-facebook
30
- msgid "Theme to use"
31
- msgstr "Tema a usar"
32
 
33
- #: lib/admin.php:101
34
  #@ wp-embed-facebook
35
- msgid "Fb Cover Embed Width"
36
- msgstr "Ancho del incrustado"
37
 
38
- #: lib/admin.php:108
39
  #@ wp-embed-facebook
40
- msgid "Embed video as Post"
41
- msgstr "Incrustar video como publicación"
42
 
43
- #: lib/admin.php:114
44
  #@ wp-embed-facebook
45
- msgid "Embed photo as Post"
46
- msgstr "Incrustar foto como publicación"
47
 
48
- #: lib/admin.php:120
49
  #@ wp-embed-facebook
50
- msgid "Add like button to embedded pages"
51
- msgstr "Agregar boton ¨me gusta¨ a las paginas incrustadas"
52
 
53
- #: lib/admin.php:126
54
  #@ wp-embed-facebook
55
- msgid "Show follow button"
56
- msgstr "Mostrar el boton de seguir"
57
 
58
- #: lib/admin.php:134
59
  #@ wp-embed-facebook
60
- msgid "Advanced Options"
61
- msgstr "Opciones Avanzadas"
62
 
63
- #: lib/admin.php:138
64
  #@ wp-embed-facebook
65
- msgid "Enqueue Styles"
66
- msgstr "Incluir css"
67
 
68
- #: lib/admin.php:144
69
  #@ wp-embed-facebook
70
- msgid "Add fb-root and js on top of content"
71
- msgstr "Incluir el fb-root y js al inicio del contenido"
72
 
73
- #: lib/admin.php:144
74
  #@ wp-embed-facebook
75
- msgid "Some themes may not need this"
76
- msgstr "Algunos themes pueden no necesitar esto"
77
 
78
- #: lib/admin.php:152
 
 
 
79
  #@ wp-embed-facebook
80
- msgid "Save"
81
- msgstr "Guardar"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
- #: lib/admin.php:161
84
  #@ wp-embed-facebook
85
- msgid "Customize"
86
- msgstr "Customizar"
87
 
88
  #: lib/admin.php:164
89
  #@ wp-embed-facebook
90
- msgid "Support"
91
- msgstr "Soporte"
92
 
93
- #: lib/admin.php:168
94
  #@ wp-embed-facebook
95
- msgid "Plugin Web Site"
96
- msgstr "Sitio Web del Plugin"
97
 
98
  #: lib/admin.php:176
99
  #@ wp-embed-facebook
100
- msgid "Donate!"
101
- msgstr "¡Dona!"
102
 
103
- #: lib/admin.php:177
104
  #@ wp-embed-facebook
105
- msgid "Help me keep this plugin up to date"
106
- msgstr "Ayúdame a mantener este plugin actualizado"
107
 
108
- #: lib/admin.php:178
109
  #@ wp-embed-facebook
110
- msgid "Click the taco !"
111
- msgstr "¡Click en el Taco!"
112
 
113
- #: lib/admin.php:187
114
  #@ wp-embed-facebook
115
- msgid "Searching for the Premium version ?"
116
- msgstr "¿ Buscas la versión premium ?"
117
 
118
- #: lib/admin.php:190
119
  #@ wp-embed-facebook
120
- msgid "Custom templates"
121
- msgstr "Templates nuevos"
122
 
123
- #: lib/admin.php:193
124
  #@ wp-embed-facebook
125
- msgid "Compatibility with all themes imaginable"
126
- msgstr "Compatibilidad con más themes"
127
 
128
- #: lib/admin.php:196
129
  #@ wp-embed-facebook
130
- msgid "Multiple fb app id's per each multisite site"
131
- msgstr "Multiples apps de fb para cada sitio en multisite"
132
 
133
- #: lib/admin.php:199
134
  #@ wp-embed-facebook
135
- msgid "Comming Soon"
136
- msgstr "Proximamente"
137
 
138
- #: lib/core.php:234
139
  #@ wp-embed-facebook
140
- msgid "Web Site"
141
- msgstr "Sitio Web"
142
 
143
- #: lib/core.php:242
144
- #@ default
145
- msgid "Museum/art gallery"
146
- msgstr ""
147
 
148
- #: lib/core.php:243
149
- #@ default
150
- msgid "Local business"
151
  msgstr ""
152
 
153
- #: lib/core.php:244
154
- #@ default
155
- msgid "Concert venue"
156
  msgstr ""
157
 
158
- #: lib/core.php:245
159
- #@ default
160
- msgid "Public places"
161
- msgstr ""
162
 
163
- #: lib/core.php:288
164
- #, php-format
165
  #@ wp-embed-facebook
166
- msgid "%d people like this."
167
- msgstr "%d les gusta esto"
168
 
169
- #: templates/classic/event.php:33 templates/default/event.php:36
170
  #@ wp-embed-facebook
171
- msgid "Creator: "
172
- msgstr "Creador: "
173
 
174
- #: templates/classic/page.php:36 templates/default/page.php:34
175
  #@ wp-embed-facebook
176
- msgid "category"
177
- msgstr "categoria"
178
 
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: WP Embed Facebook v1.7\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: 2014-10-24 21:27:06+0000\n"
7
  "Last-Translator: Miguel Sirvent <miguel.sirvent@gmail.com>\n"
8
  "Language-Team: Miguel Sirvent <miguel.sirvent@gmail.com>\n"
9
  "MIME-Version: 1.0\n"
20
  "X-Poedit-SearchPath-0: .\n"
21
  "X-Textdomain-Support: yes"
22
 
23
+ #: lib/admin.php:132
24
  #@ wp-embed-facebook
25
  msgid "Facebook application data"
26
  msgstr "Datos de la App de Facebook"
27
 
28
+ #: lib/admin.php:241
29
  #@ wp-embed-facebook
30
+ msgid "Advanced Options"
31
+ msgstr "Opciones Avanzadas"
32
 
33
+ #: lib/admin.php:246
34
  #@ wp-embed-facebook
35
+ msgid "Enqueue Styles"
36
+ msgstr "Incluir css"
37
 
38
+ #: lib/admin.php:252
39
  #@ wp-embed-facebook
40
+ msgid "Some themes may not need this"
41
+ msgstr "Algunos themes pueden no necesitar esto"
42
 
43
+ #: lib/admin.php:273
44
  #@ wp-embed-facebook
45
+ msgid "Save"
46
+ msgstr "Guardar"
47
 
48
+ #: lib/admin.php:305
49
  #@ wp-embed-facebook
50
+ msgid "Plugin Web Site"
51
+ msgstr "Sitio Web del Plugin"
52
 
53
+ #: lib/admin.php:277
54
  #@ wp-embed-facebook
55
+ msgid "Donate!"
56
+ msgstr "¡Dona!"
57
 
58
+ #: lib/admin.php:278
59
  #@ wp-embed-facebook
60
+ msgid "Help me keep this plugin up to date"
61
+ msgstr "Ayúdame a mantener este plugin actualizado"
62
 
63
+ #: lib/admin.php:279
64
  #@ wp-embed-facebook
65
+ msgid "Click the taco !"
66
+ msgstr "¡Click en el Taco!"
67
 
68
+ #: lib/admin.php:288
69
  #@ wp-embed-facebook
70
+ msgid "Searching for the Premium version ?"
71
+ msgstr "¿ Buscas la versión premium ?"
72
 
73
+ #: lib/admin.php:300
74
  #@ wp-embed-facebook
75
+ msgid "Comming Soon"
76
+ msgstr "Proximamente"
77
 
78
+ #: templates/default/com-page.php:25
79
+ #: templates/default/com-page.php:26
80
+ #: templates/default/page.php:44
81
+ #: templates/default/page.php:45
82
  #@ wp-embed-facebook
83
+ msgid "Web Site"
84
+ msgstr "Sitio Web"
85
+
86
+ #: lib/core.php:321
87
+ #, php-format
88
+ #@ wp-embed-facebook
89
+ msgid "%d people like this."
90
+ msgstr "%d les gusta esto"
91
+
92
+ #: templates/classic/event.php:33
93
+ #: templates/default/event.php:37
94
+ #@ wp-embed-facebook
95
+ msgid "Creator: "
96
+ msgstr "Creador: "
97
+
98
+ #: templates/classic/page.php:37
99
+ #: templates/default/page.php:40
100
+ #@ wp-embed-facebook
101
+ msgid "category"
102
+ msgstr "categoria"
103
+
104
+ #: lib/admin.php:150
105
+ #@ wp-embed-Facebook
106
+ msgid "General Options"
107
+ msgstr ""
108
 
109
+ #: lib/admin.php:155
110
  #@ wp-embed-facebook
111
+ msgid "Template to use"
112
+ msgstr "Template a usar"
113
 
114
  #: lib/admin.php:164
115
  #@ wp-embed-facebook
116
+ msgid "Embed Max-Width"
117
+ msgstr "Ancho máximo del incrustado"
118
 
119
+ #: lib/admin.php:170
120
  #@ wp-embed-facebook
121
+ msgid "Number of Photos <br> on Embedded Albums"
122
+ msgstr "Numero de fotos <br> en Albumes Incrustados"
123
 
124
  #: lib/admin.php:176
125
  #@ wp-embed-facebook
126
+ msgid "Show follow button <br>on Embedded Profiles"
127
+ msgstr "Mostrar boton de segur <br>en Perfiles Incrustados"
128
 
129
+ #: lib/admin.php:184
130
  #@ wp-embed-facebook
131
+ msgid "Embedded Fan Pages"
132
+ msgstr "Incrustación de Fan Pages"
133
 
134
+ #: lib/admin.php:189
135
  #@ wp-embed-facebook
136
+ msgid "Show like button"
137
+ msgstr "Mostrar boton me gusta"
138
 
139
+ #: lib/admin.php:195
140
  #@ wp-embed-facebook
141
+ msgid "Show latest posts"
142
+ msgstr "Mostrar publicaciones recientes"
143
 
144
+ #: lib/admin.php:201
145
  #@ wp-embed-facebook
146
+ msgid "Number of posts"
147
+ msgstr "Numero de entradas"
148
 
149
+ #: lib/admin.php:209
150
  #@ wp-embed-facebook
151
+ msgid "Raw Embedded Options"
152
+ msgstr "Opciones de incrustaciones en crudo"
153
 
154
+ #: lib/admin.php:214
155
  #@ wp-embed-facebook
156
+ msgid "Embed Videos Raw"
157
+ msgstr "Incrustar videos en crudo"
158
 
159
+ #: lib/admin.php:215
160
  #@ wp-embed-facebook
161
+ msgid "not mobile friendly"
162
+ msgstr "no amigable con mobiles"
163
 
164
+ #: lib/admin.php:223
165
  #@ wp-embed-facebook
166
+ msgid "Embed Photos Raw"
167
+ msgstr "Incrustar fotos en crudo"
168
 
169
+ #: lib/admin.php:252
170
+ #@ wp-embed-facebook
171
+ msgid "Add fb-root on top of content"
172
+ msgstr "Agregar fb-root al inicio del contenido"
173
 
174
+ #: lib/admin.php:258
175
+ #@ wp-embed-facebook
176
+ msgid "Enqueue Lightbox script"
177
  msgstr ""
178
 
179
+ #: lib/admin.php:264
180
+ #@ wp-embed-facebook
181
+ msgid "Enqueue WPEmbedFB script"
182
  msgstr ""
183
 
184
+ #: lib/admin.php:291
185
+ #@ wp-embed-facebook
186
+ msgid "Embed Full Pages"
187
+ msgstr "Incrustado de paginas completo"
188
 
189
+ #: lib/admin.php:294
 
190
  #@ wp-embed-facebook
191
+ msgid "Embed Events with cover"
192
+ msgstr "Incrustar eventos con banner"
193
 
194
+ #: lib/admin.php:297
195
  #@ wp-embed-facebook
196
+ msgid "More Resposive Teplates"
197
+ msgstr "Más templates responsivos"
198
 
199
+ #: templates/default/event.php:29
200
  #@ wp-embed-facebook
201
+ msgid "@ "
202
+ msgstr "en"
203
 
lib/admin.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ jQuery(function() {
2
+ jQuery( "#accordion" ).accordion();
3
+ });
lib/admin.php CHANGED
@@ -1,6 +1,21 @@
1
  <?php
2
  //TODO add option
3
  class EmbFbAdmin{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  static function add_page(){
5
  add_options_page('EmbedFacebook', 'Embed Facebook', 'manage_options', 'embedfacebook', array('EmbFbAdmin', 'embedfb_page'));
6
  }
@@ -59,6 +74,21 @@ class EmbFbAdmin{
59
  }else{
60
  update_option('wpemfb_show_posts', 'false');
61
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
63
  }
64
  static function embedfb_page() {
@@ -72,126 +102,190 @@ class EmbFbAdmin{
72
  $checked5 = (get_option('wpemfb_raw_video') === 'true') ? 'checked' : '' ;
73
  $checked6 = (get_option('wpemfb_raw_photo') === 'true') ? 'checked' : '' ;
74
  $checked7 = (get_option('wpemfb_show_posts') === 'true') ? 'checked' : '' ;
 
 
 
 
75
  $sel1 = (get_option('wpemfb_theme') === 'default') ? 'selected' : '' ;
76
  $sel2 = (get_option('wpemfb_theme') === 'classic') ? 'selected' : '' ;
77
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  <div class="wrap">
79
  <h2>WP Embed Facebook</h2>
80
  <div class="welcome-panel">
81
  <div class="welcome-panel-content">
82
  <div class="welcome-panel-column-container">
83
- <div class="welcome-panel-column " style="width: 55%">
84
  <form id="config-form" action="#" method="post">
85
  <?php wp_nonce_field( 'wp-embed-facebook','save-data' ); ?>
86
- <h3 style="color: #23487F;"><?php _e('Facebook application data', 'wp-embed-facebook') ?></h3>
87
- <table class="form-table">
88
- <tbody>
89
- <tr valign="middle">
90
- <th>App ID</th>
91
- <td>
92
- <input type="text" name="wpemfb_app_id" required value="<?php echo get_option('wpemfb_app_id') ?>" size="29" />
93
- </td>
94
- </tr>
95
- <tr valign="middle">
96
- <th>App Secret</th>
97
- <td>
98
- <input type="text" name="wpemfb_app_secret" required value="<?php echo get_option('wpemfb_app_secret') ?>" size="29" />
99
- </td>
100
- </tr>
101
- </table>
102
- <h3 style="color: #23487F;"><?php _e('Embedded Pages Options', 'wp-embed-facebook') ?></h3>
103
- <table class="form-table">
104
- <tbody>
105
- <tr valign="middle">
106
- <th><?php _e('Show like button','wp-embed-facebook') ?></th>
107
- <td>
108
- <input type="checkbox" name="wpemfb_show_like" <?php echo $checked2 ?> />
109
- </td>
110
- </tr>
111
- <tr valign="middle">
112
- <th><?php _e('Show latest posts','wp-embed-facebook') ?></th>
113
- <td>
114
- <input type="checkbox" name="wpemfb_show_posts" <?php echo $checked7 ?> />
115
- </td>
116
- </tr>
117
- <tr valign="middle">
118
- <th><?php _e('Number of posts','wp-embed-facebook') ?></th>
119
- <td>
120
- <input type="number" name="wpemfb_max_posts" value="<?php echo get_option('wpemfb_max_posts') ?>" />
121
- </td>
122
- </tr>
123
- </tbody>
124
- </table>
125
- <h3 style="color: #23487F;"><?php _e('Other Options', 'wp-embed-facebook') ?></h3>
126
- <table class="form-table">
127
- <tbody>
128
- <tr>
129
- <th><?php _e("Template to use", 'wp-embed-facebook') ?></th>
130
- <td>
131
- <select name="wpemfb_theme">
132
- <option value="default" <?php echo $sel1 ?> >Default</option>
133
- <option value="classic" <?php echo $sel2 ?> >Classic</option>
134
- </select>
135
- </td>
136
- </tr>
137
- <tr valign="middle">
138
- <th><?php _e('Embed Max-Width','wp-embed-facebook') ?></th>
139
- <td>
140
- <input type="number" name="wpemfb_max_width" value="<?php echo get_option('wpemfb_max_width') ?>" />
141
- </td>
142
- </tr>
143
- <tr valign="middle">
144
- <th><?php _e('Photos in Album','wp-embed-facebook') ?></th>
145
- <td>
146
- <input type="number" name="wpemfb_max_photos" value="<?php echo get_option('wpemfb_max_photos') ?>" />
147
- </td>
148
- </tr>
149
- <tr valign="middle">
150
- <th><?php _e('Embed video as Post','wp-embed-facebook') ?></th>
151
- <td>
152
- <input type="checkbox" name="wpemfb_raw_video" <?php echo $checked5 ?> />
153
- </td>
154
- </tr>
155
- <tr valign="middle">
156
- <th><?php _e('Embed photo as Post','wp-embed-facebook') ?></th>
157
- <td>
158
- <input type="checkbox" name="wpemfb_raw_photo" <?php echo $checked6 ?> />
159
- </td>
160
- </tr>
161
- <tr valign="middle">
162
- <th><?php _e('Show follow button','wp-embed-facebook') ?></th>
163
- <td>
164
- <input type="checkbox" name="wpemfb_show_follow" <?php echo $checked4 ?> />
165
- </td>
166
- </tr>
167
- </tbody>
168
- </table>
169
- <h3 style="color: #23487F;"><?php _e('Advanced Options', 'wp-embed-facebook') ?></h3>
170
- <table class="form-table">
171
- <tbody>
172
- <tr valign="middle">
173
- <th><?php _e('Enqueue Styles','wp-embed-facebook') ?></th>
174
- <td>
175
- <input type="checkbox" name="wpemfb_enqueue_style" <?php echo $checked ?> />
176
- </td>
177
- </tr>
178
- <tr valign="middle">
179
- <th><?php _e('Add fb-root and js on top of content','wp-embed-facebook') ?><br><small><?php _e('Some themes may not need this','wp-embed-facebook') ?></small></th>
180
- <td>
181
- <input type="checkbox" name="wpemfb_fb_root" <?php echo $checked3 ?> />
182
- </td>
183
- </tr>
184
- <tr>
185
- <td>
186
- <?php //echo wp_nonce_field('wpebfb','nonce'); ?>
187
- <input type="submit" name="submit" class="button button-primary button-hero" value="<?php _e('Save','wp-embed-facebook') ?>" />
188
- </td>
189
- </tr>
190
- </tbody>
191
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  </form>
193
  </div>
194
- <div class="welcome-panel-column welcome-panel-last " style="width: 40%">
195
  <h3 style="color:#CF1912;"><?php _e('Donate!', 'wp-embed-facebook') ?></h3>
196
  <p><?php _e('Help me keep this plugin up to date', 'wp-embed-facebook') ?></p>
197
  <p><strong><?php _e('Click the taco !', 'wp-embed-facebook') ?></strong></p>
@@ -218,25 +312,19 @@ class EmbFbAdmin{
218
  <h3 style="color:#23487F; text-align:center;"><?php _e('Comming Soon', 'wp-embed-facebook') ?></h3>
219
  </p>
220
  <hr>
221
- <h4 style="color:#23487F;"><?php _e('Shortcode Examples:', 'wp-embed-facebook') ?></h4>
222
- <p><?php _e('Raw Photo', 'wp-embed-facebook') ?></p>
223
- <p>[facebook=https://www.facebook.com/photo.php?fbid=10150777131437722&set=a.10150777131307722.434719.6798562721 raw=true]</p>
224
- <p><?php _e('Raw is optional, and only works on photos and videos.', 'wp-embed-facebook') ?></p>
225
- <p><?php _e('Event', 'wp-embed-facebook') ?></p>
226
- <p>[facebook=https://www.facebook.com/events/611232852279921/ ]</p>
227
- <p><strong><?php _e('You can avoid the shortcode by placing the url on a single line', 'wp-embed-facebook') ?></strong></p>
228
  <hr>
229
- <p style="text-align: center">
230
  <img src="<?php echo plugins_url('/img/hechoenmexico.png', __FILE__) ?>" width="60px" />
231
  </p>
232
- <p><a href="http://www.wpembedfb.com"><?php _e('Plugin Web Site','wp-embed-facebook') ?></a></p>
233
  </div>
234
- <!-- <div class="welcome-panel-column welcome-panel-last"> -->
235
  </div>
236
  </div>
237
  </div>
238
- </div><!-- .wrap -- 766>
239
-
240
  <?php
241
  }
242
  }
1
  <?php
2
  //TODO add option
3
  class EmbFbAdmin{
4
+ static function admin_enqueue_scripts($hook_suffix){
5
+ if($hook_suffix == 'settings_page_embedfacebook'){
6
+ global $wp_scripts;
7
+ wp_enqueue_script('wpemfb-admin', WP_PLUGIN_URL."/".WPEMFBSLUG.'/lib/admin.js',array('jquery-ui-accordion'));
8
+ $queryui = $wp_scripts->query('jquery-ui-core');
9
+ $url = "http://ajax.googleapis.com/ajax/libs/jqueryui/".$queryui->ver."/themes/smoothness/jquery-ui.css";
10
+ wp_enqueue_style('jquery-ui-start', $url, false, null);
11
+ }
12
+ $translation_array = array( 'local' => get_locale(), 'fb_id'=>get_option('wpemfb_app_id'), 'fb_root'=>get_option('wpemfb_fb_root') );
13
+ wp_localize_script( 'wpemfb', 'WEF', $translation_array );
14
+ }
15
+ static function admin_init(){
16
+ $theme = get_option('wpemfb_theme');
17
+ add_editor_style( plugins_url('/'.WPEMFBSLUG.'/templates/'.$theme.'/wpemfb.css') );
18
+ }
19
  static function add_page(){
20
  add_options_page('EmbedFacebook', 'Embed Facebook', 'manage_options', 'embedfacebook', array('EmbFbAdmin', 'embedfb_page'));
21
  }
74
  }else{
75
  update_option('wpemfb_show_posts', 'false');
76
  }
77
+ if(isset($_POST['wpemfb_raw_post'])){
78
+ update_option('wpemfb_raw_post', 'true');
79
+ }else{
80
+ update_option('wpemfb_raw_post', 'false');
81
+ }
82
+ if(isset($_POST['wpemfb_enq_lightbox'])){
83
+ update_option('wpemfb_enq_lightbox', 'true');
84
+ }else{
85
+ update_option('wpemfb_enq_lightbox', 'false');
86
+ }
87
+ if(isset($_POST['wpemfb_enq_wpemfb'])){
88
+ update_option('wpemfb_enq_wpemfb', 'true');
89
+ }else{
90
+ update_option('wpemfb_enq_wpemfb', 'false');
91
+ }
92
  }
93
  }
94
  static function embedfb_page() {
102
  $checked5 = (get_option('wpemfb_raw_video') === 'true') ? 'checked' : '' ;
103
  $checked6 = (get_option('wpemfb_raw_photo') === 'true') ? 'checked' : '' ;
104
  $checked7 = (get_option('wpemfb_show_posts') === 'true') ? 'checked' : '' ;
105
+
106
+ $checked8 = (get_option('wpemfb_raw_post') === 'true') ? 'checked' : '' ;
107
+ $checked9 = (get_option('wpemfb_enq_lightbox') === 'true') ? 'checked' : '' ;
108
+ $checked10 = (get_option('wpemfb_enq_wpemfb') === 'true') ? 'checked' : '' ;
109
  $sel1 = (get_option('wpemfb_theme') === 'default') ? 'selected' : '' ;
110
  $sel2 = (get_option('wpemfb_theme') === 'classic') ? 'selected' : '' ;
111
  ?>
112
+ <style>
113
+ .ui-widget-content th{
114
+ font-weight: normal;
115
+ padding-right: 10px;
116
+ }
117
+ .settings-col{
118
+ width: 50% !important;
119
+ padding-right: 2% !important;
120
+ text-align: left !important;
121
+ }
122
+ .welcome-panel-last{
123
+ width: 47% !important;
124
+ text-align: center;
125
+ }
126
+ @media (max-width:870px){
127
+ .settings-col{
128
+ width: 100% !important;
129
+ }
130
+ .welcome-panel-last{
131
+ width: 100% !important;
132
+ }
133
+ }
134
+ </style>
135
  <div class="wrap">
136
  <h2>WP Embed Facebook</h2>
137
  <div class="welcome-panel">
138
  <div class="welcome-panel-content">
139
  <div class="welcome-panel-column-container">
140
+ <div class="welcome-panel-column settings-col" >
141
  <form id="config-form" action="#" method="post">
142
  <?php wp_nonce_field( 'wp-embed-facebook','save-data' ); ?>
143
+ <div id="accordion">
144
+ <h5><?php _e('Facebook application data', 'wp-embed-facebook') ?></h5>
145
+ <div>
146
+ <table>
147
+ <tbody>
148
+ <tr valign="middle">
149
+ <th>App ID</th>
150
+ <td>
151
+ <input type="text" name="wpemfb_app_id" required value="<?php echo get_option('wpemfb_app_id') ?>" size="38" />
152
+ </td>
153
+ </tr>
154
+ <tr valign="middle">
155
+ <th>App Secret</th>
156
+ <td>
157
+ <input type="text" name="wpemfb_app_secret" required value="<?php echo get_option('wpemfb_app_secret') ?>" size="38" />
158
+ </td>
159
+ </tr>
160
+ </table>
161
+ </div>
162
+ <h5><?php _e('General Options','wp-embed-Facebook') ?></h5>
163
+ <div>
164
+ <table>
165
+ <tbody>
166
+ <tr>
167
+ <th><?php _e("Template to use", 'wp-embed-facebook') ?></th>
168
+ <td>
169
+ <select name="wpemfb_theme">
170
+ <option value="default" <?php echo $sel1 ?> >Default</option>
171
+ <option value="classic" <?php echo $sel2 ?> >Classic</option>
172
+ </select>
173
+ </td>
174
+ </tr>
175
+ <tr valign="middle">
176
+ <th><?php _e('Embed Max-Width','wp-embed-facebook') ?></th>
177
+ <td>
178
+ <input type="number" name="wpemfb_max_width" value="<?php echo get_option('wpemfb_max_width') ?>" />
179
+ </td>
180
+ </tr>
181
+ <tr valign="middle">
182
+ <th><?php _e('Number of Photos <br> on Embedded Albums','wp-embed-facebook') ?></th>
183
+ <td>
184
+ <input type="number" name="wpemfb_max_photos" value="<?php echo get_option('wpemfb_max_photos') ?>" />
185
+ </td>
186
+ </tr>
187
+ <tr valign="middle">
188
+ <th><?php _e('Show follow button <br>on Embedded Profiles','wp-embed-facebook') ?></th>
189
+ <td>
190
+ <input type="checkbox" name="wpemfb_show_follow" <?php echo $checked4 ?> />
191
+ </td>
192
+ </tr>
193
+ </tbody>
194
+ </table>
195
+ </div>
196
+ <h5><?php _e('Embedded Fan Pages', 'wp-embed-facebook') ?></h5>
197
+ <div>
198
+ <table>
199
+ <tbody>
200
+ <tr valign="middle">
201
+ <th><?php _e('Show like button','wp-embed-facebook') ?></th>
202
+ <td>
203
+ <input type="checkbox" name="wpemfb_show_like" <?php echo $checked2 ?> />
204
+ </td>
205
+ </tr>
206
+ <tr valign="middle">
207
+ <th><?php _e('Show latest posts','wp-embed-facebook') ?></th>
208
+ <td>
209
+ <input type="checkbox" name="wpemfb_show_posts" <?php echo $checked7 ?> />
210
+ </td>
211
+ </tr>
212
+ <tr valign="middle">
213
+ <th><?php _e('Number of posts','wp-embed-facebook') ?></th>
214
+ <td>
215
+ <input type="number" name="wpemfb_max_posts" value="<?php echo get_option('wpemfb_max_posts') ?>" style="width: 60px;"/>
216
+ </td>
217
+ </tr>
218
+ </tbody>
219
+ </table>
220
+ </div>
221
+ <h5><?php _e('Raw Embedded Options', 'wp-embed-facebook') ?></h5>
222
+ <div>
223
+ <table>
224
+ <tbody>
225
+ <tr valign="middle">
226
+ <th><?php _e('Embed Videos Raw','wp-embed-facebook') ?>
227
+ <br><small><?php _e('not mobile friendly','wp-embed-facebook') ?></small>
228
+ </th>
229
+
230
+ <td>
231
+ <input type="checkbox" name="wpemfb_raw_video" <?php echo $checked5 ?> />
232
+ </td>
233
+ </tr>
234
+ <tr valign="middle">
235
+ <th><?php _e('Embed Photos Raw','wp-embed-facebook') ?></th>
236
+ <td>
237
+ <input type="checkbox" name="wpemfb_raw_photo" <?php echo $checked6 ?> />
238
+ </td>
239
+ </tr>
240
+ <?php
241
+ /*
242
+ <tr valign="middle">
243
+ <th><?php _e('Embed Posts Raw','wp-embed-facebook') ?></th>
244
+ <td>
245
+ <input type="checkbox" name="wpemfb_raw_post" <?php echo $checked8 ?> />
246
+ </td>
247
+ </tr>
248
+ */
249
+ ?>
250
+ </tbody>
251
+ </table>
252
+ </div>
253
+ <h5><?php _e('Advanced Options', 'wp-embed-facebook') ?></h5>
254
+ <div>
255
+ <table>
256
+ <tbody>
257
+ <tr valign="middle">
258
+ <th><?php _e('Enqueue Styles','wp-embed-facebook') ?></th>
259
+ <td>
260
+ <input type="checkbox" name="wpemfb_enqueue_style" <?php echo $checked ?> />
261
+ </td>
262
+ </tr>
263
+ <tr valign="middle">
264
+ <th><?php _e('Add fb-root on top of content','wp-embed-facebook') ?><br><small><?php _e('Some themes may not need this','wp-embed-facebook') ?></small></th>
265
+ <td>
266
+ <input type="checkbox" name="wpemfb_fb_root" <?php echo $checked3 ?> />
267
+ </td>
268
+ </tr>
269
+ <tr valign="middle">
270
+ <th><?php _e('Enqueue Lightbox script','wp-embed-facebook') ?></th>
271
+ <td>
272
+ <input type="checkbox" name="wpemfb_enq_lightbox" <?php echo $checked9 ?> />
273
+ </td>
274
+ </tr>
275
+ <tr valign="middle">
276
+ <th><?php _e('Enqueue WPEmbedFB script','wp-embed-facebook') ?><br></th>
277
+ <td>
278
+ <input type="checkbox" name="wpemfb_enq_wpemfb" <?php echo $checked10 ?> />
279
+ </td>
280
+ </tr>
281
+ </tbody>
282
+ </table>
283
+ </div>
284
+ </div>
285
+ <input type="submit" name="submit" class="button button-primary button-hero" value="<?php _e('Save','wp-embed-facebook') ?>" />
286
  </form>
287
  </div>
288
+ <div class="welcome-panel-column welcome-panel-last" >
289
  <h3 style="color:#CF1912;"><?php _e('Donate!', 'wp-embed-facebook') ?></h3>
290
  <p><?php _e('Help me keep this plugin up to date', 'wp-embed-facebook') ?></p>
291
  <p><strong><?php _e('Click the taco !', 'wp-embed-facebook') ?></strong></p>
312
  <h3 style="color:#23487F; text-align:center;"><?php _e('Comming Soon', 'wp-embed-facebook') ?></h3>
313
  </p>
314
  <hr>
315
+ <p>
316
+ <small>More information</small><br>
317
+ <a href="http://www.wpembedfb.com" style="color:#23487F;"><?php _e('Plugin Web Site','wp-embed-facebook') ?></a>
318
+ </p>
 
 
 
319
  <hr>
320
+ <p>
321
  <img src="<?php echo plugins_url('/img/hechoenmexico.png', __FILE__) ?>" width="60px" />
322
  </p>
 
323
  </div>
 
324
  </div>
325
  </div>
326
  </div>
327
+ </div>
 
328
  <?php
329
  }
330
  }
lib/core.php CHANGED
@@ -2,6 +2,7 @@
2
  /*
3
  * Main Class of the plugin.
4
  */
 
5
  class WP_Embed_FB {
6
  static $fbsdk;
7
  static $width = '';
@@ -41,9 +42,13 @@ class WP_Embed_FB {
41
  delete_site_option($option);
42
  }
43
  }
44
- self::whois(false);
45
  return;
46
  }
 
 
 
 
47
  /*
48
  * Default options
49
  */
@@ -62,12 +67,17 @@ class WP_Embed_FB {
62
  'wpemfb_fb_root' => 'true',
63
  'wpemfb_theme' => 'default',
64
  'wpemfb_show_follow' => 'true',
65
- 'wpemfb_raw_video' => 'true',
66
  'wpemfb_raw_photo' => 'false',
 
 
 
67
  );
68
  }
69
- protected static function whois($install = true){
70
- //TODO: send site url to wpembedfb site
 
 
71
  return true;
72
  }
73
  /*
@@ -81,25 +91,32 @@ class WP_Embed_FB {
81
  * Enqueue wp embed facebook styles
82
  */
83
  static function wp_enqueue_scripts(){
84
- $theme = get_option('wpemfb_theme');
85
- wp_register_style( 'wpemfb-style', plugins_url('/'.WPEMFBSLUG.'/templates/'.$theme.'/wpemfb.css'));
86
- wp_register_style( 'wpemfb-lightbox', plugins_url('/'.WPEMFBSLUG.'/lib/lightbox2/css/lightbox.css'));
87
  if(get_option('wpemfb_enqueue_style') == 'true'){
 
 
 
88
  wp_enqueue_style('wpemfb-style');
89
  wp_enqueue_style('wpemfb-lightbox');
90
  }
91
-
92
- wp_enqueue_script(
93
- 'wpemfb-lightbox',
94
- plugins_url('/'.WPEMFBSLUG.'/lib/lightbox2/js/lightbox.min.js'),
95
- array( 'jquery' )
96
- );
97
- wp_enqueue_script(
98
- 'wpemfb-responsive',
99
- plugins_url('/'.WPEMFBSLUG.'/lib/responsive.js'),
100
- array( 'jquery' )
101
- );
102
-
 
 
 
 
 
 
 
103
  }
104
  /*
105
  * the_content filter to process fb url's
@@ -120,8 +137,7 @@ class WP_Embed_FB {
120
  * Extract fb_id from the url
121
  * @param array $match[2]=the juice from the url
122
  */
123
- static function fb_embed($match){ //TODO: photos!
124
-
125
  //extract fbid from url good for profiles, pages, comunity pages, raw photos, events
126
  $vars = array();
127
  $type = '';
@@ -156,33 +172,33 @@ class WP_Embed_FB {
156
 
157
  //TODO: check if its event and pull cover photo, probably only fro premium
158
  do_action('fb_embed_plus');
159
-
160
- //photos and videos
161
- if( 'photo.php' == $last || ( array_search('photos',$clean) !== false ) ){
162
- if(!empty(self::$raw)){
163
- $raw_photo = self::$raw;
164
- $raw_video = self::$raw;
 
 
 
 
 
 
 
165
  } else {
166
- $raw_photo = get_option('wpemfb_raw_photo') == 'true' ? 'false' : 'true';
167
- $raw_video = get_option('wpemfb_raw_video') == 'true' ? 'false' : 'true';
168
- }
169
- if(isset($vars['v'])){ //is video
170
- if($raw_video == 'true'){
171
- $fb_data = array( 'v_id' => $vars['v'], 'is_video' => '' );
172
- return self::print_fb_data($fb_data);
173
- } else {
174
- $fb_data = array( 'link' => $match[2],'is_post' => '' );
175
- return self::print_fb_data($fb_data);
176
- }
177
- } else { //is photo
178
- if($raw_photo == 'true'){
179
- return self::fb_api_get($fb_id, $match[2]);
180
- } else {
181
- $fb_data = array( 'link' => $match[2],'is_post' => '' );
182
- return self::print_fb_data($fb_data);
183
- }
184
  }
185
  }
 
 
 
 
 
 
 
 
 
186
 
187
  return self::fb_api_get($fb_id, $match[2], $type);
188
  }
@@ -194,23 +210,27 @@ class WP_Embed_FB {
194
  $wp_emb_fbsdk = self::$fbsdk;
195
  try {
196
  if(empty($type))
197
- $fb_data = $wp_emb_fbsdk->api('/'.$fb_id);
198
  elseif($type == 'album')
199
  $fb_data = $wp_emb_fbsdk->api('/'.$fb_id.'?fields=name,id,from,photos.fields(name,picture,source).limit('.get_option("wpemfb_max_photos").')');
200
  //$res = '<pre>'.print_r($fb_data,true).'</pre>'; //to inspect what elements are queried by default
201
  if(isset($fb_data['category']) && get_option("wpemfb_show_posts") == "true")
202
  $fb_data = $fb_data + $wp_emb_fbsdk->api('/'.$fb_data['id'].'?fields=posts.limit('.get_option("wpemfb_max_posts").'){message,shares,link,picture,object_id,likes.limit(1).summary(true),comments.limit(1).summary(true)}');
 
 
203
  $res = self::print_fb_data($fb_data);
204
  } catch(FacebookApiException $e) {
205
- $res = '<p><a href="http://wwww.facebook.com/'.$url.'" target="_blank" rel="nofollow">http://wwww.facebook.com/'.$url.'</a>';
206
  //uncoment this lines to debug
207
- /*
208
  if(is_super_admin()){
209
- $res .= '<span style="color: red">'.__('This facebook link is not public', 'wp-embed-facebook').'</span></p>';
210
- $res .= print_r($e->getResult(),true);
211
- $res .= 'fb_id'.$fb_id;
 
212
  }
213
- */
 
214
  }
215
  return $res;
216
  }
@@ -261,8 +281,8 @@ class WP_Embed_FB {
261
  $template = self::locate_template('profile');
262
  }
263
  ob_start();
264
- include($template);
265
- return ob_get_clean();
266
  }
267
  /**
268
  * Locate the template inside plugin or theme
@@ -286,23 +306,6 @@ class WP_Embed_FB {
286
  $url = explode(' ',$urls);
287
  return $url[0];
288
  }
289
- /**
290
- * facebook scripts required to show like buttons and posts added on top of the content
291
- * @param string the post content
292
- */
293
- static function fb_scripts($the_content){
294
- $opt = get_option('wpemfb_fb_root');
295
- if($opt === 'true'){
296
- ob_start();
297
- ?>
298
- <div id="fb-root"></div>
299
- <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() ?>/all.js#xfbml=1&appId=<?php echo get_option('wpemfb_app_id') ?>"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
300
- <?php
301
- $scripts = ob_get_clean();
302
- return $scripts.$the_content;
303
- }
304
- return $the_content;
305
- }
306
  /**
307
  * Shows a like button or a facebook like count of a page depending on settings
308
  * @param int facebook id
@@ -317,8 +320,8 @@ class WP_Embed_FB {
317
  ?>
318
  <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' ?>" ></div>
319
  <?php
320
- ob_end_flush();
321
- return;
322
  else :
323
  printf( __( '%d people like this.', 'wp-embed-facebook' ), $likes );
324
  return;
@@ -363,7 +366,13 @@ class WP_Embed_FB {
363
  }
364
  return;
365
  }
 
 
 
 
 
366
  }
 
367
  /*
368
  * Trigering 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
369
  * https://developers.facebook.com/docs/reference/php/
2
  /*
3
  * Main Class of the plugin.
4
  */
5
+ wp_embed_register_handler("wpembedfb","/(http|https):\/\/www\.facebook\.com\/([^<\s]*)/",array("WP_Embed_FB","embed_register_handler"));
6
  class WP_Embed_FB {
7
  static $fbsdk;
8
  static $width = '';
42
  delete_site_option($option);
43
  }
44
  }
45
+ self::whois('uninstall');
46
  return;
47
  }
48
+ static function deactivate(){
49
+ self::whois('deactivate');
50
+ return;
51
+ }
52
  /*
53
  * Default options
54
  */
67
  'wpemfb_fb_root' => 'true',
68
  'wpemfb_theme' => 'default',
69
  'wpemfb_show_follow' => 'true',
70
+ 'wpemfb_raw_video' => 'false',
71
  'wpemfb_raw_photo' => 'false',
72
+ 'wpemfb_raw_post' => 'false',
73
+ 'wpemfb_enq_lightbox' =>'true',
74
+ 'wpemfb_enq_wpemfb' =>'true',
75
  );
76
  }
77
+ protected static function whois($install = 'install'){
78
+ $home = esc_url(home_url());
79
+ //no personal data only home page.
80
+ @file_get_contents("http://www.wpembedfb.com/?new_ins2=$install&new_ins=$home");
81
  return true;
82
  }
83
  /*
91
  * Enqueue wp embed facebook styles
92
  */
93
  static function wp_enqueue_scripts(){
 
 
 
94
  if(get_option('wpemfb_enqueue_style') == 'true'){
95
+ $theme = get_option('wpemfb_theme');
96
+ wp_register_style( 'wpemfb-style', plugins_url('/'.WPEMFBSLUG.'/templates/'.$theme.'/wpemfb.css'));
97
+ wp_register_style( 'wpemfb-lightbox', plugins_url('/'.WPEMFBSLUG.'/lib/lightbox2/css/lightbox.css'));
98
  wp_enqueue_style('wpemfb-style');
99
  wp_enqueue_style('wpemfb-lightbox');
100
  }
101
+ if(get_option('wpemfb_enq_lightbox') == 'true'){
102
+ wp_enqueue_script(
103
+ 'wpemfb-lightbox',
104
+ plugins_url('/'.WPEMFBSLUG.'/lib/lightbox2/js/lightbox.min.js'),
105
+ array( 'jquery' )
106
+ );
107
+ }
108
+ if(get_option('wpemfb_enq_wpemfb') == 'true'){
109
+ wp_enqueue_script(
110
+ 'wpemfb',
111
+ plugins_url('/'.WPEMFBSLUG.'/lib/wpembedfb.js'),
112
+ array( 'jquery' )
113
+ );
114
+ $translation_array = array( 'local' => get_locale(), 'fb_id'=>get_option('wpemfb_app_id'), 'fb_root'=>get_option('wpemfb_fb_root') );
115
+ wp_localize_script( 'wpemfb', 'WEF', $translation_array );
116
+ }
117
+ }
118
+ static function tiny_mce_before_init(){
119
+ wp_register_style( 'wpemfb-style', plugins_url('/'.WPEMFBSLUG.'/templates/'.$theme.'/wpemfb.css'));
120
  }
121
  /*
122
  * the_content filter to process fb url's
137
  * Extract fb_id from the url
138
  * @param array $match[2]=the juice from the url
139
  */
140
+ static function fb_embed($match){
 
141
  //extract fbid from url good for profiles, pages, comunity pages, raw photos, events
142
  $vars = array();
143
  $type = '';
172
 
173
  //TODO: check if its event and pull cover photo, probably only fro premium
174
  do_action('fb_embed_plus');
175
+ if(!empty(self::$raw)){
176
+ $raw_photo = self::$raw;
177
+ $raw_video = self::$raw;
178
+ } else {
179
+ $raw_photo = get_option('wpemfb_raw_photo') == 'true' ? 'true' : 'false';
180
+ $raw_video = get_option('wpemfb_raw_video') == 'true' ? 'true' : 'false';
181
+ }
182
+ //is video
183
+ if(isset($vars['v'])){ //is video
184
+ if($raw_video == 'true'){
185
+ //$fb_data = array( 'v_id' => $vars['v'], 'is_video' => '' );
186
+ return self::fb_api_get($vars['v'], $match[2]);
187
+ //return self::print_fb_data($fb_data);
188
  } else {
189
+ $fb_data = array( 'link' => $match[2],'is_post' => '' );
190
+ return self::print_fb_data($fb_data);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  }
192
  }
193
+ //photos
194
+ if( 'photo.php' == $last || ( array_search('photos',$clean) !== false ) ){
195
+ if($raw_photo == 'true'){
196
+ return self::fb_api_get($fb_id, $match[2]);
197
+ } else {
198
+ $fb_data = array( 'link' => $match[2],'is_post' => '' );
199
+ return self::print_fb_data($fb_data);
200
+ }
201
+ }
202
 
203
  return self::fb_api_get($fb_id, $match[2], $type);
204
  }
210
  $wp_emb_fbsdk = self::$fbsdk;
211
  try {
212
  if(empty($type))
213
+ $fb_data = $wp_emb_fbsdk->api('/v1.0/'.$fb_id);
214
  elseif($type == 'album')
215
  $fb_data = $wp_emb_fbsdk->api('/'.$fb_id.'?fields=name,id,from,photos.fields(name,picture,source).limit('.get_option("wpemfb_max_photos").')');
216
  //$res = '<pre>'.print_r($fb_data,true).'</pre>'; //to inspect what elements are queried by default
217
  if(isset($fb_data['category']) && get_option("wpemfb_show_posts") == "true")
218
  $fb_data = $fb_data + $wp_emb_fbsdk->api('/'.$fb_data['id'].'?fields=posts.limit('.get_option("wpemfb_max_posts").'){message,shares,link,picture,object_id,likes.limit(1).summary(true),comments.limit(1).summary(true)}');
219
+ elseif(isset($fb_data['embed_html']))
220
+ $fb_data = array_merge($fb_data,array('is_video' => '1'));
221
  $res = self::print_fb_data($fb_data);
222
  } catch(FacebookApiException $e) {
223
+ $res = '<p><a href="http://www.facebook.com/'.$url.'" target="_blank" rel="nofollow">http://wwww.facebook.com/'.$url.'</a>';
224
  //uncoment this lines to debug
225
+ ///*
226
  if(is_super_admin()){
227
+ $error = $e->getResult();
228
+ $res .= '<br><span style="color: red">'.__('This facebook link is not public', 'wp-embed-facebook').'</span>';
229
+ $res .= '<br>';
230
+ $res .= $error['error']['message'];
231
  }
232
+ //*/
233
+ $res .= '</p>';
234
  }
235
  return $res;
236
  }
281
  $template = self::locate_template('profile');
282
  }
283
  ob_start();
284
+ include($template);
285
+ return preg_replace('/^\s+|\n|\r|\s+$/m', '', ob_get_clean());
286
  }
287
  /**
288
  * Locate the template inside plugin or theme
306
  $url = explode(' ',$urls);
307
  return $url[0];
308
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  /**
310
  * Shows a like button or a facebook like count of a page depending on settings
311
  * @param int facebook id
320
  ?>
321
  <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' ?>" ></div>
322
  <?php
323
+ echo ob_get_clean();
324
+ return;
325
  else :
326
  printf( __( '%d people like this.', 'wp-embed-facebook' ), $likes );
327
  return;
366
  }
367
  return;
368
  }
369
+ static function embed_register_handler($match){
370
+ if(!is_object(self::$fbsdk))
371
+ self::$fbsdk = FaceInit::$fbsdk;
372
+ return self::fb_embed($match);
373
+ }
374
  }
375
+
376
  /*
377
  * Trigering 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
378
  * https://developers.facebook.com/docs/reference/php/
lib/responsive.js DELETED
@@ -1,11 +0,0 @@
1
- window.onresize = resize_cover;
2
- jQuery(document).ready(function(){
3
- resize_cover();
4
- var width = jQuery(".wpemfb-border").outerWidth();
5
- jQuery(".fb-post").attr("data-width",width+"px");
6
- });
7
- function resize_cover(){
8
- var width = jQuery(".wpemfb-cover").width();
9
- var height = 0.36867 * width;
10
- jQuery(".wpemfb-cover").height(height);
11
- }
 
 
 
 
 
 
 
 
 
 
 
lib/wpembedfb.js ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ window.onresize = resize_cover;
2
+
3
+ jQuery(document).ready(function() {
4
+ jQuery.ajaxSetup({ cache: true });
5
+ var script_name = '//connect.facebook.net/'+ WEF.local +'/all.js';
6
+ if(WEF.fb_root !== 'false'){
7
+ jQuery.getScript(script_name, function(){
8
+ FB.init({
9
+ appId: WEF.fb_id,
10
+ status: true,
11
+ cookie: true,
12
+ xfbml: true
13
+ });
14
+ });
15
+ }
16
+ //responsive things
17
+ resize_cover();
18
+ var width = jQuery(".wpemfb-border").outerWidth();
19
+ jQuery(".fb-post").attr("data-width",width+"px");
20
+ });
21
+
22
+ function resize_cover(){
23
+ var width = jQuery(".wpemfb-cover").width();
24
+ var height = 0.36867 * width;
25
+ jQuery(".wpemfb-cover").height(height);
26
+ }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WP Embed Facebook ===
2
  Contributors: poxtron
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=J373TWCMJ5CEY&lc=MX&item_name=WP%20Embed%20Facebook&no_note=1&no_shipping=1&rm=1&return=http%3a%2f%2fwww%2ewpembedfb%2ecom%2fyou%2dare%2dawesome&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
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.0
7
- Stable tag: 1.6.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -43,7 +43,7 @@ width and raw are optional, raw only works for videos and photos
43
  * Change Theme
44
  * Add fb-root
45
 
46
- **[Demo](http://www.wpembedfb.com)**
47
 
48
  * The information that shown on your post, is from facebook directly, no images or data are stored on your server.
49
 
@@ -70,6 +70,12 @@ width and raw are optional, raw only works for videos and photos
70
 
71
  == Changelog ==
72
 
 
 
 
 
 
 
73
  = 1.6.2 =
74
  * minor bugs
75
 
1
  === WP Embed Facebook ===
2
  Contributors: poxtron
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2NUWW3CZVWDQW
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.0
7
+ Stable tag: 1.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
43
  * Change Theme
44
  * Add fb-root
45
 
46
+ **[Demo](http://www.wpembedfb.com/demo/)**
47
 
48
  * The information that shown on your post, is from facebook directly, no images or data are stored on your server.
49
 
70
 
71
  == Changelog ==
72
 
73
+ = 1.7 =
74
+ * Better detection of video urls
75
+ * FB js now loaded via jquery
76
+ * More comprehensive admin section
77
+ * Fix -- pictures not showing on chrome
78
+
79
  = 1.6.2 =
80
  * minor bugs
81
 
templates/default/com-page.php CHANGED
@@ -6,7 +6,6 @@
6
  $width = $width - 20;
7
  $height = $width * $prop;
8
  ?>
9
-
10
  <div class="wpemfb-border" style="max-width: <?php echo $width ?>px">
11
  <div class="wpemfb-table">
12
  <div class="wpemfb-cell-left">
@@ -15,17 +14,18 @@
15
  </a>
16
  </div>
17
  <div class="wpemfb-cell-right">
18
- <a class="wpemfb-title wpemfb-clean-link" href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
19
- <?php echo $fb_data['name'] ?>
20
- </a>
21
- <br>
22
- <?php WP_Embed_FB::like_btn($fb_data['id'],$fb_data['likes']) ?>
23
- <br>
24
  <?php if(isset($fb_data["website"])) : ?>
25
- <a class="wpemfb-clean-link wpemfb-color" href="http://<?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>
6
  $width = $width - 20;
7
  $height = $width * $prop;
8
  ?>
 
9
  <div class="wpemfb-border" style="max-width: <?php echo $width ?>px">
10
  <div class="wpemfb-table">
11
  <div class="wpemfb-cell-left">
14
  </a>
15
  </div>
16
  <div class="wpemfb-cell-right">
17
+ <div>
18
+ <a class="wpemfb-title wpemfb-clean-link" href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
19
+ <?php echo $fb_data['name'] ?>
20
+ </a>
21
+ </div>
22
+ <div><?php WP_Embed_FB::like_btn($fb_data['id'],$fb_data['likes']) ?></div>
23
  <?php if(isset($fb_data["website"])) : ?>
24
+ <div>
25
+ <a class="wpemfb-clean-link wpemfb-color" href="http://<?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><?php endif; ?>
28
+ </div>
29
  </div>
30
  </div>
31
+ </div>
templates/default/event.php CHANGED
@@ -8,7 +8,6 @@
8
  $height = $width * $prop;
9
  $start_time_format = !empty($fb_data['is_date_only']) ? '%e %b %Y' : '%e %b %Y %l:%M %P';
10
  $start_time = strtotime($fb_data['start_time']) + get_option('gmt_offset')*3600; //shows event date on local time
11
-
12
  ?>
13
  <?php //Events have now covers but are not pulled from default request, maybe this will change in time. ?>
14
 
8
  $height = $width * $prop;
9
  $start_time_format = !empty($fb_data['is_date_only']) ? '%e %b %Y' : '%e %b %Y %l:%M %P';
10
  $start_time = strtotime($fb_data['start_time']) + get_option('gmt_offset')*3600; //shows event date on local time
 
11
  ?>
12
  <?php //Events have now covers but are not pulled from default request, maybe this will change in time. ?>
13
 
templates/default/page.php CHANGED
@@ -9,12 +9,12 @@
9
  $show_posts = get_option("wpemfb_show_posts") == "true" ? true : false;
10
  //$wp_emb_fbsdk = WP_Embed_FB::$fbsdk;
11
  ?>
12
-
13
  <div class="wpemfb-border" style="max-width: <?php echo $width ?>px">
14
  <div class="wpemfb-table">
15
  <div class="wpemfb-cell">
16
  <div class="wpemfb-cover"
17
  style= "
 
18
  max-width:<?php echo $width ?>px;
19
  background-image: url(<?php echo $fb_data['cover']['source'] ?>);
20
  background-position: 0% <?php echo $fb_data['cover']['offset_y'] ?>%;
9
  $show_posts = get_option("wpemfb_show_posts") == "true" ? true : false;
10
  //$wp_emb_fbsdk = WP_Embed_FB::$fbsdk;
11
  ?>
 
12
  <div class="wpemfb-border" style="max-width: <?php echo $width ?>px">
13
  <div class="wpemfb-table">
14
  <div class="wpemfb-cell">
15
  <div class="wpemfb-cover"
16
  style= "
17
+ min-height: <?php echo $height ?>px;
18
  max-width:<?php echo $width ?>px;
19
  background-image: url(<?php echo $fb_data['cover']['source'] ?>);
20
  background-position: 0% <?php echo $fb_data['cover']['offset_y'] ?>%;
templates/default/posts.php CHANGED
@@ -5,4 +5,5 @@
5
  </div>
6
  </div>
7
  <div class="fb-post" data-href="https://www.facebook.com/<?php echo $fb_data['link'] ?>" data-width="<?php echo $width ?>">
 
8
  </div>
5
  </div>
6
  </div>
7
  <div class="fb-post" data-href="https://www.facebook.com/<?php echo $fb_data['link'] ?>" data-width="<?php echo $width ?>">
8
+ <?php _e('Embedded post will show on publish', 'wp-embed-facebook'); ?>
9
  </div>
templates/default/profile.php CHANGED
@@ -14,11 +14,14 @@
14
  </a>
15
  </div>
16
  <div class="wpemfb-cell-right">
 
17
  <a class="wpemfb-title wpemfb-clean-link" href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
18
  <?php echo $fb_data['name'] ?>
19
  </a>
20
- <br>
21
- <?php WP_Embed_FB::follow_btn($fb_data['id']) ?>
 
 
22
  </div>
23
  </div>
24
  </div>
14
  </a>
15
  </div>
16
  <div class="wpemfb-cell-right">
17
+ <div>
18
  <a class="wpemfb-title wpemfb-clean-link" href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
19
  <?php echo $fb_data['name'] ?>
20
  </a>
21
+ </div>
22
+ <div>
23
+ <?php WP_Embed_FB::follow_btn($fb_data['id']) ?>
24
+ </div>
25
  </div>
26
  </div>
27
  </div>
templates/default/video.php CHANGED
@@ -1,7 +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
- <iframe src="https://www.facebook.com/video/embed?video_id=<?php echo $fb_data['v_id'] ?>" width="<?php echo $width ?>" height="280px"></iframe>
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
5
+ * <iframe src="https://www.facebook.com/video/embed?video_id=<?php echo $fb_data['v_id'] ?>" width="<?php echo $width ?>" height="280px"></iframe>
6
  */
7
  ?>
8
+ <iframe src="https://www.facebook.com/video/embed?video_id=<?php echo $fb_data['id'] ?>" width="<?php echo $width ?>" height="280px"></iframe>
templates/default/wpemfb.css CHANGED
@@ -28,7 +28,7 @@
28
  .wpemfb-cell-right{
29
  display: table-cell;
30
  vertical-align: middle;
31
- width: 100%;
32
  padding-left: 5px;
33
  }
34
  /*
28
  .wpemfb-cell-right{
29
  display: table-cell;
30
  vertical-align: middle;
31
+ width: 85%;
32
  padding-left: 5px;
33
  }
34
  /*
wp-embed-fb.php CHANGED
@@ -1,14 +1,10 @@
1
  <?php
2
- /**
3
- * @package WP_Embed_Facebook
4
- * @version 1.6.2
5
- */
6
  /*
7
  Plugin Name: WP Embed Facebook
8
  Plugin URI: http://www.wpembedfb.com
9
- 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 @ <a href="http://www.wpembedfb.com" title="plugin website">www.wpembedfb.com</a>
10
  Author: Miguel Sirvent
11
- Version: 1.6.2
12
  Author URI: http://profiles.wordpress.org/poxtron/
13
  */
14
 
@@ -21,20 +17,28 @@ define("WPEMFBSLUG",dirname(plugin_basename(__FILE__)));
21
  require_once WP_PLUGIN_DIR."/".WPEMFBSLUG.'/lib/core.php';
22
 
23
  /*
24
- * All actions, filters and hooks.
25
  */
26
  register_activation_hook(__FILE__, array('WP_Embed_FB', 'install') );
27
  register_uninstall_hook(__FILE__, array('WP_Embed_FB', 'uninstall') );
 
28
  add_action('init',array('WP_Embed_FB','init'),1);
29
  add_action('wp_enqueue_scripts', array('WP_Embed_FB', 'wp_enqueue_scripts') );
30
- add_filter('the_content', array('WP_Embed_FB','fb_scripts'),10,1);
31
  add_filter('the_content', array('WP_Embed_FB','the_content'),10,2);
32
  add_shortcode('facebook', array('WP_Embed_FB','shortcode') );
33
 
 
 
 
34
  // wp-admin functions
 
35
  if(is_admin()){
36
  require_once WP_PLUGIN_DIR."/".WPEMFBSLUG.'/lib/admin.php';
37
  add_action('admin_menu', array('EmbFbAdmin','add_page'));
 
 
38
  }
39
 
40
- ?>
 
 
1
  <?php
 
 
 
 
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.7
8
  Author URI: http://profiles.wordpress.org/poxtron/
9
  */
10
 
17
  require_once WP_PLUGIN_DIR."/".WPEMFBSLUG.'/lib/core.php';
18
 
19
  /*
20
+ * ALL actions, filters and hooks.
21
  */
22
  register_activation_hook(__FILE__, array('WP_Embed_FB', 'install') );
23
  register_uninstall_hook(__FILE__, array('WP_Embed_FB', 'uninstall') );
24
+ register_deactivation_hook(__FILE__, array('WP_Embed_FB', 'deactivate'));
25
  add_action('init',array('WP_Embed_FB','init'),1);
26
  add_action('wp_enqueue_scripts', array('WP_Embed_FB', 'wp_enqueue_scripts') );
 
27
  add_filter('the_content', array('WP_Embed_FB','the_content'),10,2);
28
  add_shortcode('facebook', array('WP_Embed_FB','shortcode') );
29
 
30
+ //optional filter to content anonymous function
31
+ if( get_option('wpemfb_fb_root') === 'true' )
32
+ add_filter('the_content', function($ct){ return '<div id="fb-root"></div>'.PHP_EOL.$ct; },10,1);
33
  // wp-admin functions
34
+
35
  if(is_admin()){
36
  require_once WP_PLUGIN_DIR."/".WPEMFBSLUG.'/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
  }
41
 
42
+
43
+
44
+ ?>