Custom Facebook Feed - Version 1.3.4

Version Description

  • New: Email addresses within the post text are now hyperlinked
  • Fix: Links beginning with 'www' are now also hyperlinked
Download this release

Release Info

Developer smashballoon
Plugin Icon 128x128 Custom Facebook Feed
Version 1.3.4
Comparing to
See all releases

Code changes from version 1.3.3 to 1.3.4

README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: smashballoon
3
  Tags: facebook, custom, customizable, feed, seo, search engine, responsive, mobile, shortcode, social, status
4
  Requires at least: 3.0
5
  Tested up to: 3.5.1
6
- Stable tag: 1.3.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -74,6 +74,10 @@ It sure is. Unlike other Facebook plugins which use iframes to embed your feed i
74
 
75
  == Changelog ==
76
 
 
 
 
 
77
  = 1.3.3 =
78
  * New: Added support for events - display the event details (name, location, date/time, description) directly in the feed
79
  * Fix: Links within the post text are now hyperlinked
3
  Tags: facebook, custom, customizable, feed, seo, search engine, responsive, mobile, shortcode, social, status
4
  Requires at least: 3.0
5
  Tested up to: 3.5.1
6
+ Stable tag: 1.3.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
74
 
75
  == Changelog ==
76
 
77
+ = 1.3.4 =
78
+ * New: Email addresses within the post text are now hyperlinked
79
+ * Fix: Links beginning with 'www' are now also hyperlinked
80
+
81
  = 1.3.3 =
82
  * New: Added support for events - display the event details (name, location, date/time, description) directly in the feed
83
  * Fix: Links within the post text are now hyperlinked
custom-facebook-feed-admin.php CHANGED
@@ -162,7 +162,7 @@ function cff_settings_page() {
162
  <br /><br /><a href="http://smashballoon.com/custom-facebook-feed/" target="_blank">Plugin Support</a> - Smash Balloon is committed to making this plugin better. Please let us know if you have had any issues when using this plugin so that we can continue to make it better!
163
 
164
  <br /><br /><br />
165
- <a href="http://smashballoon.com/custom-facebook-feed/troubleshooting" target="_blank"><img src="<?php echo plugins_url( 'img/pro.jpg' , __FILE__ ) ?>" /></a>
166
 
167
  <?php
168
  } //End Settings_Page
162
  <br /><br /><a href="http://smashballoon.com/custom-facebook-feed/" target="_blank">Plugin Support</a> - Smash Balloon is committed to making this plugin better. Please let us know if you have had any issues when using this plugin so that we can continue to make it better!
163
 
164
  <br /><br /><br />
165
+ <a href="http://smashballoon.com/custom-facebook-feed/demo" target="_blank"><img src="<?php echo plugins_url( 'img/pro.jpg' , __FILE__ ) ?>" /></a>
166
 
167
  <?php
168
  } //End Settings_Page
custom-facebook-feed.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Custom Facebook Feed
4
  Plugin URI: http://smashballoon.com/custom-facebook-feed
5
  Description: Add a completely customizable Facebook feed to your WordPress site
6
- Version: 1.3.3
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
@@ -131,28 +131,26 @@ function display_cff($atts) {
131
  if (isset($title_limit) && $title_limit !== '') {
132
  if (strlen($story_text) > $title_limit) $story_text = substr($story_text, 0, $title_limit) . '...';
133
  }
134
- $story_text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\" target='_blank'>\\0</a>", $story_text);
135
- $content .= '<h4>' . $story_text . '</h4>';
136
  }
137
  if (!empty($news->message)) {
138
  $message_text = $news->message;
139
  if (isset($title_limit) && $title_limit !== '') {
140
  if (strlen($message_text) > $title_limit) $message_text = substr($message_text, 0, $title_limit) . '...';
141
  }
142
- $message_text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\" target='_blank'>\\0</a>", $message_text);
143
- $content .= '<h4>' . $message_text . '</h4>';
144
  }
145
  if (!empty($news->description)) {
146
  $description_text = $news->description;
147
  if (isset($body_limit) && $body_limit !== '') {
148
  if (strlen($description_text) > $body_limit) $description_text = substr($description_text, 0, $body_limit) . '...';
149
  }
150
- $content .= '<p>' . $description_text . '</p>';
151
  }
152
 
153
 
154
  //Posted on
155
- $content .= '<p class="cff-date">Posted '. timeSince(strtotime($news->created_time)) . ' ago</p>';
156
 
157
 
158
  //Check whether it's a shared link
@@ -183,7 +181,7 @@ function display_cff($atts) {
183
  if (isset($body_limit) && $body_limit !== '') {
184
  if (strlen($description) > $body_limit) $description = substr($description, 0, $body_limit) . '...';
185
  }
186
- $content .= '<p>' . $description . '</p>';
187
  }
