Custom Facebook Feed - Version 1.5.1

Version Description

  • New: Added a 'See More' link to expand any text which is longer than the character limit defined
  • New: Choose to show posts by other people in your feed
  • New: Option to show the post author's profile picture and name above each post
  • New: Added options to customize and format the post date
  • New: Add your own text before and after the date and in place of the 'View on Facebook' and 'View Link' links
  • New: Specify the format of the Event date
  • Tweak: Default date format is less specific and better mimics Facebook's - credit Mark Bebbington
  • Tweak: Changed the layout of the Typography section to allow for the additional options
  • Fix: When a photo album is shared it now links to the album itself and not just the cover photo
  • Fix: Fixed issue with hyperlinks in post text which don't have a space before them not being converted to links
Download this release

Release Info

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

Code changes from version 1.4.8 to 1.5.1

README.txt CHANGED
@@ -1,33 +1,38 @@
1
  === Custom Facebook Feed ===
2
  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.6
6
- Stable tag: 1.4.8
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
- The Custom Facebook Feed allows you to display a customizable Facebook feed of any public Facebook page on your website.
11
 
12
  == Description ==
13
 
14
- Display a **customizable**, **responsive** and **search engine crawlable** version of your Facebook feed on your website. Completely match the look and feel of the site!
15
 
16
  = Features =
17
 
18
  * **Completely Customizable** - By default the Facebook feed will adopt the style of your website, but can be completely customized to look however you like - with tons of styling options and custom CSS!
19
  * Facebook 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
- * Display **feeds from multiple Facebook pages** and use the shortcode to embed them into a page, post or widget anywhere on your site
22
  * Show **events** from your Facebook feed with name, date/time, location and description
23
  * Add your own **custom CSS**
24
  * Show and hide certain parts of each post
 
 
25
  * Control the width, height, padding and background color of your Facebook feed
26
  * Customize the size, weight and color of text
 
 
 
27
  * Select the number of posts to display
28
  * Set a maximum character length for both the post title and body text
29
 
30
- To display photos, videos, the number of likes, shares and comments for each Facebook post, multiple layout options and more 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").
31
 
32
  == Installation ==
33
 
@@ -35,7 +40,7 @@ To display photos, videos, the number of likes, shares and comments for each Fac
35
  2. Activate the plugin through the 'Plugins' menu in WordPress.
36
  3. Navigate to the 'Facebook Feed' settings page to configure your feed.
37
  4. Use the shortcode `[custom-facebook-feed]` in your page, post or widget to display your feed.
38
- 5. You can display multiple feeds of different Facebook pages by specifying a Page ID directly in the shortcode: `[custom-facebook-feed id=SarahsBakery num=5]`.
39
 
40
  == Frequently Asked Questions ==
41
 
@@ -81,13 +86,26 @@ You can embed the feed directly into a template file by using the WordPress do_s
81
  2. Completely customize the way your Facebook feed looks to perfectly match your site
82
  3. Use custom CSS to customize every part of the Facebook feed
83
  4. Display Facebook events
84
- 5. Configuring the plugin
85
- 6. Use the styling options to customize your Facebook feed
86
- 7. It's super easy to display your Facebook feed in any page or post
87
- 8. Add the shortcode to a widget
 
88
 
89
  == Changelog ==
90
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  = 1.4.8 =
92
  * Minor fixes
93
 
1
  === Custom Facebook Feed ===
2
  Contributors: smashballoon
3
+ Tags: facebook, custom, customizable, feed, events, seo, search engine, responsive, mobile, shortcode, social, status
4
  Requires at least: 3.0
5
+ Tested up to: 3.6.1
6
+ Stable tag: 1.5.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
+ The Custom Facebook Feed allows you to display a completely customizable Facebook feed of any public Facebook page on your website.
11
 
12
  == Description ==
13
 
14
+ Display a **completely customizable**, **responsive** and **search engine crawlable** version of your Facebook feed on your website. Completely match the look and feel of the site!
15
 
16
  = Features =
17
 
18
  * **Completely Customizable** - By default the Facebook feed will adopt the style of your website, but can be completely customized to look however you like - with tons of styling options and custom CSS!
19
  * Facebook 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
+ * Display **feeds from multiple different Facebook pages** and use the shortcode to embed them into a page, post or widget anywhere on your site
22
  * Show **events** from your Facebook feed with name, date/time, location and description
23
  * Add your own **custom CSS**
24
  * Show and hide certain parts of each post
25
+ * Choose to show the profile picture and name above each post
26
+ * Select whether to display posts by just the page owner, or everyone
27
  * Control the width, height, padding and background color of your Facebook feed
28
  * Customize the size, weight and color of text
29
+ * Select from a range of date formats or enter your own
30
+ * Use your own custom link text
31
+ * Use the shortcode options to style multiple feeds in completely different ways
32
  * Select the number of posts to display
33
  * Set a maximum character length for both the post title and body text
34
 
35
+ To display photos, videos, the number of likes, shares and comments for each Facebook post, multiple layout options and more then [upgrade to the Pro version](http://smashballoon.com/custom-facebook-feed/ "Custom Facebook Feed Pro"). Try out the [Pro demo](http://smashballoon.com/custom-facebook-feed/demo "Custom Facebook Feed Demo").
36
 
37
  == Installation ==
38
 
40
  2. Activate the plugin through the 'Plugins' menu in WordPress.
41
  3. Navigate to the 'Facebook Feed' settings page to configure your feed.
42
  4. Use the shortcode `[custom-facebook-feed]` in your page, post or widget to display your feed.
43
+ 5. You can display multiple feeds of different Facebook pages by specifying a Page ID directly in the shortcode: `[custom-facebook-feed id=smashballoon num=5]`.
44
 
45
  == Frequently Asked Questions ==
46
 
86
  2. Completely customize the way your Facebook feed looks to perfectly match your site
87
  3. Use custom CSS to customize every part of the Facebook feed
88
  4. Display Facebook events
89
+ 5. Show and hide certain parts of the posts
90
+ 6. Configuring the plugin
91
+ 7. Use the styling options to customize your Facebook feed
92
+ 8. It's super easy to display your Facebook feed in any page or post
93
+ 9. Add the shortcode to a widget
94
 
95
  == Changelog ==
96
 
97
+ = 1.5.1 =
98
+ * New: Added a 'See More' link to expand any text which is longer than the character limit defined
99
+ * New: Choose to show posts by other people in your feed
100
+ * New: Option to show the post author's profile picture and name above each post
101
+ * New: Added options to customize and format the post date
102
+ * New: Add your own text before and after the date and in place of the 'View on Facebook' and 'View Link' links
103
+ * New: Specify the format of the Event date
104
+ * Tweak: Default date format is less specific and better mimics Facebook's - credit Mark Bebbington
105
+ * Tweak: Changed the layout of the Typography section to allow for the additional options
106
+ * Fix: When a photo album is shared it now links to the album itself and not just the cover photo
107
+ * Fix: Fixed issue with hyperlinks in post text which don't have a space before them not being converted to links
108
+
109
  = 1.4.8 =
110
  * Minor fixes
111
 
css/cff-style.css CHANGED
@@ -47,10 +47,41 @@
47
  /* Date */
48
  #cff .cff-date{
49
  float: left;
50
- width: 100%;
 
51
  font-size: 11px;
52
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  /* Link */
 
 
 
 
54
  /*Link text*/
55
  #cff .text-link{
56
  float: left;
@@ -63,6 +94,9 @@
63
  width: 100%;
64
  margin-left: 0;
65
  }
 
 
 
66
  /* Event */
67
  #cff .details{
68
  float: left;
@@ -85,6 +119,9 @@
85
  #cff .details .when{
86
  font-weight: bold;
87
  }
 
 
 
88
  /*****************/
89
  /*** POST META ***/
90
  /*****************/
@@ -97,7 +134,7 @@
97
  #cff .cff-viewpost{
98
  float: right;
99
  clear: none;
100
- padding-top: 12px;
101
  font-size: 11px;
102
  }
103
  /* Like box */
47
  /* Date */
48
  #cff .cff-date{
49
  float: left;
50
+ clear: left;
51
+ width: auto;
52
  font-size: 11px;
53
  }
54
+
55
+ /************/
56
+ /***AUTHOR***/
57
+ /************/
58
+ #cff .cff-author{
59
+ float: left;
60
+ clear: both;
61
+ display: block;
62
+ margin-bottom: 15px;
63
+ }
64
+ #cff .cff-author img{
65
+ float: left;
66
+ margin-right: 15px;
67
+ }
68
+ #cff .cff-author p{
69
+ float: left;
70
+ clear: none;
71
+ width: auto;
72
+ margin: 0;
73
+ padding-top: 15px;
74
+ font-weight: bold;
75
+ }
76
+ #cff .cff-author a{
77
+ text-decoration: none;
78
+ }
79
+
80
  /* Link */
81
+ #cff .cff-expand{
82
+ font-size: 11px;
83
+ font-weight: normal;
84
+ }
85
  /*Link text*/
86
  #cff .text-link{
87
  float: left;
94
  width: 100%;
95
  margin-left: 0;
96
  }
97
+ #cff .break-word{
98
+ word-break: break-all;
99
+ }
100
  /* Event */
101
  #cff .details{
102
  float: left;
119
  #cff .details .when{
120
  font-weight: bold;
121
  }
122
+ #cff .details .where{
123
+ margin-bottom: -4px;
124
+ }
125
  /*****************/
126
  /*** POST META ***/
127
  /*****************/
134
  #cff .cff-viewpost{
135
  float: right;
136
  clear: none;
137
+ padding-top: 5px;
138
  font-size: 11px;
139
  }
140
  /* Like box */
