Custom Facebook Feed - Version 1.4.2

Version Description

  • New: Add your own custom CSS to allow for even deeper customization
  • New: Optionally link your post text to the Facebook post
  • New: Optionally link your event title to the Facebook event page
  • Some minor modifications
Download this release

Release Info

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

Code changes from version 1.4.1 to 1.4.2

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.4.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -13,20 +13,28 @@ The Custom Facebook Feed allows you to display a customizable Facebook feed of a
13
 
14
  Display a **customizable**, **responsive** and **search engine crawlable** version of your Facebook feed on your WordPress site.
15
 
16
- The Custom Facebook Feed allows you to display a completely customizable, responsive, and search engine crawlable version of your Facebook page on your own website. No more ugly iframes! Customize your feed to seamlessly match the look and feel of your site.
17
 
18
  * **Completely Customizable** - By default the feed will adopt the style of your website, but can be completely customized to look however you like!
19
- * **Feed content is crawlable by search engines adding SEO value to your site** - other Facebook plugins embed the feed using iframes which are not crawlable
20
- * **Completely responsive and mobile optimized** - layout looks great on any screen size and in any container width
 
21
  * Control the width, height, padding and background color of your feed
22
  * Customize the size, weight and color of text
23
- * Select which parts of each post to display or hide
24
  * Select the number of posts to display
 
25
  * Set a maximum length for both the post title and body text
26
- * Use the shortcode to display the feed in a page, post or widget anywhere on your site
27
 
