PluginProbe ʕ •ᴥ•ʔ
Smash Balloon Social Post Feed – Simple Social Feeds for WordPress / 1.6.7
Smash Balloon Social Post Feed – Simple Social Feeds for WordPress v1.6.7
4.8.1 trunk 1.0 1.1 1.12.1 1.2.3 1.2.4 1.2.5 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.5 1.5.1 1.5.2 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.4.1 1.6.5 1.6.5.1 1.6.6 1.6.6.1 1.6.6.2 1.6.6.3 1.6.7 1.6.7.1 1.6.8 1.6.8.1 1.6.8.2 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.9.0 1.9.1 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.8.1 1.9.9 1.9.9.1 1.9.9.2 1.9.9.3 2.0 2.0.1 2.1 2.1.1 2.1.2 2.1.3 2.10 2.11 2.11.1 2.12 2.12.1 2.12.2 2.12.3 2.12.4 2.13 2.14 2.14.1 2.15 2.15.1 2.16 2.16.1 2.17 2.17.1 2.18 2.18.1 2.18.2 2.18.3 2.19 2.19.1 2.19.2 2.19.3 2.2 2.2.1 2.3 2.3.1 2.3.10 2.3.2 2.3.3 2.3.4 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.1.1 2.4.1.2 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.5 2.5.1 2.5.2 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.7 2.7.1 2.7.2 2.8 2.9 2.9.1 4.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.1 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.7.5 4.7.6 4.7.7
custom-facebook-feed / custom-facebook-feed.php
custom-facebook-feed Last commit date
css 12 years ago img 12 years ago js 12 years ago README.txt 12 years ago custom-facebook-feed-admin.php 12 years ago custom-facebook-feed.php 12 years ago gpl-2.0.txt 13 years ago
custom-facebook-feed.php
980 lines
1 <?php
2 /*
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.6.7
7 Author: Smash Balloon
8 Author URI: http://smashballoon.com/
9 License: GPLv2 or later
10 */
11 /*
12 Copyright 2013 Smash Balloon (email : hey@smashballoon.com)
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25 //Include admin
26 include dirname( __FILE__ ) .'/custom-facebook-feed-admin.php';
27 // Add shortcodes
28 add_shortcode('custom-facebook-feed', 'display_cff');
29 function display_cff($atts) {
30
31 //Style options
32 $options = get_option('cff_style_settings');
33 //Create the types string to set as shortcode default
34 $include_string = '';
35 if($options[ 'cff_show_text' ]) $include_string .= 'text,';
36 if($options[ 'cff_show_desc' ]) $include_string .= 'desc,';
37 if($options[ 'cff_show_shared_links' ]) $include_string .= 'sharedlinks,';
38 if($options[ 'cff_show_date' ]) $include_string .= 'date,';
39 if($options[ 'cff_show_media' ]) $include_string .= 'media,';
40 if($options[ 'cff_show_event_title' ]) $include_string .= 'eventtitle,';
41 if($options[ 'cff_show_event_details' ]) $include_string .= 'eventdetails,';
42 if($options[ 'cff_show_meta' ]) $include_string .= 'social,';
43 if($options[ 'cff_show_link' ]) $include_string .= 'link,';
44 if($options[ 'cff_show_like_box' ]) $include_string .= 'likebox,';
45 //Pass in shortcode attrbutes
46 $atts = shortcode_atts(
47 array(
48 'id' => get_option('cff_page_id'),
49 'num' => get_option('cff_num_show'),
50 'limit' => get_option('cff_post_limit'),
51 'others' => get_option('cff_show_others'),
52 'cachetime' => get_option('cff_cache_time'),
53 'cacheunit' => get_option('cff_cache_time_unit'),
54 'locale' => get_option('cff_locale'),
55 'width' => $options[ 'cff_feed_width' ],
56 'height' => $options[ 'cff_feed_height' ],
57 'padding' => $options[ 'cff_feed_padding' ],
58 'bgcolor' => $options[ 'cff_bg_color' ],
59 'showauthor' => $options[ 'cff_show_author' ],
60 'class' => $options[ 'cff_class' ],
61 'layout' => $options[ 'cff_preset_layout' ],
62 'include' => $include_string,
63 //Typography
64 'seemoretext' => $options[ 'cff_see_more_text' ],
65 'seelesstext' => $options[ 'cff_see_less_text' ],
66 'textformat' => $options[ 'cff_title_format' ],
67 'textsize' => $options[ 'cff_title_size' ],
68 'textweight' => $options[ 'cff_title_weight' ],
69 'textcolor' => $options[ 'cff_title_color' ],
70 'textlink' => $options[ 'cff_title_link' ],
71 'descsize' => $options[ 'cff_body_size' ],
72 'descweight' => $options[ 'cff_body_weight' ],
73 'desccolor' => $options[ 'cff_body_color' ],
74 //Event title
75 'eventtitleformat' => $options[ 'cff_event_title_format' ],
76 'eventtitlesize' => $options[ 'cff_event_title_size' ],
77 'eventtitleweight' => $options[ 'cff_event_title_weight' ],
78 'eventtitlecolor' => $options[ 'cff_event_title_color' ],
79 'eventtitlelink' => $options[ 'cff_event_title_link' ],
80 //Event date
81 'eventdatesize' => $options[ 'cff_event_date_size' ],
82 'eventdateweight' => $options[ 'cff_event_date_weight' ],
83 'eventdatecolor' => $options[ 'cff_event_date_color' ],
84 'eventdatepos' => $options[ 'cff_event_date_position' ],
85 'eventdateformat' => $options[ 'cff_event_date_formatting' ],
86 'eventdatecustom' => $options[ 'cff_event_date_custom' ],
87 //Event details
88 'eventdetailssize' => $options[ 'cff_event_details_size' ],
89 'eventdetailsweight' => $options[ 'cff_event_details_weight' ],
90 'eventdetailscolor' => $options[ 'cff_event_details_color' ],
91 //Date
92 'datepos' => $options[ 'cff_date_position' ],
93 'datesize' => $options[ 'cff_date_size' ],
94 'dateweight' => $options[ 'cff_date_weight' ],
95 'datecolor' => $options[ 'cff_date_color' ],
96 'dateformat' => $options[ 'cff_date_formatting' ],
97 'datecustom' => $options[ 'cff_date_custom' ],
98 'linksize' => $options[ 'cff_link_size' ],
99 'linkweight' => $options[ 'cff_link_weight' ],
100 'linkcolor' => $options[ 'cff_link_color' ],
101 'facebooklinktext' => $options[ 'cff_facebook_link_text' ],
102 'viewlinktext' => $options[ 'cff_view_link_text' ],
103 'linktotimeline' => $options[ 'cff_link_to_timeline' ],
104 //Social
105 'iconstyle' => $options[ 'cff_icon_style' ],
106 'socialtextcolor' => $options[ 'cff_meta_text_color' ],
107 'socialbgcolor' => $options[ 'cff_meta_bg_color' ],
108 //Misc
109 'textlength' => get_option('cff_title_length'),
110 'desclength' => get_option('cff_body_length'),
111 'likeboxpos' => $options[ 'cff_like_box_position' ],
112 'likeboxoutside' => $options[ 'cff_like_box_outside' ],
113 'likeboxcolor' => $options[ 'cff_likebox_bg_color' ],
114 'likeboxwidth' => $options[ 'cff_likebox_width' ],
115 'likeboxfaces' => $options[ 'cff_like_box_faces' ],
116
117 'videoheight' => $options[ 'cff_video_height' ],
118 'videoaction' => $options[ 'cff_video_action' ],
119 'sepcolor' => $options[ 'cff_sep_color' ],
120 'sepsize' => $options[ 'cff_sep_size' ]
121 ), $atts);
122 /********** GENERAL **********/
123 $cff_feed_width = $atts['width'];
124 $cff_feed_height = $atts[ 'height' ];
125 $cff_feed_padding = $atts[ 'padding' ];
126 $cff_bg_color = $atts[ 'bgcolor' ];
127 $cff_show_author = $atts[ 'showauthor' ];
128 $cff_cache_time = $atts[ 'cachetime' ];
129 $cff_locale = $atts[ 'locale' ];
130 if ( empty($cff_locale) || !isset($cff_locale) || $cff_locale == '' ) $cff_locale = 'en_US';
131 if (!isset($cff_cache_time)) $cff_cache_time = 0;
132 $cff_cache_time_unit = $atts[ 'cacheunit' ];
133 $cff_class = $atts['class'];
134 //Compile feed styles
135 $cff_feed_styles = 'style="';
136 if ( !empty($cff_feed_width) ) $cff_feed_styles .= 'width:' . $cff_feed_width . '; ';
137 if ( !empty($cff_feed_height) ) $cff_feed_styles .= 'height:' . $cff_feed_height . '; ';
138 if ( !empty($cff_feed_padding) ) $cff_feed_styles .= 'padding:' . $cff_feed_padding . '; ';
139 if ( !empty($cff_bg_color) ) $cff_feed_styles .= 'background-color:#' . $cff_bg_color . '; ';
140 $cff_feed_styles .= '"';
141 //Like box
142 $cff_like_box_position = $atts[ 'likeboxpos' ];
143 $cff_like_box_outside = $atts[ 'likeboxoutside' ];
144 //Open links in new window?
145 $target = 'target="_blank"';
146 /********** POST TYPES **********/
147 $cff_show_links_type = true;
148 $cff_show_event_type = true;
149 $cff_show_video_type = true;
150 $cff_show_photos_type = true;
151 $cff_show_status_type = true;
152 $cff_events_only = false;
153 //Are we showing ONLY events?
154 if ($cff_show_event_type && !$cff_show_links_type && !$cff_show_video_type && !$cff_show_photos_type && !$cff_show_status_type) $cff_events_only = true;
155 /********** LAYOUT **********/
156 $cff_includes = $atts[ 'include' ];
157 //Look for non-plural version of string in the types string in case user specifies singular in shortcode
158 if ( stripos($cff_includes, 'text') !== false ) $cff_show_text = true;
159 if ( stripos($cff_includes, 'desc') !== false ) $cff_show_desc = true;
160 if ( stripos($cff_includes, 'sharedlink') !== false ) $cff_show_shared_links = true;
161 if ( stripos($cff_includes, 'date') !== false ) $cff_show_date = true;
162 if ( stripos($cff_includes, 'media') !== false ) $cff_show_media = true;
163 if ( stripos($cff_includes, 'eventtitle') !== false ) $cff_show_event_title = true;
164 if ( stripos($cff_includes, 'eventdetail') !== false ) $cff_show_event_details = true;
165 if ( stripos($cff_includes, 'social') !== false ) $cff_show_meta = true;
166 if ( stripos($cff_includes, ',link') !== false ) $cff_show_link = true; //comma used to separate it from 'sharedlinks' - which also contains 'link' string
167 if ( stripos($cff_includes, 'like') !== false ) $cff_show_like_box = true;
168 $cff_preset_layout = 'thumb';
169
170 /********** META **********/
171 $cff_icon_style = $atts[ 'iconstyle' ];
172 $cff_meta_text_color = $atts[ 'socialtextcolor' ];
173 $cff_meta_bg_color = $atts[ 'socialbgcolor' ];
174 $cff_meta_styles = 'style="';
175 if ( !empty($cff_meta_text_color) ) $cff_meta_styles .= 'color:#' . $cff_meta_text_color . ';';
176 if ( !empty($cff_meta_bg_color) ) $cff_meta_styles .= 'background-color:#' . $cff_meta_bg_color . ';';
177 $cff_meta_styles .= '"';
178 $cff_nocomments_text = $options[ 'cff_nocomments_text' ];
179 $cff_hide_comments = $options[ 'cff_hide_comments' ];
180 if (!isset($cff_nocomments_text) || empty($cff_nocomments_text)) $cff_hide_comments = true;
181 /********** TYPOGRAPHY **********/
182 //See More text
183 $cff_see_more_text = $atts[ 'seemoretext' ];
184 $cff_see_less_text = $atts[ 'seelesstext' ];
185 //See Less text
186 //Title
187 $cff_title_format = $atts[ 'textformat' ];
188 if (empty($cff_title_format)) $cff_title_format = 'p';
189 $cff_title_size = $atts[ 'textsize' ];
190 $cff_title_weight = $atts[ 'textweight' ];
191 $cff_title_color = $atts[ 'textcolor' ];
192 $cff_title_styles = 'style="';
193 if ( !empty($cff_title_size) && $cff_title_size != 'inherit' ) $cff_title_styles .= 'font-size:' . $cff_title_size . 'px; ';
194 if ( !empty($cff_title_weight) && $cff_title_weight != 'inherit' ) $cff_title_styles .= 'font-weight:' . $cff_title_weight . '; ';
195 if ( !empty($cff_title_color) ) $cff_title_styles .= 'color:#' . $cff_title_color . ';';
196 $cff_title_styles .= '"';
197 $cff_title_link = $atts[ 'textlink' ];
198 //Description
199 $cff_body_size = $atts[ 'descsize' ];
200 $cff_body_weight = $atts[ 'descweight' ];
201 $cff_body_color = $atts[ 'desccolor' ];
202 $cff_body_styles = 'style="';
203 if ( !empty($cff_body_size) && $cff_body_size != 'inherit' ) $cff_body_styles .= 'font-size:' . $cff_body_size . 'px; ';
204 if ( !empty($cff_body_weight) && $cff_body_weight != 'inherit' ) $cff_body_styles .= 'font-weight:' . $cff_body_weight . '; ';
205 if ( !empty($cff_body_color) ) $cff_body_styles .= 'color:#' . $cff_body_color . ';';
206 $cff_body_styles .= '"';
207 //Event Title
208 $cff_event_title_format = $atts[ 'eventtitleformat' ];
209 if (empty($cff_event_title_format)) $cff_event_title_format = 'p';
210 $cff_event_title_size = $atts[ 'eventtitlesize' ];
211 $cff_event_title_weight = $atts[ 'eventtitleweight' ];
212 $cff_event_title_color = $atts[ 'eventtitlecolor' ];
213 $cff_event_title_styles = 'style="';
214 if ( !empty($cff_event_title_size) && $cff_event_title_size != 'inherit' ) $cff_event_title_styles .= 'font-size:' . $cff_event_title_size . 'px; ';
215 if ( !empty($cff_event_title_weight) && $cff_event_title_weight != 'inherit' ) $cff_event_title_styles .= 'font-weight:' . $cff_event_title_weight . '; ';
216 if ( !empty($cff_event_title_color) ) $cff_event_title_styles .= 'color:#' . $cff_event_title_color . ';';
217 $cff_event_title_styles .= '"';
218 $cff_event_title_link = $atts[ 'eventtitlelink' ];
219 //Event Date
220 $cff_event_date_size = $atts[ 'eventdatesize' ];
221 $cff_event_date_weight = $atts[ 'eventdateweight' ];
222 $cff_event_date_color = $atts[ 'eventdatecolor' ];
223 $cff_event_date_position = $atts[ 'eventdatepos' ];
224 $cff_event_date_formatting = $atts[ 'eventdateformat' ];
225 $cff_event_date_custom = $atts[ 'eventdatecustom' ];
226 $cff_event_date_styles = 'style="';
227 if ( !empty($cff_event_date_size) && $cff_event_date_size != 'inherit' ) $cff_event_date_styles .= 'font-size:' . $cff_event_date_size . 'px; ';
228 if ( !empty($cff_event_date_weight) && $cff_event_date_weight != 'inherit' ) $cff_event_date_styles .= 'font-weight:' . $cff_event_date_weight . '; ';
229 if ( !empty($cff_event_date_color) ) $cff_event_date_styles .= 'color:#' . $cff_event_date_color . ';';
230 $cff_event_date_styles .= '"';
231 //Event Details
232 $cff_event_details_size = $atts[ 'eventdetailssize' ];
233 $cff_event_details_weight = $atts[ 'eventdetailsweight' ];
234 $cff_event_details_color = $atts[ 'eventdetailscolor' ];
235 $cff_event_details_styles = 'style="';
236 if ( !empty($cff_event_details_size) && $cff_event_details_size != 'inherit' ) $cff_event_details_styles .= 'font-size:' . $cff_event_details_size . 'px; ';
237 if ( !empty($cff_event_details_weight) && $cff_event_details_weight != 'inherit' ) $cff_event_details_styles .= 'font-weight:' . $cff_event_details_weight . '; ';
238 if ( !empty($cff_event_details_color) ) $cff_event_details_styles .= 'color:#' . $cff_event_details_color . ';';
239 $cff_event_details_styles .= '"';
240 //Date
241 $cff_date_position = $atts[ 'datepos' ];
242 if (!isset($cff_date_position)) $cff_date_position = 'below';
243 $cff_date_size = $atts[ 'datesize' ];
244 $cff_date_weight = $atts[ 'dateweight' ];
245 $cff_date_color = $atts[ 'datecolor' ];
246 $cff_date_styles = 'style="';
247 if ( !empty($cff_date_size) && $cff_date_size != 'inherit' ) $cff_date_styles .= 'font-size:' . $cff_date_size . 'px; ';
248 if ( !empty($cff_date_weight) && $cff_date_weight != 'inherit' ) $cff_date_styles .= 'font-weight:' . $cff_date_weight . '; ';
249 if ( !empty($cff_date_color) ) $cff_date_styles .= 'color:#' . $cff_date_color . ';';
250 $cff_date_styles .= '"';
251 $cff_date_before = $options[ 'cff_date_before' ];
252 $cff_date_after = $options[ 'cff_date_after' ];
253 //Link to Facebook
254 $cff_link_size = $atts[ 'linksize' ];
255 $cff_link_weight = $atts[ 'linkweight' ];
256 $cff_link_color = $atts[ 'linkcolor' ];
257 $cff_link_styles = 'style="';
258 if ( !empty($cff_link_size) && $cff_link_size != 'inherit' ) $cff_link_styles .= 'font-size:' . $cff_link_size . 'px; ';
259 if ( !empty($cff_link_weight) && $cff_link_weight != 'inherit' ) $cff_link_styles .= 'font-weight:' . $cff_link_weight . '; ';
260 if ( !empty($cff_link_color) ) $cff_link_styles .= 'color:#' . $cff_link_color . ';';
261 $cff_link_styles .= '"';
262 $cff_facebook_link_text = $atts[ 'facebooklinktext' ];
263 $cff_view_link_text = $atts[ 'viewlinktext' ];
264 $cff_link_to_timeline = $atts[ 'linktotimeline' ];
265 /********** MISC **********/
266 //Like Box styles
267 $cff_likebox_bg_color = $atts[ 'likeboxcolor' ];
268 $cff_likebox_styles = 'style="';
269 if ( !empty($cff_likebox_bg_color) ) $cff_likebox_styles .= 'background-color:#' . $cff_likebox_bg_color . '; margin-left: 0; ';
270 $cff_likebox_styles .= '"';
271 //Video
272 //Dimensions
273 $cff_video_width = 640;
274 $cff_video_height = $atts[ 'videoheight' ];
275
276 //Action
277 $cff_video_action = $atts[ 'videoaction' ];
278 //Separating Line
279 $cff_sep_color = $atts[ 'sepcolor' ];
280 if (empty($cff_sep_color)) $cff_sep_color = 'ddd';
281 $cff_sep_size = $atts[ 'sepsize' ];
282 if (empty($cff_sep_size)) $cff_sep_size = 0;
283 //CFF item styles
284 $cff_item_styles = 'style="';
285 $cff_item_styles .= 'border-bottom: ' . $cff_sep_size . 'px solid #' . $cff_sep_color . '; ';
286 $cff_item_styles .= '"';
287
288 //Text limits
289 $title_limit = $atts['textlength'];
290 if (!isset($title_limit)) $title_limit = 9999;
291 $body_limit = $atts['desclength'];
292 //Assign the Access Token and Page ID variables
293 $access_token = get_option('cff_access_token');
294 $page_id = $atts['id'];
295 //Get show posts attribute. If not set then default to 25
296 $show_posts = $atts['num'];
297 if (empty($show_posts)) $show_posts = 25;
298 if ( $show_posts == 0 || $show_posts == 'undefined' ) $show_posts = 25;
299 //Check whether the Access Token is present and valid
300 if ($access_token == '') {
301 echo 'Please enter a valid Access Token. You can do this in the Custom Facebook Feed plugin settings.<br /><br />';
302 return false;
303 }
304 //Check whether a Page ID has been defined
305 if ($page_id == '') {
306 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 />";
307 return false;
308 }
309 //Use posts? or feed?
310 $show_others = $atts['others'];
311 $graph_query = 'posts';
312 if ($show_others == 'on' || $show_others == 'true' || $show_others == true) $graph_query = 'feed';
313 $cff_post_limit = $atts['limit'];
314 //Calculate the cache time in seconds
315 if($cff_cache_time_unit == 'minutes') $cff_cache_time_unit = 60;
316 if($cff_cache_time_unit == 'hours') $cff_cache_time_unit = 60*60;
317 if($cff_cache_time_unit == 'days') $cff_cache_time_unit = 60*60*24;
318 $cache_seconds = $cff_cache_time * $cff_cache_time_unit;
319
320 //Get like box vars
321 $cff_likebox_width = $atts[ 'likeboxwidth' ];
322 if ( !isset($cff_likebox_width) || empty($cff_likebox_width) || $cff_likebox_width == '' ) $cff_likebox_width = 300;
323 $cff_like_box_faces = $atts[ 'likeboxfaces' ];
324 if ( !isset($cff_like_box_faces) || empty($cff_like_box_faces) ) $cff_like_box_faces = 'false';
325
326 //Set like box variable
327 $like_box = '<div class="cff-likebox';
328 if ($cff_like_box_outside) $like_box .= ' cff-outside';
329 $like_box .= ($cff_like_box_position == 'top') ? ' cff-top' : ' cff-bottom';
330 $like_box .= '"' . $cff_likebox_styles . '><script src="http://connect.facebook.net/' . $cff_locale . '/all.js#xfbml=1"></script><fb:like-box href="http://www.facebook.com/' . $page_id . '" width="'.$cff_likebox_width.'" show_faces="'.$cff_like_box_faces.'" stream="false" header="false"></fb:like-box></div>';
331 //***START FEED***
332 $content = '';
333 //Add like box to the outside of the top of feed
334 if ($cff_like_box_position == 'top' && $cff_show_like_box && $cff_like_box_outside) $content .= $like_box;
335 //Create CFF container HTML
336 $content .= '<div id="cff" rel="'.$title_limit.'" class="';
337 if( !empty($cff_class) ) $content .= $cff_class . ' ';
338 if ( !empty($cff_feed_height) ) $content .= 'cff-fixed-height ';
339 $content .= '" ' . $cff_feed_styles . '>';
340 //Add like box to the inside of the top of feed
341 if ($cff_like_box_position == 'top' && $cff_show_like_box && !$cff_like_box_outside) $content .= $like_box;
342 //Limit var
343 $i = 0;
344
345
346 //ALL POSTS
347 if (!$cff_events_only){
348
349 $cff_posts_json_url = 'https://graph.facebook.com/' . $page_id . '/' . $graph_query . '?access_token=' . $access_token . '&limit=' . $cff_post_limit . '&locale=' . $cff_locale;
350
351 //Don't use caching if the cache time is set to zero
352 if ($cff_cache_time != 0){
353 // Get any existing copy of our transient data
354 $transient_name = 'cff_'. $graph_query .'_json_' . $page_id;
355 if ( false === ( $posts_json = get_transient( $transient_name ) ) || $posts_json === null ) {
356 //Get the contents of the Facebook page
357 $posts_json = cff_fetchUrl($cff_posts_json_url);
358 //Cache the JSON
359 set_transient( $transient_name, $posts_json, $cache_seconds );
360 } else {
361 $posts_json = get_transient( $transient_name );
362 }
363 } else {
364 $posts_json = cff_fetchUrl($cff_posts_json_url);
365 }
366
367 //Interpret data with JSON
368 $FBdata = json_decode($posts_json);
369 //***STARTS POSTS LOOP***
370 foreach ($FBdata->data as $news )
371 {
372 //Explode News and Page ID's into 2 values
373 $PostID = explode("_", $news->id);
374 //Check the post type
375 $cff_post_type = $news->type;
376 if ($cff_post_type == 'link') {
377 isset($news->story) ? $story = $news->story : $story = '';
378 //Check whether it's an event
379 $event_link_check = "facebook.com/events/";
380 $event_link_check = stripos($news->link, $event_link_check);
381 if ( $event_link_check ) $cff_post_type = 'event';
382 }
383 //Should we show this post or not?
384 $cff_show_post = false;
385 switch ($cff_post_type) {
386 case 'link':
387 if ( $cff_show_links_type ) $cff_show_post = true;
388 break;
389 case 'event':
390 if ( $cff_show_event_type ) $cff_show_post = true;
391 break;
392 case 'video':
393 if ( $cff_show_video_type ) $cff_show_post = true;
394 break;
395 case 'swf':
396 if ( $cff_show_video_type ) $cff_show_post = true;
397 break;
398 case 'photo':
399 if ( $cff_show_photos_type ) $cff_show_post = true;
400 break;
401 case 'offer':
402 $cff_show_post = true;
403 break;
404 case 'status':
405 //Check whether it's a status (author comment or like)
406 if ( $cff_show_status_type && !empty($news->message) ) $cff_show_post = true;
407 break;
408 }
409
410 //Is it a duplicate post?
411 if (!isset($prev_post_message)) $prev_post_message = '';
412 if (!isset($prev_post_link)) $prev_post_link = '';
413 if (!isset($prev_post_description)) $prev_post_description = '';
414 isset($news->message) ? $pm = $news->message : $pm = '';
415 isset($news->link) ? $pl = $news->link : $pl = '';
416 isset($news->description) ? $pd = $news->description : $pd = '';
417
418 if ( ($prev_post_message == $pm) && ($prev_post_link == $pl) && ($prev_post_description == $pd) ) $cff_show_post = false;
419
420 //Check post type and display post if selected
421 if ( $cff_show_post ) {
422 //If it isn't then create the post
423 //Only create posts for the amount of posts specified
424 if ( $i == $show_posts ) break;
425 $i++;
426 //********************************//
427 //***COMPILE SECTION VARIABLES***//
428 //********************************//
429 //Set the post link
430 isset($news->link) ? $link = $news->link : $link = '';
431 //Is it a shared album?
432 $shared_album_string = 'shared an album:';
433 isset($news->story) ? $story = $news->story : $story = '';
434 $shared_album = stripos($story, $shared_album_string);
435 if ( $shared_album ) {
436 $link = str_replace('photo.php?','media/set/?',$link);
437 }
438
439 //If there's no link provided then link to either the Facebook page or the individual status
440 if (empty($news->link)) {
441 if ($cff_link_to_timeline == true){
442 //Link to page
443 $link = 'http://facebook.com/' . $page_id;
444 } else {
445 //Link to status
446 $link = "https://www.facebook.com/" . $page_id . "/posts/" . $PostID[1];
447 }
448 }
449
450 //POST AUTHOR
451 $cff_author = '<a class="cff-author" href="http://facebook.com/' . $news->from->id . '" '.$target.' title="'.$news->from->name.' on Facebook">';
452 $cff_author .= '<img src="http://graph.facebook.com/' . $news->from->id . '/picture">';
453 $cff_author .= '<p>'.$news->from->name.'</p>';
454 $cff_author .= '</a>';
455 //POST TEXT
456 $cff_post_text = '<' . $cff_title_format . ' class="cff-post-text" ' . $cff_title_styles . '>';
457 $cff_post_text .= '<span class="cff-text">';
458 if ($cff_title_link) $cff_post_text .= '<a class="cff-post-text-link" href="'.$link.'" '.$target.'>';
459 if (!empty($news->story)) $post_text = $news->story;
460 if (!empty($news->message)) $post_text = $news->message;
461 //Use the name if neither the story or message are available, or if the post type is an offer
462 if ( (!empty($news->name) && empty($news->story) && empty($news->message)) || $cff_post_type == 'offer') $post_text = $news->name;
463 //If the text is wrapped in a link then don't hyperlink any text within
464 if ($cff_title_link) {
465 //Wrap links in a span so we can break the text if it's too long
466 $cff_post_text .= cff_wrap_span($post_text) . ' ';
467 } else {
468 $cff_post_text .= cff_make_clickable($post_text) . ' ';
469 }
470
471 if ($cff_title_link) $cff_post_text .= '</a>';
472 $cff_post_text .= '</span>';
473 //'See More' link
474 $cff_post_text .= '<span class="cff-expand">... <a href="#"><span class="cff-more">' . $cff_see_more_text . '</span><span class="cff-less">' . $cff_see_less_text . '</span></a></span>';
475 $cff_post_text .= '</' . $cff_title_format . '>';
476 //DESCRIPTION
477 $cff_description = '';
478 //Use the description if it's available and the post type isn't set to offer (offer description isn't useful)
479 if (!empty($news->description) && $cff_post_type != 'offer') {
480 $description_text = $news->description;
481 if (!empty($body_limit)) {
482 if (strlen($description_text) > $body_limit) $description_text = substr($description_text, 0, $body_limit) . '...';
483 }
484 $cff_description .= '<p class="cff-post-desc" '.$cff_body_styles.'><span>' . cff_make_clickable($description_text) . '</span></p>';
485 }
486 //LINK
487 $cff_shared_link = '';
488 //Display shared link
489 if ($news->type == 'link') {
490 //Display link name and description
491 if (!empty($news->description)) {
492 $cff_shared_link .= '<p class="cff-text-link ';
493 $cff_shared_link .= 'cff-no-image';
494 $cff_shared_link .= '"><a href="'.$link.'" '.$target.'>'. '<b>' . $news->name . '</b></a></p>';
495 }
496 }
497 //DATE
498 $cff_date_formatting = $atts[ 'dateformat' ];
499 $cff_date_custom = $atts[ 'datecustom' ];
500 $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>';
501 //EVENT
502 $cff_event = '';
503 if ($cff_show_event_title || $cff_show_event_details) {
504 //Check for media
505 if ($cff_post_type == 'event') {
506
507 //Get the event id from the event URL. eg: http://www.facebook.com/events/123451234512345/
508 $event_url = parse_url($link);
509 $url_parts = explode('/', $event_url['path']);
510 //Get the id from the parts
511 $eventID = $url_parts[count($url_parts)-2];
512
513 //Get the contents of the event using the WP HTTP API
514 $event_json = cff_fetchUrl('https://graph.facebook.com/'.$eventID.'?access_token=' . $access_token);
515 //Interpret data with JSON
516 $event_object = json_decode($event_json);
517 //Event date
518 $event_time = $event_object->start_time;
519 //If timezone migration is enabled then remove last 5 characters
520 if ( strlen($event_time) == 24 ) $event_time = substr($event_time, 0, -5);
521 if (!empty($event_time)) $cff_event_date = '<p class="cff-date" '.$cff_event_date_styles.'>' . cff_eventdate(strtotime($event_time), $cff_event_date_formatting, $cff_event_date_custom) . '</p>';
522 //EVENT
523 //Display the event details
524 $cff_event .= '<div class="cff-details">';
525 //show event date above title
526 if ($cff_event_date_position == 'above') $cff_event .= $cff_event_date;
527 //Show event title
528 if ($cff_show_event_title && !empty($event_object->name)) {
529 if ($cff_event_title_link) $cff_event .= '<a href="'.$link.'">';
530 $cff_event .= '<' . $cff_event_title_format . ' ' . $cff_event_title_styles . '>' . $event_object->name . '</' . $cff_event_title_format . '>';
531 if ($cff_event_title_link) $cff_event .= '</a>';
532 }
533 //show event date below title
534 if ($cff_event_date_position !== 'above') $cff_event .= $cff_event_date;
535 //Show event details
536 if ($cff_show_event_details){
537 //Location
538 if (!empty($event_object->location)) $cff_event .= '<p class="cff-where" ' . $cff_event_details_styles . '>' . $event_object->location . '</p>';
539 //Description
540 if (!empty($event_object->description)){
541 $description = $event_object->description;
542 if (!empty($body_limit)) {
543 if (strlen($description) > $body_limit) $description = substr($description, 0, $body_limit) . '...';
544 }
545 $cff_event .= '<p class="cff-info" ' . $cff_event_details_styles . '>' . cff_make_clickable($description) . '</p>';
546 }
547 }
548 $cff_event .= '</div>';
549
550 }
551 }
552
553 //Display the link to the Facebook post or external link
554 $cff_link = '';
555 //Default link
556 $cff_viewpost_class = 'cff-viewpost-facebook';
557 if ($cff_facebook_link_text == '') $cff_facebook_link_text = 'View on Facebook';
558 $link_text = $cff_facebook_link_text;
559 if (!empty($news->link)) {
560 //Check whether it links to facebook or somewhere else
561 $facebook_str = 'facebook.com';
562 if(stripos($link, $facebook_str) == false) {
563 if ($cff_view_link_text == '') $cff_view_link_text = 'View Link';
564 $link_text = $cff_view_link_text;
565 }
566 $cff_viewpost_class = 'cff-viewpost-link';
567 }
568 if ($cff_post_type == 'offer') $link_text = 'View Offer';
569 $cff_link = '<a class="' . $cff_viewpost_class . '" href="' . $link . '" title="' . $link_text . '" ' . $target . ' ' . $cff_link_styles . '>' . $link_text . '</a>';
570 //**************************//
571 //***CREATE THE POST HTML***//
572 //**************************//
573 //Start the container
574 $content .= '<div class="cff-item ';
575 if ($cff_post_type == 'link') $content .= 'cff-link-item';
576 if ($cff_post_type == 'event') $content .= 'cff-timeline-event';
577 if ($cff_post_type == 'photo') $content .= 'cff-photo-post';
578 if ($cff_post_type == 'video') $content .= 'cff-video-post';
579 if ($cff_post_type == 'swf') $content .= 'cff-swf-post';
580 if ($cff_post_type == 'status') $content .= 'cff-status-post';
581 if ($cff_post_type == 'offer') $content .= 'cff-offer-post';
582 $content .= '" id="'. $news->id .'" ' . $cff_item_styles . '>';
583
584 //POST AUTHOR
585 if($cff_show_author) $content .= $cff_author;
586 //DATE ABOVE
587 if ($cff_show_date && $cff_date_position == 'above') $content .= $cff_date;
588 //POST TEXT
589 if($cff_show_text) $content .= $cff_post_text;
590 //DESCRIPTION
591 if($cff_show_desc) $content .= $cff_description;
592 //LINK
593 if($cff_show_shared_links) $content .= $cff_shared_link;
594 //DATE BELOW
595 if ($cff_show_date && $cff_date_position == 'below') $content .= $cff_date;
596 //EVENT
597 if($cff_show_event_title || $cff_show_event_details) $content .= $cff_event;
598 //VIEW ON FACEBOOK LINK
599 if($cff_show_link) $content .= $cff_link;
600
601 //End the post item
602 $content .= '</div><div class="cff-clear"></div>';
603 } // End post type check
604
605 if (isset($news->message)) $prev_post_message = $news->message;
606 if (isset($news->link)) $prev_post_link = $news->link;
607 if (isset($news->description)) $prev_post_description = $news->description;
608
609 } // End the loop
610 } // End ALL POSTS
611 //Load more posts
612 // $content .= '<button class="loadmore">Load More Posts</button>';
613 //Add the Like Box inside
614 if ($cff_like_box_position == 'bottom' && $cff_show_like_box && !$cff_like_box_outside) $content .= $like_box;
615 //End the feed
616 $content .= '</div><div class="cff-clear"></div>';
617 //Add the Like Box outside
618 if ($cff_like_box_position == 'bottom' && $cff_show_like_box && $cff_like_box_outside) $content .= $like_box;
619 //Return our feed HTML to display
620 return $content;
621 }
622 //Get JSON object of feed data
623 function cff_fetchUrl($url){
624 //Can we use file_get_contents?
625 if ( ini_get('allow_url_fopen') == 1 || ini_get('allow_url_fopen') === TRUE ) {
626 $feedData = @file_get_contents($url);
627 //If not then can we use cURL?
628 } elseif(is_callable('curl_init')){
629 $ch = curl_init();
630 curl_setopt($ch, CURLOPT_URL, $url);
631 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
632 curl_setopt($ch, CURLOPT_TIMEOUT, 20);
633 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
634 $feedData = curl_exec($ch);
635 curl_close($ch);
636 //Else use the WP HTTP API
637 } else {
638 if( !class_exists( 'WP_Http' ) ) include_once( ABSPATH . WPINC. '/class-http.php' );
639 $request = new WP_Http;
640 $result = $request->request($url);
641 $feedData = $result['body'];
642 }
643
644 return $feedData;
645 }
646 //***FUNCTIONS***
647 //Make links in text clickable
648 function cff_make_clickable($text) {
649 $pattern = '#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#';
650 return preg_replace_callback($pattern, 'cff_auto_link_text_callback', $text);
651 }
652 function cff_auto_link_text_callback($matches) {
653 $max_url_length = 50;
654 $max_depth_if_over_length = 2;
655 $ellipsis = '&hellip;';
656 $target = 'target="_blank"';
657 $url_full = $matches[0];
658 $url_short = '';
659 if (strlen($url_full) > $max_url_length) {
660 $parts = parse_url($url_full);
661 $url_short = $parts['scheme'] . '://' . preg_replace('/^www\./', '', $parts['host']) . '/';
662 $path_components = explode('/', trim($parts['path'], '/'));
663 foreach ($path_components as $dir) {
664 $url_string_components[] = $dir . '/';
665 }
666 if (!empty($parts['query'])) {
667 $url_string_components[] = '?' . $parts['query'];
668 }
669 if (!empty($parts['fragment'])) {
670 $url_string_components[] = '#' . $parts['fragment'];
671 }
672 for ($k = 0; $k < count($url_string_components); $k++) {
673 $curr_component = $url_string_components[$k];
674 if ($k >= $max_depth_if_over_length || strlen($url_short) + strlen($curr_component) > $max_url_length) {
675 if ($k == 0 && strlen($url_short) < $max_url_length) {
676 // Always show a portion of first directory
677 $url_short .= substr($curr_component, 0, $max_url_length - strlen($url_short));
678 }
679 $url_short .= $ellipsis;
680 break;
681 }
682 $url_short .= $curr_component;
683 }
684 } else {
685 $url_short = $url_full;
686 }
687 return "<a class='cff-break-word' rel=\"nofollow\" href=\"$url_full\">$url_full</a>";
688 }
689 //Make links into span instead when the post text is made clickable
690 function cff_wrap_span($text) {
691 $pattern = '#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#';
692 return preg_replace_callback($pattern, 'cff_wrap_span_callback', $text);
693 }
694 function cff_wrap_span_callback($matches) {
695 $max_url_length = 50;
696 $max_depth_if_over_length = 2;
697 $ellipsis = '&hellip;';
698 $target = 'target="_blank"';
699 $url_full = $matches[0];
700 $url_short = '';
701 if (strlen($url_full) > $max_url_length) {
702 $parts = parse_url($url_full);
703 $url_short = $parts['scheme'] . '://' . preg_replace('/^www\./', '', $parts['host']) . '/';
704 $path_components = explode('/', trim($parts['path'], '/'));
705 foreach ($path_components as $dir) {
706 $url_string_components[] = $dir . '/';
707 }
708 if (!empty($parts['query'])) {
709 $url_string_components[] = '?' . $parts['query'];
710 }
711 if (!empty($parts['fragment'])) {
712 $url_string_components[] = '#' . $parts['fragment'];
713 }
714 for ($k = 0; $k < count($url_string_components); $k++) {
715 $curr_component = $url_string_components[$k];
716 if ($k >= $max_depth_if_over_length || strlen($url_short) + strlen($curr_component) > $max_url_length) {
717 if ($k == 0 && strlen($url_short) < $max_url_length) {
718 // Always show a portion of first directory
719 $url_short .= substr($curr_component, 0, $max_url_length - strlen($url_short));
720 }
721 $url_short .= $ellipsis;
722 break;
723 }
724 $url_short .= $curr_component;
725 }
726 } else {
727 $url_short = $url_full;
728 }
729 return "<span class='cff-break-word'>$url_short</span>";
730 }
731 //2013-04-28T21:06:56+0000
732 //Time stamp function - used for posts
733 function cff_getdate($original, $date_format, $custom_date) {
734 switch ($date_format) {
735
736 case '2':
737 $print = date_i18n('F jS, g:i a', $original);
738 break;
739 case '3':
740 $print = date_i18n('F jS', $original);
741 break;
742 case '4':
743 $print = date_i18n('D F jS', $original);
744 break;
745 case '5':
746 $print = date_i18n('l F jS', $original);
747 break;
748 case '6':
749 $print = date_i18n('D M jS, Y', $original);
750 break;
751 case '7':
752 $print = date_i18n('l F jS, Y', $original);
753 break;
754 case '8':
755 $print = date_i18n('l F jS, Y - g:i a', $original);
756 break;
757 case '9':
758 $print = date_i18n("l M jS, 'y", $original);
759 break;
760 case '10':
761 $print = date_i18n('m.d.y', $original);
762 break;
763 case '11':
764 $print = date_i18n('m/d/y', $original);
765 break;
766 case '12':
767 $print = date_i18n('d.m.y', $original);
768 break;
769 case '13':
770 $print = date_i18n('d/m/y', $original);
771 break;
772 default:
773
774 $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
775 $lengths = array("60","60","24","7","4.35","12","10");
776 $now = time();
777
778 // is it future date or past date
779 if($now > $original) {
780 $difference = $now - $original;
781 $tense = "ago";
782 } else {
783 $difference = $original - $now;
784 $tense = "from now";
785 }
786 for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
787 $difference /= $lengths[$j];
788 }
789
790 $difference = round($difference);
791
792 if($difference != 1) {
793 $periods[$j].= "s";
794 }
795 $print = "$difference $periods[$j] {$tense}";
796 break;
797
798 }
799 if ( !empty($custom_date) ){
800 $print = date_i18n($custom_date, $original);
801 }
802 return $print;
803 }
804 function cff_eventdate($original, $date_format, $custom_date) {
805 switch ($date_format) {
806
807 case '2':
808 $print = date_i18n('F jS, g:ia', $original);
809 break;
810 case '3':
811 $print = date_i18n('g:ia - F jS', $original);
812 break;
813 case '4':
814 $print = date_i18n('g:ia, F jS', $original);
815 break;
816 case '5':
817 $print = date_i18n('l F jS - g:ia', $original);
818 break;
819 case '6':
820 $print = date_i18n('D M jS, Y, g:iA', $original);
821 break;
822 case '7':
823 $print = date_i18n('l F jS, Y, g:iA', $original);
824 break;
825 case '8':
826 $print = date_i18n('l F jS, Y - g:ia', $original);
827 break;
828 case '9':
829 $print = date_i18n("l M jS, 'y", $original);
830 break;
831 case '10':
832 $print = date_i18n('m.d.y - g:iA', $original);
833 break;
834 case '11':
835 $print = date_i18n('m/d/y, g:ia', $original);
836 break;
837 case '12':
838 $print = date_i18n('d.m.y - g:iA', $original);
839 break;
840 case '13':
841 $print = date_i18n('d/m/y, g:ia', $original);
842 break;
843 default:
844 $print = date_i18n('F j, Y, g:ia', $original);
845 break;
846 }
847 if ( !empty($custom_date) ){
848 $print = date_i18n($custom_date, $original);
849 }
850 return $print;
851 }
852 //Time stamp function - used for comments
853 function cff_timesince($original) {
854
855 $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
856 $lengths = array("60","60","24","7","4.35","12","10");
857 $now = time();
858
859 // is it future date or past date
860 if($now > $original) {
861 $difference = $now - $original;
862 $tense = "ago";
863 } else {
864 $difference = $original - $now;
865 $tense = "from now";
866 }
867 for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
868 $difference /= $lengths[$j];
869 }
870
871 $difference = round($difference);
872
873 if($difference != 1) {
874 $periods[$j].= "s";
875 }
876 return "$difference $periods[$j] {$tense}";
877
878 }
879 //Use custom stripos function if it's not available (only available in PHP 5+)
880 if(!is_callable('stripos')){
881 function stripos($haystack, $needle){
882 return strpos($haystack, stristr( $haystack, $needle ));
883 }
884 }
885
886 // remove_filter( 'the_content', 'wpautop' );
887 // add_filter( 'the_content', 'wpautop', 99 );
888
889 //Enqueue stylesheet
890 add_action( 'wp_enqueue_scripts', 'cff_add_my_stylesheet' );
891 function cff_add_my_stylesheet() {
892 // Respects SSL, Style.css is relative to the current file
893 wp_register_style( 'cff', plugins_url('css/cff-style.css?3', __FILE__) );
894 wp_enqueue_style( 'cff' );
895 }
896 //Enqueue scripts
897 add_action( 'wp_enqueue_scripts', 'cff_scripts_method' );
898 function cff_scripts_method() {
899 wp_enqueue_script(
900 'cffscripts',
901 plugins_url( '/js/cff-scripts.js?3' , __FILE__ ),
902 array( 'jquery' )
903 );
904 }
905 //Allows shortcodes in theme
906 add_filter('widget_text', 'do_shortcode');
907 function cff_activate() {
908 $options = get_option('cff_style_settings');
909 $options[ 'cff_show_links_type' ] = true;
910 $options[ 'cff_show_event_type' ] = true;
911 $options[ 'cff_show_video_type' ] = true;
912 $options[ 'cff_show_photos_type' ] = true;
913 $options[ 'cff_show_status_type' ] = true;
914 // Show all parts of the feed by default on activation
915 $options[ 'cff_show_text' ] = true;
916 $options[ 'cff_show_desc' ] = true;
917 $options[ 'cff_show_shared_links' ] = true;
918 $options[ 'cff_show_date' ] = true;
919 $options[ 'cff_show_media' ] = true;
920 $options[ 'cff_show_event_title' ] = true;
921 $options[ 'cff_show_event_details' ] = true;
922 $options[ 'cff_show_meta' ] = true;
923 $options[ 'cff_show_link' ] = true;
924 $options[ 'cff_show_like_box' ] = true;
925 update_option( 'cff_style_settings', $options );
926 }
927 register_activation_hook( __FILE__, 'cff_activate' );
928 //Uninstall
929 function cff_uninstall()
930 {
931 if ( ! current_user_can( 'activate_plugins' ) )
932 return;
933 //Settings
934 delete_option( 'cff_access_token' );
935 delete_option( 'cff_page_id' );
936 delete_option( 'cff_num_show' );
937 delete_option( 'cff_post_limit' );
938 delete_option( 'cff_show_others' );
939 delete_option('cff_cache_time');
940 delete_option('cff_cache_time_unit');
941 delete_option( 'cff_locale' );
942 //Style & Layout
943 delete_option( 'cff_title_length' );
944 delete_option( 'cff_body_length' );
945 delete_option('cff_style_settings');
946 }
947 register_uninstall_hook( __FILE__, 'cff_uninstall' );
948 add_action( 'wp_head', 'cff_custom_css' );
949 function cff_custom_css() {
950 $options = get_option('cff_style_settings');
951 $cff_custom_css = $options[ 'cff_custom_css' ];
952 echo '<!-- Custom Facebook Feed Custom CSS -->';
953 echo "\r\n";
954 echo '<style type="text/css">';
955 echo "\r\n";
956 echo $cff_custom_css;
957 echo "\r\n";
958 echo '</style>';
959 echo "\r\n";
960 }
961 add_action( 'wp_footer', 'cff_js' );
962 function cff_js() {
963 // $path = site_url();
964 $url = site_url();
965 $path = urlencode(ABSPATH);
966 echo '<!-- Custom Facebook Feed JS -->';
967 echo "\r\n";
968 echo '<script type="text/javascript">';
969 echo "\r\n";
970 echo 'var siteURL = "' . $url . '";';
971 echo "\r\n";
972 echo 'var rootPath = "' . $path . '";';
973 echo "\r\n";
974 echo '</script>';
975 echo "\r\n";
976 }
977
978 //Comment out the line below to view errors
979 error_reporting(0);
980 ?>