Recent Facebook Posts - Version 1.8.4

Version Description

  • December 2, 2013 =
  • Fixed: Empty events won't show
  • Improved: a cache renewal is no longer required after changing the image size
  • Improved: after changing important settings, cache will automatically be cleared
  • Improved: added a test configuration button which performs a simple ping to Facebook.
  • Improved: added an info message for new users
  • Improved: filters are now added the "WordPress way", which means they can be disabled
  • Improved: namespaced the trigger for renewing the cache
  • Improved: added empty index.php files to prevent directory listings
  • Improved: code clean-up
Download this release

Release Info

Developer DvanKooten
Plugin Icon wp plugin Recent Facebook Posts
Version 1.8.4
Comparing to
See all releases

Code changes from version 1.7.3 to 1.8.4

assets/css/admin.css CHANGED
@@ -1,24 +1,61 @@
1
- .rfbp-column{ float:left; }
2
- .rfbp-sidebar{ width:30%; float:right; margin-left:1%; }
3
- .rfbp-error{ color:red; }
4
-
5
- .rfbp-box{ margin:0 0 24px;}
6
- .rfbp-well { background:#222; color:#eee; padding:10px 20px; margin-top:10px; }
7
-
8
- .rfbp-row-error label{ color:red; }
9
- p.status{ font-weight:bold;}
10
- span.connected, span.disconnected{ font-weight:bold; display:inline-block; color:white; padding:3px; }
11
- span.connected{ background:green; }
12
- span.disconnected{ background:lightGrey; }
13
-
14
- .clearfix:after {
15
- visibility: hidden;
16
- display: block;
17
- font-size: 0;
18
- content: " ";
19
- clear: both;
20
- height: 0;
21
- }
22
-
23
- * html .clearfix { zoom: 1; } /* IE6 */
24
- *:first-child+html .clearfix { zoom: 1; } /* IE7 */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .rfbp-container{
2
+ max-width:1200px;
3
+ }
4
+
5
+ .rfbp-primary{
6
+ width:60%;
7
+ }
8
+
9
+ .rfbp-column{
10
+ float:left;
11
+ }
12
+
13
+ .rfbp-secondary {
14
+ width:35%;
15
+ margin-left: 2%;
16
+ padding-left:2%;
17
+ border-left: 1px solid #efefef;
18
+ }
19
+
20
+ .rfbp-error{
21
+ color:red;
22
+ }
23
+
24
+ .rfbp-box{
25
+ margin:0 0 25px;
26
+ clear:both;
27
+ }
28
+
29
+ .rfbp-info {
30
+ padding:5px 15px;
31
+ color: #3a87ad;
32
+ background-color: #d9edf7;
33
+ border-color: #bce8f1;
34
+ }
35
+
36
+ .rfbp-alert {
37
+ padding:5px 15px;
38
+ color: #c09853;
39
+ background-color: #fcf8e3;
40
+ border-color: #faebcc;
41
+ }
42
+
43
+ .rfbp-title{ margin-top: 2em; }
44
+
45
+ @media(max-width: 919px) {
46
+ .rfbp-column{
47
+ float: none;
48
+ width: 100%;
49
+ }
50
+
51
+ .rfbp-secondary{
52
+ padding:0;
53
+ margin:25px 0;
54
+ border-left:0;
55
+ }
56
+
57
+ .rfbp-box{
58
+ border-top: 1px solid #efefef;
59
+ padding-top:25px;
60
+ }
61
+ }
assets/css/default.css CHANGED
@@ -2,9 +2,23 @@
2
 
3
  .rfbp-post { border-bottom:1px solid #E9E9E9; padding-bottom:15px; margin-bottom:15px; margin-top:0; padding-top:0; }
4
  .rfbp-post-link-wrap { margin-bottom:0 !important; padding-bottom:0; }
5
- .rfbp-post-link{ display:block; font-weight:normal; background:none; border:0; padding:1px 0; margin:0; cursor:pointer; text-decoration:none !important; color:#3B5998;; font-size:11px; line-height:15px !important; height:15px; }
6
  .rfbp-post-link:hover{ text-decoration:none !important; color:#3B5998; }
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  .rfbp-timestamp{ color:#999;}
9
  .rfbp-timestamp:hover{ text-decoration:underline; color:#999; font-weight:normal; }
10
 
@@ -14,7 +28,7 @@
14
  .rfbp-like-count > span{ display:none; }
15
  .rfbp-comment-count > span{ display:none; }
16
 
17
- .rfbp-image-wrap { margin:1em 0; max-width:100%; }
18
  .rfbp-image-link{ margin:0; padding:0; float:none; line-height:0; max-width:100%; display:inline-block; }
19
  .rfbp-image{ margin:0; padding:0; border:1px solid #ccc; }
20
 
2
 
3
  .rfbp-post { border-bottom:1px solid #E9E9E9; padding-bottom:15px; margin-bottom:15px; margin-top:0; padding-top:0; }
4
  .rfbp-post-link-wrap { margin-bottom:0 !important; padding-bottom:0; }
5
+ .rfbp-post-link{ display:block; font-weight:normal !important; background:none; border:0; padding:1px 0; margin:0; cursor:pointer; text-decoration:none !important; color:#3B5998; font-size:11px; line-height:15px !important; height:15px; }
6
  .rfbp-post-link:hover{ text-decoration:none !important; color:#3B5998; }
7
 
8
+ .rfbp-link-wrap{ display:block; padding:0 !important; margin:1em 0; max-width:100%; font-weight: normal !important; text-shadow: none !important;
9
+ background: #f6f7f9; border: 1px solid #d3dae8 !important; font-size:11px; color: gray; overflow: hidden; }
10
+ a.rfbp-link{ text-decoration: none !important; display:block; color: gray; font-weight: normal; }
11
+ a.rfbp-link:hover{ text-decoration:none; }
12
+
13
+ span.rfbp-link-image-wrap{ margin:0; padding:0; width:114px; line-height: 0; border-right: 1px solid #d3dae8; display:table-cell; vertical-align: middle; }
14
+ img.rfbp-link-image{ margin:0 !important; padding:0 !important; border:0 !important; border-radius:0 !important; box-shadow:none !important; width:114px; height: auto; display: inline; }
15
+
16
+ span.rfbp-link-text-wrap{ padding:8px; color: gray; display:table-cell; }
17
+ span.rfbp-link-text-wrap span{ line-height:14px; display:block; }
18
+ span.rfbp-link-name{ font-weight:bold; color: #3b5998; }
19
+ span.rfbp-link-caption{ }
20
+ span.rfbp-link-description{ margin-top:12px; }
21
+
22
  .rfbp-timestamp{ color:#999;}
23
  .rfbp-timestamp:hover{ text-decoration:underline; color:#999; font-weight:normal; }
24
 
28
  .rfbp-like-count > span{ display:none; }
29
  .rfbp-comment-count > span{ display:none; }
30
 
31
+ .rfbp-image-wrap { display:block; margin:1em 0; max-width:100%; }
32
  .rfbp-image-link{ margin:0; padding:0; float:none; line-height:0; max-width:100%; display:inline-block; }
33
  .rfbp-image{ margin:0; padding:0; border:1px solid #ccc; }
34
 
assets/css/index.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ // empty index.php to prevent directory listing
assets/img/index.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ // empty index.php to prevent directory listing
assets/index.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ // empty index.php to prevent directory listing
assets/js/index.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ // empty index.php to prevent directory listing
includes/RFBP.php DELETED
@@ -1,303 +0,0 @@
1
- <?php
2
-
3
- class RFBP {
4
-
5
- private static $instance = null;
6
- private static $api = null;
7
- private $options;
8
- public $cache_renewed = false;
9
-
10
- public static function instance() {
11
- return self::$instance;
12
- }
13
-
14
- public function __construct() {
15
-
16
- self::$instance = $this;
17
-
18
- // both frontend and backend
19
- include_once RFBP_PLUGIN_DIR . 'includes/RFBP_Widget.php';
20
- add_action( 'widgets_init', array($this, 'register_widget') );
21
-
22
- // finish if this is an AJAX request
23
- if(defined("DOING_AJAX") && DOING_AJAX) { return; }
24
-
25
- // starts sessions, fixes app token problem
26
- if(!session_id() && !headers_sent()) {
27
- session_start();
28
- }
29
-
30
- $opts = $this->get_settings();
31
-
32
- // only on frontend
33
- if(!is_admin()) {
34
-
35
- add_filter('rfbp_content', 'wpautop');
36
-
37
- include_once RFBP_PLUGIN_DIR . 'includes/helper-functions.php';
38
- include_once RFBP_PLUGIN_DIR . 'includes/template-functions.php';
39
-
40
- add_shortcode('recent_facebook_posts', array($this, 'output'));
41
- add_shortcode('recent-facebook-posts', array($this, 'output'));
42
-
43
- if($opts['load_css']) {
44
- add_action( 'wp_enqueue_scripts', array($this, 'load_css'));
45
- }
46
-
47
- } else {
48
- // only in admin panel
49
- include_once RFBP_PLUGIN_DIR . 'includes/RFBP_Admin.php';
50
- new RFBP_Admin();
51
- }
52
-
53
- add_action('rfbp_renew_cache', array($this, 'delete_transients'), 10);
54
- add_action('rfbp_renew_cache', array($this, 'get_posts'), 11);
55
- }
56
-
57
- public function register_widget()
58
- {
59
- register_widget( "RFBP_Widget" );
60
- }
61
-
62
- public function load_css() {
63
- wp_register_style('recent-facebook-posts-css', plugins_url('recent-facebook-posts/assets/css/default.css'), array(), RFBP_VERSION );
64
- wp_enqueue_style('recent-facebook-posts-css' );
65
- }
66
-
67
- public function get_settings() {
68
- if(!$this->options) {
69
-
70
- $defaults = array(
71
- 'app_id' => '',
72
- 'app_secret' => '',
73
- 'fb_id' => 'DannyvanKootenCOM',
74
- 'cache_time' => 7200,
75
- 'load_css' => 1,
76
- 'link_text' => 'Find us on Facebook',
77
- 'link_new_window' => 0,
78
- 'img_size' => 'normal',
79
- 'img_width' => '',
80
- 'img_height' => ''
81
- );
82
-
83
- // get user options
84
- $options = get_option('rfb_settings');
85
-
86
- // options did not exist yet, add option to database
87
- if(!$options) { add_option('rfb_settings', $defaults); }
88
-
89
- $this->options = array_merge($defaults, (array) $options);
90
- }
91
-
92
- return $this->options;
93
- }
94
-
95
- static public function api()
96
- {
97
- if(!self::$api) {
98
- require_once RFBP_PLUGIN_DIR . 'includes/RFBP_API.php';
99
- $opts = RFBP::instance()->get_settings();
100
- self::$api = new RFBP_API($opts['app_id'], $opts['app_secret'], $opts['fb_id']);
101
- }
102
-
103
- return self::$api;
104
- }
105
-
106
- public function get_fallback_posts()
107
- {
108
- $posts = get_transient('rfbp_posts_fallback');
109
-
110
- if(!$posts) {
111
- return array();
112
- }
113
-
114
- return $posts;
115
- }
116
-
117
- public function get_posts() {
118
-
119
- // try to get posts from cache
120
- if(($posts = get_transient('rfbp_posts'))) {
121
- return $posts;
122
- }
123
-
124
- $opts = $this->get_settings();
125
-
126
- $api = self::api();
127
- $data = $api->get_posts();
128
-
129
- // did api call succeed?
130
- if(!$data) {
131
- return $this->get_fallback_posts();
132
- }
133
-
134
- $posts = array();
135
- foreach($data as $p) {
136
-
137
- // skip this "post" if it is not of one of the following types
138
- if(!in_array($p->type, array('status', 'photo', 'video', 'link'))) {
139
- continue;
140
- }
141
-
142
- // skip empty status updates and friend approvals
143
- if($p->type == 'status' && (!isset($p->message) || empty($p->message))) { continue; }
144
- if($p->type == 'status' && $p->status_type == 'approved_friend') { continue; }
145
-
146
- //split user and post ID (userID_postID)
147
- $idArray = explode("_", $p->id);
148
-
149
- $post = array();
150
- $post['type'] = $p->type;
151
- $post['content'] = isset($p->message) ? utf8_encode($p->message) : '';
152
- $post['image'] = null;
153
-
154
- // set post content and image
155
- if($p->type == 'photo') {
156
-
157
- $image = "//graph.facebook.com/". $p->object_id . '/picture?type=' . $opts['img_size'];
158
- $post['image'] = $image;
159
-
160
- } elseif($p->type == 'video') {
161
-
162
- $image = $p->picture;
163
-
164
- // hacky
165
- if($opts['img_size'] == 'normal') {
166
- $image = str_replace(array("_s.jpg", "_s.png"), array("_n.jpg", "_n.png"), $image);
167
- }
168
-
169
- $post['image'] = $image;
170
-
171
- } elseif($p->type == 'link' && !stristr($post['content'], $p->link)) {
172
- $post['content'] .= (empty($post['content'])) ? $p->link : "\n\n" . $p->link;
173
- }
174
-
175
- // calculate post like and comment counts
176
- if(isset($p->likes->summary->total_count)) {
177
- $like_count = $p->likes->summary->total_count;
178
- } else {
179
- $like_count = 0;
180
- }
181
-
182
- if(isset($p->comments->summary->total_count)) {
183
- $comment_count = $p->comments->summary->total_count;
184
- } else {
185
- $comment_count = 0;
186
- }
187
-
188
- $post['timestamp'] = strtotime($p->created_time);
189
- $post['like_count'] = $like_count;
190
- $post['comment_count'] = $comment_count;
191
- $post['link'] = "http://www.facebook.com/".$opts['fb_id']."/posts/".$idArray[1];
192
- $posts[] = $post;
193
-
194
- }
195
-
196
- // store results in cache for later use
197
- if($posts) {
198
- set_transient('rfbp_posts', $posts, $opts['cache_time']); // user set cache time
199
- set_transient('rfbp_posts_fallback', $posts, 2629744); // 1 month
200
- $this->cache_renewed = true;
201
- }
202
-
203
- return $posts;
204
- }
205
-
206
- public function output($atts = array())
207
- {
208
- extract(shortcode_atts(array(
209
- 'number' => '5',
210
- 'likes' => 1,
211
- 'comments' => 1,
212
- 'excerpt_length' => 140,
213
- 'el' => 'div',
214
- 'origin' => 'shortcode',
215
- 'show_link' => false
216
- ), $atts));
217
-
218
- $opts = $this->get_settings();
219
- $posts = $this->get_posts();
220
-
221
- ob_start();
222
- ?>
223
- <!-- Recent Facebook Posts v<?php echo RFBP_VERSION; ?> - http://wordpress.org/plugins/recent-facebook-posts/ -->
224
- <div class="recent-facebook-posts rfbp rfbp-container rfbp-<?php echo $origin; ?>">
225
- <?php
226
-
227
- if($posts && !empty($posts)) {
228
-
229
- if($el == 'li') { echo '<ul class="rfbp-posts-wrap">'; }
230
-
231
- $posts = array_slice($posts, 0, $number);
232
- $link_target = ($opts['link_new_window']) ? "_blank" : '';
233
-
234
- foreach($posts as $p) {
235
-
236
- $content = convert_smilies(utf8_decode($p['content']));
237
-
238
- $shortened = false;
239
-
240
- if(strlen($content) > $excerpt_length) {
241
- $limit = strpos($content, ' ',$excerpt_length);
242
- if($limit) {
243
- $content = substr($content, 0, $limit);
244
- $shortened = true;
245
- }
246
- }
247
- ?>
248
-
249
- <<?php echo $el; ?> class="rfbp-post">
250
- <div class="rfbp-text">
251
-
252
- <?php
253
- $content = make_clickable($content, $link_target);
254
- $content = ($shortened) ? $content . apply_filters('rfbp_read_more', '..', $p['link']) : $content;
255
- $content = apply_filters('rfbp_content', $content, $p['link']);
256
-
257
- echo $content; ?>
258
-
259
- </div>
260
- <?php if($opts['img_size'] != 'dont_show' && isset($p['image']) && !empty($p['image'])) { ?>
261
- <p class="rfbp-image-wrap">
262
- <a class="rfbp-image-link" target="<?php echo $link_target; ?>" href="<?php echo $p['link']; ?>" rel="nofollow">
263
- <?php $max_img_width = (!empty($opts['img_width'])) ? $opts['img_width'].'px' : '100%'; $max_img_height = (!empty($opts['img_height'])) ? $opts['img_height'].'px' : 'none'; ?>
264
- <img class="rfbp-image" src="<?php echo $p['image']; ?>" style="max-width: <?php echo $max_img_width; ?>; max-height: <?php echo $max_img_height; ?>" alt="" />
265
- </a>
266
- </p>
267
- <?php } ?>
268
- <p class="rfbp-post-link-wrap">
269
- <a target="<?php echo $link_target; ?>" class="rfbp-post-link" href="<?php echo $p['link']; ?>" rel="nofolloW">
270
- <?php if($likes) { ?><span class="rfbp-like-count"><?php echo $p['like_count']; ?> <span>likes<?php if($comments) { ?>, <?php } ?></span></span><?php } ?>
271
- <?php if($comments) { ?><span class="rfbp-comment-count"><?php echo $p['comment_count']; ?> <span>comments</span></span><?php } ?>
272
- <?php if($likes || $comments) { ?> · <?php } ?>
273
- <span class="rfbp-timestamp" title="<?php echo date('l, F j, Y', $p['timestamp']) ?> at <?php echo date('G:i', $p['timestamp']); ?>"><?php echo rfbp_time_ago($p['timestamp']); ?></span>
274
- </a>
275
- </p>
276
- </<?php echo $el; ?>>
277
- <?php
278
-
279
- } // end foreach $posts
280
-
281
- if($el == 'li') { echo '</ul>'; }
282
-
283
- } else {
284
- ?><p>No recent Facebook posts to show.</p><?php
285
- if(current_user_can('manage_options')) {
286
- ?><p><strong>Admins only notice:</strong> Did you <a href="<?php echo admin_url('options-general.php?page=rfbp'); ?>">configure the plugin</a> properly?</p><?php
287
- }
288
- } ?>
289
-
290
- <?php if($show_link) { ?>
291
- <p class="rfbp-page-link-wrap"><a class="rfbp-page-link" href="http://www.facebook.com/<?php echo $opts['fb_id']; ?>/" rel="external nofollow" target="<?php echo $link_target; ?>"><?php echo strip_tags($opts['link_text']); ?></a></p>
292
- <?php } ?>
293
-
294
- </div>
295
- <!-- / Recent Facebook Posts -->
296
- <?php
297
- $output = ob_get_contents();
298
- ob_end_clean();
299
-
300
- return $output;
301
- }
302
-
303
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/RFBP_Widget.php DELETED
@@ -1,104 +0,0 @@
1
- <?php
2
-
3
- class RFBP_Widget extends WP_Widget {
4
-
5
- private $defaults = array(
6
- 'title' => 'Recent Facebook posts',
7
- 'number_of_posts' => 5,
8
- 'excerpt_length' => 140,
9
- 'show_comment_count' => true,
10
- 'show_like_count' => true,
11
- 'show_link' => true
12
- );
13
-
14
- public function __construct() {
15
- parent::__construct(
16
- 'rfb_widget', // Base ID
17
- 'Recent Facebook Posts', // Name
18
- array( 'description' => 'Lists a number of your most recent Facebook posts.' )
19
- );
20
- }
21
-
22
- public function form( $instance ) {
23
-
24
- $instance = array_merge($this->defaults, $instance);
25
- extract($instance);
26
-
27
- $opts = RFBP::instance()->get_settings();
28
-
29
- if(empty($opts['app_id'])) { ?>
30
- <p style="color:red;">You'll need to <a href="<?php echo admin_url('options-general.php?page=rfbp'); ?>">configure Recent Facebook Posts</a> first before this will work.</p>
31
- <?php } ?>
32
- <p>
33
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
34
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
35
- </p>
36
-
37
- <p>
38
- <label for="<?php echo $this->get_field_id( 'number_of_posts' ); ?>"><?php _e( 'Number of posts:' ); ?></label>
39
- <input class="widefat" id="<?php echo $this->get_field_id( 'number_of_posts' ); ?>" name="<?php echo $this->get_field_name( 'number_of_posts' ); ?>" type="text" value="<?php echo esc_attr( $number_of_posts ); ?>" />
40
- </p>
41
-
42
- <p>
43
- <label for="<?php echo $this->get_field_id( 'excerpt_length' ); ?>"><?php _e( 'Excerpt length:' ); ?></label>
44
- <input class="widefat" id="<?php echo $this->get_field_id( 'excerpt_length' ); ?>" name="<?php echo $this->get_field_name( 'excerpt_length' ); ?>" type="text" value="<?php echo esc_attr( $excerpt_length ); ?>" />
45
- </p>
46
-
47
- <p>
48
- <input type="checkbox" id="<?php echo $this->get_field_id( 'show_like_count' ); ?>" name="<?php echo $this->get_field_name( 'show_like_count' ); ?>" value="1" <?php checked($show_like_count, 1); ?> />
49
- <label for="<?php echo $this->get_field_id( 'show_like_count' ); ?>"><?php _e( 'Show Like count?' ); ?></label>
50
- </p>
51
-
52
- <p>
53
- <input type="checkbox" id="<?php echo $this->get_field_id( 'show_comment_count' ); ?>" name="<?php echo $this->get_field_name( 'show_comment_count' ); ?>" value="1" <?php checked($show_comment_count, 1); ?> />
54
- <label for="<?php echo $this->get_field_id( 'show_comment_count' ); ?>"><?php _e( 'Show Comment count?' ); ?></label>
55
- </p>
56
-
57
- <p>
58
- <input type="checkbox" id="<?php echo $this->get_field_id( 'show_link' ); ?>" name="<?php echo $this->get_field_name( 'show_link' ); ?>" value="1" <?php if($show_link) { ?>checked="1"<?php } ?> />
59
- <label for="<?php echo $this->get_field_id( 'show_link' ); ?>"><?php _e( 'Show a link to Facebook page?' ); ?></label>
60
- </p>
61
-
62
- <p style="background: #222; color:#eee; padding:10px; ">If you like this plugin, consider <a href="http://dannyvankooten.com/donate/">donating $10, $20 or $50</a> as a token of your appreciation.</p>
63
-
64
- <?php
65
- }
66
-
67
- public function update( $new_instance, $old_instance ) {
68
- $instance = array();
69
- $instance['title'] = strip_tags( $new_instance['title'] );
70
- $instance['number_of_posts'] = (int) strip_tags( $new_instance['number_of_posts'] );
71
- $instance['excerpt_length'] = (int) strip_tags($new_instance['excerpt_length']);
72
- $instance['show_like_count'] = isset($new_instance['show_like_count']);
73
- $instance['show_comment_count'] = isset($new_instance['show_comment_count']);
74
- $instance['show_link'] = isset($new_instance['show_link']);
75
- return $instance;
76
- }
77
-
78
- public function widget( $args, $instance = array()) {
79
-
80
- $instance = array_merge($this->defaults, $instance);
81
-
82
- extract($instance);
83
- extract( $args );
84
-
85
- $title = apply_filters( 'widget_title', $instance['title'] );
86
-
87
- echo $before_widget;
88
- if ( ! empty( $title ) )
89
- echo $before_title . $title . $after_title;
90
- echo RFBP::instance()->output(array(
91
- 'origin' => 'widget',
92
- 'number' => $number_of_posts,
93
- 'likes' => $show_like_count,
94
- 'comments' => $show_comment_count,
95
- 'excerpt_length' => $excerpt_length,
96
- 'el' => apply_filters('rfbp_widget_element', 'div'),
97
- 'show_link' => $show_link
98
- ));
99
- echo $after_widget;
100
- }
101
-
102
-
103
-
104
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/{RFBP_Admin.php → class-admin.php} RENAMED
@@ -2,9 +2,9 @@
2
 
3
  class RFBP_Admin {
4
 
5
- public function __construct() {
6
 
7
- global $pagenow;
8
 
9
  add_action( 'admin_init', array( $this, 'register_settings' ) );
10
  add_action( 'admin_menu', array( $this, 'build_menu' ) );
@@ -13,25 +13,45 @@ class RFBP_Admin {
13
 
14
  // handle requests early, but only on rfb settings page
15
  if ( isset( $_GET['page'] ) && $_GET['page'] == 'rfbp' ) {
16
-
17
  // load css
18
  add_action( 'admin_enqueue_scripts', array( $this, 'load_css' ) );
19
- add_action( 'init', array( $this, 'on_init' ) );
20
  }
 
 
21
  }
22
 
23
  public function on_init() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  // maybe renew cache file
25
- if ( isset( $_POST['renew_cache'] ) ) {
 
26
  delete_transient('rfbp_posts');
27
  delete_transient('rfbp_posts_fallback');
28
 
29
- RFBP::instance()->get_posts();
30
  }
31
- }
32
 
33
- public function get_settings() {
34
- return RFBP::instance()->get_settings();
 
35
  }
36
 
37
  public function register_settings() {
@@ -39,23 +59,26 @@ class RFBP_Admin {
39
  }
40
 
41
  public function sanitize_settings( $opts ) {
42
- $old_opts = $this->get_settings();
 
 
43
  $opts['app_id'] = trim($opts['app_id']);
44
  $opts['app_secret'] = trim($opts['app_secret']);
45
  $opts['fb_id'] = trim($opts['fb_id']);
46
 
47
- if($old_opts['fb_id'] !== $opts['fb_id'] || $old_opts['img_size'] !== $opts['img_size']) {
48
- add_settings_error('rfbp', 'rfbp-cache-invalid', 'Settings have changed which invalidated the cached Facebook posts. <form action="'. admin_url('options-general.php?page=rfbp') .'" method="post"><input type="hidden" name="renew_cache" value="1" /><input type="submit" class="button-primary" value="Renew Cache" /></form>', "updated");
49
- }
50
-
51
- if($old_opts['app_id'] !== $opts['app_id'] || !$old_opts['app_secret']) {
52
- add_settings_error('rfbp', 'rfbp-cache-invalid', 'You changed important settings, please test your new configuration by renewing the Facebook posts cache. <form action="'. admin_url('options-general.php?page=rfbp') .'" method="post"><input type="hidden" name="renew_cache" value="1" /><input type="submit" class="button-primary" value="Renew Cache" /></form>', "updated");
53
  }
54
 
55
- $opts['cache_time'] = absint($opts['cache_time']);
 
56
  $opts['img_height'] = ( !empty( $opts['img_height'] ) ) ? (int) $opts['img_height'] : '';
57
  $opts['img_width'] = ( !empty( $opts['img_width'] ) ) ? (int) $opts['img_width'] : '';
58
  $opts['load_css'] = ( isset( $opts['load_css'] ) ) ? 1 : 0;
 
 
59
  return $opts;
60
  }
61
 
@@ -70,14 +93,11 @@ class RFBP_Admin {
70
 
71
  public function settings_page() {
72
 
73
- $opts = $this->get_settings();
74
-
75
- $ready = (!empty($opts['app_id']) && !empty($opts['app_secret']) && !empty($opts['fb_id']));
76
- $api = RFBP::api();
77
 
78
  // show user-friendly error message
79
- if(RFBP::instance()->cache_renewed) {
80
- $notice = "<strong>Cache renewed!</strong> You succesfully renewed the cache.";
81
  }
82
 
83
  include_once RFBP_PLUGIN_DIR . 'includes/views/settings_page.html.php';
@@ -89,10 +109,22 @@ class RFBP_Admin {
89
  * @param array $links Array containing all the settings links for the various plugins.
90
  * @return array The new array containing all the settings links
91
  */
92
- function add_settings_link( $links ) {
93
- $settings_link = '<a href="options-general.php?page=rfbp">Settings</a>';
94
  array_unshift( $links, $settings_link );
95
 
96
  return $links;
97
  }
 
 
 
 
 
 
 
 
 
 
 
 
98
  }
2
 
3
  class RFBP_Admin {
4
 
5
+ private $cache_cleared = false;
6
 
7
+ public function __construct() {
8
 
9
  add_action( 'admin_init', array( $this, 'register_settings' ) );
10
  add_action( 'admin_menu', array( $this, 'build_menu' ) );
13
 
14
  // handle requests early, but only on rfb settings page
15
  if ( isset( $_GET['page'] ) && $_GET['page'] == 'rfbp' ) {
 
16
  // load css
17
  add_action( 'admin_enqueue_scripts', array( $this, 'load_css' ) );
 
18
  }
19
+
20
+ add_action( 'init', array( $this, 'on_init' ) );
21
  }
22
 
23
  public function on_init() {
24
+
25
+ if(version_compare(RFBP_VERSION, get_option('rfbp_version', 0))) {
26
+
27
+ // code is newer than database, run upgrade routine
28
+ delete_transient('rfbp_posts');
29
+ delete_transient('rfbp_posts_fallback');
30
+
31
+ $settings = rfbp_get_settings();
32
+
33
+ if(isset($settings['link_text'])) {
34
+ $settings['page_link_text'] = $settings['link_text'];
35
+ unset($settings['link_text']);
36
+ }
37
+
38
+ update_option('rfb_settings', $settings);
39
+
40
+ update_option('rfbp_version', RFBP_VERSION);
41
+ }
42
+
43
  // maybe renew cache file
44
+ if ( isset( $_POST['rfbp-clear-cache'] ) ) {
45
+
46
  delete_transient('rfbp_posts');
47
  delete_transient('rfbp_posts_fallback');
48
 
49
+ $this->cache_cleared = true;
50
  }
 
51
 
52
+ if(isset($_POST['rfbp-test-config'])) {
53
+ add_action( 'admin_init', array($this, 'test_facebook_api') );
54
+ }
55
  }
56
 
57
  public function register_settings() {
59
  }
60
 
61
  public function sanitize_settings( $opts ) {
62
+ $old_opts = rfbp_get_settings();
63
+
64
+ // fb config
65
  $opts['app_id'] = trim($opts['app_id']);
66
  $opts['app_secret'] = trim($opts['app_secret']);
67
  $opts['fb_id'] = trim($opts['fb_id']);
68
 
69
+ if(($old_opts['fb_id'] !== $opts['fb_id']) || ($old_opts['app_id'] !== $opts['app_id']) || ($old_opts['app_secret'] !== $opts['app_secret'])) {
70
+ // delete cache transients
71
+ delete_transient('rfbp_posts');
72
+ delete_transient('rfbp_posts_fallback');
 
 
73
  }
74
 
75
+ // appearance opts
76
+ $opts['page_link_text'] = strip_tags($opts['page_link_text'], '<span><strong><b><em><i><img>');
77
  $opts['img_height'] = ( !empty( $opts['img_height'] ) ) ? (int) $opts['img_height'] : '';
78
  $opts['img_width'] = ( !empty( $opts['img_width'] ) ) ? (int) $opts['img_width'] : '';
79
  $opts['load_css'] = ( isset( $opts['load_css'] ) ) ? 1 : 0;
80
+ $opts['show_links'] = isset($opts['show_links']) ? 1 : 0;
81
+
82
  return $opts;
83
  }
84
 
93
 
94
  public function settings_page() {
95
 
96
+ $opts = rfbp_get_settings();
 
 
 
97
 
98
  // show user-friendly error message
99
+ if($this->cache_cleared) {
100
+ $notice = __("<strong>Cache cleared!</strong> You succesfully cleared the cache.", 'recent-facebook-posts');
101
  }
102
 
103
  include_once RFBP_PLUGIN_DIR . 'includes/views/settings_page.html.php';
109
  * @param array $links Array containing all the settings links for the various plugins.
110
  * @return array The new array containing all the settings links
111
  */
112
+ public function add_settings_link( $links ) {
113
+ $settings_link = '<a href="options-general.php?page=rfbp">'. __('Settings', 'recent-facebook-posts') . '</a>';
114
  array_unshift( $links, $settings_link );
115
 
116
  return $links;
117
  }
118
+
119
+ public function test_facebook_api()
120
+ {
121
+ $api = rfbp_get_api();
122
+ $ping = $api->ping();
123
+
124
+ if($ping) {
125
+ add_settings_error('rfbp', 'rfbp-api-success', __('Your configuration seems to be okay and working! Nice work.', 'recent-facebook-posts'), "updated");
126
+ } else {
127
+ add_settings_error('rfbp', 'rfbp-api-error', __('Facebook returned the following error when testing your configuration.', 'recent-facebook-posts') . '<pre>' . $api->get_error_message() . '</pre>');
128
+ }
129
+ }
130
  }
includes/{RFBP_API.php → class-api.php} RENAMED
@@ -16,8 +16,7 @@ class RFBP_API {
16
  public function get_posts()
17
  {
18
  $result = $this->call("{$this->fb_id}/posts", array(
19
- 'fields' => 'id,picture,type,from,message,status_type,object_id,link,created_time,comments.limit(1).summary(true),likes.limit(1).summary(true)',
20
- 'access_token' => "{$this->app_id}|{$this->app_secret}"
21
  ));
22
 
23
  if($result) {
@@ -32,11 +31,26 @@ class RFBP_API {
32
  return false;
33
  }
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  private function call($endpoint, array $data = array())
36
  {
37
  if(empty($this->app_id) || empty($this->app_secret)) { return false; }
38
 
39
  $url = "https://graph.facebook.com/{$endpoint}";
 
40
 
41
  $url = add_query_arg($data, $url);
42
 
16
  public function get_posts()
17
  {
18
  $result = $this->call("{$this->fb_id}/posts", array(
19
+ 'fields' => 'id,picture,type,from,message,status_type,object_id,picture,name,caption,description,link,created_time,comments.limit(1).summary(true),likes.limit(1).summary(true)'
 
20
  ));
21
 
22
  if($result) {
31
  return false;
32
  }
33
 
34
+ public function ping()
35
+ {
36
+ $result = $this->call("{$this->fb_id}/posts", array('fields' => 'name', 'limit' => 1) );
37
+
38
+ if($result) {
39
+ if(isset($result->data)) {
40
+ return true;
41
+ } else {
42
+ $this->error = $result->error;
43
+ return false;
44
+ }
45
+ }
46
+ }
47
+
48
  private function call($endpoint, array $data = array())
49
  {
50
  if(empty($this->app_id) || empty($this->app_secret)) { return false; }
51
 
52
  $url = "https://graph.facebook.com/{$endpoint}";
53
+ $data['access_token'] = "{$this->app_id}|{$this->app_secret}";
54
 
55
  $url = add_query_arg($data, $url);
56
 
includes/class-public.php ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class RFBP_Public {
4
+
5
+ private static $instance = null;
6
+
7
+ public static function instance()
8
+ {
9
+ if(!self::$instance) {
10
+ self::$instance = new RFBP_Public();
11
+ }
12
+
13
+ return self::$instance;
14
+ }
15
+
16
+ public function __construct() {
17
+
18
+ $opts = rfbp_get_settings();
19
+
20
+ include_once RFBP_PLUGIN_DIR . 'includes/helper-functions.php';
21
+ include_once RFBP_PLUGIN_DIR . 'includes/template-functions.php';
22
+
23
+ add_shortcode( 'recent_facebook_posts', array( $this, 'output' ) );
24
+ add_shortcode( 'recent-facebook-posts', array( $this, 'output' ) );
25
+
26
+ if ( $opts['load_css'] ) {
27
+ add_action( 'wp_enqueue_scripts', array( $this, 'load_css' ) );
28
+ }
29
+
30
+ add_filter( 'rfbp_content', 'wptexturize' ) ;
31
+ add_filter( 'rfbp_content', 'convert_smilies' );
32
+ add_filter( 'rfbp_content', 'convert_chars' );
33
+ add_filter( 'rfbp_content', 'wpautop' );
34
+ }
35
+
36
+ public function load_css() {
37
+ wp_register_style( 'recent-facebook-posts-css', plugins_url( 'recent-facebook-posts/assets/css/default.css' ), array(), RFBP_VERSION );
38
+ wp_enqueue_style( 'recent-facebook-posts-css' );
39
+ }
40
+
41
+ public function get_fallback_posts() {
42
+ $posts = get_transient( 'rfbp_posts_fallback' );
43
+
44
+ if ( !$posts ) {
45
+ return array();
46
+ }
47
+
48
+ return $posts;
49
+ }
50
+
51
+ public function get_posts() {
52
+
53
+ // try to get posts from cache
54
+ if ( ( $posts = get_transient( 'rfbp_posts' ) ) ) {
55
+ return $posts;
56
+ }
57
+
58
+ $opts = rfbp_get_settings();
59
+
60
+ $api = rfbp_get_api();
61
+ $data = $api->get_posts();
62
+
63
+ // did api call succeed?
64
+ if ( !$data ) {
65
+ return $this->get_fallback_posts();
66
+ }
67
+
68
+ $posts = array();
69
+ foreach ( $data as $p ) {
70
+
71
+ // skip this "post" if it is not of one of the following types
72
+ if ( !in_array( $p->type, array( 'status', 'photo', 'video', 'link' ) ) ) {
73
+ continue;
74
+ }
75
+
76
+ // skip empty status updates
77
+ if ($p->type == 'status' && (!isset($p->message) || empty($p->message) ) ) {
78
+ continue;
79
+ }
80
+
81
+ if ($p->type == 'link' && !isset($p->name) && (!isset($p->message) || empty($p->message))) {
82
+ continue;
83
+ }
84
+
85
+ // skip friend approvals
86
+ if ( $p->type == 'status' && $p->status_type == 'approved_friend' ) { continue; }
87
+
88
+
89
+
90
+
91
+ //split user and post ID (userID_postID)
92
+ $idArray = explode( "_", $p->id );
93
+
94
+ $post = array();
95
+ $post['type'] = $p->type;
96
+ $post['content'] = isset( $p->message ) ? utf8_encode( $p->message ) : '';
97
+ $post['image'] = null;
98
+
99
+ // set post content and image
100
+ if ( $p->type == 'photo' ) {
101
+
102
+ $image = "//graph.facebook.com/". $p->object_id . '/picture';
103
+ $post['image'] = $image;
104
+
105
+ } elseif ( $p->type == 'video' ) {
106
+
107
+ $image = $p->picture;
108
+
109
+ // hacky
110
+ if ( $opts['img_size'] == 'normal' ) {
111
+ $image = str_replace( array( "_s.jpg", "_s.png" ), array( "_n.jpg", "_n.png" ), $image );
112
+ }
113
+
114
+ $post['image'] = $image;
115
+
116
+ } elseif ( $p->type == 'link' ) {
117
+ $post['link_image'] = ( isset( $p->picture ) ) ? $p->picture : '';
118
+ $post['link_name'] = ( isset( $p->name ) ) ? $p->name : '';
119
+ $post['link_caption'] = ( isset( $p->caption ) ) ? $p->caption : '';
120
+ $post['link_description'] = ( isset( $p->description ) ) ? $p->description : '';
121
+ $post['link_url'] = $p->link;
122
+ }
123
+
124
+ // calculate post like and comment counts
125
+ if ( isset( $p->likes->summary->total_count ) ) {
126
+ $like_count = $p->likes->summary->total_count;
127
+ } else {
128
+ $like_count = 0;
129
+ }
130
+
131
+ if ( isset( $p->comments->summary->total_count ) ) {
132
+ $comment_count = $p->comments->summary->total_count;
133
+ } else {
134
+ $comment_count = 0;
135
+ }
136
+
137
+ $post['timestamp'] = strtotime( $p->created_time );
138
+ $post['like_count'] = $like_count;
139
+ $post['comment_count'] = $comment_count;
140
+ $post['url'] = "http://www.facebook.com/".$opts['fb_id']."/posts/".$idArray[1];
141
+ $posts[] = $post;
142
+
143
+ }
144
+
145
+ // store results in cache for later use
146
+ if ( $posts ) {
147
+ set_transient( 'rfbp_posts', $posts, apply_filters( 'rfbp_cache_time', 3600 ) ); // user set cache time
148
+ set_transient( 'rfbp_posts_fallback', $posts, 2629744 ); // 1 month
149
+ }
150
+
151
+ return $posts;
152
+ }
153
+
154
+ public function output( $atts = array() ) {
155
+
156
+ $opts = rfbp_get_settings();
157
+ $posts = $this->get_posts();
158
+
159
+ if ( isset( $atts['show_link'] ) ) {
160
+ $atts['show_page_link'] = $atts['show_link'];
161
+ }
162
+
163
+ extract( shortcode_atts( array(
164
+ 'number' => '5',
165
+ 'likes' => 1,
166
+ 'comments' => 1,
167
+ 'excerpt_length' => 140,
168
+ 'el' => 'div',
169
+ 'origin' => 'shortcode',
170
+ 'show_page_link' => false,
171
+ 'show_link_previews' => ( $opts['load_css'] )
172
+ ), $atts ) );
173
+
174
+ ob_start();
175
+ ?>
176
+ <!-- Recent Facebook Posts v<?php echo RFBP_VERSION; ?> - http://wordpress.org/plugins/recent-facebook-posts/ -->
177
+ <div class="recent-facebook-posts rfbp rfbp-container rfbp-<?php echo $origin; ?>">
178
+ <?php
179
+
180
+ if ( $posts && !empty( $posts ) ) {
181
+
182
+ if ( $el == 'li' ) { echo '<ul class="rfbp-posts-wrap">'; }
183
+
184
+ $posts = array_slice( $posts, 0, $number );
185
+ $link_target = ( $opts['link_new_window'] ) ? "_blank" : '';
186
+
187
+ foreach ( $posts as $p ) {
188
+
189
+ $content = $p['content'];
190
+
191
+ $shortened = false;
192
+
193
+ if ( strlen( $content ) > $excerpt_length ) {
194
+ $limit = strpos( $content, ' ', $excerpt_length );
195
+ if ( $limit ) {
196
+ $content = substr( $content, 0, $limit );
197
+ $shortened = true;
198
+ }
199
+ }
200
+ ?>
201
+
202
+ <<?php echo $el; ?> class="rfbp-post">
203
+ <div class="rfbp-text">
204
+
205
+ <?php
206
+ $content = make_clickable( $content, $link_target );
207
+ $content = ( $shortened ) ? $content . apply_filters( 'rfbp_read_more', '..', $p['url'] ) : $content;
208
+ $content = apply_filters( 'rfbp_content', $content, $p['url'] );
209
+
210
+ echo $content; ?>
211
+
212
+ </div>
213
+
214
+ <?php if ( $show_link_previews && isset( $p['link_url'] ) && !empty( $p['link_url'] ) && !empty( $p['link_name'] ) ) { ?>
215
+
216
+ <p class="rfbp-link-wrap">
217
+ <a class="rfbp-link" href="<?php echo $p['link_url']; ?>" rel="external nofollow" target="<?php echo $link_target; ?>">
218
+ <?php if ( !empty( $p['link_image'] ) && ( apply_filters( 'rfbp_show_link_images', true ) !== false ) ) { ?>
219
+ <span class="rfbp-link-image-wrap">
220
+ <img class="rfbp-link-image" src="<?php echo esc_attr( $p['link_image'] ); ?>" width="114" />
221
+ </span>
222
+ <?php } ?>
223
+
224
+ <span class="rfbp-link-text-wrap">
225
+ <span class="rfbp-link-name"><?php echo $p['link_name']; ?></span>
226
+ <?php if ( isset( $p['link_caption'] ) ) { ?><span class="rfbp-link-caption"><?php echo $p['link_caption']; ?></span><?php } ?>
227
+ <?php if ( isset( $p['link_description'] ) && !empty( $p['link_description'] ) ) { ?><span class="rfbp-link-description"><?php echo $p['link_description']; ?></span><?php } ?>
228
+ </span>
229
+ </a>
230
+ </p>
231
+
232
+ <?php } ?>
233
+
234
+ <?php if ( $opts['img_size'] != 'dont_show' && isset( $p['image'] ) && !empty( $p['image'] ) ) { ?>
235
+ <p class="rfbp-image-wrap">
236
+ <a class="rfbp-image-link" target="<?php echo $link_target; ?>" href="<?php echo $p['url']; ?>" rel="external nofollow">
237
+ <?php $max_img_width = ( !empty( $opts['img_width'] ) ) ? $opts['img_width'].'px' : '100%'; $max_img_height = ( !empty( $opts['img_height'] ) ) ? $opts['img_height'].'px' : 'none'; ?>
238
+ <img class="rfbp-image" src="<?php echo esc_attr($p['image'] . '?type=' . $opts['img_size']); ?>" style="max-width: <?php echo $max_img_width; ?>; max-height: <?php echo $max_img_height; ?>" alt="" />
239
+ </a>
240
+ </p>
241
+ <?php } ?>
242
+ <p class="rfbp-post-link-wrap">
243
+ <a target="<?php echo $link_target; ?>" class="rfbp-post-link" href="<?php echo $p['url']; ?>" rel="external nofolloW">
244
+ <?php if ( $likes ) { ?><span class="rfbp-like-count"><?php echo $p['like_count']; ?> <span><?php _e( "likes", 'recent-facebook-posts' ); ?><?php if ( $comments ) { ?>, <?php } ?></span></span><?php } ?>
245
+ <?php if ( $comments ) { ?><span class="rfbp-comment-count"><?php echo $p['comment_count']; ?> <span><?php _e( "comments", 'recent-facebook-posts' ); ?></span></span><?php } ?>
246
+ <?php if ( $likes || $comments ) { ?> &sdot; <?php } ?>
247
+ <span class="rfbp-timestamp" title="<?php printf( __( '%1$s at %2$s', 'recent-facebook-posts' ), date( 'l, F j, Y', $p['timestamp'] ), date( 'G:i', $p['timestamp'] ) ); ?>"><?php echo rfbp_time_ago( $p['timestamp'] ); ?></span>
248
+ </a>
249
+ </p>
250
+ </<?php echo $el; ?>>
251
+ <?php
252
+
253
+ } // end foreach $posts
254
+
255
+ if ( $el == 'li' ) { echo '</ul>'; }
256
+
257
+ } else {
258
+ ?><p><?php _e( "No recent Facebook posts to show", 'recent-facebook-posts' ); ?></p><?php
259
+ if ( current_user_can( 'manage_options' ) ) {
260
+ ?><p><strong><?php _e( "Admins only notice", 'recent-facebook-posts' ); ?>:</strong> Did you <a href="<?php echo admin_url( 'options-general.php?page=rfbp' ); ?>">configure the plugin</a> properly?</p><?php
261
+ }
262
+ } ?>
263
+
264
+ <?php if ( $show_page_link ) { ?>
265
+ <p class="rfbp-page-link-wrap"><a class="rfbp-page-link" href="http://www.facebook.com/<?php echo $opts['fb_id']; ?>/" rel="external nofollow" target="<?php echo $link_target; ?>"><?php echo $opts['page_link_text']; ?></a></p>
266
+ <?php } ?>
267
+
268
+ </div>
269
+ <!-- / Recent Facebook Posts -->
270
+ <?php
271
+ $output = ob_get_contents();
272
+ ob_end_clean();
273
+
274
+ return $output;
275
+ }
276
+
277
+ }
includes/class-widget.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class RFBP_Widget extends WP_Widget {
4
+
5
+ private $defaults;
6
+
7
+ public function __construct() {
8
+ parent::__construct(
9
+ 'rfb_widget',
10
+ 'Recent Facebook Posts',
11
+ array( 'description' => __( 'Lists a number of your most recent Facebook posts.', 'recent-facebook-posts' ) )
12
+ );
13
+
14
+ $this->defaults = array(
15
+ 'title' => __( 'Recent Facebook Posts', 'recent-facebook-posts' ),
16
+ 'number_of_posts' => 5,
17
+ 'excerpt_length' => 140,
18
+ 'show_comment_count' => true,
19
+ 'show_like_count' => true,
20
+ 'show_page_link' => true,
21
+ 'show_link_previews' => false
22
+ );
23
+ }
24
+
25
+ public function form( $instance ) {
26
+
27
+ $instance = array_merge( $this->defaults, $instance );
28
+ extract( $instance );
29
+
30
+ $opts = rfbp_get_settings();
31
+
32
+ if ( empty( $opts['app_id'] ) ) { ?>
33
+ <p style="color:red;">You need to <a href="<?php echo admin_url( 'options-general.php?page=rfbp' ); ?>">configure Recent Facebook Posts</a> first.</p>
34
+ <?php } ?>
35
+
36
+ <p>
37
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'recent-facebook-posts' ); ?></label>
38
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
39
+ </p>
40
+
41
+ <p>
42
+ <label for="<?php echo $this->get_field_id( 'number_of_posts' ); ?>"><?php _e( 'Number of posts:', 'recent-facebook-posts' ); ?></label>
43
+ <input class="widefat" id="<?php echo $this->get_field_id( 'number_of_posts' ); ?>" name="<?php echo $this->get_field_name( 'number_of_posts' ); ?>" type="number" min="1" max="99" value="<?php echo esc_attr( $number_of_posts ); ?>" />
44
+ </p>
45
+
46
+ <p>
47
+ <label for="<?php echo $this->get_field_id( 'excerpt_length' ); ?>"><?php _e( 'Excerpt length:', 'recent-facebook-posts' ); ?></label>
48
+ <input class="widefat" id="<?php echo $this->get_field_id( 'excerpt_length' ); ?>" name="<?php echo $this->get_field_name( 'excerpt_length' ); ?>" type="number" min="1" max="9999"value="<?php echo esc_attr( $excerpt_length ); ?>" />
49
+ </p>
50
+
51
+ <p>
52
+ <input type="checkbox" id="<?php echo $this->get_field_id( 'show_like_count' ); ?>" name="<?php echo $this->get_field_name( 'show_like_count' ); ?>" value="1" <?php checked( $show_like_count, 1 ); ?> />
53
+ <label for="<?php echo $this->get_field_id( 'show_like_count' ); ?>"><?php _e( 'Show like count?', 'recent-facebook-posts' ); ?></label>
54
+ </p>
55
+
56
+ <p>
57
+ <input type="checkbox" id="<?php echo $this->get_field_id( 'show_comment_count' ); ?>" name="<?php echo $this->get_field_name( 'show_comment_count' ); ?>" value="1" <?php checked( $show_comment_count, 1 ); ?> />
58
+ <label for="<?php echo $this->get_field_id( 'show_comment_count' ); ?>"><?php _e( 'Show comment count?', 'recent-facebook-posts' ); ?></label>
59
+ </p>
60
+
61
+ <p>
62
+ <input type="checkbox" id="<?php echo $this->get_field_id( 'show_page_link' ); ?>" name="<?php echo $this->get_field_name( 'show_page_link' ); ?>" value="1" <?php if ( $show_page_link ) { ?>checked="1"<?php } ?> />
63
+ <label for="<?php echo $this->get_field_id( 'show_page_link' ); ?>"><?php _e( 'Show link to Facebook page?', 'recent-facebook-posts' ); ?></label>
64
+ </p>
65
+
66
+ <p>
67
+ <input type="checkbox" id="<?php echo $this->get_field_id( 'show_link_previews' ); ?>" name="<?php echo $this->get_field_name( 'show_link_previews' ); ?>" value="1" <?php if ( $show_link_previews ) { ?>checked="1"<?php } ?> />
68
+ <label for="<?php echo $this->get_field_id( 'show_link_previews' ); ?>"><?php _e( 'Show link previews?', 'recent-facebook-posts' ); ?></label>
69
+ </p>
70
+
71
+ <?php
72
+ }
73
+
74
+ public function update( $new_instance, $old_instance ) {
75
+ $instance = array();
76
+ $instance['title'] = strip_tags( $new_instance['title'] );
77
+ $instance['number_of_posts'] = (int) strip_tags( $new_instance['number_of_posts'] );
78
+ $instance['excerpt_length'] = (int) strip_tags( $new_instance['excerpt_length'] );
79
+ $instance['show_like_count'] = isset( $new_instance['show_like_count'] );
80
+ $instance['show_comment_count'] = isset( $new_instance['show_comment_count'] );
81
+ $instance['show_page_link'] = isset( $new_instance['show_page_link'] );
82
+ $instance['show_link_previews'] = isset( $new_instance['show_link_previews'] );
83
+ return $instance;
84
+ }
85
+
86
+ public function widget( $args, $instance = array() ) {
87
+
88
+ $instance = array_merge( $this->defaults, $instance );
89
+
90
+ extract( $instance );
91
+ extract( $args );
92
+
93
+ $title = apply_filters( 'widget_title', $instance['title'] );
94
+
95
+ echo $before_widget;
96
+
97
+ if ( ! empty( $title ) ) {
98
+ echo $before_title . $title . $after_title;
99
+ }
100
+
101
+ recent_facebook_posts( array(
102
+ 'origin' => 'widget',
103
+ 'number' => $number_of_posts,
104
+ 'likes' => $show_like_count,
105
+ 'comments' => $show_comment_count,
106
+ 'excerpt_length' => $excerpt_length,
107
+ 'el' => apply_filters( 'rfbp_widget_element', 'div' ),
108
+ 'show_page_link' => $show_page_link,
109
+ 'show_link_previews' => $show_link_previews
110
+ ) );
111
+
112
+
113
+ echo $after_widget;
114
+ }
115
+
116
+
117
+
118
+ }
includes/helper-functions.php CHANGED
@@ -16,7 +16,7 @@ function rfbp_time_ago($timestamp)
16
  $diff = time() - (int) $timestamp;
17
 
18
  if ($diff == 0)
19
- return 'just now';
20
 
21
  $intervals = array
22
  (
@@ -30,5 +30,42 @@ function rfbp_time_ago($timestamp)
30
  );
31
 
32
  $value = floor($diff / $intervals[1][1]);
33
- return $value.' '. $intervals[1][0] . ($value > 1 ? 's' : '').' ago';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  }
16
  $diff = time() - (int) $timestamp;
17
 
18
  if ($diff == 0)
19
+ return __('just now', "recent-facebook-posts");
20
 
21
  $intervals = array
22
  (
30
  );
31
 
32
  $value = floor($diff / $intervals[1][1]);
33
+
34
+ $time_unit = $intervals[1][0];
35
+
36
+ switch($time_unit) {
37
+ case 'year':
38
+ return sprintf(_n('1 year ago', '%d years ago', $value, "recent-facebook-posts"), $value);
39
+ break;
40
+
41
+ case 'month':
42
+ return sprintf(_n('1 month ago', '%d months ago', $value, "recent-facebook-posts"), $value);
43
+ break;
44
+
45
+ case 'week':
46
+ return sprintf(_n('1 week ago', '%d weeks ago', $value, "recent-facebook-posts"), $value);
47
+ break;
48
+
49
+ case 'day':
50
+ return sprintf(_n('1 day ago', '%d days ago', $value, "recent-facebook-posts"), $value);
51
+ break;
52
+
53
+ case 'hour':
54
+ return sprintf(_n('1 hour ago', '%d hours ago', $value, "recent-facebook-posts"), $value);
55
+ break;
56
+
57
+ case 'minute':
58
+ return sprintf(_n('1 minute ago', '%d minutes ago', $value, "recent-facebook-posts"), $value);
59
+ break;
60
+
61
+ case 'second':
62
+ return sprintf(_n('1 second ago', '%d seconds ago', $value, "recent-facebook-posts"), $value);
63
+ break;
64
+
65
+ default:
66
+ return sprintf(__('Some time ago', "recent-facebook-posts"));
67
+ break;
68
+ }
69
+
70
+
71
  }
includes/index.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ // empty index.php to prevent directory listing
includes/plugin.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function rfbp_get_settings() {
4
+ static $settings;
5
+
6
+ if ( !$settings ) {
7
+
8
+ $defaults = array(
9
+ 'app_id' => '',
10
+ 'app_secret' => '',
11
+ 'fb_id' => '',
12
+ 'load_css' => 1,
13
+ 'page_link_text' => 'Find us on Facebook',
14
+ 'link_new_window' => 0,
15
+ 'img_size' => 'normal',
16
+ 'img_width' => '',
17
+ 'img_height' => ''
18
+ );
19
+
20
+ // get user options
21
+ $options = get_option( 'rfb_settings' );
22
+
23
+ // options did not exist yet, add option to database
24
+ if ( !$options ) { add_option( 'rfb_settings', $defaults ); }
25
+
26
+ $settings = array_merge( $defaults, (array) $options );
27
+ }
28
+
29
+ return $settings;
30
+ }
31
+
32
+ function rfbp_register_widget() {
33
+ include_once RFBP_PLUGIN_DIR . 'includes/class-widget.php';
34
+ register_widget( "RFBP_Widget" );
35
+ }
36
+
37
+ add_action('widgets_init', 'rfbp_register_widget');
38
+
39
+ function rfbp_load_textdomain() {
40
+ load_plugin_textdomain( 'recent-facebook-posts', false, 'recent-facebook-posts/languages/' );
41
+ }
42
+
43
+ add_action('plugins_loaded', 'rfbp_load_textdomain');
44
+
45
+ function rfbp_get_class() {
46
+ static $class;
47
+
48
+ if(!$class) {
49
+ require_once RFBP_PLUGIN_DIR . 'includes/class-public.php';
50
+ $class = new RFBP_Public();
51
+ }
52
+
53
+ return $class;
54
+ }
55
+
56
+ function rfbp_get_api() {
57
+ static $api;
58
+
59
+ if(!$api) {
60
+ $opts = rfbp_get_settings();
61
+ require_once RFBP_PLUGIN_DIR . 'includes/class-api.php';
62
+ $api = new RFBP_API( $opts['app_id'], $opts['app_secret'], $opts['fb_id'] );
63
+ }
64
+
65
+ return $api;
66
+ }
67
+
68
+ function rfbp_valid_config() {
69
+ $opts = rfbp_get_settings();
70
+
71
+ return (!empty($opts['fb_id']) && !empty($opts['app_id']) && !empty($opts['app_secret']) );
72
+ }
includes/template-functions.php CHANGED
@@ -2,5 +2,6 @@
2
 
3
  function recent_facebook_posts($args = array())
4
  {
5
- echo RFBP::instance()->output($args);
 
6
  }
2
 
3
  function recent_facebook_posts($args = array())
4
  {
5
+ $rfbp = rfbp_get_class();
6
+ echo $rfbp->output($args);
7
  }
includes/views/index.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ // empty index.php to prevent directory listing
includes/views/settings_page.html.php CHANGED
@@ -1,130 +1,143 @@
 
1
  <div id="rfbp-options" class="wrap">
 
 
2
 
3
- <div class="rfbp-column" style="width:69%;">
4
 
5
- <h2>Recent Facebook Posts</h2>
6
-
7
- <?php if($api->has_error()) { ?>
8
- <div id="setting-error-settings_updated" class="settings-error error">
9
- <p>
10
- <strong>Error:</strong> <?php echo $api->get_error_message(); ?>
11
- </p>
12
- </div>
13
- <?php }
14
-
15
- if(isset($notice)) { ?>
16
  <div id="setting-error-settings_updated" class="updated settings-error">
17
  <p>
18
  <?php echo $notice; ?>
19
  </p>
20
  </div>
21
- <?php
22
- }
23
- ?>
24
 
25
- <h3>Configuration</h3>
26
  <form method="post" action="options.php">
27
- <?php settings_fields( 'rfb_settings_group' ); ?>
28
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  <table class="form-table">
30
- <tbody>
31
- <tr valign="top" <?php if(empty($opts['app_id'])) echo 'class="rfbp-row-error"'; ?>>
32
- <th scope="row"><label for="rfb_app_id">Facebook App ID/API Key</label></th>
33
- <td>
34
- <input type="text" class="widefat" placeholder="Eg: 123456789012345" id="rfb_app_id" name="rfb_settings[app_id]" value="<?php echo esc_attr($opts['app_id']); ?>" required />
35
- <small class="help"><a href="https://developers.facebook.com/apps">get from developers.facebook.com/apps</a></small>
36
- </td>
37
- </tr>
38
-
39
- <tr valign="top" <?php if(empty($opts['app_secret'])) echo 'class="rfbp-row-error"'; ?>>
40
- <th scope="row"><label for="rfb_app_secret">Facebook App Secret</label></th>
41
- <td>
42
- <input type="text" class="widefat" placeholder="Eg: 16vgrz4hk45wvh29k2puk45wvk2h29pu" id="rfb_app_secret" name="rfb_settings[app_secret]" value="<?php echo esc_attr($opts['app_secret']); ?>" required />
43
- <small class="help"><a href="https://developers.facebook.com/apps">get from developers.facebook.com/apps</a></small>
44
- </td>
45
- </tr>
46
-
47
- <tr valign="top" <?php if(empty($opts['fb_id'])) echo 'class="rfbp-row-error"'; ?>>
48
- <th scope="row"><label for="rfb_fb_id">Facebook Page ID or Slug</label></th>
49
- <td>
50
- <input type="text" class="widefat" placeholder="Eg: DannyvanKootenCOM" id="rfb_fb_id" name="rfb_settings[fb_id]" value="<?php echo esc_attr($opts['fb_id']); ?>" required />
51
- <small><a target="_blank" href="http://findmyfacebookid.com/">Use this tool to find the numeric ID of the Facebook page you want to fetch posts from</a></small>
52
- </td>
53
- </tr>
54
-
55
- <tr valign="top">
56
- <th scope="row"><label for="rfb_cache_time">Cache expiry time <small>(in seconds)</small></label></th>
57
- <td><input type="number" min="60" max="99999999999" id="rfb_cache_time" name="rfb_settings[cache_time]" value="<?php echo esc_attr($opts['cache_time']); ?>" required /></td>
58
- </tr>
59
-
60
- <tr valign="top">
61
- <th scope="row"><label for="rfb_img_size">Image size</label></th>
62
- <td>
63
- <select class="widefat" id="rfb_img_size" name="rfb_settings[img_size]">
64
- <option value="dont_show" <?php if($opts['img_size'] == 'dont_show') { echo 'selected'; } ?>>Don't show images</option>
65
- <option value="thumbnail" <?php if($opts['img_size'] == 'thumbnail') { echo 'selected'; } ?>>Thumbnail</option>
66
- <option value="normal" <?php if($opts['img_size'] == 'normal') { echo 'selected'; } ?>>Normal</option>
67
- </select>
68
- </tr>
69
- </tbody>
70
- <tbody id="rfb_img_options" <?php if($opts['img_size'] == 'dont_show') echo 'style="display:none;"'; ?>>
71
- <tr valign="top">
72
- <th>Image dimensions<br /><small>(in pixels)</small></th>
73
- <td>
74
- <label style="float:left; margin-right:20px; ">
75
- Max Width<br />
76
- <input type="number" min="0" max="1600" size="3" id="rfb_img_width" name="rfb_settings[img_width]" value="<?php echo esc_attr($opts['img_width']); ?>" />
77
- </label>
78
- <label style="float:left; margin-right:20px;">
79
- Max Height<br />
80
- <input type="number" min="0" max="1600" size="3" id="rfb_img_height" name="rfb_settings[img_height]" value="<?php echo esc_attr($opts['img_height']); ?>" />
81
- </label>
82
- <small class="help"><br />Leave empty for default sizing (maximum of 100% of containing element)</small>
83
- </td>
84
- </tr>
85
- </tbody>
86
- <tbody>
87
- <tr valign="top">
88
- <th scope="row"><label for="rfb_link_text">Link text</label></th>
89
- <td><input type="text" class="widefat" placeholder="Find us on Facebook" id="rfb_link_text" name="rfb_settings[link_text]" value="<?php echo esc_attr($opts['link_text']); ?>" /></td>
90
- </tr>
91
-
92
- <tr valign="top">
93
- <th scope="row"><label for="rfb_link_new_window">Open links in new window?</label></th>
94
- <td><input type="checkbox" id="rfb_link_new_window" name="rfb_settings[link_new_window]" value="1" <?php checked($opts['link_new_window'], 1); ?> /></td>
95
- </tr>
96
-
97
- <tr valign="top">
98
- <th scope="row"><label for="rfb_load_css">Load some default CSS?</label></th>
99
- <td><input type="checkbox" id="rfb_load_css" name="rfb_settings[load_css]" value="1" <?php checked($opts['load_css'], 1); ?> /></td>
100
- </tr>
101
- </tbody>
102
  </table>
 
103
 
104
- <p class="submit">
105
- <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
106
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
  </form>
109
 
110
- <?php if($ready) { ?>
111
- <h3>Faceook Posts Cache</h3>
112
- <p>Because fetching posts from Facebook is slow the posts are cached for <strong><?php echo $opts['cache_time']; ?> seconds</strong> (as configured above). You can manually renew the cache or test your configuration using the button below.</p>
113
- <p>
114
- <form action="<?php echo admin_url('options-general.php?page=rfbp'); ?>" method="post">
115
- <input type="hidden" name="renew_cache" value="1" />
116
- <input type="submit" class="button-primary" value="Renew Facebook Posts" />
117
- </form>
118
- </p>
119
- <?php } ?>
 
 
 
 
 
120
  </div>
121
 
122
- <div class="rfbp-sidebar clearfix">
123
-
124
- <div class="rfbp-box rfbp-well">
125
- <h3>Donate $10, $20 or $50</h3>
126
- <p>I spent countless hours developing this plugin, offering support, chasing bugs, etc. If you like it, consider showing me a token of your appreciation.</p>
127
-
 
128
  <div class="rfbp-donate">
129
  <form class="donate" action="https://www.paypal.com/cgi-bin/webscr" method="post">
130
  <input type="hidden" name="cmd" value="_donations">
@@ -134,40 +147,46 @@
134
  <input type="hidden" name="item_number" value="Recent Facebook Posts">
135
  <input type="hidden" name="currency_code" value="USD">
136
  <input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHosted">
137
- <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
138
  <img alt="" border="0" src="https://www.paypalobjects.com/nl_NL/i/scr/pixel.gif" width="1" height="1">
139
  </form>
140
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
 
142
- <p>Alternatively, you can: </p>
143
- <ul class="ul-square">
144
- <li><a href="http://wordpress.org/support/view/plugin-reviews/recent-facebook-posts?rate=5#postform" target="_blank">Give a &#9733;&#9733;&#9733;&#9733;&#9733; rating on WordPress.org</a></li>
145
- <li><a href="http://dannyvankooten.com/wordpress-plugins/recent-facebook-posts/" target="_blank">Blog about it and link to the plugin page</a></li>
146
- <li><a href="http://twitter.com/?status=I%20show%20recent%20facebook%20posts%20on%20my%20%23WordPress%20site%20using%20Recent%20Facebook%20Posts%20by%20%40DannyvanKooten%20-%20love%20it!%20http%3A%2F%2Fwordpress.org%2Fplugins%2Frecent-facebook-posts%2F" target="_blank">Tweet about Recent Facebook Posts</a></li>
147
- <li><a href="http://wordpress.org/plugins/recent-facebook-posts/#compatibility">Vote "works" on the WordPress.org plugin page</a></li>
148
- </ul>
149
- </div>
150
-
151
- <div class="rfbp-box">
152
- <h3>Looking for support?</h3>
153
- <p>Having trouble? Please use the <a href="http://wordpress.org/support/plugin/recent-facebook-posts">support forums</a> on WordPress.org.</p>
154
- <p>Take a close look at the <a href="http://wordpress.org/plugins/recent-facebook-posts/installation/">installation instructions</a> for help configuring the plugin and registering your own Facebook application (required).</p>
155
- </div>
156
-
157
- <div class="rfbp-box">
158
- <h3>Other Useful plugins</h3>
159
- <ul class="ul-square">
160
- <li><a href="http://wordpress.org/plugins/mailchimp-for-wp/">MailChimp for WordPress</a></li>
161
- <li><a href="http://wordpress.org/plugins/wysiwyg-widgets/">WYSIWYG Widgets</a>
162
- <li><a href="http://wordpress.org/plugins/newsletter-sign-up/">Newsletter Sign-Up</a></li>
163
- </ul>
164
- </div>
165
-
166
- <div class="rfbp-box">
167
- <h3>About the developer</h3>
168
- <p>I am <a href="http://dannyvankooten.com/">Danny</a>, a young Dutch Computer Science student. I seriously enjoy coding, eating, sleeping, playing (sports) and happy clients.</p>
169
- <p>I developed a few <a href="http://dannyvankooten.com/wordpress-plugins/">other WordPress plugins</a>, have a look.</p>
170
- <p><em>PS: Donations are much appreciated!</em></p>
171
- </div>
172
  </div>
173
- </div>
 
1
+ <?php defined("ABSPATH") or exit; ?>
2
  <div id="rfbp-options" class="wrap">
3
+ <div class="rfbp-container">
4
+ <div class="rfbp-column rfbp-primary">
5
 
6
+ <h2>Recent Facebook Posts</h2>
7
 
8
+ <?php if(isset($notice)) { ?>