custom-facebook-feed-admin.php CHANGED
@@ -37,20 +37,28 @@ function cff_settings_page() {
37
  $access_token = 'cff_access_token';
38
  $page_id = 'cff_page_id';
39
  $num_show = 'cff_num_show';
 
 
40
  // Read in existing option value from database
41
  $access_token_val = get_option( $access_token );
42
  $page_id_val = get_option( $page_id );
43
  $num_show_val = get_option( $num_show );
 
 
44
  // See if the user has posted us some information. If they did, this hidden field will be set to 'Y'.
45
  if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) {
46
  // Read their posted value
47
  $access_token_val = $_POST[ $access_token ];
48
  $page_id_val = $_POST[ $page_id ];
49
  $num_show_val = $_POST[ $num_show ];
 
 
50
  // Save the posted value in the database
51
  update_option( $access_token, $access_token_val );
52
  update_option( $page_id, $page_id_val );
53
  update_option( $num_show, $num_show_val );
 
 
54
  // Put an settings updated message on the screen
55
  ?>
56
  <div class="updated"><p><strong><?php _e('Settings saved.', 'custom-facebook-feed' ); ?></strong></p></div>
@@ -83,6 +91,13 @@ function cff_settings_page() {
83
  <input name="cff_num_show" type="text" value="<?php esc_attr_e( $num_show_val ); ?>" size="4" />
84
  </td>
85
  </tr>
 
 
 
 
 
 
 
86
  </tbody>
87
  </table>
88
  <?php submit_button(); ?>
@@ -142,12 +157,23 @@ function cff_style_page() {
142
  'cff_event_details_size' => 'inherit',
143
  'cff_event_details_weight' => 'inherit',
144
  'cff_event_details_color' => '',
 
 
 
 
145
  'cff_date_size' => 'inherit',
146
  'cff_date_weight' => 'inherit',
147
  'cff_date_color' => '',
 
 
 
 
 
148
  'cff_link_size' => 'inherit',
149
  'cff_link_weight' => 'inherit',
150
  'cff_link_color' => '',
 
 
151
  //Misc
152
  'cff_feed_width' => '',
153
  'cff_feed_height' => '',
@@ -155,6 +181,7 @@ function cff_style_page() {
155
  'cff_like_box_position' => 'bottom',
156
  'cff_bg_color' => '',
157
  'cff_likebox_bg_color' => '',
 
158
  //New
159
  'cff_custom_css' => '',
160
  'cff_title_link' => false,
@@ -189,12 +216,24 @@ function cff_style_page() {
189
  $cff_event_details_size = $options[ 'cff_event_details_size' ];
190
  $cff_event_details_weight = $options[ 'cff_event_details_weight' ];
191
  $cff_event_details_color = $options[ 'cff_event_details_color' ];
 
 
 
 
 
192
  $cff_date_size = $options[ 'cff_date_size' ];
193
  $cff_date_weight = $options[ 'cff_date_weight' ];
194
  $cff_date_color = $options[ 'cff_date_color' ];
 
 
 
 
 
195
  $cff_link_size = $options[ 'cff_link_size' ];
196
  $cff_link_weight = $options[ 'cff_link_weight' ];
197
  $cff_link_color = $options[ 'cff_link_color' ];
 
 
198
  //Misc
199
  $cff_feed_width = $options[ 'cff_feed_width' ];
200
  $cff_feed_height = $options[ 'cff_feed_height' ];
@@ -203,6 +242,8 @@ 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
  //New
207
  $cff_custom_css = $options[ 'cff_custom_css' ];
208
  $cff_title_link = $options[ 'cff_title_link' ];
@@ -250,12 +291,24 @@ function cff_style_page() {
250
  $cff_event_details_size = $_POST[ 'cff_event_details_size' ];
251
  $cff_event_details_weight = $_POST[ 'cff_event_details_weight' ];
252
  $cff_event_details_color = $_POST[ 'cff_event_details_color' ];
 
 
 
 
 
253
  $cff_date_size = $_POST[ 'cff_date_size' ];
254
  $cff_date_weight = $_POST[ 'cff_date_weight' ];
255
  $cff_date_color = $_POST[ 'cff_date_color' ];
 
 
 
 
 
256
  $cff_link_size = $_POST[ 'cff_link_size' ];
257
  $cff_link_weight = $_POST[ 'cff_link_weight' ];
258
  $cff_link_color = $_POST[ 'cff_link_color' ];
 
 
259
  //Misc
260
  $cff_feed_width = $_POST[ 'cff_feed_width' ];
261
  $cff_feed_height = $_POST[ 'cff_feed_height' ];
@@ -264,6 +317,8 @@ function cff_style_page() {
264
  $cff_open_links = $_POST[ 'cff_open_links' ];
265
  $cff_bg_color = $_POST[ 'cff_bg_color' ];
266
  $cff_likebox_bg_color = $_POST[ 'cff_likebox_bg_color' ];
 
 
267
  //New
268
  $cff_custom_css = $_POST[ 'cff_custom_css' ];
269
  $cff_title_link = $_POST[ 'cff_title_link' ];
@@ -294,12 +349,24 @@ function cff_style_page() {
294
  $options[ 'cff_event_details_size' ] = $cff_event_details_size;
295
  $options[ 'cff_event_details_weight' ] = $cff_event_details_weight;
296
  $options[ 'cff_event_details_color' ] = $cff_event_details_color;
 
 
 
 
 
297
  $options[ 'cff_date_size' ] = $cff_date_size;
298
  $options[ 'cff_date_weight' ] = $cff_date_weight;
299
  $options[ 'cff_date_color' ] = $cff_date_color;
 
 
 
 
 
300
  $options[ 'cff_link_size' ] = $cff_link_size;
301
  $options[ 'cff_link_weight' ] = $cff_link_weight;
302
  $options[ 'cff_link_color' ] = $cff_link_color;
 
 
303
  //Misc
304
  $options[ 'cff_feed_width' ] = $cff_feed_width;
305
  $options[ 'cff_feed_height' ] = $cff_feed_height;
@@ -308,6 +375,8 @@ function cff_style_page() {
308
  $options[ 'cff_open_links' ] = $cff_open_links;
309
  $options[ 'cff_bg_color' ] = $cff_bg_color;
310
  $options[ 'cff_likebox_bg_color' ] = $cff_likebox_bg_color;
 
 
311
  //New
312
  $options[ 'cff_custom_css' ] = $cff_custom_css;
313
  $options[ 'cff_title_link' ] = $cff_title_link;
@@ -358,6 +427,15 @@ function cff_style_page() {
358
  <span>Eg. ED9A00 <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a></span>
359
  </td>
360
  </tr>
 
 
 
 
 
 
 
 
 
361
  </tbody>
362
  </table>
363
  <br />
@@ -450,12 +528,10 @@ function cff_style_page() {
450
  <h3><?php _e('Typography'); ?></h3>
451
  <table class="form-table">
452
  <tbody>
453
- <tr valign="top">
454
- <th scope="row"><?php _e('Post Text'); ?></th>
455
-
456
- <!-- <p>What does inherit mean?</p> -->
457
  <td>
458
- <label for="cff_title_format">Format</label>
459
  <select name="cff_title_format">
460
  <option value="p" <?php if($cff_title_format == "p") echo 'selected="selected"' ?> >Paragraph</option>
461
  <option value="h3" <?php if($cff_title_format == "h3") echo 'selected="selected"' ?> >Heading 3</option>
@@ -463,8 +539,11 @@ function cff_style_page() {
463
  <option value="h5" <?php if($cff_title_format == "h5") echo 'selected="selected"' ?> >Heading 5</option>
464
  <option value="h6" <?php if($cff_title_format == "h6") echo 'selected="selected"' ?> >Heading 6</option>
465
  </select>
466
- &nbsp;&nbsp;
467
- <label for="cff_title_size">Font Size</label>
 
 
 
468
  <select name="cff_title_size">
469
  <option value="inherit" <?php if($cff_title_size == "inherit") echo 'selected="selected"' ?> >Inherit</option>
470
  <option value="10" <?php if($cff_title_size == "10") echo 'selected="selected"' ?> >10px</option>
@@ -483,30 +562,35 @@ function cff_style_page() {
483
  <option value="60" <?php if($cff_title_size == "54") echo 'selected="selected"' ?> >54px</option>
484
  <option value="60" <?php if($cff_title_size == "60") echo 'selected="selected"' ?> >60px</option>
485
  </select>
486
- &nbsp;&nbsp;
487
- <label for="cff_title_weight">Font Weight</label>
 
 
 
488
  <select name="cff_title_weight">
489
  <option value="inherit" <?php if($cff_title_weight == "inherit") echo 'selected="selected"' ?> >Inherit</option>
490
  <option value="normal" <?php if($cff_title_weight == "normal") echo 'selected="selected"' ?> >Normal</option>
491
  <option value="bold" <?php if($cff_title_weight == "bold") echo 'selected="selected"' ?> >Bold</option>
492
  </select>
493
- &nbsp;&nbsp;
494
- <label for="cff_title_color">Font Color&nbsp;&nbsp;#</label>
495
- <input name="cff_title_color" type="text" value="<?php esc_attr_e( $cff_title_color ); ?>" size="10" placeholder="Eg. ED9A00" />
 
 
 
496
  <span><a href="http://www.colorpicker.com/" target="_blank">Color Picker</a></span>
497
- &nbsp;&nbsp;
498
- <input type="checkbox" name="cff_title_link" id="cff_title_link" <?php if($cff_title_link == true) echo 'checked="checked"' ?> />
499
- <label for="cff_title_link">Link to Facebook post</label>
500
  </td>
501
  </tr>
502
- <tr valign="top">
503
- <th scope="row"><?php _e('Link Description'); ?></th>
504
-
 
 
 
 
 
 
505
  <td>
506
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
507
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
508
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
509
- <label for="cff_body_size">Font Size</label>
510
  <select name="cff_body_size">
511
  <option value="inherit" <?php if($cff_body_size == "inherit") echo 'selected="selected"' ?> >Inherit</option>
512
  <option value="10" <?php if($cff_body_size == "10") echo 'selected="selected"' ?> >10px</option>
@@ -525,24 +609,31 @@ function cff_style_page() {
525
  <option value="60" <?php if($cff_body_size == "54") echo 'selected="selected"' ?> >54px</option>
526
  <option value="60" <?php if($cff_body_size == "60") echo 'selected="selected"' ?> >60px</option>
527
  </select>
528
- &nbsp;&nbsp;
529
- <label for="cff_body_weight">Font Weight</label>
 
 
 
530
  <select name="cff_body_weight">
531
  <option value="inherit" <?php if($cff_body_weight == "inherit") echo 'selected="selected"' ?> >Inherit</option>
532
  <option value="normal" <?php if($cff_body_weight == "normal") echo 'selected="selected"' ?> >Normal</option>
533
  <option value="bold" <?php if($cff_body_weight == "bold") echo 'selected="selected"' ?> >Bold</option>
534
  </select>
535
- &nbsp;&nbsp;
536
- <label for="cff_body_color">Font Color&nbsp;&nbsp;#</label>
537
- <input name="cff_body_color" type="text" value="<?php esc_attr_e( $cff_body_color ); ?>" size="10" placeholder="Eg. ED9A00" />
538
- <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
539
  </td>
540
  </tr>
541
- <tr valign="top">
542
- <th scope="row"><?php _e('Event Title'); ?></th>
543
 
544
  <td>
545
- <label for="cff_event_title_format">Format</label>
 
 
 
 
 
 
 
 
546
  <select name="cff_event_title_format">
547
  <option value="p" <?php if($cff_event_title_format == "p") echo 'selected="selected"' ?> >Paragraph</option>
548
  <option value="h3" <?php if($cff_event_title_format == "h3") echo 'selected="selected"' ?> >Heading 3</option>
@@ -550,8 +641,12 @@ function cff_style_page() {
550
  <option value="h5" <?php if($cff_event_title_format == "h5") echo 'selected="selected"' ?> >Heading 5</option>
551
  <option value="h6" <?php if($cff_event_title_format == "h6") echo 'selected="selected"' ?> >Heading 6</option>
552
  </select>
553
- &nbsp;&nbsp;
554
- <label for="cff_event_title_size">Font Size</label>
 
 
 
 
555
  <select name="cff_event_title_size">
556
  <option value="inherit" <?php if($cff_event_title_size == "inherit") echo 'selected="selected"' ?> >Inherit</option>
557
  <option value="10" <?php if($cff_event_title_size == "10") echo 'selected="selected"' ?> >10px</option>
@@ -570,30 +665,34 @@ function cff_style_page() {
570
  <option value="60" <?php if($cff_event_title_size == "54") echo 'selected="selected"' ?> >54px</option>
571
  <option value="60" <?php if($cff_event_title_size == "60") echo 'selected="selected"' ?> >60px</option>
572
  </select>
573
- &nbsp;&nbsp;
574
- <label for="cff_event_title_weight">Font Weight</label>
 
 
 
575
  <select name="cff_event_title_weight">
576
  <option value="inherit" <?php if($cff_event_title_weight == "inherit") echo 'selected="selected"' ?> >Inherit</option>
577
  <option value="normal" <?php if($cff_event_title_weight == "normal") echo 'selected="selected"' ?> >Normal</option>
578
  <option value="bold" <?php if($cff_event_title_weight == "bold") echo 'selected="selected"' ?> >Bold</option>
579
  </select>
580
- &nbsp;&nbsp;
581
- <label for="cff_event_title_color">Font Color&nbsp;&nbsp;#</label>
 
 
 
582
  <input name="cff_event_title_color" type="text" value="<?php esc_attr_e( $cff_event_title_color ); ?>" size="10" placeholder="Eg. ED9A00" />
583
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
584
- &nbsp;&nbsp;
585
- <input type="checkbox" name="cff_event_title_link" id="cff_event_title_link" <?php if($cff_event_title_link == true) echo 'checked="checked"' ?> />
586
- <label for="cff_event_title_link">Link to Facebook event</label>
587
  </td>
588
  </tr>
589
- <tr valign="top">
590
- <th scope="row"><?php _e('Event Details'); ?></th>
591
-
 
 
 
 
 
592
  <td>
593
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
594
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
595
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
596
- <label for="cff_event_details_size">Font Size</label>
597
  <select name="cff_event_details_size">
598
  <option value="inherit" <?php if($cff_event_details_size == "inherit") echo 'selected="selected"' ?> >Inherit</option>
599
  <option value="10" <?php if($cff_event_details_size == "10") echo 'selected="selected"' ?> >10px</option>
@@ -612,27 +711,67 @@ function cff_style_page() {
612
  <option value="60" <?php if($cff_event_details_size == "54") echo 'selected="selected"' ?> >54px</option>
613
  <option value="60" <?php if($cff_event_details_size == "60") echo 'selected="selected"' ?> >60px</option>
614
  </select>
615
- &nbsp;&nbsp;
616
- <label for="cff_event_details_weight">Font Weight</label>
 
 
 
617
  <select name="cff_event_details_weight">
618
  <option value="inherit" <?php if($cff_event_details_weight == "inherit") echo 'selected="selected"' ?> >Inherit</option>
619
  <option value="normal" <?php if($cff_event_details_weight == "normal") echo 'selected="selected"' ?> >Normal</option>
620
  <option value="bold" <?php if($cff_event_details_weight == "bold") echo 'selected="selected"' ?> >Bold</option>
621
  </select>
622
- &nbsp;&nbsp;
623
- <label for="cff_event_details_color">Font Color&nbsp;&nbsp;#</label>
624
- <input name="cff_event_details_color" type="text" value="<?php esc_attr_e( $cff_event_details_color ); ?>" size="10" placeholder="Eg. ED9A00" />
 
 
 
625
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
626
  </td>
627
  </tr>
628
- <tr valign="top">
629
- <th scope="row"><?php _e('Date'); ?></th>
630
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
631
  <td>
632
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
633
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
634
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
635
- <label for="cff_date_size">Font Size</label>
636
  <select name="cff_date_size">
637
  <option value="inherit" <?php if($cff_date_size == "inherit") echo 'selected="selected"' ?> >Inherit</option>
638
  <option value="10" <?php if($cff_date_size == "10") echo 'selected="selected"' ?> >10px</option>
@@ -651,29 +790,67 @@ function cff_style_page() {
651
  <option value="60" <?php if($cff_date_size == "54") echo 'selected="selected"' ?> >54px</option>
652
  <option value="60" <?php if($cff_date_size == "60") echo 'selected="selected"' ?> >60px</option>
653
  </select>
654
- &nbsp;&nbsp;
655
- <label for="cff_date_weight">Font Weight</label>
 
 
 
656
  <select name="cff_date_weight">
657
  <option value="inherit" <?php if($cff_date_weight == "inherit") echo 'selected="selected"' ?> >Inherit</option>
658
  <option value="normal" <?php if($cff_date_weight == "normal") echo 'selected="selected"' ?> >Normal</option>
659
  <option value="bold" <?php if($cff_date_weight == "bold") echo 'selected="selected"' ?> >Bold</option>
660
  </select>
661
- &nbsp;&nbsp;
662
- <label for="cff_date_color">Font Color&nbsp;&nbsp;#</label>
663
- <input name="cff_date_color" type="text" value="<?php esc_attr_e( $cff_date_color ); ?>" size="10" placeholder="Eg. ED9A00" />
 
 
 
664
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
665
  </td>
666
  </tr>
667
- <tr valign="top">
668
- <th scope="row"><?php _e('Link to Facebook'); ?></th>
669
-
670
- <!-- <p>What does inherit mean?</p> -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
671
 
 
 
672
  <td>
673
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
674
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
675
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
676
- <label for="cff_link_size">Font Size</label>
677
  <select name="cff_link_size">
678
  <option value="inherit" <?php if($cff_link_size == "inherit") echo 'selected="selected"' ?> >Inherit</option>
679
  <option value="10" <?php if($cff_link_size == "10") echo 'selected="selected"' ?> >10px</option>
@@ -692,23 +869,44 @@ function cff_style_page() {
692
  <option value="60" <?php if($cff_link_size == "54") echo 'selected="selected"' ?> >54px</option>
693
  <option value="60" <?php if($cff_link_size == "60") echo 'selected="selected"' ?> >60px</option>
694
  </select>
695
- &nbsp;&nbsp;
696
- <label for="cff_link_weight">Font Weight</label>
 
 
 
697
  <select name="cff_link_weight">
698
  <option value="inherit" <?php if($cff_link_weight == "inherit") echo 'selected="selected"' ?> >Inherit</option>
699
  <option value="normal" <?php if($cff_link_weight == "normal") echo 'selected="selected"' ?> >Normal</option>
700
  <option value="bold" <?php if($cff_link_weight == "bold") echo 'selected="selected"' ?> >Bold</option>
701
  </select>
702
- &nbsp;&nbsp;
703
- <label for="cff_link_color">Font Color&nbsp;&nbsp;#</label>
 
 
 
704
  <input name="cff_link_color" type="text" value="<?php esc_attr_e( $cff_link_color ); ?>" size="10" placeholder="Eg. ED9A00" />
705
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
706
  </td>
707
  </tr>
708
- <tr><i style="color: #666; font-size: 11px; margin-left: 5px;">'Inherit' means that the text will inherit the styles from your theme.</i></tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
709
  </tbody>
710
  </table>
711
  <br />
 
712
  <hr />
713
  <h3><?php _e('Likes, Shares and Comments'); ?></h3>
714
  <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>
37
  $access_token = 'cff_access_token';
38
  $page_id = 'cff_page_id';
39
  $num_show = 'cff_num_show';
40
+ $cff_show_others = 'cff_show_others';
41
+
42
  // Read in existing option value from database
43
  $access_token_val = get_option( $access_token );
44
  $page_id_val = get_option( $page_id );
45
  $num_show_val = get_option( $num_show );
46
+ $cff_show_others_val = get_option( $cff_show_others );
47
+
48
  // See if the user has posted us some information. If they did, this hidden field will be set to 'Y'.
49
  if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) {
50
  // Read their posted value
51
  $access_token_val = $_POST[ $access_token ];
52
  $page_id_val = $_POST[ $page_id ];
53
  $num_show_val = $_POST[ $num_show ];
54
+ $cff_show_others_val = $_POST[ $cff_show_others ];
55
+
56
  // Save the posted value in the database
57
  update_option( $access_token, $access_token_val );
58
  update_option( $page_id, $page_id_val );
59
  update_option( $num_show, $num_show_val );
60
+ update_option( $cff_show_others, $cff_show_others_val );
61
+
62
  // Put an settings updated message on the screen
63
  ?>
64
  <div class="updated"><p><strong><?php _e('Settings saved.', 'custom-facebook-feed' ); ?></strong></p></div>
91
  <input name="cff_num_show" type="text" value="<?php esc_attr_e( $num_show_val ); ?>" size="4" />
92
  </td>
93
  </tr>
94
+ <tr valign="top">
95
+ <th scope="row"><?php _e('Show posts by others on my page'); ?></th>
96
+ <td>
97
+ <input name="cff_show_others" type="checkbox" id="cff_show_others" <?php if($cff_show_others_val == true) echo "checked"; ?> />
98
+ <i style="color: #666; font-size: 11px;">By default only posts by the page owner will be shown. Check this box to also show posts by others.</span>
99
+ </td>
100
+ </tr>
101
  </tbody>
102
  </table>
103
  <?php submit_button(); ?>
157
  'cff_event_details_size' => 'inherit',
158
  'cff_event_details_weight' => 'inherit',
159
  'cff_event_details_color' => '',
160
+ 'cff_event_date_formatting' => '1',
161
+ 'cff_event_date_custom' => '',
162
+ //Date
163
+ 'cff_date_position' => 'below',
164
  'cff_date_size' => 'inherit',
165
  'cff_date_weight' => 'inherit',
166
  'cff_date_color' => '',
167
+ 'cff_date_formatting' => '1',
168
+ 'cff_date_custom' => '',
169
+ 'cff_date_before' => '',
170
+ 'cff_date_after' => '',
171
+ //Link to Facebook
172
  'cff_link_size' => 'inherit',
173
  'cff_link_weight' => 'inherit',
174
  'cff_link_color' => '',
175
+ 'cff_facebook_link_text' => 'View on Facebook',
176
+ 'cff_view_link_text' => 'View Link',
177
  //Misc
178
  'cff_feed_width' => '',
179
  'cff_feed_height' => '',
181
  'cff_like_box_position' => 'bottom',
182
  'cff_bg_color' => '',
183
  'cff_likebox_bg_color' => '',
184
+ 'cff_show_author' => false,
185
  //New
186
  'cff_custom_css' => '',
187
  'cff_title_link' => false,
216
  $cff_event_details_size = $options[ 'cff_event_details_size' ];
217
  $cff_event_details_weight = $options[ 'cff_event_details_weight' ];
218
  $cff_event_details_color = $options[ 'cff_event_details_color' ];
219
+ $cff_event_date_formatting = $options[ 'cff_event_date_formatting' ];
220
+ $cff_event_date_custom = $options[ 'cff_event_date_custom' ];
221
+
222
+ //Date
223
+ $cff_date_position = $options[ 'cff_date_position' ];
224
  $cff_date_size = $options[ 'cff_date_size' ];
225
  $cff_date_weight = $options[ 'cff_date_weight' ];
226
  $cff_date_color = $options[ 'cff_date_color' ];
227
+ $cff_date_formatting = $options[ 'cff_date_formatting' ];
228
+ $cff_date_custom = $options[ 'cff_date_custom' ];
229
+ $cff_date_before = $options[ 'cff_date_before' ];
230
+ $cff_date_after = $options[ 'cff_date_after' ];
231
+ //View on Facebook link
232
  $cff_link_size = $options[ 'cff_link_size' ];
233
  $cff_link_weight = $options[ 'cff_link_weight' ];
234
  $cff_link_color = $options[ 'cff_link_color' ];
235
+ $cff_facebook_link_text = $options[ 'cff_facebook_link_text' ];
236
+ $cff_view_link_text = $options[ 'cff_view_link_text' ];
237
  //Misc
238
  $cff_feed_width = $options[ 'cff_feed_width' ];
239
  $cff_feed_height = $options[ 'cff_feed_height' ];
242
  $cff_open_links = $options[ 'cff_open_links' ];
243
  $cff_bg_color = $options[ 'cff_bg_color' ];
244
  $cff_likebox_bg_color = $options[ 'cff_likebox_bg_color' ];
245
+ $cff_show_author = $options[ 'cff_show_author' ];
246
+
247
  //New
248
  $cff_custom_css = $options[ 'cff_custom_css' ];
249
  $cff_title_link = $options[ 'cff_title_link' ];
291
  $cff_event_details_size = $_POST[ 'cff_event_details_size' ];
292
  $cff_event_details_weight = $_POST[ 'cff_event_details_weight' ];
293
  $cff_event_details_color = $_POST[ 'cff_event_details_color' ];
294
+ $cff_event_date_formatting = $_POST[ 'cff_event_date_formatting' ];
295
+ $cff_event_date_custom = $_POST[ 'cff_event_date_custom' ];
296
+
297
+ //Date
298
+ $cff_date_position = $_POST[ 'cff_date_position' ];
299
  $cff_date_size = $_POST[ 'cff_date_size' ];
300
  $cff_date_weight = $_POST[ 'cff_date_weight' ];
301
  $cff_date_color = $_POST[ 'cff_date_color' ];
302
+ $cff_date_formatting = $_POST[ 'cff_date_formatting' ];
303
+ $cff_date_custom = $_POST[ 'cff_date_custom' ];
304
+ $cff_date_before = $_POST[ 'cff_date_before' ];
305
+ $cff_date_after = $_POST[ 'cff_date_after' ];
306
+ //View on Facebook link
307
  $cff_link_size = $_POST[ 'cff_link_size' ];
308
  $cff_link_weight = $_POST[ 'cff_link_weight' ];
309
  $cff_link_color = $_POST[ 'cff_link_color' ];
310
+ $cff_facebook_link_text = $_POST[ 'cff_facebook_link_text' ];
311
+ $cff_view_link_text = $_POST[ 'cff_view_link_text' ];
312
  //Misc
313
  $cff_feed_width = $_POST[ 'cff_feed_width' ];
314
  $cff_feed_height = $_POST[ 'cff_feed_height' ];
317
  $cff_open_links = $_POST[ 'cff_open_links' ];
318
  $cff_bg_color = $_POST[ 'cff_bg_color' ];
319
  $cff_likebox_bg_color = $_POST[ 'cff_likebox_bg_color' ];
320
+ $cff_show_author = $_POST[ 'cff_show_author' ];
321
+
322
  //New
323
  $cff_custom_css = $_POST[ 'cff_custom_css' ];
324
  $cff_title_link = $_POST[ 'cff_title_link' ];
349
  $options[ 'cff_event_details_size' ] = $cff_event_details_size;
350
  $options[ 'cff_event_details_weight' ] = $cff_event_details_weight;
351
  $options[ 'cff_event_details_color' ] = $cff_event_details_color;
352
+ $options[ 'cff_event_date_formatting' ] = $cff_event_date_formatting;
353
+ $options[ 'cff_event_date_custom' ] = $cff_event_date_custom;
354
+
355
+ //Date
356
+ $options[ 'cff_date_position' ] = $cff_date_position;
357
  $options[ 'cff_date_size' ] = $cff_date_size;
358
  $options[ 'cff_date_weight' ] = $cff_date_weight;
359
  $options[ 'cff_date_color' ] = $cff_date_color;
360
+ $options[ 'cff_date_formatting' ] = $cff_date_formatting;
361
+ $options[ 'cff_date_custom' ] = $cff_date_custom;
362
+ $options[ 'cff_date_before' ] = $cff_date_before;
363
+ $options[ 'cff_date_after' ] = $cff_date_after;
364
+ //Link
365
  $options[ 'cff_link_size' ] = $cff_link_size;
366
  $options[ 'cff_link_weight' ] = $cff_link_weight;
367
  $options[ 'cff_link_color' ] = $cff_link_color;
368
+ $options[ 'cff_facebook_link_text' ] = $cff_facebook_link_text;
369
+ $options[ 'cff_view_link_text' ] = $cff_view_link_text;
370
  //Misc
371
  $options[ 'cff_feed_width' ] = $cff_feed_width;
372
  $options[ 'cff_feed_height' ] = $cff_feed_height;
375
  $options[ 'cff_open_links' ] = $cff_open_links;
376
  $options[ 'cff_bg_color' ] = $cff_bg_color;
377
  $options[ 'cff_likebox_bg_color' ] = $cff_likebox_bg_color;
378
+ $options[ 'cff_show_author' ] = $cff_show_author;
379
+
380
  //New
381
  $options[ 'cff_custom_css' ] = $cff_custom_css;
382
  $options[ 'cff_title_link' ] = $cff_title_link;
427
  <span>Eg. ED9A00 <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a></span>
428
  </td>
429
  </tr>
430
+ <tr valign="top">
431
+ <th scope="row"><?php _e('Show name and picture of author'); ?></th>
432
+ <td>
433
+ <input name="cff_show_author" type="checkbox" id="cff_show_author" <?php if($cff_show_author == true) echo "checked"; ?> />
434
+ <label for="cff_show_status_type">Yes</label>
435
+ <i style="color: #666; font-size: 11px; margin-left: 5px;">This will show the thumbnail picture and name of the post author at the top of each post</i>
436
+
437
+ </td>
438
+ </tr>
439
  </tbody>
440
  </table>
441
  <br />
528
  <h3><?php _e('Typography'); ?></h3>
529
  <table class="form-table">
530
  <tbody>
531
+ <tr><td><b style="font-size: 14px;"><?php _e('Post Text'); ?></b></td></tr>
532
+ <tr>
533
+ <th><label for="cff_title_format" class="bump-left">Format</label></th>
 
534
  <td>
 
535
  <select name="cff_title_format">
536
  <option value="p" <?php if($cff_title_format == "p") echo 'selected="selected"' ?> >Paragraph</option>
537
  <option value="h3" <?php if($cff_title_format == "h3") echo 'selected="selected"' ?> >Heading 3</option>
539
  <option value="h5" <?php if($cff_title_format == "h5") echo 'selected="selected"' ?> >Heading 5</option>
540
  <option value="h6" <?php if($cff_title_format == "h6") echo 'selected="selected"' ?> >Heading 6</option>
541
  </select>
542
+ </td>
543
+ </tr>
544
+ <tr>
545
+ <th><label for="cff_title_size" class="bump-left">Text Size</label></th>
546
+ <td>
547
  <select name="cff_title_size">
548
  <option value="inherit" <?php if($cff_title_size == "inherit") echo 'selected="selected"' ?> >Inherit</option>
549
  <option value="10" <?php if($cff_title_size == "10") echo 'selected="selected"' ?> >10px</option>
562
  <option value="60" <?php if($cff_title_size == "54") echo 'selected="selected"' ?> >54px</option>
563
  <option value="60" <?php if($cff_title_size == "60") echo 'selected="selected"' ?> >60px</option>
564
  </select>
565
+ </td>
566
+ </tr>
567
+ <tr>
568
+ <th><label for="cff_title_weight" class="bump-left">Text Weight</label></th>
569
+ <td>
570
  <select name="cff_title_weight">
571
  <option value="inherit" <?php if($cff_title_weight == "inherit") echo 'selected="selected"' ?> >Inherit</option>
572
  <option value="normal" <?php if($cff_title_weight == "normal") echo 'selected="selected"' ?> >Normal</option>
573
  <option value="bold" <?php if($cff_title_weight == "bold") echo 'selected="selected"' ?> >Bold</option>
574
  </select>
575
+ </td>
576
+ </tr>
577
+ <tr>
578
+ <th><label for="cff_title_color" class="bump-left">Text Color</label></th>
579
+ <td>
580
+ #<input name="cff_title_color" type="text" value="<?php esc_attr_e( $cff_title_color ); ?>" size="10" placeholder="Eg. ED9A00" />
581
  <span><a href="http://www.colorpicker.com/" target="_blank">Color Picker</a></span>
 
 
 
582
  </td>
583
  </tr>
584
+ <tr>
585
+ <th><label for="cff_title_link" class="bump-left">Link text to Facebook post?</label></th>
586
+ <td><input type="checkbox" name="cff_title_link" id="cff_title_link" <?php if($cff_title_link == true) echo 'checked="checked"' ?> />&nbsp;Yes</td>
587
+ </tr>
588
+
589
+ <tr><td><b style="font-size: 14px;"><?php _e('Photo/Video Description'); ?></b></td></tr>
590
+
591
+ <tr>
592
+ <th><label for="cff_body_size" class="bump-left">Text Size</label></th>
593
  <td>
 
 
 
 
594
  <select name="cff_body_size">
595
  <option value="inherit" <?php if($cff_body_size == "inherit") echo 'selected="selected"' ?> >Inherit</option>
596
  <option value="10" <?php if($cff_body_size == "10") echo 'selected="selected"' ?> >10px</option>
609
  <option value="60" <?php if($cff_body_size == "54") echo 'selected="selected"' ?> >54px</option>
610
  <option value="60" <?php if($cff_body_size == "60") echo 'selected="selected"' ?> >60px</option>
611
  </select>
612
+ </td>
613
+ </tr>
614
+ <tr>
615
+ <th><label for="cff_body_weight" class="bump-left">Text Weight</label></th>
616
+ <td>
617
  <select name="cff_body_weight">
618
  <option value="inherit" <?php if($cff_body_weight == "inherit") echo 'selected="selected"' ?> >Inherit</option>
619
  <option value="normal" <?php if($cff_body_weight == "normal") echo 'selected="selected"' ?> >Normal</option>
620
  <option value="bold" <?php if($cff_body_weight == "bold") echo 'selected="selected"' ?> >Bold</option>
621
  </select>
 
 
 
 
622
  </td>
623
  </tr>
624
+ <tr>
625
+ <th><label for="cff_body_color" class="bump-left">Text Color</label></th>
626
 
627
  <td>
628
+ #<input name="cff_body_color" type="text" value="<?php esc_attr_e( $cff_body_color ); ?>" size="10" placeholder="Eg. ED9A00" />
629
+ <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
630
+ </td>
631
+ </tr>
632
+ <tr><td><b style="font-size: 14px;"><?php _e('Event Title'); ?></b></td></tr>
633
+
634
+ <tr>
635
+ <th><label for="cff_event_title_format" class="bump-left">Format</label></th>
636
+ <td>
637
  <select name="cff_event_title_format">
638
  <option value="p" <?php if($cff_event_title_format == "p") echo 'selected="selected"' ?> >Paragraph</option>
639
  <option value="h3" <?php if($cff_event_title_format == "h3") echo 'selected="selected"' ?> >Heading 3</option>
641
  <option value="h5" <?php if($cff_event_title_format == "h5") echo 'selected="selected"' ?> >Heading 5</option>
642
  <option value="h6" <?php if($cff_event_title_format == "h6") echo 'selected="selected"' ?> >Heading 6</option>
643
  </select>
644
+ </td>
645
+ </tr>
646
+
647
+ <tr>
648
+ <th><label for="cff_event_title_size" class="bump-left">Text Size</label></th>
649
+ <td>
650
  <select name="cff_event_title_size">
651
  <option value="inherit" <?php if($cff_event_title_size == "inherit") echo 'selected="selected"' ?> >Inherit</option>
652
  <option value="10" <?php if($cff_event_title_size == "10") echo 'selected="selected"' ?> >10px</option>
665
  <option value="60" <?php if($cff_event_title_size == "54") echo 'selected="selected"' ?> >54px</option>
666
  <option value="60" <?php if($cff_event_title_size == "60") echo 'selected="selected"' ?> >60px</option>
667
  </select>
668
+ </td>
669
+ </tr>
670
+ <tr>
671
+ <th><label for="cff_event_title_weight" class="bump-left">Text Weight</label></th>
672
+ <td>
673
  <select name="cff_event_title_weight">
674
  <option value="inherit" <?php if($cff_event_title_weight == "inherit") echo 'selected="selected"' ?> >Inherit</option>
675
  <option value="normal" <?php if($cff_event_title_weight == "normal") echo 'selected="selected"' ?> >Normal</option>
676
  <option value="bold" <?php if($cff_event_title_weight == "bold") echo 'selected="selected"' ?> >Bold</option>
677
  </select>
678
+ </td>
679
+ </tr>
680
+ <tr>
681
+ <th><label for="cff_event_title_color" class="bump-left">Text Color</label></th>
682
+ <td>
683
  <input name="cff_event_title_color" type="text" value="<?php esc_attr_e( $cff_event_title_color ); ?>" size="10" placeholder="Eg. ED9A00" />
684
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
 
 
 
685
  </td>
686
  </tr>
687
+ <tr>
688
+ <th><label for="cff_title_link" class="bump-left">Link title to Facebook event page?</label></th>
689
+ <td><input type="checkbox" name="cff_event_title_link" id="cff_event_title_link" <?php if($cff_event_title_link == true) echo 'checked="checked"' ?> />&nbsp;Yes</td>
690
+ </tr>
691
+ <tr><td><b style="font-size: 14px;"><?php _e('Event Details'); ?></b></td></tr>
692
+
693
+ <tr>
694
+ <th><label for="cff_event_details_size" class="bump-left">Text Size</label></th>
695
  <td>
 
 
 
 
696
  <select name="cff_event_details_size">
697
  <option value="inherit" <?php if($cff_event_details_size == "inherit") echo 'selected="selected"' ?> >Inherit</option>
698
  <option value="10" <?php if($cff_event_details_size == "10") echo 'selected="selected"' ?> >10px</option>
711
  <option value="60" <?php if($cff_event_details_size == "54") echo 'selected="selected"' ?> >54px</option>
712
  <option value="60" <?php if($cff_event_details_size == "60") echo 'selected="selected"' ?> >60px</option>
713
  </select>
714
+ </td>
715
+ </tr>
716
+ <tr>
717
+ <th><label for="cff_event_details_weight" class="bump-left">Text Weight</label></th>
718
+ <td>
719
  <select name="cff_event_details_weight">
720
  <option value="inherit" <?php if($cff_event_details_weight == "inherit") echo 'selected="selected"' ?> >Inherit</option>
721
  <option value="normal" <?php if($cff_event_details_weight == "normal") echo 'selected="selected"' ?> >Normal</option>
722
  <option value="bold" <?php if($cff_event_details_weight == "bold") echo 'selected="selected"' ?> >Bold</option>
723
  </select>
724
+ </td>
725
+ </tr>
726
+ <tr>
727
+ <th><label for="cff_event_details_color" class="bump-left">Text Color</label></th>
728
+ <td>
729
+ #<input name="cff_event_details_color" type="text" value="<?php esc_attr_e( $cff_event_details_color ); ?>" size="10" placeholder="Eg. ED9A00" />
730
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
731
  </td>
732
  </tr>
733
+ <tr>
734
+ <th><label for="cff_event_date_formatting" class="bump-left">Event date formatting</label></th>
735
+ <td>
736
+ <select name="cff_event_date_formatting">
737
+ <?php $original = strtotime('2013-07-25T17:30:00+0000'); ?>
738
+ <option value="1" <?php if($cff_event_date_formatting == "1") echo 'selected="selected"' ?> ><?php echo date('F j, Y, g:ia', $original); ?></option>
739
+ <option value="2" <?php if($cff_event_date_formatting == "2") echo 'selected="selected"' ?> ><?php echo date('F jS, g:ia', $original); ?></option>
740
+ <option value="3" <?php if($cff_event_date_formatting == "3") echo 'selected="selected"' ?> ><?php echo date('g:ia - F jS', $original); ?></option>
741
+ <option value="4" <?php if($cff_event_date_formatting == "4") echo 'selected="selected"' ?> ><?php echo date('g:ia, F jS', $original); ?></option>
742
+ <option value="5" <?php if($cff_event_date_formatting == "5") echo 'selected="selected"' ?> ><?php echo date('l F jS - g:ia', $original); ?></option>
743
+ <option value="6" <?php if($cff_event_date_formatting == "6") echo 'selected="selected"' ?> ><?php echo date('D M jS, Y, g:iA', $original); ?></option>
744
+ <option value="7" <?php if($cff_event_date_formatting == "7") echo 'selected="selected"' ?> ><?php echo date('l F jS, Y, g:iA', $original); ?></option>
745
+ <option value="8" <?php if($cff_event_date_formatting == "8") echo 'selected="selected"' ?> ><?php echo date('l F jS, Y - g:ia', $original); ?></option>
746
+ <option value="9" <?php if($cff_event_date_formatting == "9") echo 'selected="selected"' ?> ><?php echo date("l M jS, 'y", $original); ?></option>
747
+ <option value="10" <?php if($cff_event_date_formatting == "10") echo 'selected="selected"' ?> ><?php echo date('m.d.y - g:iA', $original); ?></option>
748
+ <option value="11" <?php if($cff_event_date_formatting == "11") echo 'selected="selected"' ?> ><?php echo date('m/d/y, g:ia', $original); ?></option>
749
+ <option value="12" <?php if($cff_event_date_formatting == "12") echo 'selected="selected"' ?> ><?php echo date('d.m.y - g:iA', $original); ?></option>
750
+ <option value="13" <?php if($cff_event_date_formatting == "13") echo 'selected="selected"' ?> ><?php echo date('d/m/y, g:ia', $original); ?></option>
751
+ </select>
752
+ </td>
753
+ </tr>
754
+ <tr>
755
+ <th><label for="cff_event_date_custom" class="bump-left">Custom event date format</label></th>
756
+ <td>
757
+ <input name="cff_event_date_custom" type="text" value="<?php esc_attr_e( $cff_event_date_custom ); ?>" size="10" placeholder="Eg. F j, Y - g:ia" />
758
+ <i style="color: #666; font-size: 11px;">(<a href="http://smashballoon.com/custom-facebook-feed/docs/date/" target="_blank">Examples</a>)</i>
759
+ </td>
760
+ </tr>
761
+
762
+ <tr><td><b style="font-size: 14px;"><?php _e('Date'); ?></b></td></tr>
763
+ <tr>
764
+ <th><label for="cff_date_position" class="bump-left">Position</label></th>
765
+ <td>
766
+ <select name="cff_date_position">
767
+ <option value="below" <?php if($cff_date_position == "below") echo 'selected="selected"' ?> >Below Text</option>
768
+ <option value="above" <?php if($cff_date_position == "above") echo 'selected="selected"' ?> >Above Text</option>
769
+ </select>
770
+ </td>
771
+ </tr>
772
+ <tr>
773
+ <th><label for="cff_date_size" class="bump-left">Text Size</label></th>
774
  <td>
 
 
 
 
775
  <select name="cff_date_size">
776
  <option value="inherit" <?php if($cff_date_size == "inherit") echo 'selected="selected"' ?> >Inherit</option>
777
  <option value="10" <?php if($cff_date_size == "10") echo 'selected="selected"' ?> >10px</option>
790
  <option value="60" <?php if($cff_date_size == "54") echo 'selected="selected"' ?> >54px</option>
791
  <option value="60" <?php if($cff_date_size == "60") echo 'selected="selected"' ?> >60px</option>
792
  </select>
793
+ </td>
794
+ </tr>
795
+ <tr>
796
+ <th><label for="cff_date_weight" class="bump-left">Text Weight</label></th>
797
+ <td>
798
  <select name="cff_date_weight">
799
  <option value="inherit" <?php if($cff_date_weight == "inherit") echo 'selected="selected"' ?> >Inherit</option>
800
  <option value="normal" <?php if($cff_date_weight == "normal") echo 'selected="selected"' ?> >Normal</option>
801
  <option value="bold" <?php if($cff_date_weight == "bold") echo 'selected="selected"' ?> >Bold</option>
802
  </select>
803
+ </td>
804
+ </tr>
805
+ <tr>
806
+ <th><label for="cff_date_color" class="bump-left">Text Color</label></th>
807
+ <td>
808
+ #<input name="cff_date_color" type="text" value="<?php esc_attr_e( $cff_date_color ); ?>" size="10" placeholder="Eg. ED9A00" />
809
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
810
  </td>
811
  </tr>
812
+
813
+ <tr>
814
+ <th><label for="cff_date_formatting" class="bump-left">Date formatting</label></th>
815
+ <td>
816
+ <select name="cff_date_formatting">
817
+ <?php $original = strtotime('2013-07-25T17:30:00+0000'); ?>
818
+ <option value="1" <?php if($cff_date_formatting == "1") echo 'selected="selected"' ?> >Posted 2 days ago</option>
819
+ <option value="2" <?php if($cff_date_formatting == "2") echo 'selected="selected"' ?> ><?php echo date('F jS, g:i a', $original); ?></option>
820
+ <option value="3" <?php if($cff_date_formatting == "3") echo 'selected="selected"' ?> ><?php echo date('F jS', $original); ?></option>
821
+ <option value="4" <?php if($cff_date_formatting == "4") echo 'selected="selected"' ?> ><?php echo date('D F jS', $original); ?></option>
822
+ <option value="5" <?php if($cff_date_formatting == "5") echo 'selected="selected"' ?> ><?php echo date('l F jS', $original); ?></option>
823
+ <option value="6" <?php if($cff_date_formatting == "6") echo 'selected="selected"' ?> ><?php echo date('D M jS, Y', $original); ?></option>
824
+ <option value="7" <?php if($cff_date_formatting == "7") echo 'selected="selected"' ?> ><?php echo date('l F jS, Y', $original); ?></option>
825
+ <option value="8" <?php if($cff_date_formatting == "8") echo 'selected="selected"' ?> ><?php echo date('l F jS, Y - g:i a', $original); ?></option>
826
+ <option value="9" <?php if($cff_date_formatting == "9") echo 'selected="selected"' ?> ><?php echo date("l M jS, 'y", $original); ?></option>
827
+ <option value="10" <?php if($cff_date_formatting == "10") echo 'selected="selected"' ?> ><?php echo date('m.d.y', $original); ?></option>
828
+ <option value="11" <?php if($cff_date_formatting == "11") echo 'selected="selected"' ?> ><?php echo date('m/d/y', $original); ?></option>
829
+ <option value="12" <?php if($cff_date_formatting == "12") echo 'selected="selected"' ?> ><?php echo date('d.m.y', $original); ?></option>
830
+ <option value="13" <?php if($cff_date_formatting == "13") echo 'selected="selected"' ?> ><?php echo date('d/m/y', $original); ?></option>
831
+ </select>
832
+ </td>
833
+ </tr>
834
+ <tr>
835
+ <th><label for="cff_date_custom" class="bump-left">Custom format</label></th>
836
+ <td>
837
+ <input name="cff_date_custom" type="text" value="<?php esc_attr_e( $cff_date_custom ); ?>" size="10" placeholder="Eg. F j, Y" />
838
+ <i style="color: #666; font-size: 11px;">(<a href="http://smashballoon.com/custom-facebook-feed/docs/date/" target="_blank">Examples</a>)</i>
839
+ </td>
840
+ </tr>
841
+ <tr>
842
+ <th><label for="cff_date_before" class="bump-left">Text before date</label></th>
843
+ <td><input name="cff_date_before" type="text" value="<?php esc_attr_e( $cff_date_before ); ?>" size="10" placeholder="Eg. Posted" /></td>
844
+ </tr>
845
+ <tr>
846
+ <th><label for="cff_date_after" class="bump-left">Text after date</label></th>
847
+ <td><input name="cff_date_after" type="text" value="<?php esc_attr_e( $cff_date_after ); ?>" size="10" placeholder="Eg. ago" /></td>
848
+ </tr>
849
+ <tr><td><b style="font-size: 14px;"><?php _e('Link to Facebook'); ?></b></td></tr>
850
 
851
+ <tr>
852
+ <th><label for="cff_link_size" class="bump-left">Text Size</label></th>
853
  <td>
 
 
 
 
854
  <select name="cff_link_size">
855
  <option value="inherit" <?php if($cff_link_size == "inherit") echo 'selected="selected"' ?> >Inherit</option>
856
  <option value="10" <?php if($cff_link_size == "10") echo 'selected="selected"' ?> >10px</option>
869
  <option value="60" <?php if($cff_link_size == "54") echo 'selected="selected"' ?> >54px</option>
870
  <option value="60" <?php if($cff_link_size == "60") echo 'selected="selected"' ?> >60px</option>
871
  </select>
872
+ </td>
873
+ </tr>
874
+ <tr>
875
+ <th><label for="cff_link_weight" class="bump-left">Text Weight</label></th>
876
+ <td>
877
  <select name="cff_link_weight">
878
  <option value="inherit" <?php if($cff_link_weight == "inherit") echo 'selected="selected"' ?> >Inherit</option>
879
  <option value="normal" <?php if($cff_link_weight == "normal") echo 'selected="selected"' ?> >Normal</option>
880
  <option value="bold" <?php if($cff_link_weight == "bold") echo 'selected="selected"' ?> >Bold</option>
881
  </select>
882
+ </td>
883
+ </tr>
884
+ <tr>
885
+ <th><label for="cff_link_color" class="bump-left">Text Color</label></th>
886
+ <td>
887
  <input name="cff_link_color" type="text" value="<?php esc_attr_e( $cff_link_color ); ?>" size="10" placeholder="Eg. ED9A00" />
888
  <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
889
  </td>
890
  </tr>
891
+ <tr>
892
+ <th><label for="cff_facebook_link_text" class="bump-left">Custom 'View on Facebook' text</label></th>
893
+ <td>
894
+ <input name="cff_facebook_link_text" type="text" value="<?php esc_attr_e( $cff_facebook_link_text ); ?>" size="20" />
895
+ <i style="color: #666; font-size: 11px; margin-left: 5px;">Use different text in place of the default 'View on Facebook' link</i>
896
+ </td>
897
+ </tr>
898
+ <tr>
899
+ <th><label for="cff_view_link_text" class="bump-left">Custom 'View Link' text</label></th>
900
+ <td>
901
+ <input name="cff_view_link_text" type="text" value="<?php esc_attr_e( $cff_view_link_text ); ?>" size="20" />
902
+ <i style="color: #666; font-size: 11px; margin-left: 5px;">Use different text in place of the default 'View on Facebook' link</i>
903
+ </td>
904
+ </tr>
905
+
906
  </tbody>
907
  </table>
908
  <br />
909
+ <?php submit_button(); ?>
910
  <hr />
911
  <h3><?php _e('Likes, Shares and Comments'); ?></h3>
912
  <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>
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.4.7
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
@@ -32,6 +32,7 @@ function display_cff($atts) {
32
  $options = get_option('cff_style_settings');
33
 
34
  //Create the types string to set as shortcode default
 
35
  if($options[ 'cff_show_text' ]) $include_string .= 'text,';
36
  if($options[ 'cff_show_desc' ]) $include_string .= 'desc,';
37
  if($options[ 'cff_show_date' ]) $include_string .= 'date,';
@@ -45,10 +46,12 @@ function display_cff($atts) {
45
  array(
46
  'id' => get_option('cff_page_id'),
47
  'num' => get_option('cff_num_show'),
 
48
  'width' => $options[ 'cff_feed_width' ],
49
  'height' => $options[ 'cff_feed_height' ],
50
  'padding' => $options[ 'cff_feed_padding' ],
51
  'bgcolor' => $options[ 'cff_bg_color' ],
 
52
  'include' => $include_string,
53
  //Typography
54
  'textformat' => $options[ 'cff_title_format' ],
@@ -67,19 +70,20 @@ function display_cff($atts) {
67
  'eventdetailssize' => $options[ 'cff_event_details_size' ],
68
  'eventdetailsweight' => $options[ 'cff_event_details_weight' ],
69
  'eventdetailscolor' => $options[ 'cff_event_details_color' ],
 
70
  'datesize' => $options[ 'cff_date_size' ],
71
  'dateweight' => $options[ 'cff_date_weight' ],
72
  'datecolor' => $options[ 'cff_date_color' ],
73
  'linksize' => $options[ 'cff_link_size' ],
74
  'linkweight' => $options[ 'cff_link_weight' ],
75
  'linkcolor' => $options[ 'cff_link_color' ],
 
 
76
  //Misc
77
  'textlength' => get_option('cff_title_length'),
78
  'desclength' => get_option('cff_body_length'),
79
  'likeboxpos' => $options[ 'cff_like_box_position' ],
80
  'likeboxcolor' => $options[ 'cff_likebox_bg_color' ],
81
- 'videoheight' => $options[ 'cff_video_height' ],
82
- 'videoaction' => $options[ 'cff_video_action' ],
83
  'sepcolor' => $options[ 'cff_sep_color' ],
84
  'sepsize' => $options[ 'cff_sep_size' ]
85
  ), $atts);
@@ -92,6 +96,7 @@ function display_cff($atts) {
92
  $cff_feed_height = $atts[ 'height' ];
93
  $cff_feed_padding = $atts[ 'padding' ];
94
  $cff_bg_color = $atts[ 'bgcolor' ];
 
95
  //Compile feed styles
96
  $cff_feed_styles = 'style="';
97
  if ( !empty($cff_feed_width) ) $cff_feed_styles .= 'width:' . $cff_feed_width . '; ';
@@ -149,7 +154,6 @@ function display_cff($atts) {
149
  if ( !empty($cff_event_title_color) ) $cff_event_title_styles .= 'color:#' . $cff_event_title_color . ';';
150
  $cff_event_title_styles .= '"';
151
  $cff_event_title_link = $atts[ 'eventtitlelink' ];
152
-
153
  //Event Details
154
  $cff_event_details_size = $atts[ 'eventdetailssize' ];
155
  $cff_event_details_weight = $atts[ 'eventdetailsweight' ];
@@ -160,6 +164,8 @@ function display_cff($atts) {
160
  if ( !empty($cff_event_details_color) ) $cff_event_details_styles .= 'color:#' . $cff_event_details_color . ';';
161
  $cff_event_details_styles .= '"';
162
  //Date
 
 
163
  $cff_date_size = $atts[ 'datesize' ];
164
  $cff_date_weight = $atts[ 'dateweight' ];
165
  $cff_date_color = $atts[ 'datecolor' ];
@@ -168,6 +174,8 @@ function display_cff($atts) {
168
  if ( !empty($cff_date_weight) && $cff_date_weight != 'inherit' ) $cff_date_styles .= 'font-weight:' . $cff_date_weight . '; ';
169
  if ( !empty($cff_date_color) ) $cff_date_styles .= 'color:#' . $cff_date_color . ';';
170
  $cff_date_styles .= '"';
 
 
171
  //Link to Facebook
172
  $cff_link_size = $atts[ 'linksize' ];
173
  $cff_link_weight = $atts[ 'linkweight' ];
@@ -177,6 +185,8 @@ function display_cff($atts) {
177
  if ( !empty($cff_link_weight) && $cff_link_weight != 'inherit' ) $cff_link_styles .= 'font-weight:' . $cff_link_weight . '; ';
178
  if ( !empty($cff_link_color) ) $cff_link_styles .= 'color:#' . $cff_link_color . ';';
179
  $cff_link_styles .= '"';
 
 
180
  /********** MISC **********/
181
  //Like Box styles
182
  $cff_likebox_bg_color = $atts[ 'likeboxcolor' ];
@@ -197,15 +207,18 @@ function display_cff($atts) {
197
 
198
  //Text limits
199
  $title_limit = $atts['textlength'];
200
- $body_limit = $atts['desclength'];
201
- //Assign the Access Token and Page ID variables
 
 
 
 
202
  $access_token = get_option('cff_access_token');
203
  $page_id = $atts['id'];
204
 
205
  //Get show posts attribute. If not set then default to 25.
206
  $show_posts = $atts['num'];
207
- if (empty($show_posts)) $show_posts = 25;
208
- if ( $show_posts == 0 || $show_posts == undefined ) $show_posts = 25;
209
 
210
  //Check whether the Access Token is present and valid
211
  if ($access_token == '') {
@@ -217,9 +230,14 @@ function display_cff($atts) {
217
  echo "Please enter the Page ID of the Facebook feed you'd like to display. You can do this in either the Custom Facebook Feed plugin settings or in the shortcode itself. For example [custom_facebook_feed id=<b>YOUR_PAGE_ID</b>].<br /><br />";
218
  return false;
219
  }
 
 
 
 
 
220
 
221
  //Get the contents of the Facebook page
222
- $json_object = fetchUrl('https://graph.facebook.com/' . $page_id . '/posts?access_token=' . $access_token);
223
  //Interpret data with JSON
224
  $FBdata = json_decode($json_object);
225
  //Set like box variable
@@ -239,6 +257,17 @@ function display_cff($atts) {
239
  {
240
  //Explode News and Page ID's into 2 values
241
  $PostID = explode("_", $news->id);
 
 
 
 
 
 
 
 
 
 
 
242
  //Check whether it's a status (author comment or like)
243
  if ( ( $news->type == 'status' && !empty($news->message) ) || $news->type !== 'status' ) {
244
  //If it isn't then create the post
@@ -248,40 +277,53 @@ function display_cff($atts) {
248
  //********************************//
249
  //***COMPILE SECTION VARIABLES***//
250
  //********************************//
251
- //POST TEXT
252
- $cff_post_text = '';
253
-
254
- //Set the link
255
- $link = $news->link;
256
- //If there's no link provided then link to Facebook page
257
- if (empty($news->link)) $link = 'http://facebook.com/' . $page_id;
258
-
259
- if ($cff_title_link) $cff_post_text .= '<a href="'.$link.'" '.$target.'>';
260
- $cff_post_text .= '<' . $cff_title_format . ' class="cff-post-text" ' . $cff_title_styles . '>';
261
- if (!empty($news->story)) {
262
- $story_text = $news->story;
263
- if (!empty($title_limit)) {
264
- if (strlen($story_text) > $title_limit) $story_text = substr($story_text, 0, $title_limit) . '...';
265
- }
266
- $cff_post_text .= cff_make_clickable($story_text) . ' ';
267
- }
268
- if (!empty($news->message)) {
269
- $message_text = $news->message;
270
- if (!empty($title_limit)) {
271
- if (strlen($message_text) > $title_limit) $message_text = substr($message_text, 0, $title_limit) . '...';
272
- }
273
- $cff_post_text .= cff_make_clickable($message_text) . ' ';
274
- }
275
- if (!empty($news->name) && empty($news->story)) {
276
- $name_text = $news->name;
277
- if (!empty($title_limit)) {
278
- if (strlen($name_text) > $title_limit) $name_text = substr($name_text, 0, $title_limit) . '...';
279
- }
280
- //Only show name as last resort if both story and message are empty
281
- if ( empty($news->story) && empty($news->message) ) $cff_post_text .= cff_make_clickable($name_text);
282
  }
283
- $cff_post_text .= '</' . $cff_title_format . '>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  if ($cff_title_link) $cff_post_text .= '</a>';
 
 
 
285
  //DESCRIPTION
286
  $cff_description = '';
287
  if (!empty($news->description)) {
@@ -289,8 +331,9 @@ function display_cff($atts) {
289
  if (!empty($body_limit)) {
290
  if (strlen($description_text) > $body_limit) $description_text = substr($description_text, 0, $body_limit) . '...';
291
  }
292
- $cff_description .= '<p '.$cff_body_styles.'>' . cff_make_clickable($description_text) . '</p>';
293
  }
 
294
  //LINK
295
  $cff_shared_link = '';
296
  //Display shared link
@@ -301,74 +344,78 @@ function display_cff($atts) {
301
  }
302
  }
303
  //DATE
304
- $cff_date = '<p class="cff-date" '.$cff_date_styles.'>Posted '. cff_timeSince(strtotime($news->created_time)) . ' ago</p>';
 
 
305
  //EVENT
306
  $cff_event = '';
307
  if ($cff_show_event_title || $cff_show_event_details) {
308
  //Check for media
309
- if ($news->type == 'link') {
310
- $story = $news->story;
311
- //Check whether it's an event
312
- $created_event = 'created an event.';
313
- $shared_event = 'shared an event.';
314
- $created_event = stripos($story, $created_event);
315
- $shared_event = stripos($story, $shared_event);
316
- if ( $created_event || $shared_event ){
317
- //Get the event object
318
- $eventID = $PostID[1];
319
- if ( $shared_event ) {
320
- //Get the event id from the event URL. eg: http://www.facebook.com/events/123451234512345/
321
- $event_url = parse_url($news->link);
322
- $url_parts = explode('/', $event_url['path']);
323
- //Get the id from the parts
324
- $eventID = $url_parts[count($url_parts)-2];
325
- }
326
- //Get the contents of the event using the WP HTTP API
327
- $event_json = fetchUrl('https://graph.facebook.com/'.$eventID.'?access_token=' . $access_token);
328
- //Interpret data with JSON
329
- $event_object = json_decode($event_json);
330
-
331
- //EVENT
332
- //Display the event details
333
- $cff_event = '<div class="details">';
334
- //Show event title
335
- if ($cff_show_event_title && !empty($event_object->name)) {
336
- if ($cff_event_title_link) $cff_event .= '<a href="'.$news->link.'">';
337
- $cff_event .= '<' . $cff_event_title_format . ' ' . $cff_event_title_styles . '>' . $event_object->name . '</' . $cff_event_title_format . '>';
338
- if ($cff_event_title_link) $cff_event .= '</a>';
339
- }
340
- //Show event details
341
- if ($cff_show_event_details){
342
- if (!empty($event_object->location)) $cff_event .= '<p class="where" ' . $cff_event_details_styles . '>' . $event_object->location . '</p>';
343
- if (!empty($event_object->start_time)) $cff_event .= '<p class="when" ' . $cff_event_details_styles . '>' . date("F j, Y, g:i a", strtotime($event_object->start_time)) . '</p>';
344
- if (!empty($event_object->description)){
345
- $description = $event_object->description;
346
- if (!empty($body_limit)) {
347
- if (strlen($description) > $body_limit) $description = substr($description, 0, $body_limit) . '...';
348
- }
349
- $cff_event .= '<p class="info" ' . $cff_event_details_styles . '>' . cff_make_clickable($description) . '</p>';
350
  }
 
351
  }
352
- $cff_event .= '</div><!-- end .details -->';
353
  }
 
 
354
  }
355
  }
356
  //LINK
357
  //Display the link to the Facebook post or external link
358
  $cff_link = '';
359
  //Default link
360
- $link = 'http://facebook.com/' . $page_id;
361
- $link_text = 'View on Facebook';
362
- //If there's an actual link provided
363
  if (!empty($news->link)) {
364
- $link = $news->link;
365
  //Check whether it links to facebook or somewhere else
366
  $facebook_str = 'facebook.com';
367
  if(stripos($link, $facebook_str) == false) {
368
- $link_text = 'View Link';
 
369
  }
370
  }
371
- $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 -->';
372
 
373
 
374
  //**************************//
@@ -378,27 +425,31 @@ function display_cff($atts) {
378
  $content .= '<div class="cff-item ';
379
  if ($news->type == 'link') $content .= 'link-item';
380
  $content .= '" ' . $cff_item_styles . '>';
 
 
 
 
381
  //POST TEXT
382
  if($cff_show_text) $content .= $cff_post_text;
383
  //DESCRIPTION
384
  if($cff_show_desc) $content .= $cff_description;
385
- //LINK
386
  if($cff_show_desc) $content .= $cff_shared_link;
387
-
388
  //EVENT
389
  if($cff_show_event_title || $cff_show_event_details) $content .= $cff_event;
390
- //DATE
391
- if($cff_show_date) $content .= $cff_date;
392
- //LINK
393
  if($cff_show_link) $content .= $cff_link;
 
394
  //End the post item
395
- $content .= '</div><div class="clear"></div> <!-- end .cff-item -->';
396
  } // End status check
397
  } // End the loop
398
  //Add the Like Box
399
  if ($cff_like_box_position == 'bottom' && $cff_show_like_box) $content .= $like_box;
400
  //End the feed
401
- $content .= '</div><div class="clear"></div> <!-- end .Custom Facebook Feed -->';
402
  //Return our feed HTML to display
403
  return $content;
404
  }
@@ -428,93 +479,240 @@ function fetchUrl($url){
428
  }
429
  //***FUNCTIONS***
430
  //Make links in text clickable
431
- function cff_make_url_clickable($matches) {
432
- $target = 'target="_blank"';
433
- $ret = '';
434
- $url = $matches[2];
435
-
436
- if ( empty($url) )
437
- return $matches[0];
438
- // removed trailing [.,;:] from URL
439
- if ( in_array(substr($url, -1), array('.', ',', ';', ':')) === true ) {
440
- $ret = substr($url, -1);
441
- $url = substr($url, 0, strlen($url)-1);
442
- }
443
- return $matches[1] . "<a href=\"$url\" rel=\"nofollow\" ".$target.">$url</a>" . $ret;
444
  }
445
- function cff_make_web_ftp_clickable($matches) {
 
 
 
446
  $target = 'target="_blank"';
447
- $ret = '';
448
- $dest = $matches[2];
449
- $dest = 'http://' . $dest;
450
-
451
- if ( empty($dest) )
452
- return $matches[0];
453
- // removed trailing [,;:] from URL
454
- if ( in_array(substr($dest, -1), array('.', ',', ';', ':')) === true ) {
455
- $ret = substr($dest, -1);
456
- $dest = substr($dest, 0, strlen($dest)-1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
457
  }
458
- return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\" ".$target.">$dest</a>" . $ret;
 
459
  }
460
- function cff_make_email_clickable($matches) {
461
- $email = $matches[2] . '@' . $matches[3];
462
- return $matches[1] . "<a href=\"mailto:$email\">$email</a>";
 
 
 
463
  }
464
- function cff_make_clickable($ret) {
465
- $ret = ' ' . $ret;
466
- // in testing, using arrays here was found to be faster
467
- $ret = preg_replace_callback('#([\s>])([\w]+?://[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]*)#is', 'cff_make_url_clickable', $ret);
468
- $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]*)#is', 'cff_make_web_ftp_clickable', $ret);
469
- $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', 'cff_make_email_clickable', $ret);
470
-
471
- // this one is not in an array because we need it to run last, for cleanup of accidental links within links
472
- $ret = preg_replace("#(<a( [^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i", "$1$3</a>", $ret);
473
- $ret = trim($ret);
474
- return $ret;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475
  }
476
- //Time stamp function
477
- function cff_timeSince($original) {
478
- // Array of time period
479
- $chunks = array(
480
- array(60 * 60 * 24 * 365 , 'year'),
481
- array(60 * 60 * 24 * 30 , 'month'),
482
- array(60 * 60 * 24 * 7, 'week'),
483
- array(60 * 60 * 24 , 'day'),
484
- array(60 * 60 , 'hour'),
485
- array(60 , 'minute'),
486
- );
487
-
488
- // Current time
489
- $today = time();
490
- $since = $today - $original;
491
-
492
- // $j saves performing the count function each time around the loop
493
- for ($i = 0, $j = count($chunks); $i < $j; $i++) {
494
-
495
- $seconds = $chunks[$i][0];
496
- $name = $chunks[$i][1];
497
 
498
- // finding the biggest chunk (if the chunk fits, break)
499
- if (($count = floor($since / $seconds)) != 0) {
500
  break;
501
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
502
  }
503
-
504
- $print = ($count == 1) ? '1 '.$name : "$count {$name}s";
505
-
506
- if ($i + 1 < $j) {
507
- // now getting the second item
508
- $seconds2 = $chunks[$i + 1][0];
509
- $name2 = $chunks[$i + 1][1];
 
 
510
 
511
- // add second item if it's greater than 0
512
- if (($count2 = floor(($since - ($seconds * $count)) / $seconds2)) != 0) {
513
- $print .= ($count2 == 1) ? ', 1 '.$name2 : ", $count2 {$name2}s";
514
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
515
  }
516
  return $print;
517
  }
 
 
 
518
  //Enqueue stylesheet
519
  add_action( 'wp_enqueue_scripts', 'cff_add_my_stylesheet' );
520
  function cff_add_my_stylesheet() {
@@ -522,6 +720,17 @@ function cff_add_my_stylesheet() {
522
  wp_register_style( 'cff', plugins_url('css/cff-style.css', __FILE__) );
523
  wp_enqueue_style( 'cff' );
524
  }
 
 
 
 
 
 
 
 
 
 
 
525
  //Allows shortcodes in sidebar of theme
526
  add_filter('widget_text', 'do_shortcode');
527
  function cff_activate() {
@@ -546,6 +755,7 @@ function cff_uninstall()
546
  delete_option( 'cff_access_token' );
547
  delete_option( 'cff_page_id' );
548
  delete_option( 'cff_num_show' );
 
549
  delete_option( 'cff_title_length' );
550
  delete_option( 'cff_body_length' );
551
  delete_option('cff_style_settings');
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.5.1
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
32
  $options = get_option('cff_style_settings');
33
 
34
  //Create the types string to set as shortcode default
35
+ $include_string = '';
36
  if($options[ 'cff_show_text' ]) $include_string .= 'text,';
37
  if($options[ 'cff_show_desc' ]) $include_string .= 'desc,';
38
  if($options[ 'cff_show_date' ]) $include_string .= 'date,';
46
  array(
47
  'id' => get_option('cff_page_id'),
48
  'num' => get_option('cff_num_show'),
49
+ 'others' => get_option('cff_show_others'),
50
  'width' => $options[ 'cff_feed_width' ],
51
  'height' => $options[ 'cff_feed_height' ],
52
  'padding' => $options[ 'cff_feed_padding' ],
53
  'bgcolor' => $options[ 'cff_bg_color' ],
54
+ 'showauthor' => $options[ 'cff_show_author' ],
55
  'include' => $include_string,
56
  //Typography
57
  'textformat' => $options[ 'cff_title_format' ],
70
  'eventdetailssize' => $options[ 'cff_event_details_size' ],
71
  'eventdetailsweight' => $options[ 'cff_event_details_weight' ],
72
  'eventdetailscolor' => $options[ 'cff_event_details_color' ],
73
+ 'datepos' => $options[ 'cff_date_position' ],
74
  'datesize' => $options[ 'cff_date_size' ],
75
  'dateweight' => $options[ 'cff_date_weight' ],
76
  'datecolor' => $options[ 'cff_date_color' ],
77
  'linksize' => $options[ 'cff_link_size' ],
78
  'linkweight' => $options[ 'cff_link_weight' ],
79
  'linkcolor' => $options[ 'cff_link_color' ],
80
+ 'facebooklinktext' => $options[ 'cff_facebook_link_text' ],
81
+ 'viewlinktext' => $options[ 'cff_view_link_text' ],
82
  //Misc
83
  'textlength' => get_option('cff_title_length'),
84
  'desclength' => get_option('cff_body_length'),
85
  'likeboxpos' => $options[ 'cff_like_box_position' ],
86
  'likeboxcolor' => $options[ 'cff_likebox_bg_color' ],
 
 
87
  'sepcolor' => $options[ 'cff_sep_color' ],
88
  'sepsize' => $options[ 'cff_sep_size' ]
89
  ), $atts);
96
  $cff_feed_height = $atts[ 'height' ];
97
  $cff_feed_padding = $atts[ 'padding' ];
98
  $cff_bg_color = $atts[ 'bgcolor' ];
99
+ $cff_show_author = $atts[ 'showauthor' ];
100
  //Compile feed styles
101
  $cff_feed_styles = 'style="';
102
  if ( !empty($cff_feed_width) ) $cff_feed_styles .= 'width:' . $cff_feed_width . '; ';
154
  if ( !empty($cff_event_title_color) ) $cff_event_title_styles .= 'color:#' . $cff_event_title_color . ';';
155
  $cff_event_title_styles .= '"';
156
  $cff_event_title_link = $atts[ 'eventtitlelink' ];
 
157
  //Event Details
158
  $cff_event_details_size = $atts[ 'eventdetailssize' ];
159
  $cff_event_details_weight = $atts[ 'eventdetailsweight' ];
164
  if ( !empty($cff_event_details_color) ) $cff_event_details_styles .= 'color:#' . $cff_event_details_color . ';';
165
  $cff_event_details_styles .= '"';
166
  //Date
167
+ $cff_date_position = $atts[ 'datepos' ];
168
+ if (!isset($cff_date_position)) $cff_date_position = 'below';
169
  $cff_date_size = $atts[ 'datesize' ];
170
  $cff_date_weight = $atts[ 'dateweight' ];
171
  $cff_date_color = $atts[ 'datecolor' ];
174
  if ( !empty($cff_date_weight) && $cff_date_weight != 'inherit' ) $cff_date_styles .= 'font-weight:' . $cff_date_weight . '; ';
175
  if ( !empty($cff_date_color) ) $cff_date_styles .= 'color:#' . $cff_date_color . ';';
176
  $cff_date_styles .= '"';
177
+ $cff_date_before = $options[ 'cff_date_before' ];
178
+ $cff_date_after = $options[ 'cff_date_after' ];
179
  //Link to Facebook
180
  $cff_link_size = $atts[ 'linksize' ];
181
  $cff_link_weight = $atts[ 'linkweight' ];
185
  if ( !empty($cff_link_weight) && $cff_link_weight != 'inherit' ) $cff_link_styles .= 'font-weight:' . $cff_link_weight . '; ';
186
  if ( !empty($cff_link_color) ) $cff_link_styles .= 'color:#' . $cff_link_color . ';';
187
  $cff_link_styles .= '"';
188
+ $cff_facebook_link_text = $atts[ 'facebooklinktext' ];
189
+ $cff_view_link_text = $atts[ 'viewlinktext' ];
190
  /********** MISC **********/
191
  //Like Box styles
192
  $cff_likebox_bg_color = $atts[ 'likeboxcolor' ];
207
 
208
  //Text limits
209
  $title_limit = $atts['textlength'];
210
+ if(empty($title_limit)) $title_limit = 99999;
211
+ $body_limit = $atts['desclength']; ?>
212
+ <script type="text/javascript">
213
+ var text_limit = <?php echo $title_limit ?>;
214
+ </script>
215
+ <?php //Assign the Access Token and Page ID variables
216
  $access_token = get_option('cff_access_token');
217
  $page_id = $atts['id'];
218
 
219
  //Get show posts attribute. If not set then default to 25.
220
  $show_posts = $atts['num'];
221
+ if (empty($show_posts) || $show_posts == '') $show_posts = 25;
 
222
 
223
  //Check whether the Access Token is present and valid
224
  if ($access_token == '') {
230
  echo "Please enter the Page ID of the Facebook feed you'd like to display. You can do this in either the Custom Facebook Feed plugin settings or in the shortcode itself. For example [custom_facebook_feed id=<b>YOUR_PAGE_ID</b>].<br /><br />";
231
  return false;
232
  }
233
+
234
+ //Use posts? or feed?
235
+ $show_others = $atts['others'];
236
+ $graph_query = 'posts';
237
+ if ($show_others) $graph_query = 'feed';
238
 
239
  //Get the contents of the Facebook page
240
+ $json_object = fetchUrl('https://graph.facebook.com/' . $page_id . '/' . $graph_query . '?access_token=' . $access_token);
241
  //Interpret data with JSON
242
  $FBdata = json_decode($json_object);
243
  //Set like box variable
257
  {
258
  //Explode News and Page ID's into 2 values
259
  $PostID = explode("_", $news->id);
260
+ //Check the post type
261
+ $cff_post_type = $news->type;
262
+ if ($cff_post_type == 'link') {
263
+ $story = $news->story;
264
+ //Check whether it's an event
265
+ $created_event = 'created an event.';
266
+ $shared_event = 'shared an event.';
267
+ $created_event = stripos($story, $created_event);
268
+ $shared_event = stripos($story, $shared_event);
269
+ if ( $created_event || $shared_event ) $cff_post_type = 'event';
270
+ }
271
  //Check whether it's a status (author comment or like)
272
  if ( ( $news->type == 'status' && !empty($news->message) ) || $news->type !== 'status' ) {
273
  //If it isn't then create the post
277
  //********************************//
278
  //***COMPILE SECTION VARIABLES***//
279
  //********************************//
280
+
281
+ //Set the post link
282
+ if(!empty($news->link)) {
283
+ $link = $news->link;
284
+ } else {
285
+ //If there's no link provided then link to Facebook page
286
+ $link = 'http://facebook.com/' . $page_id;
287
+ }
288
+
289
+ //Is it a shared album?
290
+ $shared_album_string = 'shared an album:';
291
+ if (!empty($news->story)){
292
+ $shared_album = stripos($news->story, $shared_album_string);
293
+ if ( $shared_album ) {
294
+ $link = str_replace('photo.php?','media/set/?',$link);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  }
296
+ }
297
+
298
+
299
+ //POST AUTHOR
300
+ $cff_author = '<a class="cff-author" href="http://facebook.com/' . $news->from->id . '" '.$target.' title="'.$news->from->name.' on Facebook">';
301
+ $cff_author .= '<img src="http://graph.facebook.com/' . $news->from->id . '/picture">';
302
+ $cff_author .= '<p>'.$news->from->name.'</p>';
303
+ $cff_author .= '</a>';
304
+
305
+
306
+ //POST TEXT
307
+ $cff_post_text = '<' . $cff_title_format . ' class="cff-post-text" ' . $cff_title_styles . '>';
308
+ $cff_post_text .= '<span>';
309
+ if ($cff_title_link) $cff_post_text .= '<a class="cff-post-text-link" href="'.$link.'" '.$target.'>';
310
+
311
+ if (!empty($news->story)) $post_text = $news->story;
312
+ if (!empty($news->message)) $post_text = $news->message;
313
+ if (!empty($news->name) && empty($news->story) && empty($news->message)) $post_text = $news->name;
314
+
315
+ //If the text is wrapped in a link then don't hyperlink any text within
316
+ if ($cff_title_link) {
317
+ //Wrap links in a span so we can break the text if it's too long
318
+ $cff_post_text .= cff_wrap_span($post_text) . ' ';
319
+ } else {
320
+ $cff_post_text .= cff_make_clickable($post_text) . ' ';
321
+ }
322
+
323
  if ($cff_title_link) $cff_post_text .= '</a>';
324
+ $cff_post_text .= '</span>';
325
+ $cff_post_text .= '</' . $cff_title_format . '>';
326
+
327
  //DESCRIPTION
328
  $cff_description = '';
329
  if (!empty($news->description)) {
331
  if (!empty($body_limit)) {
332
  if (strlen($description_text) > $body_limit) $description_text = substr($description_text, 0, $body_limit) . '...';
333
  }
334
+ $cff_description .= '<p class="cff-post-desc" '.$cff_body_styles.'><span>' . cff_make_clickable($description_text) . '</span></p>';
335
  }
336
+
337
  //LINK
338
  $cff_shared_link = '';
339
  //Display shared link
344
  }
345
  }
346
  //DATE
347
+ $cff_date_formatting = $options[ 'cff_date_formatting' ];
348
+ $cff_date_custom = $options[ 'cff_date_custom' ];
349
+ $cff_date = '<p class="cff-date" '.$cff_date_styles.'>'. $cff_date_before . ' ' . cff_getdate(strtotime($news->created_time), $cff_date_formatting, $cff_date_custom) . ' ' . $cff_date_after . '</p>';
350
  //EVENT
351
  $cff_event = '';
352
  if ($cff_show_event_title || $cff_show_event_details) {
353
  //Check for media
354
+ if ($cff_post_type == 'event') {
355
+
356
+ //Get the event object
357
+ $eventID = $PostID[1];
358
+ if ( $shared_event ) {
359
+ //Get the event id from the event URL. eg: http://www.facebook.com/events/123451234512345/
360
+ $event_url = parse_url($link);
361
+ $url_parts = explode('/', $event_url['path']);
362
+ //Get the id from the parts
363
+ $eventID = $url_parts[count($url_parts)-2];
364
+ }
365
+ //Get the contents of the event using the WP HTTP API
366
+ $event_json = fetchUrl('https://graph.facebook.com/'.$eventID.'?access_token=' . $access_token);
367
+ //Interpret data with JSON
368
+ $event_object = json_decode($event_json);
369
+
370
+ //EVENT
371
+ //Display the event details
372
+ $cff_event .= '<div class="details">';
373
+ //Show event title
374
+ if ($cff_show_event_title && !empty($event_object->name)) {
375
+ if ($cff_event_title_link) $cff_event .= '<a href="'.$link.'">';
376
+ $cff_event .= '<' . $cff_event_title_format . ' ' . $cff_event_title_styles . '>' . $event_object->name . '</' . $cff_event_title_format . '>';
377
+ if ($cff_event_title_link) $cff_event .= '</a>';
378
+ }
379
+ //Show event details
380
+ if ($cff_show_event_details){
381
+ $event_time = $event_object->start_time;
382
+ //If timezone migration is enabled then remove last 5 characters
383
+ if ( strlen($event_time) == 24 ) $event_time = substr($event_time, 0, -5);
384
+
385
+ //Event date
386
+ $cff_event_date_formatting = $options[ 'cff_event_date_formatting' ];
387
+ $cff_event_date_custom = $options[ 'cff_event_date_custom' ];
388
+
389
+ if (!empty($event_object->location)) $cff_event .= '<p class="where" ' . $cff_event_details_styles . '>' . $event_object->location . '</p>';
390
+ if (!empty($event_object->start_time)) $cff_event .= '<p class="when" ' . $cff_event_details_styles . '>' . cff_eventdate(strtotime($event_time), $cff_event_date_formatting, $cff_event_date_custom) . '</p>';
391
+ if (!empty($event_object->description)){
392
+ $description = $event_object->description;
393
+ if (!empty($body_limit)) {
394
+ if (strlen($description) > $body_limit) $description = substr($description, 0, $body_limit) . '...';
395
  }
396
+ $cff_event .= '<p class="info" ' . $cff_event_details_styles . '>' . cff_make_clickable($description) . '</p>';
397
  }
 
398
  }
399
+ $cff_event .= '</div>';
400
+
401
  }
402
  }
403
  //LINK
404
  //Display the link to the Facebook post or external link
405
  $cff_link = '';
406
  //Default link
407
+ if ($cff_facebook_link_text == '') $cff_facebook_link_text = 'View on Facebook';
408
+ $link_text = $cff_facebook_link_text;
409
+
410
  if (!empty($news->link)) {
 
411
  //Check whether it links to facebook or somewhere else
412
  $facebook_str = 'facebook.com';
413
  if(stripos($link, $facebook_str) == false) {
414
+ if ($cff_view_link_text == '') $cff_view_link_text = 'View Link';
415
+ $link_text = $cff_view_link_text;
416
  }
417
  }
418
+ $cff_link = '<a class="cff-viewpost" href="' . $link . '" title="' . $link_text . '" ' . $target . ' ' . $cff_link_styles . '>' . $link_text . '</a>';
419
 
420
 
421
  //**************************//
425
  $content .= '<div class="cff-item ';
426
  if ($news->type == 'link') $content .= 'link-item';
427
  $content .= '" ' . $cff_item_styles . '>';
428
+ //POST AUTHOR
429
+ if($cff_show_author) $content .= $cff_author;
430
+ //DATE ABOVE
431
+ if($cff_show_date && $cff_date_position == 'above') $content .= $cff_date;
432
  //POST TEXT
433
  if($cff_show_text) $content .= $cff_post_text;
434
  //DESCRIPTION
435
  if($cff_show_desc) $content .= $cff_description;
436
+ //SHARED LINK
437
  if($cff_show_desc) $content .= $cff_shared_link;
 
438
  //EVENT
439
  if($cff_show_event_title || $cff_show_event_details) $content .= $cff_event;
440
+ //DATE BELOW
441
+ if($cff_show_date && $cff_date_position == 'below') $content .= $cff_date;
442
+ //VIEW ON FACEBOOK LINK
443
  if($cff_show_link) $content .= $cff_link;
444
+
445
  //End the post item
446
+ $content .= '</div><div class="clear"></div>';
447
  } // End status check
448
  } // End the loop
449
  //Add the Like Box
450
  if ($cff_like_box_position == 'bottom' && $cff_show_like_box) $content .= $like_box;
451
  //End the feed
452
+ $content .= '</div><div class="clear"></div>';
453
  //Return our feed HTML to display
454
  return $content;
455
  }
479
  }
480
  //***FUNCTIONS***
481
  //Make links in text clickable
482
+ function cff_make_clickable($text) {
483
+ $pattern = '#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#';
484
+ return preg_replace_callback($pattern, 'auto_link_text_callback', $text);
 
 
 
 
 
 
 
 
 
 
485
  }
486
+ function auto_link_text_callback($matches) {
487
+ $max_url_length = 50;
488
+ $max_depth_if_over_length = 2;
489
+ $ellipsis = '&hellip;';
490
  $target = 'target="_blank"';
491
+
492
+ $url_full = $matches[0];
493
+ $url_short = '';
494
+
495
+ if (strlen($url_full) > $max_url_length) {
496
+ $parts = parse_url($url_full);
497
+ $url_short = $parts['scheme'] . '://' . preg_replace('/^www\./', '', $parts['host']) . '/';
498
+
499
+ $path_components = explode('/', trim($parts['path'], '/'));
500
+ foreach ($path_components as $dir) {
501
+ $url_string_components[] = $dir . '/';
502
+ }
503
+
504
+ if (!empty($parts['query'])) {
505
+ $url_string_components[] = '?' . $parts['query'];
506
+ }
507
+
508
+ if (!empty($parts['fragment'])) {
509
+ $url_string_components[] = '#' . $parts['fragment'];
510
+ }
511
+
512
+ for ($k = 0; $k < count($url_string_components); $k++) {
513
+ $curr_component = $url_string_components[$k];
514
+ if ($k >= $max_depth_if_over_length || strlen($url_short) + strlen($curr_component) > $max_url_length) {
515
+ if ($k == 0 && strlen($url_short) < $max_url_length) {
516
+ // Always show a portion of first directory
517
+ $url_short .= substr($curr_component, 0, $max_url_length - strlen($url_short));
518
+ }
519
+ $url_short .= $ellipsis;
520
+ break;
521
+ }
522
+ $url_short .= $curr_component;
523
+ }
524
+
525
+ } else {
526
+ $url_short = $url_full;
527
  }
528
+
529
+ return "<a class='break-word' rel=\"nofollow\" href=\"$url_full\">$url_short</a>";
530
  }
531
+
532
+
533
+ //Make links into span instead when the post text is made clickable
534
+ function cff_wrap_span($text) {
535
+ $pattern = '#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#';
536
+ return preg_replace_callback($pattern, 'cff_wrap_span_callback', $text);
537
  }
538
+ function cff_wrap_span_callback($matches) {
539
+ $max_url_length = 50;
540
+ $max_depth_if_over_length = 2;
541
+ $ellipsis = '&hellip;';
542
+ $target = 'target="_blank"';
543
+
544
+ $url_full = $matches[0];
545
+ $url_short = '';
546
+
547
+ if (strlen($url_full) > $max_url_length) {
548
+ $parts = parse_url($url_full);
549
+ $url_short = $parts['scheme'] . '://' . preg_replace('/^www\./', '', $parts['host']) . '/';
550
+
551
+ $path_components = explode('/', trim($parts['path'], '/'));
552
+ foreach ($path_components as $dir) {
553
+ $url_string_components[] = $dir . '/';
554
+ }
555
+
556
+ if (!empty($parts['query'])) {
557
+ $url_string_components[] = '?' . $parts['query'];
558
+ }
559
+
560
+ if (!empty($parts['fragment'])) {
561
+ $url_string_components[] = '#' . $parts['fragment'];
562
+ }
563
+
564
+ for ($k = 0; $k < count($url_string_components); $k++) {
565
+ $curr_component = $url_string_components[$k];
566
+ if ($k >= $max_depth_if_over_length || strlen($url_short) + strlen($curr_component) > $max_url_length) {
567
+ if ($k == 0 && strlen($url_short) < $max_url_length) {
568
+ // Always show a portion of first directory
569
+ $url_short .= substr($curr_component, 0, $max_url_length - strlen($url_short));
570
+ }
571
+ $url_short .= $ellipsis;
572
+ break;
573
+ }
574
+ $url_short .= $curr_component;
575
+ }
576
+
577
+ } else {
578
+ $url_short = $url_full;
579
+ }
580
+
581
+ return "<span class='break-word'>$url_short</span>";
582
  }
583
+
584
+
585
+ //2013-04-28T21:06:56+0000
586
+ //Time stamp function - used for posts
587
+ function cff_getdate($original, $date_format, $custom_date) {
588
+ switch ($date_format) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
589
 
590
+ case '2':
591
+ $print = date('F jS, g:i a', $original);
592
  break;
593
+ case '3':
594
+ $print = date('F jS', $original);
595
+ break;
596
+ case '4':
597
+ $print = date('D F jS', $original);
598
+ break;
599
+ case '5':
600
+ $print = date('l F jS', $original);
601
+ break;
602
+ case '6':
603
+ $print = date('D M jS, Y', $original);
604
+ break;
605
+ case '7':
606
+ $print = date('l F jS, Y', $original);
607
+ break;
608
+ case '8':
609
+ $print = date('l F jS, Y - g:i a', $original);
610
+ break;
611
+ case '9':
612
+ $print = date("l M jS, 'y", $original);
613
+ break;
614
+ case '10':
615
+ $print = date('m.d.y', $original);
616
+ break;
617
+ case '11':
618
+ $print = date('m/d/y', $original);
619
+ break;
620
+ case '12':
621
+ $print = date('d.m.y', $original);
622
+ break;
623
+ case '13':
624
+ $print = date('d/m/y', $original);
625
+ break;
626
+
627
+ default:
628
+
629
+ $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
630
+ $lengths = array("60","60","24","7","4.35","12","10");
631
+ $now = time();
632
+
633
+ // is it future date or past date
634
+ if($now > $original) {
635
+ $difference = $now - $original;
636
+ $tense = "ago";
637
+ } else {
638
+ $difference = $original - $now;
639
+ $tense = "from now";
640
+ }
641
+ for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
642
+ $difference /= $lengths[$j];
643
+ }
644
+
645
+ $difference = round($difference);
646
+
647
+ if($difference != 1) {
648
+ $periods[$j].= "s";
649
+ }
650
+
651
+ $print = "$difference $periods[$j] {$tense}";
652
+
653
+ break;
654
+
655
+
656
  }
657
+ if ( !empty($custom_date) ){
658
+ $print = date($custom_date, $original);
659
+ }
660
+ return $print;
661
+ }
662
+
663
+
664
+ function cff_eventdate($original, $date_format, $custom_date) {
665
+ switch ($date_format) {
666
 
667
+ case '2':
668
+ $print = date('F jS, g:ia', $original);
669
+ break;
670
+ case '3':
671
+ $print = date('g:ia - F jS', $original);
672
+ break;
673
+ case '4':
674
+ $print = date('g:ia, F jS', $original);
675
+ break;
676
+ case '5':
677
+ $print = date('l F jS - g:ia', $original);
678
+ break;
679
+ case '6':
680
+ $print = date('D M jS, Y, g:iA', $original);
681
+ break;
682
+ case '7':
683
+ $print = date('l F jS, Y, g:iA', $original);
684
+ break;
685
+ case '8':
686
+ $print = date('l F jS, Y - g:ia', $original);
687
+ break;
688
+ case '9':
689
+ $print = date("l M jS, 'y", $original);
690
+ break;
691
+ case '10':
692
+ $print = date('m.d.y - g:iA', $original);
693
+ break;
694
+ case '11':
695
+ $print = date('m/d/y, g:ia', $original);
696
+ break;
697
+ case '12':
698
+ $print = date('d.m.y - g:iA', $original);
699
+ break;
700
+ case '13':
701
+ $print = date('d/m/y, g:ia', $original);
702
+ break;
703
+
704
+ default:
705
+ $print = date('F j, Y, g:ia', $original);
706
+ break;
707
+ }
708
+ if ( !empty($custom_date) ){
709
+ $print = date($custom_date, $original);
710
  }
711
  return $print;
712
  }
713
+
714
+
715
+
716
  //Enqueue stylesheet
717
  add_action( 'wp_enqueue_scripts', 'cff_add_my_stylesheet' );
718
  function cff_add_my_stylesheet() {
720
  wp_register_style( 'cff', plugins_url('css/cff-style.css', __FILE__) );
721
  wp_enqueue_style( 'cff' );
722
  }
723
+
724
+ //Enqueue scripts
725
+ add_action( 'wp_enqueue_scripts', 'cff_scripts_method' );
726
+ function cff_scripts_method() {
727
+ wp_enqueue_script(
728
+ 'cffscripts',
729
+ plugins_url( '/js/cff-scripts.js' , __FILE__ ),
730
+ array( 'jquery' )
731
+ );
732
+ }
733
+
734
  //Allows shortcodes in sidebar of theme
735
  add_filter('widget_text', 'do_shortcode');
736
  function cff_activate() {
755
  delete_option( 'cff_access_token' );
756
  delete_option( 'cff_page_id' );
757
  delete_option( 'cff_num_show' );
758
+ delete_option( 'cff_show_others' );
759
  delete_option( 'cff_title_length' );
760
  delete_option( 'cff_body_length' );
761
  delete_option('cff_style_settings');
js/cff-scripts.js ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+
3
+ //Wpautop fix
4
+ if( jQuery('.cff-viewpost').parent('p').length ){
5
+ jQuery('.cff-viewpost').unwrap('p');
6
+ }
7
+ if( jQuery('#cff .link').parent('p').length ){
8
+ jQuery('#cff .link').unwrap('p');
9
+ }
10
+
11
+ //Expand post
12
+ jQuery('.cff-item').each(function(){
13
+ var $self = jQuery(this),
14
+ expanded = false,
15
+ $post_text = $self.find('.cff-post-text span');
16
+ //If the text is linked then use the text within the link
17
+ if ( $post_text.find('a.cff-post-text-link').length ) $post_text = $self.find('.cff-post-text span a');
18
+ var full_text = $post_text.html(),
19
+ short_text = $post_text.html().substring(0,text_limit);
20
+
21
+ //Cut the text based on limits set
22
+ $post_text.html( short_text );
23
+ //Append link to end of text
24
+ if (full_text.length > text_limit) $post_text.after('... <a class="cff-expand" href="#">See More</a>');
25
+
26
+ //Click function
27
+ $self.find('.cff-expand').click(function(e){
28
+ e.preventDefault();
29
+ var $expand = jQuery(this);
30
+
31
+ if (expanded == false){
32
+ $post_text.html( full_text );
33
+ expanded = true;
34
+ $expand.text('See Less');
35
+ } else {
36
+ $post_text.html( short_text );
37
+ expanded = false;
38
+ $expand.text('See More');
39
+ }
40
+ });
41
+ });
42
+
43
+ console.log(text_limit);
44
+
45
+ });