Custom Facebook Feed - Version 1.4.4

Version Description

  • New: Added more shortcode options
  • Minor tweaks
Download this release

Release Info

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

Code changes from version 1.4.3 to 1.4.4

Files changed (2) hide show
  1. README.txt +3 -2
  2. custom-facebook-feed.php +107 -50
README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: smashballoon
3
  Tags: facebook, custom, customizable, feed, seo, search engine, responsive, mobile, shortcode, social, status
4
  Requires at least: 3.0
5
  Tested up to: 3.5.1
6
- Stable tag: 1.4.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -88,7 +88,8 @@ You can embed the feed directly into a template file by using the WordPress do_s
88
 
89
  == Changelog ==
90
 
91
- = 1.4.3 =
 
92
  * Minor tweaks
93
 
94
  = 1.4.2 =
3
  Tags: facebook, custom, customizable, feed, seo, search engine, responsive, mobile, shortcode, social, status
4
  Requires at least: 3.0
5
  Tested up to: 3.5.1
6
+ Stable tag: 1.4.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
88
 
89
  == Changelog ==
90
 
91
+ = 1.4.4 =
92
+ * New: Added more shortcode options
93
  * Minor tweaks
94
 
95
  = 1.4.2 =
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.3
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
@@ -27,14 +27,72 @@ include dirname( __FILE__ ) .'/custom-facebook-feed-admin.php';
27
  // Add shortcodes
28
  add_shortcode('custom-facebook-feed', 'display_cff');