188
 
189
  $content .= '</div><!-- end .details -->';
@@ -226,11 +224,55 @@ function display_cff($atts) {
226
 
227
 
228
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
 
230
 
231
  //Time stamp function
232
 
233
- function timeSince($original) {
234
 
235
  // Array of time period
236
  $chunks = array(
3
  Plugin Name: Custom Facebook Feed
4
  Plugin URI: http://smashballoon.com/custom-facebook-feed
5
  Description: Add a completely customizable Facebook feed to your WordPress site
6
+ Version: 1.3.4
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
131
  if (isset($title_limit) && $title_limit !== '') {
132
  if (strlen($story_text) > $title_limit) $story_text = substr($story_text, 0, $title_limit) . '...';
133
  }
134
+ $content .= '<h4>' . cff_make_clickable($story_text) . '</h4>';
 
135
  }
136
  if (!empty($news->message)) {
137
  $message_text = $news->message;
138
  if (isset($title_limit) && $title_limit !== '') {
139
  if (strlen($message_text) > $title_limit) $message_text = substr($message_text, 0, $title_limit) . '...';
140
  }
141
+ $content .= '<h4>' . cff_make_clickable($message_text) . '</h4>';
 
142
  }
143
  if (!empty($news->description)) {
144
  $description_text = $news->description;
145
  if (isset($body_limit) && $body_limit !== '') {
146
  if (strlen($description_text) > $body_limit) $description_text = substr($description_text, 0, $body_limit) . '...';
147
  }
148
+ $content .= '<p>' . cff_make_clickable($description_text) . '</p>';
149
  }
150
 
151
 
152
  //Posted on
153
+ $content .= '<p class="cff-date">Posted '. cff_timeSince(strtotime($news->created_time)) . ' ago</p>';
154
 
155
 
156
  //Check whether it's a shared link
181
  if (isset($body_limit) && $body_limit !== '') {
182
  if (strlen($description) > $body_limit) $description = substr($description, 0, $body_limit) . '...';
183
  }
184
+ $content .= '<p>' . cff_make_clickable($description) . '</p>';
185
  }
186
 
187
  $content .= '</div><!-- end .details -->';
224
 
225
 
226
 
227
+ //Make links in text clickable
228
+ function cff_make_url_clickable($matches) {
229
+ $ret = '';
230
+ $url = $matches[2];
231
+
232
+ if ( empty($url) )
233
+ return $matches[0];
234
+ // removed trailing [.,;:] from URL
235
+ if ( in_array(substr($url, -1), array('.', ',', ';', ':')) === true ) {
236
+ $ret = substr($url, -1);
237
+ $url = substr($url, 0, strlen($url)-1);
238
+ }
239
+ return $matches[1] . "<a href=\"$url\" rel=\"nofollow\" target='_blank'>$url</a>" . $ret;
240
+ }
241
+ function cff_make_web_ftp_clickable($matches) {
242
+ $ret = '';
243
+ $dest = $matches[2];
244
+ $dest = 'http://' . $dest;
245
+
246
+ if ( empty($dest) )
247
+ return $matches[0];
248
+ // removed trailing [,;:] from URL
249
+ if ( in_array(substr($dest, -1), array('.', ',', ';', ':')) === true ) {
250
+ $ret = substr($dest, -1);
251
+ $dest = substr($dest, 0, strlen($dest)-1);
252
+ }
253
+ return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\" target='_blank'>$dest</a>" . $ret;
254
+ }
255
+ function cff_make_email_clickable($matches) {
256
+ $email = $matches[2] . '@' . $matches[3];
257
+ return $matches[1] . "<a href=\"mailto:$email\">$email</a>";
258
+ }
259
+ function cff_make_clickable($ret) {
260
+ $ret = ' ' . $ret;
261
+ // in testing, using arrays here was found to be faster
262
+ $ret = preg_replace_callback('#([\s>])([\w]+?://[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]*)#is', 'cff_make_url_clickable', $ret);
263
+ $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]*)#is', 'cff_make_web_ftp_clickable', $ret);
264
+ $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', 'cff_make_email_clickable', $ret);
265
+
266
+ // this one is not in an array because we need it to run last, for cleanup of accidental links within links
267
+ $ret = preg_replace("#(<a( [^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i", "$1$3</a>", $ret);
268
+ $ret = trim($ret);
269
+ return $ret;
270
+ }
271
 
272
 
273
  //Time stamp function
274
 
275
+ function cff_timeSince($original) {
276
 
277
  // Array of time period
278
  $chunks = array(
img/pro.jpg CHANGED
Binary file