Simple Facebook Plugin - Version 1.3.2

Version Description

Download this release

Release Info

Developer fornyhucker
Plugin Icon 128x128 Simple Facebook Plugin
Version 1.3.2
Comparing to
See all releases

Code changes from version 1.2.2 to 1.3.2

lib/css/sfp-admin-style.css ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .sfp-icon {
2
+ display: inline-block;
3
+ width: 16px;
4
+ height: 16px;
5
+ position: relative;
6
+ padding: 0 5px 0 0;
7
+ margin-bottom: -4px;
8
+ background: url('../img/help_icon.png') no-repeat;
9
+ }
10
+ .sfp-tooltip-wrap {
11
+ display: none;
12
+ width: 250px;
13
+ position: absolute;
14
+ bottom: 0;
15
+ left: -110px;
16
+ font-size: 12px;
17
+ z-index: 999;
18
+ }
19
+ .sfp-tooltip {
20
+ display: block;
21
+ position: relative;
22
+ margin-bottom: 23px;
23
+ padding: 14px;
24
+ background: #f1f1f1;
25
+ font-size: 13px;
26
+ line-height: 18px;
27
+ -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
28
+ box-shadow: 0 1px 1px rgba(0,0,0,.04);
29
+ }
30
+ .sfp-tooltip:after {
31
+ border-left: 6px solid transparent;
32
+ border-right: 6px solid transparent;
33
+ border-bottom: none;
34
+ border-top: 6px solid #f1f1f1;
35
+ height: 0;
36
+ width: 0;
37
+ bottom: -6px;
38
+ content: "";
39
+ left: 112px;
40
+ position: absolute;
41
+ }
42
+ .sfp-tooltip .sfp-buttons {
43
+ display: block;
44
+ margin-top: 5px;
45
+ font-size: 13px;
46
+ line-height: 26px;
47
+ }
48
+ .sfp-icon:hover .sfp-tooltip-wrap,
49
+ .sfp-icon .sfp-tooltip-wrap:hover {
50
+ display: block;
51
+ }
lib/img/help_icon.png ADDED
Binary file
lib/sfp-like-box.php CHANGED
@@ -31,11 +31,16 @@ class SFPLikeBoxWidget extends WP_Widget {
31
  function widget( $args, $instance ) {
32
 
33
  global $sfplugin;
34
-
 
 
 
 
35
  // extract user options
36
  extract( $args );
37
  extract( $instance );
38
 
 
39
  echo $before_widget;
40
 
41
  // check for title
@@ -44,7 +49,11 @@ class SFPLikeBoxWidget extends WP_Widget {
44
 
45
  // include Like Box view
46
  include( $sfplugin->pluginPath . 'views/view-like-box.php' );
 
 
 
47
 
 
48
  echo $after_widget;
49
  }
50
 
@@ -65,6 +74,9 @@ class SFPLikeBoxWidget extends WP_Widget {
65
  $instance['stream'] = isset( $new_instance['stream'] );
66
  $instance['header'] = isset( $new_instance['header'] );
67
  $instance['border'] = isset( $new_instance['border'] );
 
 
 
68
 
69
  return $instance;
70
  }
@@ -73,8 +85,10 @@ class SFPLikeBoxWidget extends WP_Widget {
73
  * Back-end form
74
  */
75
  function form( $instance ) {
 
 
76
 
77
- extract( array_merge( array(
78
  // default options
79
  'title' => 'Our Facebook Page',
80
  'url' => 'http://www.facebook.com/wordpress',
@@ -86,7 +100,17 @@ class SFPLikeBoxWidget extends WP_Widget {
86
  'header' => true,
87
  'border' => true,
88
  'local' => 'en_US'
89
- ), $instance ) ); ?>
 
 
 
 
 
 
 
 
 
 
90
 
91
  <p>
92
  <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title'); ?></label>
@@ -107,6 +131,10 @@ class SFPLikeBoxWidget extends WP_Widget {
107
  </td><td>
108
  <input size="6" id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="text" value="<?php echo $height; ?>" />px
109
  </td></tr>
 
 
 
 
110
  <tr><td>
111
  &nbsp;
112
  </td></tr>
@@ -139,44 +167,24 @@ class SFPLikeBoxWidget extends WP_Widget {
139
  </td><td>
140
  <input id="<?php echo $this->get_field_id('border'); ?>" type="checkbox" name="<?php echo $this->get_field_name('border'); ?>" <?php checked(isset($border) ? $border : 0); ?>/>
141
  </td></tr>
 
 
 
 
142
  </table>
143
  <br/>
144
  <p>
145
  <label for="<?php echo $this->get_field_id('local'); ?>"><?php _e('Language'); ?></label>
146
  <select name="<?php echo $this->get_field_name('local'); ?>">
147
- <option <?php selected(( $local == 'cs_CZ') ? 1 : 0);?> value="cs_CZ" >Czech</option>
148
- <option <?php selected(( $local == 'da_DK') ? 1 : 0);?> value="da_DK" >Danish</option>
149
- <option <?php selected(( $local == 'nl_NL') ? 1 : 0);?> value="nl_NL" >Dutch</option>
150
- <option <?php selected(( $local == 'en_US') ? 1 : 0);?> value="en_US" >English (US)</option>
151
- <option <?php selected(( $local == 'en_GB') ? 1 : 0);?> value="en_GB" >English (UK)</option>
152
- <option <?php selected(( $local == 'et_EE') ? 1 : 0);?> value="et_EE" >Estonian</option>
153
- <option <?php selected(( $local == 'fr_FR') ? 1 : 0);?> value="fr_FR" >French</option>
154
- <option <?php selected(( $local == 'de_DE') ? 1 : 0);?> value="de_DE" >German</option>
155
- <option <?php selected(( $local == 'it_IT') ? 1 : 0);?> value="it_IT" >Italian</option>
156
- <option <?php selected(( $local == 'ja_JP') ? 1 : 0);?> value="ja_JP" >Japanese</option>
157
- <option <?php selected(( $local == 'ko_KR') ? 1 : 0);?> value="ko_KR" >Korean</option>
158
- <option <?php selected(( $local == 'lv_LV') ? 1 : 0);?> value="lv_LV" >Latvian</option>
159
- <option <?php selected(( $local == 'lt_LT') ? 1 : 0);?> value="lt_LT" >Lithuanian</option>
160
- <option <?php selected(( $local == 'nb_NO') ? 1 : 0);?> value="nb_NO" >Norwegian (bokmal)</option>
161
- <option <?php selected(( $local == 'pl_PL') ? 1 : 0);?> value="pl_PL" >Polish</option>
162
- <option <?php selected(( $local == 'pt_PT') ? 1 : 0);?> value="pt_PT" >Portuguese</option>
163
- <option <?php selected(( $local == 'ro_RO') ? 1 : 0);?> value="ro_RO" >Romanian</option>
164
- <option <?php selected(( $local == 'ru_RU') ? 1 : 0);?> value="ru_RU" >Russian</option>
165
- <option <?php selected(( $local == 'es_LA') ? 1 : 0);?> value="es_LA" >Spanish</option>
166
- <option <?php selected(( $local == 'es_ES') ? 1 : 0);?> value="es_ES" >Spanish (Spain)</option>
167
- <option <?php selected(( $local == 'es_CL') ? 1 : 0);?> value="es_CL" >Spanish (Chile)</option>
168
- <option <?php selected(( $local == 'es_CO') ? 1 : 0);?> value="es_CO" >Spanish (Colombia)</option>
169
- <option <?php selected(( $local == 'es_MX') ? 1 : 0);?> value="es_MX" >Spanish (Mexico)</option>
170
- <option <?php selected(( $local == 'es_VE') ? 1 : 0);?> value="es_VE" >Spanish (Venezuela)</option>
171
- <option <?php selected(( $local == 'sv_SE') ? 1 : 0);?> value="sv_SE" >Swedish</option>
172
- <option <?php selected(( $local == 'zh_CN') ? 1 : 0);?> value="zh_CN" >Simplified Chinese</option>
173
- <option <?php selected(( $local == 'zh_TW') ? 1 : 0);?> value="zh_TW" >Traditional Chinese (Taiwan)</option>
174
- <option <?php selected(( $local == 'th_TH') ? 1 : 0);?> value="th_TH" >Thai</option>
175
- <option <?php selected(( $local == 'tr_TR') ? 1 : 0);?> value="tr_TR" >Turkish</option>
176
- <option <?php selected(( $local == 'uk_UA') ? 1 : 0);?> value="uk_UA" >Ukrainian</option>
177
- <option <?php selected(( $local == 'tl_ST') ? 1 : 0);?> value="tl_ST" >Klingon</option>
178
  </select>
179
  </p>
 
 
 
 
180
  <?php }
181
 
182
  } // class SFPLikeBoxWidget
@@ -188,10 +196,15 @@ class SFPLikeBoxWidget extends WP_Widget {
188
  * @author Ilya K.
189
  */
190
 
191
- function sfp_like_box_shortcode ( $args = array() ) {
192
 
193
  global $sfplugin;
194
 
 
 
 
 
 
195
  extract( array_merge( array(
196
  // default options
197
  'url' => 'http://www.facebook.com/wordpress',
@@ -203,7 +216,7 @@ function sfp_like_box_shortcode ( $args = array() ) {
203
  'header' => true,
204
  'border' => true,
205
  'local' => 'en_US'
206
- ), $args ) );
207
 
208
  ob_start();
209
 
@@ -221,9 +234,12 @@ function sfp_like_box_shortcode ( $args = array() ) {
221
  * @author Ilya K.
222
  */
223
 
224
- function sfp_like_box ( $args = array() ) {
225
 
226
  global $sfplugin;
 
 
 
227
 
228
  extract( array_merge( array(
229
  // default options
@@ -236,7 +252,7 @@ function sfp_like_box ( $args = array() ) {
236
  'header' => true,
237
  'border' => true,
238
  'local' => 'en_US'
239
- ), $args ) );
240
 
241
  // include Like Box view
242
  include( $sfplugin->pluginPath . 'views/view-like-box.php' );
31
  function widget( $args, $instance ) {
32
 
33
  global $sfplugin;
34
+
35
+ // Add-ons hook
36
+ $instance = apply_filters( "sfp_before_like_box", $instance, $this, $sfplugin );
37
+ do_action( "sfp_before_like_box", $args, $instance, $this, $sfplugin );
38
+
39
  // extract user options
40
  extract( $args );
41
  extract( $instance );
42
 
43
+ // Stnadar WP output
44
  echo $before_widget;
45
 
46
  // check for title
49
 
50
  // include Like Box view
51
  include( $sfplugin->pluginPath . 'views/view-like-box.php' );
52
+
53
+ // Add-ons hook
54
+ do_action("sfp_after_like_box", $args, $instance, $this, $sfplugin );
55
 
56
+ // Stnadar WP output
57
  echo $after_widget;
58
  }
59
 
74
  $instance['stream'] = isset( $new_instance['stream'] );
75
  $instance['header'] = isset( $new_instance['header'] );
76
  $instance['border'] = isset( $new_instance['border'] );
77
+
78
+ // Add-ons hook
79
+ apply_filters( 'sfp_like_box_widget_update', $instance, $new_instance, $old_instance );
80
 
81
  return $instance;
82
  }
85
  * Back-end form
86
  */
87
  function form( $instance ) {
88
+
89
+ global $sfplugin;
90
 
91
+ $default = array(
92
  // default options
93
  'title' => 'Our Facebook Page',
94
  'url' => 'http://www.facebook.com/wordpress',
100
  'header' => true,
101
  'border' => true,
102
  'local' => 'en_US'
103
+ );
104
+
105
+ // Add-ons hook
106
+ //$instance = apply_filters( 'sfp_like_box_form', $instance, $default, $this, $sfplugin );
107
+
108
+ extract( array_merge( $default, $instance ) ); ?>
109
+
110
+ <?php
111
+ // Add-ons hook
112
+ do_action( "sfp_like_box_widget_form_start", $instance, $this, $sfplugin );
113
+ ?>
114
 
115
  <p>
116
  <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title'); ?></label>
131
  </td><td>
132
  <input size="6" id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="text" value="<?php echo $height; ?>" />px
133
  </td></tr>
134
+ <?php
135
+ // Add-ons hook
136
+ do_action( "sfp_like_box_widget_form_after_inputs", $instance, $this, $sfplugin );
137
+ ?>
138
  <tr><td>
139
  &nbsp;
140
  </td></tr>
167
  </td><td>
168
  <input id="<?php echo $this->get_field_id('border'); ?>" type="checkbox" name="<?php echo $this->get_field_name('border'); ?>" <?php checked(isset($border) ? $border : 0); ?>/>
169
  </td></tr>
170
+ <?php
171
+ // Add-ons hook
172
+ do_action("sfp_like_box_widget_form_after_checkboxes", $instance, $this, $sfplugin );
173
+ ?>
174
  </table>
175
  <br/>
176
  <p>
177
  <label for="<?php echo $this->get_field_id('local'); ?>"><?php _e('Language'); ?></label>
178
  <select name="<?php echo $this->get_field_name('local'); ?>">
179
+ <?php foreach ( $sfplugin->locales as $code => $name ) : ?>
180
+ <option <?php selected(( $local == $code) ? 1 : 0); ?> value="<?php echo $code; ?>" ><?php echo $name; ?></option>
181
+ <?php endforeach; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  </select>
183
  </p>
184
+ <?php
185
+ do_action( "sfp_like_box_widget_form_end", $instance, $this, $sfplugin );
186
+ ?>
187
+
188
  <?php }
189
 
190
  } // class SFPLikeBoxWidget
196
  * @author Ilya K.
197
  */
198
 
199
+ function sfp_like_box_shortcode ( $instance ) {
200
 
201
  global $sfplugin;
202
 
203
+ $instance = ( !$instance ) ? array() : $instance;
204
+
205
+ // Add-ons hook
206
+ $instance = apply_filters( "sfp_before_like_box", $instance, $sfplugin );
207
+
208
  extract( array_merge( array(
209
  // default options
210
  'url' => 'http://www.facebook.com/wordpress',
216
  'header' => true,
217
  'border' => true,
218
  'local' => 'en_US'
219
+ ), $instance ) );
220
 
221
  ob_start();
222
 
234
  * @author Ilya K.
235
  */
236
 
237
+ function sfp_like_box ( $instance = array() ) {
238
 
239
  global $sfplugin;
240
+
241
+ // Add-ons hook
242
+ $instance = apply_filters( "sfp_before_like_box", $instance, $sfplugin );
243
 
244
  extract( array_merge( array(
245
  // default options
252
  'header' => true,
253
  'border' => true,
254
  'local' => 'en_US'
255
+ ), $instance ) );
256
 
257
  // include Like Box view
258
  include( $sfplugin->pluginPath . 'views/view-like-box.php' );
readme.txt CHANGED
@@ -1,65 +1,35 @@
1
  === Simple Facebook Plugin ===
2
 
3
- Contributors: fornyhucker
4
- Tags: social, facebook, fb, fb like, like box, likebox, widget, shortcode, template tag, sidebar
5
  Requires at least: 2.8
6
- Tested up to: 3.8
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
 
10
- Allows you to integrate Facebook Like Box into your WordPress Site.
11
 
12
  == Description ==
13
 
14
- = Whats new in 1.2.1? =
15
-
16
- Now you can hide Like Box border, just uncheck 'Show Border' option on widget setting and vuala! (If you are using shortcode or template tag set ‘border‘ parameter to ‘false‘)
17
-
18
  = Description =
19
 
20
- Simple Facebook Plugin enables Facebook Page owners to attract and gain Likes from their own WordPress blogs. The **Like Box** enables users to:
21
 
22
  * See how many users already like this Page, and which of their friends like it too
23
  * Read recent posts from the Page
24
  * Like the Page with one click, without needing to visit the Page
25
 
26
- Please visit [Plugin Home Page](http://plugins.topdevs.net/simple-facebook-plugin/ "Simple Facebook Plugin Home Page") for more info and examples.
27
-
28
- Visit our CodeCanyon [Portfolio](http://codecanyon.net/user/topdevs/portfolio?ref=topdevs "Our CodeCanyon Portfolio") to see more awesome plugins we made.
29
-
30
- **Supported languages**
31
-
32
- * Czech
33
- * Danish
34
- * Dutch
35
- * English (US)
36
- * English (UK)
37
- * Estonian
38
- * French
39
- * German
40
- * Italian
41
- * Japanese
42
- * Korean
43
- * Latvian
44
- * Lithuanian
45
- * Norwegian (bokmal)
46
- * Polish
47
- * Portuguese
48
- * Romanian
49
- * Russian
50
- * Spanish
51
- * Spanish (Spain)
52
- * Spanish (Chile)
53
- * Spanish (Colombia)
54
- * Spanish (Mexico)
55
- * Spanish (Venezuela)
56
- * Swedish
57
- * Simplified Chinese
58
- * Traditional Chinese (Taiwan)
59
- * Thai
60
- * Turkish
61
- * Ukrainian
62
- * Klingon
63
 
64
  == Installation ==
65
  **Installation**
@@ -72,8 +42,8 @@ Visit our CodeCanyon [Portfolio](http://codecanyon.net/user/topdevs/portfolio?re
72
  1. In WordPress dashboard, go to **Appearance > Widgets**.
73
  1. Drag and Drop **SFP - Like Box** into your sidebar.
74
  1. Click triangle near **SFP - Like Box** header.
75
- 1. Choose colorscheme, size and other options you like.
76
  1. Enter your Facebook Page URL (not your personal page URL!).
 
77
 
78
  **or**
79
 
@@ -87,12 +57,13 @@ Use `[sfp-like-box]` shortcode inside your post or page. This shortcode support
87
  * faces – *true* or *false*
88
  * stream - *true* or *false*
89
  * header - *true* or *false*
 
90
  * local - valid language code (e.g. *en_US* or *es_MX*) see [.xml file](http://www.facebook.com/translations/FacebookLocales.xml "Facebook locales XML") with all Facebook locales
91
 
92
 
93
  If you want Like Box *220 pixels width*, *dark color scheme* and *showing stream* you need to use it next way:
94
 
95
- `[sfp-like-box width=220 colorscheme=dark stream=true]`
96
 
97
  **or**
98
 
@@ -123,6 +94,9 @@ Like Box is only for Fan Pages and **not** for your personal page.
123
 
124
  == Changelog ==
125
 
 
 
 
126
  = 1.2.2 =
127
  * Option to show Like Box with no border changed to native Facebook data-show-border=false;
128
 
1
  === Simple Facebook Plugin ===
2
 
3
+ Contributors: topdevs, fornyhucker
4
+ Tags: social, facebook, fb, fb like, like box, likebox, widget, shortcode, responsive, template tag, sidebar
5
  Requires at least: 2.8
6
+ Tested up to: 4.0
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
 
10
+ Allows you to integrate Facebook Like Box into your WordPress site using Widgets or Shortcodes.
11
 
12
  == Description ==
13
 
 
 
 
 
14
  = Description =
15
 
16
+ Simple Facebook Plugin enables Facebook Page admins to promote their Pages and embed a simple feed of content from a Page into any WordPress blog. The **Like Box** enables users to:
17
 
18
  * See how many users already like this Page, and which of their friends like it too
19
  * Read recent posts from the Page
20
  * Like the Page with one click, without needing to visit the Page
21
 
22
+ You can easily integrate Like Box using WordPress Widgets and Shortcodes.
23
+
24
+ = Add-ons =
25
+
26
+ Starting version 1.3 Simple Facebook Plugin is add-on ready. Visit our first [Responsive Like Box Add-on](http://plugins.topdevs.net/simple-facebook-plugin/responsive-like-box-addon/ "Visit Responsive Like Box Add-on Page") page to learn more.
27
+
28
+ = More =
29
+
30
+ Visit [Plugin Page](http://plugins.topdevs.net/simple-facebook-plugin/ "See 'Simple Facebook Plugin' Page") for more info and examples.
31
+
32
+ Visit our [CodeCanyon Portfolio](http://codecanyon.net/user/topdevs/portfolio?ref=topdevs "Our Plugins on CodeCanyon") or our [Plugins Site](http://plugins.topdevs.net/ "See all our plugins") to see more awesome plugins we made.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  == Installation ==
35
  **Installation**
42
  1. In WordPress dashboard, go to **Appearance > Widgets**.
43
  1. Drag and Drop **SFP - Like Box** into your sidebar.
44
  1. Click triangle near **SFP - Like Box** header.
 
45
  1. Enter your Facebook Page URL (not your personal page URL!).
46
+ 1. Choose colorscheme, size and other options you like.
47
 
48
  **or**
49
 
57
  * faces – *true* or *false*
58
  * stream - *true* or *false*
59
  * header - *true* or *false*
60
+ * border - *true* or *false*
61
  * local - valid language code (e.g. *en_US* or *es_MX*) see [.xml file](http://www.facebook.com/translations/FacebookLocales.xml "Facebook locales XML") with all Facebook locales
62
 
63
 
64
  If you want Like Box *220 pixels width*, *dark color scheme* and *showing stream* you need to use it next way:
65
 
66
+ `[sfp-like-box width=220 colorscheme=dark stream=true url=http://www.facebook.com/yourPageName]`
67
 
68
  **or**
69
 
94
 
95
  == Changelog ==
96
 
97
+ = 1.3 =
98
+ * Add-on support added
99
+
100
  = 1.2.2 =
101
  * Option to show Like Box with no border changed to native Facebook data-show-border=false;
102
 
simple-facebook-plugin.php CHANGED
@@ -3,12 +3,14 @@
3
  Plugin Name: Simple Facebook Plugin
4
  Plugin URI: http://plugins.topdevs.net/simple-facebook-plugin
5
  Description: Allows you to integrate Facebook Like Box into your WordPress Site.
6
- Version: 1.2.2
7
- Author: Ilya K.
8
  Author URI: http://codecanyon.net/user/topdevs/portfolio?ref=topdevs
9
  License: GPLv2 or later
10
  */
11
 
 
 
12
  /**
13
  * Main SF Plugin Class
14
  *
@@ -27,7 +29,11 @@ if ( !class_exists( 'SFPlugin' ) ) {
27
  public $pluginPath;
28
  public $pluginUrl;
29
  public $pluginName;
30
-
 
 
 
 
31
  /**
32
  * SF Plugin Constructor
33
  *
@@ -36,7 +42,11 @@ if ( !class_exists( 'SFPlugin' ) ) {
36
  public function __construct( ) {
37
  $this->pluginPath = plugin_dir_path(__FILE__);
38
  $this->pluginUrl = plugin_dir_url(__FILE__);
 
 
39
 
 
 
40
  $this->loadFiles();
41
  $this->addActions();
42
  $this->addShortcodes();
@@ -48,7 +58,9 @@ if ( !class_exists( 'SFPlugin' ) ) {
48
  protected function loadFiles() {
49
  // Include social plugins files
50
  require_once( $this->pluginPath . 'lib/sfp-like-box.php' );
51
-
 
 
52
  }
53
 
54
  /**
@@ -56,8 +68,21 @@ if ( !class_exists( 'SFPlugin' ) ) {
56
  */
57
  protected function addActions() {
58
 
59
- add_action('widgets_init', array( $this, 'addWidgets') );
60
-
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  }
62
 
63
  /**
@@ -66,7 +91,9 @@ if ( !class_exists( 'SFPlugin' ) ) {
66
  public function addWidgets() {
67
 
68
  register_widget('SFPLikeBoxWidget');
69
-
 
 
70
  }
71
 
72
  /**
@@ -76,6 +103,319 @@ if ( !class_exists( 'SFPlugin' ) ) {
76
 
77
  add_shortcode('sfp-like-box', 'sfp_like_box_shortcode');
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
 
81
  } // end SFPlugin class
3
  Plugin Name: Simple Facebook Plugin
4
  Plugin URI: http://plugins.topdevs.net/simple-facebook-plugin
5
  Description: Allows you to integrate Facebook Like Box into your WordPress Site.
6
+ Version: 1.3.2
7
+ Author: topdevs
8
  Author URI: http://codecanyon.net/user/topdevs/portfolio?ref=topdevs
9
  License: GPLv2 or later
10
  */
11
 
12
+ define( SFP_VERSION, '1.3.2' );
13
+
14
  /**
15
  * Main SF Plugin Class
16
  *
29
  public $pluginPath;
30
  public $pluginUrl;
31
  public $pluginName;
32
+ public $optionName;
33
+
34
+ public $facebookLocalesUrl = "http://www.facebook.com/translations/FacebookLocales.xml";
35
+ public $locales;
36
+
37
  /**
38
  * SF Plugin Constructor
39
  *
42
  public function __construct( ) {
43
  $this->pluginPath = plugin_dir_path(__FILE__);
44
  $this->pluginUrl = plugin_dir_url(__FILE__);
45
+
46
+ $this->optionName = "simple_facebook_plugin_options";
47
 
48
+ $this->locales = $this->parseLocales($this->facebookLocalesUrl);
49
+
50
  $this->loadFiles();
51
  $this->addActions();
52
  $this->addShortcodes();
58
  protected function loadFiles() {
59
  // Include social plugins files
60
  require_once( $this->pluginPath . 'lib/sfp-like-box.php' );
61
+
62
+ // Allow addons load files
63
+ do_action('sfp_load_files');
64
  }
65
 
66
  /**
68
  */
69
  protected function addActions() {
70
 
71
+ //add_action( 'admin_menu', array( $this, 'pluginMenu') );
72
+ add_action( 'admin_notices', array( $this, 'adminNotice') );
73
+ add_action( 'widgets_init', array( $this, 'addWidgets') );
74
+ //add_action( 'wp_footer', array( $this, 'addJavaScriptSDK') );
75
+ add_action( 'admin_init', array( $this, 'saveOptions' ) );
76
+ add_action( 'admin_init', array( $this, 'ignoreNotices' ) );
77
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueueScriptsAdmin') );
78
+ add_action( "sfp_like_box_widget_form_after_checkboxes", array( $this, "fakeCheckbox" ) );
79
+
80
+ // Add settings link on Plugins page
81
+ $plugin = "simple-facebook-plugin/simple-facebook-plugin.php";
82
+ //add_filter( "plugin_action_links_$plugin", array( $this, 'pluginSettingsLink') );
83
+
84
+ // Allow addons add actions
85
+ do_action( 'sfp_add_actions', $this );
86
  }
87
 
88
  /**
91
  public function addWidgets() {
92
 
93
  register_widget('SFPLikeBoxWidget');
94
+
95
+ // Allow addons add widgets
96
+ do_action('sfp_add_widgets');
97
  }
98
 
99
  /**
103
 
104
  add_shortcode('sfp-like-box', 'sfp_like_box_shortcode');
105
 
106
+ // Allow addons add shortcodes
107
+ do_action('sfp_add_shortcodes');
108
+ }
109
+
110
+ /**
111
+ * Get remote XML file by URL
112
+ *
113
+ * @param string $url
114
+ * @return array
115
+ * @since 1.3
116
+ */
117
+ public function parseLocales ( $url = "" ) {
118
+
119
+ if ( file_exists( $url ) && function_exists( "simplexml_load_file" ) ) {
120
+
121
+ $locales = array();
122
+ $xml = simplexml_load_file( $url );
123
+
124
+ foreach ( $xml as $key => $locale ) {
125
+
126
+ $name = (array) $locale->englishName;
127
+ $name = $name[0];
128
+
129
+ $code = (array) $locale->codes->code->standard->representation;
130
+ $code = $code[0];
131
+
132
+ $locales[$code] = $name;
133
+ };
134
+ }
135
+ else
136
+ $locales = array(
137
+ "af_ZA"=> "Afrikaans",
138
+ "ar_AR"=> "Arabic",
139
+ "az_AZ"=> "Azerbaijani",
140
+ "be_BY"=> "Belarusian",
141
+ "bg_BG"=> "Bulgarian",
142
+ "bn_IN"=> "Bengali",
143
+ "bs_BA"=> "Bosnian",
144
+ "ca_ES"=> "Catalan",
145
+ "cs_CZ"=> "Czech",
146
+ "cy_GB"=> "Welsh",
147
+ "da_DK"=> "Danish",
148
+ "de_DE"=> "German",
149
+ "el_GR"=> "Greek",
150
+ "en_GB"=> "English (UK)",
151
+ "en_PI"=> "English (Pirate)",
152
+ "en_UD"=> "English (Upside Down)",
153
+ "en_US"=> "English (US)",
154
+ "eo_EO"=> "Esperanto",
155
+ "es_ES"=> "Spanish (Spain)",
156
+ "es_LA"=> "Spanish",
157
+ "et_EE"=> "Estonian",
158
+ "eu_ES"=> "Basque",
159
+ "fa_IR"=> "Persian",
160
+ "fb_LT"=> "Leet Speak",
161
+ "fi_FI"=> "Finnish",
162
+ "fo_FO"=> "Faroese",
163
+ "fr_CA"=> "French (Canada)",
164
+ "fr_FR"=> "French (France)",
165
+ "fy_NL"=> "Frisian",
166
+ "ga_IE"=> "Irish",
167
+ "gl_ES"=> "Galician",
168
+ "he_IL"=> "Hebrew",
169
+ "hi_IN"=> "Hindi",
170
+ "hr_HR"=> "Croatian",
171
+ "hu_HU"=> "Hungarian",
172
+ "hy_AM"=> "Armenian",
173
+ "id_ID"=> "Indonesian",
174
+ "is_IS"=> "Icelandic",
175
+ "it_IT"=> "Italian",
176
+ "ja_JP"=> "Japanese",
177
+ "ka_GE"=> "Georgian",
178
+ "km_KH"=> "Khmer",
179
+ "ko_KR"=> "Korean",
180
+ "ku_TR"=> "Kurdish",
181
+ "la_VA"=> "Latin",
182
+ "lt_LT"=> "Lithuanian",
183
+ "lv_LV"=> "Latvian",
184
+ "mk_MK"=> "Macedonian",
185
+ "ml_IN"=> "Malayalam",
186
+ "ms_MY"=> "Malay",
187
+ "nb_NO"=> "Norwegian (bokmal)",
188
+ "ne_NP"=> "Nepali",
189
+ "nl_NL"=> "Dutch",
190
+ "nn_NO"=> "Norwegian (nynorsk)",
191
+ "pa_IN"=> "Punjabi",
192
+ "pl_PL"=> "Polish",
193
+ "ps_AF"=> "Pashto",
194
+ "pt_BR"=> "Portuguese (Brazil)",
195
+ "pt_PT"=> "Portuguese (Portugal)",
196
+ "ro_RO"=> "Romanian",
197
+ "ru_RU"=> "Russian",
198
+ "sk_SK"=> "Slovak",
199
+ "sl_SI"=> "Slovenian",
200
+ "sq_AL"=> "Albanian",
201
+ "sr_RS"=> "Serbian",
202
+ "sv_SE"=> "Swedish",
203
+ "sw_KE"=> "Swahili",
204
+ "ta_IN"=> "Tamil",
205
+ "te_IN"=> "Telugu",
206
+ "th_TH"=> "Thai",
207
+ "tl_PH"=> "Filipino",
208
+ "tr_TR"=> "Turkish",
209
+ "uk_UA"=> "Ukrainian",
210
+ "vi_VN"=> "Vietnamese",
211
+ "zh_CN"=> "Simplified Chinese (China)",
212
+ "zh_HK"=> "Traditional Chinese (Hong Kong)",
213
+ "zh_TW"=> "Traditional Chinese (Taiwan)"
214
+ );
215
+
216
+ return $locales;
217
+ }
218
+
219
+ /**
220
+ * Load styles for dashboard
221
+ *
222
+ * @since 1.3.1
223
+ */
224
+
225
+ static function enqueueScriptsAdmin() {
226
+
227
+ // add scripts
228
+ wp_register_script( 'gumroad', 'https://gumroad.com/js/gumroad.js' );
229
+ wp_enqueue_script( 'gumroad' );
230
+
231
+ // add custom css
232
+ wp_register_style( 'sfp-admin-style', plugin_dir_url(__FILE__) . '/lib/css/sfp-admin-style.css' );
233
+ wp_enqueue_style( 'sfp-admin-style' );
234
+ }
235
+
236
+ /**
237
+ * Load Facebook JavaScript SDK
238
+ *
239
+ * @since 1.3
240
+ */
241
+
242
+ public function addJavaScriptSDK() {
243
+
244
+ $options = $this->getPluginOptions();
245
+ $locale = $options['locale'];
246
+
247
+ ?>
248
+
249
+ <div id="fb-root"></div>
250
+ <script>
251
+ (function(d){
252
+ var js, id = 'facebook-jssdk';
253
+ if (d.getElementById(id)) {return;}
254
+ js = d.createElement('script');
255
+ js.id = id;
256
+ js.async = true;
257
+ js.src = "//connect.facebook.net/<?php echo $locale; ?>/all.js#xfbml=1";
258
+ d.getElementsByTagName('head')[0].appendChild(js);
259
+ }(document));
260
+ </script>
261
+
262
+ <?php }
263
+
264
+ /**
265
+ * Add Dashboard > Plugins Menu Page
266
+ *
267
+ * @since 1.3
268
+ */
269
+
270
+ public function pluginMenu() {
271
+
272
+ add_plugins_page('Simple Facebook Plugin Menu', 'Simple Facebook', 'read', 'simple_facebook_plugin', array( $this, "pluginMenuView" ) );
273
+ }
274
+
275
+ /**
276
+ * Show Menu Page View
277
+ *
278
+ * @since 1.3
279
+ */
280
+
281
+ public function pluginMenuView() {
282
+
283
+ $options = $this->getPluginOptions();
284
+
285
+ // include Like Box view
286
+ include( $sfplugin->pluginPath . 'views/view-menu.php' );
287
+
288
+ }
289
+
290
+ /**
291
+ * Show admin notice
292
+ *
293
+ * @since 1.3
294
+ */
295
+
296
+ public function adminNotice() {
297
+
298
+ global $current_user;
299
+ $user_id = $current_user->ID;
300
+
301
+ /* Check that the user hasn't already clicked to ignore the message */
302
+ if ( ! get_user_meta( $user_id, 'sfp_ignore_notice_1') ) {
303
+
304
+ echo '<div class="updated"><p>';
305
+
306
+ printf( __('Thanks for using <strong>Simple Facebook Plugin</strong>. Use our Responsive Add-on to make it look nice on all devices. <a class="button" href="https://gum.co/zrJx">Buy Add-on Now</a> or <a href="http://plugins.topdevs.net/simple-facebook-plugin/responsive-like-box-addon/">Visit Add-on Page</a> | <a href="%1$s">Don\'t show this</a>'), '?sfp_ignore_1=0');
307
+
308
+ echo "</p></div>";
309
+
310
+ }
311
+ }
312
+
313
+ public function ignoreNotices() {
314
+
315
+ global $current_user;
316
+ $user_id = $current_user->ID;
317
+
318
+ /* If user clicks to ignore the notice, add that to their user meta */
319
+ if ( isset( $_GET['sfp_ignore_1'] ) && '0' == $_GET['sfp_ignore_1'] ) {
320
+ add_user_meta( $user_id, 'sfp_ignore_notice_1', 'true', true);
321
+ }
322
+ }
323
+
324
+ /**
325
+ * Add status link on plugins page
326
+ *
327
+ * @since 1.3
328
+ */
329
+
330
+ public function pluginSettingsLink ( $links ) {
331
+
332
+ $settings_link = '<a href="' . menu_page_url( "simple_facebook_plugin", false ) . '">Settings</a>';
333
+
334
+ array_unshift( $links, $settings_link );
335
+
336
+ return $links;
337
+ }
338
+
339
+ /**
340
+ * Get plugin options
341
+ *
342
+ * @since 1.3
343
+ */
344
+
345
+ public function getPluginOptions() {
346
+
347
+ $defaults = array(
348
+ 'locale' => "en_US" );
349
+
350
+ $defaults = apply_filters( "sfp_default_options", $defaults );
351
+
352
+ $options = get_option( $this->optionName, $defaults );
353
+
354
+ return $options;
355
+ }
356
+
357
+ /**
358
+ * Save plugin options
359
+ *
360
+ * @since 1.3
361
+ */
362
+
363
+ public function savePluginOptions( $options = array() ) {
364
+
365
+ update_option( $this->optionName, $options );
366
+ }
367
+
368
+ /**
369
+ * Trigger when settings page form submitted
370
+ *
371
+ * @since 1.3
372
+ */
373
+
374
+ public function saveOptions() {
375
+
376
+ //delete_option( $this->optionName );
377
+
378
+ // If submit button pressed
379
+ if ( isset( $_POST['sfp_options_saved'] ) ) {
380
+
381
+ $options = $this->getPluginOptions();
382
+
383
+ if ( isset( $_POST['locale'] ) && !empty( $_POST['locale'] ) ) {
384
+
385
+ $options['locale'] = $_POST['locale'];
386
+ }
387
+
388
+ $this->savePluginOptions( $options );
389
+ }
390
+ }
391
+
392
+ /**
393
+ * Add disabled 'Responsive' checkbox
394
+ *
395
+ * @since 1.3.1
396
+ */
397
+
398
+ public function fakeCheckbox () {
399
+
400
+ if ( is_plugin_active( 'sfp-responsive-like-box/sfp-responsive-like-box.php' ) )
401
+ return;
402
+ ?>
403
+ <tr><td>
404
+ <label><?php _e('Responsive'); ?></label>
405
+ </td><td>
406
+ <input type="checkbox" disabled="disabled"/>
407
+ <span class="sfp-icon">
408
+ <span class="sfp-tooltip-wrap">
409
+ <span class="sfp-tooltip">
410
+ Available with "Responsive Like Box Add-on" installed and activated.
411
+ <span class="sfp-buttons">
412
+ <a class="button" href="https://gum.co/zrJx">Buy Add-on Now</a> or <a href="http://plugins.topdevs.net/simple-facebook-plugin/responsive-like-box-addon/">Learn more</a>
413
+ </span>
414
+ </span>
415
+ </span>
416
+ </span
417
+ </td></tr>
418
+ <?php
419
  }
420
 
421
  } // end SFPlugin class
views/view-like-box.php CHANGED
@@ -1,33 +1,39 @@
1
- <?php // Check if shortcode return string and not bool
2
- if ( is_string( $border ) ) $border = ( $border == 'true') ? true : false;
3
- if ( is_string( $faces ) ) $faces = ( $faces == 'true') ? true : false;
4
- if ( is_string( $stream ) ) $stream = ( $stream == 'true') ? true : false;
5
- if ( is_string( $header ) ) $header = ( $header == 'true') ? true : false;
6
- ?>
7
- <!-- SFPlugin by TopDevs -->
8
- <div id="fb-root"></div>
9
- <script>
10
- (function(d){
11
- var js, id = 'facebook-jssdk';
12
- if (d.getElementById(id)) {return;}
13
- js = d.createElement('script');
14
- js.id = id;
15
- js.async = true;
16
- js.src = "//connect.facebook.net/<?php echo $local; ?>/all.js#xfbml=1";
17
- d.getElementsByTagName('head')[0].appendChild(js);
18
- }(document));
19
- </script>
20
- <!-- Like Box Code START -->
21
- <div class="sfp-container">
22
- <div class="fb-like-box"
23
- data-href="<?php echo $url; ?>"
24
- data-width="<?php echo $width; ?>"
25
- data-height="<?php echo $height; ?>"
26
- data-colorscheme="<?php echo $colorscheme; ?>"
27
- data-show-faces="<?php echo ( $faces ) ? 'true' : 'false'; ?>"
28
- data-show-border="<?php echo ( $border ) ? 'true' : 'false'; ?>"
29
- data-stream="<?php echo ( $stream ) ? 'true' : 'false' ;?>"
30
- data-header="<?php echo ( $header ) ? 'true' : 'false' ;?>">
31
- </div>
 
 
 
 
 
32
  </div>
33
- <!-- Like Box Code END -->
 
1
+ <?php
2
+ // Check if shortcode return string and not bool
3
+ if ( is_string( $border ) ) $border = ( $border == 'true') ? true : false;
4
+ if ( is_string( $faces ) ) $faces = ( $faces == 'true') ? true : false;
5
+ if ( is_string( $stream ) ) $stream = ( $stream == 'true') ? true : false;
6
+ if ( is_string( $header ) ) $header = ( $header == 'true') ? true : false;
7
+
8
+ $like_box_classes = array( "sfp-container" );
9
+ $like_box_classes = apply_filters( "sfp_like_box_classes", $like_box_classes, $instance );
10
+ $like_box_classes = implode( " ", $like_box_classes );
11
+
12
+ ?>
13
+ <div id="fb-root"></div>
14
+ <script>
15
+ (function(d){
16
+ var js, id = 'facebook-jssdk';
17
+ if (d.getElementById(id)) {return;}
18
+ js = d.createElement('script');
19
+ js.id = id;
20
+ js.async = true;
21
+ js.src = "//connect.facebook.net/<?php echo $local; ?>/all.js#xfbml=1";
22
+ d.getElementsByTagName('head')[0].appendChild(js);
23
+ }(document));
24
+ </script>
25
+ <!-- SFPlugin by topdevs -->
26
+ <!-- Like Box Code START -->
27
+ <div class="<?php echo $like_box_classes; ?>">
28
+ <div class="fb-like-box"
29
+ data-href="<?php echo $url; ?>"
30
+ data-width="<?php echo $width; ?>"
31
+ data-height="<?php echo $height; ?>"
32
+ data-colorscheme="<?php echo $colorscheme; ?>"
33
+ data-show-faces="<?php echo ( $faces ) ? 'true' : 'false'; ?>"
34
+ data-show-border="<?php echo ( $border ) ? 'true' : 'false'; ?>"
35
+ data-stream="<?php echo ( $stream ) ? 'true' : 'false' ;?>"
36
+ data-header="<?php echo ( $header ) ? 'true' : 'false' ;?>">
37
  </div>
38
+ </div>
39
+ <!-- Like Box Code END -->
views/view-menu.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2>Simple Facebook Menu</h2>
3
+
4
+ <form method="POST" action="">
5
+ <select name="locale">
6
+ <?php foreach ( $this->locales as $code => $name ) : ?>
7
+ <option <?php selected(( $options['locale'] == $code ) ? 1 : 0 ); ?> value="<?php echo $code; ?>" ><?php echo $name; ?></option>
8
+ <?php endforeach; ?>
9
+ </select>
10
+
11
+ <p class="description">
12
+ Some Description
13
+ </p>
14
+
15
+ <?php submit_button('Save', 'primary', 'sfp_options_saved'); ?>
16
+ </form>
17
+
18
+ <?php var_dump( $options ); ?>
19
+ </div>