Custom Facebook Feed - Version 1.8.2

Version Description

  • New: Now supports Facebook tags - creates links when using the @ symbol to tag other people or Facebook pages in your posts
  • Tweak: Changed the method used for link replacement in posts
Download this release

Release Info

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

Code changes from version 1.8.1 to 1.8.2

Files changed (3) hide show
  1. README.txt +148 -2
  2. custom-facebook-feed-admin.php +13 -0
  3. custom-facebook-feed.php +96 -105
README.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Custom Facebook Feed ===
2
  Contributors: smashballoon
3
- Tags: Facebook, Facebook feed, Facebook posts, Facebook wall, Facebook events, Facebook page, Facebook group, custom, customizable, seo, responsive, mobile, social
4
  Requires at least: 3.0
5
  Tested up to: 3.8.1
6
- Stable tag: 1.8.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H5XFD33R3FHMG
@@ -117,6 +117,148 @@ It sure is. Unlike other Facebook plugins which use iframes to embed your Facebo
117
 
118
  You can embed your Facebook feed directly into a template file by using the WordPress [do_shortcode](http://codex.wordpress.org/Function_Reference/do_shortcode "WordPress.org do_shortcode reference") function: `<?php echo do_shortcode('[custom-facebook-feed]'); ?>`.
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  == Screenshots ==
121
 
122
  1. By default the Facebook feed inherits your theme's default styles and is completely responsive
@@ -131,6 +273,10 @@ You can embed your Facebook feed directly into a template file by using the Word
131
 
132
  == Changelog ==
133
 
 
 
 
 
134
  = 1.8.1 =
135
  * New: Added an 'exclude' shortcode option to allow you to easily exclude specific parts of the post
136
  * New: Timeline events are now cached to help reduce page load time
1
  === Custom Facebook Feed ===
2
  Contributors: smashballoon
3
+ Tags: Facebook, Facebook feed, Facebook posts, Facebook wall, Facebook events, Facebook page, Facebook group, Facebook Like box, Customizable Facebook Feed, custom, customizable, seo, responsive, mobile, social
4
  Requires at least: 3.0
5
  Tested up to: 3.8.1
6
+ Stable tag: 1.8.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H5XFD33R3FHMG
117
 
118
  You can embed your Facebook feed directly into a template file by using the WordPress [do_shortcode](http://codex.wordpress.org/Function_Reference/do_shortcode "WordPress.org do_shortcode reference") function: `<?php echo do_shortcode('[custom-facebook-feed]'); ?>`.
119
 
120
+ == Other Notes ==
121
+
122
+ **"The best dang Facebook plugin this side of the Mississippi!"**
123
+
124
+ = At Smash Balloon we have two goals: =
125
+
126
+ 1. Creating and maintaining the most useful, functional, customizable, robust and down-right awesomist Facebook feed plugin your website has ever seen.
127
+ 2. To provide the quickest, friendliest and most mind-blowingly amazing product support you have ever experienced.
128
+
129
+ = Why do I need the Custom Facebook Feed plugin? =
130
+
131
+ **Increase Social Engagement**
132
+ Increase engagement between you and your users, customers, fans or group members. Get more Facebook likes by displaying your Facebook content directly on your site.
133
+
134
+ **Save Time**
135
+ Don't have time to blog? Save time by using the Custom Facebook Feed instead to generate dynamic content for your website.
136
+
137
+ **Display Your Facebook Content Your Way**
138
+ Tailor your Facebook feeds to display whatever types of content you like. Integrate your Facebook content into your website to completely match the look and feel of the site. No more uncustomizable Facebook iframes.
139
+
140
+ **Add Dynamic SEO Facebook Content to Your Site**
141
+ All of that quality keyword-rich Facebook content from Facebook posts is directly embedded into your website.
142
+
143
+ **No Coding Required**
144
+ Choose from tons of built-in customization options to create a truly unique feed of your Facebook content.
145
+
146
+ **Mind-blowing Customer Support**
147
+ We understand that sometimes you need help, have issues or just have questions. We love our customers and strive to provide the best support experience in the business. If you need support then just let us know and we'll get back to you right away.
148
+
149
+ = How to get a Facebook Access Token =
150
+
151
+ **For step-by-step instructions and screenshots on how to get a Facebook Access Token just follow the [Facebook Access Token instructions](http://smashballoon.com/custom-facebook-feed/access-token/ "Facebook Access Token instructions") on the Smash Balloon website.**
152
+
153
+ In order to use the Custom Facebook Feed Plugin you will need to obtain an Access Token from Facebook. Don't worry though, this is really easy to do. Just follow the steps below:
154
+
155
+ **1)** Go to [developers.facebook.com](http://developers.facebook.com "Facebook developers website") and click on Log In in the top right. Log in using your personal Facebook credentials.
156
+
157
+ **Note:** The personal Facebook account that you use to register as a Facebook developer does not need to be associated in any way with the Facebook page or Facebook group whose posts you want to display. You can use the Facebook Access Token you receive to display the Facebook posts from any public Facebook page or open Facebook group.
158
+
159
+ **Note:** You cannot log in to the Facebook Developer site using a Facebook Page or Facebook Business account. You must use the username and password from your personal Facebook profile. Facebook doesn't allow businesses to register as Facebook developers, only individuals.
160
+
161
+ **2)** If this is your first time signing in to the Facebook Developer portal then click on Register Now. Registering is a quick an easy process which will take less than a couple of minutes. If you're already registered as a Facebook developer then you can skip ahead to step 9.
162
+
163
+ **3)** Accept the Facebook terms and click Continue.
164
+
165
+ **4)** Enter your phone number to confirm your account.
166
+
167
+ **5)** Facebook will send you an automated text message containing a confirmation code. Enter it in the box and click Confirm.
168
+
169
+ **6)** Choose to share your phone number with Only Me (unless you wish to share it with publicly or with Facebook friends).
170
+
171
+ **7)** You can skip the next step by clicking Skip.
172
+
173
+ **8)** Click Done.
174
+
175
+ **9)** Now click on Create New App.
176
+
177
+ **10)** Enter your Facebook App Name. This can be anything you like. Click Continue.
178
+
179
+ **11)** Fill in Facebook's Security Check and click Continue.
180
+
181
+ **12)** Your Facebook App should now be set up. Copy and paste your Facebook App ID and Facebook App Secret into the fields in the last step of the [Access Token instructions](http://smashballoon.com/custom-facebook-feed/access-token/ "How to get a Facebook Access Token") to retrieve your Facebook Access Token.
182
+
183
+ = What some of our users think =
184
+
185
+ **See all of the reviews [here](http://smashballoon.com/custom-facebook-feed/#support "Custom Facebook Feed customer reviews")**
186
+
187
+ "Loving the Facebook feed plugin from @smashballoon. It's gonna transform my work's website! Great customer service too :)" - Grace Snow
188
+
189
+ "Love the style and functionality of the @smashballoon facebook feed plugin. AMAZING support!" - Bella Guzman
190
+
191
+ "Hands down the BEST Facebook feed plugin for WP - @smashballoon #prettysureivetriedthemall" - Jacob Ajjarapu
192
+
193
+ "@smashballoon Custom Facebook Feed plugin for WordPress is excellent and support couldn't have been easier or faster. Thx!" - Scott Whittier
194
+
195
+ "@smashballoon Love your Facebook plugin, and fantastic back-up support - good work" - Mike Harwood
196
+
197
+ "Very smooth purchase process. After getting the Facebook access key, the plugin worked perfectly. Needed some questions answered, and received the best personal support i've ever had. Can't recommend this plugin highly enough." - jondennis
198
+
199
+ "I am not by any means an experienced web designer or programmer. Normally upon seeking tech support for anything I am met with a support tech that either talks over my head and answers me as shortly as possible. The short answers would not normally bother me if the response time was under 6-8 hours if not 3 days for a response. I found Smash Balloon by absolute luck in my search for a Facebook Plugin for my blog site that had a better look than the Facebook widget that my site came with. In fear that I would receive the aforementioned type of "help," I spent almost 2 days trying to save myself the frustration of the technicians by thinking that I could do it myself. Well, I couldn't do it myself and finally I submitted a support request from Smash Balloon. It was the fastest response that I have ever experienced with any tech that I have ever contacted in my life and I didn't feel as if I was talking to a robot whos creator forgot to program the part where they liked their job. Furthermore, I trusted the SmashTeam to go into my site and fix what my limited amount of knowledge would allow me to do on my own. I sat at my computer hitting refresh watching it come to life.
200
+ I'm now sitting here playing with the very simple and highly extensive custom Facebook feed customization options and my stress has been removed. I recommend this product and this company to anyone and I will continue to do so. Thank you SmashTeam" - Chris West
201
+
202
+ "I can't tell you how many plugins I struggle with because of poor documentation. I'm not a developer, I am a user who needs (fairly quick) responses.
203
+ The Custom Facebook Feed plugin doesn't fit into that category at all! I handled 90% of the install by myself, and got immediate and accurate support from the developer when it came to slight customizations.
204
+ Bottom line: this is the best tool for implementing a Facebook feed into a WordPress page - and the people behind it are simply awesome!" - kairostcheck
205
+
206
+ "This is THE plugin to use if you want to get realtime postings from your Facebook page onto your WordPress Site. I was up and running in no time. I had a few settings wrong but was able to receive VERY quick responses from Smash Ballon's tech support team (Thanks John!)." - kevymars
207
+
208
+ "This plugin is great. Pull in as little or as much content from a Facebook page into your WordPress site. Fantastic for keeping content on your WordPress pages dynamic with no more effort other than using your Facebook page as per normal. I had some issues in getting the plugin to work at first, so I contacted support at SmashBalloon. John was immensely helpful, considering I was only using the free version of the plugin. He got to the bottom of my problem (which was a hosting server issue), got this fixed and it works a treat. Would highly recommend SmashBalloon for quality of product and refreshingly good support. Well done!" - gluedesign
209
+
210
+ "Easy to install, took about 5-10 minutes in total. Was able to get 3 facebook feeds showing up on my page which is exactly what I needed as we have 3 facebook pages. Definately the easiest facebook plugin to use that I've tried." - susiep
211
+
212
+ "I got it working pretty easily and looks sweet. A lot of customization options for a simple facebook plugin - makes it really easy to get it lookin just right.
213
+ Wish facebook made it easier to get a token but is what it is. The step by step instructions helped so wasn't too bad.
214
+ Cheers, Moz" - mozlover
215
+
216
+ "Tried a bunch of other facebook plugins but they were either impossible to get working or looked like garbage. This facebook plugin has easy to follow instructions and lets you customize pretty much every aspect of it. Highly recommend." - Samtaray
217
+
218
+ "You will have a professional touch to a website with this plugin. Total freedom to integrate Facebook in your website - which is of course much nicer than the standard options from Facebook. Have a look at youngfocus.org where you can see the implementation.
219
+ Smashballoon did a great job with this plugin and their service and instructions on their website are very clear! Bravo!
220
+ Paul (Young Focus)" - paulvw
221
+
222
+ "Easy to set up. Nice to be able to show facebook posts on my site without the ugly facebook social plugin." - B
223
+
224
+ = The Importance of Facebook for Small Businesses =
225
+
226
+ **Below is an article indicating the importance of building a Facebook community around your business or product. The Custom Facebook Feed plugin can help you to build a Facebook community more easily and effectively.**
227
+
228
+ A few years back when Mark Zuckerberg came up with his concept of a social networking site and named it Facebook, he had no idea what it would become in the time to come. Facebook has quite literally revolutionized the way we look at social networking. With over 700 million active Facebook users, it is definitely the biggest platform you can get if you seek to engage with many people simultaneously. Though Facebook is the premiere social networking platform, it also holds a lot of potential for businesses. The fact that Facebook can help businesses in growing and reaching out to a new customer base has added to Facebook's popularity.
229
+
230
+ Today when you look at Facebook and the Facebook groups or Facebook pages that exist on the site, you will find that every popular brand is there. They are not only there but are active on Facebook on almost a daily basis. For the present generation, who spend a lot more time on the internet than on the TV, brands needed to change their approach. Facebook provides the best possible solution in this scenario. However, it is not only the big brands that make the full use of Facebook’s social media power. Even small businesses can benefit greatly from using Facebook if they make optimal use of the various features that Facebook has to offer.
231
+
232
+ **Why Use Facebook for Your Business?**
233
+
234
+ When you start your business, many things have to be taken into account. Amongst the tons of seemingly more important things, you might question the need for using Facebook. Often people end up feeling that Facebook is too trivial a task and can be accomplished at anytime. Here are some reasons why you should have your presence on a social networking giant like Facebook and take it very seriously:
235
+
236
+ Customer Interaction: Having your business on Facebook through a Facebook fanpage or a Facebook group is a great way to learn more about your customers. Through Facebook comments or Facebook posts, you get to have direct feedback and conversations with your target audience on Facebook. The people who like your Facebook fanpage or join your Facebook group are only there because they want to be. They are there to know what they can about you and you can do the same thing.
237
+
238
+ Give a personal touch to your business: Being well connected is important for any business, especially for a small one. You need to be able to communicate with people and grow your contacts. The best possible way to do that is through direct involvement. Facebook allows you to give your business an image and then you can actually have live conversations with people who matter, making communicating through Facebook a more personal experience then what you get on a TV.
239
+
240
+ Develop a loyal fan base: Facebook allows you to develop your very own Facebook community. All you need to do is, post links and content that is both relevant and useful. You can even have promotional Facebook campaigns and Facebook contests through your Facebook page and offer incentives as well. If done correctly, you will find that you can develop a loyal community for your business on Facebook.
241
+
242
+ SEO: Search Engine Optimization is a key aspect for anyone who wants to build a significant presence on the web. Having a Facebook page for your business can help you in your SEO efforts as well. All the links and Facebook posts on the page are indexed by search engines. So having a Facebook page flowing with continuous relevant content will definitely give you a jump in search engine rankings.
243
+
244
+ Beat your competition: One of the biggest reasons for you to make sure that you are on Facebook is that your competition might already be there. In this cut throat environment, lagging behind will make it really hard for your business to succeed.
245
+
246
+ Viral promotion: If someone ends up liking your page then it appears in their Facebook news feed. This makes it possible for your business to be in their eyes on a regular basis through Facebook status updates or content posting. What’s more, if they comment on your Facebook post, their Facebook friends will also see your Facebook post and this will help in viral promotion of your business.
247
+
248
+ Facebook Ads: Your business at Facebook is not just limited to a Facebook page or Facebook group. Facebook also offers you a chance to put up Facebook advertising campaigns. You can build your Facebook advertisements, and as per your budget requirements, go for a Facebook campaign suitable for your business. You can also choose the set of people to whom these Facebook ads will be visible. You can target your Facebook ads on the basis of demographics, educational level, interests etc. It is also up to you to decide how often these Facebook ads will appear.
249
+
250
+ Save money: Apart from these facts, Facebook is free. You do not need to spend anything for promoting your company through a Facebook page. Facebook already has people addicted to it. This means you do not have to look for customers – they are already there on Facebook.
251
+
252
+ **How to Make the Best Use of Facebook?**
253
+
254
+ Many people feel that simply having a Facebook page or Facebook group is enough to help their company. It cannot be further from the truth. In fact, if you are not going to use it properly, then it can be more disadvantageous than not being on Facebook.
255
+
256
+ Make sure that you do not leave your Facebook page or Facebook group after a few days. It reduces participation and gives your business a bad name. Do not spam through your Facebook pages, it is the simplest way to lose customers. Make sure that your Facebook fans and members are rewarded for being there in your Facebook group or Facebook page. You could give them free coupons via Facebook or something similar.
257
+
258
+ Facebook has really changed the way people go about promoting their business. With so many people with varied interests available on a single platform, there is something for everyone. All you need to do is find the right target audience and then market your business to them. Facebook provides you all the tools required to reach these people.
259
+
260
+ Credit [iMarketing Factory](http://www.imarketingfactory.com/facebook/ "The Importance of Facebook for Small Businesses")
261
+
262
  == Screenshots ==
263
 
264
  1. By default the Facebook feed inherits your theme's default styles and is completely responsive
273
 
274
  == Changelog ==
275
 
276
+ = 1.8.2 =
277
+ * New: Now supports Facebook tags - creates links when using the @ symbol to tag other people or Facebook pages in your posts
278
+ * Tweak: Changed the method used for link replacement in posts
279
+
280
  = 1.8.1 =
281
  * New: Added an 'exclude' shortcode option to allow you to easily exclude specific parts of the post
282
  * New: Timeline events are now cached to help reduce page load time
custom-facebook-feed-admin.php CHANGED
@@ -472,6 +472,7 @@ function cff_style_page() {
472
  'cff_custom_css' => '',
473
  'cff_custom_js' => '',
474
  'cff_title_link' => false,
 
475
  'cff_event_title_link' => false,
476
  'cff_video_action' => 'file',
477
  'cff_sep_color' => '',
@@ -643,6 +644,7 @@ function cff_style_page() {
643
  $cff_custom_css = $options[ 'cff_custom_css' ];
644
  $cff_custom_js = $options[ 'cff_custom_js' ];
645
  $cff_title_link = $options[ 'cff_title_link' ];
 
646
  $cff_event_title_link = $options[ 'cff_event_title_link' ];
647
  $cff_video_action = $options[ 'cff_video_action' ];
648
  $cff_sep_color = $options[ 'cff_sep_color' ];
@@ -723,6 +725,7 @@ function cff_style_page() {
723
  if (isset($_POST[ 'cff_title_weight' ]) ) $cff_title_weight = $_POST[ 'cff_title_weight' ];
724
  if (isset($_POST[ 'cff_title_color' ]) ) $cff_title_color = $_POST[ 'cff_title_color' ];
725
  (isset($_POST[ 'cff_title_link' ]) ) ? $cff_title_link = $_POST[ 'cff_title_link' ] : $cff_title_link = '';
 
726
  $cff_body_size = $_POST[ 'cff_body_size' ];
727
  if (isset($_POST[ 'cff_body_weight' ]) ) $cff_body_weight = $_POST[ 'cff_body_weight' ];
728
  if (isset($_POST[ 'cff_body_color' ]) ) $cff_body_color = $_POST[ 'cff_body_color' ];
@@ -787,6 +790,7 @@ function cff_style_page() {
787
  $options[ 'cff_title_weight' ] = $cff_title_weight;
788
  $options[ 'cff_title_color' ] = $cff_title_color;
789
  $options[ 'cff_title_link' ] = $cff_title_link;
 
790
  $options[ 'cff_body_size' ] = $cff_body_size;
791
  $options[ 'cff_body_weight' ] = $cff_body_weight;
792
  $options[ 'cff_body_color' ] = $cff_body_color;
@@ -1257,6 +1261,15 @@ function cff_style_page() {
1257
  <th><label for="cff_title_link" class="bump-left"><?php _e('Link text to Facebook post?'); ?></label></th>
1258
  <td><input type="checkbox" name="cff_title_link" id="cff_title_link" <?php if($cff_title_link == true) echo 'checked="checked"' ?> />&nbsp;Yes</td>
1259
  </tr>
 
 
 
 
 
 
 
 
 
1260
 
1261
  </tbody>
1262
  </table>
472
  'cff_custom_css' => '',
473
  'cff_custom_js' => '',
474
  'cff_title_link' => false,
475
+ 'cff_post_tags' => true,
476
  'cff_event_title_link' => false,
477
  'cff_video_action' => 'file',
478
  'cff_sep_color' => '',
644
  $cff_custom_css = $options[ 'cff_custom_css' ];
645
  $cff_custom_js = $options[ 'cff_custom_js' ];
646
  $cff_title_link = $options[ 'cff_title_link' ];
647
+ $cff_post_tags = $options[ 'cff_post_tags' ];
648
  $cff_event_title_link = $options[ 'cff_event_title_link' ];
649
  $cff_video_action = $options[ 'cff_video_action' ];
650
  $cff_sep_color = $options[ 'cff_sep_color' ];
725
  if (isset($_POST[ 'cff_title_weight' ]) ) $cff_title_weight = $_POST[ 'cff_title_weight' ];
726
  if (isset($_POST[ 'cff_title_color' ]) ) $cff_title_color = $_POST[ 'cff_title_color' ];
727
  (isset($_POST[ 'cff_title_link' ]) ) ? $cff_title_link = $_POST[ 'cff_title_link' ] : $cff_title_link = '';
728
+ (isset($_POST[ 'cff_post_tags' ]) ) ? $cff_post_tags = $_POST[ 'cff_post_tags' ] : $cff_post_tags = '';
729
  $cff_body_size = $_POST[ 'cff_body_size' ];
730
  if (isset($_POST[ 'cff_body_weight' ]) ) $cff_body_weight = $_POST[ 'cff_body_weight' ];
731
  if (isset($_POST[ 'cff_body_color' ]) ) $cff_body_color = $_POST[ 'cff_body_color' ];
790
  $options[ 'cff_title_weight' ] = $cff_title_weight;
791
  $options[ 'cff_title_color' ] = $cff_title_color;
792
  $options[ 'cff_title_link' ] = $cff_title_link;
793
+ $options[ 'cff_post_tags' ] = $cff_post_tags;
794
  $options[ 'cff_body_size' ] = $cff_body_size;
795
  $options[ 'cff_body_weight' ] = $cff_body_weight;
796
  $options[ 'cff_body_color' ] = $cff_body_color;
1261
  <th><label for="cff_title_link" class="bump-left"><?php _e('Link text to Facebook post?'); ?></label></th>
1262
  <td><input type="checkbox" name="cff_title_link" id="cff_title_link" <?php if($cff_title_link == true) echo 'checked="checked"' ?> />&nbsp;Yes</td>
1263
  </tr>
1264
+
1265
+ <tr>
1266
+ <th><label for="cff_post_tags" class="bump-left"><?php _e('Enable Post Tags?'); ?></label></th>
1267
+ <td>
1268
+ <input type="checkbox" name="cff_post_tags" id="cff_post_tags" <?php if($cff_post_tags == true) echo 'checked="checked"' ?> />&nbsp;<?php _e('Yes'); ?>
1269
+ <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e('What are Post Tags?'); ?></a>
1270
+ <p class="cff-tooltip cff-more-info"><?php _e("When you use tag another Facebook page or user in your post using the @ symbol it creates a post tag, which is a link to either that Facebook page or user profile."); ?></p>
1271
+ </td>
1272
+ </tr>
1273
 
1274
  </tbody>
1275
  </table>
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.8.1
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
@@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
  */
25
  //Include admin
26
  include dirname( __FILE__ ) .'/custom-facebook-feed-admin.php';
 
27
 
28
  // Add shortcodes
29
  add_shortcode('custom-facebook-feed', 'display_cff');
@@ -74,6 +75,7 @@ function display_cff($atts) {
74
  'textweight' => isset($options[ 'cff_title_weight' ]) ? $options[ 'cff_title_weight' ] : '',
75
  'textcolor' => isset($options[ 'cff_title_color' ]) ? $options[ 'cff_title_color' ] : '',
76
  'textlink' => isset($options[ 'cff_title_link' ]) ? $options[ 'cff_title_link' ] : '',
 
77
  'descsize' => isset($options[ 'cff_body_size' ]) ? $options[ 'cff_body_size' ] : '',
78
  'descweight' => isset($options[ 'cff_body_weight' ]) ? $options[ 'cff_body_weight' ] : '',
79
  'desccolor' => isset($options[ 'cff_body_color' ]) ? $options[ 'cff_body_color' ] : '',
@@ -702,31 +704,102 @@ function display_cff($atts) {
702
  $cff_translate_photos_text = $atts['photostext'];
703
  if (!isset($cff_translate_photos_text) || empty($cff_translate_photos_text)) $cff_translate_photos_text = 'photos';
704
  $cff_post_text = '<' . $cff_title_format . ' class="cff-post-text" ' . $cff_title_styles . '>';
705
- //__ shared __'s photo
706
- // if ($news->type == 'photo' && !empty($news->story) ) $cff_post_text .= '<span class="cff-byline" '.$cff_body_styles.'>' . $news->story . '</span>';
707
- // $cff_post_text = '<div class="cff-post-text" ' . $cff_title_styles . '>';
708
  $cff_post_text .= '<span class="cff-text">';
709
-
710
- ( $cff_title_link == 'on' || $cff_title_link == 'true' || $cff_title_link == true ) ? $cff_title_link = true : $cff_title_link = false;
711
- if( $atts[ 'textlink' ] == 'false' ) $cff_title_link = false;
712
-
713
- if ($cff_title_link == true) $cff_post_text .= '<a class="cff-post-text-link" href="'.$link.'" '.$target.'>';
714
- if (!empty($news->story)) $post_text = $news->story;
715
- if (!empty($news->message)) $post_text = $news->message;
716
- if (!empty($news->name) && empty($news->story) && empty($news->message)) $post_text = $news->name;
 
 
 
 
 
 
 
 
 
 
717
  if ($cff_album) {
718
- if (!empty($news->name)) $post_text = $news->name;
719
- if (!empty($news->message) && empty($news->name)) $post_text = $news->message;
 
 
 
 
 
 
720
  $post_text .= ' (' . $num_photos . ' '.$cff_translate_photos_text.')';
721
  }
722
 
723
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
724
  //If the text is wrapped in a link then don't hyperlink any text within
725
  if ($cff_title_link) {
726
  //Wrap links in a span so we can break the text if it's too long
727
- $cff_post_text .= cff_wrap_span( htmlspecialchars($post_text) ) . ' ';
728
  } else {
729
- $cff_post_text .= cff_make_clickable( htmlspecialchars($post_text) ) . ' ';
 
730
  }
731
 
732
  if ($cff_title_link) $cff_post_text .= '</a>';
@@ -750,7 +823,7 @@ function display_cff($atts) {
750
  if (!empty($body_limit)) {
751
  if (strlen($description_text) > $body_limit) $description_text = substr($description_text, 0, $body_limit) . '...';
752
  }
753
- $cff_description .= '<p class="cff-post-desc" '.$cff_body_styles.'><span>' . cff_make_clickable( htmlspecialchars($description_text) ) . '</span></p>';
754
 
755
  //If the post text and description/caption are the same then don't show the description
756
  if($post_text == $description_text) $cff_description = '';
@@ -847,7 +920,7 @@ function display_cff($atts) {
847
  if (!empty($body_limit)) {
848
  if (strlen($description) > $body_limit) $description = substr($description, 0, $body_limit) . '...';
849
  }
850
- $cff_event .= '<p class="cff-info" ' . $cff_event_details_styles . '>' . cff_make_clickable($description) . '</p>';
851
  }
852
  }
853
  $cff_event .= '</div>';
@@ -867,7 +940,7 @@ function display_cff($atts) {
867
  $cff_description = '<div class="cff-desc-wrap ';
868
  if (empty($picture)) $cff_description .= 'cff-no-image';
869
  $cff_description .= '"><a class="cff-link-title" href="'.$link.'" '.$target.'>'. '<b>' . $video_name . '</b></a>';
870
- $cff_description .= '<p class="cff-post-desc" '.$cff_body_styles.'><span>' . cff_make_clickable( htmlspecialchars($description_text) ) . '</span></p></div>';
871
  }
872
  }
873
 
@@ -964,6 +1037,9 @@ function display_cff($atts) {
964
  //Return our feed HTML to display
965
  return $cff_content;
966
  }
 
 
 
967
  //Get JSON object of feed data
968
  function cff_fetchUrl($url){
969
  //Can we use cURL?
@@ -988,92 +1064,7 @@ function cff_fetchUrl($url){
988
 
989
  return $feedData;
990
  }
991
- //***FUNCTIONS***
992
- //Make links in text clickable
993
- function cff_make_clickable($text) {
994
- $pattern = '#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#';
995
- return preg_replace_callback($pattern, 'cff_auto_link_text_callback', $text);
996
- }
997
- function cff_auto_link_text_callback($matches) {
998
- $max_url_length = 50;
999
- $max_depth_if_over_length = 2;
1000
- $ellipsis = '&hellip;';
1001
- $target = 'target="_blank"';
1002
- $url_full = $matches[0];
1003
- $url_short = '';
1004
- if (strlen($url_full) > $max_url_length) {
1005
- $parts = parse_url($url_full);
1006
- $url_short = $parts['scheme'] . '://' . preg_replace('/^www\./', '', $parts['host']) . '/';
1007
- $path_components = explode('/', trim($parts['path'], '/'));
1008
- foreach ($path_components as $dir) {
1009
- $url_string_components[] = $dir . '/';
1010
- }
1011
- if (!empty($parts['query'])) {
1012
- $url_string_components[] = '?' . $parts['query'];
1013
- }
1014
- if (!empty($parts['fragment'])) {
1015
- $url_string_components[] = '#' . $parts['fragment'];
1016
- }
1017
- for ($k = 0; $k < count($url_string_components); $k++) {
1018
- $curr_component = $url_string_components[$k];
1019
- if ($k >= $max_depth_if_over_length || strlen($url_short) + strlen($curr_component) > $max_url_length) {
1020
- if ($k == 0 && strlen($url_short) < $max_url_length) {
1021
- // Always show a portion of first directory
1022
- $url_short .= substr($curr_component, 0, $max_url_length - strlen($url_short));
1023
- }
1024
- $url_short .= $ellipsis;
1025
- break;
1026
- }
1027
- $url_short .= $curr_component;
1028
- }
1029
- } else {
1030
- $url_short = $url_full;
1031
- }
1032
- if( substr( $url_full, 0, 4 ) !== "http" ) $url_full = 'http://' . $url_full;
1033
- return "<a class='cff-break-word' rel=\"nofollow\" href=\"$url_full\" " . $target . ">$url_full</a>";
1034
- }
1035
- //Make links into span instead when the post text is made clickable
1036
- function cff_wrap_span($text) {
1037
- $pattern = '#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#';
1038
- return preg_replace_callback($pattern, 'cff_wrap_span_callback', $text);
1039
- }
1040
- function cff_wrap_span_callback($matches) {
1041
- $max_url_length = 50;
1042
- $max_depth_if_over_length = 2;
1043
- $ellipsis = '&hellip;';
1044
- $target = 'target="_blank"';
1045
- $url_full = $matches[0];
1046
- $url_short = '';
1047
- if (strlen($url_full) > $max_url_length) {
1048
- $parts = parse_url($url_full);
1049
- $url_short = $parts['scheme'] . '://' . preg_replace('/^www\./', '', $parts['host']) . '/';
1050
- $path_components = explode('/', trim($parts['path'], '/'));
1051
- foreach ($path_components as $dir) {
1052
- $url_string_components[] = $dir . '/';
1053
- }
1054
- if (!empty($parts['query'])) {
1055
- $url_string_components[] = '?' . $parts['query'];
1056
- }
1057
- if (!empty($parts['fragment'])) {
1058
- $url_string_components[] = '#' . $parts['fragment'];
1059
- }
1060
- for ($k = 0; $k < count($url_string_components); $k++) {
1061
- $curr_component = $url_string_components[$k];
1062
- if ($k >= $max_depth_if_over_length || strlen($url_short) + strlen($curr_component) > $max_url_length) {
1063
- if ($k == 0 && strlen($url_short) < $max_url_length) {
1064
- // Always show a portion of first directory
1065
- $url_short .= substr($curr_component, 0, $max_url_length - strlen($url_short));
1066
- }
1067
- $url_short .= $ellipsis;
1068
- break;
1069
- }
1070
- $url_short .= $curr_component;
1071
- }
1072
- } else {
1073
- $url_short = $url_full;
1074
- }
1075
- return "<span class='cff-break-word'>$url_short</span>";
1076
- }
1077
  //2013-04-28T21:06:56+0000
1078
  //Time stamp function - used for posts
1079
  function cff_getdate($original, $date_format, $custom_date) {
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.8.2
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
24
  */
25
  //Include admin
26
  include dirname( __FILE__ ) .'/custom-facebook-feed-admin.php';
27
+ include dirname( __FILE__ ) .'/cff_autolink.php';
28
 
29
  // Add shortcodes
30
  add_shortcode('custom-facebook-feed', 'display_cff');
75
  'textweight' => isset($options[ 'cff_title_weight' ]) ? $options[ 'cff_title_weight' ] : '',
76
  'textcolor' => isset($options[ 'cff_title_color' ]) ? $options[ 'cff_title_color' ] : '',
77
  'textlink' => isset($options[ 'cff_title_link' ]) ? $options[ 'cff_title_link' ] : '',
78
+ 'posttags' => isset($options[ 'cff_post_tags' ]) ? $options[ 'cff_post_tags' ] : '',
79
  'descsize' => isset($options[ 'cff_body_size' ]) ? $options[ 'cff_body_size' ] : '',
80
  'descweight' => isset($options[ 'cff_body_weight' ]) ? $options[ 'cff_body_weight' ] : '',
81
  'desccolor' => isset($options[ 'cff_body_color' ]) ? $options[ 'cff_body_color' ] : '',
704
  $cff_translate_photos_text = $atts['photostext'];
705
  if (!isset($cff_translate_photos_text) || empty($cff_translate_photos_text)) $cff_translate_photos_text = 'photos';
706
  $cff_post_text = '<' . $cff_title_format . ' class="cff-post-text" ' . $cff_title_styles . '>';
 
 
 
707
  $cff_post_text .= '<span class="cff-text">';
708
+ if ($cff_title_link == 'true') $cff_post_text .= '<a class="cff-post-text-link" href="'.$link.'" '.$target.'>';
709
+ //Which content should we use?
710
+ $cff_post_text_type = '';
711
+ //Use the story
712
+ if (!empty($news->story)) {
713
+ $post_text = htmlspecialchars($news->story);
714
+ $cff_post_text_type = 'story';
715
+ }
716
+ //Use the message
717
+ if (!empty($news->message)) {
718
+ $post_text = htmlspecialchars($news->message);
719
+ $cff_post_text_type = 'message';
720
+ }
721
+ //Use the name
722
+ if (!empty($news->name) && empty($news->story) && empty($news->message)) {
723
+ $post_text = htmlspecialchars($news->name);
724
+ $cff_post_text_type = 'name';
725
+ }
726
  if ($cff_album) {
727
+ if (!empty($news->name)) {
728
+ $post_text = htmlspecialchars($news->name);
729
+ $cff_post_text_type = 'name';
730
+ }
731
+ if (!empty($news->message) && empty($news->name)) {
732
+ $post_text = htmlspecialchars($news->message);
733
+ $cff_post_text_type = 'message';
734
+ }
735
  $post_text .= ' (' . $num_photos . ' '.$cff_translate_photos_text.')';
736
  }
737
 
738
 
739
+ //MESSAGE TAGS
740
+ $cff_post_tags = $atts[ 'posttags' ];
741
+ //If the post tags option doesn't exist yet (ie. on plugin update) then set them as true
742
+ if ( !array_key_exists( 'cff_post_tags', $options ) ) $cff_post_tags = true;
743
+ //Add message and story tags if there are any and the post text is the message or the story
744
+ if( $cff_post_tags && ( isset($news->message_tags) || isset($news->story_tags) ) && ($cff_post_text_type == 'message' || $cff_post_text_type == 'story') && $cff_title_link != 'true' ){
745
+ //Use message_tags or story_tags?
746
+ ( $cff_post_text_type == 'message' )? $text_tags = $news->message_tags : $text_tags = $news->story_tags;
747
+
748
+ //Does the Post Text contain any html tags? - the & symbol is the best indicator of this
749
+ $html_check = stripos($post_text, '&');
750
+
751
+ //If it contains HTML tags then use the name replace method
752
+ if( $html_check ) {
753
+ //Loop through the tags
754
+ foreach($text_tags as $message_tag ) {
755
+ $tag_name = $message_tag[0]->name;
756
+ $tag_link = '<a href="http://facebook.com/' . $message_tag[0]->id . '" target="_blank">' . $message_tag[0]->name . '</a>';
757
+
758
+ $post_text = str_replace($tag_name, $tag_link, $post_text);
759
+ }
760
+
761
+ } else {
762
+ //If it doesn't contain HTMl tags then use the offset to replace message tags
763
+ $message_tags_arr = array();
764
+
765
+ $i = 0;
766
+ foreach($text_tags as $message_tag ) {
767
+ $i++;
768
+ $message_tags_arr = array_push_assoc(
769
+ $message_tags_arr,
770
+ $i,
771
+ array(
772
+ 'id' => $message_tag[0]->id,
773
+ 'name' => $message_tag[0]->name,
774
+ 'type' => $message_tag[0]->type,
775
+ 'offset' => $message_tag[0]->offset,
776
+ 'length' => $message_tag[0]->length
777
+ )
778
+ );
779
+ }
780
+
781
+ for($i = count($message_tags_arr); $i >= 1; $i--) {
782
+
783
+ $b = '<a href="http://facebook.com/' . $message_tags_arr[$i]['id'] . '" target="_blank">' . $message_tags_arr[$i]['name'] . '</a>';
784
+ $c = $message_tags_arr[$i]['offset'];
785
+ $d = $message_tags_arr[$i]['length'];
786
+
787
+ $post_text = substr_replace( $post_text, $b, $c, $d);
788
+
789
+ }
790
+
791
+ }
792
+
793
+ } //END MESSAGE TAGS
794
+
795
+
796
  //If the text is wrapped in a link then don't hyperlink any text within
797
  if ($cff_title_link) {
798
  //Wrap links in a span so we can break the text if it's too long
799
+ $cff_post_text .= cff_autolink( htmlspecialchars($post_text), true ) . ' ';
800
  } else {
801
+ //Don't use htmlspecialchars for post_text as it's added above so that it doesn't mess up the message_tag offsets
802
+ $cff_post_text .= cff_autolink( $post_text ) . ' ';
803
  }
804
 
805
  if ($cff_title_link) $cff_post_text .= '</a>';
823
  if (!empty($body_limit)) {
824
  if (strlen($description_text) > $body_limit) $description_text = substr($description_text, 0, $body_limit) . '...';
825
  }
826
+ $cff_description .= '<p class="cff-post-desc" '.$cff_body_styles.'><span>' . cff_autolink( htmlspecialchars($description_text) ) . '</span></p>';
827
 
828
  //If the post text and description/caption are the same then don't show the description
829
  if($post_text == $description_text) $cff_description = '';
920
  if (!empty($body_limit)) {
921
  if (strlen($description) > $body_limit) $description = substr($description, 0, $body_limit) . '...';
922
  }
923
+ $cff_event .= '<p class="cff-info" ' . $cff_event_details_styles . '>' . cff_autolink($description) . '</p>';
924
  }
925
  }
926
  $cff_event .= '</div>';
940
  $cff_description = '<div class="cff-desc-wrap ';
941
  if (empty($picture)) $cff_description .= 'cff-no-image';
942
  $cff_description .= '"><a class="cff-link-title" href="'.$link.'" '.$target.'>'. '<b>' . $video_name . '</b></a>';
943
+ $cff_description .= '<p class="cff-post-desc" '.$cff_body_styles.'><span>' . cff_autolink( htmlspecialchars($description_text) ) . '</span></p></div>';
944
  }
945
  }
946
 
1037
  //Return our feed HTML to display
1038
  return $cff_content;
1039
  }
1040
+
1041
+ //***FUNCTIONS***
1042
+
1043
  //Get JSON object of feed data
1044
  function cff_fetchUrl($url){
1045
  //Can we use cURL?
1064
 
1065
  return $feedData;
1066
  }
1067
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1068
  //2013-04-28T21:06:56+0000
1069
  //Time stamp function - used for posts
1070
  function cff_getdate($original, $date_format, $custom_date) {