28
  To display photos, videos, the number of likes, shares and comments for each post, and for multiple layout options then [upgrade to the PRO version](http://smashballoon.com/custom-facebook-feed/wordpress-plugin/ "Custom Facebook Feed PRO"). Try out the [PRO demo](http://smashballoon.com/custom-facebook-feed/demo "Custom Facebook Feed Demo").
29
 
 
 
 
 
 
 
 
30
  == Installation ==
31
 
32
  1. Install the Custom Facebook Feed either via the WordPress plugin directory, or by uploading the files to your web server (in the `/wp-content/plugins/` directory).
@@ -76,6 +84,12 @@ It sure is. Unlike other Facebook plugins which use iframes to embed your feed i
76
 
77
  == Changelog ==
78
 
 
 
 
 
 
 
79
  = 1.4.1 =
80
  * Fix: Set all parts of the feed to display by default on activation
81
 
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.4.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
13
 
14
  Display a **customizable**, **responsive** and **search engine crawlable** version of your Facebook feed on your WordPress site.
15
 
16
+ = Features =
17
 
18
  * **Completely Customizable** - By default the feed will adopt the style of your website, but can be completely customized to look however you like!
19
+ * Feed content is **crawlable by search engines** adding SEO value to your site* - other Facebook plugins embed the feed using iframes which are not crawlable
20
+ * Completely **responsive** and mobile optimized - layout looks great on any screen size and in any container width
21
+ * Select which parts of each post to display or hide
22
  * Control the width, height, padding and background color of your feed
23
  * Customize the size, weight and color of text
 
24
  * Select the number of posts to display
25
+ * Add your own custom CSS
26
  * Set a maximum length for both the post title and body text
27
+ * Use the shortcode to display multiple feeds in a page, post or widget anywhere on your site
28
 
29
  To display photos, videos, the number of likes, shares and comments for each post, and for multiple layout options then [upgrade to the PRO version](http://smashballoon.com/custom-facebook-feed/wordpress-plugin/ "Custom Facebook Feed PRO"). Try out the [PRO demo](http://smashballoon.com/custom-facebook-feed/demo "Custom Facebook Feed Demo").
30
 
31
+ = Why do I need this plugin? =
32
+ **Small Business Owners & Marketers**
33
+ Don't have time to blog? Save time by using the Custom Facebook Feed instead to generate dynamic, search engine crawlable content on your website. All of that quality Facebook content from posts and comments is directly embedded into your website.
34
+
35
+ **Designers & Developers**
36
+ Integrate Facebook feeds into your websites that completely match the look and feel of the site. No more uncustomizable iframes.
37
+
38
  == Installation ==
39
 
40
  1. Install the Custom Facebook Feed either via the WordPress plugin directory, or by uploading the files to your web server (in the `/wp-content/plugins/` directory).
84
 
85
  == Changelog ==
86
 
87
+ = 1.4.2 =
88
+ * New: Add your own custom CSS to allow for even deeper customization
89
+ * New: Optionally link your post text to the Facebook post
90
+ * New: Optionally link your event title to the Facebook event page
91
+ * Some minor modifications
92
+
93
  = 1.4.1 =
94
  * Fix: Set all parts of the feed to display by default on activation
95
 
custom-facebook-feed-admin.php CHANGED
@@ -30,14 +30,41 @@ function cff_styling_menu() {
30
  }
31
  add_action('admin_menu', 'cff_styling_menu');
32
 
33
-
34
- function cff_register_option() {
35
- // creates our settings in the options table
36
- register_setting('cff_license', 'cff_license_key', 'cff_sanitize_license' );
 
 
 
 
 
 
37
  }
38
- add_action('admin_init', 'cff_register_option');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
 
 
40
 
 
 
 
 
 
41
 
42
  //Create Settings page
43
  function cff_settings_page() {
@@ -46,12 +73,10 @@ function cff_settings_page() {
46
  $access_token = 'cff_access_token';
47
  $page_id = 'cff_page_id';
48
  $num_show = 'cff_num_show';
49
-
50
  // Read in existing option value from database
51
  $access_token_val = get_option( $access_token );
52
  $page_id_val = get_option( $page_id );
53
  $num_show_val = get_option( $num_show );
54
-
55
  // See if the user has posted us some information. If they did, this hidden field will be set to 'Y'.
56
  if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) {
57
  // Read their posted value
@@ -66,7 +91,6 @@ function cff_settings_page() {
66
  ?>
67
  <div class="updated"><p><strong><?php _e('Settings saved.', 'custom-facebook-feed' ); ?></strong></p></div>
68
  <?php } ?>
69
-
70
 
71
  <div class="wrap">
72
  <h2><?php _e('Custom Facebook Feed Settings'); ?></h2>
@@ -108,18 +132,13 @@ function cff_settings_page() {
108
  <br />
109
  <hr />
110
  <br />
111
- <p>Please note that the free version of the plugin only displays text updates. For <b>photos, videos, comments and more</b> please upgrade to the <a href="http://smashballoon.com/custom-facebook-feed/wordpress-plugin/" target="_blank">Pro version</a> of the plugin.</p>
112
-
113
- <p><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!</p>
114
- <br /><br /><br /><br />
115
- <a href="http://smashballoon.com/custom-facebook-feed/demo" target="_blank"><img src="<?php echo plugins_url( 'img/pro.jpg' , __FILE__ ) ?>" /></a>
116
-
117
-
118
  <?php
119
  } //End Settings_Page
120
  //Create Style page
121
  function cff_style_page() {
122
-
123
  //Declare variables for fields
124
  $style_hidden_field_name = 'cff_style_submit_hidden';
125
  $defaults = array(
@@ -158,14 +177,19 @@ function cff_style_page() {
158
  'cff_feed_padding' => '',
159
  'cff_like_box_position' => 'bottom',
160
  'cff_bg_color' => '',
161
- 'cff_likebox_bg_color' => ''
162
- );
163
 
 
 
 
 
 
 
 
164
  //Save layout options in an array
165
  add_option( 'cff_style_settings', $options );
166
  $options = wp_parse_args(get_option('cff_style_settings'), $defaults);
167
  //Set the page variables
168
-
169
  //Include
170
  $cff_show_text = $options[ 'cff_show_text' ];
171
  $cff_show_desc = $options[ 'cff_show_desc' ];
@@ -203,15 +227,20 @@ function cff_style_page() {
203
  $cff_open_links = $options[ 'cff_open_links' ];
204
  $cff_bg_color = $options[ 'cff_bg_color' ];
205
  $cff_likebox_bg_color = $options[ 'cff_likebox_bg_color' ];
 
 
 
 
 
 
 
206
 
207
  // Texts lengths
208
  $cff_title_length = 'cff_title_length';
209
  $cff_body_length = 'cff_body_length';
210
-
211
  // Read in existing option value from database
212
  $cff_title_length_val = get_option( $cff_title_length );
213
  $cff_body_length_val = get_option( $cff_body_length );
214
-
215
  // See if the user has posted us some information. If they did, this hidden field will be set to 'Y'.
216
  if( isset($_POST[ $style_hidden_field_name ]) && $_POST[ $style_hidden_field_name ] == 'Y' ) {
217
 
@@ -260,6 +289,12 @@ function cff_style_page() {
260
  $cff_open_links = $_POST[ 'cff_open_links' ];
261
  $cff_bg_color = $_POST[ 'cff_bg_color' ];
262
  $cff_likebox_bg_color = $_POST[ 'cff_likebox_bg_color' ];
 
 
 
 
 
 
263
 
264
  //Update the options in the array in the database
265
  //Include
@@ -299,6 +334,12 @@ function cff_style_page() {
299
  $options[ 'cff_open_links' ] = $cff_open_links;
300
  $options[ 'cff_bg_color' ] = $cff_bg_color;
301
  $options[ 'cff_likebox_bg_color' ] = $cff_likebox_bg_color;
 
 
 
 
 
 
302
 
303
  //Update the array
304
  update_option( 'cff_style_settings', $options );
@@ -307,7 +348,6 @@ function cff_style_page() {
307
  <div class="updated"><p><strong><?php _e('Settings saved.', 'custom-facebook-feed' ); ?></strong></p></div>
308
  <?php } ?>
309
 
310
-
311
  <div class="wrap">
312
  <h2><?php _e('Custom Facebook Feed - Layout and Style'); ?></h2>
313
  <form name="form1" method="post" action="">
@@ -347,25 +387,55 @@ function cff_style_page() {
347
  </tr>
348
  </tbody>
349
  </table>
350
- <?php submit_button(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
  <hr />
352
  <h3><?php _e('Post Layout'); ?></h3>
353
  <table class="form-table">
354
  <tbody>
355
  <tr>
356
  <td><p>Choose a post layout:</p></td>
357
-
358
  <td>
359
  <select name="cff_preset_layout" disabled>
360
  <option>Thumbnail</option>
361
  <option>Half-width</option>
362
  <option>Full-width</option>
363
  </select>
364
-
365
  <i style="color: #666; font-size: 11px; margin-left: 5px;"><a href="http://smashballoon.com/custom-facebook-feed/" target="_blank">Upgrade to Pro</a></i>
366
  </td>
367
  </tr>
368
-
369
  <tr valign="top">
370
  <th scope="row"><?php _e('Include the following in posts (when applicable):'); ?></th>
371
  <td>
@@ -408,8 +478,6 @@ function cff_style_page() {
408
  </table>
409
  <?php submit_button(); ?>
410
  <hr />
411
-
412
-
413
  <h3><?php _e('Typography'); ?></h3>
414
  <table class="form-table">
415
  <tbody>
@@ -455,8 +523,11 @@ function cff_style_page() {
455
  </select>
456
  &nbsp;&nbsp;
457
  <label for="cff_title_color">Font Color&nbsp;&nbsp;#</label>
458
- <input name="cff_title_color" type="text" value="<?php esc_attr_e( $cff_title_color ); ?>" size="10" />
459
- <span>Eg. ED9A00 <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a></span>
 
 
 
460
  </td>
461
  </tr>
462
  <tr valign="top">
@@ -494,7 +565,7 @@ function cff_style_page() {
494
  </select>
495
  &nbsp;&nbsp;
496
  <label for="cff_body_color">Font Color&nbsp;&nbsp;#</label>
497
- <input name="cff_body_color" type="text" value="<?php esc_attr_e( $cff_body_color ); ?>" size="10" />
498
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
499
  </td>
500
  </tr>
@@ -539,8 +610,11 @@ function cff_style_page() {
539
  </select>
540
  &nbsp;&nbsp;
541
  <label for="cff_event_title_color">Font Color&nbsp;&nbsp;#</label>
542
- <input name="cff_event_title_color" type="text" value="<?php esc_attr_e( $cff_event_title_color ); ?>" size="10" />
543
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
 
 
 
544
  </td>
545
  </tr>
546
  <tr valign="top">
@@ -578,7 +652,7 @@ function cff_style_page() {
578
  </select>
579
  &nbsp;&nbsp;
580
  <label for="cff_event_details_color">Font Color&nbsp;&nbsp;#</label>
581
- <input name="cff_event_details_color" type="text" value="<?php esc_attr_e( $cff_event_details_color ); ?>" size="10" />
582
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
583
  </td>
584
  </tr>
@@ -617,7 +691,7 @@ function cff_style_page() {
617
  </select>
618
  &nbsp;&nbsp;
619
  <label for="cff_date_color">Font Color&nbsp;&nbsp;#</label>
620
- <input name="cff_date_color" type="text" value="<?php esc_attr_e( $cff_date_color ); ?>" size="10" />
621
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
622
  </td>
623
  </tr>
@@ -658,7 +732,7 @@ function cff_style_page() {
658
  </select>
659
  &nbsp;&nbsp;
660
  <label for="cff_link_color">Font Color&nbsp;&nbsp;#</label>
661
- <input name="cff_link_color" type="text" value="<?php esc_attr_e( $cff_link_color ); ?>" size="10" />
662
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
663
  </td>
664
  </tr>
@@ -667,28 +741,47 @@ function cff_style_page() {
667
  </table>
668
  <br />
669
  <hr />
670
-
671
-
672
  <h3><?php _e('Likes, Shares and Comments'); ?></h3>
673
  <p style="color: #666; font-size: 11px; font-style: italic; margin-left: 5px;"><a href="http://smashballoon.com/custom-facebook-feed/" target="_blank">Upgrade to Pro</a></p>
 
 
 
674
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
675
  <br />
676
  <hr />
 
677
  <h3><?php _e('Misc'); ?></h3>
678
  <table class="form-table">
679
  <tbody>
 
680
  <tr valign="top">
681
  <th scope="row"><?php _e('Maximum Post Text Length'); ?></th>
682
  <td>
683
- <input name="cff_title_length" type="text" value="<?php esc_attr_e( $cff_title_length_val ); ?>" size="4" /> <span>Characters.</span> <i style="color: #666; font-size: 11px; margin-left: 5px;">(Leave empty to set no maximum length)</i>
684
  </td>
685
  </tr>
686
  <tr valign="top">
687
- <th scope="row"><?php _e('Maximum Link/Event Description Length'); ?></th>
688
  <td>
689
  <input name="cff_body_length" type="text" value="<?php esc_attr_e( $cff_body_length_val ); ?>" size="4" /> <span>Characters.</span> <i style="color: #666; font-size: 11px; margin-left: 5px;">(Leave empty to set no maximum length)</i>
690
  </td>
691
  </tr>
 
692
  <tr valign="top">
693
  <th scope="row"><?php _e('Show the Like Box'); ?></th>
694
  <td>
@@ -709,23 +802,35 @@ function cff_style_page() {
709
  <td>
710
  <label for="cff_likebox_bg_color">#</label>
711
  <input name="cff_likebox_bg_color" type="text" value="<?php esc_attr_e( $cff_likebox_bg_color ); ?>" size="10" />
712
- <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
713
  </td>
714
  </tr>
 
715
  </tbody>
716
  </table>
717
  <?php submit_button(); ?>
718
  </form>
719
-
720
  <hr />
721
  <br />
722
- <p>Please note that the free version of the plugin only displays text updates. For <b>photos, videos, comments and more</b> please upgrade to the <a href="http://smashballoon.com/custom-facebook-feed/wordpress-plugin/" target="_blank">Pro version</a> of the plugin.</p>
723
-
724
- <p><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!</p>
725
- <br /><br /><br /><br />
726
- <a href="http://smashballoon.com/custom-facebook-feed/demo" target="_blank"><img src="<?php echo plugins_url( 'img/pro.jpg' , __FILE__ ) ?>" /></a>
727
-
728
-
729
  <?php
730
  } //End Style_Page
731
  ?>
30
  }
31
  add_action('admin_menu', 'cff_styling_menu');
32
 
33
+ //Add system info page
34
+ function cff_system_menu() {
35
+ add_submenu_page(
36
+ 'cff-top',
37
+ 'System Info',
38
+ 'System Info',
39
+ 'manage_options',
40
+ 'cff-system',
41
+ 'cff_system_info'
42
+ );
43
  }
44
+ add_action('admin_menu', 'cff_system_menu');
45
+
46
+ //Create Settings page
47
+ function cff_system_info() { ?>
48
+
49
+ <div class="wrap">
50
+ <h2><?php _e('System Info'); ?></h2>
51
+
52
+ <p>PHP Version: <b><?php echo PHP_VERSION . "\n"; ?></b></p>
53
+ <p>Web Server Info: <b><?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?></b></p>
54
+
55
+ <p>PHP allow_url_fopen: <b><?php echo ini_get( 'allow_url_fopen' ) ? "<span style='color: green;'>Yes</span>" : "<span style='color: red;'>No</span>"; ?></b></p>
56
+ <p>PHP cURL: <b><?php echo is_callable('curl_init') ? "<span style='color: green;'>Yes</span>" : "<span style='color: red;'>No</span>" ?></b></p>
57
+ <p>JSON: <b><?php echo function_exists("json_decode") ? "<span style='color: green;'>Yes</span>" : "<span style='color: red;'>No</span>" ?></b></p>
58
+ </div>
59
 
60
+ <?php
61
+ } //End cff_system_info
62
 
63
+ // function cff_register_option() {
64
+ // // creates our settings in the options table
65
+ // register_setting('cff_license', 'cff_license_key', 'cff_sanitize_license' );
66
+ // }
67
+ // add_action('admin_init', 'cff_register_option');
68
 
69
  //Create Settings page
70
  function cff_settings_page() {
73
  $access_token = 'cff_access_token';
74
  $page_id = 'cff_page_id';
75
  $num_show = 'cff_num_show';
 
76
  // Read in existing option value from database
77
  $access_token_val = get_option( $access_token );
78
  $page_id_val = get_option( $page_id );
79
  $num_show_val = get_option( $num_show );
 
80
  // See if the user has posted us some information. If they did, this hidden field will be set to 'Y'.
81
  if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) {
82
  // Read their posted value
91
  ?>
92
  <div class="updated"><p><strong><?php _e('Settings saved.', 'custom-facebook-feed' ); ?></strong></p></div>
93
  <?php } ?>
 
94
 
95
  <div class="wrap">
96
  <h2><?php _e('Custom Facebook Feed Settings'); ?></h2>
132
  <br />
133
  <hr />
134
  <br />
135
+ <p><a href="http://smashballoon.com/custom-facebook-feed/support" 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 improve it!</p>
136
+ <br /><br />
137
+ <a href="http://smashballoon.com/custom-facebook-feed/demo" target="_blank"><img src="<?php echo plugins_url( 'img/pro.png' , __FILE__ ) ?>" /></a>
 
 
 
 
138
  <?php
139
  } //End Settings_Page
140
  //Create Style page
141
  function cff_style_page() {
 
142
  //Declare variables for fields
143
  $style_hidden_field_name = 'cff_style_submit_hidden';
144
  $defaults = array(
177
  'cff_feed_padding' => '',
178
  'cff_like_box_position' => 'bottom',
179
  'cff_bg_color' => '',
180
+ 'cff_likebox_bg_color' => '',
 
181
 
182
+ //New
183
+ 'cff_custom_css' => '',
184
+ 'cff_title_link' => false,
185
+ 'cff_event_title_link' => false,
186
+ 'cff_sep_color' => '',
187
+ 'cff_sep_size' => '1'
188
+ );
189
  //Save layout options in an array
190
  add_option( 'cff_style_settings', $options );
191
  $options = wp_parse_args(get_option('cff_style_settings'), $defaults);
192
  //Set the page variables
 
193
  //Include
194
  $cff_show_text = $options[ 'cff_show_text' ];
195
  $cff_show_desc = $options[ 'cff_show_desc' ];
227
  $cff_open_links = $options[ 'cff_open_links' ];
228
  $cff_bg_color = $options[ 'cff_bg_color' ];
229
  $cff_likebox_bg_color = $options[ 'cff_likebox_bg_color' ];
230
+
231
+ //New
232
+ $cff_custom_css = $options[ 'cff_custom_css' ];
233
+ $cff_title_link = $options[ 'cff_title_link' ];
234
+ $cff_event_title_link = $options[ 'cff_event_title_link' ];
235
+ $cff_sep_color = $options[ 'cff_sep_color' ];
236
+ $cff_sep_size = $options[ 'cff_sep_size' ];
237
 
238
  // Texts lengths
239
  $cff_title_length = 'cff_title_length';
240
  $cff_body_length = 'cff_body_length';
 
241
  // Read in existing option value from database
242
  $cff_title_length_val = get_option( $cff_title_length );
243
  $cff_body_length_val = get_option( $cff_body_length );
 
244
  // See if the user has posted us some information. If they did, this hidden field will be set to 'Y'.
245
  if( isset($_POST[ $style_hidden_field_name ]) && $_POST[ $style_hidden_field_name ] == 'Y' ) {
246
 
289
  $cff_open_links = $_POST[ 'cff_open_links' ];
290
  $cff_bg_color = $_POST[ 'cff_bg_color' ];
291
  $cff_likebox_bg_color = $_POST[ 'cff_likebox_bg_color' ];
292
+ //New
293
+ $cff_custom_css = $_POST[ 'cff_custom_css' ];
294
+ $cff_title_link = $_POST[ 'cff_title_link' ];
295
+ $cff_event_title_link = $_POST[ 'cff_event_title_link' ];
296
+ $cff_sep_color = $_POST[ 'cff_sep_color' ];
297
+ $cff_sep_size = $_POST[ 'cff_sep_size' ];
298
 
299
  //Update the options in the array in the database
300
  //Include
334
  $options[ 'cff_open_links' ] = $cff_open_links;
335
  $options[ 'cff_bg_color' ] = $cff_bg_color;
336
  $options[ 'cff_likebox_bg_color' ] = $cff_likebox_bg_color;
337
+ //New
338
+ $options[ 'cff_custom_css' ] = $cff_custom_css;
339
+ $options[ 'cff_title_link' ] = $cff_title_link;
340
+ $options[ 'cff_event_title_link' ] = $cff_event_title_link;
341
+ $options[ 'cff_sep_color' ] = $cff_sep_color;
342
+ $options[ 'cff_sep_size' ] = $cff_sep_size;
343
 
344
  //Update the array
345
  update_option( 'cff_style_settings', $options );
348
  <div class="updated"><p><strong><?php _e('Settings saved.', 'custom-facebook-feed' ); ?></strong></p></div>
349
  <?php } ?>
350
 
 
351
  <div class="wrap">
352
  <h2><?php _e('Custom Facebook Feed - Layout and Style'); ?></h2>
353
  <form name="form1" method="post" action="">
387
  </tr>
388
  </tbody>
389
  </table>
390
+
391
+ <br />
392
+ <hr />
393
+
394
+ <table class="form-table">
395
+ <tbody>
396
+
397
+ <h3><?php _e('Post Types'); ?></h3>
398
+ <tr valign="top">
399
+ <th scope="row"><?php _e('Show these types of posts:'); ?></th>
400
+ <td>
401
+ <input name="cff_show_status_type" type="checkbox" id="cff_show_status_type" disabled checked />
402
+ <label for="cff_show_status_type">Statuses</label>
403
+ &nbsp;&nbsp;
404
+
405
+ <input type="checkbox" name="cff_show_event_type" id="cff_show_event_type" disabled checked />
406
+ <label for="cff_show_event_type">Events</label>
407
+ &nbsp;&nbsp;
408
+ <input type="checkbox" name="cff_show_photos_type" id="cff_show_photos_type" disabled checked />
409
+ <label for="cff_show_photos_type">Photos</label>
410
+ &nbsp;&nbsp;
411
+ <input type="checkbox" name="cff_show_video_type" id="cff_show_video_type" disabled checked />
412
+ <label for="cff_show_video_type">Videos</label>
413
+ &nbsp;&nbsp;
414
+ <input type="checkbox" name="cff_show_links_type" id="cff_show_links_type" disabled checked />
415
+ <label for="cff_show_links_type">Links</label>
416
+ &nbsp;
417
+ <i style="color: #666; font-size: 11px; margin-left: 5px;"><a href="http://smashballoon.com/custom-facebook-feed/" target="_blank">Upgrade to Pro</a></i>
418
+ </td>
419
+ </tr>
420
+
421
+ </tbody>
422
+ </table>
423
+ <br />
424
  <hr />
425
  <h3><?php _e('Post Layout'); ?></h3>
426
  <table class="form-table">
427
  <tbody>
428
  <tr>
429
  <td><p>Choose a post layout:</p></td>
 
430
  <td>
431
  <select name="cff_preset_layout" disabled>
432
  <option>Thumbnail</option>
433
  <option>Half-width</option>
434
  <option>Full-width</option>
435
  </select>
 
436
  <i style="color: #666; font-size: 11px; margin-left: 5px;"><a href="http://smashballoon.com/custom-facebook-feed/" target="_blank">Upgrade to Pro</a></i>
437
  </td>
438
  </tr>
 
439
  <tr valign="top">
440
  <th scope="row"><?php _e('Include the following in posts (when applicable):'); ?></th>
441
  <td>
478
  </table>
479
  <?php submit_button(); ?>
480
  <hr />
 
 
481
  <h3><?php _e('Typography'); ?></h3>
482
  <table class="form-table">
483
  <tbody>
523
  </select>
524
  &nbsp;&nbsp;
525
  <label for="cff_title_color">Font Color&nbsp;&nbsp;#</label>
526
+ <input name="cff_title_color" type="text" value="<?php esc_attr_e( $cff_title_color ); ?>" size="10" placeholder="Eg. ED9A00" />
527
+ <span><a href="http://www.colorpicker.com/" target="_blank">Color Picker</a></span>
528
+ &nbsp;&nbsp;
529
+ <input type="checkbox" name="cff_title_link" id="cff_title_link" <?php if($cff_title_link == true) echo 'checked="checked"' ?> />
530
+ <label for="cff_title_link">Link to Facebook post</label>
531
  </td>
532
  </tr>
533
  <tr valign="top">
565
  </select>
566
  &nbsp;&nbsp;
567
  <label for="cff_body_color">Font Color&nbsp;&nbsp;#</label>
568
+ <input name="cff_body_color" type="text" value="<?php esc_attr_e( $cff_body_color ); ?>" size="10" placeholder="Eg. ED9A00" />
569
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
570
  </td>
571
  </tr>
610
  </select>
611
  &nbsp;&nbsp;
612
  <label for="cff_event_title_color">Font Color&nbsp;&nbsp;#</label>
613
+ <input name="cff_event_title_color" type="text" value="<?php esc_attr_e( $cff_event_title_color ); ?>" size="10" placeholder="Eg. ED9A00" />
614
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
615
+ &nbsp;&nbsp;
616
+ <input type="checkbox" name="cff_event_title_link" id="cff_event_title_link" <?php if($cff_event_title_link == true) echo 'checked="checked"' ?> />
617
+ <label for="cff_event_title_link">Link to Facebook event</label>
618
  </td>
619
  </tr>
620
  <tr valign="top">
652
  </select>
653
  &nbsp;&nbsp;
654
  <label for="cff_event_details_color">Font Color&nbsp;&nbsp;#</label>
655
+ <input name="cff_event_details_color" type="text" value="<?php esc_attr_e( $cff_event_details_color ); ?>" size="10" placeholder="Eg. ED9A00" />
656
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
657
  </td>
658
  </tr>
691
  </select>
692
  &nbsp;&nbsp;
693
  <label for="cff_date_color">Font Color&nbsp;&nbsp;#</label>
694
+ <input name="cff_date_color" type="text" value="<?php esc_attr_e( $cff_date_color ); ?>" size="10" placeholder="Eg. ED9A00" />
695
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
696
  </td>
697
  </tr>
732
  </select>
733
  &nbsp;&nbsp;
734
  <label for="cff_link_color">Font Color&nbsp;&nbsp;#</label>
735
+ <input name="cff_link_color" type="text" value="<?php esc_attr_e( $cff_link_color ); ?>" size="10" placeholder="Eg. ED9A00" />
736
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
737
  </td>
738
  </tr>
741
  </table>
742
  <br />
743
  <hr />
 
 
744
  <h3><?php _e('Likes, Shares and Comments'); ?></h3>
745
  <p style="color: #666; font-size: 11px; font-style: italic; margin-left: 5px;"><a href="http://smashballoon.com/custom-facebook-feed/" target="_blank">Upgrade to Pro</a></p>
746
+
747
+ <br />
748
+ <hr />
749
 
750
+ <h3><?php _e('Custom CSS'); ?></h3>
751
+ <table class="form-table">
752
+ <tbody>
753
+ <tr valign="top">
754
+ <td>
755
+ Enter your own custom CSS in the box below
756
+ </td>
757
+ </tr>
758
+ <tr valign="top">
759
+ <td>
760
+ <textarea name="cff_custom_css" id="cff_custom_css" style="width: 70%;" rows="7"><?php esc_attr_e( $cff_custom_css ); ?></textarea>
761
+ </td>
762
+ </tr>
763
+ </tbody>
764
+ </table>
765
  <br />
766
  <hr />
767
+
768
  <h3><?php _e('Misc'); ?></h3>
769
  <table class="form-table">
770
  <tbody>
771
+ <tr><td><b style="font-size: 14px;"><?php _e('Text Character Limits'); ?></b></td></tr>
772
  <tr valign="top">
773
  <th scope="row"><?php _e('Maximum Post Text Length'); ?></th>
774
  <td>
775
+ <input name="cff_title_length" type="text" value="<?php esc_attr_e( $cff_title_length_val ); ?>" size="4" /> <span>Characters.</span> <span>Eg. 200</span> <i style="color: #666; font-size: 11px; margin-left: 5px;">(Leave empty to set no maximum length)</i>
776
  </td>
777
  </tr>
778
  <tr valign="top">
779
+ <th scope="row"><?php _e('Maximum Video/Link/Event Description Length'); ?></th>
780
  <td>
781
  <input name="cff_body_length" type="text" value="<?php esc_attr_e( $cff_body_length_val ); ?>" size="4" /> <span>Characters.</span> <i style="color: #666; font-size: 11px; margin-left: 5px;">(Leave empty to set no maximum length)</i>
782
  </td>
783
  </tr>
784
+ <tr><td><b style="font-size: 14px;"><?php _e('Like Box'); ?></b></td></tr>
785
  <tr valign="top">
786
  <th scope="row"><?php _e('Show the Like Box'); ?></th>
787
  <td>
802
  <td>
803
  <label for="cff_likebox_bg_color">#</label>
804
  <input name="cff_likebox_bg_color" type="text" value="<?php esc_attr_e( $cff_likebox_bg_color ); ?>" size="10" />
805
+ <span>Eg. ED9A00</span>&nbsp;&nbsp;<a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
806
+ </td>
807
+ </tr>
808
+
809
+ <tr><td><b style="font-size: 14px;"><?php _e('Separating Line'); ?></b></td></tr>
810
+ <tr valign="top">
811
+ <th scope="row"><?php _e('Separating Line Color'); ?></th>
812
+ <td>
813
+ <label for="cff_sep_color">#</label>
814
+ <input name="cff_sep_color" type="text" value="<?php esc_attr_e( $cff_sep_color ); ?>" size="10" />
815
+ <span>Eg. ED9A00</span>&nbsp;&nbsp;<a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
816
+ </td>
817
+ </tr>
818
+ <tr valign="top">
819
+ <th scope="row"><?php _e('Separating Line Thickness'); ?></th>
820
+ <td>
821
+ <input name="cff_sep_size" type="text" value="<?php esc_attr_e( $cff_sep_size ); ?>" size="1" /><span>px</span> <i style="color: #666; font-size: 11px; margin-left: 5px;">(Leave empty to hide)</i>
822
  </td>
823
  </tr>
824
+
825
  </tbody>
826
  </table>
827
  <?php submit_button(); ?>
828
  </form>
 
829
  <hr />
830
  <br />
831
+ <p>Please note that the free version of the plugin only displays text updates. For <b>photos, videos, comments and more</b> please upgrade to the <a href="http://smashballoon.com/custom-facebook-feed/" target="_blank">Pro version</a> of the plugin.</p>
832
+ <br /><br />
833
+ <a href="http://smashballoon.com/custom-facebook-feed/demo" target="_blank"><img src="<?php echo plugins_url( 'img/pro.png' , __FILE__ ) ?>" /></a>
 
 
 
 
834
  <?php
835
  } //End Style_Page
836
  ?>
custom-facebook-feed.php CHANGED
@@ -3,12 +3,11 @@
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.4.1
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
10
  */
11
-
12
  /*
13
  Copyright 2013 Smash Balloon (email : hey@smashballoon.com)
14
  This program is free software; you can redistribute it and/or modify
@@ -23,25 +22,19 @@ You should have received a copy of the GNU General Public License
23
  along with this program; if not, write to the Free Software
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
-
27
  //Include admin
28
  include dirname( __FILE__ ) .'/custom-facebook-feed-admin.php';
29
-
30
  // Add shortcodes
31
  add_shortcode('custom-facebook-feed', 'display_cff');
32
  function display_cff($atts) {
33
 
34
  //Style options
35
  $options = get_option('cff_style_settings');
36
-
37
-
38
  /********** GENERAL **********/
39
-
40
  $cff_feed_width = $options[ 'cff_feed_width' ];
41
  $cff_feed_height = $options[ 'cff_feed_height' ];
42
  $cff_feed_padding = $options[ 'cff_feed_padding' ];
43
  $cff_bg_color = $options[ 'cff_bg_color' ];
44
-
45
  //Compile feed styles
46
  $cff_feed_styles = 'style="';
47
  if ( !empty($cff_feed_width) ) $cff_feed_styles .= 'width:' . $cff_feed_width . '; ';
@@ -49,18 +42,13 @@ function display_cff($atts) {
49
  if ( !empty($cff_feed_padding) ) $cff_feed_styles .= 'padding:' . $cff_feed_padding . '; ';
50
  if ( !empty($cff_bg_color) ) $cff_feed_styles .= 'background-color:#' . $cff_bg_color . '; ';
51
  $cff_feed_styles .= '"';
52
-
53
  //Like box
54
  $cff_like_box_position = $options[ 'cff_like_box_position' ];
55
-
56
  //Open links in new window?
57
  $cff_open_links = $options[ 'cff_open_links' ];
58
  $target = 'target="_blank"';
59
  if ($cff_open_links) $target = 'target="_blank"';
60
-
61
-
62
  /********** LAYOUT **********/
63
-
64
  //Include
65
  $cff_show_text = $options[ 'cff_show_text' ];
66
  $cff_show_desc = $options[ 'cff_show_desc' ];
@@ -69,10 +57,7 @@ function display_cff($atts) {
69
  $cff_show_event_details = $options[ 'cff_show_event_details' ];
70
  $cff_show_link = $options[ 'cff_show_link' ];
71
  $cff_show_like_box = $options[ 'cff_show_like_box' ];
72
-
73
-
74
  /********** TYPOGRAPHY **********/
75
-
76
  //Title
77
  $cff_title_format = $options[ 'cff_title_format' ];
78
  if (empty($cff_title_format)) $cff_title_format = 'p';
@@ -84,6 +69,7 @@ function display_cff($atts) {
84
  if ( !empty($cff_title_weight) && $cff_title_weight != 'inherit' ) $cff_title_styles .= 'font-weight:' . $cff_title_weight . '; ';
85
  if ( !empty($cff_title_color) ) $cff_title_styles .= 'color:#' . $cff_title_color . ';';
86
  $cff_title_styles .= '"';
 
87
 
88
  //Description
89
  $cff_body_size = $options[ 'cff_body_size' ];
@@ -94,7 +80,6 @@ function display_cff($atts) {
94
  if ( !empty($cff_body_weight) && $cff_body_weight != 'inherit' ) $cff_body_styles .= 'font-weight:' . $cff_body_weight . '; ';
95
  if ( !empty($cff_body_color) ) $cff_body_styles .= 'color:#' . $cff_body_color . ';';
96
  $cff_body_styles .= '"';
97
-
98
  //Event Title
99
  $cff_event_title_format = $options[ 'cff_event_title_format' ];
100
  if (empty($cff_event_title_format)) $cff_event_title_format = 'p';
@@ -106,7 +91,8 @@ function display_cff($atts) {
106
  if ( !empty($cff_event_title_weight) && $cff_event_title_weight != 'inherit' ) $cff_event_title_styles .= 'font-weight:' . $cff_event_title_weight . '; ';
107
  if ( !empty($cff_event_title_color) ) $cff_event_title_styles .= 'color:#' . $cff_event_title_color . ';';
108
  $cff_event_title_styles .= '"';
109
-
 
110
  //Event Details
111
  $cff_event_details_size = $options[ 'cff_event_details_size' ];
112
  $cff_event_details_weight = $options[ 'cff_event_details_weight' ];
@@ -116,7 +102,6 @@ function display_cff($atts) {
116
  if ( !empty($cff_event_details_weight) && $cff_event_details_weight != 'inherit' ) $cff_event_details_styles .= 'font-weight:' . $cff_event_details_weight . '; ';
117
  if ( !empty($cff_event_details_color) ) $cff_event_details_styles .= 'color:#' . $cff_event_details_color . ';';
118
  $cff_event_details_styles .= '"';
119
-
120
  //Date
121
  $cff_date_size = $options[ 'cff_date_size' ];
122
  $cff_date_weight = $options[ 'cff_date_weight' ];
@@ -126,7 +111,6 @@ function display_cff($atts) {
126
  if ( !empty($cff_date_weight) && $cff_date_weight != 'inherit' ) $cff_date_styles .= 'font-weight:' . $cff_date_weight . '; ';
127
  if ( !empty($cff_date_color) ) $cff_date_styles .= 'color:#' . $cff_date_color . ';';
128
  $cff_date_styles .= '"';
129
-
130
  //Link to Facebook
131
  $cff_link_size = $options[ 'cff_link_size' ];
132
  $cff_link_weight = $options[ 'cff_link_weight' ];
@@ -136,19 +120,25 @@ function display_cff($atts) {
136
  if ( !empty($cff_link_weight) && $cff_link_weight != 'inherit' ) $cff_link_styles .= 'font-weight:' . $cff_link_weight . '; ';
137
  if ( !empty($cff_link_color) ) $cff_link_styles .= 'color:#' . $cff_link_color . ';';
138
  $cff_link_styles .= '"';
139
-
140
-
141
  /********** MISC **********/
142
-
143
  //Like Box styles
144
  $cff_likebox_bg_color = $options[ 'cff_likebox_bg_color' ];
145
  $cff_likebox_styles = 'style="';
146
  if ( !empty($cff_likebox_bg_color) ) $cff_likebox_styles .= 'background-color:#' . $cff_likebox_bg_color . '; margin-left: 0; ';
147
  $cff_likebox_styles .= '"';
148
 
149
-
 
 
 
 
150
 
 
 
 
 
151
 
 
152
  //Pass in shortcode attrbutes
153
  $atts = shortcode_atts(
154
  array(
@@ -157,15 +147,12 @@ function display_cff($atts) {
157
  'titlelength' => get_option('cff_title_length'),
158
  'bodylength' => get_option('cff_body_length')
159
  ), $atts);
160
-
161
  //Text limits
162
  $title_limit = $atts['titlelength'];
163
  $body_limit = $atts['bodylength'];
164
-
165
  //Assign the Access Token and Page ID variables
166
  $access_token = get_option('cff_access_token');
167
  $page_id = $atts['id'];
168
-
169
  //Get show posts attribute. If not set then default to 10.
170
  $show_posts = $atts['show'];
171
  if ( $show_posts == 0 || $show_posts == undefined ) $show_posts = 10;
@@ -187,15 +174,12 @@ function display_cff($atts) {
187
  //Set like box variable
188
  $like_box = '<div class="cff-likebox" ' . $cff_likebox_styles . '><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like-box href="http://www.facebook.com/' . $page_id . '" width="300" show_faces="false" stream="false" header="true"></fb:like-box></div>';
189
 
190
-
191
-
192
  //***START FEED***
193
  //Create HTML
194
  $content = '<div id="cff" class="';
195
  if ( !empty($cff_feed_height) ) $content .= 'fixed-height ';
196
  $content .= '"' . $cff_feed_styles . '>';
197
 
198
-
199
  //Add like box to top of feed
200
  if ($cff_like_box_position == 'top' && $cff_show_like_box) $content .= $like_box;
201
  //Limit var
@@ -211,14 +195,13 @@ function display_cff($atts) {
211
  //Only create posts for the amount of posts specified
212
  if ( $i == $show_posts ) break;
213
  $i++;
214
-
215
-
216
  //********************************//
217
  //***COMPILE SECTION VARIABLES***//
218
  //********************************//
219
-
220
  //POST TEXT
221
- $cff_post_text = '<' . $cff_title_format . ' ' . $cff_title_styles . '">';
 
 
222
  if (!empty($news->story)) {
223
  $story_text = $news->story;
224
  if (!empty($title_limit)) {
@@ -238,9 +221,12 @@ function display_cff($atts) {
238
  if (!empty($title_limit)) {
239
  if (strlen($name_text) > $title_limit) $name_text = substr($name_text, 0, $title_limit) . '...';
240
  }
241
- $cff_post_text .= cff_make_clickable($name_text);
 
242
  }
243
  $cff_post_text .= '</' . $cff_title_format . '>';
 
 
244
 
245
  //DESCRIPTION
246
  $cff_description = '';
@@ -251,7 +237,6 @@ function display_cff($atts) {
251
  }
252
  $cff_description .= '<p '.$cff_body_styles.'>' . cff_make_clickable($description_text) . '</p>';
253
  }
254
-
255
  //LINK
256
  $cff_shared_link = '';
257
  //Display shared link
@@ -261,10 +246,8 @@ function display_cff($atts) {
261
  $cff_shared_link .= '<p class="text-link no-image"><a href="'.$news->link.'" '.$target.'>'. '<b>' . $news->name . '</b></a></p>';
262
  }
263
  }
264
-
265
  //DATE
266
  $cff_date = '<p class="cff-date" '.$cff_date_styles.'>Posted '. cff_timeSince(strtotime($news->created_time)) . ' ago</p>';
267
-
268
  //EVENT
269
  $cff_event = '';
270
  if ($cff_show_event_title || $cff_show_event_details) {
@@ -295,7 +278,11 @@ function display_cff($atts) {
295
  //Display the event details
296
  $cff_event = '<div class="details">';
297
  //Show event title
298
- if ($cff_show_event_title && !empty($event_object->name)) $cff_event .= '<' . $cff_event_title_format . ' ' . $cff_event_title_styles . '>' . $event_object->name . '</' . $cff_event_title_format . '>';
 
 
 
 
299
  //Show event details
300
  if ($cff_show_event_details){
301
  if (!empty($event_object->location)) $cff_event .= '<p ' . $cff_event_details_styles . '>Where: ' . $event_object->location . '</p>';
@@ -312,8 +299,6 @@ function display_cff($atts) {
312
  }
313
  }
314
  }
315
-
316
-
317
  //LINK
318
  //Display the link to the Facebook post or external link
319
  $cff_link = '';
@@ -328,59 +313,38 @@ function display_cff($atts) {
328
  }
329
  $cff_link = '<div class="meta-wrap"><a class="cff-viewpost" href="' . $link . '" title="' . $link_text . '" ' . $target . ' ' . $cff_link_styles . '>' . $link_text . '</a></div><!-- end .meta-wrap -->';
330
  }
331
-
332
-
333
-
334
  //**************************//
335
  //***CREATE THE POST HTML***//
336
  //**************************//
337
-
338
  //Start the container
339
  $content .= '<div class="cff-item ';
340
  if ($news->type == 'link') $content .= 'link-item';
341
- $content .= '">';
342
-
343
-
344
 
345
  //POST TEXT
346
  if($cff_show_text) $content .= $cff_post_text;
347
-
348
  //DESCRIPTION
349
  if($cff_show_desc) $content .= $cff_description;
350
-
351
  //LINK
352
  if($cff_show_desc) $content .= $cff_shared_link;
353
 
354
  //EVENT
355
  if($cff_show_event_title || $cff_show_event_details) $content .= $cff_event;
356
-
357
  //DATE
358
  if($cff_show_date) $content .= $cff_date;
359
-
360
  //LINK
361
  if($cff_show_link) $content .= $cff_link;
362
-
363
-
364
  //End the post item
365
  $content .= '</div><div class="clear"></div> <!-- end .cff-item -->';
366
-
367
-
368
-
369
-
370
  } // End status check
371
-
372
  } // End the loop
373
-
374
  //Add the Like Box
375
  if ($cff_like_box_position == 'bottom' && $cff_show_like_box) $content .= $like_box;
376
-
377
  //End the feed
378
  $content .= '</div><div class="clear"></div> <!-- end .Custom Facebook Feed -->';
379
-
380
  //Return our feed HTML to display
381
  return $content;
382
  }
383
-
384
  //Get JSON object of feed data
385
  function fetchUrl($url){
386
  //Can we use cURL?
@@ -405,10 +369,7 @@ function fetchUrl($url){
405
 
406
  return $feedData;
407
  }
408
-
409
-
410
  //***FUNCTIONS***
411
-
412
  //Make links in text clickable
413
  function cff_make_url_clickable($matches) {
414
  $target = 'target="_blank"';
@@ -455,8 +416,6 @@ function cff_make_clickable($ret) {
455
  $ret = trim($ret);
456
  return $ret;
457
  }
458
-
459
-
460
  //Time stamp function
461
  function cff_timeSince($original) {
462
  // Array of time period
@@ -499,8 +458,6 @@ function cff_timeSince($original) {
499
  }
500
  return $print;
501
  }
502
-
503
-
504
  //Enqueue stylesheet
505
  add_action( 'wp_enqueue_scripts', 'cff_add_my_stylesheet' );
506
  function cff_add_my_stylesheet() {
@@ -508,15 +465,10 @@ function cff_add_my_stylesheet() {
508
  wp_register_style( 'cff', plugins_url('css/cff-style.css', __FILE__) );
509
  wp_enqueue_style( 'cff' );
510
  }
511
-
512
-
513
  //Allows shortcodes in sidebar of theme
514
  add_filter('widget_text', 'do_shortcode');
515
-
516
-
517
  function cff_activate() {
518
  $options = get_option('cff_style_settings');
519
-
520
  //Show all parts of the feed by default on activation
521
  $options[ 'cff_show_text' ] = true;
522
  $options[ 'cff_show_desc' ] = true;
@@ -526,11 +478,11 @@ function cff_activate() {
526
  $options[ 'cff_show_link' ] = true;
527
  $options[ 'cff_show_like_box' ] = true;
528
 
 
 
529
  update_option( 'cff_style_settings', $options );
530
  }
531
  register_activation_hook( __FILE__, 'cff_activate' );
532
-
533
-
534
  //Uninstall
535
  function cff_uninstall()
536
  {
@@ -546,6 +498,22 @@ function cff_uninstall()
546
  register_uninstall_hook( __FILE__, 'cff_uninstall' );
547
 
548
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
549
  //Comment out the line below to view errors
550
  error_reporting(0);
551
  ?>
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.4.2
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
10
  */
 
11
  /*
12
  Copyright 2013 Smash Balloon (email : hey@smashballoon.com)
13
  This program is free software; you can redistribute it and/or modify
22
  along with this program; if not, write to the Free Software
23
  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
  // Add shortcodes
28
  add_shortcode('custom-facebook-feed', 'display_cff');
29
  function display_cff($atts) {
30
 
31
  //Style options
32
  $options = get_option('cff_style_settings');
 
 
33
  /********** GENERAL **********/
 
34
  $cff_feed_width = $options[ 'cff_feed_width' ];
35
  $cff_feed_height = $options[ 'cff_feed_height' ];
36
  $cff_feed_padding = $options[ 'cff_feed_padding' ];
37
  $cff_bg_color = $options[ 'cff_bg_color' ];
 
38
  //Compile feed styles
39
  $cff_feed_styles = 'style="';
40
  if ( !empty($cff_feed_width) ) $cff_feed_styles .= 'width:' . $cff_feed_width . '; ';
42
  if ( !empty($cff_feed_padding) ) $cff_feed_styles .= 'padding:' . $cff_feed_padding . '; ';
43
  if ( !empty($cff_bg_color) ) $cff_feed_styles .= 'background-color:#' . $cff_bg_color . '; ';
44
  $cff_feed_styles .= '"';
 
45
  //Like box
46
  $cff_like_box_position = $options[ 'cff_like_box_position' ];
 
47
  //Open links in new window?
48
  $cff_open_links = $options[ 'cff_open_links' ];
49
  $target = 'target="_blank"';
50
  if ($cff_open_links) $target = 'target="_blank"';
 
 
51
  /********** LAYOUT **********/
 
52
  //Include
53
  $cff_show_text = $options[ 'cff_show_text' ];
54
  $cff_show_desc = $options[ 'cff_show_desc' ];
57
  $cff_show_event_details = $options[ 'cff_show_event_details' ];
58
  $cff_show_link = $options[ 'cff_show_link' ];
59
  $cff_show_like_box = $options[ 'cff_show_like_box' ];
 
 
60
  /********** TYPOGRAPHY **********/
 
61
  //Title
62
  $cff_title_format = $options[ 'cff_title_format' ];
63
  if (empty($cff_title_format)) $cff_title_format = 'p';
69
  if ( !empty($cff_title_weight) && $cff_title_weight != 'inherit' ) $cff_title_styles .= 'font-weight:' . $cff_title_weight . '; ';
70
  if ( !empty($cff_title_color) ) $cff_title_styles .= 'color:#' . $cff_title_color . ';';
71
  $cff_title_styles .= '"';
72
+ $cff_title_link = $options[ 'cff_title_link' ];
73
 
74
  //Description
75
  $cff_body_size = $options[ 'cff_body_size' ];
80
  if ( !empty($cff_body_weight) && $cff_body_weight != 'inherit' ) $cff_body_styles .= 'font-weight:' . $cff_body_weight . '; ';
81
  if ( !empty($cff_body_color) ) $cff_body_styles .= 'color:#' . $cff_body_color . ';';
82
  $cff_body_styles .= '"';
 
83
  //Event Title
84
  $cff_event_title_format = $options[ 'cff_event_title_format' ];
85
  if (empty($cff_event_title_format)) $cff_event_title_format = 'p';
91
  if ( !empty($cff_event_title_weight) && $cff_event_title_weight != 'inherit' ) $cff_event_title_styles .= 'font-weight:' . $cff_event_title_weight . '; ';
92
  if ( !empty($cff_event_title_color) ) $cff_event_title_styles .= 'color:#' . $cff_event_title_color . ';';
93
  $cff_event_title_styles .= '"';
94
+ $cff_event_title_link = $options[ 'cff_event_title_link' ];
95
+
96
  //Event Details
97
  $cff_event_details_size = $options[ 'cff_event_details_size' ];
98
  $cff_event_details_weight = $options[ 'cff_event_details_weight' ];
102
  if ( !empty($cff_event_details_weight) && $cff_event_details_weight != 'inherit' ) $cff_event_details_styles .= 'font-weight:' . $cff_event_details_weight . '; ';
103
  if ( !empty($cff_event_details_color) ) $cff_event_details_styles .= 'color:#' . $cff_event_details_color . ';';
104
  $cff_event_details_styles .= '"';
 
105
  //Date
106
  $cff_date_size = $options[ 'cff_date_size' ];
107
  $cff_date_weight = $options[ 'cff_date_weight' ];
111
  if ( !empty($cff_date_weight) && $cff_date_weight != 'inherit' ) $cff_date_styles .= 'font-weight:' . $cff_date_weight . '; ';
112
  if ( !empty($cff_date_color) ) $cff_date_styles .= 'color:#' . $cff_date_color . ';';
113
  $cff_date_styles .= '"';
 
114
  //Link to Facebook
115
  $cff_link_size = $options[ 'cff_link_size' ];
116
  $cff_link_weight = $options[ 'cff_link_weight' ];
120
  if ( !empty($cff_link_weight) && $cff_link_weight != 'inherit' ) $cff_link_styles .= 'font-weight:' . $cff_link_weight . '; ';
121
  if ( !empty($cff_link_color) ) $cff_link_styles .= 'color:#' . $cff_link_color . ';';
122
  $cff_link_styles .= '"';
 
 
123
  /********** MISC **********/
 
124
  //Like Box styles
125
  $cff_likebox_bg_color = $options[ 'cff_likebox_bg_color' ];
126
  $cff_likebox_styles = 'style="';
127
  if ( !empty($cff_likebox_bg_color) ) $cff_likebox_styles .= 'background-color:#' . $cff_likebox_bg_color . '; margin-left: 0; ';
128
  $cff_likebox_styles .= '"';
129
 
130
+ //Separating Line
131
+ $cff_sep_color = $options[ 'cff_sep_color' ];
132
+ if (empty($cff_sep_color)) $cff_sep_color = 'ddd';
133
+ $cff_sep_size = $options[ 'cff_sep_size' ];
134
+ if (empty($cff_sep_size)) $cff_sep_size = 0;
135
 
136
+ //CFF item styles
137
+ $cff_item_styles = 'style="';
138
+ $cff_item_styles .= 'border-bottom: ' . $cff_sep_size . 'px solid #' . $cff_sep_color . '; ';
139
+ $cff_item_styles .= '"';
140
 
141
+
142
  //Pass in shortcode attrbutes
143
  $atts = shortcode_atts(
144
  array(
147
  'titlelength' => get_option('cff_title_length'),
148
  'bodylength' => get_option('cff_body_length')
149
  ), $atts);
 
150
  //Text limits
151
  $title_limit = $atts['titlelength'];
152
  $body_limit = $atts['bodylength'];
 
153
  //Assign the Access Token and Page ID variables
154
  $access_token = get_option('cff_access_token');
155
  $page_id = $atts['id'];
 
156
  //Get show posts attribute. If not set then default to 10.
157
  $show_posts = $atts['show'];
158
  if ( $show_posts == 0 || $show_posts == undefined ) $show_posts = 10;
174
  //Set like box variable
175
  $like_box = '<div class="cff-likebox" ' . $cff_likebox_styles . '><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like-box href="http://www.facebook.com/' . $page_id . '" width="300" show_faces="false" stream="false" header="true"></fb:like-box></div>';
176
 
 
 
177
  //***START FEED***
178
  //Create HTML
179
  $content = '<div id="cff" class="';
180
  if ( !empty($cff_feed_height) ) $content .= 'fixed-height ';
181
  $content .= '"' . $cff_feed_styles . '>';
182
 
 
183
  //Add like box to top of feed
184
  if ($cff_like_box_position == 'top' && $cff_show_like_box) $content .= $like_box;
185
  //Limit var
195
  //Only create posts for the amount of posts specified
196
  if ( $i == $show_posts ) break;
197
  $i++;
 
 
198
  //********************************//
199
  //***COMPILE SECTION VARIABLES***//
200
  //********************************//
 
201
  //POST TEXT
202
+ $cff_post_text = '';
203
+ if ($cff_title_link) $cff_post_text .= '<a href="'.$news->link.'">';
204
+ $cff_post_text .= '<' . $cff_title_format . ' class="cff-post-text" ' . $cff_title_styles . '>';
205
  if (!empty($news->story)) {
206
  $story_text = $news->story;
207
  if (!empty($title_limit)) {
221
  if (!empty($title_limit)) {
222
  if (strlen($name_text) > $title_limit) $name_text = substr($name_text, 0, $title_limit) . '...';
223
  }
224
+ //Only show name as last resort if both story and message are empty
225
+ if ( empty($news->story) && empty($news->message) ) $cff_post_text .= cff_make_clickable($name_text);
226
  }
227
  $cff_post_text .= '</' . $cff_title_format . '>';
228
+ if ($cff_title_link) $cff_post_text .= '</a>';
229
+
230
 
231
  //DESCRIPTION
232
  $cff_description = '';
237
  }
238
  $cff_description .= '<p '.$cff_body_styles.'>' . cff_make_clickable($description_text) . '</p>';
239
  }
 
240
  //LINK
241
  $cff_shared_link = '';
242
  //Display shared link
246
  $cff_shared_link .= '<p class="text-link no-image"><a href="'.$news->link.'" '.$target.'>'. '<b>' . $news->name . '</b></a></p>';
247
  }
248
  }
 
249
  //DATE
250
  $cff_date = '<p class="cff-date" '.$cff_date_styles.'>Posted '. cff_timeSince(strtotime($news->created_time)) . ' ago</p>';
 
251
  //EVENT
252
  $cff_event = '';
253
  if ($cff_show_event_title || $cff_show_event_details) {
278
  //Display the event details
279
  $cff_event = '<div class="details">';
280
  //Show event title
281
+ if ($cff_show_event_title && !empty($event_object->name)) {
282
+ if ($cff_event_title_link) $cff_event .= '<a href="'.$news->link.'">';
283
+ $cff_event .= '<' . $cff_event_title_format . ' ' . $cff_event_title_styles . '>' . $event_object->name . '</' . $cff_event_title_format . '>';
284
+ if ($cff_event_title_link) $cff_event .= '</a>';
285
+ }
286
  //Show event details
287
  if ($cff_show_event_details){
288
  if (!empty($event_object->location)) $cff_event .= '<p ' . $cff_event_details_styles . '>Where: ' . $event_object->location . '</p>';
299
  }
300
  }
301
  }
 
 
302
  //LINK
303
  //Display the link to the Facebook post or external link
304
  $cff_link = '';
313
  }
314
  $cff_link = '<div class="meta-wrap"><a class="cff-viewpost" href="' . $link . '" title="' . $link_text . '" ' . $target . ' ' . $cff_link_styles . '>' . $link_text . '</a></div><!-- end .meta-wrap -->';
315
  }
 
 
 
316
  //**************************//
317
  //***CREATE THE POST HTML***//
318
  //**************************//
 
319
  //Start the container
320
  $content .= '<div class="cff-item ';
321
  if ($news->type == 'link') $content .= 'link-item';
322
+ $content .= '" ' . $cff_item_styles . '>';
 
 
323
 
324
  //POST TEXT
325
  if($cff_show_text) $content .= $cff_post_text;
 
326
  //DESCRIPTION
327
  if($cff_show_desc) $content .= $cff_description;
 
328
  //LINK
329
  if($cff_show_desc) $content .= $cff_shared_link;
330
 
331
  //EVENT
332
  if($cff_show_event_title || $cff_show_event_details) $content .= $cff_event;
 
333
  //DATE
334
  if($cff_show_date) $content .= $cff_date;
 
335
  //LINK
336
  if($cff_show_link) $content .= $cff_link;
 
 
337
  //End the post item
338
  $content .= '</div><div class="clear"></div> <!-- end .cff-item -->';
 
 
 
 
339
  } // End status check
 
340
  } // End the loop
 
341
  //Add the Like Box
342
  if ($cff_like_box_position == 'bottom' && $cff_show_like_box) $content .= $like_box;
 
343
  //End the feed
344
  $content .= '</div><div class="clear"></div> <!-- end .Custom Facebook Feed -->';
 
345
  //Return our feed HTML to display
346
  return $content;
347
  }
 
348
  //Get JSON object of feed data
349
  function fetchUrl($url){
350
  //Can we use cURL?
369
 
370
  return $feedData;
371
  }
 
 
372
  //***FUNCTIONS***
 
373
  //Make links in text clickable
374
  function cff_make_url_clickable($matches) {
375
  $target = 'target="_blank"';
416
  $ret = trim($ret);
417
  return $ret;
418
  }
 
 
419
  //Time stamp function
420
  function cff_timeSince($original) {
421
  // Array of time period
458
  }
459
  return $print;
460
  }
 
 
461
  //Enqueue stylesheet
462
  add_action( 'wp_enqueue_scripts', 'cff_add_my_stylesheet' );
463
  function cff_add_my_stylesheet() {
465
  wp_register_style( 'cff', plugins_url('css/cff-style.css', __FILE__) );
466
  wp_enqueue_style( 'cff' );
467
  }
 
 
468
  //Allows shortcodes in sidebar of theme
469
  add_filter('widget_text', 'do_shortcode');
 
 
470
  function cff_activate() {
471
  $options = get_option('cff_style_settings');
 
472
  //Show all parts of the feed by default on activation
473
  $options[ 'cff_show_text' ] = true;
474
  $options[ 'cff_show_desc' ] = true;
478
  $options[ 'cff_show_link' ] = true;
479
  $options[ 'cff_show_like_box' ] = true;
480
 
481
+ $options[ 'cff_sep_size' ] = '1';
482
+
483
  update_option( 'cff_style_settings', $options );
484
  }
485
  register_activation_hook( __FILE__, 'cff_activate' );
 
 
486
  //Uninstall
487
  function cff_uninstall()
488
  {
498
  register_uninstall_hook( __FILE__, 'cff_uninstall' );
499
 
500
 
501
+ add_action( 'wp_head', 'cff_custom_css' );
502
+ function cff_custom_css() {
503
+ $options = get_option('cff_style_settings');
504
+ $cff_custom_css = $options[ 'cff_custom_css' ];
505
+
506
+ echo '<!-- Custom Facebook Feed Custom CSS -->';
507
+ echo "\r\n";
508
+ echo '<style type="text/css">';
509
+ echo "\r\n";
510
+ echo $cff_custom_css;
511
+ echo "\r\n";
512
+ echo '</style>';
513
+ echo "\r\n";
514
+ }
515
+
516
+
517
  //Comment out the line below to view errors
518
  error_reporting(0);
519
  ?>
img/pro.png ADDED
Binary file