29
  function display_cff($atts) {
30
-
31
  //Style options
32
  $options = get_option('cff_style_settings');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  /********** GENERAL **********/
34
- $cff_feed_width = $options[ 'cff_feed_width' ];
35
- $cff_feed_height = $options[ 'cff_feed_height' ];
36
- $cff_feed_padding = $options[ 'cff_feed_padding' ];
37
- $cff_bg_color = $options[ 'cff_bg_color' ];
38
  //Compile feed styles
39
  $cff_feed_styles = 'style="';
40
  if ( !empty($cff_feed_width) ) $cff_feed_styles .= 'width:' . $cff_feed_width . '; ';
@@ -43,77 +101,78 @@ function display_cff($atts) {
43
  if ( !empty($cff_bg_color) ) $cff_feed_styles .= 'background-color:#' . $cff_bg_color . '; ';
44
  $cff_feed_styles .= '"';
45
  //Like box
46
- $cff_like_box_position = $options[ 'cff_like_box_position' ];
47
  //Open links in new window?
48
  $cff_open_links = $options[ 'cff_open_links' ];
49
  $target = 'target="_blank"';
50
  if ($cff_open_links) $target = 'target="_blank"';
51
  /********** LAYOUT **********/
52
- //Include
53
- $cff_show_text = $options[ 'cff_show_text' ];
54
- $cff_show_desc = $options[ 'cff_show_desc' ];
55
- $cff_show_date = $options[ 'cff_show_date' ];
56
- $cff_show_event_title = $options[ 'cff_show_event_title' ];
57
- $cff_show_event_details = $options[ 'cff_show_event_details' ];
58
- $cff_show_link = $options[ 'cff_show_link' ];
59
- $cff_show_like_box = $options[ 'cff_show_like_box' ];
 
60
  /********** TYPOGRAPHY **********/
61
  //Title
62
- $cff_title_format = $options[ 'cff_title_format' ];
63
  if (empty($cff_title_format)) $cff_title_format = 'p';
64
- $cff_title_size = $options[ 'cff_title_size' ];
65
- $cff_title_weight = $options[ 'cff_title_weight' ];
66
- $cff_title_color = $options[ 'cff_title_color' ];
67
  $cff_title_styles = 'style="';
68
  if ( !empty($cff_title_size) && $cff_title_size != 'inherit' ) $cff_title_styles .= 'font-size:' . $cff_title_size . 'px; ';
69
  if ( !empty($cff_title_weight) && $cff_title_weight != 'inherit' ) $cff_title_styles .= 'font-weight:' . $cff_title_weight . '; ';
70
  if ( !empty($cff_title_color) ) $cff_title_styles .= 'color:#' . $cff_title_color . ';';
71
  $cff_title_styles .= '"';
72
- $cff_title_link = $options[ 'cff_title_link' ];
73
  //Description
74
- $cff_body_size = $options[ 'cff_body_size' ];
75
- $cff_body_weight = $options[ 'cff_body_weight' ];
76
- $cff_body_color = $options[ 'cff_body_color' ];
77
  $cff_body_styles = 'style="';
78
  if ( !empty($cff_body_size) && $cff_body_size != 'inherit' ) $cff_body_styles .= 'font-size:' . $cff_body_size . 'px; ';
79
  if ( !empty($cff_body_weight) && $cff_body_weight != 'inherit' ) $cff_body_styles .= 'font-weight:' . $cff_body_weight . '; ';
80
  if ( !empty($cff_body_color) ) $cff_body_styles .= 'color:#' . $cff_body_color . ';';
81
  $cff_body_styles .= '"';
82
  //Event Title
83
- $cff_event_title_format = $options[ 'cff_event_title_format' ];
84
  if (empty($cff_event_title_format)) $cff_event_title_format = 'p';
85
- $cff_event_title_size = $options[ 'cff_event_title_size' ];
86
- $cff_event_title_weight = $options[ 'cff_event_title_weight' ];
87
- $cff_event_title_color = $options[ 'cff_event_title_color' ];
88
  $cff_event_title_styles = 'style="';
89
  if ( !empty($cff_event_title_size) && $cff_event_title_size != 'inherit' ) $cff_event_title_styles .= 'font-size:' . $cff_event_title_size . 'px; ';
90
  if ( !empty($cff_event_title_weight) && $cff_event_title_weight != 'inherit' ) $cff_event_title_styles .= 'font-weight:' . $cff_event_title_weight . '; ';
91
  if ( !empty($cff_event_title_color) ) $cff_event_title_styles .= 'color:#' . $cff_event_title_color . ';';
92
  $cff_event_title_styles .= '"';
93
- $cff_event_title_link = $options[ 'cff_event_title_link' ];
94
 
95
  //Event Details
96
- $cff_event_details_size = $options[ 'cff_event_details_size' ];
97
- $cff_event_details_weight = $options[ 'cff_event_details_weight' ];
98
- $cff_event_details_color = $options[ 'cff_event_details_color' ];
99
  $cff_event_details_styles = 'style="';
100
  if ( !empty($cff_event_details_size) && $cff_event_details_size != 'inherit' ) $cff_event_details_styles .= 'font-size:' . $cff_event_details_size . 'px; ';
101
  if ( !empty($cff_event_details_weight) && $cff_event_details_weight != 'inherit' ) $cff_event_details_styles .= 'font-weight:' . $cff_event_details_weight . '; ';
102
  if ( !empty($cff_event_details_color) ) $cff_event_details_styles .= 'color:#' . $cff_event_details_color . ';';
103
  $cff_event_details_styles .= '"';
104
  //Date
105
- $cff_date_size = $options[ 'cff_date_size' ];
106
- $cff_date_weight = $options[ 'cff_date_weight' ];
107
- $cff_date_color = $options[ 'cff_date_color' ];
108
  $cff_date_styles = 'style="';
109
  if ( !empty($cff_date_size) && $cff_date_size != 'inherit' ) $cff_date_styles .= 'font-size:' . $cff_date_size . 'px; ';
110
  if ( !empty($cff_date_weight) && $cff_date_weight != 'inherit' ) $cff_date_styles .= 'font-weight:' . $cff_date_weight . '; ';
111
  if ( !empty($cff_date_color) ) $cff_date_styles .= 'color:#' . $cff_date_color . ';';
112
  $cff_date_styles .= '"';
113
  //Link to Facebook
114
- $cff_link_size = $options[ 'cff_link_size' ];
115
- $cff_link_weight = $options[ 'cff_link_weight' ];
116
- $cff_link_color = $options[ 'cff_link_color' ];
117
  $cff_link_styles = 'style="';
118
  if ( !empty($cff_link_size) && $cff_link_size != 'inherit' ) $cff_link_styles .= 'font-size:' . $cff_link_size . 'px; ';
119
  if ( !empty($cff_link_weight) && $cff_link_weight != 'inherit' ) $cff_link_styles .= 'font-weight:' . $cff_link_weight . '; ';
@@ -121,36 +180,34 @@ function display_cff($atts) {
121
  $cff_link_styles .= '"';
122
  /********** MISC **********/
123
  //Like Box styles
124
- $cff_likebox_bg_color = $options[ 'cff_likebox_bg_color' ];
125
  $cff_likebox_styles = 'style="';
126
  if ( !empty($cff_likebox_bg_color) ) $cff_likebox_styles .= 'background-color:#' . $cff_likebox_bg_color . '; margin-left: 0; ';
127
  $cff_likebox_styles .= '"';
128
  //Separating Line
129
- $cff_sep_color = $options[ 'cff_sep_color' ];
130
  if (empty($cff_sep_color)) $cff_sep_color = 'ddd';
131
- $cff_sep_size = $options[ 'cff_sep_size' ];
132
  if (empty($cff_sep_size)) $cff_sep_size = 0;
133
  //CFF item styles
134
  $cff_item_styles = 'style="';
135
  $cff_item_styles .= 'border-bottom: ' . $cff_sep_size . 'px solid #' . $cff_sep_color . '; ';
136
  $cff_item_styles .= '"';
137
 
138
- //Pass in shortcode attrbutes
139
- $atts = shortcode_atts(
140
- array(
141
- 'id' => get_option('cff_page_id'),
142
- 'show' => get_option('cff_num_show'),
143
- 'titlelength' => get_option('cff_title_length'),
144
- 'bodylength' => get_option('cff_body_length')
145
- ), $atts);
146
  //Text limits
147
- $title_limit = $atts['titlelength'];
148
- $body_limit = $atts['bodylength'];
149
  //Assign the Access Token and Page ID variables
150
  $access_token = get_option('cff_access_token');
151
  $page_id = $atts['id'];
152
  //Get show posts attribute. If not set then default to 10.
153
  $show_posts = $atts['show'];
 
 
 
 
154
  if ( $show_posts == 0 || $show_posts == undefined ) $show_posts = 10;
155
  //Check whether the Access Token is present and valid
156
  if ($access_token == '') {
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.4
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
27
  // Add shortcodes
28
  add_shortcode('custom-facebook-feed', 'display_cff');
29
  function display_cff($atts) {
30
+
31
  //Style options
32
  $options = get_option('cff_style_settings');
33
+
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,';
38
+ if($options[ 'cff_show_event_title' ]) $include_string .= 'eventtitle,';
39
+ if($options[ 'cff_show_event_details' ]) $include_string .= 'eventdetails,';
40
+ if($options[ 'cff_show_link' ]) $include_string .= 'link';
41
+ if($options[ 'cff_show_like_box' ]) $include_string .= 'likebox,';
42
+
43
+ //Pass in shortcode attrbutes
44
+ $atts = shortcode_atts(
45
+ array(
46
+ 'id' => get_option('cff_page_id'),
47
+ 'show' => get_option('cff_num_show'),
48
+ 'num' => get_option('cff_num_show'),
49
+ 'width' => $options[ 'cff_feed_width' ],
50
+ 'height' => $options[ 'cff_feed_height' ],
51
+ 'padding' => $options[ 'cff_feed_padding' ],
52
+ 'bgcolor' => $options[ 'cff_bg_color' ],
53
+ 'include' => $include_string,
54
+ //Typography
55
+ 'textformat' => $options[ 'cff_title_format' ],
56
+ 'textsize' => $options[ 'cff_title_size' ],
57
+ 'textweight' => $options[ 'cff_title_weight' ],
58
+ 'textcolor' => $options[ 'cff_title_color' ],
59
+ 'textlink' => $options[ 'cff_title_link' ],
60
+ 'descsize' => $options[ 'cff_body_size' ],
61
+ 'descweight' => $options[ 'cff_body_weight' ],
62
+ 'desccolor' => $options[ 'cff_body_color' ],
63
+ 'eventtitleformat' => $options[ 'cff_event_title_format' ],
64
+ 'eventtitlesize' => $options[ 'cff_event_title_size'
65
+ 'eventtitleweight' => $options[ 'cff_event_title_weight' ],
66
+ 'eventtitlecolor' => $options[ 'cff_event_title_color' ],
67
+ 'eventtitlelink' => $options[ 'cff_event_title_link' ],
68
+ 'eventdetailssize' => $options[ 'cff_event_details_size' ],
69
+ 'eventdetailsweight' => $options[ 'cff_event_details_weight' ],
70
+ 'eventdetailscolor' => $options[ 'cff_event_details_color' ],
71
+ 'datesize' => $options[ 'cff_date_size' ],
72
+ 'dateweight' => $options[ 'cff_date_weight' ],
73
+ 'datecolor' => $options[ 'cff_date_color' ],
74
+ 'linksize' => $options[ 'cff_link_size' ],
75
+ 'linkweight' => $options[ 'cff_link_weight' ],
76
+ 'linkcolor' => $options[ 'cff_link_color' ],
77
+ //Misc
78
+ 'textlength' => get_option('cff_title_length'),
79
+ 'desclength' => get_option('cff_body_length'),
80
+ 'likeboxpos' => $options[ 'cff_like_box_position' ],
81
+ 'likeboxcolor' => $options[ 'cff_likebox_bg_color' ],
82
+ 'videoheight' => $options[ 'cff_video_height' ],
83
+ 'videoaction' => $options[ 'cff_video_action' ],
84
+ 'sepcolor' => $options[ 'cff_sep_color' ],
85
+ 'sepsize' => $options[ 'cff_sep_size' ]
86
+ ), $atts);
87
+
88
+
89
+
90
+
91
  /********** GENERAL **********/
92
+ $cff_feed_width = $atts['width'];
93
+ $cff_feed_height = $atts[ 'height' ];
94
+ $cff_feed_padding = $atts[ 'padding' ];
95
+ $cff_bg_color = $atts[ 'bgcolor' ];
96
  //Compile feed styles
97
  $cff_feed_styles = 'style="';
98
  if ( !empty($cff_feed_width) ) $cff_feed_styles .= 'width:' . $cff_feed_width . '; ';
101
  if ( !empty($cff_bg_color) ) $cff_feed_styles .= 'background-color:#' . $cff_bg_color . '; ';
102
  $cff_feed_styles .= '"';
103
  //Like box
104
+ $cff_like_box_position = $atts[ 'likeboxpos' ];
105
  //Open links in new window?
106
  $cff_open_links = $options[ 'cff_open_links' ];
107
  $target = 'target="_blank"';
108
  if ($cff_open_links) $target = 'target="_blank"';
109
  /********** LAYOUT **********/
110
+ $cff_includes = $atts[ 'include' ];
111
+ //Look for non-plural version of string in the types string in case user specifies singular in shortcode
112
+ if ( stripos($cff_includes, 'text') !== false ) $cff_show_text = true;
113
+ if ( stripos($cff_includes, 'desc') !== false ) $cff_show_desc = true;
114
+ if ( stripos($cff_includes, 'date') !== false ) $cff_show_date = true;
115
+ if ( stripos($cff_includes, 'eventtitle') !== false ) $cff_show_event_title = true;
116
+ if ( stripos($cff_includes, 'eventdetail') !== false ) $cff_show_event_details = true;
117
+ if ( stripos($cff_includes, 'link') !== false ) $cff_show_link = true;
118
+ if ( stripos($cff_includes, 'like') !== false ) $cff_show_like_box = true;
119
  /********** TYPOGRAPHY **********/
120
  //Title
121
+ $cff_title_format = $atts[ 'textformat' ];
122
  if (empty($cff_title_format)) $cff_title_format = 'p';
123
+ $cff_title_size = $atts[ 'textsize' ];
124
+ $cff_title_weight = $atts[ 'textweight' ];
125
+ $cff_title_color = $atts[ 'textcolor' ];
126
  $cff_title_styles = 'style="';
127
  if ( !empty($cff_title_size) && $cff_title_size != 'inherit' ) $cff_title_styles .= 'font-size:' . $cff_title_size . 'px; ';
128
  if ( !empty($cff_title_weight) && $cff_title_weight != 'inherit' ) $cff_title_styles .= 'font-weight:' . $cff_title_weight . '; ';
129
  if ( !empty($cff_title_color) ) $cff_title_styles .= 'color:#' . $cff_title_color . ';';
130
  $cff_title_styles .= '"';
131
+ $cff_title_link = $atts[ 'textlink' ];
132
  //Description
133
+ $cff_body_size = $atts[ 'descsize' ];
134
+ $cff_body_weight = $atts[ 'descweight' ];
135
+ $cff_body_color = $atts[ 'desccolor' ];
136
  $cff_body_styles = 'style="';
137
  if ( !empty($cff_body_size) && $cff_body_size != 'inherit' ) $cff_body_styles .= 'font-size:' . $cff_body_size . 'px; ';
138
  if ( !empty($cff_body_weight) && $cff_body_weight != 'inherit' ) $cff_body_styles .= 'font-weight:' . $cff_body_weight . '; ';
139
  if ( !empty($cff_body_color) ) $cff_body_styles .= 'color:#' . $cff_body_color . ';';
140
  $cff_body_styles .= '"';
141
  //Event Title
142
+ $cff_event_title_format = $atts[ 'eventtitleformat' ];
143
  if (empty($cff_event_title_format)) $cff_event_title_format = 'p';
144
+ $cff_event_title_size = $atts[ 'eventtitlesize' ];
145
+ $cff_event_title_weight = $atts[ 'eventtitleweight' ];
146
+ $cff_event_title_color = $atts[ 'eventtitlecolor' ];
147
  $cff_event_title_styles = 'style="';
148
  if ( !empty($cff_event_title_size) && $cff_event_title_size != 'inherit' ) $cff_event_title_styles .= 'font-size:' . $cff_event_title_size . 'px; ';
149
  if ( !empty($cff_event_title_weight) && $cff_event_title_weight != 'inherit' ) $cff_event_title_styles .= 'font-weight:' . $cff_event_title_weight . '; ';
150
  if ( !empty($cff_event_title_color) ) $cff_event_title_styles .= 'color:#' . $cff_event_title_color . ';';
151
  $cff_event_title_styles .= '"';
152
+ $cff_event_title_link = $atts[ 'eventtitlelink' ];
153
 
154
  //Event Details
155
+ $cff_event_details_size = $atts[ 'eventdetailssize' ];
156
+ $cff_event_details_weight = $atts[ 'eventdetailsweight' ];
157
+ $cff_event_details_color = $atts[ 'eventdetailscolor' ];
158
  $cff_event_details_styles = 'style="';
159
  if ( !empty($cff_event_details_size) && $cff_event_details_size != 'inherit' ) $cff_event_details_styles .= 'font-size:' . $cff_event_details_size . 'px; ';
160
  if ( !empty($cff_event_details_weight) && $cff_event_details_weight != 'inherit' ) $cff_event_details_styles .= 'font-weight:' . $cff_event_details_weight . '; ';
161
  if ( !empty($cff_event_details_color) ) $cff_event_details_styles .= 'color:#' . $cff_event_details_color . ';';
162
  $cff_event_details_styles .= '"';
163
  //Date
164
+ $cff_date_size = $atts[ 'datesize' ];
165
+ $cff_date_weight = $atts[ 'dateweight' ];
166
+ $cff_date_color = $atts[ 'datecolor' ];
167
  $cff_date_styles = 'style="';
168
  if ( !empty($cff_date_size) && $cff_date_size != 'inherit' ) $cff_date_styles .= 'font-size:' . $cff_date_size . 'px; ';
169
  if ( !empty($cff_date_weight) && $cff_date_weight != 'inherit' ) $cff_date_styles .= 'font-weight:' . $cff_date_weight . '; ';
170
  if ( !empty($cff_date_color) ) $cff_date_styles .= 'color:#' . $cff_date_color . ';';
171
  $cff_date_styles .= '"';
172
  //Link to Facebook
173
+ $cff_link_size = $atts[ 'linksize' ];
174
+ $cff_link_weight = $atts[ 'linkweight' ];
175
+ $cff_link_color = $atts[ 'linkcolor' ];
176
  $cff_link_styles = 'style="';
177
  if ( !empty($cff_link_size) && $cff_link_size != 'inherit' ) $cff_link_styles .= 'font-size:' . $cff_link_size . 'px; ';
178
  if ( !empty($cff_link_weight) && $cff_link_weight != 'inherit' ) $cff_link_styles .= 'font-weight:' . $cff_link_weight . '; ';
180
  $cff_link_styles .= '"';
181
  /********** MISC **********/
182
  //Like Box styles
183
+ $cff_likebox_bg_color = $atts[ 'likeboxcolor' ];
184
  $cff_likebox_styles = 'style="';
185
  if ( !empty($cff_likebox_bg_color) ) $cff_likebox_styles .= 'background-color:#' . $cff_likebox_bg_color . '; margin-left: 0; ';
186
  $cff_likebox_styles .= '"';
187
  //Separating Line
188
+ $cff_sep_color = $atts[ 'sepcolor' ];
189
  if (empty($cff_sep_color)) $cff_sep_color = 'ddd';
190
+ $cff_sep_size = $atts[ 'sepsize' ];
191
  if (empty($cff_sep_size)) $cff_sep_size = 0;
192
  //CFF item styles
193
  $cff_item_styles = 'style="';
194
  $cff_item_styles .= 'border-bottom: ' . $cff_sep_size . 'px solid #' . $cff_sep_color . '; ';
195
  $cff_item_styles .= '"';
196
 
197
+
198
+
 
 
 
 
 
 
199
  //Text limits
200
+ $title_limit = $atts['textlength'];
201
+ $body_limit = $atts['desclength'];
202
  //Assign the Access Token and Page ID variables
203
  $access_token = get_option('cff_access_token');
204
  $page_id = $atts['id'];
205
  //Get show posts attribute. If not set then default to 10.
206
  $show_posts = $atts['show'];
207
+ if ( empty($show_posts) ) {
208
+ $show_posts = $atts['num'];
209
+ if (empty($show_posts)) $show_posts = 25;
210
+ }
211
  if ( $show_posts == 0 || $show_posts == undefined ) $show_posts = 10;
212
  //Check whether the Access Token is present and valid
213
  if ($access_token == '') {